igniteui-webcomponents 4.6.0 → 4.7.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 +16 -0
- package/animations/player.js.map +1 -1
- package/components/accordion/accordion.js.map +1 -1
- package/components/avatar/avatar.d.ts +4 -3
- package/components/avatar/avatar.js +20 -24
- package/components/avatar/avatar.js.map +1 -1
- package/components/avatar/themes/themes.js +8 -9
- package/components/avatar/themes/themes.js.map +1 -1
- package/components/badge/badge.d.ts +4 -1
- package/components/badge/badge.js +15 -5
- package/components/badge/badge.js.map +1 -1
- package/components/badge/themes/themes.js +8 -9
- package/components/badge/themes/themes.js.map +1 -1
- package/components/button/button-base.d.ts +5 -6
- package/components/button/button-base.js +13 -26
- package/components/button/button-base.js.map +1 -1
- package/components/button/button.d.ts +2 -8
- package/components/button/button.js +6 -14
- package/components/button/button.js.map +1 -1
- package/components/button/icon-button.d.ts +1 -1
- package/components/button/icon-button.js +2 -1
- package/components/button/icon-button.js.map +1 -1
- package/components/button/themes/button/themes.js +8 -9
- package/components/button/themes/button/themes.js.map +1 -1
- package/components/button/themes/icon-button/themes.js +8 -9
- package/components/button/themes/icon-button/themes.js.map +1 -1
- package/components/button-group/button-group.d.ts +1 -1
- package/components/button-group/button-group.js +2 -1
- package/components/button-group/button-group.js.map +1 -1
- package/components/button-group/themes/button.js +6 -13
- package/components/button-group/themes/button.js.map +1 -1
- package/components/button-group/themes/group.js +8 -9
- package/components/button-group/themes/group.js.map +1 -1
- package/components/button-group/toggle-button.d.ts +2 -2
- package/components/button-group/toggle-button.js +7 -13
- package/components/button-group/toggle-button.js.map +1 -1
- package/components/calendar/calendar.d.ts +1 -1
- package/components/calendar/calendar.js +2 -1
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/common/calendar-base.js.map +1 -1
- package/components/calendar/common/calendar.model.js.map +1 -1
- package/components/calendar/common/utils.js.map +1 -1
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/calendar/months-view/months-view.js.map +1 -1
- package/components/calendar/themes/calendar.js +8 -9
- package/components/calendar/themes/calendar.js.map +1 -1
- package/components/calendar/years-view/years-view.js.map +1 -1
- package/components/card/card.content.d.ts +1 -1
- package/components/card/card.content.js +2 -1
- package/components/card/card.content.js.map +1 -1
- package/components/card/card.d.ts +1 -1
- package/components/card/card.header.d.ts +1 -1
- package/components/card/card.header.js +2 -1
- package/components/card/card.header.js.map +1 -1
- package/components/card/card.js +2 -1
- package/components/card/card.js.map +1 -1
- package/components/card/themes/container.js +8 -9
- package/components/card/themes/container.js.map +1 -1
- package/components/card/themes/content.js +8 -9
- package/components/card/themes/content.js.map +1 -1
- package/components/card/themes/header.js +8 -9
- package/components/card/themes/header.js.map +1 -1
- package/components/checkbox/checkbox-base.js.map +1 -1
- package/components/chip/chip.d.ts +1 -1
- package/components/chip/chip.js +2 -1
- package/components/chip/chip.js.map +1 -1
- package/components/chip/themes/themes.js +8 -9
- package/components/chip/themes/themes.js.map +1 -1
- package/components/combo/combo-item.d.ts +2 -0
- package/components/combo/combo-item.js +10 -11
- package/components/combo/combo-item.js.map +1 -1
- package/components/combo/combo-list.d.ts +0 -1
- package/components/combo/combo-list.js +0 -6
- package/components/combo/combo-list.js.map +1 -1
- package/components/combo/combo.d.ts +4 -5
- package/components/combo/combo.js +51 -39
- package/components/combo/combo.js.map +1 -1
- package/components/combo/controllers/navigation.js.map +1 -1
- package/components/combo/controllers/selection.js.map +1 -1
- package/components/combo/operations/group.d.ts +2 -2
- package/components/combo/operations/group.js +13 -26
- package/components/combo/operations/group.js.map +1 -1
- package/components/combo/themes/dark/combo.bootstrap.css.js +1 -1
- package/components/combo/themes/dark/combo.bootstrap.css.js.map +1 -1
- package/components/combo/themes/dark/combo.fluent.css.js +1 -1
- package/components/combo/themes/dark/combo.fluent.css.js.map +1 -1
- package/components/combo/themes/light/combo.bootstrap.css.js +1 -1
- package/components/combo/themes/light/combo.bootstrap.css.js.map +1 -1
- package/components/combo/themes/light/combo.fluent.css.js +1 -1
- package/components/combo/themes/light/combo.fluent.css.js.map +1 -1
- package/components/common/controllers/key-bindings.js.map +1 -1
- package/components/common/controllers/root-click.d.ts +1 -1
- package/components/common/controllers/root-click.js.map +1 -1
- package/components/common/controllers/root-scroll.js.map +1 -1
- package/components/common/decorators/watch.js.map +1 -1
- package/components/common/definitions/defineComponents.js.map +1 -1
- package/components/common/definitions/register.js.map +1 -1
- package/components/common/mixins/alert.js.map +1 -1
- package/components/common/mixins/combo-box.js.map +1 -1
- package/components/common/mixins/form-associated.js.map +1 -1
- package/components/common/util.js.map +1 -1
- package/components/date-time-input/date-time-input.js.map +1 -1
- package/components/date-time-input/date-util.js.map +1 -1
- package/components/dialog/dialog.js +2 -1
- package/components/dialog/dialog.js.map +1 -1
- package/components/dialog/themes/themes.js +8 -9
- package/components/dialog/themes/themes.js.map +1 -1
- package/components/dropdown/dropdown.js.map +1 -1
- package/components/dropdown/themes/dark/dropdown.bootstrap.css.js +1 -1
- package/components/dropdown/themes/dark/dropdown.bootstrap.css.js.map +1 -1
- package/components/dropdown/themes/dark/dropdown.fluent.css.js +1 -1
- package/components/dropdown/themes/dark/dropdown.fluent.css.js.map +1 -1
- package/components/dropdown/themes/light/dropdown.bootstrap.css.js +1 -1
- package/components/dropdown/themes/light/dropdown.bootstrap.css.js.map +1 -1
- package/components/dropdown/themes/light/dropdown.fluent.css.js +1 -1
- package/components/dropdown/themes/light/dropdown.fluent.css.js.map +1 -1
- package/components/dropdown/themes/shared/item/dropdown-item.fluent.css.js +1 -1
- package/components/dropdown/themes/shared/item/dropdown-item.fluent.css.js.map +1 -1
- package/components/expansion-panel/expansion-panel.d.ts +1 -1
- package/components/expansion-panel/expansion-panel.js +2 -1
- package/components/expansion-panel/expansion-panel.js.map +1 -1
- package/components/expansion-panel/themes/themes.js +8 -9
- package/components/expansion-panel/themes/themes.js.map +1 -1
- package/components/form/form.js.map +1 -1
- package/components/icon/icon.d.ts +2 -2
- package/components/icon/icon.js +6 -7
- package/components/icon/icon.js.map +1 -1
- package/components/icon/icon.registry.js.map +1 -1
- package/components/icon/themes/themes.js +8 -9
- package/components/icon/themes/themes.js.map +1 -1
- package/components/input/input-base.js +0 -4
- package/components/input/input-base.js.map +1 -1
- package/components/list/list-header.d.ts +1 -1
- package/components/list/list-header.js +2 -1
- package/components/list/list-header.js.map +1 -1
- package/components/list/list-item.d.ts +1 -1
- package/components/list/list-item.js +2 -1
- package/components/list/list-item.js.map +1 -1
- package/components/list/themes/header.js +8 -9
- package/components/list/themes/header.js.map +1 -1
- package/components/list/themes/item.js +8 -9
- package/components/list/themes/item.js.map +1 -1
- package/components/mask-input/mask-input-base.js.map +1 -1
- package/components/mask-input/mask-input.js.map +1 -1
- package/components/mask-input/mask-parser.js.map +1 -1
- package/components/nav-drawer/nav-drawer-header-item.d.ts +1 -1
- package/components/nav-drawer/nav-drawer-header-item.js +2 -1
- package/components/nav-drawer/nav-drawer-header-item.js.map +1 -1
- package/components/nav-drawer/nav-drawer-item.d.ts +1 -1
- package/components/nav-drawer/nav-drawer-item.js +2 -1
- package/components/nav-drawer/nav-drawer-item.js.map +1 -1
- package/components/nav-drawer/nav-drawer.d.ts +1 -1
- package/components/nav-drawer/nav-drawer.js +2 -1
- package/components/nav-drawer/nav-drawer.js.map +1 -1
- package/components/nav-drawer/themes/container.base.css.js +1 -1
- package/components/nav-drawer/themes/container.base.css.js.map +1 -1
- package/components/nav-drawer/themes/container.js +8 -9
- package/components/nav-drawer/themes/container.js.map +1 -1
- package/components/nav-drawer/themes/header-item.js +2 -21
- package/components/nav-drawer/themes/header-item.js.map +1 -1
- package/components/nav-drawer/themes/item.js +4 -17
- package/components/nav-drawer/themes/item.js.map +1 -1
- package/components/navbar/navbar.d.ts +1 -1
- package/components/navbar/navbar.js +2 -1
- package/components/navbar/navbar.js.map +1 -1
- package/components/navbar/themes/themes.js +8 -9
- package/components/navbar/themes/themes.js.map +1 -1
- package/components/popover/popover.js.map +1 -1
- package/components/progress/base.js.map +1 -1
- package/components/progress/circular-progress.d.ts +1 -1
- package/components/progress/circular-progress.js +2 -1
- package/components/progress/circular-progress.js.map +1 -1
- package/components/progress/linear-progress.d.ts +1 -1
- package/components/progress/linear-progress.js +2 -1
- package/components/progress/linear-progress.js.map +1 -1
- package/components/progress/themes/circular/themes.js +8 -9
- package/components/progress/themes/circular/themes.js.map +1 -1
- package/components/progress/themes/linear/themes.js +8 -9
- package/components/progress/themes/linear/themes.js.map +1 -1
- package/components/radio/radio.js.map +1 -1
- package/components/radio/utils.js.map +1 -1
- package/components/rating/rating.d.ts +5 -0
- package/components/rating/rating.js +13 -2
- package/components/rating/rating.js.map +1 -1
- package/components/rating/themes/themes.js +8 -9
- package/components/rating/themes/themes.js.map +1 -1
- package/components/select/select-group.js.map +1 -1
- package/components/select/select-item.js.map +1 -1
- package/components/select/select.js.map +1 -1
- package/components/select/themes/dark/select.bootstrap.css.js +1 -1
- package/components/select/themes/dark/select.bootstrap.css.js.map +1 -1
- package/components/select/themes/dark/select.fluent.css.js +1 -1
- package/components/select/themes/dark/select.fluent.css.js.map +1 -1
- package/components/select/themes/light/select.bootstrap.css.js +1 -1
- package/components/select/themes/light/select.bootstrap.css.js.map +1 -1
- package/components/select/themes/light/select.fluent.css.js +1 -1
- package/components/select/themes/light/select.fluent.css.js.map +1 -1
- package/components/slider/range-slider.js.map +1 -1
- package/components/slider/slider-base.js.map +1 -1
- package/components/slider/slider.js.map +1 -1
- package/components/snackbar/snackbar.d.ts +1 -1
- package/components/snackbar/snackbar.js +2 -1
- package/components/snackbar/snackbar.js.map +1 -1
- package/components/snackbar/themes/themes.js +8 -9
- package/components/snackbar/themes/themes.js.map +1 -1
- package/components/stepper/step.d.ts +1 -1
- package/components/stepper/step.js +2 -1
- package/components/stepper/step.js.map +1 -1
- package/components/stepper/stepper.js.map +1 -1
- package/components/stepper/themes/step/themes.js +8 -9
- package/components/stepper/themes/step/themes.js.map +1 -1
- package/components/tabs/tab.d.ts +1 -1
- package/components/tabs/tab.js +2 -1
- package/components/tabs/tab.js.map +1 -1
- package/components/tabs/tabs.d.ts +1 -1
- package/components/tabs/tabs.js +2 -1
- package/components/tabs/tabs.js.map +1 -1
- package/components/tabs/themes/tab-themes.js +4 -17
- package/components/tabs/themes/tab-themes.js.map +1 -1
- package/components/tabs/themes/tabs-themes.js +8 -9
- package/components/tabs/themes/tabs-themes.js.map +1 -1
- package/components/textarea/textarea.js.map +1 -1
- package/components/toast/themes/themes.js +8 -9
- package/components/toast/themes/themes.js.map +1 -1
- package/components/toast/toast.js +2 -1
- package/components/toast/toast.js.map +1 -1
- package/components/tree/tree-item.d.ts +1 -1
- package/components/tree/tree-item.js +20 -4
- package/components/tree/tree-item.js.map +1 -1
- package/components/tree/tree.d.ts +5 -0
- package/components/tree/tree.js +4 -0
- package/components/tree/tree.js.map +1 -1
- package/components/tree/tree.navigation.js.map +1 -1
- package/components/tree/tree.selection.js.map +1 -1
- package/custom-elements.json +190 -378
- package/package.json +1 -1
- package/theming/config.js.map +1 -1
- package/theming/theming-controller.js.map +1 -1
- package/theming/utils.js.map +1 -1
- package/components/toggle/toggle.controller.d.ts +0 -52
- package/components/toggle/toggle.controller.js +0 -92
- package/components/toggle/toggle.controller.js.map +0 -1
- package/components/toggle/toggle.directive.d.ts +0 -20
- package/components/toggle/toggle.directive.js +0 -94
- package/components/toggle/toggle.directive.js.map +0 -1
- package/components/toggle/types.d.ts +0 -51
- package/components/toggle/types.js +0 -2
- package/components/toggle/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo.bootstrap.css.js","sourceRoot":"","sources":["../../../../../src/components/combo/themes/light/combo.bootstrap.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,
|
|
1
|
+
{"version":3,"file":"combo.bootstrap.css.js","sourceRoot":"","sources":["../../../../../src/components/combo/themes/light/combo.bootstrap.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,m/IAAm/I,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`:host{--toggle-button-background-focus--border: var(--ig-combo-toggle-button-background-focus--border, hsla(var(--ig-gray-300), var(--ig-gray-a)));--case-icon-color: var(--ig-combo-case-icon-color, hsla(var(--ig-gray-400), var(--ig-gray-a)));--case-icon-color--active: var(--ig-combo-case-icon-color--active, hsla(var(--ig-primary-500), var(--ig-primary-a)));--empty-list-background: var(--ig-combo-empty-list-background, hsla(var(--ig-surface-500), var(--ig-surface-a)));--search-separator-border-color: var(--ig-combo-search-separator-border-color, hsla(var(--ig-gray-400), var(--ig-gray-a)));--empty-list-placeholder-color: var(--ig-combo-empty-list-placeholder-color, hsla(var(--ig-gray-600), var(--ig-gray-a)));--toggle-button-background: var(--ig-combo-toggle-button-background, hsla(var(--ig-gray-300), var(--ig-gray-a)));--toggle-button-background-focus: var(--ig-combo-toggle-button-background-focus, hsla(var(--ig-gray-300), var(--ig-gray-a)));--toggle-button-foreground: var(--ig-combo-toggle-button-foreground, hsla(var(--ig-gray-800), var(--ig-gray-a)));--toggle-button-foreground-focus: var(--ig-combo-toggle-button-foreground-focus, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-foreground-filled: var(--ig-combo-toggle-button-foreground-filled, hsla(var(--ig-gray-800), var(--ig-gray-a)));--clear-button-background: var(--ig-combo-clear-button-background, hsla(var(--ig-gray-300), var(--ig-gray-a)));--clear-button-background-focus: var(--ig-combo-clear-button-background-focus, hsla(var(--ig-gray-300), var(--ig-gray-a)));--clear-button-foreground: var(--ig-combo-clear-button-foreground, hsla(var(--ig-gray-800), var(--ig-gray-a)));--clear-button-foreground-focus: var(--ig-combo-clear-button-foreground-focus, hsla(var(--ig-gray-800), var(--ig-gray-a)));--toggle-button-background-disabled: var(--ig-combo-toggle-button-background-disabled, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-foreground-disabled: var(--ig-combo-toggle-button-foreground-disabled, hsla(var(--ig-gray-400), var(--ig-gray-a)));--default-size: var(--ig-combo-default-size, 2);--toggle-button-foreground--focus: var(--ig-combo-toggle-button-foreground--focus, hsla(var(--ig-gray-800), var(--ig-gray-a)));--elevation: var(--ig-combo-list-elevation, var(--ig-elevation-0));--background-color: var(--ig-combo-list-background-color, hsla(var(--ig-surface-500), var(--ig-surface-a)));--header-text-color: var(--ig-combo-list-header-text-color, hsla(var(--ig-gray-700), var(--ig-gray-a)));--item-text-color: var(--ig-combo-list-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--hover-item-text-color: var(--ig-combo-list-hover-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--hover-item-background: var(--ig-combo-list-hover-item-background, hsla(var(--ig-gray-200), var(--ig-gray-a)));--focused-item-background: var(--ig-combo-list-focused-item-background, hsla(var(--ig-gray-200), var(--ig-gray-a)));--focused-item-text-color: var(--ig-combo-list-focused-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--selected-item-background: var(--ig-combo-list-selected-item-background, hsla(var(--ig-primary-500), var(--ig-primary-a)));--selected-item-text-color: var(--ig-combo-list-selected-item-text-color, var(--ig-primary-600-contrast));--selected-hover-item-background: var(--ig-combo-list-selected-hover-item-background, hsla(var(--ig-primary-600), var(--ig-primary-a)));--selected-hover-item-text-color: var(--ig-combo-list-selected-hover-item-text-color, var(--ig-primary-600-contrast));--selected-focus-item-background: var(--ig-combo-list-selected-focus-item-background, hsla(var(--ig-primary-600), var(--ig-primary-a)));--selected-focus-item-text-color: var(--ig-combo-list-selected-focus-item-text-color, var(--ig-primary-600-contrast));--disabled-item-background: var(--ig-combo-list-disabled-item-background, hsla(var(--ig-gray-50), 0));--disabled-item-text-color: var(--ig-combo-list-disabled-item-text-color, hsla(var(--ig-gray-400), var(--ig-gray-a)));--border-color: var(--ig-combo-list-border-color, hsla(var(--ig-gray-300), var(--ig-gray-a)));--border-width: var(--ig-combo-list-border-width, 1px);--border-radius: var(--ig-combo-list-border-radius, clamp(0rem, calc(var(--ig-radius-factor, 0.2) * 1.25rem), 1.25rem));--item-border-radius: var(--ig-combo-list-item-border-radius, clamp(0rem, calc(var(--ig-radius-factor, 0) * 1.25rem), 1.25rem));--size: var(--ig-combo-list-size, max(var(--is-large, 1) * max(2.5rem, -1 * 2.5rem), var(--is-medium, 1) * max(2rem, -1 * 2rem), var(--is-small, 1) * max(1.75rem, -1 * 1.75rem)))}`;\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const styles = css `:host{--toggle-button-background-focus--border: var(--ig-combo-toggle-button-background-focus--border, hsla(var(--ig-gray-300), var(--ig-gray-a)));--case-icon-color: var(--ig-combo-case-icon-color, hsla(var(--ig-gray-400), var(--ig-gray-a)));--case-icon-color--active: var(--ig-combo-case-icon-color--active, hsla(var(--ig-primary-500), var(--ig-primary-a)));--empty-list-background: var(--ig-combo-empty-list-background, hsla(var(--ig-surface-500), var(--ig-surface-a)));--search-separator-border-color: var(--ig-combo-search-separator-border-color, hsla(var(--ig-gray-500), var(--ig-gray-a)));--empty-list-placeholder-color: var(--ig-combo-empty-list-placeholder-color, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-background: var(--ig-combo-toggle-button-background, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-background-focus: var(--ig-combo-toggle-button-background-focus, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-foreground: var(--ig-combo-toggle-button-foreground, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-foreground-focus: var(--ig-combo-toggle-button-foreground-focus, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-foreground-filled: var(--ig-combo-toggle-button-foreground-filled, hsla(var(--ig-gray-700), var(--ig-gray-a)));--clear-button-background: var(--ig-combo-clear-button-background, hsla(var(--ig-gray-100), var(--ig-gray-a)));--clear-button-background-focus: var(--ig-combo-clear-button-background-focus, hsla(var(--ig-gray-100), var(--ig-gray-a)));--clear-button-foreground: var(--ig-combo-clear-button-foreground, var(--ig-gray-100-contrast));--clear-button-foreground-focus: var(--ig-combo-clear-button-foreground-focus, var(--ig-gray-100-contrast));--toggle-button-background-disabled: var(--ig-combo-toggle-button-background-disabled, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-foreground-disabled: var(--ig-combo-toggle-button-foreground-disabled, hsla(var(--ig-gray-400), var(--ig-gray-a)));--default-size: var(--ig-combo-default-size, 2);--elevation: var(--ig-combo-list-elevation, var(--ig-elevation-4));--background-color: var(--ig-combo-list-background-color, hsla(var(--ig-surface-500), var(--ig-surface-a)));--header-text-color: var(--ig-combo-list-header-text-color, hsla(var(--ig-secondary-500), var(--ig-secondary-a)));--item-text-color: var(--ig-combo-list-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--hover-item-text-color: var(--ig-combo-list-hover-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--hover-item-background: var(--ig-combo-list-hover-item-background, hsla(var(--ig-gray-100),
|
|
2
|
+
export const styles = css `:host{--toggle-button-background-focus--border: var(--ig-combo-toggle-button-background-focus--border, hsla(var(--ig-gray-300), var(--ig-gray-a)));--case-icon-color: var(--ig-combo-case-icon-color, hsla(var(--ig-gray-400), var(--ig-gray-a)));--case-icon-color--active: var(--ig-combo-case-icon-color--active, hsla(var(--ig-primary-500), var(--ig-primary-a)));--empty-list-background: var(--ig-combo-empty-list-background, hsla(var(--ig-surface-500), var(--ig-surface-a)));--search-separator-border-color: var(--ig-combo-search-separator-border-color, hsla(var(--ig-gray-500), var(--ig-gray-a)));--empty-list-placeholder-color: var(--ig-combo-empty-list-placeholder-color, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-background: var(--ig-combo-toggle-button-background, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-background-focus: var(--ig-combo-toggle-button-background-focus, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-foreground: var(--ig-combo-toggle-button-foreground, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-foreground-focus: var(--ig-combo-toggle-button-foreground-focus, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-foreground-filled: var(--ig-combo-toggle-button-foreground-filled, hsla(var(--ig-gray-700), var(--ig-gray-a)));--clear-button-background: var(--ig-combo-clear-button-background, hsla(var(--ig-gray-100), var(--ig-gray-a)));--clear-button-background-focus: var(--ig-combo-clear-button-background-focus, hsla(var(--ig-gray-100), var(--ig-gray-a)));--clear-button-foreground: var(--ig-combo-clear-button-foreground, var(--ig-gray-100-contrast));--clear-button-foreground-focus: var(--ig-combo-clear-button-foreground-focus, var(--ig-gray-100-contrast));--toggle-button-background-disabled: var(--ig-combo-toggle-button-background-disabled, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-foreground-disabled: var(--ig-combo-toggle-button-foreground-disabled, hsla(var(--ig-gray-400), var(--ig-gray-a)));--default-size: var(--ig-combo-default-size, 2);--elevation: var(--ig-combo-list-elevation, var(--ig-elevation-4));--background-color: var(--ig-combo-list-background-color, hsla(var(--ig-surface-500), var(--ig-surface-a)));--header-text-color: var(--ig-combo-list-header-text-color, hsla(var(--ig-secondary-500), var(--ig-secondary-a)));--item-text-color: var(--ig-combo-list-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--hover-item-text-color: var(--ig-combo-list-hover-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--hover-item-background: var(--ig-combo-list-hover-item-background, hsla(var(--ig-gray-100), var(--ig-gray-a)));--focused-item-background: var(--ig-combo-list-focused-item-background, hsla(var(--ig-surface-500), var(--ig-surface-a)));--focused-item-text-color: var(--ig-combo-list-focused-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--selected-item-background: var(--ig-combo-list-selected-item-background, hsla(var(--ig-gray-200), var(--ig-gray-a)));--selected-item-text-color: var(--ig-combo-list-selected-item-text-color, var(--ig-gray-200-contrast));--selected-hover-item-background: var(--ig-combo-list-selected-hover-item-background, hsla(var(--ig-gray-200), var(--ig-gray-a)));--selected-hover-item-text-color: var(--ig-combo-list-selected-hover-item-text-color, var(--ig-gray-200-contrast));--selected-focus-item-background: var(--ig-combo-list-selected-focus-item-background, hsla(var(--ig-gray-200), var(--ig-gray-a)));--selected-focus-item-text-color: var(--ig-combo-list-selected-focus-item-text-color, var(--ig-gray-200-contrast));--disabled-item-background: var(--ig-combo-list-disabled-item-background, hsla(var(--ig-gray-50), 0));--disabled-item-text-color: var(--ig-combo-list-disabled-item-text-color, hsla(var(--ig-gray-500), var(--ig-gray-a)));--border-color: var(--ig-combo-list-border-color, hsla(var(--ig-gray-700), var(--ig-gray-a)));--border-width: var(--ig-combo-list-border-width, 0);--border-radius: var(--ig-combo-list-border-radius, clamp(0rem, calc(var(--ig-radius-factor, 0.1) * 1.25rem), 1.25rem));--item-border-radius: var(--ig-combo-list-item-border-radius, clamp(0rem, calc(var(--ig-radius-factor, 0) * 1.25rem), 1.25rem));--size: var(--ig-combo-list-size, max(var(--is-large, 1) * max(2.5rem, -1 * 2.5rem), var(--is-medium, 1) * max(2rem, -1 * 2rem), var(--is-small, 1) * max(1.75rem, -1 * 1.75rem)))}`;
|
|
3
3
|
//# sourceMappingURL=combo.fluent.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo.fluent.css.js","sourceRoot":"","sources":["../../../../../src/components/combo/themes/light/combo.fluent.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,
|
|
1
|
+
{"version":3,"file":"combo.fluent.css.js","sourceRoot":"","sources":["../../../../../src/components/combo/themes/light/combo.fluent.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,y0IAAy0I,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`:host{--toggle-button-background-focus--border: var(--ig-combo-toggle-button-background-focus--border, hsla(var(--ig-gray-300), var(--ig-gray-a)));--case-icon-color: var(--ig-combo-case-icon-color, hsla(var(--ig-gray-400), var(--ig-gray-a)));--case-icon-color--active: var(--ig-combo-case-icon-color--active, hsla(var(--ig-primary-500), var(--ig-primary-a)));--empty-list-background: var(--ig-combo-empty-list-background, hsla(var(--ig-surface-500), var(--ig-surface-a)));--search-separator-border-color: var(--ig-combo-search-separator-border-color, hsla(var(--ig-gray-500), var(--ig-gray-a)));--empty-list-placeholder-color: var(--ig-combo-empty-list-placeholder-color, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-background: var(--ig-combo-toggle-button-background, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-background-focus: var(--ig-combo-toggle-button-background-focus, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-foreground: var(--ig-combo-toggle-button-foreground, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-foreground-focus: var(--ig-combo-toggle-button-foreground-focus, hsla(var(--ig-gray-700), var(--ig-gray-a)));--toggle-button-foreground-filled: var(--ig-combo-toggle-button-foreground-filled, hsla(var(--ig-gray-700), var(--ig-gray-a)));--clear-button-background: var(--ig-combo-clear-button-background, hsla(var(--ig-gray-100), var(--ig-gray-a)));--clear-button-background-focus: var(--ig-combo-clear-button-background-focus, hsla(var(--ig-gray-100), var(--ig-gray-a)));--clear-button-foreground: var(--ig-combo-clear-button-foreground, var(--ig-gray-100-contrast));--clear-button-foreground-focus: var(--ig-combo-clear-button-foreground-focus, var(--ig-gray-100-contrast));--toggle-button-background-disabled: var(--ig-combo-toggle-button-background-disabled, hsla(var(--ig-gray-100), var(--ig-gray-a)));--toggle-button-foreground-disabled: var(--ig-combo-toggle-button-foreground-disabled, hsla(var(--ig-gray-400), var(--ig-gray-a)));--default-size: var(--ig-combo-default-size, 2);--elevation: var(--ig-combo-list-elevation, var(--ig-elevation-4));--background-color: var(--ig-combo-list-background-color, hsla(var(--ig-surface-500), var(--ig-surface-a)));--header-text-color: var(--ig-combo-list-header-text-color, hsla(var(--ig-secondary-500), var(--ig-secondary-a)));--item-text-color: var(--ig-combo-list-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--hover-item-text-color: var(--ig-combo-list-hover-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--hover-item-background: var(--ig-combo-list-hover-item-background, hsla(var(--ig-gray-100), var(--ig-gray-a)));--focused-item-background: var(--ig-combo-list-focused-item-background, hsla(var(--ig-surface-500), var(--ig-surface-a)));--focused-item-text-color: var(--ig-combo-list-focused-item-text-color, hsla(var(--ig-gray-800), var(--ig-gray-a)));--selected-item-background: var(--ig-combo-list-selected-item-background, hsla(var(--ig-gray-200), var(--ig-gray-a)));--selected-item-text-color: var(--ig-combo-list-selected-item-text-color, var(--ig-gray-200-contrast));--selected-hover-item-background: var(--ig-combo-list-selected-hover-item-background, hsla(var(--ig-gray-200), var(--ig-gray-a)));--selected-hover-item-text-color: var(--ig-combo-list-selected-hover-item-text-color, var(--ig-gray-200-contrast));--selected-focus-item-background: var(--ig-combo-list-selected-focus-item-background, hsla(var(--ig-gray-200), var(--ig-gray-a)));--selected-focus-item-text-color: var(--ig-combo-list-selected-focus-item-text-color, var(--ig-gray-200-contrast));--disabled-item-background: var(--ig-combo-list-disabled-item-background, hsla(var(--ig-gray-50), 0));--disabled-item-text-color: var(--ig-combo-list-disabled-item-text-color, hsla(var(--ig-gray-500), var(--ig-gray-a)));--border-color: var(--ig-combo-list-border-color, hsla(var(--ig-gray-700), var(--ig-gray-a)));--border-width: var(--ig-combo-list-border-width, 0);--border-radius: var(--ig-combo-list-border-radius, clamp(0rem, calc(var(--ig-radius-factor, 0.1) * 1.25rem), 1.25rem));--item-border-radius: var(--ig-combo-list-item-border-radius, clamp(0rem, calc(var(--ig-radius-factor, 0) * 1.25rem), 1.25rem));--size: var(--ig-combo-list-size, max(var(--is-large, 1) * max(2.5rem, -1 * 2.5rem), var(--is-medium, 1) * max(2rem, -1 * 2rem), var(--is-small, 1) * max(1.75rem, -1 * 1.75rem)))}`;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-bindings.js","sourceRoot":"","sources":["../../../../src/components/common/controllers/key-bindings.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,SAAS,GAAG,WAAoB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,YAAqB,CAAC;AAChD,MAAM,CAAC,MAAM,OAAO,GAAG,SAAkB,CAAC;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,WAAoB,CAAC;AAC9C,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAgB,CAAC;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAY,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,QAAiB,CAAC;AAC3C,MAAM,CAAC,MAAM,OAAO,GAAG,MAAe,CAAC;AACvC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAc,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,QAAiB,CAAC;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,UAAmB,CAAC;AAC/C,MAAM,CAAC,MAAM,MAAM,GAAG,KAAc,CAAC;AAGrC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAc,CAAC;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,MAAe,CAAC;AACvC,MAAM,CAAC,MAAM,OAAO,GAAG,MAAe,CAAC;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAgB,CAAC;AAmGzC,MAAM,WAAW,GAAG,IAAI,GAAG,CACzB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,GA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IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;CACF;AAMD,MAAM,UAAU,cAAc,CAC5B,OAAyC,EACzC,OAAqC;IAErC,OAAO,IAAI,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport type { Ref } from 'lit/directives/ref.js';\n\n/* Common keys */\nexport const arrowLeft = 'ArrowLeft' as const;\nexport const arrowRight = 'ArrowRight' as const;\nexport const arrowUp = 'ArrowUp' as const;\nexport const arrowDown = 'ArrowDown' as const;\nexport const enterKey = 'Enter' as const;\nexport const spaceBar = ' ' as const;\nexport const escapeKey = 'Escape' as const;\nexport const homeKey = 'Home' as const;\nexport const endKey = 'End' as const;\nexport const pageUpKey = 'PageUp' as const;\nexport const pageDownKey = 'PageDown' as const;\nexport const tabKey = 'Tab' as const;\n\n/* Modifiers */\nexport const altKey = 'Alt' as const;\nexport const ctrlKey = 'Ctrl' as const;\nexport const metaKey = 'Meta' as const;\nexport const shiftKey = 'Shift' as const;\n\n/* Types */\nexport type KeyBindingHandler = (event: KeyboardEvent) => void;\nexport type KeyBindingObserverCleanup = { unsubscribe: () => void };\n\n/**\n * Whether the current event should be ignored by the controller.\n *\n * @param node - The event target\n * @param event - The event object\n *\n * When `true` is returned, the current event is ignored.\n */\nexport type KeyBindingSkipCallback = (\n node: Element,\n event: KeyboardEvent\n) => boolean;\n\n/**\n * The event type which will trigger the bound handler.\n *\n * @remarks\n * `keydownRepeat` is similar to `keydown` with the exception\n * that after the handler is invoked the pressed state of the key is reset\n * in the controller.\n */\nexport type KeyBindingTrigger = 'keydown' | 'keyup' | 'keydownRepeat';\n\n/**\n * Configuration object for the controller.\n */\nexport interface KeyBindingControllerOptions {\n /**\n * By default, the controller listens for keypress events in the context of the host element.\n * If you pass a `ref`, you can limit the observation to a certain DOM part of the host scope.\n */\n ref?: Ref;\n /**\n * Option to ignore key press events.\n *\n * If passed an array of CSS selectors, it will ignore key presses originating from elements in the event composed path\n * that match one of the selectors.\n * Otherwise you can pass a {@link KeyBindingSkipCallback} function.\n *\n * Defaults to `['input', 'textarea', 'select']`.\n *\n * @example\n * ```ts\n * {\n * // Skip events originating from elements with `readonly` attribute\n * skip: ['[readonly]']\n * }\n * ...\n * {\n * // Same as above but with a callback\n * skip: (node: Element) => node.hasAttribute('readonly')\n * }\n * ```\n */\n skip?: string[] | KeyBindingSkipCallback;\n /**\n * A set of KeyBindingOptions configuration which is applied to every handler\n * that is added to the controller.\n *\n * Any additional KeyBindingOptions values passed when `set` is called\n * will be merged with `bindingDefaults`.\n */\n bindingDefaults?: KeyBindingOptions;\n}\n\n/**\n * Configuration object for customizing the behavior of\n * the registered handler.\n */\nexport interface KeyBindingOptions {\n /**\n * The event type(s) on which the handler will be invoked.\n *\n * Defaults to `keydown` if not set.\n */\n triggers?: KeyBindingTrigger[];\n /**\n * Whether to call `preventDefault` on the target event before the handler is invoked.\n */\n preventDefault?: boolean;\n /**\n * Whether to call `stopPropagation` on the target event before the handler is invoked.\n */\n stopPropagation?: boolean;\n}\n\ninterface KeyBinding {\n keys: string[];\n handler: KeyBindingHandler;\n options?: KeyBindingOptions;\n modifiers?: string[];\n}\n\nconst __modifiers = new Set<string>(\n [altKey, ctrlKey, metaKey, shiftKey].map((key) => key.toLowerCase())\n);\n\nconst defaultOptions: KeyBindingControllerOptions = {\n skip: ['input', 'textarea', 'select'],\n};\n\nfunction normalizeKeys(keys: string | string[]) {\n return (Array.isArray(keys) ? keys : [keys]).map((key) => key.toLowerCase());\n}\n\nfunction isModifier(key: string) {\n return __modifiers.has(key);\n}\n\nfunction isKeydown(event: Event) {\n return event.type === 'keydown';\n}\n\nfunction isKeyup(event: Event) {\n return event.type === 'keyup';\n}\n\nfunction isKeydownTrigger(triggers?: KeyBindingTrigger[]) {\n return triggers\n ? triggers.includes('keydown') || isKeydownRepeatTrigger(triggers)\n : false;\n}\n\nfunction isKeyupTrigger(triggers?: KeyBindingTrigger[]) {\n return triggers ? triggers.includes('keyup') : false;\n}\n\nfunction isKeydownRepeatTrigger(triggers?: KeyBindingTrigger[]) {\n return triggers ? triggers.includes('keydownRepeat') : false;\n}\n\nfunction isElement(node: EventTarget): node is Element {\n return (node as Element).nodeType === Node.ELEMENT_NODE;\n}\n\nexport function parseKeys(keys: string | string[]) {\n const parsed = normalizeKeys(keys);\n return {\n keys: parsed.filter((key) => !isModifier(key)),\n modifiers: parsed.filter((key) => isModifier(key)),\n };\n}\n\nclass KeyBindingController implements ReactiveController {\n protected _host: ReactiveControllerHost & Element;\n protected _ref?: Ref;\n protected _observedElement?: Element;\n protected _options?: KeyBindingControllerOptions;\n private bindings = new Set<KeyBinding>();\n private pressedKeys = new Set<string>();\n\n protected get _element() {\n if (this._observedElement) {\n return this._observedElement;\n }\n return this._ref ? this._ref.value : this._host;\n }\n\n /**\n * Sets the controller to listen for keyboard events on an arbitrary `element` in the page context.\n * All the configuration and event handlers are applied as well.\n *\n * Returns an object with an `unsubscribe` function which should be called when the observing of keyboard\n * events on the `element` should cease.\n */\n public observeElement(element: Element): KeyBindingObserverCleanup {\n element.addEventListener('keydown', this);\n element.addEventListener('keyup', this);\n this._observedElement = element;\n\n return {\n unsubscribe: () => {\n this._observedElement?.removeEventListener('keydown', this);\n this._observedElement?.removeEventListener('keyup', this);\n this._observedElement = undefined;\n },\n };\n }\n\n constructor(\n host: ReactiveControllerHost & Element,\n options?: KeyBindingControllerOptions\n ) {\n this._host = host;\n this._ref = options?.ref;\n this._options = { ...defaultOptions, ...options };\n host.addController(this);\n }\n\n /**\n * Checks and executes any event modifiers that are present in the matched binding.\n */\n private eventModifiersMatch(binding: KeyBinding, event: KeyboardEvent) {\n if (binding.options?.preventDefault) {\n event.preventDefault();\n }\n\n if (binding.options?.stopPropagation) {\n event.stopPropagation();\n }\n }\n\n private keysMatch(binding: KeyBinding, event: KeyboardEvent) {\n const modifiers = binding.modifiers ?? [];\n return (\n binding.keys.every((key) => this.pressedKeys.has(key)) &&\n modifiers.every((mod) => !!event[`${mod}Key` as keyof KeyboardEvent])\n );\n }\n\n private bindingMatches(binding: KeyBinding, event: KeyboardEvent) {\n const triggers = binding.options?.triggers ?? ['keydown'];\n\n if (!this.keysMatch(binding, event)) {\n return false;\n }\n\n if (isKeydown(event) && isKeydownTrigger(triggers)) {\n return true;\n }\n\n if (isKeyup(event) && isKeyupTrigger(triggers)) {\n return true;\n }\n\n return false;\n }\n\n public handleEvent(event: KeyboardEvent) {\n const key = event.key.toLowerCase();\n const path = event.composedPath();\n const skip = this._options?.skip;\n\n if (!this._element || !path.includes(this._element)) {\n return;\n }\n\n if (skip) {\n const shouldSkip = Array.isArray(skip)\n ? path.some(\n (target) =>\n isElement(target) &&\n skip.some((selector) => target.matches(selector))\n )\n : skip.call(this._host, event.target as Element, event);\n\n if (shouldSkip) {\n return;\n }\n }\n\n if (isModifier(key)) {\n this.pressedKeys.clear();\n }\n\n if (isKeydown(event) && !isModifier(key)) {\n this.pressedKeys.add(key);\n }\n\n for (const binding of this.bindings) {\n if (this.bindingMatches(binding, event)) {\n this.eventModifiersMatch(binding, event);\n\n binding.handler.call(this._host, event);\n\n if (isKeydownRepeatTrigger(binding.options?.triggers)) {\n this.pressedKeys.delete(key);\n }\n }\n }\n\n if (isKeyup(event) && !isModifier(key)) {\n this.pressedKeys.delete(key);\n }\n }\n\n /**\n * Registers a keybinding handler.\n */\n public set(\n key: string | string[],\n fn: KeyBindingHandler,\n options?: KeyBindingOptions\n ) {\n this.bindings.add({\n ...parseKeys(key),\n handler: fn,\n options: { ...this._options?.bindingDefaults, ...options },\n });\n\n return this;\n }\n\n /**\n * Register a handler function which is called when the target receives a key\n * which \"activates\" it.\n *\n * In the browser context this is usually either an Enter and/or Space keypress.\n */\n public setActivateHandler(\n fn: KeyBindingHandler,\n options?: KeyBindingOptions\n ) {\n for (const key of [enterKey, spaceBar]) {\n this.set(key, fn, options);\n }\n\n return this;\n }\n\n public hostConnected(): void {\n this._host.addEventListener('keyup', this);\n this._host.addEventListener('keydown', this);\n }\n\n public hostDisconnected(): void {\n this._host.removeEventListener('keyup', this);\n this._host.removeEventListener('keydown', this);\n }\n}\n\n/**\n * Creates a keybinding controller and adds to it to the passed `element`\n * with the provided `options`.\n */\nexport function addKeybindings(\n element: ReactiveControllerHost & Element,\n options?: KeyBindingControllerOptions\n) {\n return new KeyBindingController(element, options);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"key-bindings.js","sourceRoot":"","sources":["../../../../src/components/common/controllers/key-bindings.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,SAAS,GAAG,WAAoB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,YAAqB,CAAC;AAChD,MAAM,CAAC,MAAM,OAAO,GAAG,SAAkB,CAAC;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,WAAoB,CAAC;AAC9C,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAgB,CAAC;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAY,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,QAAiB,CAAC;AAC3C,MAAM,CAAC,MAAM,OAAO,GAAG,MAAe,CAAC;AACvC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAc,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,QAAiB,CAAC;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,UAAmB,CAAC;AAC/C,MAAM,CAAC,MAAM,MAAM,GAAG,KAAc,CAAC;AAGrC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAc,CAAC;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,MAAe,CAAC;AACvC,MAAM,CAAC,MAAM,OAAO,GAAG,MAAe,CAAC;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAgB,CAAC;AAmGzC,MAAM,WAAW,GAAG,IAAI,G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IAAI,CAAC;IACd,CAAC;IAEM,aAAa;QAClB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAEM,gBAAgB;QACrB,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;CACF;AAMD,MAAM,UAAU,cAAc,CAC5B,OAAyC,EACzC,OAAqC;IAErC,OAAO,IAAI,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport type { Ref } from 'lit/directives/ref.js';\n\n/* Common keys */\nexport const arrowLeft = 'ArrowLeft' as const;\nexport const arrowRight = 'ArrowRight' as const;\nexport const arrowUp = 'ArrowUp' as const;\nexport const arrowDown = 'ArrowDown' as const;\nexport const enterKey = 'Enter' as const;\nexport const spaceBar = ' ' as const;\nexport const escapeKey = 'Escape' as const;\nexport const homeKey = 'Home' as const;\nexport const endKey = 'End' as const;\nexport const pageUpKey = 'PageUp' as const;\nexport const pageDownKey = 'PageDown' as const;\nexport const tabKey = 'Tab' as const;\n\n/* Modifiers */\nexport const altKey = 'Alt' as const;\nexport const ctrlKey = 'Ctrl' as const;\nexport const metaKey = 'Meta' as const;\nexport const shiftKey = 'Shift' as const;\n\n/* Types */\nexport type KeyBindingHandler = (event: KeyboardEvent) => void;\nexport type KeyBindingObserverCleanup = { unsubscribe: () => void };\n\n/**\n * Whether the current event should be ignored by the controller.\n *\n * @param node - The event target\n * @param event - The event object\n *\n * When `true` is returned, the current event is ignored.\n */\nexport type KeyBindingSkipCallback = (\n node: Element,\n event: KeyboardEvent\n) => boolean;\n\n/**\n * The event type which will trigger the bound handler.\n *\n * @remarks\n * `keydownRepeat` is similar to `keydown` with the exception\n * that after the handler is invoked the pressed state of the key is reset\n * in the controller.\n */\nexport type KeyBindingTrigger = 'keydown' | 'keyup' | 'keydownRepeat';\n\n/**\n * Configuration object for the controller.\n */\nexport interface KeyBindingControllerOptions {\n /**\n * By default, the controller listens for keypress events in the context of the host element.\n * If you pass a `ref`, you can limit the observation to a certain DOM part of the host scope.\n */\n ref?: Ref;\n /**\n * Option to ignore key press events.\n *\n * If passed an array of CSS selectors, it will ignore key presses originating from elements in the event composed path\n * that match one of the selectors.\n * Otherwise you can pass a {@link KeyBindingSkipCallback} function.\n *\n * Defaults to `['input', 'textarea', 'select']`.\n *\n * @example\n * ```ts\n * {\n * // Skip events originating from elements with `readonly` attribute\n * skip: ['[readonly]']\n * }\n * ...\n * {\n * // Same as above but with a callback\n * skip: (node: Element) => node.hasAttribute('readonly')\n * }\n * ```\n */\n skip?: string[] | KeyBindingSkipCallback;\n /**\n * A set of KeyBindingOptions configuration which is applied to every handler\n * that is added to the controller.\n *\n * Any additional KeyBindingOptions values passed when `set` is called\n * will be merged with `bindingDefaults`.\n */\n bindingDefaults?: KeyBindingOptions;\n}\n\n/**\n * Configuration object for customizing the behavior of\n * the registered handler.\n */\nexport interface KeyBindingOptions {\n /**\n * The event type(s) on which the handler will be invoked.\n *\n * Defaults to `keydown` if not set.\n */\n triggers?: KeyBindingTrigger[];\n /**\n * Whether to call `preventDefault` on the target event before the handler is invoked.\n */\n preventDefault?: boolean;\n /**\n * Whether to call `stopPropagation` on the target event before the handler is invoked.\n */\n stopPropagation?: boolean;\n}\n\ninterface KeyBinding {\n keys: string[];\n handler: KeyBindingHandler;\n options?: KeyBindingOptions;\n modifiers?: string[];\n}\n\nconst __modifiers = new Set<string>(\n [altKey, ctrlKey, metaKey, shiftKey].map((key) => key.toLowerCase())\n);\n\nconst defaultOptions: KeyBindingControllerOptions = {\n skip: ['input', 'textarea', 'select'],\n};\n\nfunction normalizeKeys(keys: string | string[]) {\n return (Array.isArray(keys) ? keys : [keys]).map((key) => key.toLowerCase());\n}\n\nfunction isModifier(key: string) {\n return __modifiers.has(key);\n}\n\nfunction isKeydown(event: Event) {\n return event.type === 'keydown';\n}\n\nfunction isKeyup(event: Event) {\n return event.type === 'keyup';\n}\n\nfunction isKeydownTrigger(triggers?: KeyBindingTrigger[]) {\n return triggers\n ? triggers.includes('keydown') || isKeydownRepeatTrigger(triggers)\n : false;\n}\n\nfunction isKeyupTrigger(triggers?: KeyBindingTrigger[]) {\n return triggers ? triggers.includes('keyup') : false;\n}\n\nfunction isKeydownRepeatTrigger(triggers?: KeyBindingTrigger[]) {\n return triggers ? triggers.includes('keydownRepeat') : false;\n}\n\nfunction isElement(node: EventTarget): node is Element {\n return (node as Element).nodeType === Node.ELEMENT_NODE;\n}\n\nexport function parseKeys(keys: string | string[]) {\n const parsed = normalizeKeys(keys);\n return {\n keys: parsed.filter((key) => !isModifier(key)),\n modifiers: parsed.filter((key) => isModifier(key)),\n };\n}\n\nclass KeyBindingController implements ReactiveController {\n protected _host: ReactiveControllerHost & Element;\n protected _ref?: Ref;\n protected _observedElement?: Element;\n protected _options?: KeyBindingControllerOptions;\n private bindings = new Set<KeyBinding>();\n private pressedKeys = new Set<string>();\n\n protected get _element() {\n if (this._observedElement) {\n return this._observedElement;\n }\n return this._ref ? this._ref.value : this._host;\n }\n\n /**\n * Sets the controller to listen for keyboard events on an arbitrary `element` in the page context.\n * All the configuration and event handlers are applied as well.\n *\n * Returns an object with an `unsubscribe` function which should be called when the observing of keyboard\n * events on the `element` should cease.\n */\n public observeElement(element: Element): KeyBindingObserverCleanup {\n element.addEventListener('keydown', this);\n element.addEventListener('keyup', this);\n this._observedElement = element;\n\n return {\n unsubscribe: () => {\n this._observedElement?.removeEventListener('keydown', this);\n this._observedElement?.removeEventListener('keyup', this);\n this._observedElement = undefined;\n },\n };\n }\n\n constructor(\n host: ReactiveControllerHost & Element,\n options?: KeyBindingControllerOptions\n ) {\n this._host = host;\n this._ref = options?.ref;\n this._options = { ...defaultOptions, ...options };\n host.addController(this);\n }\n\n /**\n * Checks and executes any event modifiers that are present in the matched binding.\n */\n private eventModifiersMatch(binding: KeyBinding, event: KeyboardEvent) {\n if (binding.options?.preventDefault) {\n event.preventDefault();\n }\n\n if (binding.options?.stopPropagation) {\n event.stopPropagation();\n }\n }\n\n private keysMatch(binding: KeyBinding, event: KeyboardEvent) {\n const modifiers = binding.modifiers ?? [];\n return (\n binding.keys.every((key) => this.pressedKeys.has(key)) &&\n modifiers.every((mod) => !!event[`${mod}Key` as keyof KeyboardEvent])\n );\n }\n\n private bindingMatches(binding: KeyBinding, event: KeyboardEvent) {\n const triggers = binding.options?.triggers ?? ['keydown'];\n\n if (!this.keysMatch(binding, event)) {\n return false;\n }\n\n if (isKeydown(event) && isKeydownTrigger(triggers)) {\n return true;\n }\n\n if (isKeyup(event) && isKeyupTrigger(triggers)) {\n return true;\n }\n\n return false;\n }\n\n public handleEvent(event: KeyboardEvent) {\n const key = event.key.toLowerCase();\n const path = event.composedPath();\n const skip = this._options?.skip;\n\n if (!this._element || !path.includes(this._element)) {\n return;\n }\n\n if (skip) {\n const shouldSkip = Array.isArray(skip)\n ? path.some(\n (target) =>\n isElement(target) &&\n skip.some((selector) => target.matches(selector))\n )\n : skip.call(this._host, event.target as Element, event);\n\n if (shouldSkip) {\n return;\n }\n }\n\n if (isModifier(key)) {\n this.pressedKeys.clear();\n }\n\n if (isKeydown(event) && !isModifier(key)) {\n this.pressedKeys.add(key);\n }\n\n for (const binding of this.bindings) {\n if (this.bindingMatches(binding, event)) {\n this.eventModifiersMatch(binding, event);\n\n binding.handler.call(this._host, event);\n\n if (isKeydownRepeatTrigger(binding.options?.triggers)) {\n this.pressedKeys.delete(key);\n }\n }\n }\n\n if (isKeyup(event) && !isModifier(key)) {\n this.pressedKeys.delete(key);\n }\n }\n\n /**\n * Registers a keybinding handler.\n */\n public set(\n key: string | string[],\n fn: KeyBindingHandler,\n options?: KeyBindingOptions\n ) {\n this.bindings.add({\n ...parseKeys(key),\n handler: fn,\n options: { ...this._options?.bindingDefaults, ...options },\n });\n\n return this;\n }\n\n /**\n * Register a handler function which is called when the target receives a key\n * which \"activates\" it.\n *\n * In the browser context this is usually either an Enter and/or Space keypress.\n */\n public setActivateHandler(\n fn: KeyBindingHandler,\n options?: KeyBindingOptions\n ) {\n for (const key of [enterKey, spaceBar]) {\n this.set(key, fn, options);\n }\n\n return this;\n }\n\n public hostConnected(): void {\n this._host.addEventListener('keyup', this);\n this._host.addEventListener('keydown', this);\n }\n\n public hostDisconnected(): void {\n this._host.removeEventListener('keyup', this);\n this._host.removeEventListener('keydown', this);\n }\n}\n\n/**\n * Creates a keybinding controller and adds to it to the passed `element`\n * with the provided `options`.\n */\nexport function addKeybindings(\n element: ReactiveControllerHost & Element,\n options?: KeyBindingControllerOptions\n) {\n return new KeyBindingController(element, options);\n}\n"]}
|
|
@@ -5,7 +5,7 @@ type RootClickControllerConfig = {
|
|
|
5
5
|
};
|
|
6
6
|
type RootClickControllerHost = ReactiveControllerHost & HTMLElement & {
|
|
7
7
|
open: boolean;
|
|
8
|
-
keepOpenOnOutsideClick
|
|
8
|
+
keepOpenOnOutsideClick?: boolean;
|
|
9
9
|
hide(): void;
|
|
10
10
|
};
|
|
11
11
|
declare class RootClickController implements ReactiveController {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-click.js","sourceRoot":"","sources":["../../../../src/components/common/controllers/root-click.ts"],"names":[],"mappings":"AAcA,MAAM,mBAAmB;IACvB,YACmB,IAA6B,EACtC,MAAkC;QADzB,SAAI,GAAJ,IAAI,CAAyB;QACtC,WAAM,GAAN,MAAM,CAA4B;QAE1C,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE;
|
|
1
|
+
{"version":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AAC,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IAEM,MAAM,CAAC,MAAkC;QAC9C,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QAC9C,CAAC;QACD,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAEM,aAAa;QAClB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAEM,gBAAgB;QACrB,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CACjC,IAA6B,EAC7B,MAAkC;IAElC,OAAO,IAAI,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\ntype RootClickControllerConfig = {\n hideCallback?: Function;\n target?: HTMLElement;\n};\n\ntype RootClickControllerHost = ReactiveControllerHost &\n HTMLElement & {\n open: boolean;\n keepOpenOnOutsideClick?: boolean;\n hide(): void;\n };\n\nclass RootClickController implements ReactiveController {\n constructor(\n private readonly host: RootClickControllerHost,\n private config?: RootClickControllerConfig\n ) {\n this.host.addController(this);\n }\n\n private addEventListeners() {\n if (!this.host.keepOpenOnOutsideClick) {\n document.addEventListener('click', this);\n }\n }\n\n private removeEventListeners() {\n document.removeEventListener('click', this);\n }\n\n private configureListeners() {\n this.host.open ? this.addEventListeners() : this.removeEventListeners();\n }\n\n public handleEvent(event: MouseEvent) {\n if (this.host.keepOpenOnOutsideClick) {\n return;\n }\n\n const path = event.composed ? event.composedPath() : [event.target];\n const target = this.config?.target || null;\n if (path.includes(this.host) || path.includes(target)) {\n return;\n }\n\n this.hide();\n }\n\n private hide() {\n this.config?.hideCallback\n ? this.config.hideCallback.call(this.host)\n : this.host.hide();\n }\n\n public update(config?: RootClickControllerConfig) {\n if (config) {\n this.config = { ...this.config, ...config };\n }\n this.configureListeners();\n }\n\n public hostConnected() {\n this.configureListeners();\n }\n\n public hostDisconnected() {\n this.removeEventListeners();\n }\n}\n\nexport function addRootClickHandler(\n host: RootClickControllerHost,\n config?: RootClickControllerConfig\n) {\n return new RootClickController(host, config);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-scroll.js","sourceRoot":"","sources":["../../../../src/components/common/controllers/root-scroll.ts"],"names":[],"mappings":"AAeA,MAAM,oBAAoB;IAGxB,YACmB,IAA8B,EACvC,MAAmC;QAD1B,SAAI,GAAJ,IAAI,CAA0B;QACvC,WAAM,GAAN,MAAM,CAA6B;QAE3C,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAEO,kBAAkB;QACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC1E,CAAC;IAEO,IAAI;QACV,IAAI,CAAC,MAAM,EAAE,YAAY;YACvB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IAEO,iBAAiB;QACvB,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,KAAK,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"root-scroll.js","sourceRoot":"","sources":["../../../../src/components/common/controllers/root-scroll.ts"],"names":[],"mappings":"AAeA,MAAM,oBAAoB;IAGxB,YACmB,IAA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Controller, ReactiveControllerHost } from 'lit';\n\ntype RootScrollControllerConfig = {\n hideCallback?: Function;\n resetListeners?: boolean;\n};\n\ntype RootScrollControllerHost = ReactiveControllerHost & {\n open: boolean;\n hide(): void;\n scrollStrategy?: 'scroll' | 'close' | 'block';\n};\n\ntype ScrollRecord = { scrollTop: number; scrollLeft: number };\n\nclass RootScrollController implements ReactiveController {\n private _cache: WeakMap<Element, ScrollRecord>;\n\n constructor(\n private readonly host: RootScrollControllerHost,\n private config?: RootScrollControllerConfig\n ) {\n this._cache = new WeakMap();\n this.host.addController(this);\n }\n\n private configureListeners() {\n this.host.open ? this.addEventListeners() : this.removeEventListeners();\n }\n\n private hide() {\n this.config?.hideCallback\n ? this.config.hideCallback.call(this.host)\n : this.host.hide();\n }\n\n private addEventListeners() {\n if (this.host.scrollStrategy !== 'scroll') {\n document.addEventListener('scroll', this, { capture: true });\n }\n }\n\n private removeEventListeners() {\n document.removeEventListener('scroll', this, { capture: true });\n this._cache = new WeakMap();\n }\n\n public handleEvent(event: Event) {\n this.host.scrollStrategy === 'close' ? this.hide() : this._block(event);\n }\n\n private _block(event: Event) {\n event.preventDefault();\n const element = event.target as Element;\n const cache = this._cache;\n\n if (!cache.has(element)) {\n cache.set(element, {\n scrollTop: element.firstElementChild?.scrollTop ?? element.scrollTop,\n scrollLeft: element.firstElementChild?.scrollLeft ?? element.scrollLeft,\n });\n }\n\n const record = cache.get(element)!;\n Object.assign(element, record);\n\n if (element.firstElementChild) {\n Object.assign(element.firstElementChild, record);\n }\n }\n\n public update(config?: RootScrollControllerConfig) {\n if (config) {\n this.config = { ...this.config, ...config };\n }\n\n if (config?.resetListeners) {\n this.removeEventListeners();\n }\n\n this.configureListeners();\n }\n\n public hostConnected() {\n this.configureListeners();\n }\n\n public hostDisconnected() {\n this.removeEventListeners();\n }\n}\n\nexport function addRootScrollHandler(\n host: RootScrollControllerHost,\n config?: RootScrollControllerConfig\n) {\n return new RootScrollController(host, config);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../../src/components/common/decorators/watch.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,KAAK,CAAC,QAAgB,EAAE,OAAsB;IAC5D,OAAO,CAAC,iBAAsB,EAAE,IAAY,EAAO,EAAE;QACnD,MAAM,EAAE,UAAU,EAAE,GAAG,iBAAiB,CAAC;QAEzC,OAAO,GAAG,MAAM,CAAC,MAAM,CACrB,EAAE,oBAAoB,EAAE,KAAK,EAAE,EAC/B,OAAO,CACQ,CAAC;QAElB,iBAAiB,CAAC,UAAU,GAAG,UAAU,YAA8B;YACrE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAEpC,IAAI,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../../src/components/common/decorators/watch.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,KAAK,CAAC,QAAgB,EAAE,OAAsB;IAC5D,OAAO,CAAC,iBAAsB,EAAE,IAAY,EAAO,EAAE;QACnD,MAAM,EAAE,UAAU,EAAE,GAAG,iBAAiB,CAAC;QAEzC,OAAO,GAAG,MAAM,CAAC,MAAM,CACrB,EAAE,oBAAoB,EAAE,KAAK,EAAE,EAC/B,OAAO,CACQ,CAAC;QAElB,iBAAiB,CAAC,UAAU,GAAG,UAAU,YAA8B;YACrE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAEpC,IAAI,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/B,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAEhC,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;oBAC1B,IAAI,CAAC,OAAO,EAAE,oBAAoB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;wBACtD,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC5C,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n waitUntilFirstUpdate?: boolean;\n}\n\nexport function watch(propName: string, options?: WatchOptions) {\n return (protoOrDescriptor: any, name: string): any => {\n const { willUpdate } = protoOrDescriptor;\n\n options = Object.assign(\n { waitUntilFirstUpdate: false },\n options\n ) as WatchOptions;\n\n protoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n willUpdate.call(this, changedProps);\n\n if (changedProps.has(propName)) {\n const oldValue = changedProps.get(propName);\n const newValue = this[propName];\n\n if (oldValue !== newValue) {\n if (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n this[name].call(this, oldValue, newValue);\n }\n }\n }\n };\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineComponents.js","sourceRoot":"","sources":["../../../../src/components/common/definitions/defineComponents.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,GAAG,UAA6B;IAC/D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"defineComponents.js","sourceRoot":"","sources":["../../../../src/components/common/definitions/defineComponents.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,GAAG,UAA6B;IAC/D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["import { IgniteComponent } from './register.js';\n\nexport function defineComponents(...components: IgniteComponent[]) {\n for (const component of components) {\n component.register();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../src/components/common/definitions/register.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,iBAAiB,CAC/B,SAA0B,EAC1B,GAAG,YAA+B;IAElC,KAAK,MAAM,UAAU,IAAI,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../src/components/common/definitions/register.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,iBAAiB,CAC/B,SAA0B,EAC1B,GAAG,YAA+B;IAElC,KAAK,MAAM,UAAU,IAAI,YAAY,EAAE,CAAC;QACtC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3C,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACtD,CAAC;AACH,CAAC","sourcesContent":["export type IgniteComponent = CustomElementConstructor & {\n tagName: string;\n register: () => void;\n};\n\nexport function registerComponent(\n component: IgniteComponent,\n ...dependencies: IgniteComponent[]\n) {\n for (const dependency of dependencies) {\n dependency.register();\n }\n\n if (!customElements.get(component.tagName)) {\n customElements.define(component.tagName, component);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../../src/components/common/mixins/alert.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAE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;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2DAC4B;AAG9C;IADT,KAAK,CAAC,aAAa,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;kEAGpD;AAGS;IADT,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;+DAGjD","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport type { AnimationPlayer } from '../../../animations/player';\nimport { fadeIn, fadeOut } from '../../../animations/presets/fade/index.js';\nimport { watch } from '../decorators/watch.js';\n\n// It'd be better to have this as a mixin rather than a base class once the analyzer\n// knows how to resolve multiple mixin chains\n\nexport abstract class IgcBaseAlertLikeComponent extends LitElement {\n private _internals: ElementInternals;\n protected _autoHideTimeout?: number;\n protected _animationPlayer!: AnimationPlayer;\n\n /**\n * Whether the component is in shown state.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * Determines the duration in ms in which the component will be visible.\n * @attr display-time\n */\n @property({ type: Number, attribute: 'display-time' })\n public displayTime = 4000;\n\n /**\n * Determines whether the component should close after the `displayTime` is over.\n * @attr keep-open\n */\n @property({ type: Boolean, reflect: true, attribute: 'keep-open' })\n public keepOpen = false;\n\n /**\n * Sets the position of the component in the viewport.\n * @attr\n */\n @property({ reflect: true })\n public position: 'bottom' | 'middle' | 'top' = 'bottom';\n\n @watch('displayTime', { waitUntilFirstUpdate: true })\n protected displayTimeChange() {\n this.setAutoHideTimer();\n }\n\n @watch('keepOpen', { waitUntilFirstUpdate: true })\n protected keepOpenChange() {\n clearTimeout(this._autoHideTimeout);\n }\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n\n this._internals.role = 'status';\n this._internals.ariaLive = 'polite';\n }\n\n private async toggleAnimation(state: 'open' | 'close') {\n const animation = state === 'open' ? fadeIn : fadeOut;\n\n const [_, event] = await Promise.all([\n this._animationPlayer.stopAll(),\n this._animationPlayer.play(animation()),\n ]);\n\n return event.type === 'finish';\n }\n\n private setAutoHideTimer() {\n clearTimeout(this._autoHideTimeout);\n if (this.open && this.displayTime > 0 && !this.keepOpen) {\n this._autoHideTimeout = window.setTimeout(\n () => this.hide(),\n this.displayTime\n );\n }\n }\n\n /** Opens the component. */\n public async show() {\n if (this.open) {\n return;\n }\n\n this.open = true;\n await this.toggleAnimation('open');\n this.setAutoHideTimer();\n }\n\n /** Closes the component. */\n public async hide() {\n if (!this.open) {\n return;\n }\n\n clearTimeout(this._autoHideTimeout);\n await this.toggleAnimation('close');\n this.open = false;\n }\n\n /** Toggles the open state of the component. */\n public toggle() {\n this.open ? this.hide() : this.show();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../../../src/components/common/mixins/combo-box.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AASvC,MAAM,OAAO,4BAA6B,SAAQ,UAAU;IAA5D;;QAcS,qBAAgB,GAAG,KAAK,CAAC;QAWzB,2BAAsB,GAAG,KAAK,CAAC;QAO/B,SAAI,GAAG,KAAK,CAAC;IAkEtB,CAAC;IAhEW,WAAW;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IAES,UAAU;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;IAES,WAAW;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IAES,UAAU;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACrC,CA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C,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAEtC,KAAU;IACV,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAE1E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport type { UnpackCustomEvent } from './event-emitter.js';\nimport { iterNodes } from '../util.js';\n\ninterface IgcBaseComboBoxEventMap {\n igcOpening: CustomEvent<void>;\n igcOpened: CustomEvent<void>;\n igcClosing: CustomEvent<void>;\n igcClosed: CustomEvent<void>;\n}\n\nexport class IgcBaseComboBoxLikeComponent extends LitElement {\n public declare emitEvent: <\n K extends keyof IgcBaseComboBoxEventMap,\n D extends UnpackCustomEvent<IgcBaseComboBoxEventMap[K]>,\n >(\n event: K,\n eventInitDict?: CustomEventInit<D>\n ) => boolean;\n\n /**\n * Whether the component dropdown should be kept open on selection.\n * @attr keep-open-on-select\n */\n @property({ type: Boolean, reflect: true, attribute: 'keep-open-on-select' })\n public keepOpenOnSelect = false;\n\n /**\n * Whether the component dropdown should be kept open on clicking outside of it.\n * @attr keep-open-on-outside-click\n */\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'keep-open-on-outside-click',\n })\n public keepOpenOnOutsideClick = false;\n\n /**\n * Sets the open state of the component.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n protected emitClosing() {\n return this.emitEvent('igcClosing', { cancelable: true });\n }\n\n protected emitClosed() {\n return this.emitEvent('igcClosed');\n }\n\n protected emitOpening() {\n return this.emitEvent('igcOpening', { cancelable: true });\n }\n\n protected emitOpened() {\n return this.emitEvent('igcOpened');\n }\n\n protected handleAnchorClick() {\n this.open ? this._hide(true) : this._show(true);\n }\n\n protected async _hide(emitEvent = false) {\n if (!this.open || (emitEvent && !this.emitClosing())) {\n return false;\n }\n\n this.open = false;\n\n if (emitEvent) {\n await this.updateComplete;\n return this.emitClosed();\n }\n\n return false;\n }\n\n protected async _show(emitEvent = false) {\n if (this.open || (emitEvent && !this.emitOpening())) {\n return false;\n }\n\n this.open = true;\n\n if (emitEvent) {\n await this.updateComplete;\n return this.emitOpened();\n }\n\n return false;\n }\n\n /** Shows the component. */\n public show() {\n this._show();\n }\n\n /** Hides the component. */\n public hide() {\n this._hide();\n }\n\n /** Toggles the open state of the component. */\n public toggle() {\n this.open ? this.hide() : this.show();\n }\n}\n\nexport function getItems<T extends HTMLElement>(root: Node, tagName: string) {\n return iterNodes<T>(root, 'SHOW_ELEMENT', (item) => item.matches(tagName));\n}\n\nexport function getActiveItems<T extends HTMLElement & { disabled: boolean }>(\n root: Node,\n tagName: string\n) {\n return iterNodes<T>(\n root,\n 'SHOW_ELEMENT',\n (item) => item.matches(tagName) && !item.disabled\n );\n}\n\nexport function getNextActiveItem<\n T extends HTMLElement & { disabled: boolean },\n>(items: T[], from: T) {\n const current = items.indexOf(from);\n\n for (let i = current + 1; i < items.length; i++) {\n if (!items[i].disabled) {\n return items[i];\n }\n }\n\n return items[current];\n}\n\nexport function getPreviousActiveItem<\n T extends HTMLElement & { disabled: boolean },\n>(items: T[], from: T) {\n const current = items.indexOf(from);\n\n for (let i = current - 1; i >= 0; i--) {\n if (!items[i].disabled) {\n return items[i];\n }\n }\n\n return items[current];\n}\n\nexport function setInitialSelectionState<\n T extends HTMLElement & { selected: boolean },\n>(items: T[]) {\n const lastSelected = items.filter((item) => item.selected).at(-1) ?? null;\n\n for (const item of items) {\n if (!item.isSameNode(lastSelected)) {\n item.selected = false;\n }\n }\n\n return lastSelected;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-associated.js","sourceRoot":"","sources":["../../../../src/components/common/mixins/form-associated.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AA0H7C,MAAM,UAAU,mBAAmB,CACjC,UAAa;IAEb,MAAM,qBAAsB,SAAQ,UAAU;QA6B5C,IAAW,IAAI;YACb,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAC/B,CAAC;QAMD,IAAW,QAAQ;YACjB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;QACnC,CAAC;QAGD,IAAW,iBAAiB;YAC1B,OAAO,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC;QAC5C,CAAC;QAMD,IAAW,YAAY;YACrB,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;QACvC,CAAC;QAOD,IAAW,QAAQ;YACjB,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;QAED,IAAW,QAAQ,CAAC,KAAc;YAChC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;YAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YAC1D,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;QAOD,IAAW,OAAO;YAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QAED,IAAW,OAAO,CAAC,KAAc;YAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC3B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,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QAC5D,CAAC;QAQS,eAAe;YACvB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,EAAE;gBAClC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;aACtC;QACH,CAAC;QAGM,cAAc;YACnB,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC;QAC3C,CAAC;QAGM,aAAa;YAClB,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;QAC1C,CAAC;QAMM,iBAAiB,CAAC,OAAe;YACtC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAC7B,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QACvC,CAAC;;IAvNsB,oCAAc,GAAG,IAAI,AAAP,CAAQ;IAyBtC;QADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDACP;IAiCrB;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yDAG1C;IAcD;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wDAG1C;IA8IH,OAAO,qBACJ,CAAC;AACN,CAAC","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport type { Constructor } from './constructor';\nimport type { Validator } from '../validators.js';\n\nexport declare class FormAssociatedElementInterface {\n public static readonly formAssociated: boolean;\n\n private __internals: ElementInternals;\n protected validators: Validator[];\n protected _disabled: boolean;\n protected _invalid: boolean;\n protected _dirty: boolean;\n\n /**\n * The default value of the control at \"creation\" time.\n *\n * @remarks\n * This is set by default on `connectedCallback` through the `setDefaultValue` call.\n * It expects the component to have either a `checked` or a `value` property and binds it to the initial value of the\n * respective property.\n *\n * In use-cases where additional customization is required, make sure to override the `setDefaultValue` method.\n */\n protected _defaultValue: unknown;\n\n /**\n * Applies the {@link FormAssociatedElementInterface.invalid | `invalid`} attribute on the control and the associated styles\n * if the element has completed the first update cycle or it has been interacted with by the user.\n *\n * Usually, it should be called after {@link FormAssociatedElementInterface.updateValidity | `updateValidity()`}\n */\n protected setInvalidState(): void;\n\n /**\n * Executes the component validators and updates the internal validity state.\n */\n protected updateValidity(message?: string): void;\n\n /**\n * Saves the initial value/checked state of the control.\n *\n * Called on connectedCallback.\n */\n protected setDefaultValue(): void;\n\n /**\n * Called when the parent form is reset.\n *\n * Restores the initially bound value/checked state of the control.\n */\n protected restoreDefaultValue(): void;\n\n protected setFormValue(\n value: string | File | FormData | null,\n state?: string | File | FormData | null | undefined\n ): void;\n protected setValidity(\n flags?: ValidityStateFlags | undefined,\n message?: string | undefined,\n anchor?: HTMLElement | undefined\n ): void;\n\n protected formResetCallback(): void;\n protected formDisabledCallback(state: boolean): void;\n protected formStateRestoreCallback(\n state: string | FormData | File,\n mode: 'autocomplete' | 'restore'\n ): void;\n\n /**\n * The disabled state of the component\n * @attr [disabled=false]\n */\n public disabled: boolean;\n\n /**\n * Control the validity of the control.\n * @attr\n */\n public invalid: boolean;\n\n /**\n * The name attribute of the control.\n * @attr\n */\n public name: string;\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null;\n\n /**\n * Returns a ValidityState object which represents the different validity states\n * the element can be in, with respect to constraint validation.\n */\n public get validity(): ValidityState;\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string;\n\n /**\n * A boolean value which returns true if the element is a submittable element\n * that is a candidate for constraint validation.\n */\n public get willValidate(): boolean;\n\n /** Checks for validity of the control and emits the invalid event if it invalid. */\n public checkValidity(): boolean;\n\n /** Checks for validity of the control and shows the browser message if it invalid. */\n public reportValidity(): boolean;\n\n /**\n * Sets a custom validation message for the control.\n * As long as `message` is not empty, the control is considered invalid.\n */\n public setCustomValidity(message: string): void;\n}\n\n/**\n * Turns the passed class element into a Form Associated Custom Element.\n */\nexport function FormAssociatedMixin<T extends Constructor<LitElement>>(\n superClass: T\n) {\n class FormAssociatedElement extends superClass {\n public static readonly formAssociated = true;\n\n private __internals: ElementInternals;\n protected validators: Validator[] = [];\n protected _disabled = false;\n protected _invalid = false;\n protected _dirty = false;\n\n /**\n * The default value of the control at \"creation\" time.\n *\n * @remarks\n * This is set by default on `connectedCallback` through the `setDefaultValue` call.\n * It expects the component to have either a `checked` or a `value` property and binds it to the initial value of the\n * respective property.\n *\n * In use-cases where additional customization is required, make sure to override the `setDefaultValue` method.\n */\n protected _defaultValue: unknown;\n\n /**\n * The name attribute of the control.\n * @attr\n */\n @property({ reflect: true })\n public name!: string;\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null {\n return this.__internals.form;\n }\n\n /**\n * Returns a ValidityState object which represents the different validity states\n * the element can be in, with respect to constraint validation.\n */\n public get validity(): ValidityState {\n return this.__internals.validity;\n }\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string {\n return this.__internals.validationMessage;\n }\n\n /**\n * A boolean value which returns true if the element is a submittable element\n * that is a candidate for constraint validation.\n */\n public get willValidate(): boolean {\n return this.__internals.willValidate;\n }\n\n /**\n * The disabled state of the component\n * @attr [disabled=false]\n */\n @property({ type: Boolean, reflect: true })\n public get disabled(): boolean {\n return this._disabled;\n }\n\n public set disabled(value: boolean) {\n const prev = this._disabled;\n this._disabled = value;\n this.toggleAttribute('disabled', Boolean(this._disabled));\n this.requestUpdate('disabled', prev);\n }\n\n /**\n * Control the validity of the control.\n * @attr [invalid=false]\n */\n @property({ type: Boolean, reflect: true })\n public get invalid(): boolean {\n return this._invalid;\n }\n\n public set invalid(value: boolean) {\n const prev = this._invalid;\n this._invalid = value;\n this.toggleAttribute('invalid', Boolean(this._invalid));\n this.requestUpdate('invalid', prev);\n }\n\n constructor(...args: any[]) {\n super(args);\n this.__internals = this.attachInternals();\n this.addEventListener('invalid', this.handleInvalid);\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this._dirty = false;\n this.setDefaultValue();\n }\n\n /**\n * Saves the initial value/checked state of the control.\n *\n * Called on connectedCallback.\n */\n protected setDefaultValue() {\n if ('checked' in this) {\n this._defaultValue = this.checked;\n } else if ('value' in this) {\n this._defaultValue = this.value;\n }\n }\n\n /**\n * Called when the parent form is reset.\n *\n * Restores the initially bound value/checked state of the control.\n */\n protected restoreDefaultValue() {\n if ('checked' in this) {\n this.checked = this._defaultValue;\n } else if ('value' in this) {\n this.value = this._defaultValue;\n }\n }\n\n protected handleInvalid = (event: Event) => {\n event.preventDefault();\n this.invalid = true;\n };\n\n protected setFormValue(\n value: string | File | FormData | null,\n state?: string | File | FormData | null | undefined\n ) {\n this.__internals.setFormValue(value, state || value);\n }\n\n protected setValidity(\n flags?: ValidityStateFlags | undefined,\n message?: string | undefined,\n anchor?: HTMLElement | undefined\n ) {\n this.__internals.setValidity(flags, message, anchor);\n }\n\n protected formResetCallback() {\n this.restoreDefaultValue();\n this._dirty = false;\n\n // Apply any changes happening during form reset synchronously\n this.performUpdate();\n\n this.invalid = false;\n }\n\n protected formDisabledCallback(state: boolean) {\n this._disabled = state;\n this.requestUpdate();\n }\n\n /**\n * Executes the component validators and updates the internal validity state.\n */\n protected updateValidity(message?: string) {\n const validity: ValidityStateFlags = {};\n let validationMessage = '';\n\n for (const validator of this.validators) {\n const isValid = validator.isValid(this);\n\n validity[validator.key] = !isValid;\n\n if (!isValid) {\n validationMessage =\n typeof validator.message === 'function'\n ? validator.message(this)\n : validator.message;\n }\n }\n\n if (message) {\n validity.customError = true;\n validationMessage = message;\n }\n\n this.__internals.setValidity(validity, validationMessage);\n }\n\n /**\n * Applies the {@link FormAssociatedElementInterface.invalid | `invalid`} attribute on the control and the associated styles\n * if the element has completed the first update cycle or it has been interacted with by the user.\n *\n * Usually, it should be called after {@link FormAssociatedElementInterface.updateValidity | `updateValidity()`}\n */\n protected setInvalidState() {\n if (this.hasUpdated || this._dirty) {\n this.invalid = !this.checkValidity();\n }\n }\n\n /** Checks for validity of the control and shows the browser message if it invalid. */\n public reportValidity() {\n return this.__internals.reportValidity();\n }\n\n /** Checks for validity of the control and emits the invalid event if it invalid. */\n public checkValidity() {\n return this.__internals.checkValidity();\n }\n\n /**\n * Sets a custom validation message for the control.\n * As long as `message` is not empty, the control is considered invalid.\n */\n public setCustomValidity(message: string) {\n this.updateValidity(message);\n this.invalid = !this.checkValidity();\n }\n }\n\n return FormAssociatedElement as unknown as Constructor<FormAssociatedElementInterface> &\n T;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"form-associated.js","sourceRoot":"","sources":["../../../../src/components/common/mixins/form-associated.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AA0H7C,MAAM,UAAU,mBAAmB,CACjC,UAAa;IAEb,MAAM,qBAAsB,SAAQ,UAAU;QA6B5C,IAAW,IAAI;YACb,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAC/B,CAAC;QAMD,IAAW,QAAQ;YACjB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;QACnC,CAAC;QAGD,IAAW,iBAAiB;YAC1B,OAAO,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC;QAC5C,CAAC;QAMD,IAAW,YAAY;YACrB,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;QACvC,CAAC;QAOD,IAAW,QAAQ;YACjB,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;QAED,IAAW,QAAQ,CAAC,KAAc;YAChC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;YAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YAC1D,IAAI,CAAC,aAAa,CAAC,UAAU,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{ Constructor } from './constructor';\nimport type { Validator } from '../validators.js';\n\nexport declare class FormAssociatedElementInterface {\n public static readonly formAssociated: boolean;\n\n private __internals: ElementInternals;\n protected validators: Validator[];\n protected _disabled: boolean;\n protected _invalid: boolean;\n protected _dirty: boolean;\n\n /**\n * The default value of the control at \"creation\" time.\n *\n * @remarks\n * This is set by default on `connectedCallback` through the `setDefaultValue` call.\n * It expects the component to have either a `checked` or a `value` property and binds it to the initial value of the\n * respective property.\n *\n * In use-cases where additional customization is required, make sure to override the `setDefaultValue` method.\n */\n protected _defaultValue: unknown;\n\n /**\n * Applies the {@link FormAssociatedElementInterface.invalid | `invalid`} attribute on the control and the associated styles\n * if the element has completed the first update cycle or it has been interacted with by the user.\n *\n * Usually, it should be called after {@link FormAssociatedElementInterface.updateValidity | `updateValidity()`}\n */\n protected setInvalidState(): void;\n\n /**\n * Executes the component validators and updates the internal validity state.\n */\n protected updateValidity(message?: string): void;\n\n /**\n * Saves the initial value/checked state of the control.\n *\n * Called on connectedCallback.\n */\n protected setDefaultValue(): void;\n\n /**\n * Called when the parent form is reset.\n *\n * Restores the initially bound value/checked state of the control.\n */\n protected restoreDefaultValue(): void;\n\n protected setFormValue(\n value: string | File | FormData | null,\n state?: string | File | FormData | null | undefined\n ): void;\n protected setValidity(\n flags?: ValidityStateFlags | undefined,\n message?: string | undefined,\n anchor?: HTMLElement | undefined\n ): void;\n\n protected formResetCallback(): void;\n protected formDisabledCallback(state: boolean): void;\n protected formStateRestoreCallback(\n state: string | FormData | File,\n mode: 'autocomplete' | 'restore'\n ): void;\n\n /**\n * The disabled state of the component\n * @attr [disabled=false]\n */\n public disabled: boolean;\n\n /**\n * Control the validity of the control.\n * @attr\n */\n public invalid: boolean;\n\n /**\n * The name attribute of the control.\n * @attr\n */\n public name: string;\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null;\n\n /**\n * Returns a ValidityState object which represents the different validity states\n * the element can be in, with respect to constraint validation.\n */\n public get validity(): ValidityState;\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string;\n\n /**\n * A boolean value which returns true if the element is a submittable element\n * that is a candidate for constraint validation.\n */\n public get willValidate(): boolean;\n\n /** Checks for validity of the control and emits the invalid event if it invalid. */\n public checkValidity(): boolean;\n\n /** Checks for validity of the control and shows the browser message if it invalid. */\n public reportValidity(): boolean;\n\n /**\n * Sets a custom validation message for the control.\n * As long as `message` is not empty, the control is considered invalid.\n */\n public setCustomValidity(message: string): void;\n}\n\n/**\n * Turns the passed class element into a Form Associated Custom Element.\n */\nexport function FormAssociatedMixin<T extends Constructor<LitElement>>(\n superClass: T\n) {\n class FormAssociatedElement extends superClass {\n public static readonly formAssociated = true;\n\n private __internals: ElementInternals;\n protected validators: Validator[] = [];\n protected _disabled = false;\n protected _invalid = false;\n protected _dirty = false;\n\n /**\n * The default value of the control at \"creation\" time.\n *\n * @remarks\n * This is set by default on `connectedCallback` through the `setDefaultValue` call.\n * It expects the component to have either a `checked` or a `value` property and binds it to the initial value of the\n * respective property.\n *\n * In use-cases where additional customization is required, make sure to override the `setDefaultValue` method.\n */\n protected _defaultValue: unknown;\n\n /**\n * The name attribute of the control.\n * @attr\n */\n @property({ reflect: true })\n public name!: string;\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null {\n return this.__internals.form;\n }\n\n /**\n * Returns a ValidityState object which represents the different validity states\n * the element can be in, with respect to constraint validation.\n */\n public get validity(): ValidityState {\n return this.__internals.validity;\n }\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string {\n return this.__internals.validationMessage;\n }\n\n /**\n * A boolean value which returns true if the element is a submittable element\n * that is a candidate for constraint validation.\n */\n public get willValidate(): boolean {\n return this.__internals.willValidate;\n }\n\n /**\n * The disabled state of the component\n * @attr [disabled=false]\n */\n @property({ type: Boolean, reflect: true })\n public get disabled(): boolean {\n return this._disabled;\n }\n\n public set disabled(value: boolean) {\n const prev = this._disabled;\n this._disabled = value;\n this.toggleAttribute('disabled', Boolean(this._disabled));\n this.requestUpdate('disabled', prev);\n }\n\n /**\n * Control the validity of the control.\n * @attr [invalid=false]\n */\n @property({ type: Boolean, reflect: true })\n public get invalid(): boolean {\n return this._invalid;\n }\n\n public set invalid(value: boolean) {\n const prev = this._invalid;\n this._invalid = value;\n this.toggleAttribute('invalid', Boolean(this._invalid));\n this.requestUpdate('invalid', prev);\n }\n\n constructor(...args: any[]) {\n super(args);\n this.__internals = this.attachInternals();\n this.addEventListener('invalid', this.handleInvalid);\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this._dirty = false;\n this.setDefaultValue();\n }\n\n /**\n * Saves the initial value/checked state of the control.\n *\n * Called on connectedCallback.\n */\n protected setDefaultValue() {\n if ('checked' in this) {\n this._defaultValue = this.checked;\n } else if ('value' in this) {\n this._defaultValue = this.value;\n }\n }\n\n /**\n * Called when the parent form is reset.\n *\n * Restores the initially bound value/checked state of the control.\n */\n protected restoreDefaultValue() {\n if ('checked' in this) {\n this.checked = this._defaultValue;\n } else if ('value' in this) {\n this.value = this._defaultValue;\n }\n }\n\n protected handleInvalid = (event: Event) => {\n event.preventDefault();\n this.invalid = true;\n };\n\n protected setFormValue(\n value: string | File | FormData | null,\n state?: string | File | FormData | null | undefined\n ) {\n this.__internals.setFormValue(value, state || value);\n }\n\n protected setValidity(\n flags?: ValidityStateFlags | undefined,\n message?: string | undefined,\n anchor?: HTMLElement | undefined\n ) {\n this.__internals.setValidity(flags, message, anchor);\n }\n\n protected formResetCallback() {\n this.restoreDefaultValue();\n this._dirty = false;\n\n // Apply any changes happening during form reset synchronously\n this.performUpdate();\n\n this.invalid = false;\n }\n\n protected formDisabledCallback(state: boolean) {\n this._disabled = state;\n this.requestUpdate();\n }\n\n /**\n * Executes the component validators and updates the internal validity state.\n */\n protected updateValidity(message?: string) {\n const validity: ValidityStateFlags = {};\n let validationMessage = '';\n\n for (const validator of this.validators) {\n const isValid = validator.isValid(this);\n\n validity[validator.key] = !isValid;\n\n if (!isValid) {\n validationMessage =\n typeof validator.message === 'function'\n ? validator.message(this)\n : validator.message;\n }\n }\n\n if (message) {\n validity.customError = true;\n validationMessage = message;\n }\n\n this.__internals.setValidity(validity, validationMessage);\n }\n\n /**\n * Applies the {@link FormAssociatedElementInterface.invalid | `invalid`} attribute on the control and the associated styles\n * if the element has completed the first update cycle or it has been interacted with by the user.\n *\n * Usually, it should be called after {@link FormAssociatedElementInterface.updateValidity | `updateValidity()`}\n */\n protected setInvalidState() {\n if (this.hasUpdated || this._dirty) {\n this.invalid = !this.checkValidity();\n }\n }\n\n /** Checks for validity of the control and shows the browser message if it invalid. */\n public reportValidity() {\n return this.__internals.reportValidity();\n }\n\n /** Checks for validity of the control and emits the invalid event if it invalid. */\n public checkValidity() {\n return this.__internals.checkValidity();\n }\n\n /**\n * Sets a custom validation message for the control.\n * As long as `message` is not empty, the control is considered invalid.\n */\n public setCustomValidity(message: string) {\n this.updateValidity(message);\n this.invalid = !this.checkValidity();\n }\n }\n\n return FormAssociatedElement as unknown as Constructor<FormAssociatedElementInterface> &\n T;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/components/common/util.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,YAA0B,EAAE,EAAE;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;SAC7B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;SAClC,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC;AAE/E,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAAc,EAAE,GAAW,EAAE,GAAW,EAAE,EAAE,CAChE,IAAI,CAAC,GAAG,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IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE/B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["export interface PartNameInfo {\n readonly [name: string]: string | boolean | number;\n}\n\nexport const partNameMap = (partNameInfo: PartNameInfo) => {\n return Object.keys(partNameInfo)\n .filter((key) => partNameInfo[key])\n .join(' ');\n};\n\nexport const asPercent = (part: number, whole: number) => (part / whole) * 100;\n\nexport const clamp = (number: number, min: number, max: number) =>\n Math.max(min, Math.min(number, max));\n\n/**\n *\n * Returns an element's offset relative to its parent. Similar to element.offsetTop and element.offsetLeft, except the\n * parent doesn't have to be positioned relative or absolute.\n *\n * Work around for the following issues in Chromium based browsers:\n *\n * https://bugs.chromium.org/p/chromium/issues/detail?id=1330819\n * https://bugs.chromium.org/p/chromium/issues/detail?id=1334556\n *\n */\nexport function getOffset(element: HTMLElement, parent: HTMLElement) {\n const { top, left, bottom, right } = element.getBoundingClientRect();\n const {\n top: pTop,\n left: pLeft,\n bottom: pBottom,\n right: pRight,\n } = parent.getBoundingClientRect();\n\n return {\n top: Math.round(top - pTop),\n left: Math.round(left - pLeft),\n right: Math.round(right - pRight),\n bottom: Math.round(bottom - pBottom),\n };\n}\n\nexport function createCounter() {\n let i = 0;\n return function () {\n i++;\n return i;\n };\n}\n\nexport function isLTR(element: HTMLElement) {\n return getComputedStyle(element).getPropertyValue('direction') === 'ltr';\n}\n\nexport function extractText<T extends Node>(arr: T[]) {\n return arr.reduce((agg: string[], item: T) => {\n const text = item.textContent?.trim();\n if (text) {\n agg.push(text);\n }\n return agg;\n }, []);\n}\n\n/**\n * Builds a string from format specifiers and replacement parameters.\n *\n * @example\n * ```typescript\n * format('{0} says \"{1}\".', 'John', 'Hello'); // 'John says \"Hello\".'\n * ```\n */\nexport function format(template: string, ...params: string[]): string {\n return template.replace(/{(\\d+)}/g, function (match: string, index: number) {\n if (index >= params.length) {\n return match;\n }\n\n const value: string = params[index];\n if (typeof value !== 'number' && !value) {\n return '';\n }\n return value;\n });\n}\n\n/**\n * Parse the passed `value` as a number or return the `fallback` if it can't be done.\n *\n * @example\n * ```typescript\n * asNumber('5'); // 5\n * asNumber('3.14'); // 3.14\n * asNumber('five'); // 0\n * asNUmber('five', 5); // 5\n * ```\n */\nexport function asNumber(value: unknown, fallback = 0) {\n const parsed = parseFloat(value as string);\n return isNaN(parsed) ? fallback : parsed;\n}\n\n/**\n * Returns the value wrapped between the min and max bounds.\n *\n * If the value is greater than max, returns the min and vice-versa.\n * If the value is between the bounds, it is returned unchanged.\n *\n * @example\n * ```typescript\n * wrap(1, 4, 2); // 2\n * wrap(1, 4, 5); // 1\n * wrap(1, 4, -1); // 4\n * ```\n */\nexport function wrap(min: number, max: number, value: number) {\n if (value < min) {\n return max;\n } else if (value > max) {\n return min;\n }\n\n return value;\n}\n\nexport function isDefined<T = unknown>(value: T) {\n return value !== undefined;\n}\n\nexport function* iterNodes<T = Node>(\n root: Node,\n whatToShow?: keyof typeof NodeFilter,\n filter?: (node: T) => boolean\n): Generator<T> {\n const iter = document.createTreeWalker(\n root,\n NodeFilter[whatToShow ?? 'SHOW_ALL']\n );\n let node = iter.nextNode() as T;\n\n while (node) {\n if (filter) {\n if (filter(node)) {\n yield node;\n }\n } else {\n yield node;\n }\n\n node = iter.nextNode() as T;\n }\n}\n\nexport function getElementByIdFromRoot(root: HTMLElement, id: string) {\n return (root.getRootNode() as Document | ShadowRoot).getElementById(id);\n}\n\nexport function groupBy<T>(array: T[], key: keyof T | ((item: T) => any)) {\n const result: Record<string, T[]> = {};\n const _get = typeof key === 'function' ? key : (item: T) => item[key];\n\n for (const item of array) {\n const category = _get(item);\n const group = result[category];\n\n Array.isArray(group) ? group.push(item) : (result[category] = [item]);\n }\n\n return result;\n}\n"]}
|