Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big refactor of the plugin and new options addition #167

Merged
merged 9 commits into from
Oct 19, 2024
82 changes: 60 additions & 22 deletions README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
"test:clean": "rm -rf dist .nyc_output coverage || true",
"test:ts": "tsc --noEmit",
"test:run": "dotenv playwright test",
"test:run:tag": "dotenv -- playwright test --grep @testing",
"test:open": "playwright test --ui",
"test:ci": "pnpm test:clean && pnpm demo && pnpm start:playwright && pnpm stop:ha",
"test:tag": "pnpm reset:ha && pnpm test:clean && pnpm demo && pnpm tag:playwright && pnpm stop:ha",
"test:all": "pnpm lint && pnpm test:ts && pnpm test:ci",
"demo": "pnpm build && pnpm start:ha",
"start:ha": "docker run --rm -d -p8123:8123 --shm-size=512m -v ${PWD}/.hass/config:/config homeassistant/home-assistant:${TAG:-$(cat .hass/config/.HA_VERSION)}",
"stop:ha": "docker stop $(docker ps -a -q --filter ancestor=homeassistant/home-assistant:${TAG:-$(cat .hass/config/.HA_VERSION)}) || true",
"start:playwright": "docker run --rm --network host --add-host host.docker.internal:host-gateway -v $(pwd):/$(pwd)/ -w $(pwd) -i mcr.microsoft.com/playwright:v$npm_package_devDependencies__playwright_test-jammy sh -c \"yarn test:run && exit\"",
"tag:playwright": "docker run --rm --network host --add-host host.docker.internal:host-gateway -v $(pwd):/$(pwd)/ -w $(pwd) -i mcr.microsoft.com/playwright:v$npm_package_devDependencies__playwright_test-jammy sh -c \"yarn test:run:tag && exit\"",
"coverage:report": "nyc report --reporter=lcov --reporter=text-summary",
"reset:ha": "git add .hass/config/.HA_VERSION && git checkout .hass/config",
"preinstall": "npx -y only-allow pnpm",
Expand Down
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default defineConfig({
expect: {
timeout: 15000,
toHaveScreenshot: {
maxDiffPixels: 25,
threshold: 0.7,
maxDiffPixels: 15,
threshold: 0.5,
animations: 'disabled'
}
},
Expand Down
20 changes: 20 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ export enum SELECTOR {
SCOPE = ':scope',
TITLE = '.title',
ITEM = 'a[role="option"]',
ITEM_SELECTED = '.iron-selected',
SPACER = '.spacer',
ITEM_TEXT = '.item-text',
NOTIFICATION_BADGE = '.notification-badge',
NOTIFICATIONS_BADGE_COLLAPSED = '.notification-badge-collapsed',
CONFIGURATION_BADGE = '.configuration-badge',
HA_MENU_BUTTON = 'ha-panel-lovelace$ hui-root$ .toolbar > ha-menu-button',
EDIT_SIDEBAR_BUTTON = 'ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button',
SIDEBAR_NOTIFICATIONS = '.notifications',
Expand All @@ -39,6 +41,24 @@ export enum SELECTOR {
HA_ICON_BUTTON = 'ha-icon-button'
}

export enum CSS_VARIABLES {
SIDEBAR_ICON_COLOR = '--sidebar-icon-color',
SIDEBAR_SELECTED_ICON_COLOR= '--sidebar-selected-icon-color',
SIDEBAR_TEXT_COLOR = '--sidebar-text-color',
SIDEBAR_SELECTED_TEXT_COLOR = '--sidebar-selected-text-color',
SIDEBAR_BACKGROUND_COLOR = '--sidebar-background-color',
SIDEBAR_TITLE_COLOR = '--sidebar-menu-button-text-color',
SIDEBAR_BUTTON_COLOR = '--sidebar-icon-color',
CUSTOM_SIDEBAR_TEXT_COLOR = '--custom-sidebar-text-color',
CUSTOM_SIDEBAR_SELECTED_TEXT_COLOR = '--custom-sidebar-selected-text-color',
CUSTOM_SIDEBAR_ICON_COLOR = '--custom-sidebar-icon-color',
CUSTOM_SIDEBAR_SELECTED_ICON_COLOR = '--custom-sidebar-selected-icon-color',
CUSTOM_SIDEBAR_SELECTION_COLOR = '--custom-sidebar-selection-color',
CUSTOM_SIDEBAR_INFO_COLOR = '--custom-sidebar-info-color',
CUSTOM_SIDEBAR_SELECTED_INFO_COLOR = '--custom-sidebar-selected-info-color',
CUSTOM_SIDEBAR_NOTIFICATION_COLOR = '--custom-sidebar-notification-color',
}

export enum CLASS {
NOTIFICATIONS_BADGE = 'notification-badge',
NOTIFICATIONS_BADGE_COLLAPSED = 'notification-badge-collapsed',
Expand Down
Loading
Loading