@furystack/shades-common-components 12.6.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +183 -0
- package/README.md +218 -4
- package/esm/components/accordion/accordion-item.d.ts +1 -1
- package/esm/components/accordion/accordion-item.d.ts.map +1 -1
- package/esm/components/accordion/accordion-item.js +6 -11
- package/esm/components/accordion/accordion-item.js.map +1 -1
- package/esm/components/accordion/accordion.d.ts.map +1 -1
- package/esm/components/accordion/accordion.js +1 -0
- package/esm/components/accordion/accordion.js.map +1 -1
- package/esm/components/app-bar-link.d.ts.map +1 -1
- package/esm/components/app-bar-link.js +1 -0
- package/esm/components/app-bar-link.js.map +1 -1
- package/esm/components/app-bar.d.ts.map +1 -1
- package/esm/components/app-bar.js +2 -0
- package/esm/components/app-bar.js.map +1 -1
- package/esm/components/app-bar.spec.js +3 -3
- package/esm/components/app-bar.spec.js.map +1 -1
- package/esm/components/avatar.d.ts.map +1 -1
- package/esm/components/avatar.js +1 -0
- package/esm/components/avatar.js.map +1 -1
- package/esm/components/badge.d.ts.map +1 -1
- package/esm/components/badge.js +2 -1
- package/esm/components/badge.js.map +1 -1
- package/esm/components/breadcrumb.d.ts.map +1 -1
- package/esm/components/breadcrumb.js +1 -0
- package/esm/components/breadcrumb.js.map +1 -1
- package/esm/components/button-group.d.ts.map +1 -1
- package/esm/components/button-group.js +57 -60
- package/esm/components/button-group.js.map +1 -1
- package/esm/components/button-group.spec.js +7 -6
- package/esm/components/button-group.spec.js.map +1 -1
- package/esm/components/button.d.ts.map +1 -1
- package/esm/components/button.js +1 -0
- package/esm/components/button.js.map +1 -1
- package/esm/components/cache-view.d.ts.map +1 -1
- package/esm/components/cache-view.js +4 -0
- package/esm/components/cache-view.js.map +1 -1
- package/esm/components/cache-view.spec.js +4 -1
- package/esm/components/cache-view.spec.js.map +1 -1
- package/esm/components/card.d.ts.map +1 -1
- package/esm/components/card.js +3 -1
- package/esm/components/card.js.map +1 -1
- package/esm/components/circular-progress.d.ts.map +1 -1
- package/esm/components/circular-progress.js +1 -0
- package/esm/components/circular-progress.js.map +1 -1
- package/esm/components/command-palette/command-palette-input.d.ts.map +1 -1
- package/esm/components/command-palette/command-palette-input.js +1 -0
- package/esm/components/command-palette/command-palette-input.js.map +1 -1
- package/esm/components/command-palette/command-palette-suggestion-list.d.ts.map +1 -1
- package/esm/components/command-palette/command-palette-suggestion-list.js +3 -1
- package/esm/components/command-palette/command-palette-suggestion-list.js.map +1 -1
- package/esm/components/command-palette/index.d.ts.map +1 -1
- package/esm/components/command-palette/index.js +2 -0
- package/esm/components/command-palette/index.js.map +1 -1
- package/esm/components/context-menu/context-menu-item.d.ts.map +1 -1
- package/esm/components/context-menu/context-menu-item.js +1 -0
- package/esm/components/context-menu/context-menu-item.js.map +1 -1
- package/esm/components/context-menu/context-menu.d.ts.map +1 -1
- package/esm/components/context-menu/context-menu.js +1 -0
- package/esm/components/context-menu/context-menu.js.map +1 -1
- package/esm/components/data-grid/body.d.ts.map +1 -1
- package/esm/components/data-grid/body.js +2 -0
- package/esm/components/data-grid/body.js.map +1 -1
- package/esm/components/data-grid/data-grid-row.d.ts.map +1 -1
- package/esm/components/data-grid/data-grid-row.js +1 -0
- package/esm/components/data-grid/data-grid-row.js.map +1 -1
- package/esm/components/data-grid/data-grid.d.ts.map +1 -1
- package/esm/components/data-grid/data-grid.js +1 -0
- package/esm/components/data-grid/data-grid.js.map +1 -1
- package/esm/components/data-grid/filters/boolean-filter.d.ts.map +1 -1
- package/esm/components/data-grid/filters/boolean-filter.js +2 -0
- package/esm/components/data-grid/filters/boolean-filter.js.map +1 -1
- package/esm/components/data-grid/filters/date-filter.d.ts.map +1 -1
- package/esm/components/data-grid/filters/date-filter.js +2 -0
- package/esm/components/data-grid/filters/date-filter.js.map +1 -1
- package/esm/components/data-grid/filters/enum-filter.d.ts.map +1 -1
- package/esm/components/data-grid/filters/enum-filter.js +2 -0
- package/esm/components/data-grid/filters/enum-filter.js.map +1 -1
- package/esm/components/data-grid/filters/filter-dropdown.d.ts.map +1 -1
- package/esm/components/data-grid/filters/filter-dropdown.js +1 -0
- package/esm/components/data-grid/filters/filter-dropdown.js.map +1 -1
- package/esm/components/data-grid/filters/number-filter.d.ts.map +1 -1
- package/esm/components/data-grid/filters/number-filter.js +2 -0
- package/esm/components/data-grid/filters/number-filter.js.map +1 -1
- package/esm/components/data-grid/filters/string-filter.d.ts.map +1 -1
- package/esm/components/data-grid/filters/string-filter.js +2 -0
- package/esm/components/data-grid/filters/string-filter.js.map +1 -1
- package/esm/components/data-grid/footer.d.ts.map +1 -1
- package/esm/components/data-grid/footer.js +1 -0
- package/esm/components/data-grid/footer.js.map +1 -1
- package/esm/components/data-grid/header.d.ts.map +1 -1
- package/esm/components/data-grid/header.js +2 -0
- package/esm/components/data-grid/header.js.map +1 -1
- package/esm/components/data-grid/selection-cell.d.ts.map +1 -1
- package/esm/components/data-grid/selection-cell.js +1 -0
- package/esm/components/data-grid/selection-cell.js.map +1 -1
- package/esm/components/dialog.d.ts.map +1 -1
- package/esm/components/dialog.js +8 -12
- package/esm/components/dialog.js.map +1 -1
- package/esm/components/divider.d.ts.map +1 -1
- package/esm/components/divider.js +1 -0
- package/esm/components/divider.js.map +1 -1
- package/esm/components/drawer/drawer-toggle-button.d.ts +1 -1
- package/esm/components/drawer/drawer-toggle-button.d.ts.map +1 -1
- package/esm/components/drawer/drawer-toggle-button.js +2 -1
- package/esm/components/drawer/drawer-toggle-button.js.map +1 -1
- package/esm/components/drawer/index.d.ts.map +1 -1
- package/esm/components/drawer/index.js +1 -0
- package/esm/components/drawer/index.js.map +1 -1
- package/esm/components/dropdown.d.ts.map +1 -1
- package/esm/components/dropdown.js +1 -0
- package/esm/components/dropdown.js.map +1 -1
- package/esm/components/fab.d.ts.map +1 -1
- package/esm/components/fab.js +1 -0
- package/esm/components/fab.js.map +1 -1
- package/esm/components/form.d.ts.map +1 -1
- package/esm/components/form.js +2 -0
- package/esm/components/form.js.map +1 -1
- package/esm/components/grid.d.ts.map +1 -1
- package/esm/components/grid.js +3 -1
- package/esm/components/grid.js.map +1 -1
- package/esm/components/icons/icon.d.ts.map +1 -1
- package/esm/components/icons/icon.js +2 -0
- package/esm/components/icons/icon.js.map +1 -1
- package/esm/components/image.d.ts.map +1 -1
- package/esm/components/image.js +1 -0
- package/esm/components/image.js.map +1 -1
- package/esm/components/inputs/autocomplete.d.ts.map +1 -1
- package/esm/components/inputs/autocomplete.js +2 -0
- package/esm/components/inputs/autocomplete.js.map +1 -1
- package/esm/components/inputs/checkbox.d.ts.map +1 -1
- package/esm/components/inputs/checkbox.js +2 -1
- package/esm/components/inputs/checkbox.js.map +1 -1
- package/esm/components/inputs/input-number.d.ts.map +1 -1
- package/esm/components/inputs/input-number.js +1 -0
- package/esm/components/inputs/input-number.js.map +1 -1
- package/esm/components/inputs/input.d.ts.map +1 -1
- package/esm/components/inputs/input.js +1 -0
- package/esm/components/inputs/input.js.map +1 -1
- package/esm/components/inputs/radio-group.d.ts.map +1 -1
- package/esm/components/inputs/radio-group.js +1 -0
- package/esm/components/inputs/radio-group.js.map +1 -1
- package/esm/components/inputs/radio.d.ts.map +1 -1
- package/esm/components/inputs/radio.js +1 -0
- package/esm/components/inputs/radio.js.map +1 -1
- package/esm/components/inputs/select.d.ts.map +1 -1
- package/esm/components/inputs/select.js +14 -16
- package/esm/components/inputs/select.js.map +1 -1
- package/esm/components/inputs/select.spec.js +3 -6
- package/esm/components/inputs/select.spec.js.map +1 -1
- package/esm/components/inputs/slider.d.ts.map +1 -1
- package/esm/components/inputs/slider.js +5 -31
- package/esm/components/inputs/slider.js.map +1 -1
- package/esm/components/inputs/switch.d.ts.map +1 -1
- package/esm/components/inputs/switch.js +2 -1
- package/esm/components/inputs/switch.js.map +1 -1
- package/esm/components/inputs/text-area.d.ts.map +1 -1
- package/esm/components/inputs/text-area.js +1 -0
- package/esm/components/inputs/text-area.js.map +1 -1
- package/esm/components/linear-progress.d.ts.map +1 -1
- package/esm/components/linear-progress.js +1 -0
- package/esm/components/linear-progress.js.map +1 -1
- package/esm/components/list/list-item.d.ts.map +1 -1
- package/esm/components/list/list-item.js +1 -0
- package/esm/components/list/list-item.js.map +1 -1
- package/esm/components/list/list.d.ts.map +1 -1
- package/esm/components/list/list.js +2 -0
- package/esm/components/list/list.js.map +1 -1
- package/esm/components/loader.d.ts.map +1 -1
- package/esm/components/loader.js +1 -0
- package/esm/components/loader.js.map +1 -1
- package/esm/components/markdown/markdown-display.js +1 -1
- package/esm/components/markdown/markdown-display.js.map +1 -1
- package/esm/components/markdown/markdown-display.spec.js +2 -2
- package/esm/components/markdown/markdown-display.spec.js.map +1 -1
- package/esm/components/markdown/markdown-editor.d.ts +16 -2
- package/esm/components/markdown/markdown-editor.d.ts.map +1 -1
- package/esm/components/markdown/markdown-editor.js +43 -8
- package/esm/components/markdown/markdown-editor.js.map +1 -1
- package/esm/components/markdown/markdown-editor.spec.js +191 -1
- package/esm/components/markdown/markdown-editor.spec.js.map +1 -1
- package/esm/components/markdown/markdown-input.d.ts +2 -0
- package/esm/components/markdown/markdown-input.d.ts.map +1 -1
- package/esm/components/markdown/markdown-input.js +5 -9
- package/esm/components/markdown/markdown-input.js.map +1 -1
- package/esm/components/markdown/markdown-input.spec.js +43 -0
- package/esm/components/markdown/markdown-input.spec.js.map +1 -1
- package/esm/components/markdown/markdown-validation.d.ts +25 -0
- package/esm/components/markdown/markdown-validation.d.ts.map +1 -0
- package/esm/components/markdown/markdown-validation.js +15 -0
- package/esm/components/markdown/markdown-validation.js.map +1 -0
- package/esm/components/modal.d.ts.map +1 -1
- package/esm/components/modal.js +2 -0
- package/esm/components/modal.js.map +1 -1
- package/esm/components/noty-list.d.ts.map +1 -1
- package/esm/components/noty-list.js +4 -2
- package/esm/components/noty-list.js.map +1 -1
- package/esm/components/noty-list.spec.js +1 -1
- package/esm/components/noty-list.spec.js.map +1 -1
- package/esm/components/page-container/index.d.ts +1 -1
- package/esm/components/page-container/index.d.ts.map +1 -1
- package/esm/components/page-container/index.js +2 -1
- package/esm/components/page-container/index.js.map +1 -1
- package/esm/components/page-container/page-header.d.ts.map +1 -1
- package/esm/components/page-container/page-header.js +10 -12
- package/esm/components/page-container/page-header.js.map +1 -1
- package/esm/components/page-container/page-header.spec.js +6 -4
- package/esm/components/page-container/page-header.spec.js.map +1 -1
- package/esm/components/page-layout/index.d.ts.map +1 -1
- package/esm/components/page-layout/index.js +2 -0
- package/esm/components/page-layout/index.js.map +1 -1
- package/esm/components/paper.d.ts.map +1 -1
- package/esm/components/paper.js +6 -1
- package/esm/components/paper.js.map +1 -1
- package/esm/components/rating.d.ts.map +1 -1
- package/esm/components/rating.js +1 -0
- package/esm/components/rating.js.map +1 -1
- package/esm/components/result.d.ts.map +1 -1
- package/esm/components/result.js +3 -14
- package/esm/components/result.js.map +1 -1
- package/esm/components/result.spec.js +3 -3
- package/esm/components/result.spec.js.map +1 -1
- package/esm/components/suggest/index.d.ts.map +1 -1
- package/esm/components/suggest/index.js +2 -0
- package/esm/components/suggest/index.js.map +1 -1
- package/esm/components/suggest/suggest-input.d.ts.map +1 -1
- package/esm/components/suggest/suggest-input.js +1 -0
- package/esm/components/suggest/suggest-input.js.map +1 -1
- package/esm/components/suggest/suggestion-list.d.ts.map +1 -1
- package/esm/components/suggest/suggestion-list.js +3 -1
- package/esm/components/suggest/suggestion-list.js.map +1 -1
- package/esm/components/tabs.d.ts.map +1 -1
- package/esm/components/tabs.js +1 -0
- package/esm/components/tabs.js.map +1 -1
- package/esm/components/timeline.d.ts.map +1 -1
- package/esm/components/timeline.js +58 -51
- package/esm/components/timeline.js.map +1 -1
- package/esm/components/timeline.spec.js +0 -66
- package/esm/components/timeline.spec.js.map +1 -1
- package/esm/components/tooltip.d.ts.map +1 -1
- package/esm/components/tooltip.js +1 -0
- package/esm/components/tooltip.js.map +1 -1
- package/esm/components/tree/tree-item.d.ts.map +1 -1
- package/esm/components/tree/tree-item.js +1 -0
- package/esm/components/tree/tree-item.js.map +1 -1
- package/esm/components/tree/tree.d.ts.map +1 -1
- package/esm/components/tree/tree.js +2 -0
- package/esm/components/tree/tree.js.map +1 -1
- package/esm/components/typography.d.ts +2 -19
- package/esm/components/typography.d.ts.map +1 -1
- package/esm/components/typography.js +104 -94
- package/esm/components/typography.js.map +1 -1
- package/esm/components/typography.spec.js +16 -16
- package/esm/components/typography.spec.js.map +1 -1
- package/esm/components/wizard/index.d.ts.map +1 -1
- package/esm/components/wizard/index.js +1 -0
- package/esm/components/wizard/index.js.map +1 -1
- package/esm/services/css-variable-theme.d.ts +4 -0
- package/esm/services/css-variable-theme.d.ts.map +1 -1
- package/esm/services/css-variable-theme.js +29 -6
- package/esm/services/css-variable-theme.js.map +1 -1
- package/esm/services/css-variable-theme.spec.js +93 -1
- package/esm/services/css-variable-theme.spec.js.map +1 -1
- package/esm/services/get-rgb-from-color-string.d.ts +10 -0
- package/esm/services/get-rgb-from-color-string.d.ts.map +1 -0
- package/esm/services/get-rgb-from-color-string.js +86 -0
- package/esm/services/get-rgb-from-color-string.js.map +1 -0
- package/esm/services/get-rgb-from-color-string.spec.d.ts +2 -0
- package/esm/services/get-rgb-from-color-string.spec.d.ts.map +1 -0
- package/esm/services/get-rgb-from-color-string.spec.js +107 -0
- package/esm/services/get-rgb-from-color-string.spec.js.map +1 -0
- package/esm/services/get-text-color.d.ts +10 -0
- package/esm/services/get-text-color.d.ts.map +1 -0
- package/esm/services/get-text-color.js +15 -0
- package/esm/services/get-text-color.js.map +1 -0
- package/esm/services/get-text-color.spec.d.ts +2 -0
- package/esm/services/get-text-color.spec.d.ts.map +1 -0
- package/esm/services/get-text-color.spec.js +21 -0
- package/esm/services/get-text-color.spec.js.map +1 -0
- package/esm/services/index.d.ts +7 -4
- package/esm/services/index.d.ts.map +1 -1
- package/esm/services/index.js +7 -4
- package/esm/services/index.js.map +1 -1
- package/esm/services/rgb-color.d.ts +13 -0
- package/esm/services/rgb-color.d.ts.map +1 -0
- package/esm/services/rgb-color.js +23 -0
- package/esm/services/rgb-color.js.map +1 -0
- package/esm/services/rgb-color.spec.d.ts +2 -0
- package/esm/services/rgb-color.spec.d.ts.map +1 -0
- package/esm/services/rgb-color.spec.js +69 -0
- package/esm/services/rgb-color.spec.js.map +1 -0
- package/esm/services/theme-provider-service.d.ts +9 -23
- package/esm/services/theme-provider-service.d.ts.map +1 -1
- package/esm/services/theme-provider-service.js +1 -63
- package/esm/services/theme-provider-service.js.map +1 -1
- package/esm/services/theme-provider-service.spec.js +12 -159
- package/esm/services/theme-provider-service.spec.js.map +1 -1
- package/esm/themes/architect-palette.d.ts +8 -0
- package/esm/themes/architect-palette.d.ts.map +1 -0
- package/esm/themes/architect-palette.js +56 -0
- package/esm/themes/architect-palette.js.map +1 -0
- package/esm/themes/architect-theme.d.ts +120 -0
- package/esm/themes/architect-theme.d.ts.map +1 -0
- package/esm/themes/architect-theme.js +122 -0
- package/esm/themes/architect-theme.js.map +1 -0
- package/esm/themes/auditore-palette.d.ts +8 -0
- package/esm/themes/auditore-palette.d.ts.map +1 -0
- package/esm/themes/auditore-palette.js +56 -0
- package/esm/themes/auditore-palette.js.map +1 -0
- package/esm/themes/auditore-theme.d.ts +120 -0
- package/esm/themes/auditore-theme.d.ts.map +1 -0
- package/esm/themes/auditore-theme.js +122 -0
- package/esm/themes/auditore-theme.js.map +1 -0
- package/esm/themes/black-mesa-palette.d.ts +8 -0
- package/esm/themes/black-mesa-palette.d.ts.map +1 -0
- package/esm/themes/black-mesa-palette.js +56 -0
- package/esm/themes/black-mesa-palette.js.map +1 -0
- package/esm/themes/black-mesa-theme.d.ts +120 -0
- package/esm/themes/black-mesa-theme.d.ts.map +1 -0
- package/esm/themes/black-mesa-theme.js +122 -0
- package/esm/themes/black-mesa-theme.js.map +1 -0
- package/esm/themes/chieftain-palette.d.ts +8 -0
- package/esm/themes/chieftain-palette.d.ts.map +1 -0
- package/esm/themes/chieftain-palette.js +56 -0
- package/esm/themes/chieftain-palette.js.map +1 -0
- package/esm/themes/chieftain-theme.d.ts +121 -0
- package/esm/themes/chieftain-theme.d.ts.map +1 -0
- package/esm/themes/chieftain-theme.js +123 -0
- package/esm/themes/chieftain-theme.js.map +1 -0
- package/esm/themes/default-dark-palette.d.ts +8 -0
- package/esm/themes/default-dark-palette.d.ts.map +1 -0
- package/esm/{services → themes}/default-dark-palette.js +1 -1
- package/esm/themes/default-dark-palette.js.map +1 -0
- package/esm/{services → themes}/default-dark-theme.d.ts +7 -1
- package/esm/themes/default-dark-theme.d.ts.map +1 -0
- package/esm/{services → themes}/default-dark-theme.js +6 -0
- package/esm/themes/default-dark-theme.js.map +1 -0
- package/esm/{services → themes}/default-light-theme.d.ts +7 -1
- package/esm/themes/default-light-theme.d.ts.map +1 -0
- package/esm/{services → themes}/default-light-theme.js +6 -0
- package/esm/themes/default-light-theme.js.map +1 -0
- package/esm/{services → themes}/default-palette.d.ts +1 -1
- package/esm/themes/default-palette.d.ts.map +1 -0
- package/esm/themes/default-palette.js.map +1 -0
- package/esm/themes/dragonborn-palette.d.ts +8 -0
- package/esm/themes/dragonborn-palette.d.ts.map +1 -0
- package/esm/themes/dragonborn-palette.js +56 -0
- package/esm/themes/dragonborn-palette.js.map +1 -0
- package/esm/themes/dragonborn-theme.d.ts +120 -0
- package/esm/themes/dragonborn-theme.d.ts.map +1 -0
- package/esm/themes/dragonborn-theme.js +122 -0
- package/esm/themes/dragonborn-theme.js.map +1 -0
- package/esm/themes/hawkins-palette.d.ts +8 -0
- package/esm/themes/hawkins-palette.d.ts.map +1 -0
- package/esm/themes/hawkins-palette.js +56 -0
- package/esm/themes/hawkins-palette.js.map +1 -0
- package/esm/themes/hawkins-theme.d.ts +120 -0
- package/esm/themes/hawkins-theme.d.ts.map +1 -0
- package/esm/themes/hawkins-theme.js +122 -0
- package/esm/themes/hawkins-theme.js.map +1 -0
- package/esm/themes/jedi-palette.d.ts +8 -0
- package/esm/themes/jedi-palette.d.ts.map +1 -0
- package/esm/themes/jedi-palette.js +56 -0
- package/esm/themes/jedi-palette.js.map +1 -0
- package/esm/themes/jedi-theme.d.ts +120 -0
- package/esm/themes/jedi-theme.d.ts.map +1 -0
- package/esm/themes/jedi-theme.js +122 -0
- package/esm/themes/jedi-theme.js.map +1 -0
- package/esm/themes/neon-runner-palette.d.ts +8 -0
- package/esm/themes/neon-runner-palette.d.ts.map +1 -0
- package/esm/themes/neon-runner-palette.js +56 -0
- package/esm/themes/neon-runner-palette.js.map +1 -0
- package/esm/themes/neon-runner-theme.d.ts +119 -0
- package/esm/themes/neon-runner-theme.d.ts.map +1 -0
- package/esm/themes/neon-runner-theme.js +120 -0
- package/esm/themes/neon-runner-theme.js.map +1 -0
- package/esm/themes/paladin-palette.d.ts +8 -0
- package/esm/themes/paladin-palette.d.ts.map +1 -0
- package/esm/themes/paladin-palette.js +56 -0
- package/esm/themes/paladin-palette.js.map +1 -0
- package/esm/themes/paladin-theme.d.ts +121 -0
- package/esm/themes/paladin-theme.d.ts.map +1 -0
- package/esm/themes/paladin-theme.js +123 -0
- package/esm/themes/paladin-theme.js.map +1 -0
- package/esm/themes/plumber-palette.d.ts +8 -0
- package/esm/themes/plumber-palette.d.ts.map +1 -0
- package/esm/themes/plumber-palette.js +56 -0
- package/esm/themes/plumber-palette.js.map +1 -0
- package/esm/themes/plumber-theme.d.ts +120 -0
- package/esm/themes/plumber-theme.d.ts.map +1 -0
- package/esm/themes/plumber-theme.js +121 -0
- package/esm/themes/plumber-theme.js.map +1 -0
- package/esm/themes/replicant-palette.d.ts +8 -0
- package/esm/themes/replicant-palette.d.ts.map +1 -0
- package/esm/themes/replicant-palette.js +56 -0
- package/esm/themes/replicant-palette.js.map +1 -0
- package/esm/themes/replicant-theme.d.ts +120 -0
- package/esm/themes/replicant-theme.d.ts.map +1 -0
- package/esm/themes/replicant-theme.js +122 -0
- package/esm/themes/replicant-theme.js.map +1 -0
- package/esm/themes/sandworm-palette.d.ts +8 -0
- package/esm/themes/sandworm-palette.d.ts.map +1 -0
- package/esm/themes/sandworm-palette.js +56 -0
- package/esm/themes/sandworm-palette.js.map +1 -0
- package/esm/themes/sandworm-theme.d.ts +120 -0
- package/esm/themes/sandworm-theme.d.ts.map +1 -0
- package/esm/themes/sandworm-theme.js +122 -0
- package/esm/themes/sandworm-theme.js.map +1 -0
- package/esm/themes/shadow-broker-palette.d.ts +8 -0
- package/esm/themes/shadow-broker-palette.d.ts.map +1 -0
- package/esm/themes/shadow-broker-palette.js +56 -0
- package/esm/{services/default-dark-palette.js.map → themes/shadow-broker-palette.js.map} +1 -1
- package/esm/themes/shadow-broker-theme.d.ts +120 -0
- package/esm/themes/shadow-broker-theme.d.ts.map +1 -0
- package/esm/themes/shadow-broker-theme.js +121 -0
- package/esm/themes/shadow-broker-theme.js.map +1 -0
- package/esm/themes/sith-palette.d.ts +8 -0
- package/esm/themes/sith-palette.d.ts.map +1 -0
- package/esm/themes/sith-palette.js +56 -0
- package/esm/themes/sith-palette.js.map +1 -0
- package/esm/themes/sith-theme.d.ts +120 -0
- package/esm/themes/sith-theme.d.ts.map +1 -0
- package/esm/themes/sith-theme.js +122 -0
- package/esm/themes/sith-theme.js.map +1 -0
- package/esm/themes/vault-dweller-palette.d.ts +8 -0
- package/esm/themes/vault-dweller-palette.d.ts.map +1 -0
- package/esm/themes/vault-dweller-palette.js +56 -0
- package/esm/themes/vault-dweller-palette.js.map +1 -0
- package/esm/themes/vault-dweller-theme.d.ts +120 -0
- package/esm/themes/vault-dweller-theme.d.ts.map +1 -0
- package/esm/themes/vault-dweller-theme.js +122 -0
- package/esm/themes/vault-dweller-theme.js.map +1 -0
- package/esm/themes/wild-hunt-palette.d.ts +8 -0
- package/esm/themes/wild-hunt-palette.d.ts.map +1 -0
- package/esm/themes/wild-hunt-palette.js +56 -0
- package/esm/themes/wild-hunt-palette.js.map +1 -0
- package/esm/themes/wild-hunt-theme.d.ts +120 -0
- package/esm/themes/wild-hunt-theme.d.ts.map +1 -0
- package/esm/themes/wild-hunt-theme.js +122 -0
- package/esm/themes/wild-hunt-theme.js.map +1 -0
- package/esm/themes/xenomorph-palette.d.ts +8 -0
- package/esm/themes/xenomorph-palette.d.ts.map +1 -0
- package/esm/themes/xenomorph-palette.js +56 -0
- package/esm/themes/xenomorph-palette.js.map +1 -0
- package/esm/themes/xenomorph-theme.d.ts +120 -0
- package/esm/themes/xenomorph-theme.d.ts.map +1 -0
- package/esm/themes/xenomorph-theme.js +121 -0
- package/esm/themes/xenomorph-theme.js.map +1 -0
- package/package.json +7 -3
- package/src/components/accordion/accordion-item.tsx +16 -23
- package/src/components/accordion/accordion.tsx +1 -0
- package/src/components/app-bar-link.tsx +1 -0
- package/src/components/app-bar.spec.tsx +3 -3
- package/src/components/app-bar.tsx +2 -0
- package/src/components/avatar.tsx +1 -0
- package/src/components/badge.tsx +2 -1
- package/src/components/breadcrumb.tsx +1 -0
- package/src/components/button-group.spec.tsx +7 -6
- package/src/components/button-group.tsx +72 -70
- package/src/components/button.tsx +1 -0
- package/src/components/cache-view.spec.tsx +4 -1
- package/src/components/cache-view.tsx +4 -0
- package/src/components/card.tsx +3 -1
- package/src/components/circular-progress.tsx +1 -0
- package/src/components/command-palette/command-palette-input.tsx +1 -0
- package/src/components/command-palette/command-palette-suggestion-list.tsx +3 -1
- package/src/components/command-palette/index.tsx +2 -0
- package/src/components/context-menu/context-menu-item.tsx +1 -0
- package/src/components/context-menu/context-menu.tsx +1 -0
- package/src/components/data-grid/body.tsx +2 -0
- package/src/components/data-grid/data-grid-row.tsx +1 -0
- package/src/components/data-grid/data-grid.tsx +1 -0
- package/src/components/data-grid/filters/boolean-filter.tsx +2 -0
- package/src/components/data-grid/filters/date-filter.tsx +2 -0
- package/src/components/data-grid/filters/enum-filter.tsx +2 -0
- package/src/components/data-grid/filters/filter-dropdown.tsx +1 -0
- package/src/components/data-grid/filters/number-filter.tsx +2 -0
- package/src/components/data-grid/filters/string-filter.tsx +2 -0
- package/src/components/data-grid/footer.tsx +1 -0
- package/src/components/data-grid/header.tsx +2 -0
- package/src/components/data-grid/selection-cell.tsx +1 -0
- package/src/components/dialog.tsx +15 -15
- package/src/components/divider.tsx +1 -0
- package/src/components/drawer/drawer-toggle-button.tsx +2 -1
- package/src/components/drawer/index.tsx +1 -0
- package/src/components/dropdown.tsx +1 -0
- package/src/components/fab.tsx +1 -0
- package/src/components/form.tsx +2 -0
- package/src/components/grid.tsx +3 -1
- package/src/components/icons/icon.tsx +2 -0
- package/src/components/image.tsx +1 -0
- package/src/components/inputs/autocomplete.tsx +2 -0
- package/src/components/inputs/checkbox.tsx +2 -1
- package/src/components/inputs/input-number.tsx +1 -0
- package/src/components/inputs/input.tsx +1 -0
- package/src/components/inputs/radio-group.tsx +1 -0
- package/src/components/inputs/radio.tsx +1 -0
- package/src/components/inputs/select.spec.tsx +3 -6
- package/src/components/inputs/select.tsx +13 -15
- package/src/components/inputs/slider.tsx +27 -36
- package/src/components/inputs/switch.tsx +2 -1
- package/src/components/inputs/text-area.tsx +1 -0
- package/src/components/linear-progress.tsx +1 -0
- package/src/components/list/list-item.tsx +1 -0
- package/src/components/list/list.tsx +2 -0
- package/src/components/loader.tsx +1 -0
- package/src/components/markdown/markdown-display.spec.tsx +2 -2
- package/src/components/markdown/markdown-display.tsx +1 -1
- package/src/components/markdown/markdown-editor.spec.tsx +262 -1
- package/src/components/markdown/markdown-editor.tsx +64 -10
- package/src/components/markdown/markdown-input.spec.tsx +63 -0
- package/src/components/markdown/markdown-input.tsx +7 -11
- package/src/components/markdown/markdown-validation.ts +33 -0
- package/src/components/modal.tsx +2 -0
- package/src/components/noty-list.spec.tsx +1 -1
- package/src/components/noty-list.tsx +4 -2
- package/src/components/page-container/index.tsx +2 -1
- package/src/components/page-container/page-header.spec.tsx +6 -4
- package/src/components/page-container/page-header.tsx +23 -15
- package/src/components/page-layout/index.tsx +2 -0
- package/src/components/paper.tsx +6 -1
- package/src/components/rating.tsx +1 -0
- package/src/components/result.spec.tsx +3 -3
- package/src/components/result.tsx +9 -15
- package/src/components/suggest/index.tsx +2 -0
- package/src/components/suggest/suggest-input.tsx +1 -0
- package/src/components/suggest/suggestion-list.tsx +3 -1
- package/src/components/tabs.tsx +1 -0
- package/src/components/timeline.spec.tsx +0 -95
- package/src/components/timeline.tsx +63 -54
- package/src/components/tooltip.tsx +1 -0
- package/src/components/tree/tree-item.tsx +1 -0
- package/src/components/tree/tree.tsx +2 -0
- package/src/components/typography.spec.tsx +16 -16
- package/src/components/typography.tsx +121 -110
- package/src/components/wizard/index.tsx +1 -0
- package/src/services/css-variable-theme.spec.ts +108 -0
- package/src/services/css-variable-theme.ts +30 -7
- package/src/services/get-rgb-from-color-string.spec.ts +122 -0
- package/src/services/get-rgb-from-color-string.ts +96 -0
- package/src/services/get-text-color.spec.ts +25 -0
- package/src/services/get-text-color.ts +15 -0
- package/src/services/index.ts +7 -4
- package/src/services/rgb-color.spec.ts +79 -0
- package/src/services/rgb-color.ts +20 -0
- package/src/services/theme-provider-service.spec.ts +12 -185
- package/src/services/theme-provider-service.ts +8 -72
- package/src/themes/architect-palette.ts +57 -0
- package/src/themes/architect-theme.ts +124 -0
- package/src/themes/auditore-palette.ts +57 -0
- package/src/themes/auditore-theme.ts +124 -0
- package/src/themes/black-mesa-palette.ts +57 -0
- package/src/themes/black-mesa-theme.ts +124 -0
- package/src/themes/chieftain-palette.ts +57 -0
- package/src/themes/chieftain-theme.ts +125 -0
- package/src/{services → themes}/default-dark-palette.ts +2 -2
- package/src/{services → themes}/default-dark-theme.ts +7 -1
- package/src/{services → themes}/default-light-theme.ts +7 -1
- package/src/{services → themes}/default-palette.ts +1 -1
- package/src/themes/dragonborn-palette.ts +57 -0
- package/src/themes/dragonborn-theme.ts +124 -0
- package/src/themes/hawkins-palette.ts +57 -0
- package/src/themes/hawkins-theme.ts +124 -0
- package/src/themes/jedi-palette.ts +57 -0
- package/src/themes/jedi-theme.ts +124 -0
- package/src/themes/neon-runner-palette.ts +57 -0
- package/src/themes/neon-runner-theme.ts +121 -0
- package/src/themes/paladin-palette.ts +57 -0
- package/src/themes/paladin-theme.ts +125 -0
- package/src/themes/plumber-palette.ts +57 -0
- package/src/themes/plumber-theme.ts +122 -0
- package/src/themes/replicant-palette.ts +57 -0
- package/src/themes/replicant-theme.ts +124 -0
- package/src/themes/sandworm-palette.ts +57 -0
- package/src/themes/sandworm-theme.ts +124 -0
- package/src/themes/shadow-broker-palette.ts +57 -0
- package/src/themes/shadow-broker-theme.ts +122 -0
- package/src/themes/sith-palette.ts +57 -0
- package/src/themes/sith-theme.ts +124 -0
- package/src/themes/vault-dweller-palette.ts +57 -0
- package/src/themes/vault-dweller-theme.ts +124 -0
- package/src/themes/wild-hunt-palette.ts +57 -0
- package/src/themes/wild-hunt-theme.ts +124 -0
- package/src/themes/xenomorph-palette.ts +57 -0
- package/src/themes/xenomorph-theme.ts +122 -0
- package/esm/services/default-dark-palette.d.ts +0 -8
- package/esm/services/default-dark-palette.d.ts.map +0 -1
- package/esm/services/default-dark-theme.d.ts.map +0 -1
- package/esm/services/default-dark-theme.js.map +0 -1
- package/esm/services/default-light-theme.d.ts.map +0 -1
- package/esm/services/default-light-theme.js.map +0 -1
- package/esm/services/default-palette.d.ts.map +0 -1
- package/esm/services/default-palette.js.map +0 -1
- /package/esm/{services → themes}/default-palette.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PartialElement } from '@furystack/shades'
|
|
1
|
+
import type { ChildrenList, PartialElement, RenderOptions } from '@furystack/shades'
|
|
2
2
|
import { Shade, createComponent } from '@furystack/shades'
|
|
3
3
|
import { buildTransition, cssVariableTheme } from '../services/css-variable-theme.js'
|
|
4
4
|
import { paletteMainColors } from '../services/palette-css-vars.js'
|
|
@@ -176,130 +176,141 @@ const colorToVar = (color: TypographyColor): string => {
|
|
|
176
176
|
return paletteMainColors[color].main
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
type TypographyTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span'
|
|
180
|
+
|
|
181
|
+
const variantToTag = (variant: TypographyVariant): TypographyTag => {
|
|
182
|
+
if (variant.startsWith('h')) return variant as TypographyTag
|
|
181
183
|
if (variant === 'subtitle1' || variant === 'subtitle2') return 'h6'
|
|
182
184
|
if (variant === 'body1' || variant === 'body2') return 'p'
|
|
183
185
|
return 'span'
|
|
184
186
|
}
|
|
185
187
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
display: 'block',
|
|
194
|
-
margin: '0',
|
|
195
|
-
padding: '0',
|
|
196
|
-
fontFamily: cssVariableTheme.typography.fontFamily,
|
|
197
|
-
color: 'var(--typo-color)',
|
|
198
|
-
|
|
199
|
-
// Variant-specific typography styles
|
|
200
|
-
...buildVariantCssRules(),
|
|
188
|
+
const typographyCss = {
|
|
189
|
+
display: 'block',
|
|
190
|
+
margin: '0',
|
|
191
|
+
padding: '0',
|
|
192
|
+
fontFamily: cssVariableTheme.typography.fontFamily,
|
|
193
|
+
color: 'var(--typo-color)',
|
|
194
|
+
textShadow: cssVariableTheme.typography.textShadow || 'none',
|
|
201
195
|
|
|
202
|
-
|
|
203
|
-
'&[data-gutter-bottom]': {
|
|
204
|
-
marginBottom: '0.35em',
|
|
205
|
-
},
|
|
196
|
+
...buildVariantCssRules(),
|
|
206
197
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
'&[data-align="right"]': { textAlign: 'right' },
|
|
211
|
-
'&[data-align="justify"]': { textAlign: 'justify' },
|
|
198
|
+
'&[data-gutter-bottom]': {
|
|
199
|
+
marginBottom: '0.35em',
|
|
200
|
+
},
|
|
212
201
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
font: 'inherit',
|
|
218
|
-
color: 'inherit',
|
|
219
|
-
letterSpacing: 'inherit',
|
|
220
|
-
textTransform: 'inherit',
|
|
221
|
-
},
|
|
202
|
+
'&[data-align="left"]': { textAlign: 'left' },
|
|
203
|
+
'&[data-align="center"]': { textAlign: 'center' },
|
|
204
|
+
'&[data-align="right"]': { textAlign: 'right' },
|
|
205
|
+
'&[data-align="justify"]': { textAlign: 'justify' },
|
|
222
206
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
},
|
|
207
|
+
'&[data-ellipsis="true"]': {
|
|
208
|
+
overflow: 'hidden',
|
|
209
|
+
textOverflow: 'ellipsis',
|
|
210
|
+
whiteSpace: 'nowrap',
|
|
211
|
+
},
|
|
229
212
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
},
|
|
213
|
+
'&[data-ellipsis="multiline"]': {
|
|
214
|
+
overflow: 'hidden',
|
|
215
|
+
display: '-webkit-box',
|
|
216
|
+
},
|
|
235
217
|
|
|
236
|
-
|
|
237
|
-
'
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
),
|
|
254
|
-
},
|
|
255
|
-
'& .typo-copy-btn:hover': {
|
|
256
|
-
color: cssVariableTheme.text.primary,
|
|
257
|
-
background: cssVariableTheme.action.hoverBackground,
|
|
258
|
-
},
|
|
218
|
+
'& .typo-copy-btn': {
|
|
219
|
+
display: 'inline-flex',
|
|
220
|
+
alignItems: 'center',
|
|
221
|
+
justifyContent: 'center',
|
|
222
|
+
background: 'transparent',
|
|
223
|
+
border: 'none',
|
|
224
|
+
color: cssVariableTheme.text.secondary,
|
|
225
|
+
cursor: 'pointer',
|
|
226
|
+
padding: `0 ${cssVariableTheme.spacing.xs}`,
|
|
227
|
+
fontSize: '0.85em',
|
|
228
|
+
lineHeight: '1',
|
|
229
|
+
verticalAlign: 'middle',
|
|
230
|
+
borderRadius: cssVariableTheme.shape.borderRadius.sm,
|
|
231
|
+
transition: buildTransition(
|
|
232
|
+
['color', cssVariableTheme.transitions.duration.fast, cssVariableTheme.transitions.easing.default],
|
|
233
|
+
['background', cssVariableTheme.transitions.duration.fast, cssVariableTheme.transitions.easing.default],
|
|
234
|
+
),
|
|
259
235
|
},
|
|
260
|
-
|
|
261
|
-
|
|
236
|
+
'& .typo-copy-btn:hover': {
|
|
237
|
+
color: cssVariableTheme.text.primary,
|
|
238
|
+
background: cssVariableTheme.action.hoverBackground,
|
|
239
|
+
},
|
|
240
|
+
}
|
|
262
241
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
242
|
+
const typographyRender = ({ props, children, useHostProps }: RenderOptions<TypographyProps>): JSX.Element | null => {
|
|
243
|
+
const { variant = 'body1', color = 'textPrimary', ellipsis, copyable, gutterBottom, align, style } = props
|
|
244
|
+
|
|
245
|
+
const hostStyle: Record<string, string> = {
|
|
246
|
+
'--typo-color': colorToVar(color),
|
|
247
|
+
}
|
|
248
|
+
if (typeof ellipsis === 'number') {
|
|
249
|
+
hostStyle.webkitLineClamp = String(ellipsis)
|
|
250
|
+
hostStyle.webkitBoxOrient = 'vertical'
|
|
251
|
+
}
|
|
252
|
+
if (style) {
|
|
253
|
+
Object.assign(hostStyle, style)
|
|
254
|
+
}
|
|
255
|
+
useHostProps({
|
|
256
|
+
'data-gutter-bottom': gutterBottom ? '' : undefined,
|
|
257
|
+
'data-align': align || undefined,
|
|
258
|
+
'data-ellipsis': ellipsis === true ? 'true' : typeof ellipsis === 'number' ? 'multiline' : undefined,
|
|
259
|
+
'data-variant': variant,
|
|
260
|
+
style: hostStyle,
|
|
261
|
+
})
|
|
276
262
|
|
|
277
|
-
|
|
263
|
+
if (!copyable) {
|
|
264
|
+
return <>{children}</>
|
|
265
|
+
}
|
|
278
266
|
|
|
279
|
-
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
267
|
+
const handleCopy = (e: Event) => {
|
|
268
|
+
const btn = e.currentTarget as HTMLElement
|
|
269
|
+
const host = btn.parentElement
|
|
270
|
+
if (!host) return
|
|
271
|
+
const clone = host.cloneNode(true) as HTMLElement
|
|
272
|
+
clone.querySelectorAll('.typo-copy-btn').forEach((el) => el.remove())
|
|
273
|
+
navigator.clipboard.writeText(clone.textContent ?? '').catch(() => {})
|
|
274
|
+
}
|
|
286
275
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
276
|
+
return (
|
|
277
|
+
<>
|
|
278
|
+
{children}
|
|
279
|
+
<button type="button" className="typo-copy-btn" onclick={handleCopy} title="Copy to clipboard">
|
|
280
|
+
<Icon icon={clipboard} size={14} />
|
|
281
|
+
</button>
|
|
282
|
+
</>
|
|
283
|
+
)
|
|
284
|
+
}
|
|
291
285
|
|
|
292
|
-
|
|
286
|
+
const tagConfigs: Array<[TypographyTag, new () => HTMLElement]> = [
|
|
287
|
+
['h1', HTMLHeadingElement],
|
|
288
|
+
['h2', HTMLHeadingElement],
|
|
289
|
+
['h3', HTMLHeadingElement],
|
|
290
|
+
['h4', HTMLHeadingElement],
|
|
291
|
+
['h5', HTMLHeadingElement],
|
|
292
|
+
['h6', HTMLHeadingElement],
|
|
293
|
+
['p', HTMLParagraphElement],
|
|
294
|
+
['span', HTMLSpanElement],
|
|
295
|
+
]
|
|
293
296
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
297
|
+
const shadesByTag = {} as Record<TypographyTag, (props: TypographyProps, children?: ChildrenList) => JSX.Element>
|
|
298
|
+
|
|
299
|
+
for (const [tag, elementBase] of tagConfigs) {
|
|
300
|
+
shadesByTag[tag] = Shade<TypographyProps>({
|
|
301
|
+
shadowDomName: `shade-typography-${tag}`,
|
|
302
|
+
elementBase,
|
|
303
|
+
elementBaseName: tag,
|
|
304
|
+
css: typographyCss,
|
|
305
|
+
render: typographyRender,
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Typography component for consistent text styling.
|
|
311
|
+
* Maps variants to semantic HTML tags and uses theme typography tokens.
|
|
312
|
+
*/
|
|
313
|
+
export const Typography = (props: TypographyProps, children?: ChildrenList): JSX.Element => {
|
|
314
|
+
const tag = variantToTag(props.variant ?? 'body1')
|
|
315
|
+
return shadesByTag[tag](props, children)
|
|
316
|
+
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
buildTransition,
|
|
4
4
|
cssVariableTheme,
|
|
5
5
|
getCssVariable,
|
|
6
|
+
removeCssVariable,
|
|
6
7
|
setCssVariable,
|
|
7
8
|
useThemeCssVariables,
|
|
8
9
|
} from './css-variable-theme.js'
|
|
@@ -66,6 +67,7 @@ describe('css-variable-theme', () => {
|
|
|
66
67
|
expect(cssVariableTheme.typography.fontWeight.bold).toBe('var(--shades-theme-typography-font-weight-bold)')
|
|
67
68
|
expect(cssVariableTheme.typography.lineHeight.tight).toBe('var(--shades-theme-typography-line-height-tight)')
|
|
68
69
|
expect(cssVariableTheme.typography.lineHeight.normal).toBe('var(--shades-theme-typography-line-height-normal)')
|
|
70
|
+
expect(cssVariableTheme.typography.textShadow).toBe('var(--shades-theme-typography-text-shadow, none)')
|
|
69
71
|
})
|
|
70
72
|
|
|
71
73
|
it('should have transition properties with CSS variable references', () => {
|
|
@@ -122,6 +124,37 @@ describe('css-variable-theme', () => {
|
|
|
122
124
|
})
|
|
123
125
|
})
|
|
124
126
|
|
|
127
|
+
describe('removeCssVariable', () => {
|
|
128
|
+
let testElement: HTMLElement
|
|
129
|
+
|
|
130
|
+
beforeEach(() => {
|
|
131
|
+
testElement = document.createElement('div')
|
|
132
|
+
document.body.appendChild(testElement)
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
afterEach(() => {
|
|
136
|
+
testElement.remove()
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
it('should remove a CSS variable from element', () => {
|
|
140
|
+
testElement.style.setProperty('--test-color', 'red')
|
|
141
|
+
expect(testElement.style.getPropertyValue('--test-color')).toBe('red')
|
|
142
|
+
|
|
143
|
+
removeCssVariable('--test-color', testElement)
|
|
144
|
+
expect(testElement.style.getPropertyValue('--test-color')).toBe('')
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
it('should handle var() wrapper in key name', () => {
|
|
148
|
+
testElement.style.setProperty('--test-padding', '10px')
|
|
149
|
+
removeCssVariable('var(--test-padding)', testElement)
|
|
150
|
+
expect(testElement.style.getPropertyValue('--test-padding')).toBe('')
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
it('should not throw when removing a non-existent variable', () => {
|
|
154
|
+
expect(() => removeCssVariable('--non-existent', testElement)).not.toThrow()
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
|
|
125
158
|
describe('getCssVariable', () => {
|
|
126
159
|
let testElement: HTMLElement
|
|
127
160
|
|
|
@@ -263,6 +296,81 @@ describe('css-variable-theme', () => {
|
|
|
263
296
|
expect(root.style.getPropertyValue('--shades-theme-text-primary')).toBe('#bbb')
|
|
264
297
|
})
|
|
265
298
|
|
|
299
|
+
it('should remove stale CSS variables not present in the new theme', () => {
|
|
300
|
+
useThemeCssVariables({
|
|
301
|
+
text: {
|
|
302
|
+
primary: '#fff',
|
|
303
|
+
secondary: '#ccc',
|
|
304
|
+
disabled: '#999',
|
|
305
|
+
},
|
|
306
|
+
background: {
|
|
307
|
+
default: '#000',
|
|
308
|
+
paper: '#111',
|
|
309
|
+
paperImage: 'url(texture.png)',
|
|
310
|
+
},
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
expect(root.style.getPropertyValue('--shades-theme-text-primary')).toBe('#fff')
|
|
314
|
+
expect(root.style.getPropertyValue('--shades-theme-text-secondary')).toBe('#ccc')
|
|
315
|
+
expect(root.style.getPropertyValue('--shades-theme-background-paper-image')).toBe('url(texture.png)')
|
|
316
|
+
|
|
317
|
+
useThemeCssVariables({
|
|
318
|
+
text: {
|
|
319
|
+
primary: '#eee',
|
|
320
|
+
},
|
|
321
|
+
background: {
|
|
322
|
+
default: '#000',
|
|
323
|
+
paper: '#222',
|
|
324
|
+
},
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
expect(root.style.getPropertyValue('--shades-theme-text-primary')).toBe('#eee')
|
|
328
|
+
expect(root.style.getPropertyValue('--shades-theme-text-secondary')).toBe('')
|
|
329
|
+
expect(root.style.getPropertyValue('--shades-theme-text-disabled')).toBe('')
|
|
330
|
+
expect(root.style.getPropertyValue('--shades-theme-background-default')).toBe('#000')
|
|
331
|
+
expect(root.style.getPropertyValue('--shades-theme-background-paper')).toBe('#222')
|
|
332
|
+
expect(root.style.getPropertyValue('--shades-theme-background-paper-image')).toBe('')
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
it('should remove all nested CSS variables when a whole section is omitted', () => {
|
|
336
|
+
useThemeCssVariables({
|
|
337
|
+
palette: {
|
|
338
|
+
primary: {
|
|
339
|
+
light: '#aaa',
|
|
340
|
+
lightContrast: '#000',
|
|
341
|
+
main: '#bbb',
|
|
342
|
+
mainContrast: '#000',
|
|
343
|
+
dark: '#ccc',
|
|
344
|
+
darkContrast: '#fff',
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
spacing: {
|
|
348
|
+
xs: '4px',
|
|
349
|
+
sm: '8px',
|
|
350
|
+
md: '16px',
|
|
351
|
+
lg: '24px',
|
|
352
|
+
xl: '32px',
|
|
353
|
+
},
|
|
354
|
+
})
|
|
355
|
+
|
|
356
|
+
expect(root.style.getPropertyValue('--shades-theme-palette-primary-main')).toBe('#bbb')
|
|
357
|
+
expect(root.style.getPropertyValue('--shades-theme-spacing-md')).toBe('16px')
|
|
358
|
+
|
|
359
|
+
useThemeCssVariables({
|
|
360
|
+
spacing: {
|
|
361
|
+
xs: '2px',
|
|
362
|
+
sm: '4px',
|
|
363
|
+
md: '8px',
|
|
364
|
+
lg: '16px',
|
|
365
|
+
xl: '24px',
|
|
366
|
+
},
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
expect(root.style.getPropertyValue('--shades-theme-palette-primary-main')).toBe('')
|
|
370
|
+
expect(root.style.getPropertyValue('--shades-theme-palette-primary-light')).toBe('')
|
|
371
|
+
expect(root.style.getPropertyValue('--shades-theme-spacing-md')).toBe('8px')
|
|
372
|
+
})
|
|
373
|
+
|
|
266
374
|
it('should set action CSS variables from theme', () => {
|
|
267
375
|
useThemeCssVariables({
|
|
268
376
|
action: {
|
|
@@ -17,6 +17,7 @@ export const cssVariableTheme = {
|
|
|
17
17
|
background: {
|
|
18
18
|
default: 'var(--shades-theme-background-default)',
|
|
19
19
|
paper: 'var(--shades-theme-background-paper)',
|
|
20
|
+
paperImage: 'var(--shades-theme-background-paper-image, none)',
|
|
20
21
|
},
|
|
21
22
|
palette: {
|
|
22
23
|
primary: {
|
|
@@ -86,6 +87,7 @@ export const cssVariableTheme = {
|
|
|
86
87
|
lg: 'var(--shades-theme-shape-border-radius-lg)',
|
|
87
88
|
full: 'var(--shades-theme-shape-border-radius-full)',
|
|
88
89
|
},
|
|
90
|
+
borderWidth: 'var(--shades-theme-shape-border-width, 0px)',
|
|
89
91
|
},
|
|
90
92
|
shadows: {
|
|
91
93
|
none: 'var(--shades-theme-shadows-none)',
|
|
@@ -125,6 +127,7 @@ export const cssVariableTheme = {
|
|
|
125
127
|
wider: 'var(--shades-theme-typography-letter-spacing-wider)',
|
|
126
128
|
widest: 'var(--shades-theme-typography-letter-spacing-widest)',
|
|
127
129
|
},
|
|
130
|
+
textShadow: 'var(--shades-theme-typography-text-shadow, none)',
|
|
128
131
|
},
|
|
129
132
|
transitions: {
|
|
130
133
|
duration: {
|
|
@@ -173,12 +176,29 @@ export const cssVariableTheme = {
|
|
|
173
176
|
export const buildTransition = (...specs: Array<[property: string, duration: string, easing: string]>): string =>
|
|
174
177
|
specs.map(([prop, dur, ease]) => `${prop} ${dur} ${ease}`).join(', ')
|
|
175
178
|
|
|
179
|
+
const extractVarName = (key: string): string => key.replace(/^var\(/, '').replace(/[,)].*/, '')
|
|
180
|
+
|
|
176
181
|
export const setCssVariable = (key: string, value: string, root: HTMLElement) => {
|
|
177
|
-
root.style.setProperty(key
|
|
182
|
+
root.style.setProperty(extractVarName(key), value)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export const removeCssVariable = (key: string, root: HTMLElement) => {
|
|
186
|
+
root.style.removeProperty(extractVarName(key))
|
|
178
187
|
}
|
|
179
188
|
|
|
180
189
|
export const getCssVariable = (key: string, root: HTMLElement = document.querySelector(':root') as HTMLElement) => {
|
|
181
|
-
return getComputedStyle(root).getPropertyValue(key
|
|
190
|
+
return getComputedStyle(root).getPropertyValue(extractVarName(key))
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const removeValue = <T extends object>(target: T, root: HTMLElement) => {
|
|
194
|
+
const keys = Object.keys(target) as Array<keyof T>
|
|
195
|
+
keys.forEach((key) => {
|
|
196
|
+
if (typeof target[key] === 'object') {
|
|
197
|
+
removeValue(target[key] as object, root)
|
|
198
|
+
} else {
|
|
199
|
+
removeCssVariable(target[key] as string, root)
|
|
200
|
+
}
|
|
201
|
+
})
|
|
182
202
|
}
|
|
183
203
|
|
|
184
204
|
const assignValue = <T extends object>(
|
|
@@ -189,11 +209,14 @@ const assignValue = <T extends object>(
|
|
|
189
209
|
) => {
|
|
190
210
|
const keys = Object.keys(target) as Array<keyof T>
|
|
191
211
|
keys.forEach((key) => {
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
212
|
+
if (typeof target[key] === 'object') {
|
|
213
|
+
if (source[key] === undefined) {
|
|
214
|
+
removeValue(target[key] as object, root)
|
|
215
|
+
} else {
|
|
216
|
+
assignValue(target[key] as object, source[key] as object, root, assignFn)
|
|
217
|
+
}
|
|
218
|
+
} else if (source[key] === undefined) {
|
|
219
|
+
removeCssVariable(target[key] as string, root)
|
|
197
220
|
} else {
|
|
198
221
|
assignFn(target[key] as string, source[key] as string, root)
|
|
199
222
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { getRgbFromColorString } from './get-rgb-from-color-string.js'
|
|
3
|
+
|
|
4
|
+
describe('getRgbFromColorString', () => {
|
|
5
|
+
describe('hex colors', () => {
|
|
6
|
+
it('should parse 6-digit hex color', () => {
|
|
7
|
+
const result = getRgbFromColorString('#ff8040')
|
|
8
|
+
expect(result.r).toBe(255)
|
|
9
|
+
expect(result.g).toBe(128)
|
|
10
|
+
expect(result.b).toBe(64)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('should parse 6-digit hex color with lowercase', () => {
|
|
14
|
+
const result = getRgbFromColorString('#3f51b5')
|
|
15
|
+
expect(result.r).toBe(63)
|
|
16
|
+
expect(result.g).toBe(81)
|
|
17
|
+
expect(result.b).toBe(181)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('should parse 6-digit hex color with uppercase', () => {
|
|
21
|
+
const result = getRgbFromColorString('#FF0000')
|
|
22
|
+
expect(result.r).toBe(255)
|
|
23
|
+
expect(result.g).toBe(0)
|
|
24
|
+
expect(result.b).toBe(0)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('should parse 3-digit hex color', () => {
|
|
28
|
+
const result = getRgbFromColorString('#f80')
|
|
29
|
+
expect(result.r).toBe(255)
|
|
30
|
+
expect(result.g).toBe(136)
|
|
31
|
+
expect(result.b).toBe(0)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('should parse 3-digit hex white', () => {
|
|
35
|
+
const result = getRgbFromColorString('#fff')
|
|
36
|
+
expect(result.r).toBe(255)
|
|
37
|
+
expect(result.g).toBe(255)
|
|
38
|
+
expect(result.b).toBe(255)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('should parse 3-digit hex black', () => {
|
|
42
|
+
const result = getRgbFromColorString('#000')
|
|
43
|
+
expect(result.r).toBe(0)
|
|
44
|
+
expect(result.g).toBe(0)
|
|
45
|
+
expect(result.b).toBe(0)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('should throw error for invalid hex length', () => {
|
|
49
|
+
expect(() => getRgbFromColorString('#12345')).toThrow()
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
describe('rgb / rgba', () => {
|
|
54
|
+
it('should parse rgb color', () => {
|
|
55
|
+
const result = getRgbFromColorString('rgb(255, 0, 0)')
|
|
56
|
+
expect(result.r).toBe(255)
|
|
57
|
+
expect(result.g).toBe(0)
|
|
58
|
+
expect(result.b).toBe(0)
|
|
59
|
+
expect(result.a).toBe(1)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('should parse rgb color without spaces', () => {
|
|
63
|
+
const result = getRgbFromColorString('rgb(10,20,30)')
|
|
64
|
+
expect(result.r).toBe(10)
|
|
65
|
+
expect(result.g).toBe(20)
|
|
66
|
+
expect(result.b).toBe(30)
|
|
67
|
+
expect(result.a).toBe(1)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('should parse rgba color', () => {
|
|
71
|
+
const result = getRgbFromColorString('rgba(255,128,64,0.5)')
|
|
72
|
+
expect(result.r).toBe(255)
|
|
73
|
+
expect(result.g).toBe(128)
|
|
74
|
+
expect(result.b).toBe(64)
|
|
75
|
+
expect(result.a).toBe(0.5)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('should parse rgba color with spaces', () => {
|
|
79
|
+
const result = getRgbFromColorString('rgba(100, 150, 200, 1)')
|
|
80
|
+
expect(result.r).toBe(100)
|
|
81
|
+
expect(result.g).toBe(150)
|
|
82
|
+
expect(result.b).toBe(200)
|
|
83
|
+
expect(result.a).toBe(1)
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
describe('named colors', () => {
|
|
88
|
+
it('should parse "red"', () => {
|
|
89
|
+
const result = getRgbFromColorString('red')
|
|
90
|
+
expect(result.r).toBe(255)
|
|
91
|
+
expect(result.g).toBe(0)
|
|
92
|
+
expect(result.b).toBe(0)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('should parse "black"', () => {
|
|
96
|
+
const result = getRgbFromColorString('black')
|
|
97
|
+
expect(result.r).toBe(0)
|
|
98
|
+
expect(result.g).toBe(0)
|
|
99
|
+
expect(result.b).toBe(0)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('should parse "white"', () => {
|
|
103
|
+
const result = getRgbFromColorString('white')
|
|
104
|
+
expect(result.r).toBe(255)
|
|
105
|
+
expect(result.g).toBe(255)
|
|
106
|
+
expect(result.b).toBe(255)
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('should parse named colors case-insensitively', () => {
|
|
110
|
+
const result = getRgbFromColorString('DodgerBlue')
|
|
111
|
+
expect(result.r).toBe(30)
|
|
112
|
+
expect(result.g).toBe(144)
|
|
113
|
+
expect(result.b).toBe(255)
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
describe('unsupported formats', () => {
|
|
118
|
+
it('should throw error for unsupported color format', () => {
|
|
119
|
+
expect(() => getRgbFromColorString('not-a-color')).toThrow("Color format 'not-a-color' is not supported.")
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
})
|