igniteui-webcomponents 7.2.3 → 7.3.0-beta.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 +156 -0
- package/animations/player.d.ts +4 -11
- package/animations/player.js +4 -10
- package/animations/player.js.map +1 -1
- package/animations/view-transition.d.ts +44 -0
- package/animations/view-transition.js +81 -0
- package/animations/view-transition.js.map +1 -0
- package/components/accordion/accordion.d.ts +1 -1
- package/components/accordion/accordion.js +7 -6
- package/components/accordion/accordion.js.map +1 -1
- package/components/avatar/avatar.js +10 -10
- package/components/avatar/avatar.js.map +1 -1
- package/components/avatar/themes/themes.d.ts +1 -1
- package/components/avatar/themes/themes.js.map +1 -1
- package/components/badge/badge.d.ts +1 -1
- package/components/badge/badge.js +5 -5
- package/components/badge/badge.js.map +1 -1
- package/components/badge/themes/themes.d.ts +1 -1
- package/components/badge/themes/themes.js.map +1 -1
- package/components/banner/banner.d.ts +2 -2
- package/components/banner/banner.js +8 -8
- package/components/banner/banner.js.map +1 -1
- package/components/banner/themes/themes.d.ts +1 -1
- package/components/banner/themes/themes.js.map +1 -1
- package/components/button/button-base.d.ts +2 -2
- package/components/button/button-base.js +15 -12
- package/components/button/button-base.js.map +1 -1
- package/components/button/button.d.ts +3 -3
- package/components/button/button.js +2 -2
- package/components/button/button.js.map +1 -1
- package/components/button/icon-button.js +12 -12
- package/components/button/icon-button.js.map +1 -1
- package/components/button/themes/button/themes.d.ts +1 -1
- package/components/button/themes/button/themes.js.map +1 -1
- package/components/button/themes/icon-button/themes.d.ts +1 -1
- package/components/button/themes/icon-button/themes.js.map +1 -1
- package/components/button-group/button-group.d.ts +42 -21
- package/components/button-group/button-group.js +101 -106
- package/components/button-group/button-group.js.map +1 -1
- package/components/button-group/themes/button.d.ts +1 -1
- package/components/button-group/themes/button.js.map +1 -1
- package/components/button-group/themes/group.d.ts +1 -1
- package/components/button-group/themes/group.js.map +1 -1
- package/components/button-group/toggle-button.d.ts +17 -10
- package/components/button-group/toggle-button.js +28 -13
- package/components/button-group/toggle-button.js.map +1 -1
- package/components/calendar/base.d.ts +29 -10
- package/components/calendar/base.js +12 -15
- package/components/calendar/base.js.map +1 -1
- package/components/calendar/calendar.d.ts +39 -8
- package/components/calendar/calendar.js +96 -85
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/days-view/days-view.d.ts +49 -22
- package/components/calendar/days-view/days-view.js +102 -163
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/calendar/helpers.d.ts +3 -62
- package/components/calendar/helpers.js +6 -110
- package/components/calendar/helpers.js.map +1 -1
- package/components/calendar/months-view/months-view.d.ts +7 -21
- package/components/calendar/months-view/months-view.js +30 -83
- package/components/calendar/months-view/months-view.js.map +1 -1
- package/components/calendar/selection.d.ts +21 -0
- package/components/calendar/selection.js +42 -0
- package/components/calendar/selection.js.map +1 -0
- package/components/calendar/themes/calendar.d.ts +1 -1
- package/components/calendar/themes/calendar.js.map +1 -1
- package/components/calendar/themes/days.d.ts +1 -1
- package/components/calendar/themes/days.js.map +1 -1
- package/components/calendar/themes/year-month.d.ts +1 -1
- package/components/calendar/themes/year-month.js.map +1 -1
- package/components/calendar/types.d.ts +18 -0
- package/components/calendar/types.js.map +1 -1
- package/components/calendar/year-month-view.base.d.ts +44 -0
- package/components/calendar/year-month-view.base.js +89 -0
- package/components/calendar/year-month-view.base.js.map +1 -0
- package/components/calendar/years-view/years-view.d.ts +7 -20
- package/components/calendar/years-view/years-view.js +25 -79
- package/components/calendar/years-view/years-view.js.map +1 -1
- package/components/card/card.actions.js +2 -2
- package/components/card/card.actions.js.map +1 -1
- package/components/card/card.content.d.ts +1 -1
- package/components/card/card.content.js +2 -2
- package/components/card/card.content.js.map +1 -1
- package/components/card/card.d.ts +1 -1
- package/components/card/card.header.js +2 -2
- package/components/card/card.header.js.map +1 -1
- package/components/card/card.js +2 -2
- package/components/card/card.js.map +1 -1
- package/components/card/card.media.d.ts +1 -1
- package/components/card/card.media.js +1 -1
- package/components/card/card.media.js.map +1 -1
- package/components/card/themes/actions.d.ts +1 -1
- package/components/card/themes/actions.js.map +1 -1
- package/components/card/themes/container.d.ts +1 -1
- package/components/card/themes/container.js.map +1 -1
- package/components/card/themes/content.d.ts +1 -1
- package/components/card/themes/content.js.map +1 -1
- package/components/card/themes/header.d.ts +1 -1
- package/components/card/themes/header.js.map +1 -1
- package/components/carousel/animations.d.ts +1 -1
- package/components/carousel/animations.js +2 -2
- package/components/carousel/animations.js.map +1 -1
- package/components/carousel/carousel-indicator-container.js +4 -4
- package/components/carousel/carousel-indicator-container.js.map +1 -1
- package/components/carousel/carousel-indicator.d.ts +1 -1
- package/components/carousel/carousel-indicator.js +5 -5
- package/components/carousel/carousel-indicator.js.map +1 -1
- package/components/carousel/carousel-slide.d.ts +1 -1
- package/components/carousel/carousel-slide.js +9 -9
- package/components/carousel/carousel-slide.js.map +1 -1
- package/components/carousel/carousel.d.ts +7 -7
- package/components/carousel/carousel.js +40 -30
- package/components/carousel/carousel.js.map +1 -1
- package/components/carousel/themes/container.d.ts +1 -1
- package/components/carousel/themes/container.js.map +1 -1
- package/components/carousel/themes/indicator-container.d.ts +1 -1
- package/components/carousel/themes/indicator-container.js.map +1 -1
- package/components/chat/chat-input.d.ts +4 -4
- package/components/chat/chat-input.js +13 -12
- package/components/chat/chat-input.js.map +1 -1
- package/components/chat/chat-message.d.ts +1 -1
- package/components/chat/chat-message.js +7 -6
- package/components/chat/chat-message.js.map +1 -1
- package/components/chat/chat-state.d.ts +2 -2
- package/components/chat/chat-state.js +2 -1
- package/components/chat/chat-state.js.map +1 -1
- package/components/chat/chat.d.ts +4 -4
- package/components/chat/chat.js +13 -13
- package/components/chat/chat.js.map +1 -1
- package/components/chat/message-attachments.js +5 -5
- package/components/chat/message-attachments.js.map +1 -1
- package/components/chat/themes/attachments.d.ts +1 -1
- package/components/chat/themes/attachments.js.map +1 -1
- package/components/chat/themes/input.d.ts +1 -1
- package/components/chat/themes/input.js.map +1 -1
- package/components/chat/themes/message.d.ts +1 -1
- package/components/chat/themes/message.js.map +1 -1
- package/components/chat/themes/themes.d.ts +1 -1
- package/components/chat/themes/themes.js.map +1 -1
- package/components/chat/types.d.ts +2 -2
- package/components/chat/types.js.map +1 -1
- package/components/chat/utils.d.ts +1 -1
- package/components/chat/utils.js +3 -3
- package/components/chat/utils.js.map +1 -1
- package/components/checkbox/checkbox-base.d.ts +7 -7
- package/components/checkbox/checkbox-base.js +7 -7
- package/components/checkbox/checkbox-base.js.map +1 -1
- package/components/checkbox/checkbox.js +7 -6
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/checkbox/switch.js +7 -6
- package/components/checkbox/switch.js.map +1 -1
- package/components/checkbox/themes/checkbox-themes.d.ts +1 -1
- package/components/checkbox/themes/checkbox-themes.js.map +1 -1
- package/components/checkbox/themes/switch-themes.d.ts +1 -1
- package/components/checkbox/themes/switch-themes.js.map +1 -1
- package/components/checkbox/validators.d.ts +1 -1
- package/components/checkbox/validators.js +1 -1
- package/components/checkbox/validators.js.map +1 -1
- package/components/chip/chip.d.ts +9 -3
- package/components/chip/chip.js +10 -6
- package/components/chip/chip.js.map +1 -1
- package/components/chip/themes/chip.base.css.js +1 -1
- package/components/chip/themes/chip.base.css.js.map +1 -1
- package/components/chip/themes/dark/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/dark/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/dark/chip.material.css.js +1 -1
- package/components/chip/themes/dark/chip.material.css.js.map +1 -1
- package/components/chip/themes/light/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/light/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/light/chip.fluent.css.js +1 -1
- package/components/chip/themes/light/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/light/chip.indigo.css.js +1 -1
- package/components/chip/themes/light/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/light/chip.material.css.js +1 -1
- package/components/chip/themes/light/chip.material.css.js.map +1 -1
- package/components/chip/themes/light/chip.shared.css.js +1 -1
- package/components/chip/themes/light/chip.shared.css.js.map +1 -1
- package/components/chip/themes/shared/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/shared/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/shared/chip.common.css.js +1 -1
- package/components/chip/themes/shared/chip.common.css.js.map +1 -1
- package/components/chip/themes/shared/chip.fluent.css.js +1 -1
- package/components/chip/themes/shared/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/themes.d.ts +1 -1
- package/components/chip/themes/themes.js.map +1 -1
- package/components/combo/combo-header.js +2 -2
- package/components/combo/combo-header.js.map +1 -1
- package/components/combo/combo-item.d.ts +0 -2
- package/components/combo/combo-item.js +4 -7
- package/components/combo/combo-item.js.map +1 -1
- package/components/combo/combo.d.ts +84 -26
- package/components/combo/combo.js +197 -152
- package/components/combo/combo.js.map +1 -1
- package/components/combo/controllers/data.d.ts +30 -3
- package/components/combo/controllers/data.js +34 -9
- package/components/combo/controllers/data.js.map +1 -1
- package/components/combo/controllers/navigation.d.ts +8 -2
- package/components/combo/controllers/navigation.js +11 -12
- package/components/combo/controllers/navigation.js.map +1 -1
- package/components/combo/operations/filter.d.ts +17 -1
- package/components/combo/operations/filter.js +29 -9
- package/components/combo/operations/filter.js.map +1 -1
- package/components/combo/operations/group.js +1 -1
- package/components/combo/operations/group.js.map +1 -1
- package/components/combo/themes/combo.base.css.js +1 -1
- package/components/combo/themes/combo.base.css.js.map +1 -1
- package/components/combo/themes/themes.d.ts +1 -1
- package/components/combo/themes/themes.js.map +1 -1
- package/components/combo/types.d.ts +8 -4
- package/components/combo/types.js.map +1 -1
- package/components/combo/validators.d.ts +1 -1
- package/components/combo/validators.js.map +1 -1
- package/components/date-picker/date-picker.base.d.ts +294 -0
- package/components/date-picker/date-picker.base.js +480 -0
- package/components/date-picker/date-picker.base.js.map +1 -0
- package/components/date-picker/date-picker.d.ts +52 -172
- package/components/date-picker/date-picker.js +88 -393
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/date-picker/themes/themes.d.ts +1 -1
- package/components/date-picker/themes/themes.js.map +1 -1
- package/components/date-picker/validators.d.ts +1 -1
- package/components/date-picker/validators.js +2 -2
- package/components/date-picker/validators.js.map +1 -1
- package/components/date-range-picker/date-range-input.d.ts +12 -14
- package/components/date-range-picker/date-range-input.js +42 -98
- package/components/date-range-picker/date-range-input.js.map +1 -1
- package/components/date-range-picker/date-range-mask-parser.d.ts +22 -34
- package/components/date-range-picker/date-range-mask-parser.js +38 -69
- package/components/date-range-picker/date-range-mask-parser.js.map +1 -1
- package/components/date-range-picker/date-range-picker.d.ts +98 -191
- package/components/date-range-picker/date-range-picker.js +210 -530
- package/components/date-range-picker/date-range-picker.js.map +1 -1
- package/components/date-range-picker/predefined-ranges-area.d.ts +2 -2
- package/components/date-range-picker/predefined-ranges-area.js +5 -5
- package/components/date-range-picker/predefined-ranges-area.js.map +1 -1
- package/components/date-range-picker/themes/ranges-themes.d.ts +1 -1
- package/components/date-range-picker/themes/ranges-themes.js.map +1 -1
- package/components/date-range-picker/themes/themes.d.ts +1 -1
- package/components/date-range-picker/themes/themes.js.map +1 -1
- package/components/date-range-picker/validators.d.ts +1 -1
- package/components/date-range-picker/validators.js +15 -22
- package/components/date-range-picker/validators.js.map +1 -1
- package/components/date-time-input/date-part.d.ts +18 -1
- package/components/date-time-input/date-part.js +10 -0
- package/components/date-time-input/date-part.js.map +1 -1
- package/components/date-time-input/date-time-input.base.d.ts +74 -12
- package/components/date-time-input/date-time-input.base.js +99 -27
- package/components/date-time-input/date-time-input.base.js.map +1 -1
- package/components/date-time-input/date-time-input.d.ts +13 -23
- package/components/date-time-input/date-time-input.js +45 -65
- package/components/date-time-input/date-time-input.js.map +1 -1
- package/components/date-time-input/datetime-mask-parser.d.ts +45 -109
- package/components/date-time-input/datetime-mask-parser.js +88 -139
- package/components/date-time-input/datetime-mask-parser.js.map +1 -1
- package/components/date-time-input/validators.d.ts +1 -1
- package/components/date-time-input/validators.js +2 -2
- package/components/date-time-input/validators.js.map +1 -1
- package/components/dialog/dialog.d.ts +2 -2
- package/components/dialog/dialog.js +21 -22
- package/components/dialog/dialog.js.map +1 -1
- package/components/dialog/themes/themes.d.ts +1 -1
- package/components/dialog/themes/themes.js.map +1 -1
- package/components/divider/divider.d.ts +2 -1
- package/components/divider/divider.js +3 -3
- package/components/divider/divider.js.map +1 -1
- package/components/divider/themes/themes.d.ts +1 -1
- package/components/divider/themes/themes.js.map +1 -1
- package/components/dropdown/dropdown-group.d.ts +10 -3
- package/components/dropdown/dropdown-group.js +21 -5
- package/components/dropdown/dropdown-group.js.map +1 -1
- package/components/dropdown/dropdown-header.d.ts +2 -2
- package/components/dropdown/dropdown-header.js +7 -2
- package/components/dropdown/dropdown-header.js.map +1 -1
- package/components/dropdown/dropdown-item.d.ts +4 -4
- package/components/dropdown/dropdown-item.js +3 -3
- package/components/dropdown/dropdown-item.js.map +1 -1
- package/components/dropdown/dropdown.d.ts +75 -32
- package/components/dropdown/dropdown.js +189 -110
- package/components/dropdown/dropdown.js.map +1 -1
- package/components/dropdown/themes/container.d.ts +1 -1
- package/components/dropdown/themes/container.js.map +1 -1
- package/components/dropdown/themes/group.d.ts +1 -1
- package/components/dropdown/themes/group.js.map +1 -1
- package/components/dropdown/themes/header.d.ts +1 -1
- package/components/dropdown/themes/header.js.map +1 -1
- package/components/dropdown/themes/item.d.ts +1 -1
- package/components/dropdown/themes/item.js.map +1 -1
- package/components/expansion-panel/expansion-panel.d.ts +14 -5
- package/components/expansion-panel/expansion-panel.js +10 -9
- package/components/expansion-panel/expansion-panel.js.map +1 -1
- package/components/expansion-panel/themes/themes.d.ts +1 -1
- package/components/expansion-panel/themes/themes.js.map +1 -1
- package/components/file-input/file-input.d.ts +20 -12
- package/components/file-input/file-input.js +17 -12
- package/components/file-input/file-input.js.map +1 -1
- package/components/file-input/themes/themes.d.ts +1 -1
- package/components/file-input/themes/themes.js.map +1 -1
- package/components/file-input/validators.d.ts +1 -1
- package/components/file-input/validators.js +1 -1
- package/components/file-input/validators.js.map +1 -1
- package/components/focus-trap/focus-trap.js +3 -2
- package/components/focus-trap/focus-trap.js.map +1 -1
- package/components/highlight/highlight.js +2 -2
- package/components/highlight/highlight.js.map +1 -1
- package/components/highlight/service.d.ts +4 -1
- package/components/highlight/service.js +23 -7
- package/components/highlight/service.js.map +1 -1
- package/components/highlight/themes/themes.d.ts +1 -1
- package/components/highlight/themes/themes.js.map +1 -1
- package/components/icon/icon-references.d.ts +3 -2
- package/components/icon/icon-references.js +103 -491
- package/components/icon/icon-references.js.map +1 -1
- package/components/icon/icon-state.broadcast.d.ts +14 -17
- package/components/icon/icon-state.broadcast.js +19 -20
- package/components/icon/icon-state.broadcast.js.map +1 -1
- package/components/icon/icon.d.ts +14 -25
- package/components/icon/icon.js +37 -24
- package/components/icon/icon.js.map +1 -1
- package/components/icon/icon.registry.d.ts +69 -131
- package/components/icon/icon.registry.js +51 -53
- package/components/icon/icon.registry.js.map +1 -1
- package/components/icon/internal-icons-lib.js +2 -2
- package/components/icon/internal-icons-lib.js.map +1 -1
- package/components/icon/registry/parser.d.ts +15 -3
- package/components/icon/registry/parser.js +36 -11
- package/components/icon/registry/parser.js.map +1 -1
- package/components/icon/registry/types.d.ts +55 -11
- package/components/icon/registry/types.js.map +1 -1
- package/components/icon/themes/icon.base.css.js +1 -1
- package/components/icon/themes/icon.base.css.js.map +1 -1
- package/components/icon/themes/shared/icon.common.css.js +1 -1
- package/components/icon/themes/shared/icon.common.css.js.map +1 -1
- package/components/icon/themes/themes.d.ts +1 -1
- package/components/icon/themes/themes.js.map +1 -1
- package/components/input/input-base.d.ts +12 -12
- package/components/input/input-base.js +13 -15
- package/components/input/input-base.js.map +1 -1
- package/components/input/input.d.ts +15 -12
- package/components/input/input.js +8 -8
- package/components/input/input.js.map +1 -1
- package/components/input/themes/input.base.css.js +1 -1
- package/components/input/themes/input.base.css.js.map +1 -1
- package/components/input/themes/shared/input.bootstrap.css.js +1 -1
- package/components/input/themes/shared/input.bootstrap.css.js.map +1 -1
- package/components/input/themes/shared/input.common.css.js +1 -1
- package/components/input/themes/shared/input.common.css.js.map +1 -1
- package/components/input/themes/shared/input.fluent.css.js +1 -1
- package/components/input/themes/shared/input.fluent.css.js.map +1 -1
- package/components/input/themes/shared/input.indigo.css.js +1 -1
- package/components/input/themes/shared/input.indigo.css.js.map +1 -1
- package/components/input/themes/shared/input.material.css.js +1 -1
- package/components/input/themes/shared/input.material.css.js.map +1 -1
- package/components/input/themes/themes.d.ts +1 -1
- package/components/input/themes/themes.js.map +1 -1
- package/components/input/validators.d.ts +1 -1
- package/components/input/validators.js +1 -1
- package/components/input/validators.js.map +1 -1
- package/components/list/list-header.js +3 -3
- package/components/list/list-header.js.map +1 -1
- package/components/list/list-item.js +3 -3
- package/components/list/list-item.js.map +1 -1
- package/components/list/list.js +3 -3
- package/components/list/list.js.map +1 -1
- package/components/list/themes/container.d.ts +1 -1
- package/components/list/themes/container.js.map +1 -1
- package/components/list/themes/header.d.ts +1 -1
- package/components/list/themes/header.js.map +1 -1
- package/components/list/themes/item.d.ts +1 -1
- package/components/list/themes/item.js.map +1 -1
- package/components/mask-input/mask-history.d.ts +99 -0
- package/components/mask-input/mask-history.js +95 -0
- package/components/mask-input/mask-history.js.map +1 -0
- package/components/mask-input/mask-input.d.ts +14 -9
- package/components/mask-input/mask-input.js +20 -23
- package/components/mask-input/mask-input.js.map +1 -1
- package/components/mask-input/mask-parser.d.ts +20 -2
- package/components/mask-input/mask-parser.js +21 -13
- package/components/mask-input/mask-parser.js.map +1 -1
- package/components/mask-input/validators.d.ts +1 -1
- package/components/mask-input/validators.js +1 -1
- package/components/mask-input/validators.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 -2
- package/components/nav-drawer/nav-drawer-header-item.js.map +1 -1
- package/components/nav-drawer/nav-drawer-item.d.ts +2 -2
- package/components/nav-drawer/nav-drawer-item.js +4 -4
- package/components/nav-drawer/nav-drawer-item.js.map +1 -1
- package/components/nav-drawer/nav-drawer.d.ts +3 -3
- package/components/nav-drawer/nav-drawer.js +11 -14
- 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.d.ts +1 -1
- package/components/nav-drawer/themes/container.js +2 -3
- package/components/nav-drawer/themes/container.js.map +1 -1
- package/components/nav-drawer/themes/dark/container/nav-drawer.shared.css.js +1 -1
- package/components/nav-drawer/themes/dark/container/nav-drawer.shared.css.js.map +1 -1
- package/components/nav-drawer/themes/header-item.d.ts +1 -1
- package/components/nav-drawer/themes/header-item.js.map +1 -1
- package/components/nav-drawer/themes/item.d.ts +1 -1
- package/components/nav-drawer/themes/item.js.map +1 -1
- package/components/nav-drawer/themes/light/container/nav-drawer.bootstrap.css.js +1 -1
- package/components/nav-drawer/themes/light/container/nav-drawer.bootstrap.css.js.map +1 -1
- package/components/nav-drawer/themes/light/container/nav-drawer.fluent.css.js +1 -1
- package/components/nav-drawer/themes/light/container/nav-drawer.fluent.css.js.map +1 -1
- package/components/nav-drawer/themes/light/container/nav-drawer.indigo.css.js +1 -1
- package/components/nav-drawer/themes/light/container/nav-drawer.indigo.css.js.map +1 -1
- package/components/nav-drawer/themes/light/container/nav-drawer.shared.css.js +1 -1
- package/components/nav-drawer/themes/light/container/nav-drawer.shared.css.js.map +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.bootstrap.css.js +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.bootstrap.css.js.map +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.indigo.css.js +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.indigo.css.js.map +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.material.css.js +1 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.material.css.js.map +1 -1
- package/components/navbar/navbar.js +2 -2
- package/components/navbar/navbar.js.map +1 -1
- package/components/navbar/themes/themes.d.ts +1 -1
- package/components/navbar/themes/themes.js.map +1 -1
- package/components/popover/popover.d.ts +10 -3
- package/components/popover/popover.js +114 -99
- package/components/popover/popover.js.map +1 -1
- package/components/progress/base.d.ts +1 -1
- package/components/progress/base.js +5 -4
- package/components/progress/base.js.map +1 -1
- package/components/progress/circular-gradient.d.ts +2 -2
- package/components/progress/circular-gradient.js +1 -1
- package/components/progress/circular-gradient.js.map +1 -1
- package/components/progress/circular-progress.d.ts +15 -15
- package/components/progress/circular-progress.js +7 -6
- package/components/progress/circular-progress.js.map +1 -1
- package/components/progress/linear-progress.d.ts +12 -12
- package/components/progress/linear-progress.js +4 -4
- package/components/progress/linear-progress.js.map +1 -1
- package/components/progress/themes/circular/circular.progress.base.css.js +1 -1
- package/components/progress/themes/circular/circular.progress.base.css.js.map +1 -1
- package/components/progress/themes/circular/themes.d.ts +1 -1
- package/components/progress/themes/circular/themes.js.map +1 -1
- package/components/progress/themes/linear/linear.progress.base.css.js +1 -1
- package/components/progress/themes/linear/linear.progress.base.css.js.map +1 -1
- package/components/progress/themes/linear/themes.d.ts +1 -1
- package/components/progress/themes/linear/themes.js.map +1 -1
- package/components/qr-code/model/encode.d.ts +20 -0
- package/components/qr-code/model/encode.js +166 -0
- package/components/qr-code/model/encode.js.map +1 -0
- package/components/qr-code/model/error-correction.d.ts +15 -0
- package/components/qr-code/model/error-correction.js +1114 -0
- package/components/qr-code/model/error-correction.js.map +1 -0
- package/components/qr-code/model/mask.d.ts +11 -0
- package/components/qr-code/model/mask.js +161 -0
- package/components/qr-code/model/mask.js.map +1 -0
- package/components/qr-code/model/matrix.d.ts +15 -0
- package/components/qr-code/model/matrix.js +277 -0
- package/components/qr-code/model/matrix.js.map +1 -0
- package/components/qr-code/qr-code.d.ts +134 -0
- package/components/qr-code/qr-code.js +221 -0
- package/components/qr-code/qr-code.js.map +1 -0
- package/components/qr-code/renderer/constants.d.ts +26 -0
- package/components/qr-code/renderer/constants.js +5 -0
- package/components/qr-code/renderer/constants.js.map +1 -0
- package/components/qr-code/renderer/corner.d.ts +23 -0
- package/components/qr-code/renderer/corner.js +25 -0
- package/components/qr-code/renderer/corner.js.map +1 -0
- package/components/qr-code/renderer/dots.d.ts +14 -0
- package/components/qr-code/renderer/dots.js +7 -0
- package/components/qr-code/renderer/dots.js.map +1 -0
- package/components/qr-code/renderer/helpers.d.ts +18 -0
- package/components/qr-code/renderer/helpers.js +158 -0
- package/components/qr-code/renderer/helpers.js.map +1 -0
- package/components/qr-code/renderer/image.d.ts +23 -0
- package/components/qr-code/renderer/image.js +29 -0
- package/components/qr-code/renderer/image.js.map +1 -0
- package/components/qr-code/themes/dark/qr-code.bootstrap.css.js +3 -0
- package/components/qr-code/themes/dark/qr-code.bootstrap.css.js.map +1 -0
- package/components/qr-code/themes/dark/qr-code.fluent.css.d.ts +1 -0
- package/components/qr-code/themes/dark/qr-code.fluent.css.js +3 -0
- package/components/qr-code/themes/dark/qr-code.fluent.css.js.map +1 -0
- package/components/qr-code/themes/dark/qr-code.indigo.css.d.ts +1 -0
- package/components/qr-code/themes/dark/qr-code.indigo.css.js +3 -0
- package/components/qr-code/themes/dark/qr-code.indigo.css.js.map +1 -0
- package/components/qr-code/themes/dark/qr-code.material.css.d.ts +1 -0
- package/components/qr-code/themes/dark/qr-code.material.css.js +3 -0
- package/components/qr-code/themes/dark/qr-code.material.css.js.map +1 -0
- package/components/qr-code/themes/light/qr-code.bootstrap.css.d.ts +1 -0
- package/components/qr-code/themes/light/qr-code.bootstrap.css.js +3 -0
- package/components/qr-code/themes/light/qr-code.bootstrap.css.js.map +1 -0
- package/components/qr-code/themes/light/qr-code.fluent.css.d.ts +1 -0
- package/components/qr-code/themes/light/qr-code.fluent.css.js +3 -0
- package/components/qr-code/themes/light/qr-code.fluent.css.js.map +1 -0
- package/components/qr-code/themes/light/qr-code.indigo.css.d.ts +1 -0
- package/components/qr-code/themes/light/qr-code.indigo.css.js +3 -0
- package/components/qr-code/themes/light/qr-code.indigo.css.js.map +1 -0
- package/components/qr-code/themes/light/qr-code.material.css.d.ts +1 -0
- package/components/qr-code/themes/light/qr-code.material.css.js +3 -0
- package/components/qr-code/themes/light/qr-code.material.css.js.map +1 -0
- package/components/qr-code/themes/light/qr-code.shared.css.d.ts +1 -0
- package/components/qr-code/themes/light/qr-code.shared.css.js +3 -0
- package/components/qr-code/themes/light/qr-code.shared.css.js.map +1 -0
- package/components/qr-code/themes/qr-code.base.css.d.ts +1 -0
- package/components/qr-code/themes/qr-code.base.css.js +3 -0
- package/components/qr-code/themes/qr-code.base.css.js.map +1 -0
- package/components/qr-code/themes/shared/qr-code.common.css.d.ts +1 -0
- package/components/qr-code/themes/shared/qr-code.common.css.js +3 -0
- package/components/qr-code/themes/shared/qr-code.common.css.js.map +1 -0
- package/components/qr-code/themes/themes.d.ts +2 -0
- package/components/qr-code/themes/themes.js +46 -0
- package/components/qr-code/themes/themes.js.map +1 -0
- package/components/qr-code/types.d.ts +16 -0
- package/components/qr-code/types.js +2 -0
- package/components/qr-code/types.js.map +1 -0
- package/components/radio/controller.d.ts +35 -0
- package/components/radio/controller.js +100 -0
- package/components/radio/controller.js.map +1 -0
- package/components/radio/radio.d.ts +26 -14
- package/components/radio/radio.js +47 -36
- package/components/radio/radio.js.map +1 -1
- package/components/radio/themes/themes.d.ts +1 -1
- package/components/radio/themes/themes.js.map +1 -1
- package/components/radio/validators.d.ts +1 -1
- package/components/radio/validators.js +5 -3
- package/components/radio/validators.js.map +1 -1
- package/components/radio-group/radio-group.d.ts +19 -10
- package/components/radio-group/radio-group.js +50 -41
- package/components/radio-group/radio-group.js.map +1 -1
- package/components/radio-group/themes/themes.d.ts +1 -1
- package/components/radio-group/themes/themes.js.map +1 -1
- package/components/rating/rating-symbol.d.ts +1 -1
- package/components/rating/rating-symbol.js +1 -1
- package/components/rating/rating-symbol.js.map +1 -1
- package/components/rating/rating.d.ts +6 -6
- package/components/rating/rating.js +12 -9
- package/components/rating/rating.js.map +1 -1
- package/components/rating/themes/themes.d.ts +1 -1
- package/components/rating/themes/themes.js.map +1 -1
- package/components/resize-container/resize-container.d.ts +4 -4
- package/components/resize-container/resize-container.js +4 -4
- package/components/resize-container/resize-container.js.map +1 -1
- package/components/resize-container/resize-controller.js +2 -2
- package/components/resize-container/resize-controller.js.map +1 -1
- package/components/resize-container/themes/themes.d.ts +1 -1
- package/components/resize-container/themes/themes.js.map +1 -1
- package/components/ripple/ripple.d.ts +1 -1
- package/components/ripple/ripple.js +3 -2
- package/components/ripple/ripple.js.map +1 -1
- package/components/select/select-group.d.ts +9 -2
- package/components/select/select-group.js +21 -5
- package/components/select/select-group.js.map +1 -1
- package/components/select/select-header.d.ts +1 -1
- package/components/select/select-header.js +7 -2
- package/components/select/select-header.js.map +1 -1
- package/components/select/select-item.d.ts +4 -4
- package/components/select/select-item.js +3 -3
- package/components/select/select-item.js.map +1 -1
- package/components/select/select.d.ts +49 -22
- package/components/select/select.js +132 -67
- package/components/select/select.js.map +1 -1
- package/components/select/themes/select.base.css.js +1 -1
- package/components/select/themes/select.base.css.js.map +1 -1
- package/components/select/themes/themes.d.ts +1 -1
- package/components/select/themes/themes.js.map +1 -1
- package/components/select/validators.d.ts +1 -1
- package/components/select/validators.js +1 -1
- package/components/select/validators.js.map +1 -1
- package/components/slider/range-slider.d.ts +2 -2
- package/components/slider/range-slider.js +8 -8
- package/components/slider/range-slider.js.map +1 -1
- package/components/slider/slider-base.js +18 -14
- package/components/slider/slider-base.js.map +1 -1
- package/components/slider/slider-label.js +1 -1
- package/components/slider/slider-label.js.map +1 -1
- package/components/slider/slider.d.ts +3 -3
- package/components/slider/slider.js +6 -6
- package/components/slider/slider.js.map +1 -1
- package/components/slider/themes/themes.d.ts +1 -1
- package/components/slider/themes/themes.js.map +1 -1
- package/components/snackbar/snackbar.d.ts +3 -3
- package/components/snackbar/snackbar.js +8 -8
- package/components/snackbar/snackbar.js.map +1 -1
- package/components/snackbar/themes/themes.d.ts +1 -1
- package/components/snackbar/themes/themes.js.map +1 -1
- package/components/splitter/splitter.d.ts +106 -23
- package/components/splitter/splitter.js +234 -147
- package/components/splitter/splitter.js.map +1 -1
- package/components/splitter/themes/themes.d.ts +1 -1
- package/components/splitter/themes/themes.js.map +1 -1
- package/components/splitter/types.d.ts +14 -3
- package/components/splitter/types.js.map +1 -1
- package/components/stepper/common/animations.d.ts +1 -1
- package/components/stepper/common/animations.js +2 -2
- package/components/stepper/common/animations.js.map +1 -1
- package/components/stepper/step.d.ts +1 -1
- package/components/stepper/step.js +7 -7
- package/components/stepper/step.js.map +1 -1
- package/components/stepper/stepper.d.ts +5 -5
- package/components/stepper/stepper.js +12 -9
- package/components/stepper/stepper.js.map +1 -1
- package/components/stepper/themes/step/themes.d.ts +1 -1
- package/components/stepper/themes/step/themes.js.map +1 -1
- package/components/tabs/tab-dom.d.ts +31 -28
- package/components/tabs/tab-dom.js +84 -34
- package/components/tabs/tab-dom.js.map +1 -1
- package/components/tabs/tab.d.ts +24 -6
- package/components/tabs/tab.js +34 -13
- package/components/tabs/tab.js.map +1 -1
- package/components/tabs/tabs.d.ts +36 -22
- package/components/tabs/tabs.js +118 -88
- package/components/tabs/tabs.js.map +1 -1
- package/components/tabs/themes/shared/tabs/tabs.indigo.css.js +1 -1
- package/components/tabs/themes/shared/tabs/tabs.indigo.css.js.map +1 -1
- package/components/tabs/themes/tab-themes.d.ts +1 -1
- package/components/tabs/themes/tab-themes.js.map +1 -1
- package/components/tabs/themes/tabs-themes.d.ts +1 -1
- package/components/tabs/themes/tabs-themes.js.map +1 -1
- package/components/tabs/themes/tabs.base.css.js +1 -1
- package/components/tabs/themes/tabs.base.css.js.map +1 -1
- package/components/textarea/textarea.d.ts +19 -14
- package/components/textarea/textarea.js +22 -16
- package/components/textarea/textarea.js.map +1 -1
- package/components/textarea/themes/themes.d.ts +1 -1
- package/components/textarea/themes/themes.js.map +1 -1
- package/components/textarea/validators.d.ts +1 -1
- package/components/textarea/validators.js +1 -1
- package/components/textarea/validators.js.map +1 -1
- package/components/theme-provider/theme-provider.d.ts +1 -1
- package/components/theme-provider/theme-provider.js +2 -2
- package/components/theme-provider/theme-provider.js.map +1 -1
- package/components/tile-manager/position.d.ts +1 -1
- package/components/tile-manager/position.js +2 -2
- package/components/tile-manager/position.js.map +1 -1
- package/components/tile-manager/resize-state.js +4 -3
- package/components/tile-manager/resize-state.js.map +1 -1
- package/components/tile-manager/themes/container.d.ts +1 -1
- package/components/tile-manager/themes/container.js.map +1 -1
- package/components/tile-manager/themes/tile.d.ts +1 -1
- package/components/tile-manager/themes/tile.js.map +1 -1
- package/components/tile-manager/tile-ghost-util.js +1 -1
- package/components/tile-manager/tile-ghost-util.js.map +1 -1
- package/components/tile-manager/tile-manager.d.ts +1 -1
- package/components/tile-manager/tile-manager.js +7 -7
- package/components/tile-manager/tile-manager.js.map +1 -1
- package/components/tile-manager/tile.d.ts +4 -4
- package/components/tile-manager/tile.js +29 -25
- package/components/tile-manager/tile.js.map +1 -1
- package/components/toast/themes/themes.d.ts +1 -1
- package/components/toast/themes/themes.js.map +1 -1
- package/components/toast/toast.d.ts +1 -1
- package/components/toast/toast.js +3 -3
- package/components/toast/toast.js.map +1 -1
- package/components/tooltip/controller.d.ts +18 -16
- package/components/tooltip/controller.js +62 -41
- package/components/tooltip/controller.js.map +1 -1
- package/components/tooltip/service.d.ts +2 -1
- package/components/tooltip/service.js +10 -15
- package/components/tooltip/service.js.map +1 -1
- package/components/tooltip/themes/shared/tooltip.common.css.js +1 -1
- package/components/tooltip/themes/shared/tooltip.common.css.js.map +1 -1
- package/components/tooltip/themes/shared/tooltip.indigo.css.js +1 -1
- package/components/tooltip/themes/shared/tooltip.indigo.css.js.map +1 -1
- package/components/tooltip/themes/themes.d.ts +1 -1
- package/components/tooltip/themes/themes.js.map +1 -1
- package/components/tooltip/themes/tooltip.base.css.js +1 -1
- package/components/tooltip/themes/tooltip.base.css.js.map +1 -1
- package/components/tooltip/tooltip.d.ts +64 -18
- package/components/tooltip/tooltip.js +112 -62
- package/components/tooltip/tooltip.js.map +1 -1
- package/components/tree/themes/container.base.css.js +1 -1
- package/components/tree/themes/container.base.css.js.map +1 -1
- package/components/tree/themes/container.d.ts +1 -1
- package/components/tree/themes/container.js.map +1 -1
- package/components/tree/themes/item.base.css.js +1 -1
- package/components/tree/themes/item.base.css.js.map +1 -1
- package/components/tree/themes/item.d.ts +1 -1
- package/components/tree/themes/item.js.map +1 -1
- package/components/tree/tree-item.d.ts +62 -36
- package/components/tree/tree-item.js +223 -233
- package/components/tree/tree-item.js.map +1 -1
- package/components/tree/tree.common.d.ts +16 -1
- package/components/tree/tree.common.js +40 -1
- package/components/tree/tree.common.js.map +1 -1
- package/components/tree/tree.d.ts +21 -14
- package/components/tree/tree.js +64 -72
- package/components/tree/tree.js.map +1 -1
- package/components/tree/tree.navigation.d.ts +39 -29
- package/components/tree/tree.navigation.js +140 -192
- package/components/tree/tree.navigation.js.map +1 -1
- package/components/tree/tree.selection.d.ts +32 -31
- package/components/tree/tree.selection.js +184 -178
- package/components/tree/tree.selection.js.map +1 -1
- package/components/types.js.map +1 -1
- package/components/validation-container/validation-container.d.ts +33 -6
- package/components/validation-container/validation-container.js +81 -70
- package/components/validation-container/validation-container.js.map +1 -1
- package/components/virtualization/engine.d.ts +92 -0
- package/components/virtualization/engine.js +217 -0
- package/components/virtualization/engine.js.map +1 -0
- package/components/virtualization/types.d.ts +53 -0
- package/components/virtualization/types.js +14 -0
- package/components/virtualization/types.js.map +1 -0
- package/components/virtualization/virtualization.d.ts +235 -0
- package/components/virtualization/virtualization.js +474 -0
- package/components/virtualization/virtualization.js.map +1 -0
- package/components/visually-hidden/visually-hidden.js +1 -1
- package/components/visually-hidden/visually-hidden.js.map +1 -1
- package/custom-elements.json +57500 -47242
- package/extras/chat-markdown-renderer.d.ts +1 -1
- package/extras/chat-markdown-renderer.js.map +1 -1
- package/igniteui-webcomponents.css-data.json +2 -2
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +20 -15
- package/index.js +11 -9
- package/index.js.map +1 -1
- package/internals/abort-handler.js.map +1 -0
- package/internals/context.d.ts +39 -0
- package/{components/common → internals}/context.js +2 -1
- package/internals/context.js.map +1 -0
- package/internals/controllers/adopt-styles.d.ts +76 -0
- package/internals/controllers/adopt-styles.js +173 -0
- package/internals/controllers/adopt-styles.js.map +1 -0
- package/internals/controllers/aria-projection.d.ts +144 -0
- package/internals/controllers/aria-projection.js +138 -0
- package/internals/controllers/aria-projection.js.map +1 -0
- package/{components/common → internals}/controllers/async-consumer.js +8 -7
- package/internals/controllers/async-consumer.js.map +1 -0
- package/internals/controllers/command.js.map +1 -0
- package/{components/common → internals}/controllers/drag.js +3 -2
- package/internals/controllers/drag.js.map +1 -0
- package/{components/common → internals}/controllers/focus-ring.js +5 -2
- package/internals/controllers/focus-ring.js.map +1 -0
- package/{components/common → internals}/controllers/fullscreen.js +6 -3
- package/internals/controllers/fullscreen.js.map +1 -0
- package/{components/common → internals}/controllers/gestures.d.ts +1 -1
- package/{components/common → internals}/controllers/gestures.js +4 -4
- package/internals/controllers/gestures.js.map +1 -0
- package/{components/common → internals}/controllers/id-resolver.js +15 -21
- package/internals/controllers/id-resolver.js.map +1 -0
- package/{components/common → internals}/controllers/internals.d.ts +48 -3
- package/{components/common → internals}/controllers/internals.js +32 -0
- package/internals/controllers/internals.js.map +1 -0
- package/{components/common → internals}/controllers/key-bindings.d.ts +3 -6
- package/{components/common → internals}/controllers/key-bindings.js +43 -29
- package/internals/controllers/key-bindings.js.map +1 -0
- package/{components/common → internals}/controllers/mutation-observer.d.ts +5 -4
- package/internals/controllers/mutation-observer.js +74 -0
- package/internals/controllers/mutation-observer.js.map +1 -0
- package/{components/common → internals}/controllers/resize-observer.d.ts +11 -1
- package/{components/common → internals}/controllers/resize-observer.js +13 -2
- package/internals/controllers/resize-observer.js.map +1 -0
- package/{components/common → internals}/controllers/root-click.js +8 -13
- package/internals/controllers/root-click.js.map +1 -0
- package/{components/common → internals}/controllers/root-scroll.d.ts +11 -8
- package/internals/controllers/root-scroll.js +71 -0
- package/internals/controllers/root-scroll.js.map +1 -0
- package/{components/common → internals}/controllers/slot.d.ts +18 -2
- package/{components/common → internals}/controllers/slot.js +21 -6
- package/internals/controllers/slot.js.map +1 -0
- package/internals/date/compare.d.ts +2 -0
- package/internals/date/compare.js +23 -0
- package/internals/date/compare.js.map +1 -0
- package/internals/date/converters.d.ts +18 -0
- package/internals/date/converters.js +73 -0
- package/internals/date/converters.js.map +1 -0
- package/{components/calendar → internals/date}/model.d.ts +6 -3
- package/{components/calendar → internals/date}/model.js +23 -0
- package/internals/date/model.js.map +1 -0
- package/internals/decorators/blazorAdditionalDependencies.js.map +1 -0
- package/internals/decorators/blazorDeepImport.js.map +1 -0
- package/internals/decorators/blazorInclude.js.map +1 -0
- package/internals/decorators/blazorIndirectRender.js.map +1 -0
- package/internals/decorators/blazorSuppressComponent.js.map +1 -0
- package/internals/decorators/shadow-options.js.map +1 -0
- package/internals/decorators/watch.js.map +1 -0
- package/internals/definitions/defineAllComponents.js +153 -0
- package/internals/definitions/defineAllComponents.js.map +1 -0
- package/internals/definitions/defineComponents.js.map +1 -0
- package/internals/definitions/register.js.map +1 -0
- package/{components/common → internals}/i18n/EN/calendar.resources.js +1 -1
- package/internals/i18n/EN/calendar.resources.js.map +1 -0
- package/internals/i18n/EN/chat.resources.js.map +1 -0
- package/internals/i18n/EN/date-picker.resources.js.map +1 -0
- package/internals/i18n/EN/date-range-picker.resources.js.map +1 -0
- package/internals/i18n/i18n-controller.js.map +1 -0
- package/{components/common → internals}/i18n/utils.js +1 -1
- package/internals/i18n/utils.js.map +1 -0
- package/{components/common → internals}/mixins/alert.d.ts +2 -2
- package/{components/common → internals}/mixins/alert.js +3 -3
- package/internals/mixins/alert.js.map +1 -0
- package/{components/common → internals}/mixins/combo-box.d.ts +10 -2
- package/{components/common → internals}/mixins/combo-box.js +9 -4
- package/internals/mixins/combo-box.js.map +1 -0
- package/internals/mixins/constructor.js.map +1 -0
- package/internals/mixins/event-emitter.js.map +1 -0
- package/{components/common → internals}/mixins/forms/associated-required.js +10 -19
- package/internals/mixins/forms/associated-required.js.map +1 -0
- package/{components/common → internals}/mixins/forms/associated.d.ts +1 -1
- package/{components/common → internals}/mixins/forms/associated.js +66 -51
- package/internals/mixins/forms/associated.js.map +1 -0
- package/{components/common → internals}/mixins/forms/form-transformers.d.ts +1 -1
- package/{components/common → internals}/mixins/forms/form-transformers.js +2 -2
- package/internals/mixins/forms/form-transformers.js.map +1 -0
- package/internals/mixins/forms/form-value.js.map +1 -0
- package/{components/common → internals}/mixins/forms/types.d.ts +7 -7
- package/internals/mixins/forms/types.js.map +1 -0
- package/{components/common → internals}/mixins/mask-behavior.d.ts +11 -3
- package/{components/common → internals}/mixins/mask-behavior.js +117 -29
- package/internals/mixins/mask-behavior.js.map +1 -0
- package/{components/common → internals}/mixins/option.d.ts +0 -2
- package/{components/common → internals}/mixins/option.js +1 -4
- package/internals/mixins/option.js.map +1 -0
- package/internals/part-map.js.map +1 -0
- package/{components/common → internals}/templates/input-shell.d.ts +8 -1
- package/{components/common → internals}/templates/input-shell.js +14 -4
- package/internals/templates/input-shell.js.map +1 -0
- package/{components/common → internals}/templates/masked-input.d.ts +8 -2
- package/{components/common → internals}/templates/masked-input.js +5 -3
- package/internals/templates/masked-input.js.map +1 -0
- package/internals/utils/arrays.d.ts +53 -0
- package/internals/utils/arrays.js +31 -0
- package/internals/utils/arrays.js.map +1 -0
- package/internals/utils/dom.d.ts +92 -0
- package/internals/utils/dom.js +143 -0
- package/internals/utils/dom.js.map +1 -0
- package/internals/utils/events.d.ts +41 -0
- package/internals/utils/events.js +37 -0
- package/internals/utils/events.js.map +1 -0
- package/internals/utils/lit.d.ts +8 -0
- package/internals/utils/lit.js +15 -0
- package/internals/utils/lit.js.map +1 -0
- package/internals/utils/math.d.ts +50 -0
- package/internals/utils/math.js +38 -0
- package/internals/utils/math.js.map +1 -0
- package/internals/utils/objects.d.ts +25 -0
- package/internals/utils/objects.js +125 -0
- package/internals/utils/objects.js.map +1 -0
- package/internals/utils/strings.d.ts +44 -0
- package/internals/utils/strings.js +46 -0
- package/internals/utils/strings.js.map +1 -0
- package/internals/utils/types.d.ts +13 -0
- package/internals/utils/types.js +31 -0
- package/internals/utils/types.js.map +1 -0
- package/{components/common → internals}/validators.d.ts +1 -1
- package/{components/common → internals}/validators.js +4 -2
- package/internals/validators.js.map +1 -0
- package/package.json +15 -7
- package/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +15 -1
- package/themes/dark/bootstrap.css +1 -1
- package/themes/dark/fluent.css +1 -1
- package/themes/dark/indigo.css +1 -1
- package/themes/dark/material.css +1 -1
- package/themes/light/bootstrap.css +1 -1
- package/themes/light/fluent.css +1 -1
- package/themes/light/indigo.css +1 -1
- package/themes/light/material.css +1 -1
- package/theming/theming-controller.d.ts +2 -2
- package/theming/theming-controller.js.map +1 -1
- package/web-types.json +3 -3
- package/components/calendar/model.js.map +0 -1
- package/components/combo/combo-list.d.ts +0 -11
- package/components/combo/combo-list.js +0 -13
- package/components/combo/combo-list.js.map +0 -1
- package/components/common/abort-handler.js.map +0 -1
- package/components/common/context.d.ts +0 -25
- package/components/common/context.js.map +0 -1
- package/components/common/controllers/adopt-styles.d.ts +0 -124
- package/components/common/controllers/adopt-styles.js +0 -75
- package/components/common/controllers/adopt-styles.js.map +0 -1
- package/components/common/controllers/async-consumer.js.map +0 -1
- package/components/common/controllers/command.js.map +0 -1
- package/components/common/controllers/drag.js.map +0 -1
- package/components/common/controllers/focus-ring.js.map +0 -1
- package/components/common/controllers/fullscreen.js.map +0 -1
- package/components/common/controllers/gestures.js.map +0 -1
- package/components/common/controllers/id-resolver.js.map +0 -1
- package/components/common/controllers/internals.js.map +0 -1
- package/components/common/controllers/key-bindings.js.map +0 -1
- package/components/common/controllers/mutation-observer.js +0 -69
- package/components/common/controllers/mutation-observer.js.map +0 -1
- package/components/common/controllers/resize-observer.js.map +0 -1
- package/components/common/controllers/root-click.js.map +0 -1
- package/components/common/controllers/root-scroll.js +0 -63
- package/components/common/controllers/root-scroll.js.map +0 -1
- package/components/common/controllers/slot.js.map +0 -1
- package/components/common/decorators/blazorAdditionalDependencies.js.map +0 -1
- package/components/common/decorators/blazorDeepImport.js.map +0 -1
- package/components/common/decorators/blazorInclude.js.map +0 -1
- package/components/common/decorators/blazorIndirectRender.js.map +0 -1
- package/components/common/decorators/blazorSuppressComponent.js.map +0 -1
- package/components/common/decorators/shadow-options.js.map +0 -1
- package/components/common/decorators/watch.js.map +0 -1
- package/components/common/definitions/defineAllComponents.js +0 -151
- package/components/common/definitions/defineAllComponents.js.map +0 -1
- package/components/common/definitions/defineComponents.js.map +0 -1
- package/components/common/definitions/register.js.map +0 -1
- package/components/common/i18n/EN/calendar.resources.js.map +0 -1
- package/components/common/i18n/EN/chat.resources.js.map +0 -1
- package/components/common/i18n/EN/date-picker.resources.js.map +0 -1
- package/components/common/i18n/EN/date-range-picker.resources.js.map +0 -1
- package/components/common/i18n/i18n-controller.js.map +0 -1
- package/components/common/i18n/utils.js.map +0 -1
- package/components/common/mixins/alert.js.map +0 -1
- package/components/common/mixins/combo-box.js.map +0 -1
- package/components/common/mixins/constructor.js.map +0 -1
- package/components/common/mixins/event-emitter.js.map +0 -1
- package/components/common/mixins/forms/associated-required.js.map +0 -1
- package/components/common/mixins/forms/associated.js.map +0 -1
- package/components/common/mixins/forms/form-transformers.js.map +0 -1
- package/components/common/mixins/forms/form-value.js.map +0 -1
- package/components/common/mixins/forms/types.js.map +0 -1
- package/components/common/mixins/mask-behavior.js.map +0 -1
- package/components/common/mixins/option.js.map +0 -1
- package/components/common/part-map.js.map +0 -1
- package/components/common/templates/input-shell.js.map +0 -1
- package/components/common/templates/masked-input.js.map +0 -1
- package/components/common/util.d.ts +0 -196
- package/components/common/util.js +0 -390
- package/components/common/util.js.map +0 -1
- package/components/common/validators.js.map +0 -1
- package/components/icon/registry/default-map.d.ts +0 -107
- package/components/icon/registry/default-map.js +0 -25
- package/components/icon/registry/default-map.js.map +0 -1
- package/components/nav-drawer/themes/shared/container/nav-drawer.fluent.css.js +0 -3
- package/components/nav-drawer/themes/shared/container/nav-drawer.fluent.css.js.map +0 -1
- package/components/radio/utils.d.ts +0 -13
- package/components/radio/utils.js +0 -37
- package/components/radio/utils.js.map +0 -1
- /package/components/{nav-drawer/themes/shared/container/nav-drawer.fluent.css.d.ts → qr-code/themes/dark/qr-code.bootstrap.css.d.ts} +0 -0
- /package/{components/common → internals}/abort-handler.d.ts +0 -0
- /package/{components/common → internals}/abort-handler.js +0 -0
- /package/{components/common → internals}/controllers/async-consumer.d.ts +0 -0
- /package/{components/common → internals}/controllers/command.d.ts +0 -0
- /package/{components/common → internals}/controllers/command.js +0 -0
- /package/{components/common → internals}/controllers/drag.d.ts +0 -0
- /package/{components/common → internals}/controllers/focus-ring.d.ts +0 -0
- /package/{components/common → internals}/controllers/fullscreen.d.ts +0 -0
- /package/{components/common → internals}/controllers/id-resolver.d.ts +0 -0
- /package/{components/common → internals}/controllers/root-click.d.ts +0 -0
- /package/{components/common → internals}/decorators/blazorAdditionalDependencies.d.ts +0 -0
- /package/{components/common → internals}/decorators/blazorAdditionalDependencies.js +0 -0
- /package/{components/common → internals}/decorators/blazorDeepImport.d.ts +0 -0
- /package/{components/common → internals}/decorators/blazorDeepImport.js +0 -0
- /package/{components/common → internals}/decorators/blazorInclude.d.ts +0 -0
- /package/{components/common → internals}/decorators/blazorInclude.js +0 -0
- /package/{components/common → internals}/decorators/blazorIndirectRender.d.ts +0 -0
- /package/{components/common → internals}/decorators/blazorIndirectRender.js +0 -0
- /package/{components/common → internals}/decorators/blazorSuppressComponent.d.ts +0 -0
- /package/{components/common → internals}/decorators/blazorSuppressComponent.js +0 -0
- /package/{components/common → internals}/decorators/shadow-options.d.ts +0 -0
- /package/{components/common → internals}/decorators/shadow-options.js +0 -0
- /package/{components/common → internals}/decorators/watch.d.ts +0 -0
- /package/{components/common → internals}/decorators/watch.js +0 -0
- /package/{components/common → internals}/definitions/defineAllComponents.d.ts +0 -0
- /package/{components/common → internals}/definitions/defineComponents.d.ts +0 -0
- /package/{components/common → internals}/definitions/defineComponents.js +0 -0
- /package/{components/common → internals}/definitions/register.d.ts +0 -0
- /package/{components/common → internals}/definitions/register.js +0 -0
- /package/{components/common → internals}/i18n/EN/calendar.resources.d.ts +0 -0
- /package/{components/common → internals}/i18n/EN/chat.resources.d.ts +0 -0
- /package/{components/common → internals}/i18n/EN/chat.resources.js +0 -0
- /package/{components/common → internals}/i18n/EN/date-picker.resources.d.ts +0 -0
- /package/{components/common → internals}/i18n/EN/date-picker.resources.js +0 -0
- /package/{components/common → internals}/i18n/EN/date-range-picker.resources.d.ts +0 -0
- /package/{components/common → internals}/i18n/EN/date-range-picker.resources.js +0 -0
- /package/{components/common → internals}/i18n/i18n-controller.d.ts +0 -0
- /package/{components/common → internals}/i18n/i18n-controller.js +0 -0
- /package/{components/common → internals}/i18n/utils.d.ts +0 -0
- /package/{components/common → internals}/mixins/constructor.d.ts +0 -0
- /package/{components/common → internals}/mixins/constructor.js +0 -0
- /package/{components/common → internals}/mixins/event-emitter.d.ts +0 -0
- /package/{components/common → internals}/mixins/event-emitter.js +0 -0
- /package/{components/common → internals}/mixins/forms/associated-required.d.ts +0 -0
- /package/{components/common → internals}/mixins/forms/form-value.d.ts +0 -0
- /package/{components/common → internals}/mixins/forms/form-value.js +0 -0
- /package/{components/common → internals}/mixins/forms/types.js +0 -0
- /package/{components/common → internals}/part-map.d.ts +0 -0
- /package/{components/common → internals}/part-map.js +0 -0
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
import type { LitElement, ReactiveControllerHost } from 'lit';
|
|
1
|
+
import type { LitElement, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
2
|
import type { FormValueType } from '../mixins/forms/types.js';
|
|
3
3
|
/** Configuration for the ElementInternalsController. */
|
|
4
4
|
type ElementInternalsConfig<T extends keyof ARIAMixin = keyof ARIAMixin> = {
|
|
5
5
|
/** Initial ARIA attributes to set on the element internals. */
|
|
6
|
-
initialARIA
|
|
6
|
+
initialARIA?: Partial<Record<T, ARIAMixin[T]>>;
|
|
7
|
+
/**
|
|
8
|
+
* Whether to also mirror the internals `role` to a `role` content attribute
|
|
9
|
+
* on the host element.
|
|
10
|
+
*
|
|
11
|
+
* Workaround for axe, which reads content attributes only and does not see
|
|
12
|
+
* `ElementInternals` ARIA. An author-supplied `role` attribute always wins —
|
|
13
|
+
* the controller only writes the attribute when it is absent or was written
|
|
14
|
+
* by the controller itself.
|
|
15
|
+
*/
|
|
16
|
+
reflectRole?: boolean;
|
|
7
17
|
};
|
|
8
18
|
/**
|
|
9
19
|
* A Lit ReactiveController to manage `ElementInternals` for a host element.
|
|
10
20
|
* Provides methods to interact with custom element states and ARIA attributes..
|
|
11
21
|
*/
|
|
12
|
-
declare class ElementInternalsController {
|
|
22
|
+
declare class ElementInternalsController implements ReactiveController {
|
|
13
23
|
private readonly _host;
|
|
14
24
|
private readonly _internals;
|
|
25
|
+
private readonly _reflectRole;
|
|
26
|
+
/** The last `role` content attribute value written by this controller. */
|
|
27
|
+
private _reflectedRole;
|
|
15
28
|
/**
|
|
16
29
|
* Gets the closest ancestor `<form>` element or `null`.
|
|
17
30
|
*
|
|
@@ -46,9 +59,33 @@ declare class ElementInternalsController {
|
|
|
46
59
|
* `static formAssociated = true`.
|
|
47
60
|
*/
|
|
48
61
|
get willValidate(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Returns a read-only array of the `<label>` elements associated with the host element, or `null` if there are no associated labels.
|
|
64
|
+
* The association is determined by the `for` attribute of `<label>` elements or by nesting the host element inside a `<label>`.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* The host element must be form associated, that is, it should have
|
|
68
|
+
* `static formAssociated = true` in order to return associated labels.
|
|
69
|
+
*/
|
|
70
|
+
get labels(): ReadonlyArray<Element> | null;
|
|
49
71
|
constructor(host: ReactiveControllerHost & LitElement, config?: ElementInternalsConfig);
|
|
72
|
+
/** @internal */
|
|
73
|
+
hostConnected(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Mirrors the internals `role` onto a content attribute on the host, when
|
|
76
|
+
* {@link ElementInternalsConfig.reflectRole} is enabled.
|
|
77
|
+
*
|
|
78
|
+
* Deferred until the host is connected — custom elements must not gain
|
|
79
|
+
* attributes during construction.
|
|
80
|
+
*/
|
|
81
|
+
private _reflectRoleAttribute;
|
|
50
82
|
/** Sets ARIA attributes on the element's internals. */
|
|
51
83
|
setARIA<T extends keyof ARIAMixin = keyof ARIAMixin>(state: Partial<Record<T, ARIAMixin[T]>>): void;
|
|
84
|
+
/**
|
|
85
|
+
* Returns an ARIA attribute set on the element's internals. Internals-based
|
|
86
|
+
* ARIA leaves no trace in the DOM, so this is the only way to read it back.
|
|
87
|
+
*/
|
|
88
|
+
getARIA<T extends keyof ARIAMixin = keyof ARIAMixin>(name: T): ARIAMixin[T];
|
|
52
89
|
/**
|
|
53
90
|
* Adds or removes a custom state from the element's internals.
|
|
54
91
|
* Custom states can be styled via `:state()` selector in CSS.
|
|
@@ -94,4 +131,12 @@ declare class ElementInternalsController {
|
|
|
94
131
|
}
|
|
95
132
|
/** Creates and adds a {@link ElementInternalsController} to a LitElement host. */
|
|
96
133
|
export declare function addInternalsController(host: ReactiveControllerHost & LitElement, config?: ElementInternalsConfig): ElementInternalsController;
|
|
134
|
+
/**
|
|
135
|
+
* Resolves the {@link ElementInternalsController} of the given element, if it has one.
|
|
136
|
+
*
|
|
137
|
+
* Internal cross-component/spec lookup. Not part of the public API — lives under
|
|
138
|
+
* `#internals` and must not be re-exported from the package entry point. Prefer this
|
|
139
|
+
* over exposing `public` `@hidden @internal` members on component classes.
|
|
140
|
+
*/
|
|
141
|
+
export declare function internalsOf(element: Element): ElementInternalsController | undefined;
|
|
97
142
|
export type { ElementInternalsController };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const registry = new WeakMap();
|
|
1
2
|
class ElementInternalsController {
|
|
2
3
|
get form() {
|
|
3
4
|
return this._internals.form;
|
|
@@ -11,16 +12,44 @@ class ElementInternalsController {
|
|
|
11
12
|
get willValidate() {
|
|
12
13
|
return this._internals.willValidate;
|
|
13
14
|
}
|
|
15
|
+
get labels() {
|
|
16
|
+
const labels = this._internals.labels;
|
|
17
|
+
return labels && labels.length > 0 ? Array.from(labels) : null;
|
|
18
|
+
}
|
|
14
19
|
constructor(host, config) {
|
|
20
|
+
this._reflectedRole = null;
|
|
15
21
|
this._host = host;
|
|
16
22
|
this._internals = this._host.attachInternals();
|
|
23
|
+
this._reflectRole = config?.reflectRole ?? false;
|
|
17
24
|
if (config?.initialARIA) {
|
|
18
25
|
this.setARIA(config.initialARIA);
|
|
19
26
|
}
|
|
27
|
+
registry.set(host, this);
|
|
20
28
|
host.addController(this);
|
|
21
29
|
}
|
|
30
|
+
hostConnected() {
|
|
31
|
+
this._reflectRoleAttribute();
|
|
32
|
+
}
|
|
33
|
+
_reflectRoleAttribute() {
|
|
34
|
+
const host = this._host;
|
|
35
|
+
if (!(this._reflectRole && host.isConnected)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const role = this._internals.role;
|
|
39
|
+
const current = host.getAttribute('role');
|
|
40
|
+
if (role && (current === null || current === this._reflectedRole)) {
|
|
41
|
+
host.setAttribute('role', role);
|
|
42
|
+
this._reflectedRole = role;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
22
45
|
setARIA(state) {
|
|
23
46
|
Object.assign(this._internals, state);
|
|
47
|
+
if ('role' in state) {
|
|
48
|
+
this._reflectRoleAttribute();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
getARIA(name) {
|
|
52
|
+
return this._internals[name];
|
|
24
53
|
}
|
|
25
54
|
setState(state, value) {
|
|
26
55
|
value
|
|
@@ -43,4 +72,7 @@ class ElementInternalsController {
|
|
|
43
72
|
export function addInternalsController(host, config) {
|
|
44
73
|
return new ElementInternalsController(host, config);
|
|
45
74
|
}
|
|
75
|
+
export function internalsOf(element) {
|
|
76
|
+
return registry.get(element);
|
|
77
|
+
}
|
|
46
78
|
//# sourceMappingURL=internals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internals.js","sourceRoot":"","sources":["../../../src/internals/controllers/internals.ts"],"names":[],"mappings":"AA6BA,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAuC,CAAC;AAMpE,MAAM,0BAA0B;IAe9B,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAC9B,CAAC;IAUD,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;IAClC,CAAC;IASD,IAAW,iBAAiB;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC;IAC3C,CAAC;IAUD,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;IACtC,CAAC;IAUD,IAAW,MAAM;QACf,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAoC,CAAC;QACpE,OAAO,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,CAAC;IAED,YACE,IAAyC,EACzC,MAA+B;QA/DzB,mBAAc,GAAkB,IAAI,CAAC;QAiE3C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAC/C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K;YACH,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;YACnC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAWM,YAAY,CAAC,KAAoB,EAAE,KAAqB;QAC7D,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAUM,WAAW,CAAC,KAA0B,EAAE,OAAgB;QAC7D,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAUM,aAAa;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;IACzC,CAAC;IAUM,cAAc;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;IAC1C,CAAC;CACF;AAGD,MAAM,UAAU,sBAAsB,CACpC,IAAyC,EACzC,MAA+B;IAE/B,OAAO,IAAI,0BAA0B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC;AASD,MAAM,UAAU,WAAW,CACzB,OAAgB;IAEhB,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import type {\n LitElement,\n ReactiveController,\n ReactiveControllerHost,\n} from 'lit';\nimport type { FormValueType } from '../mixins/forms/types.js';\n\n/** Configuration for the ElementInternalsController. */\ntype ElementInternalsConfig<T extends keyof ARIAMixin = keyof ARIAMixin> = {\n /** Initial ARIA attributes to set on the element internals. */\n initialARIA?: Partial<Record<T, ARIAMixin[T]>>;\n /**\n * Whether to also mirror the internals `role` to a `role` content attribute\n * on the host element.\n *\n * Workaround for axe, which reads content attributes only and does not see\n * `ElementInternals` ARIA. An author-supplied `role` attribute always wins —\n * the controller only writes the attribute when it is absent or was written\n * by the controller itself.\n */\n reflectRole?: boolean;\n};\n\n/**\n * Internal registry resolving a host element to its internals controller.\n *\n * `attachInternals()` throws when called twice on the same element, so a host\n * maps to at most one controller.\n */\nconst registry = new WeakMap<Element, ElementInternalsController>();\n\n/**\n * A Lit ReactiveController to manage `ElementInternals` for a host element.\n * Provides methods to interact with custom element states and ARIA attributes..\n */\nclass ElementInternalsController implements ReactiveController {\n private readonly _host: ReactiveControllerHost & LitElement;\n private readonly _internals: ElementInternals;\n private readonly _reflectRole: boolean;\n\n /** The last `role` content attribute value written by this controller. */\n private _reflectedRole: string | null = null;\n\n /**\n * Gets the closest ancestor `<form>` element or `null`.\n *\n * @remarks\n * The host element must be form associated, that is, it should have\n * `static formAssociated = true` in order to return the parent form.\n */\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 * @remarks\n * The host element must be form associated, that is, it should have\n * `static formAssociated = true`.\n */\n public get validity(): ValidityState {\n return this._internals.validity;\n }\n\n /**\n * Returns a string containing the validation message of this element.\n *\n * @remarks\n * The host element must be form associated, that is, it should have\n * `static formAssociated = true`.\n */\n public get validationMessage(): string {\n return this._internals.validationMessage;\n }\n\n /**\n * Returns a boolean value which returns true if the element is a submittable element\n * which is a candidate for constraint validation.\n *\n * @remarks\n * The host element must be form associated, that is, it should have\n * `static formAssociated = true`.\n */\n public get willValidate(): boolean {\n return this._internals.willValidate;\n }\n\n /**\n * Returns a read-only array of the `<label>` elements associated with the host element, or `null` if there are no associated labels.\n * The association is determined by the `for` attribute of `<label>` elements or by nesting the host element inside a `<label>`.\n *\n * @remarks\n * The host element must be form associated, that is, it should have\n * `static formAssociated = true` in order to return associated labels.\n */\n public get labels(): ReadonlyArray<Element> | null {\n const labels = this._internals.labels as NodeListOf<Element> | null;\n return labels && labels.length > 0 ? Array.from(labels) : null;\n }\n\n constructor(\n host: ReactiveControllerHost & LitElement,\n config?: ElementInternalsConfig\n ) {\n this._host = host;\n this._internals = this._host.attachInternals();\n this._reflectRole = config?.reflectRole ?? false;\n\n if (config?.initialARIA) {\n this.setARIA(config.initialARIA);\n }\n\n registry.set(host, this);\n host.addController(this);\n }\n\n /** @internal */\n public hostConnected(): void {\n this._reflectRoleAttribute();\n }\n\n /**\n * Mirrors the internals `role` onto a content attribute on the host, when\n * {@link ElementInternalsConfig.reflectRole} is enabled.\n *\n * Deferred until the host is connected — custom elements must not gain\n * attributes during construction.\n */\n private _reflectRoleAttribute(): void {\n const host = this._host;\n\n if (!(this._reflectRole && host.isConnected)) {\n return;\n }\n\n const role = this._internals.role;\n const current = host.getAttribute('role');\n\n // Write only when the attribute is absent or still holds the value this\n // controller wrote — an attribute changed by the author is theirs to keep.\n if (role && (current === null || current === this._reflectedRole)) {\n host.setAttribute('role', role);\n this._reflectedRole = role;\n }\n }\n\n /** Sets ARIA attributes on the element's internals. */\n public setARIA<T extends keyof ARIAMixin = keyof ARIAMixin>(\n state: Partial<Record<T, ARIAMixin[T]>>\n ): void {\n Object.assign(this._internals, state);\n\n if ('role' in state) {\n this._reflectRoleAttribute();\n }\n }\n\n /**\n * Returns an ARIA attribute set on the element's internals. Internals-based\n * ARIA leaves no trace in the DOM, so this is the only way to read it back.\n */\n public getARIA<T extends keyof ARIAMixin = keyof ARIAMixin>(\n name: T\n ): ARIAMixin[T] {\n return this._internals[name];\n }\n\n /**\n * Adds or removes a custom state from the element's internals.\n * Custom states can be styled via `:state()` selector in CSS.\n */\n public setState(state: string, value: boolean): void {\n value\n ? this._internals.states.add(state)\n : this._internals.states.delete(state);\n }\n\n /**\n * Sets both the state and submission value of internals's target element to value.\n *\n * If value is null, the element won't participate in form submission.\n *\n * @remarks\n * The host element must be form associated, that is, it should have\n * `static formAssociated = true`.\n */\n public setFormValue(value: FormValueType, state?: FormValueType): void {\n this._internals.setFormValue(value, state);\n }\n\n /**\n * Sets the internal validity state of the host element as well as the validation\n * message.\n *\n * @remarks\n * The host element must be form associated, that is, it should have\n * `static formAssociated = true`.\n */\n public setValidity(flags?: ValidityStateFlags, message?: string): void {\n this._internals.setValidity(flags, message);\n }\n\n /**\n * Checks the internal validity of the host element and fires an `invalid` event if\n * the host element fails validation constraints.\n *\n * @remarks\n * The host element must be form associated, that is, it should have\n * `static formAssociated = true`.\n */\n public checkValidity(): boolean {\n return this._internals.checkValidity();\n }\n\n /**\n * Checks the internal validity of the host element and fires an `invalid` event if\n * the host element fails validation constraints.\n *\n * @remarks\n * The host element must be form associated, that is, it should have\n * `static formAssociated = true`.\n */\n public reportValidity(): boolean {\n return this._internals.reportValidity();\n }\n}\n\n/** Creates and adds a {@link ElementInternalsController} to a LitElement host. */\nexport function addInternalsController(\n host: ReactiveControllerHost & LitElement,\n config?: ElementInternalsConfig\n): ElementInternalsController {\n return new ElementInternalsController(host, config);\n}\n\n/**\n * Resolves the {@link ElementInternalsController} of the given element, if it has one.\n *\n * Internal cross-component/spec lookup. Not part of the public API — lives under\n * `#internals` and must not be re-exported from the package entry point. Prefer this\n * over exposing `public` `@hidden @internal` members on component classes.\n */\nexport function internalsOf(\n element: Element\n): ElementInternalsController | undefined {\n return registry.get(element);\n}\n\nexport type { ElementInternalsController };\n"]}
|
|
@@ -35,7 +35,7 @@ type KeyBindingSkipCallback = (node: Element, event: KeyboardEvent) => boolean;
|
|
|
35
35
|
type KeyBindingTrigger = 'keydown' | 'keyup';
|
|
36
36
|
/**
|
|
37
37
|
* Configuration object for the controller.
|
|
38
|
-
* @
|
|
38
|
+
* @hidden
|
|
39
39
|
*/
|
|
40
40
|
interface KeyBindingControllerOptions {
|
|
41
41
|
/**
|
|
@@ -101,10 +101,7 @@ interface KeyBindingOptions {
|
|
|
101
101
|
*/
|
|
102
102
|
stopPropagation?: boolean;
|
|
103
103
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Maps internal modifier names to their corresponding `KeyboardEvent` boolean property names.
|
|
106
|
-
* Needed because `ctrlKey` in the DOM is the property for the `'control'` modifier (not `'controlKey'`).
|
|
107
|
-
*/
|
|
104
|
+
/** {@link MODIFIER_ENTRIES} as a lookup of modifier name to event property. */
|
|
108
105
|
export declare const MODIFIER_EVENT_KEYS: Record<string, string>;
|
|
109
106
|
/**
|
|
110
107
|
* A controller for managing key bindings on a host element. It allows you to register handlers for specific key combinations,
|
|
@@ -112,7 +109,7 @@ export declare const MODIFIER_EVENT_KEYS: Record<string, string>;
|
|
|
112
109
|
*
|
|
113
110
|
* The controller listens for keyboard events on the host element (or an optionally specified element) and invokes the appropriate handlers
|
|
114
111
|
* when the registered key combinations are detected.
|
|
115
|
-
*
|
|
112
|
+
* @hidden
|
|
116
113
|
*/
|
|
117
114
|
declare class KeyBindingController implements ReactiveController {
|
|
118
115
|
private static readonly _defaultOptions;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createAbortHandle } from '../abort-handler.js';
|
|
2
|
-
import { asArray,
|
|
2
|
+
import { asArray, partition } from '../utils/arrays.js';
|
|
3
|
+
import { isElement } from '../utils/dom.js';
|
|
4
|
+
import { toMerged } from '../utils/objects.js';
|
|
5
|
+
import { isFunction } from '../utils/types.js';
|
|
3
6
|
export const arrowLeft = 'ArrowLeft';
|
|
4
7
|
export const arrowRight = 'ArrowRight';
|
|
5
8
|
export const arrowUp = 'ArrowUp';
|
|
@@ -16,14 +19,15 @@ export const altKey = 'Alt';
|
|
|
16
19
|
export const ctrlKey = 'Control';
|
|
17
20
|
export const metaKey = 'Meta';
|
|
18
21
|
export const shiftKey = 'Shift';
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const MODIFIER_ENTRIES = [
|
|
23
|
+
['alt', 'altKey'],
|
|
24
|
+
['control', 'ctrlKey'],
|
|
25
|
+
['meta', 'metaKey'],
|
|
26
|
+
['shift', 'shiftKey'],
|
|
27
|
+
];
|
|
28
|
+
const ALL_MODIFIER_VALUES = MODIFIER_ENTRIES.map(([name]) => name);
|
|
29
|
+
const MODIFIERS = new Set(ALL_MODIFIER_VALUES);
|
|
30
|
+
export const MODIFIER_EVENT_KEYS = Object.fromEntries(MODIFIER_ENTRIES);
|
|
27
31
|
function normalizeKeys(keys) {
|
|
28
32
|
return asArray(keys).map((key) => key.toLowerCase());
|
|
29
33
|
}
|
|
@@ -33,10 +37,20 @@ function isKeydown(event) {
|
|
|
33
37
|
function isKeyup(event) {
|
|
34
38
|
return event.type === 'keyup';
|
|
35
39
|
}
|
|
40
|
+
function sortModifiers(modifiers) {
|
|
41
|
+
return ALL_MODIFIER_VALUES.filter((mod) => modifiers.includes(mod));
|
|
42
|
+
}
|
|
43
|
+
function getActiveModifiers(event) {
|
|
44
|
+
const active = [];
|
|
45
|
+
for (const [name, property] of MODIFIER_ENTRIES) {
|
|
46
|
+
if (event[property]) {
|
|
47
|
+
active.push(name);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return active;
|
|
51
|
+
}
|
|
36
52
|
function createCombinationKey(keys, modifiers) {
|
|
37
|
-
|
|
38
|
-
const sortedModifiers = ALL_MODIFIER_VALUES.filter((mod) => modifiers.includes(mod)).sort();
|
|
39
|
-
return sortedModifiers.concat(sortedKeys).join('+');
|
|
53
|
+
return modifiers.concat(keys.length > 1 ? keys.toSorted() : keys).join('+');
|
|
40
54
|
}
|
|
41
55
|
class KeyBindingController {
|
|
42
56
|
static { this._defaultOptions = {
|
|
@@ -80,20 +94,20 @@ class KeyBindingController {
|
|
|
80
94
|
}
|
|
81
95
|
return false;
|
|
82
96
|
}
|
|
83
|
-
_shouldSkip(event) {
|
|
84
|
-
|
|
85
|
-
if (!this._allowedKeys.has(event.key.toLowerCase())) {
|
|
97
|
+
_shouldSkip(event, key) {
|
|
98
|
+
if (!this._allowedKeys.has(key)) {
|
|
86
99
|
return true;
|
|
87
100
|
}
|
|
88
|
-
|
|
101
|
+
const path = event.composedPath();
|
|
102
|
+
const element = this._element;
|
|
103
|
+
if (!path.some((node) => node === element)) {
|
|
89
104
|
return true;
|
|
90
105
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
return Boolean(getElementFromPath(this._skipSelector, event));
|
|
106
|
+
const selector = this._skipSelector;
|
|
107
|
+
if (selector) {
|
|
108
|
+
return path.some((node) => isElement(node) && node.matches(selector));
|
|
96
109
|
}
|
|
110
|
+
const skip = this._options.skip;
|
|
97
111
|
return isFunction(skip)
|
|
98
112
|
? skip.call(this._host, event.target, event)
|
|
99
113
|
: false;
|
|
@@ -111,18 +125,18 @@ class KeyBindingController {
|
|
|
111
125
|
this._pressedKeys.clear();
|
|
112
126
|
}
|
|
113
127
|
_handleKeyEvent(event) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
const key = event.key.toLowerCase();
|
|
129
|
+
const isModifier = MODIFIERS.has(key);
|
|
130
|
+
if (this._shouldSkip(event, key)) {
|
|
131
|
+
if (!isModifier && isKeyup(event)) {
|
|
117
132
|
this._pressedKeys.delete(key);
|
|
118
133
|
}
|
|
119
134
|
return;
|
|
120
135
|
}
|
|
121
|
-
|
|
122
|
-
if (!MODIFIERS.has(key)) {
|
|
136
|
+
if (!isModifier) {
|
|
123
137
|
this._pressedKeys.add(key);
|
|
124
138
|
}
|
|
125
|
-
const activeModifiers =
|
|
139
|
+
const activeModifiers = getActiveModifiers(event);
|
|
126
140
|
const combination = createCombinationKey(Array.from(this._pressedKeys), activeModifiers);
|
|
127
141
|
let binding = this._bindings.get(combination);
|
|
128
142
|
if (!binding && this._pressedKeys.size > 1) {
|
|
@@ -132,7 +146,7 @@ class KeyBindingController {
|
|
|
132
146
|
this._applyEventModifiers(binding, event);
|
|
133
147
|
binding.handler.call(this._host, event);
|
|
134
148
|
}
|
|
135
|
-
if (!
|
|
149
|
+
if (!isModifier && isKeyup(event)) {
|
|
136
150
|
this._pressedKeys.delete(key);
|
|
137
151
|
}
|
|
138
152
|
}
|
|
@@ -149,7 +163,7 @@ class KeyBindingController {
|
|
|
149
163
|
}
|
|
150
164
|
set(key, handler, bindingOptions) {
|
|
151
165
|
const { keys, modifiers } = parseKeys(key);
|
|
152
|
-
const combination = createCombinationKey(keys, modifiers);
|
|
166
|
+
const combination = createCombinationKey(keys, sortModifiers(modifiers));
|
|
153
167
|
const options = toMerged(this._options.bindingDefaults, bindingOptions ?? {});
|
|
154
168
|
for (const each of [...keys, ...modifiers]) {
|
|
155
169
|
this._allowedKeys.add(each);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-bindings.js","sourceRoot":"","sources":["../../../src/internals/controllers/key-bindings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,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,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AgB;QACpC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC1C,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;QAEhC,OAAO;YACL,WAAW,EAAE,GAAG,EAAE;gBAChB,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;gBAC7C,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC3C,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE,CAAC;oBACtC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;gBACpC,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;;AAkBH,MAAM,UAAU,SAAS,CAAC,SAA4B;IAIpD,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CACpE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CACnB,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC;AAuBD,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';\nimport { createAbortHandle } from '../abort-handler.js';\nimport { asArray, partition } from '../utils/arrays.js';\nimport { isElement } from '../utils/dom.js';\nimport { toMerged } from '../utils/objects.js';\nimport { isFunction } from '../utils/types.js';\n\n//#region Keys and modifiers\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 = 'Control' as const;\nexport const metaKey = 'Meta' as const;\nexport const shiftKey = 'Shift' as const;\n\n//#endregion\n\n//#region Types\n\n/* Types */\ntype KeyBindingHandler = (event: KeyboardEvent) => void;\ntype 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 */\ntype KeyBindingSkipCallback = (node: Element, event: KeyboardEvent) => boolean;\n\n/**\n * The event type which will trigger the bound handler.\n */\ntype KeyBindingTrigger = 'keydown' | 'keyup';\n\n/**\n * Configuration object for the controller.\n * @hidden\n */\ninterface 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 */\ninterface 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 the handler should fire on auto-repeated keydown events (i.e. when a key is held down).\n *\n * Defaults to `false`.\n */\n repeat?: boolean;\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\n/** @hidden */\ninterface KeyBinding {\n keys: string[];\n handler: KeyBindingHandler;\n options?: KeyBindingOptions;\n modifiers: string[];\n}\n\n//#endregion\n\n//#region Internal functions and constants\n\n/**\n * Every modifier, paired with the `KeyboardEvent` boolean property it is read\n * from - `ctrlKey` is the property for the `'control'` modifier, not `'controlKey'`.\n *\n * Kept in alphabetical order: combination keys sort their modifiers, and every\n * derived collection below inherits that order for free.\n */\nconst MODIFIER_ENTRIES = [\n ['alt', 'altKey'],\n ['control', 'ctrlKey'],\n ['meta', 'metaKey'],\n ['shift', 'shiftKey'],\n] as const satisfies ReadonlyArray<readonly [string, keyof KeyboardEvent]>;\n\nconst ALL_MODIFIER_VALUES = MODIFIER_ENTRIES.map(([name]) => name);\nconst MODIFIERS = new Set<string>(ALL_MODIFIER_VALUES);\n\n/** {@link MODIFIER_ENTRIES} as a lookup of modifier name to event property. */\nexport const MODIFIER_EVENT_KEYS: Record<string, string> =\n Object.fromEntries(MODIFIER_ENTRIES);\n\nfunction normalizeKeys(keys: string | string[]): string[] {\n return asArray(keys).map((key) => key.toLowerCase());\n}\n\nfunction isKeydown(event: Event): boolean {\n return event.type === 'keydown';\n}\n\nfunction isKeyup(event: Event): boolean {\n return event.type === 'keyup';\n}\n\n/** Sorts `modifiers` alphabetically, by filtering the already sorted source. */\nfunction sortModifiers(modifiers: string[]): string[] {\n return ALL_MODIFIER_VALUES.filter((mod) => modifiers.includes(mod));\n}\n\n/** Returns the modifiers active for `event`, already sorted. */\nfunction getActiveModifiers(event: KeyboardEvent): string[] {\n const active: string[] = [];\n\n for (const [name, property] of MODIFIER_ENTRIES) {\n if (event[property]) {\n active.push(name);\n }\n }\n\n return active;\n}\n\n/**\n * Creates a normalized combination key string from the provided keys and modifiers.\n *\n * The combination key is a string that uniquely identifies a specific combination of keys and modifiers.\n * It is created by sorting the keys and modifiers alphabetically and joining them with a '+' separator.\n *\n * `modifiers` must already be sorted - see {@link sortModifiers} and {@link getActiveModifiers}.\n */\nfunction createCombinationKey(keys: string[], modifiers: string[]): string {\n return modifiers.concat(keys.length > 1 ? keys.toSorted() : keys).join('+');\n}\n\n//#endregion\n\n/**\n * A controller for managing key bindings on a host element. It allows you to register handlers for specific key combinations,\n * with support for modifier keys and event options such as `preventDefault` and `stopPropagation`.\n *\n * The controller listens for keyboard events on the host element (or an optionally specified element) and invokes the appropriate handlers\n * when the registered key combinations are detected.\n * @hidden\n */\nclass KeyBindingController implements ReactiveController {\n //#region Private properties and state\n\n private static readonly _defaultOptions: KeyBindingControllerOptions = {\n skip: ['input', 'textarea', 'select'],\n bindingDefaults: { preventDefault: true },\n };\n\n private readonly _host: ReactiveControllerHost & Element;\n private readonly _ref?: Ref;\n private readonly _abortHandle = createAbortHandle();\n\n private readonly _bindings = new Map<string, KeyBinding>();\n private readonly _allowedKeys = new Set<string>();\n private readonly _pressedKeys = new Set<string>();\n\n private readonly _options: KeyBindingControllerOptions;\n private readonly _skipSelector: string | undefined;\n\n private _observedElement?: Element;\n\n private get _element(): Element {\n if (this._observedElement) {\n return this._observedElement;\n }\n return this._ref?.value || this._host;\n }\n\n //#endregion\n\n constructor(\n host: ReactiveControllerHost & Element,\n options?: KeyBindingControllerOptions\n ) {\n this._host = host;\n this._ref = options?.ref;\n this._options = toMerged(\n KeyBindingController._defaultOptions,\n options ?? {}\n );\n\n if (Array.isArray(this._options.skip)) {\n this._skipSelector = this._options.skip.join(',');\n }\n\n host.addController(this);\n }\n\n //#region Private API\n\n /**\n * Applies the event modifiers specified in the binding options to the provided keyboard event.\n * If `preventDefault` is set, it calls `event.preventDefault()`.\n * If `stopPropagation` is set, it calls `event.stopPropagation()`.\n */\n private _applyEventModifiers(\n binding: KeyBinding,\n event: KeyboardEvent\n ): void {\n if (binding.options?.preventDefault) {\n event.preventDefault();\n }\n\n if (binding.options?.stopPropagation) {\n event.stopPropagation();\n }\n }\n\n /**\n * Determines whether the provided keyboard event matches the specified key binding,\n * taking into account the event type and the binding's trigger options.\n */\n private _bindingMatches(binding: KeyBinding, event: KeyboardEvent): boolean {\n const triggers = binding.options?.triggers ?? ['keydown'];\n\n if (isKeydown(event) && triggers.includes('keydown')) {\n return !event.repeat || Boolean(binding.options?.repeat);\n }\n\n if (isKeyup(event) && triggers.includes('keyup')) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Determines whether the provided event should be ignored based on the controller's configuration and the event's context.\n * The method checks if the event's key is among the allowed keys, if the event originated from within the controller's scope,\n * and if it matches any of the skip conditions defined in the controller's options.\n */\n private _shouldSkip(event: KeyboardEvent, key: string): boolean {\n if (!this._allowedKeys.has(key)) {\n return true;\n }\n\n const path = event.composedPath();\n const element = this._element;\n\n if (!path.some((node) => node === element)) {\n return true;\n }\n\n const selector = this._skipSelector;\n\n if (selector) {\n return path.some((node) => isElement(node) && node.matches(selector));\n }\n\n const skip = this._options.skip;\n\n return isFunction(skip)\n ? skip.call(this._host, event.target as Element, event)\n : false;\n }\n\n //#endregion\n\n //#region Controller lifecycle\n\n /** @internal */\n public hostConnected(): void {\n const { signal } = this._abortHandle;\n this._host.addEventListener('keyup', this, { signal });\n this._host.addEventListener('keydown', this, { signal });\n globalThis.addEventListener('blur', this, { signal });\n }\n\n /** @internal */\n public hostDisconnected(): void {\n this._abortHandle.abort();\n }\n\n //#endregion\n\n //#region Event handling\n\n /**\n * Handles the global blur event to clear the internal state of pressed keys.\n *\n * This is necessary to prevent \"stuck\" keys when the user switches to another application\n * or tab while holding down a key.\n */\n private _handleGlobalBlur(): void {\n this._pressedKeys.clear();\n }\n\n /**\n * Handles keyboard events on the observed element.\n *\n * It checks if the event should be skipped based on the controller's configuration,\n * and if not, it determines if there is a registered handler for the combination of pressed keys and active modifiers.\n *\n * If a matching handler is found, it applies the specified event modifiers and invokes the handler.\n * It also manages the internal state of currently pressed keys to accurately detect key combinations.\n *\n */\n private _handleKeyEvent(event: KeyboardEvent): void {\n const key = event.key.toLowerCase();\n const isModifier = MODIFIERS.has(key);\n\n if (this._shouldSkip(event, key)) {\n // Always clean up on keyup regardless of whether the event is otherwise skipped.\n if (!isModifier && isKeyup(event)) {\n this._pressedKeys.delete(key);\n }\n return;\n }\n\n if (!isModifier) {\n this._pressedKeys.add(key);\n }\n\n const activeModifiers = getActiveModifiers(event);\n\n const combination = createCombinationKey(\n Array.from(this._pressedKeys),\n activeModifiers\n );\n let binding = this._bindings.get(combination);\n\n // When multiple non-modifier keys are simultaneously in _pressedKeys (due to overlapping\n // key presses, e.g. pressing ArrowUp before ArrowDown's keyup fires), the full combination\n // won't match any single-key binding. Fall back to just the current key + modifiers so that\n // single-key bindings continue to fire even when other keys are still \"held\".\n if (!binding && this._pressedKeys.size > 1) {\n binding = this._bindings.get(\n createCombinationKey([key], activeModifiers)\n );\n }\n\n if (binding && this._bindingMatches(binding, event)) {\n this._applyEventModifiers(binding, event);\n binding.handler.call(this._host, event);\n }\n\n if (!isModifier && isKeyup(event)) {\n this._pressedKeys.delete(key);\n }\n }\n\n /** @internal */\n public handleEvent(event: KeyboardEvent | FocusEvent): void {\n switch (event.type) {\n case 'keydown':\n case 'keyup':\n this._handleKeyEvent(event as KeyboardEvent);\n break;\n case 'blur':\n this._handleGlobalBlur();\n break;\n }\n }\n\n //#endregion\n\n //#region Public API\n\n /**\n * Registers a key binding with the specified key(s), handler function, and optional configuration.\n *\n * The `key` parameter can be a single key or an array of keys, and can include modifier keys (e.g., 'ctrl+s', ['shift', 'a']).\n * The `handler` is a function that will be called when the specified key combination is detected.\n * The `bindingOptions` allow you to customize the behavior of the binding, such as which event types trigger the handler,\n * whether it should fire on auto-repeated keydown events, and whether to call `preventDefault` or `stopPropagation`.\n *\n * The method returns the controller instance to allow for method chaining.\n */\n public set(\n key: string | string[],\n handler: KeyBindingHandler,\n bindingOptions?: KeyBindingOptions\n ): this {\n const { keys, modifiers } = parseKeys(key);\n const combination = createCombinationKey(keys, sortModifiers(modifiers));\n const options = toMerged(\n this._options.bindingDefaults!,\n bindingOptions ?? {}\n );\n\n for (const each of [...keys, ...modifiers]) {\n this._allowedKeys.add(each);\n }\n\n this._bindings.set(combination, { keys, handler, options, modifiers });\n\n return this;\n }\n\n /**\n * Registers the provided handler function to be called when either the Enter key or Space bar is pressed.\n *\n * This is a common pattern for activating buttons or interactive elements, and this method provides a convenient way to set up such bindings.\n *\n * The method accepts optional `KeyBindingOptions` which are applied to both the Enter key and Space bar bindings.\n * It returns the controller instance to allow for method chaining.\n *\n */\n public setActivateHandler(\n handler: KeyBindingHandler,\n options?: KeyBindingOptions\n ): this {\n this.set(enterKey, handler, options);\n this.set(spaceBar, handler, options);\n\n return this;\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 element.removeEventListener('keydown', this);\n element.removeEventListener('keyup', this);\n if (this._observedElement === element) {\n this._observedElement = undefined;\n }\n },\n };\n }\n\n //#endregion\n}\n\n/**\n * Parses the provided key(s) and separates them into modifiers and regular keys.\n *\n * Modifiers are keys like Alt, Ctrl, Meta and Shift which modify the behavior of other keys when pressed in combination.\n * Regular keys are all other keys which trigger the bound handler when pressed.\n *\n * The returned `keys` and `modifiers` are normalized to lowercase for consistency.\n *\n * @internal\n *\n * @param inputKeys - The key or keys to parse, provided as a string or an array of strings.\n * @returns An object containing the separated `keys` and `modifiers`.\n */\nexport function parseKeys(inputKeys: string | string[]): {\n keys: string[];\n modifiers: string[];\n} {\n const [modifiers, keys] = partition(normalizeKeys(inputKeys), (key) =>\n MODIFIERS.has(key)\n );\n return { keys, modifiers };\n}\n\n/**\n * Controller factory function which creates a {@link KeyBindingController} instance and attaches it to the provided host.\n *\n * @param element - The host element to which the controller will be attached.\n * @param options - Optional configuration for the controller.\n * @returns The created {@link KeyBindingController} instance.\n *\n * @example\n * ```ts\n * class MyComponent extends LitElement {\n * private _keyBindings = addKeybindings(this, {\n * skip: ['input', 'textarea'], // Optional: Skip key events originating from these elements\n * bindingDefaults: { preventDefault: true }, // Optional: Default options for all bindings\n * });\n *\n * constructor() {\n * super();\n * this._keyBindings.set('ctrl+s', this._handleSave); // Register a key binding\n * }\n * ```\n */\nexport function addKeybindings(\n element: ReactiveControllerHost & Element,\n options?: KeyBindingControllerOptions\n): KeyBindingController {\n return new KeyBindingController(element, options);\n}\n\nexport type {\n KeyBindingController,\n KeyBindingControllerOptions,\n KeyBindingHandler,\n KeyBindingObserverCleanup,\n KeyBindingOptions,\n KeyBindingSkipCallback,\n KeyBindingTrigger,\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
/** @
|
|
1
|
+
import { type ReactiveController, type ReactiveControllerHost } from 'lit';
|
|
2
|
+
/** @hidden */
|
|
3
3
|
export interface MutationControllerConfig<T extends Node = Node> {
|
|
4
4
|
/** The callback function to run when a mutation occurs. */
|
|
5
5
|
callback: MutationControllerCallback<T>;
|
|
@@ -52,16 +52,17 @@ export type MutationControllerParams<T extends Node = Node> = {
|
|
|
52
52
|
};
|
|
53
53
|
declare class MutationController<T extends Node = Node> implements ReactiveController {
|
|
54
54
|
private readonly _host;
|
|
55
|
-
private readonly _observer;
|
|
56
55
|
private readonly _target;
|
|
57
56
|
private readonly _config;
|
|
58
57
|
private readonly _callback;
|
|
59
|
-
private readonly
|
|
58
|
+
private readonly _matches;
|
|
59
|
+
private _observer?;
|
|
60
60
|
constructor(host: ReactiveControllerHost & Element, options: MutationControllerConfig<T>);
|
|
61
61
|
/** @internal */
|
|
62
62
|
hostConnected(): void;
|
|
63
63
|
/** @internal */
|
|
64
64
|
hostDisconnected(): void;
|
|
65
|
+
private _collect;
|
|
65
66
|
private _process;
|
|
66
67
|
/**
|
|
67
68
|
* Begin receiving notifications of changes to the DOM based
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { isServer, } from 'lit';
|
|
2
|
+
import { isElement } from '../utils/dom.js';
|
|
3
|
+
function createNodeMatcher(filter) {
|
|
4
|
+
if (!filter) {
|
|
5
|
+
return () => true;
|
|
6
|
+
}
|
|
7
|
+
if (!Array.isArray(filter)) {
|
|
8
|
+
return filter;
|
|
9
|
+
}
|
|
10
|
+
const selector = filter.join(',');
|
|
11
|
+
return selector
|
|
12
|
+
? (node) => isElement(node) && node.matches(selector)
|
|
13
|
+
: () => false;
|
|
14
|
+
}
|
|
15
|
+
class MutationController {
|
|
16
|
+
constructor(host, options) {
|
|
17
|
+
this._host = host;
|
|
18
|
+
this._callback = options.callback;
|
|
19
|
+
this._config = options.config;
|
|
20
|
+
this._target = options.target ?? this._host;
|
|
21
|
+
this._matches = createNodeMatcher(options.filter);
|
|
22
|
+
if (!isServer) {
|
|
23
|
+
this._observer = new MutationObserver((records) => {
|
|
24
|
+
this.disconnect();
|
|
25
|
+
this._callback.call(this._host, this._process(records));
|
|
26
|
+
this.observe();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
host.addController(this);
|
|
30
|
+
}
|
|
31
|
+
hostConnected() {
|
|
32
|
+
this.observe();
|
|
33
|
+
}
|
|
34
|
+
hostDisconnected() {
|
|
35
|
+
this.disconnect();
|
|
36
|
+
}
|
|
37
|
+
_collect(nodes, target, into) {
|
|
38
|
+
for (const node of nodes) {
|
|
39
|
+
if (this._matches(node)) {
|
|
40
|
+
into.push({ target, node: node });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
_process(records) {
|
|
45
|
+
const changes = {
|
|
46
|
+
attributes: [],
|
|
47
|
+
added: [],
|
|
48
|
+
removed: [],
|
|
49
|
+
};
|
|
50
|
+
for (const record of records) {
|
|
51
|
+
const { type, target, attributeName, addedNodes, removedNodes } = record;
|
|
52
|
+
if (type === 'attributes') {
|
|
53
|
+
if (this._matches(target)) {
|
|
54
|
+
changes.attributes.push({ node: target, attributeName });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (type === 'childList') {
|
|
58
|
+
this._collect(addedNodes, target, changes.added);
|
|
59
|
+
this._collect(removedNodes, target, changes.removed);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return { records, changes, observer: this };
|
|
63
|
+
}
|
|
64
|
+
observe() {
|
|
65
|
+
this._observer?.observe(this._target, this._config);
|
|
66
|
+
}
|
|
67
|
+
disconnect() {
|
|
68
|
+
this._observer?.disconnect();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function createMutationController(host, config) {
|
|
72
|
+
return new MutationController(host, config);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=mutation-observer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-observer.js","sourceRoot":"","sources":["../../../src/internals/controllers/mutation-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GAGT,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAsE5C,SAAS,iBAAiB,CACxB,MAAoC;IAEpC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;IACpB,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAA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MAAmC;IAEnC,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import {\n isServer,\n type ReactiveController,\n type ReactiveControllerHost,\n} from 'lit';\nimport { isElement } from '../utils/dom.js';\n\n/** @hidden */\nexport interface MutationControllerConfig<T extends Node = Node> {\n /** The callback function to run when a mutation occurs. */\n callback: MutationControllerCallback<T>;\n /** The underlying mutation observer configuration parameters. */\n config: MutationObserverInit;\n /**\n * The element to observe.\n * If left out, the observer will listen on the host component itself.\n */\n target?: Element;\n /**\n * A filter configuration.\n * See {@link MutationControllerFilter|this} for additional information.\n */\n filter?: MutationControllerFilter<T>;\n}\n\ntype MutationControllerCallback<T extends Node = Node> = (\n params: MutationControllerParams<T>\n) => unknown;\n\n/**\n * Filter configuration to return elements that either match\n * an array of selector strings or a predicate function.\n */\ntype MutationControllerFilter<T extends Node = Node> =\n | string[]\n | ((node: T) => boolean);\n\ntype MutationDOMChange<T extends Node = Node> = {\n /** The parent of the added/removed element. */\n target: Element;\n /** The added/removed element. */\n node: T;\n};\n\ntype MutationAttributeChange<T extends Node = Node> = {\n /** The host element of the changed attribute. */\n node: T;\n /** The changed attribute name. */\n attributeName: string | null;\n};\n\ntype MutationChange<T extends Node = Node> = {\n /** Elements that have attribute(s) changes. */\n attributes: MutationAttributeChange<T>[];\n /** Elements that have been added. */\n added: MutationDOMChange<T>[];\n /** Elements that have been removed. */\n removed: MutationDOMChange<T>[];\n};\n\nexport type MutationControllerParams<T extends Node = Node> = {\n /** The original mutation records from the underlying observer. */\n records: MutationRecord[];\n /** The aggregated changes. */\n changes: MutationChange<T>;\n /** The observer controller instance. */\n observer: MutationController<T>;\n};\n\n/**\n * Resolves a filter configuration into a node predicate.\n *\n * A list of selectors is joined once into a single selector list, so matching a\n * node is a single `matches` call instead of one per selector.\n */\nfunction createNodeMatcher<T extends Node = Node>(\n filter?: MutationControllerFilter<T>\n): (node: T) => boolean {\n if (!filter) {\n return () => true;\n }\n\n if (!Array.isArray(filter)) {\n return filter;\n }\n\n const selector = filter.join(',');\n\n return selector\n ? (node) => isElement(node) && node.matches(selector)\n : () => false;\n}\n\nclass MutationController<T extends Node = Node> implements ReactiveController {\n private readonly _host: ReactiveControllerHost & Element;\n private readonly _target: Element;\n private readonly _config: MutationObserverInit;\n private readonly _callback: MutationControllerCallback<T>;\n private readonly _matches: (node: T) => boolean;\n\n private _observer?: MutationObserver;\n\n constructor(\n host: ReactiveControllerHost & Element,\n options: MutationControllerConfig<T>\n ) {\n this._host = host;\n this._callback = options.callback;\n this._config = options.config;\n this._target = options.target ?? this._host;\n this._matches = createNodeMatcher(options.filter);\n\n if (!isServer) {\n this._observer = new MutationObserver((records) => {\n this.disconnect();\n this._callback.call(this._host, this._process(records));\n this.observe();\n });\n }\n\n host.addController(this);\n }\n\n /** @internal */\n public hostConnected(): void {\n this.observe();\n }\n\n /** @internal */\n public hostDisconnected(): void {\n this.disconnect();\n }\n\n private _collect(\n nodes: NodeList,\n target: Element,\n into: MutationDOMChange<T>[]\n ): void {\n for (const node of nodes) {\n if (this._matches(node as T)) {\n into.push({ target, node: node as T });\n }\n }\n }\n\n private _process(records: MutationRecord[]): MutationControllerParams<T> {\n const changes: MutationChange<T> = {\n attributes: [],\n added: [],\n removed: [],\n };\n\n for (const record of records) {\n const { type, target, attributeName, addedNodes, removedNodes } = record;\n\n if (type === 'attributes') {\n if (this._matches(target as T)) {\n changes.attributes.push({ node: target as T, attributeName });\n }\n } else if (type === 'childList') {\n this._collect(addedNodes, target as Element, changes.added);\n this._collect(removedNodes, target as Element, changes.removed);\n }\n }\n\n return { records, changes, observer: this };\n }\n\n /**\n * Begin receiving notifications of changes to the DOM based\n * on the configured {@link MutationControllerConfig.target|target} and observer {@link MutationControllerConfig.config|options}.\n */\n public observe(): void {\n this._observer?.observe(this._target, this._config);\n }\n\n /** Stop watching for mutations. */\n public disconnect(): void {\n this._observer?.disconnect();\n }\n}\n\n/**\n * Creates and attaches a mutation controller with `config` to the passed in `host`.\n *\n * Automatically starts/stops observing for mutation changes\n * in the respective component connect/disconnect callbacks.\n *\n * The mutation observer is disconnected before invoking the passed in callback and re-attached\n * after that in order to not loop itself in endless stream of changes.\n */\nexport function createMutationController<T extends Node = Node>(\n host: ReactiveControllerHost & Element,\n config: MutationControllerConfig<T>\n): MutationController<T> {\n return new MutationController(host, config);\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { type ReactiveController, type ReactiveControllerHost } from 'lit';
|
|
|
2
2
|
type ResizeObserverControllerCallback = (...args: Parameters<ResizeObserverCallback>) => unknown;
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for initializing a resize controller.
|
|
5
|
-
* @
|
|
5
|
+
* @hidden
|
|
6
6
|
*/
|
|
7
7
|
export interface ResizeObserverControllerConfig {
|
|
8
8
|
/** The callback function to run when a resize mutation is triggered. */
|
|
@@ -16,6 +16,13 @@ export interface ResizeObserverControllerConfig {
|
|
|
16
16
|
* Pass in `null` to skip setting an initial target.
|
|
17
17
|
*/
|
|
18
18
|
target?: Element | null;
|
|
19
|
+
/**
|
|
20
|
+
* Whether observing a target should request an update on the host.
|
|
21
|
+
*
|
|
22
|
+
* Defaults to `true`. Set to `false` when the host already drives its own
|
|
23
|
+
* update cycle and an extra render per observed element is wasted work.
|
|
24
|
+
*/
|
|
25
|
+
requestUpdate?: boolean;
|
|
19
26
|
}
|
|
20
27
|
declare class ResizeObserverController implements ReactiveController {
|
|
21
28
|
private readonly _host;
|
|
@@ -23,8 +30,11 @@ declare class ResizeObserverController implements ReactiveController {
|
|
|
23
30
|
private readonly _observer;
|
|
24
31
|
private readonly _config;
|
|
25
32
|
constructor(host: ReactiveControllerHost & Element, config: ResizeObserverControllerConfig);
|
|
33
|
+
/** The elements currently being observed. */
|
|
34
|
+
get targets(): ReadonlySet<Element>;
|
|
26
35
|
/** Starts observing the `targe` element. */
|
|
27
36
|
observe(target: Element): void;
|
|
37
|
+
private _requestUpdate;
|
|
28
38
|
/** Stops observing the `target` element. */
|
|
29
39
|
unobserve(target: Element): void;
|
|
30
40
|
/** @internal */
|
|
@@ -13,10 +13,18 @@ class ResizeObserverController {
|
|
|
13
13
|
this._observer = new ResizeObserver((entries) => this._config.callback.call(this._host, entries, this._observer));
|
|
14
14
|
host.addController(this);
|
|
15
15
|
}
|
|
16
|
+
get targets() {
|
|
17
|
+
return this._targets;
|
|
18
|
+
}
|
|
16
19
|
observe(target) {
|
|
17
20
|
this._targets.add(target);
|
|
18
21
|
this._observer.observe(target, this._config.options);
|
|
19
|
-
this.
|
|
22
|
+
this._requestUpdate();
|
|
23
|
+
}
|
|
24
|
+
_requestUpdate() {
|
|
25
|
+
if (this._config.requestUpdate ?? true) {
|
|
26
|
+
this._host.requestUpdate();
|
|
27
|
+
}
|
|
20
28
|
}
|
|
21
29
|
unobserve(target) {
|
|
22
30
|
this._targets.delete(target);
|
|
@@ -24,7 +32,10 @@ class ResizeObserverController {
|
|
|
24
32
|
}
|
|
25
33
|
hostConnected() {
|
|
26
34
|
for (const target of this._targets) {
|
|
27
|
-
this.observe(target);
|
|
35
|
+
this._observer.observe(target, this._config.options);
|
|
36
|
+
}
|
|
37
|
+
if (this._targets.size > 0) {
|
|
38
|
+
this._requestUpdate();
|
|
28
39
|
}
|
|
29
40
|
}
|
|
30
41
|
hostDisconnected() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize-observer.js","sourceRoot":"","sources":["../../../src/internals/controllers/resize-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GAGT,MAAM,KAAK,CAAC;AA+Bb,MAAM,wBAAwB;IAM5B,YACE,IAAsC,EACtC,MAAsC;QANvB,aAAQ,GAAG,IAAI,GAAG,EAAW,CAAC;QAQ7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC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,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IAGM,gBAAgB;QACrB,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IAC9B,CAAC;CACF;AAMD,MAAM,UAAU,8BAA8B,CAC5C,IAAsC,EACtC,MAAsC;IAEtC,OAAO,IAAI,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import {\n isServer,\n type ReactiveController,\n type ReactiveControllerHost,\n} from 'lit';\n\ntype ResizeObserverControllerCallback = (\n ...args: Parameters<ResizeObserverCallback>\n) => unknown;\n\n/**\n * Configuration for initializing a resize controller.\n * @hidden\n */\nexport interface ResizeObserverControllerConfig {\n /** The callback function to run when a resize mutation is triggered. */\n callback: ResizeObserverControllerCallback;\n /** Configuration options passed to the underlying ResizeObserver. */\n options?: ResizeObserverOptions;\n /**\n * The initial target element to observe for resize mutations.\n *\n * If not provided, the host element will be set as initial target.\n * Pass in `null` to skip setting an initial target.\n */\n target?: Element | null;\n /**\n * Whether observing a target should request an update on the host.\n *\n * Defaults to `true`. Set to `false` when the host already drives its own\n * update cycle and an extra render per observed element is wasted work.\n */\n requestUpdate?: boolean;\n}\n\nclass ResizeObserverController implements ReactiveController {\n private readonly _host: ReactiveControllerHost & Element;\n private readonly _targets = new Set<Element>();\n private readonly _observer!: ResizeObserver;\n private readonly _config: ResizeObserverControllerConfig;\n\n constructor(\n host: ReactiveControllerHost & Element,\n config: ResizeObserverControllerConfig\n ) {\n this._host = host;\n this._config = config;\n\n if (this._config.target !== null) {\n this._targets.add(this._config.target ?? host);\n }\n\n /* c8 ignore next 3 */\n if (isServer) {\n return;\n }\n\n this._observer = new ResizeObserver((entries) =>\n this._config.callback.call(this._host, entries, this._observer)\n );\n\n host.addController(this);\n }\n\n /** The elements currently being observed. */\n public get targets(): ReadonlySet<Element> {\n return this._targets;\n }\n\n /** Starts observing the `targe` element. */\n public observe(target: Element): void {\n this._targets.add(target);\n this._observer.observe(target, this._config.options);\n this._requestUpdate();\n }\n\n private _requestUpdate(): void {\n if (this._config.requestUpdate ?? true) {\n this._host.requestUpdate();\n }\n }\n\n /** Stops observing the `target` element. */\n public unobserve(target: Element): void {\n this._targets.delete(target);\n this._observer.unobserve(target);\n }\n\n /** @internal */\n public hostConnected(): void {\n for (const target of this._targets) {\n this._observer.observe(target, this._config.options);\n }\n\n if (this._targets.size > 0) {\n this._requestUpdate();\n }\n }\n\n /** @internal */\n public hostDisconnected(): void {\n this._observer.disconnect();\n }\n}\n\n/**\n * Creates a new resize controller bound to the given `host`\n * with {@link ResizeObserverControllerConfig | `config`}.\n */\nexport function createResizeObserverController(\n host: ReactiveControllerHost & Element,\n config: ResizeObserverControllerConfig\n): ResizeObserverController {\n return new ResizeObserverController(host, config);\n}\n"]}
|