igniteui-webcomponents 7.3.1 → 7.4.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 +72 -1
- package/animations/easings.d.ts +21 -31
- package/animations/easings.js +21 -34
- package/animations/easings.js.map +1 -1
- package/animations/player.d.ts +8 -16
- package/animations/player.js +5 -8
- package/animations/player.js.map +1 -1
- package/animations/view-transition.d.ts +10 -10
- package/animations/view-transition.js +26 -37
- package/animations/view-transition.js.map +1 -1
- package/components/avatar/themes/avatar.base.css.js +1 -1
- package/components/avatar/themes/avatar.base.css.js.map +1 -1
- package/components/badge/themes/badge.base.css.js +1 -1
- package/components/badge/themes/badge.base.css.js.map +1 -1
- package/components/banner/themes/banner.base.css.js +1 -1
- package/components/banner/themes/banner.base.css.js.map +1 -1
- package/components/banner/themes/shared/banner.indigo.css.js +1 -1
- package/components/banner/themes/shared/banner.indigo.css.js.map +1 -1
- package/components/breadcrumb/breadcrumb.d.ts +74 -0
- package/components/breadcrumb/breadcrumb.js +107 -0
- package/components/breadcrumb/breadcrumb.js.map +1 -0
- package/components/breadcrumb/breadcrumbs.d.ts +60 -0
- package/components/breadcrumb/breadcrumbs.js +50 -0
- package/components/breadcrumb/breadcrumbs.js.map +1 -0
- package/components/breadcrumb/themes/breadcrumb.base.css.d.ts +1 -0
- package/components/breadcrumb/themes/breadcrumb.base.css.js +3 -0
- package/components/breadcrumb/themes/breadcrumb.base.css.js.map +1 -0
- package/components/breadcrumb/themes/breadcrumbs.base.css.d.ts +1 -0
- package/components/breadcrumb/themes/breadcrumbs.base.css.js +3 -0
- package/components/breadcrumb/themes/breadcrumbs.base.css.js.map +1 -0
- package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.d.ts +1 -0
- package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.js +3 -0
- package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.js.map +1 -0
- package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.d.ts +1 -0
- package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.js +3 -0
- package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.js.map +1 -0
- package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.d.ts +1 -0
- package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.js +3 -0
- package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.js.map +1 -0
- package/components/breadcrumb/themes/dark/breadcrumb.material.css.d.ts +1 -0
- package/components/breadcrumb/themes/dark/breadcrumb.material.css.js +3 -0
- package/components/breadcrumb/themes/dark/breadcrumb.material.css.js.map +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.d.ts +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.js +3 -0
- package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.js.map +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.fluent.css.d.ts +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.fluent.css.js +3 -0
- package/components/breadcrumb/themes/light/breadcrumb.fluent.css.js.map +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.indigo.css.d.ts +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.indigo.css.js +3 -0
- package/components/breadcrumb/themes/light/breadcrumb.indigo.css.js.map +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.material.css.d.ts +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.material.css.js +3 -0
- package/components/breadcrumb/themes/light/breadcrumb.material.css.js.map +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.shared.css.d.ts +1 -0
- package/components/breadcrumb/themes/light/breadcrumb.shared.css.js +3 -0
- package/components/breadcrumb/themes/light/breadcrumb.shared.css.js.map +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.d.ts +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.js +3 -0
- package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.js.map +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.common.css.d.ts +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.common.css.js +3 -0
- package/components/breadcrumb/themes/shared/breadcrumb.common.css.js.map +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.d.ts +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.js +3 -0
- package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.js.map +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.d.ts +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.js +3 -0
- package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.js.map +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.material.css.d.ts +1 -0
- package/components/breadcrumb/themes/shared/breadcrumb.material.css.js +3 -0
- package/components/breadcrumb/themes/shared/breadcrumb.material.css.js.map +1 -0
- package/components/breadcrumb/themes/themes.d.ts +2 -0
- package/components/breadcrumb/themes/themes.js +50 -0
- package/components/breadcrumb/themes/themes.js.map +1 -0
- package/components/button/button.d.ts +0 -2
- package/components/button/button.js.map +1 -1
- package/components/button-group/button-group.d.ts +42 -12
- package/components/button-group/button-group.js +82 -34
- package/components/button-group/button-group.js.map +1 -1
- package/components/button-group/toggle-button.d.ts +6 -1
- package/components/button-group/toggle-button.js +28 -2
- package/components/button-group/toggle-button.js.map +1 -1
- package/components/calendar/base.d.ts +7 -2
- package/components/calendar/base.js +10 -4
- package/components/calendar/base.js.map +1 -1
- package/components/calendar/calendar.d.ts +6 -3
- package/components/calendar/calendar.js +41 -14
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/days-view/days-view.d.ts +5 -8
- package/components/calendar/days-view/days-view.js +7 -16
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/calendar/helpers.d.ts +13 -0
- package/components/calendar/helpers.js +15 -0
- package/components/calendar/helpers.js.map +1 -1
- package/components/calendar/themes/calendar.base.css.js +1 -1
- package/components/calendar/themes/calendar.base.css.js.map +1 -1
- package/components/calendar/themes/days-view.base.css.js +1 -1
- package/components/calendar/themes/days-view.base.css.js.map +1 -1
- package/components/calendar/themes/shared/bootstrap/calendar.bootstrap.css.js +1 -1
- package/components/calendar/themes/shared/bootstrap/calendar.bootstrap.css.js.map +1 -1
- package/components/calendar/themes/shared/bootstrap/days-view.bootstrap.css.js +1 -1
- package/components/calendar/themes/shared/bootstrap/days-view.bootstrap.css.js.map +1 -1
- package/components/calendar/themes/shared/fluent/days-view.fluent.css.js +1 -1
- package/components/calendar/themes/shared/fluent/days-view.fluent.css.js.map +1 -1
- package/components/calendar/themes/shared/indigo/calendar.indigo.css.js +1 -1
- package/components/calendar/themes/shared/indigo/calendar.indigo.css.js.map +1 -1
- package/components/calendar/themes/shared/indigo/days-view.indigo.css.js +1 -1
- package/components/calendar/themes/shared/indigo/days-view.indigo.css.js.map +1 -1
- package/components/calendar/themes/shared/material/days-view.material.css.js +1 -1
- package/components/calendar/themes/shared/material/days-view.material.css.js.map +1 -1
- package/components/calendar/themes/year-month-view.base.css.js +1 -1
- package/components/calendar/themes/year-month-view.base.css.js.map +1 -1
- package/components/card/themes/container.base.css.js +1 -1
- package/components/card/themes/container.base.css.js.map +1 -1
- package/components/carousel/carousel-indicator.js +1 -0
- package/components/carousel/carousel-indicator.js.map +1 -1
- package/components/carousel/carousel-slide.d.ts +1 -1
- package/components/carousel/carousel-slide.js.map +1 -1
- package/components/carousel/carousel.d.ts +3 -3
- package/components/carousel/carousel.js.map +1 -1
- package/components/carousel/themes/carousel.base.css.js +1 -1
- package/components/carousel/themes/carousel.base.css.js.map +1 -1
- package/components/carousel/themes/shared/carousel.indigo.css.js +1 -1
- package/components/carousel/themes/shared/carousel.indigo.css.js.map +1 -1
- package/components/chat/chat-input.d.ts +1 -2
- package/components/chat/chat-input.js +1 -1
- package/components/chat/chat-input.js.map +1 -1
- package/components/chat/chat-state.d.ts +8 -9
- package/components/chat/chat-state.js.map +1 -1
- package/components/chat/chat.d.ts +1 -3
- package/components/chat/chat.js +2 -2
- package/components/chat/chat.js.map +1 -1
- package/components/chat/message-attachments.d.ts +6 -15
- package/components/chat/message-attachments.js.map +1 -1
- package/components/chat/themes/chat.base.css.js +1 -1
- package/components/chat/themes/chat.base.css.js.map +1 -1
- package/components/chat/themes/message.base.css.js +1 -1
- package/components/chat/themes/message.base.css.js.map +1 -1
- package/components/chat/utils.d.ts +0 -1
- package/components/chat/utils.js +1 -1
- package/components/chat/utils.js.map +1 -1
- package/components/checkbox/checkbox-base.d.ts +1 -1
- package/components/checkbox/checkbox.js +1 -1
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/checkbox/themes/checkbox.base.css.js +1 -1
- package/components/checkbox/themes/checkbox.base.css.js.map +1 -1
- package/components/checkbox/themes/shared/checkbox/checkbox.bootstrap.css.js +1 -1
- package/components/checkbox/themes/shared/checkbox/checkbox.bootstrap.css.js.map +1 -1
- package/components/checkbox/themes/shared/checkbox/checkbox.fluent.css.js +1 -1
- package/components/checkbox/themes/shared/checkbox/checkbox.fluent.css.js.map +1 -1
- package/components/checkbox/themes/shared/switch/switch.bootstrap.css.js +1 -1
- package/components/checkbox/themes/shared/switch/switch.bootstrap.css.js.map +1 -1
- package/components/checkbox/themes/shared/switch/switch.fluent.css.js +1 -1
- package/components/checkbox/themes/shared/switch/switch.fluent.css.js.map +1 -1
- package/components/checkbox/themes/shared/switch/switch.indigo.css.js +1 -1
- package/components/checkbox/themes/shared/switch/switch.indigo.css.js.map +1 -1
- package/components/checkbox/themes/shared/switch/switch.material.css.js +1 -1
- package/components/checkbox/themes/shared/switch/switch.material.css.js.map +1 -1
- package/components/checkbox/themes/switch.base.css.js +1 -1
- package/components/checkbox/themes/switch.base.css.js.map +1 -1
- package/components/chip/chip.d.ts +2 -2
- package/components/chip/chip.js.map +1 -1
- package/components/color-picker/color-picker.d.ts +35 -34
- package/components/color-picker/color-picker.js +9 -4
- package/components/color-picker/color-picker.js.map +1 -1
- package/components/color-picker/common.d.ts +0 -2
- package/components/color-picker/common.js +2 -2
- package/components/color-picker/common.js.map +1 -1
- package/components/color-picker/converters.js.map +1 -1
- package/components/color-picker/picker-canvas.js.map +1 -1
- package/components/color-picker/themes/color-picker.base.css.js +1 -1
- package/components/color-picker/themes/color-picker.base.css.js.map +1 -1
- package/components/combo/combo.d.ts +18 -20
- package/components/combo/combo.js +8 -2
- package/components/combo/combo.js.map +1 -1
- package/components/combo/controllers/data.d.ts +7 -10
- package/components/combo/controllers/data.js.map +1 -1
- package/components/combo/themes/combo-item.base.css.js +1 -1
- package/components/combo/themes/combo-item.base.css.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/shared/combo.bootstrap.css.js +1 -1
- package/components/combo/themes/shared/combo.bootstrap.css.js.map +1 -1
- package/components/date-picker/date-picker.base.d.ts +33 -29
- package/components/date-picker/date-picker.base.js +15 -4
- package/components/date-picker/date-picker.base.js.map +1 -1
- package/components/date-picker/date-picker.d.ts +1 -1
- package/components/date-picker/date-picker.js +5 -3
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/date-picker/themes/date-picker.base.css.js +1 -1
- package/components/date-picker/themes/date-picker.base.css.js.map +1 -1
- package/components/date-range-picker/date-range-input.d.ts +0 -2
- package/components/date-range-picker/date-range-input.js +0 -6
- package/components/date-range-picker/date-range-input.js.map +1 -1
- package/components/date-range-picker/date-range-picker.base.css.js +1 -1
- package/components/date-range-picker/date-range-picker.base.css.js.map +1 -1
- package/components/date-range-picker/date-range-picker.d.ts +22 -31
- package/components/date-range-picker/date-range-picker.js +7 -7
- package/components/date-range-picker/date-range-picker.js.map +1 -1
- package/components/date-range-picker/i18n.d.ts +21 -0
- package/components/date-range-picker/i18n.js +10 -0
- package/components/date-range-picker/i18n.js.map +1 -0
- package/components/date-range-picker/predefined-ranges-area.base.css.js +1 -1
- package/components/date-range-picker/predefined-ranges-area.base.css.js.map +1 -1
- package/components/date-range-picker/predefined-ranges-area.d.ts +3 -3
- package/components/date-range-picker/predefined-ranges-area.js +2 -5
- package/components/date-range-picker/predefined-ranges-area.js.map +1 -1
- package/components/date-range-picker/validators.d.ts +0 -4
- package/components/date-range-picker/validators.js +4 -4
- package/components/date-range-picker/validators.js.map +1 -1
- package/components/date-time-input/date-time-input.base.d.ts +39 -37
- package/components/date-time-input/date-time-input.base.js +6 -0
- package/components/date-time-input/date-time-input.base.js.map +1 -1
- package/components/date-time-input/date-time-input.d.ts +1 -11
- package/components/date-time-input/date-time-input.js +0 -6
- package/components/date-time-input/date-time-input.js.map +1 -1
- package/components/date-time-input/datetime-mask-parser.d.ts +0 -10
- package/components/date-time-input/datetime-mask-parser.js +1 -1
- package/components/date-time-input/datetime-mask-parser.js.map +1 -1
- package/components/dialog/dialog.js.map +1 -1
- package/components/divider/themes/divider.base.css.js +1 -1
- package/components/divider/themes/divider.base.css.js.map +1 -1
- package/components/dropdown/dropdown-group.d.ts +2 -10
- package/components/dropdown/dropdown-group.js +2 -27
- package/components/dropdown/dropdown-group.js.map +1 -1
- package/components/dropdown/dropdown.d.ts +17 -23
- package/components/dropdown/dropdown.js +5 -17
- package/components/dropdown/dropdown.js.map +1 -1
- package/components/dropdown/themes/dropdown-item.base.css.js +1 -1
- package/components/dropdown/themes/dropdown-item.base.css.js.map +1 -1
- package/components/dropdown/themes/dropdown.base.css.js +1 -1
- package/components/dropdown/themes/dropdown.base.css.js.map +1 -1
- package/components/file-input/file-input.d.ts +2 -2
- package/components/file-input/file-input.js.map +1 -1
- package/components/file-input/themes/file-input.base.css.js +1 -1
- package/components/file-input/themes/file-input.base.css.js.map +1 -1
- package/components/file-input/themes/shared/file-input.bootstrap.css.js +1 -1
- package/components/file-input/themes/shared/file-input.bootstrap.css.js.map +1 -1
- package/components/icon/icon.d.ts +1 -1
- package/components/icon/icon.registry.d.ts +6 -6
- package/components/icon/icon.registry.js.map +1 -1
- package/components/input/input.d.ts +3 -3
- package/components/input/input.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/list/themes/item.base.css.js +1 -1
- package/components/list/themes/item.base.css.js.map +1 -1
- package/components/mask-input/mask-history.d.ts +22 -18
- package/components/mask-input/mask-history.js.map +1 -1
- package/components/mask-input/mask-input.d.ts +1 -1
- package/components/mask-input/mask-parser.d.ts +11 -13
- package/components/mask-input/mask-parser.js.map +1 -1
- package/components/nav-drawer/themes/item.base.css.js +1 -1
- package/components/nav-drawer/themes/item.base.css.js.map +1 -1
- package/components/popover/popover.d.ts +45 -34
- package/components/popover/popover.js +54 -122
- package/components/popover/popover.js.map +1 -1
- package/components/popover/position/arrow.d.ts +19 -0
- package/components/popover/position/arrow.js +33 -0
- package/components/popover/position/arrow.js.map +1 -0
- package/components/popover/position/floating.d.ts +40 -0
- package/components/popover/position/floating.js +146 -0
- package/components/popover/position/floating.js.map +1 -0
- package/components/popover/position/native.d.ts +45 -0
- package/components/popover/position/native.js +158 -0
- package/components/popover/position/native.js.map +1 -0
- package/components/popover/position/strategy.d.ts +37 -0
- package/components/popover/position/strategy.js +21 -0
- package/components/popover/position/strategy.js.map +1 -0
- package/components/popover/position/types.d.ts +26 -0
- package/components/popover/position/types.js +15 -0
- package/components/popover/position/types.js.map +1 -0
- package/components/popover/themes/light/popover.base.css.js +1 -1
- package/components/popover/themes/light/popover.base.css.js.map +1 -1
- package/components/progress/circular-progress.d.ts +0 -5
- package/components/progress/circular-progress.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/shared/linear.progress.bootstrap.css.d.ts +1 -0
- package/components/progress/themes/linear/shared/linear.progress.bootstrap.css.js +3 -0
- package/components/progress/themes/linear/shared/linear.progress.bootstrap.css.js.map +1 -0
- package/components/progress/themes/linear/themes.js +3 -2
- package/components/progress/themes/linear/themes.js.map +1 -1
- package/components/qr-code/qr-code.d.ts +29 -2
- package/components/qr-code/qr-code.js +56 -13
- package/components/qr-code/qr-code.js.map +1 -1
- package/components/qr-code/renderer/export.d.ts +28 -0
- package/components/qr-code/renderer/export.js +120 -0
- package/components/qr-code/renderer/export.js.map +1 -0
- package/components/qr-code/types.d.ts +26 -0
- package/components/qr-code/types.js.map +1 -1
- package/components/radio/radio.d.ts +4 -4
- package/components/radio/radio.js +17 -14
- package/components/radio/radio.js.map +1 -1
- package/components/radio/themes/radio.base.css.js +1 -1
- package/components/radio/themes/radio.base.css.js.map +1 -1
- package/components/radio/themes/shared/radio.bootstrap.css.js +1 -1
- package/components/radio/themes/shared/radio.bootstrap.css.js.map +1 -1
- package/components/radio/themes/shared/radio.indigo.css.js +1 -1
- package/components/radio/themes/shared/radio.indigo.css.js.map +1 -1
- package/components/radio-group/radio-group.js.map +1 -1
- package/components/rating/rating.d.ts +6 -6
- package/components/rating/rating.js.map +1 -1
- package/components/select/select-group.d.ts +5 -10
- package/components/select/select-group.js +10 -34
- package/components/select/select-group.js.map +1 -1
- package/components/select/select.d.ts +12 -20
- package/components/select/select.js +4 -14
- 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/shared/select.bootstrap.css.js +1 -1
- package/components/select/themes/shared/select.bootstrap.css.js.map +1 -1
- package/components/slider/themes/shared/slider.material.css.js +1 -1
- package/components/slider/themes/shared/slider.material.css.js.map +1 -1
- package/components/slider/themes/slider.base.css.js +1 -1
- package/components/slider/themes/slider.base.css.js.map +1 -1
- package/components/snackbar/themes/snackbar.base.css.js +1 -1
- package/components/snackbar/themes/snackbar.base.css.js.map +1 -1
- package/components/splitter/splitter.d.ts +6 -6
- package/components/splitter/splitter.js.map +1 -1
- package/components/splitter/themes/splitter.base.css.js +1 -1
- package/components/splitter/themes/splitter.base.css.js.map +1 -1
- package/components/stepper/themes/step/step.base.css.js +1 -1
- package/components/stepper/themes/step/step.base.css.js.map +1 -1
- package/components/tabs/themes/shared/tab/tab.bootstrap.css.js +1 -1
- package/components/tabs/themes/shared/tab/tab.bootstrap.css.js.map +1 -1
- package/components/tabs/themes/shared/tab/tab.fluent.css.js +1 -1
- package/components/tabs/themes/shared/tab/tab.fluent.css.js.map +1 -1
- package/components/tabs/themes/shared/tab/tab.indigo.css.js +1 -1
- package/components/tabs/themes/shared/tab/tab.indigo.css.js.map +1 -1
- package/components/tabs/themes/shared/tab/tab.material.css.js +1 -1
- package/components/tabs/themes/shared/tab/tab.material.css.js.map +1 -1
- package/components/tabs/themes/shared/tabs/tabs.fluent.css.js +1 -1
- package/components/tabs/themes/shared/tabs/tabs.fluent.css.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/shared/tabs/tabs.material.css.js +1 -1
- package/components/tabs/themes/shared/tabs/tabs.material.css.js.map +1 -1
- package/components/tabs/themes/tab.base.css.js +1 -1
- package/components/tabs/themes/tab.base.css.js.map +1 -1
- package/components/textarea/textarea.d.ts +1 -1
- package/components/textarea/textarea.js.map +1 -1
- package/components/textarea/themes/shared/textarea.bootstrap.css.js +1 -1
- package/components/textarea/themes/shared/textarea.bootstrap.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.common.css.js +1 -1
- package/components/textarea/themes/shared/textarea.common.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.fluent.css.js +1 -1
- package/components/textarea/themes/shared/textarea.fluent.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.indigo.css.js +1 -1
- package/components/textarea/themes/shared/textarea.indigo.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.material.css.js +1 -1
- package/components/textarea/themes/shared/textarea.material.css.js.map +1 -1
- package/components/tile-manager/themes/tile.base.css.js +1 -1
- package/components/tile-manager/themes/tile.base.css.js.map +1 -1
- package/components/tile-manager/tile-manager.d.ts +6 -7
- package/components/tile-manager/tile-manager.js.map +1 -1
- package/components/tile-manager/tile.d.ts +3 -3
- package/components/tile-manager/tile.js.map +1 -1
- package/components/toast/themes/toast.base.css.js +1 -1
- package/components/toast/themes/toast.base.css.js.map +1 -1
- package/components/toast/toast.d.ts +0 -2
- package/components/toast/toast.js.map +1 -1
- package/components/tooltip/controller.js.map +1 -1
- package/components/tooltip/service.js +4 -5
- package/components/tooltip/service.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 +34 -13
- package/components/tooltip/tooltip.js +8 -4
- package/components/tooltip/tooltip.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/tree-item.d.ts +6 -6
- package/components/tree/tree-item.js.map +1 -1
- package/components/tree/tree.navigation.d.ts +5 -6
- package/components/tree/tree.navigation.js.map +1 -1
- package/components/tree/tree.selection.js.map +1 -1
- package/components/types.d.ts +1 -1
- package/components/types.js.map +1 -1
- package/components/validation-container/themes/validator.base.css.js +1 -1
- package/components/validation-container/themes/validator.base.css.js.map +1 -1
- package/components/validation-container/validation-container.d.ts +10 -12
- package/components/validation-container/validation-container.js +14 -17
- package/components/validation-container/validation-container.js.map +1 -1
- package/components/virtualization/engine.d.ts +5 -5
- package/components/virtualization/engine.js.map +1 -1
- package/components/virtualization/virtualization.d.ts +61 -63
- package/components/virtualization/virtualization.js +6 -5
- package/components/virtualization/virtualization.js.map +1 -1
- package/custom-elements.json +16769 -19698
- package/igniteui-webcomponents.css-data.json +2 -2
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +3 -1
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/internals/abort-handler.d.ts +13 -25
- package/internals/abort-handler.js +4 -6
- package/internals/abort-handler.js.map +1 -1
- package/internals/context.d.ts +13 -7
- package/internals/context.js +2 -1
- package/internals/context.js.map +1 -1
- package/internals/controllers/adopt-styles.d.ts +19 -20
- package/internals/controllers/adopt-styles.js +3 -8
- package/internals/controllers/adopt-styles.js.map +1 -1
- package/internals/controllers/aria-projection.d.ts +56 -55
- package/internals/controllers/aria-projection.js +14 -15
- package/internals/controllers/aria-projection.js.map +1 -1
- package/internals/controllers/async-consumer.js.map +1 -1
- package/internals/controllers/command.d.ts +15 -30
- package/internals/controllers/command.js +2 -7
- package/internals/controllers/command.js.map +1 -1
- package/internals/controllers/context-provider.d.ts +7 -13
- package/internals/controllers/context-provider.js.map +1 -1
- package/internals/controllers/focus-ring.d.ts +10 -30
- package/internals/controllers/focus-ring.js +6 -12
- package/internals/controllers/focus-ring.js.map +1 -1
- package/internals/controllers/fullscreen.d.ts +7 -23
- package/internals/controllers/fullscreen.js +3 -9
- package/internals/controllers/fullscreen.js.map +1 -1
- package/internals/controllers/gestures.d.ts +10 -29
- package/internals/controllers/gestures.js +1 -3
- package/internals/controllers/gestures.js.map +1 -1
- package/internals/controllers/group.d.ts +13 -30
- package/internals/controllers/group.js.map +1 -1
- package/internals/controllers/host-listeners.d.ts +28 -0
- package/internals/controllers/host-listeners.js +27 -0
- package/internals/controllers/host-listeners.js.map +1 -0
- package/internals/controllers/id-resolver.d.ts +8 -9
- package/internals/controllers/id-resolver.js +6 -14
- package/internals/controllers/id-resolver.js.map +1 -1
- package/internals/controllers/internals.d.ts +53 -104
- package/internals/controllers/internals.js +40 -13
- package/internals/controllers/internals.js.map +1 -1
- package/internals/controllers/key-bindings.d.ts +61 -158
- package/internals/controllers/key-bindings.js +68 -67
- package/internals/controllers/key-bindings.js.map +1 -1
- package/internals/controllers/keys.d.ts +32 -0
- package/internals/controllers/keys.js +20 -0
- package/internals/controllers/keys.js.map +1 -0
- package/internals/controllers/mutation-observer.d.ts +14 -37
- package/internals/controllers/mutation-observer.js +1 -1
- package/internals/controllers/mutation-observer.js.map +1 -1
- package/internals/controllers/resize-observer.d.ts +9 -19
- package/internals/controllers/resize-observer.js.map +1 -1
- package/internals/controllers/root-click.d.ts +11 -42
- package/internals/controllers/root-click.js +4 -6
- package/internals/controllers/root-click.js.map +1 -1
- package/internals/controllers/roving-focus.d.ts +16 -35
- package/internals/controllers/roving-focus.js.map +1 -1
- package/internals/controllers/slot.d.ts +25 -54
- package/internals/controllers/slot.js +6 -6
- package/internals/controllers/slot.js.map +1 -1
- package/internals/controllers/toggle.d.ts +44 -48
- package/internals/controllers/toggle.js.map +1 -1
- package/internals/date/compare.js.map +1 -1
- package/internals/date/converters.d.ts +10 -7
- package/internals/date/converters.js.map +1 -1
- package/internals/date/model.d.ts +9 -16
- package/internals/date/model.js +22 -25
- package/internals/date/model.js.map +1 -1
- package/internals/decorators/blazorAdditionalDependencies.d.ts +4 -2
- package/internals/decorators/blazorAdditionalDependencies.js.map +1 -1
- package/internals/decorators/blazorDeepImport.d.ts +1 -3
- package/internals/decorators/blazorDeepImport.js.map +1 -1
- package/internals/decorators/blazorInclude.d.ts +3 -2
- package/internals/decorators/blazorInclude.js.map +1 -1
- package/internals/decorators/blazorIndirectRender.d.ts +1 -3
- package/internals/decorators/blazorIndirectRender.js.map +1 -1
- package/internals/decorators/blazorSuppressComponent.d.ts +1 -3
- package/internals/decorators/blazorSuppressComponent.js.map +1 -1
- package/internals/decorators/coerced-property.d.ts +14 -20
- package/internals/decorators/coerced-property.js.map +1 -1
- package/internals/decorators/shadow-options.d.ts +2 -5
- package/internals/decorators/shadow-options.js.map +1 -1
- package/internals/definitions/defineAllComponents.js +6 -0
- package/internals/definitions/defineAllComponents.js.map +1 -1
- package/internals/directives/drag.d.ts +51 -81
- package/internals/directives/drag.js +27 -89
- package/internals/directives/drag.js.map +1 -1
- package/internals/directives/pointer-operation.d.ts +75 -0
- package/internals/directives/pointer-operation.js +92 -0
- package/internals/directives/pointer-operation.js.map +1 -0
- package/internals/directives/resize.d.ts +36 -64
- package/internals/directives/resize.js +18 -85
- package/internals/directives/resize.js.map +1 -1
- package/internals/i18n/EN/calendar.resources.d.ts +8 -2
- package/internals/i18n/EN/calendar.resources.js +2 -2
- package/internals/i18n/EN/calendar.resources.js.map +1 -1
- package/internals/i18n/EN/chat.resources.d.ts +8 -2
- package/internals/i18n/EN/chat.resources.js +3 -10
- package/internals/i18n/EN/chat.resources.js.map +1 -1
- package/internals/i18n/EN/date-picker.resources.d.ts +6 -4
- package/internals/i18n/EN/date-picker.resources.js +1 -7
- package/internals/i18n/EN/date-picker.resources.js.map +1 -1
- package/internals/i18n/EN/date-range-picker.resources.d.ts +9 -2
- package/internals/i18n/EN/date-range-picker.resources.js +2 -2
- package/internals/i18n/EN/date-range-picker.resources.js.map +1 -1
- package/internals/i18n/i18n-controller.d.ts +44 -46
- package/internals/i18n/i18n-controller.js +46 -33
- package/internals/i18n/i18n-controller.js.map +1 -1
- package/internals/i18n/utils.d.ts +9 -4
- package/internals/i18n/utils.js +4 -27
- package/internals/i18n/utils.js.map +1 -1
- package/internals/mixins/alert.d.ts +10 -25
- package/internals/mixins/alert.js.map +1 -1
- package/internals/mixins/combo-box.d.ts +21 -11
- package/internals/mixins/combo-box.js +16 -22
- package/internals/mixins/combo-box.js.map +1 -1
- package/internals/mixins/event-emitter.js +9 -11
- package/internals/mixins/event-emitter.js.map +1 -1
- package/internals/mixins/forms/associated-required.d.ts +4 -4
- package/internals/mixins/forms/associated-required.js.map +1 -1
- package/internals/mixins/forms/associated.d.ts +4 -2
- package/internals/mixins/forms/associated.js +8 -19
- package/internals/mixins/forms/associated.js.map +1 -1
- package/internals/mixins/forms/form-transformers.js.map +1 -1
- package/internals/mixins/forms/types.d.ts +24 -80
- package/internals/mixins/forms/types.js.map +1 -1
- package/internals/mixins/group.d.ts +18 -0
- package/internals/mixins/group.js +37 -0
- package/internals/mixins/group.js.map +1 -0
- package/internals/mixins/i18n.d.ts +10 -16
- package/internals/mixins/i18n.js.map +1 -1
- package/internals/mixins/mask-behavior.d.ts +8 -22
- package/internals/mixins/mask-behavior.js +1 -2
- package/internals/mixins/mask-behavior.js.map +1 -1
- package/internals/mixins/option.d.ts +1 -2
- package/internals/mixins/option.js +2 -1
- package/internals/mixins/option.js.map +1 -1
- package/internals/part-map.d.ts +4 -2
- package/internals/part-map.js +1 -1
- package/internals/part-map.js.map +1 -1
- package/internals/templates/input-shell.d.ts +8 -17
- package/internals/templates/input-shell.js +4 -1
- package/internals/templates/input-shell.js.map +1 -1
- package/internals/templates/masked-input.d.ts +7 -8
- package/internals/templates/masked-input.js.map +1 -1
- package/internals/templates/slotted-icon.d.ts +7 -12
- package/internals/templates/slotted-icon.js.map +1 -1
- package/internals/templates/toggle-shell.d.ts +6 -7
- package/internals/templates/toggle-shell.js.map +1 -1
- package/internals/timing.d.ts +5 -14
- package/internals/timing.js.map +1 -1
- package/internals/utils/arrays.d.ts +21 -21
- package/internals/utils/arrays.js +14 -0
- package/internals/utils/arrays.js.map +1 -1
- package/internals/utils/dom.d.ts +51 -39
- package/internals/utils/dom.js +1 -2
- package/internals/utils/dom.js.map +1 -1
- package/internals/utils/events.d.ts +29 -16
- package/internals/utils/events.js +9 -1
- package/internals/utils/events.js.map +1 -1
- package/internals/utils/lit.d.ts +5 -2
- package/internals/utils/lit.js.map +1 -1
- package/internals/utils/math.d.ts +8 -6
- package/internals/utils/math.js.map +1 -1
- package/internals/utils/objects.d.ts +3 -20
- package/internals/utils/objects.js +1 -39
- package/internals/utils/objects.js.map +1 -1
- package/internals/utils/strings.d.ts +9 -11
- package/internals/utils/strings.js.map +1 -1
- package/internals/utils/types.d.ts +16 -3
- package/internals/utils/types.js +3 -0
- package/internals/utils/types.js.map +1 -1
- package/internals/validators.d.ts +9 -8
- package/internals/validators.js +12 -6
- package/internals/validators.js.map +1 -1
- package/package.json +1 -1
- package/skills/README.md +3 -0
- package/skills/igniteui-wc-figma-to-app/SKILL.md +907 -0
- package/skills/igniteui-wc-figma-to-app/references/asset-extraction.md +363 -0
- package/skills/igniteui-wc-figma-to-app/references/design-token-bridge.md +407 -0
- package/skills/igniteui-wc-figma-to-app/references/figma-component-map.md +325 -0
- package/skills/igniteui-wc-figma-to-app/references/mcp-setup.md +409 -0
- package/skills/igniteui-wc-figma-to-app/references/validation-patterns.md +376 -0
- package/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +21 -0
- package/skills/igniteui-wc-integrate-with-framework/SKILL.md +4 -3
- package/skills/igniteui-wc-integrate-with-framework/references/vanilla-js.md +14 -0
- package/skills/igniteui-wc-migrate-grid-lite-to-premium/SKILL.md +12 -2
- package/theming/config.d.ts +14 -5
- package/theming/config.js +38 -18
- package/theming/config.js.map +1 -1
- package/theming/context.d.ts +1 -23
- package/theming/context.js.map +1 -1
- package/theming/theming-controller.d.ts +2 -32
- package/theming/theming-controller.js +15 -21
- package/theming/theming-controller.js.map +1 -1
- package/theming/theming-event.d.ts +0 -7
- package/theming/theming-event.js +0 -13
- package/theming/theming-event.js.map +1 -1
- package/theming/types.d.ts +1 -8
- package/theming/types.js.map +1 -1
- package/web-types.json +3 -3
- package/animations/presets/slide/index.d.ts +0 -3
- package/animations/presets/slide/index.js +0 -16
- package/animations/presets/slide/index.js.map +0 -1
- package/internals/controllers/root-scroll.d.ts +0 -31
- package/internals/controllers/root-scroll.js +0 -71
- package/internals/controllers/root-scroll.js.map +0 -1
- package/theming/utils.d.ts +0 -11
- package/theming/utils.js +0 -20
- package/theming/utils.js.map +0 -1
|
@@ -1,42 +1,33 @@
|
|
|
1
1
|
import { type LitElement, type ReactiveController, type ReactiveControllerHost } from 'lit';
|
|
2
2
|
type InferSlotNames<T> = T extends readonly (infer U)[] ? U : never;
|
|
3
|
-
/**
|
|
4
|
-
* Additional query options for the slot controller methods.
|
|
5
|
-
*/
|
|
6
3
|
type SlotQueryOptions = {
|
|
7
4
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* assigned elements are found, it returns the slot's fallback content.
|
|
5
|
+
* Whether the query also returns the content of the descendant slots.
|
|
6
|
+
* Defaults to `false`.
|
|
11
7
|
*
|
|
12
8
|
* @remarks
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
16
|
-
*
|
|
17
|
-
* Defaults to `false`.
|
|
9
|
+
* A flattened query also returns fallback content: a slot rendered as
|
|
10
|
+
* `<slot>${this.label}</slot>` reports `label` as assigned content,
|
|
11
|
+
* although the consumer projected nothing.
|
|
18
12
|
*/
|
|
19
13
|
flatten?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* CSS selector used to filter the elements returned.
|
|
22
|
-
*/
|
|
14
|
+
/** The CSS selector that filters the returned elements. */
|
|
23
15
|
selector?: string;
|
|
24
16
|
};
|
|
25
17
|
type SlotChangeCallback<T> = (parameters: SlotChangeCallbackParameters<T>) => void;
|
|
26
18
|
type SlotChangeCallbackParameters<T> = {
|
|
27
|
-
/** The slot
|
|
19
|
+
/** The name of the slot with the changed assigned nodes. */
|
|
28
20
|
slot: T;
|
|
29
|
-
/** `true` if the slot is the default slot. */
|
|
30
21
|
isDefault: boolean;
|
|
31
|
-
/**
|
|
22
|
+
/** Whether the callback runs for the first host update. */
|
|
32
23
|
isInitial: boolean;
|
|
33
24
|
};
|
|
34
25
|
type SlotControllerOptions<T> = {
|
|
35
|
-
/**
|
|
26
|
+
/** The slot names to observe. */
|
|
36
27
|
slots?: Iterable<T>;
|
|
37
|
-
/** Callback
|
|
28
|
+
/** Callback that runs when the assigned nodes of a slot change. */
|
|
38
29
|
onChange?: SlotChangeCallback<T>;
|
|
39
|
-
/**
|
|
30
|
+
/** Whether `onChange` also runs once, after the first host update. */
|
|
40
31
|
initial?: boolean;
|
|
41
32
|
};
|
|
42
33
|
declare const DefaultSlot = "[default]";
|
|
@@ -48,58 +39,38 @@ declare class SlotController<T> implements ReactiveController {
|
|
|
48
39
|
private _initialized;
|
|
49
40
|
constructor(host: ReactiveControllerHost & LitElement, options?: SlotControllerOptions<T>);
|
|
50
41
|
/**
|
|
51
|
-
*
|
|
52
|
-
* from a host's `render`. Only a still connected slot is served from the cache -
|
|
53
|
-
* one removed by a conditional template falls back to a fresh query.
|
|
42
|
+
* Finds the slot element with the given name.
|
|
54
43
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* The result is cached, because the accessors below run from `render`. The
|
|
46
|
+
* cache serves only a connected slot. A query before the host creates its
|
|
47
|
+
* render root reports no slot and raises no error.
|
|
58
48
|
*/
|
|
59
49
|
private _getSlot;
|
|
60
50
|
/**
|
|
61
|
-
* Returns
|
|
62
|
-
*
|
|
63
|
-
* If `flatten` is set to `true`, it returns a sequence of both the nodes assigned to the queried slot,
|
|
64
|
-
* as well as nodes assigned to any other slots that are descendants of this slot. If no
|
|
65
|
-
* assigned nodes are found, it returns the slot's fallback content.
|
|
51
|
+
* Returns the nodes assigned to `slot`. See
|
|
52
|
+
* {@link SlotQueryOptions.flatten}.
|
|
66
53
|
*/
|
|
67
54
|
getAssignedNodes(slot: T, flatten?: boolean): Node[];
|
|
68
|
-
/**
|
|
69
|
-
* Returns an array of the assigned elements for `slot` with additional `options`.
|
|
70
|
-
*
|
|
71
|
-
* See {@link SlotQueryOptions.flatten} and {@link SlotQueryOptions.selector} for more information.
|
|
72
|
-
*/
|
|
55
|
+
/** Returns the elements assigned to `slot`, as `options` selects them. */
|
|
73
56
|
getAssignedElements<U extends Element>(slot: T, options?: SlotQueryOptions): U[];
|
|
74
57
|
/**
|
|
75
|
-
* Returns the
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* Useful for deriving an accessible label from projected content.
|
|
79
|
-
* See {@link SlotQueryOptions.flatten} for the `flatten` semantics.
|
|
58
|
+
* Returns the text content assigned to `slot`, trimmed and with collapsed
|
|
59
|
+
* whitespace.
|
|
80
60
|
*/
|
|
81
61
|
getAssignedText(slot: T, flatten?: boolean): string;
|
|
82
62
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* If `flatten` is set to `true`, it returns a sequence of both the nodes assigned to the queried slot,
|
|
86
|
-
* as well as nodes assigned to any other slots that are descendants of this slot. If no
|
|
87
|
-
* assigned nodes are found, it returns the slot's fallback content - so a slot with
|
|
88
|
-
* fallback content always reports as having nodes. See {@link SlotQueryOptions.flatten}.
|
|
63
|
+
* Whether `slot` has assigned nodes. A flattened query counts fallback
|
|
64
|
+
* content, so a slot with fallback always reports nodes.
|
|
89
65
|
*/
|
|
90
66
|
hasAssignedNodes(slot: T, flatten?: boolean): boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Return whether `slot` has assigned elements accepting additional `options`.
|
|
93
|
-
*
|
|
94
|
-
* See {@link SlotQueryOptions.flatten} and {@link SlotQueryOptions.selector} for more information.
|
|
95
|
-
*/
|
|
67
|
+
/** Whether `slot` has assigned elements, as `options` selects them. */
|
|
96
68
|
hasAssignedElements(slot: T, options?: SlotQueryOptions): boolean;
|
|
97
69
|
/** @internal */
|
|
98
|
-
handleEvent(event: Event): void;
|
|
99
|
-
/** @internal */
|
|
100
70
|
hostConnected(): void;
|
|
101
71
|
/** @internal */
|
|
102
72
|
hostDisconnected(): void;
|
|
73
|
+
handleEvent(event: Event): void;
|
|
103
74
|
/** @internal */
|
|
104
75
|
hostUpdated(): void;
|
|
105
76
|
}
|
|
@@ -50,6 +50,12 @@ class SlotController {
|
|
|
50
50
|
hasAssignedElements(slot, options) {
|
|
51
51
|
return !isEmpty(this.getAssignedElements(slot, options));
|
|
52
52
|
}
|
|
53
|
+
hostConnected() {
|
|
54
|
+
this._host.renderRoot.addEventListener('slotchange', this);
|
|
55
|
+
}
|
|
56
|
+
hostDisconnected() {
|
|
57
|
+
this._host.renderRoot.removeEventListener('slotchange', this);
|
|
58
|
+
}
|
|
53
59
|
handleEvent(event) {
|
|
54
60
|
const slot = event.target;
|
|
55
61
|
const name = slot.name;
|
|
@@ -64,12 +70,6 @@ class SlotController {
|
|
|
64
70
|
this._host.requestUpdate();
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
|
-
hostConnected() {
|
|
68
|
-
this._host.renderRoot.addEventListener('slotchange', this);
|
|
69
|
-
}
|
|
70
|
-
hostDisconnected() {
|
|
71
|
-
this._host.renderRoot.removeEventListener('slotchange', this);
|
|
72
|
-
}
|
|
73
73
|
hostUpdated() {
|
|
74
74
|
if (!this._initialized && this._options.initial) {
|
|
75
75
|
this._initialized = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../src/internals/controllers/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GAIT,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAiDxD,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,MAAM,cAAc;IAOlB,YACE,IAAyC,EACzC,OAAkC;QALnB,eAAU,GAAG,IAAI,GAAG,EAAkC,CAAC;QAChE,iBAAY,GAAG,KAAK,CAAC;QAM3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAE/B,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,CAAC;IAWO,QAAQ,CAAC,QAAY;QAC3B,IAAI,QAAQ;YAAE,OAAO,IAAI,CAAC;QAE1B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAE7C,IAAI,MAAM,EAAE,WAAW,EAAE,CAAC;YACxB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,QAAQ,GACZ,QAAQ,KAAK,WAAW;YACtB,CAA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IAAI,EAAE,WAAgB;gBACtB,SAAS,EAAE,KAAK;gBAChB,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAED,SAAS,iBAAiB,CACxB,IAA4B,EAC5B,OAEC;IAED,OAAO,IAAI,cAAc,CAAC,IAA2C,EAAE;QACrE,GAAG,OAAO;QACV,KAAK,EAAE,OAAO,EAAE,KAAoC;KACrD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAoC,GAAG,KAAQ;IAC9D,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,CAAU,CAAC;AAC1C,CAAC;AAUD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import {\n isServer,\n type LitElement,\n type ReactiveController,\n type ReactiveControllerHost,\n} from 'lit';\nimport { isEmpty } from '../utils/arrays.js';\nimport { normalizedTextContent } from '../utils/dom.js';\n\ntype InferSlotNames<T> = T extends readonly (infer U)[] ? U : never;\n\n/**\n * Additional query options for the slot controller methods.\n */\ntype SlotQueryOptions = {\n /**\n * If set to `true`, it returns a sequence of both the elements assigned to the queried slot,\n * as well as elements assigned to any other slots that are descendants of this slot. If no\n * assigned elements are found, it returns the slot's fallback content.\n *\n * @remarks\n * Mind that fallback content when checking whether a consumer projected anything:\n * for a slot rendered as `<slot>${this.label}</slot>`, a flattened query reports\n * the rendered `label` as assigned content even though nothing was projected.\n *\n * Defaults to `false`.\n */\n flatten?: boolean;\n /**\n * CSS selector used to filter the elements returned.\n */\n selector?: string;\n};\n\ntype SlotChangeCallback<T> = (\n parameters: SlotChangeCallbackParameters<T>\n) => void;\n\ntype SlotChangeCallbackParameters<T> = {\n /** The slot name that has its assigned nodes changed. */\n slot: T;\n /** `true` if the slot is the default slot. */\n isDefault: boolean;\n /** `true` if the callback handler is called for the initial host update. */\n isInitial: boolean;\n};\n\ntype SlotControllerOptions<T> = {\n /** An iterable collection of slot names to observe. */\n slots?: Iterable<T>;\n /** Callback function which is invoked a slot's assigned nodes change. */\n onChange?: SlotChangeCallback<T>;\n /** If set to `true`, the `onChange` callback is invoked once after the host is updated for the first time. */\n initial?: boolean;\n};\n\nconst DefaultSlot = '[default]';\n\nclass SlotController<T> implements ReactiveController {\n private readonly _host: ReactiveControllerHost & LitElement;\n private readonly _options: SlotControllerOptions<T>;\n private readonly _slots?: Set<T>;\n private readonly _slotCache = new Map<T | undefined, HTMLSlotElement>();\n private _initialized = false;\n\n constructor(\n host: ReactiveControllerHost & LitElement,\n options?: SlotControllerOptions<T>\n ) {\n this._host = host;\n this._host.addController(this);\n\n this._options = { ...options };\n this._slots = options?.slots ? new Set(options.slots) : undefined;\n }\n\n /**\n * The query results are cached, since the accessors below are routinely called\n * from a host's `render`. Only a still connected slot is served from the cache -\n * one removed by a conditional template falls back to a fresh query.\n *\n * There is no slot to find before the host creates its render root, which happens\n * when it connects. A query that comes earlier, such as one from an attribute that\n * the parser applies on upgrade, reports no slot instead of an error.\n */\n private _getSlot(slotName?: T): HTMLSlotElement | null {\n if (isServer) return null;\n\n const cached = this._slotCache.get(slotName);\n\n if (cached?.isConnected) {\n return cached;\n }\n\n const selector =\n slotName === DefaultSlot\n ? 'slot:not([name])'\n : `slot[name=\"${slotName}\"]`;\n const slot =\n this._host.renderRoot?.querySelector<HTMLSlotElement>(selector) ?? null;\n\n if (slot) {\n this._slotCache.set(slotName, slot);\n } else {\n this._slotCache.delete(slotName);\n }\n\n return slot;\n }\n\n /**\n * Returns an array of the assigned nodes for `slot`.\n *\n * If `flatten` is set to `true`, it returns a sequence of both the nodes assigned to the queried slot,\n * as well as nodes assigned to any other slots that are descendants of this slot. If no\n * assigned nodes are found, it returns the slot's fallback content.\n */\n public getAssignedNodes(slot: T, flatten = false): Node[] {\n return this._getSlot(slot)?.assignedNodes({ flatten }) ?? [];\n }\n\n /**\n * Returns an array of the assigned elements for `slot` with additional `options`.\n *\n * See {@link SlotQueryOptions.flatten} and {@link SlotQueryOptions.selector} for more information.\n */\n public getAssignedElements<U extends Element>(\n slot: T,\n options?: SlotQueryOptions\n ): U[] {\n const elements =\n (this._getSlot(slot)?.assignedElements({\n flatten: options?.flatten,\n }) as U[]) ?? [];\n\n return options?.selector\n ? elements.filter((e) => e.matches(options.selector!))\n : elements;\n }\n\n /**\n * Returns the combined text content of the nodes assigned to `slot`,\n * trimmed and with consecutive whitespace collapsed.\n *\n * Useful for deriving an accessible label from projected content.\n * See {@link SlotQueryOptions.flatten} for the `flatten` semantics.\n */\n public getAssignedText(slot: T, flatten = false): string {\n return normalizedTextContent(this.getAssignedNodes(slot, flatten));\n }\n\n /**\n * Return whether `slot` has assigned nodes.\n *\n * If `flatten` is set to `true`, it returns a sequence of both the nodes assigned to the queried slot,\n * as well as nodes assigned to any other slots that are descendants of this slot. If no\n * assigned nodes are found, it returns the slot's fallback content - so a slot with\n * fallback content always reports as having nodes. See {@link SlotQueryOptions.flatten}.\n */\n public hasAssignedNodes(slot: T, flatten = false): boolean {\n return !isEmpty(this.getAssignedNodes(slot, flatten));\n }\n\n /**\n * Return whether `slot` has assigned elements accepting additional `options`.\n *\n * See {@link SlotQueryOptions.flatten} and {@link SlotQueryOptions.selector} for more information.\n */\n public hasAssignedElements(slot: T, options?: SlotQueryOptions): boolean {\n return !isEmpty(this.getAssignedElements(slot, options));\n }\n\n /** @internal */\n public handleEvent(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const name = slot.name as T;\n const isDefault = name === '';\n const observed = isDefault ? (DefaultSlot as T) : name;\n\n if (!this._slots || this._slots.has(observed)) {\n this._options.onChange?.call(this._host, {\n slot: name,\n isDefault,\n isInitial: false,\n });\n this._host.requestUpdate();\n }\n }\n\n /** @internal */\n public hostConnected(): void {\n this._host.renderRoot.addEventListener('slotchange', this);\n }\n\n /** @internal */\n public hostDisconnected(): void {\n this._host.renderRoot.removeEventListener('slotchange', this);\n }\n\n /** @internal */\n public hostUpdated(): void {\n if (!this._initialized && this._options.initial) {\n this._initialized = true;\n this._options.onChange?.call(this._host, {\n slot: '<initial>' as T,\n isDefault: false,\n isInitial: true,\n });\n }\n }\n}\n\nfunction addSlotController<K extends readonly string[]>(\n host: ReactiveControllerHost,\n options?: SlotControllerOptions<InferSlotNames<K>> & {\n slots?: K;\n }\n): SlotController<InferSlotNames<K>> {\n return new SlotController(host as ReactiveControllerHost & LitElement, {\n ...options,\n slots: options?.slots as Iterable<InferSlotNames<K>>,\n });\n}\n\nfunction setSlots<const T extends readonly string[]>(...slots: T) {\n return [DefaultSlot, ...slots] as const;\n}\n\nexport type {\n InferSlotNames,\n SlotChangeCallback,\n SlotChangeCallbackParameters,\n SlotController,\n SlotControllerOptions,\n SlotQueryOptions,\n};\nexport { addSlotController, DefaultSlot, setSlots };\n"]}
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../src/internals/controllers/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GAIT,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAwCxD,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,MAAM,cAAc;IAOlB,YACE,IAAyC,EACzC,OAAkC;QALnB,eAAU,GAAG,IAAI,GAAG,EAAkC,CAAC;QAChE,iBAAY,GAAG,KAAK,CAAC;QAM3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAE/B,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,CAAC;IAUO,QAAQ,CAAC,QAAY;QAC3B,IAAI,QAAQ;YAAE,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CAAC;IAGM,WAAW;QAChB,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAChD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;gBACvC,IAAI,EAAE,WAAgB;gBACtB,SAAS,EAAE,KAAK;gBAChB,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAED,SAAS,iBAAiB,CACxB,IAA4B,EAC5B,OAEC;IAED,OAAO,IAAI,cAAc,CAAC,IAA2C,EAAE;QACrE,GAAG,OAAO;QACV,KAAK,EAAE,OAAO,EAAE,KAAoC;KACrD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAoC,GAAG,KAAQ;IAC9D,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,CAAU,CAAC;AAC1C,CAAC;AAUD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import {\n isServer,\n type LitElement,\n type ReactiveController,\n type ReactiveControllerHost,\n} from 'lit';\nimport { isEmpty } from '../utils/arrays.js';\nimport { normalizedTextContent } from '../utils/dom.js';\n\ntype InferSlotNames<T> = T extends readonly (infer U)[] ? U : never;\n\ntype SlotQueryOptions = {\n /**\n * Whether the query also returns the content of the descendant slots.\n * Defaults to `false`.\n *\n * @remarks\n * A flattened query also returns fallback content: a slot rendered as\n * `<slot>${this.label}</slot>` reports `label` as assigned content,\n * although the consumer projected nothing.\n */\n flatten?: boolean;\n /** The CSS selector that filters the returned elements. */\n selector?: string;\n};\n\ntype SlotChangeCallback<T> = (\n parameters: SlotChangeCallbackParameters<T>\n) => void;\n\ntype SlotChangeCallbackParameters<T> = {\n /** The name of the slot with the changed assigned nodes. */\n slot: T;\n isDefault: boolean;\n /** Whether the callback runs for the first host update. */\n isInitial: boolean;\n};\n\ntype SlotControllerOptions<T> = {\n /** The slot names to observe. */\n slots?: Iterable<T>;\n /** Callback that runs when the assigned nodes of a slot change. */\n onChange?: SlotChangeCallback<T>;\n /** Whether `onChange` also runs once, after the first host update. */\n initial?: boolean;\n};\n\nconst DefaultSlot = '[default]';\n\nclass SlotController<T> implements ReactiveController {\n private readonly _host: ReactiveControllerHost & LitElement;\n private readonly _options: SlotControllerOptions<T>;\n private readonly _slots?: Set<T>;\n private readonly _slotCache = new Map<T | undefined, HTMLSlotElement>();\n private _initialized = false;\n\n constructor(\n host: ReactiveControllerHost & LitElement,\n options?: SlotControllerOptions<T>\n ) {\n this._host = host;\n this._host.addController(this);\n\n this._options = { ...options };\n this._slots = options?.slots ? new Set(options.slots) : undefined;\n }\n\n /**\n * Finds the slot element with the given name.\n *\n * @remarks\n * The result is cached, because the accessors below run from `render`. The\n * cache serves only a connected slot. A query before the host creates its\n * render root reports no slot and raises no error.\n */\n private _getSlot(slotName?: T): HTMLSlotElement | null {\n if (isServer) return null;\n\n const cached = this._slotCache.get(slotName);\n\n if (cached?.isConnected) {\n return cached;\n }\n\n const selector =\n slotName === DefaultSlot\n ? 'slot:not([name])'\n : `slot[name=\"${slotName}\"]`;\n const slot =\n this._host.renderRoot?.querySelector<HTMLSlotElement>(selector) ?? null;\n\n if (slot) {\n this._slotCache.set(slotName, slot);\n } else {\n this._slotCache.delete(slotName);\n }\n\n return slot;\n }\n\n /**\n * Returns the nodes assigned to `slot`. See\n * {@link SlotQueryOptions.flatten}.\n */\n public getAssignedNodes(slot: T, flatten = false): Node[] {\n return this._getSlot(slot)?.assignedNodes({ flatten }) ?? [];\n }\n\n /** Returns the elements assigned to `slot`, as `options` selects them. */\n public getAssignedElements<U extends Element>(\n slot: T,\n options?: SlotQueryOptions\n ): U[] {\n const elements =\n (this._getSlot(slot)?.assignedElements({\n flatten: options?.flatten,\n }) as U[]) ?? [];\n\n return options?.selector\n ? elements.filter((e) => e.matches(options.selector!))\n : elements;\n }\n\n /**\n * Returns the text content assigned to `slot`, trimmed and with collapsed\n * whitespace.\n */\n public getAssignedText(slot: T, flatten = false): string {\n return normalizedTextContent(this.getAssignedNodes(slot, flatten));\n }\n\n /**\n * Whether `slot` has assigned nodes. A flattened query counts fallback\n * content, so a slot with fallback always reports nodes.\n */\n public hasAssignedNodes(slot: T, flatten = false): boolean {\n return !isEmpty(this.getAssignedNodes(slot, flatten));\n }\n\n /** Whether `slot` has assigned elements, as `options` selects them. */\n public hasAssignedElements(slot: T, options?: SlotQueryOptions): boolean {\n return !isEmpty(this.getAssignedElements(slot, options));\n }\n\n /** @internal */\n public hostConnected(): void {\n this._host.renderRoot.addEventListener('slotchange', this);\n }\n\n /** @internal */\n public hostDisconnected(): void {\n this._host.renderRoot.removeEventListener('slotchange', this);\n }\n\n public handleEvent(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const name = slot.name as T;\n const isDefault = name === '';\n const observed = isDefault ? (DefaultSlot as T) : name;\n\n if (!this._slots || this._slots.has(observed)) {\n this._options.onChange?.call(this._host, {\n slot: name,\n isDefault,\n isInitial: false,\n });\n this._host.requestUpdate();\n }\n }\n\n /** @internal */\n public hostUpdated(): void {\n if (!this._initialized && this._options.initial) {\n this._initialized = true;\n this._options.onChange?.call(this._host, {\n slot: '<initial>' as T,\n isDefault: false,\n isInitial: true,\n });\n }\n }\n}\n\nfunction addSlotController<K extends readonly string[]>(\n host: ReactiveControllerHost,\n options?: SlotControllerOptions<InferSlotNames<K>> & {\n slots?: K;\n }\n): SlotController<InferSlotNames<K>> {\n return new SlotController(host as ReactiveControllerHost & LitElement, {\n ...options,\n slots: options?.slots as Iterable<InferSlotNames<K>>,\n });\n}\n\nfunction setSlots<const T extends readonly string[]>(...slots: T) {\n return [DefaultSlot, ...slots] as const;\n}\n\nexport type {\n InferSlotNames,\n SlotChangeCallback,\n SlotChangeCallbackParameters,\n SlotController,\n SlotControllerOptions,\n SlotQueryOptions,\n};\nexport { addSlotController, DefaultSlot, setSlots };\n"]}
|
|
@@ -1,96 +1,92 @@
|
|
|
1
1
|
import type { LitElement } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
* The events
|
|
4
|
-
*
|
|
5
|
-
* Include (a subset of) these in a host's event map to document them.
|
|
3
|
+
* The events that a {@link ToggleController} sends. Include them, or a subset
|
|
4
|
+
* of them, in the event map of a host to document them.
|
|
6
5
|
*/
|
|
7
6
|
export interface ToggleEventMap {
|
|
8
|
-
/**
|
|
7
|
+
/** Sent before an open. Cancelable; a prevented event stops the sequence. */
|
|
9
8
|
igcOpening: CustomEvent<unknown>;
|
|
10
|
-
/**
|
|
9
|
+
/** Sent after the host opens and its transition ends. */
|
|
11
10
|
igcOpened: CustomEvent<unknown>;
|
|
12
|
-
/**
|
|
11
|
+
/** Sent before a close. Cancelable; a prevented event stops the sequence. */
|
|
13
12
|
igcClosing: CustomEvent<unknown>;
|
|
14
|
-
/**
|
|
13
|
+
/** Sent after the host closes and its transition ends. */
|
|
15
14
|
igcClosed: CustomEvent<unknown>;
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
|
-
* A toggleable host must
|
|
19
|
-
*
|
|
20
|
-
* with
|
|
17
|
+
* A toggleable host must give the `emitEvent` method of the event-emitter
|
|
18
|
+
* mixin. Extend {@link ../mixins/event-emitter.js#EventEmitterMixin | EventEmitterMixin}
|
|
19
|
+
* with the {@link ToggleEventMap}, or with a subset of it.
|
|
21
20
|
*/
|
|
22
21
|
type ToggleHost = LitElement & {
|
|
23
22
|
open: boolean;
|
|
24
23
|
emitEvent(name: string, init?: CustomEventInit): boolean;
|
|
25
24
|
};
|
|
26
25
|
/**
|
|
27
|
-
* Runs the
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* interrupted by a newer one), which skips the trailing "-ed" event.
|
|
26
|
+
* Runs the visual transition of the host to the requested state: it sets
|
|
27
|
+
* `open`, plays the animations and awaits the updates. A resolved `false`
|
|
28
|
+
* marks the transition as superseded, for example by a newer animation, and
|
|
29
|
+
* the controller then sends no trailing "-ed" event.
|
|
32
30
|
*/
|
|
33
31
|
type ToggleTransitionFunction = (open: boolean) => Promise<boolean> | boolean;
|
|
34
32
|
type ToggleControllerOptions = {
|
|
35
33
|
/**
|
|
36
|
-
* The host transition.
|
|
37
|
-
* and the transition always counts as
|
|
34
|
+
* The host transition. Without one, the controller sets `host.open` itself
|
|
35
|
+
* and the transition always counts as complete.
|
|
38
36
|
*/
|
|
39
37
|
transition?: ToggleTransitionFunction;
|
|
40
|
-
/**
|
|
38
|
+
/** The factory for the `detail` payload of the events. */
|
|
41
39
|
detail?: () => unknown;
|
|
42
40
|
};
|
|
43
41
|
/**
|
|
44
|
-
* Implements the open
|
|
45
|
-
*
|
|
46
|
-
* 1. Bail when the host is already in the requested state.
|
|
47
|
-
* 2. When emitting, fire the cancelable `igcOpening`/`igcClosing` event and
|
|
48
|
-
* bail if the consumer prevented it.
|
|
49
|
-
* 3. Run the host transition.
|
|
50
|
-
* 4. When emitting and the transition completed, await the host update and
|
|
51
|
-
* fire the `igcOpened`/`igcClosed` event.
|
|
42
|
+
* Implements the open and close sequence of every toggleable component.
|
|
52
43
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* The sequence stops when the host is already in the requested state, sends
|
|
46
|
+
* the cancelable `igcOpening` or `igcClosing` event, runs the host
|
|
47
|
+
* transition, awaits the host update, then sends `igcOpened` or `igcClosed`.
|
|
48
|
+
* The events run only when the caller asks for them.
|
|
55
49
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
50
|
+
* The host keeps its public `open`, `show()`, `hide()` and `toggle()` members
|
|
51
|
+
* and delegates to the controller. Unlike the other controllers here, the
|
|
52
|
+
* host does not register it; it has no life-cycle of its own.
|
|
58
53
|
*/
|
|
59
54
|
declare class ToggleController {
|
|
60
55
|
private readonly _host;
|
|
61
56
|
private readonly _options;
|
|
62
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* The target of an operation in flight. A transition can set `host.open` at
|
|
59
|
+
* its end only.
|
|
60
|
+
*/
|
|
63
61
|
private _pending?;
|
|
64
|
-
/**
|
|
62
|
+
/** Incremented per operation. A superseded operation stops. */
|
|
65
63
|
private _generation;
|
|
66
64
|
constructor(host: ToggleHost, options?: ToggleControllerOptions);
|
|
67
65
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
66
|
+
* Sends the event through the host `emitEvent`. Consumers and framework
|
|
67
|
+
* wrappers observe that one method.
|
|
70
68
|
*/
|
|
71
69
|
private _emit;
|
|
72
70
|
private _setOpenState;
|
|
73
71
|
/**
|
|
74
|
-
* Opens the host
|
|
75
|
-
* `
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* transition reporting itself interrupted or by a newer request.
|
|
72
|
+
* Opens the host, wrapped in the `igcOpening` and `igcOpened` events when
|
|
73
|
+
* `emitEvents` is true. Returns `false` when the host is already open or
|
|
74
|
+
* moves there, when the consumer canceled the opening event, when a later
|
|
75
|
+
* request supersedes this one, or when the transition reports an
|
|
76
|
+
* interruption.
|
|
80
77
|
*/
|
|
81
78
|
show(emitEvents?: boolean): Promise<boolean>;
|
|
82
79
|
/**
|
|
83
|
-
* Closes the host
|
|
84
|
-
* `
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* transition reporting itself interrupted or by a newer request.
|
|
80
|
+
* Closes the host, wrapped in the `igcClosing` and `igcClosed` events when
|
|
81
|
+
* `emitEvents` is true. Returns `false` when the host is already closed or
|
|
82
|
+
* moves there, when the consumer canceled the closing event, when a later
|
|
83
|
+
* request supersedes this one, or when the transition reports an
|
|
84
|
+
* interruption.
|
|
89
85
|
*/
|
|
90
86
|
hide(emitEvents?: boolean): Promise<boolean>;
|
|
91
|
-
/** Opens or closes
|
|
87
|
+
/** Opens the host, or closes it, based on its current state. */
|
|
92
88
|
toggle(emitEvents?: boolean): Promise<boolean>;
|
|
93
89
|
}
|
|
94
|
-
/** Creates
|
|
90
|
+
/** Creates a {@link ToggleController} for the given host. */
|
|
95
91
|
export declare function addToggleController(host: ToggleHost, options?: ToggleControllerOptions): ToggleController;
|
|
96
92
|
export type { ToggleController, ToggleControllerOptions, ToggleHost };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../../src/internals/controllers/toggle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../../src/internals/controllers/toggle.ts"],"names":[],"mappings":"AA0DA,MAAM,gBAAgB;IAapB,YAAY,IAAgB,EAAE,OAAiC;QAFvD,gBAAW,GAAG,CAAC,CAAC;QAGtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;IACjC,CAAC;IAMO,KAAK,CAAC,IAA0B,EAAE,UAAmB;QAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAIhD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;YAC1B,GAAG,CAAC,UAAU,IAAI,EAAE,UAAU,EAAE,CAAC;YACjC,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,aAAa,CACzB,IAAa,EACb,UAAmB;QAEnB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;QAErC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAC1C,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,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;QAC5B,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC/C,CAAC;IAGM,MAAM,CAAC,UAAU,GAAG,KAAK;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzE,CAAC;CACF;AAGD,MAAM,UAAU,mBAAmB,CACjC,IAAgB,EAChB,OAAiC;IAEjC,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import type { LitElement } from 'lit';\n\n/**\n * The events that a {@link ToggleController} sends. Include them, or a subset\n * of them, in the event map of a host to document them.\n */\nexport interface ToggleEventMap {\n /** Sent before an open. Cancelable; a prevented event stops the sequence. */\n igcOpening: CustomEvent<unknown>;\n /** Sent after the host opens and its transition ends. */\n igcOpened: CustomEvent<unknown>;\n /** Sent before a close. Cancelable; a prevented event stops the sequence. */\n igcClosing: CustomEvent<unknown>;\n /** Sent after the host closes and its transition ends. */\n igcClosed: CustomEvent<unknown>;\n}\n\n/**\n * A toggleable host must give the `emitEvent` method of the event-emitter\n * mixin. Extend {@link ../mixins/event-emitter.js#EventEmitterMixin | EventEmitterMixin}\n * with the {@link ToggleEventMap}, or with a subset of it.\n */\ntype ToggleHost = LitElement & {\n open: boolean;\n emitEvent(name: string, init?: CustomEventInit): boolean;\n};\n\n/**\n * Runs the visual transition of the host to the requested state: it sets\n * `open`, plays the animations and awaits the updates. A resolved `false`\n * marks the transition as superseded, for example by a newer animation, and\n * the controller then sends no trailing \"-ed\" event.\n */\ntype ToggleTransitionFunction = (open: boolean) => Promise<boolean> | boolean;\n\ntype ToggleControllerOptions = {\n /**\n * The host transition. Without one, the controller sets `host.open` itself\n * and the transition always counts as complete.\n */\n transition?: ToggleTransitionFunction;\n /** The factory for the `detail` payload of the events. */\n detail?: () => unknown;\n};\n\n/**\n * Implements the open and close sequence of every toggleable component.\n *\n * @remarks\n * The sequence stops when the host is already in the requested state, sends\n * the cancelable `igcOpening` or `igcClosing` event, runs the host\n * transition, awaits the host update, then sends `igcOpened` or `igcClosed`.\n * The events run only when the caller asks for them.\n *\n * The host keeps its public `open`, `show()`, `hide()` and `toggle()` members\n * and delegates to the controller. Unlike the other controllers here, the\n * host does not register it; it has no life-cycle of its own.\n */\nclass ToggleController {\n private readonly _host: ToggleHost;\n private readonly _options: ToggleControllerOptions;\n\n /**\n * The target of an operation in flight. A transition can set `host.open` at\n * its end only.\n */\n private _pending?: boolean;\n\n /** Incremented per operation. A superseded operation stops. */\n private _generation = 0;\n\n constructor(host: ToggleHost, options?: ToggleControllerOptions) {\n this._host = host;\n this._options = { ...options };\n }\n\n /**\n * Sends the event through the host `emitEvent`. Consumers and framework\n * wrappers observe that one method.\n */\n private _emit(name: keyof ToggleEventMap, cancelable: boolean): boolean {\n const host = this._host;\n const detail = this._options.detail?.call(host);\n\n // The init omits both keys instead of a falsy value. `emitEvent` then\n // applies its own defaults, and the init of a plain event stays empty.\n return host.emitEvent(name, {\n ...(cancelable && { cancelable }),\n ...(detail !== undefined && { detail }),\n });\n }\n\n private async _setOpenState(\n open: boolean,\n emitEvents: boolean\n ): Promise<boolean> {\n const host = this._host;\n const { transition } = this._options;\n\n if ((this._pending ?? host.open) === open) {\n return false;\n }\n\n if (emitEvents && !this._emit(open ? 'igcOpening' : 'igcClosing', true)) {\n return false;\n }\n\n const generation = ++this._generation;\n this._pending = open;\n\n // The default transition is synchronous, so the state change and the\n // `updateComplete` subscription stay in the microtask of the caller.\n let completed = true;\n try {\n if (transition) {\n completed = (await transition.call(host, open)) !== false;\n } else {\n host.open = open;\n }\n } finally {\n // A newer operation owns the pending state from here on.\n if (generation === this._generation) {\n this._pending = undefined;\n }\n }\n\n if (generation !== this._generation) {\n return false;\n }\n\n if (emitEvents && completed) {\n await host.updateComplete;\n\n // A newer operation can take over while the update settles.\n if (generation !== this._generation) {\n return false;\n }\n\n this._emit(open ? 'igcOpened' : 'igcClosed', false);\n }\n\n return completed;\n }\n\n /*\n * The methods below return the underlying promise instead of being `async`.\n * An `async` wrapper costs extra microtask hops, which shift the timing of\n * caller code, for example focus management, against `updateComplete`.\n */\n\n /**\n * Opens the host, wrapped in the `igcOpening` and `igcOpened` events when\n * `emitEvents` is true. Returns `false` when the host is already open or\n * moves there, when the consumer canceled the opening event, when a later\n * request supersedes this one, or when the transition reports an\n * interruption.\n */\n public show(emitEvents = false): Promise<boolean> {\n return this._setOpenState(true, emitEvents);\n }\n\n /**\n * Closes the host, wrapped in the `igcClosing` and `igcClosed` events when\n * `emitEvents` is true. Returns `false` when the host is already closed or\n * moves there, when the consumer canceled the closing event, when a later\n * request supersedes this one, or when the transition reports an\n * interruption.\n */\n public hide(emitEvents = false): Promise<boolean> {\n return this._setOpenState(false, emitEvents);\n }\n\n /** Opens the host, or closes it, based on its current state. */\n public toggle(emitEvents = false): Promise<boolean> {\n return this._host.open ? this.hide(emitEvents) : this.show(emitEvents);\n }\n}\n\n/** Creates a {@link ToggleController} for the given host. */\nexport function addToggleController(\n host: ToggleHost,\n options?: ToggleControllerOptions\n): ToggleController {\n return new ToggleController(host, options);\n}\n\nexport type { ToggleController, ToggleControllerOptions, ToggleHost };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../src/internals/date/compare.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../src/internals/date/compare.ts"],"names":[],"mappings":"AAKA,SAAS,YAAY,CACnB,KAAW,EACX,QAAc,EACd,UAA6C,EAC7C,WAAoB,EACpB,WAAoB;IAEpB,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;QAC/B,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,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includeTime` is `false`, and the date portion when `includeDate` is\n * `false`.\n */\nfunction compareDates(\n value: Date,\n boundary: Date,\n comparator: (a: number, b: number) => boolean,\n includeTime: boolean,\n includeDate: boolean\n): boolean {\n if (includeTime && includeDate) {\n return comparator(value.getTime(), boundary.getTime());\n }\n\n const v = new Date(value.getTime());\n const b = new Date(boundary.getTime());\n\n if (!includeTime) {\n v.setHours(0, 0, 0, 0);\n b.setHours(0, 0, 0, 0);\n }\n if (!includeDate) {\n v.setFullYear(0, 0, 0);\n b.setFullYear(0, 0, 0);\n }\n\n return comparator(v.getTime(), b.getTime());\n}\n\nexport function isDateExceedingMax(\n value: Date,\n maxValue: Date,\n includeTime = true,\n includeDate = true\n): boolean {\n return compareDates(\n value,\n maxValue,\n (a, b) => a > b,\n includeTime,\n includeDate\n );\n}\n\nexport function isDateLessThanMin(\n value: Date,\n minValue: Date,\n includeTime = true,\n includeDate = true\n): boolean {\n return compareDates(\n value,\n minValue,\n (a, b) => a < b,\n includeTime,\n includeDate\n );\n}\n"]}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { DateRangeValue } from '../../components/types.js';
|
|
2
|
-
/**
|
|
2
|
+
/** Returns whether `value` is a `Date` with a valid time. */
|
|
3
3
|
export declare function isValidDate(value: unknown): value is Date;
|
|
4
|
-
/** Converts `value` to a `Date`, or
|
|
4
|
+
/** Converts `value` to a `Date`, or `null` when empty or unparsable. */
|
|
5
5
|
export declare function convertToDate(value?: Date | string | null): Date | null;
|
|
6
6
|
/**
|
|
7
|
-
* Converts a comma-separated string of ISO 8601 dates, or an array of dates
|
|
8
|
-
* strings, into an array of `Date` objects
|
|
7
|
+
* Converts a comma-separated string of ISO 8601 dates, or an array of dates
|
|
8
|
+
* and ISO 8601 strings, into an array of `Date` objects. Unparsable items
|
|
9
|
+
* are dropped.
|
|
9
10
|
*/
|
|
10
11
|
export declare function convertToDates(value?: (Date | string)[] | string | null): Date[] | null;
|
|
11
12
|
/**
|
|
12
|
-
* Converts `value` to a `DateRangeValue`, parsing a string as JSON and
|
|
13
|
-
* time of both endpoints.
|
|
14
|
-
*
|
|
13
|
+
* Converts `value` to a `DateRangeValue`, parsing a string as JSON and
|
|
14
|
+
* truncating the time of both endpoints.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Malformed input gives `null`, because this runs as an attribute converter.
|
|
15
18
|
*/
|
|
16
19
|
export declare function convertToDateRange(value?: DateRangeValue | string | null): DateRangeValue | null;
|
|
17
20
|
/** Converts a `Date` to an ISO 8601 string. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converters.js","sourceRoot":"","sources":["../../../src/internals/date/converters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGvD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAGlC,MAAM,YAAY,GAAG,cAAc,CAAC;AAGpC,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,YAAY,CAAC,IAAU;IAC9B,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC;AAGD,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAE5B,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,OAAO,YAAY,CAAC,IAAI,IAAI,CAA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MAAM,CAAC,GAA2B,CAAC,CAAC;IAE9D,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;AAChE,CAAC;AAGD,MAAM,UAAU,gBAAgB,CAAC,KAAkB;IACjD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC","sourcesContent":["import type { DateRangeValue } from '../../components/types.js';\nimport { isPlainObject, isString } from '../utils/types.js';\nimport { CalendarDay, truncateTime } from './model.js';\n\n/** Matches a string that starts with a four digit year. `Date` parses it. */\nconst ISO_DATE_PATTERN = /^\\d{4}/;\n\n/** Matches a time only string: `HH:MM`, with optional seconds and ms. */\nconst TIME_PATTERN = /^\\d{2}:\\d{2}/;\n\n/** Returns whether `value` is a `Date` with a valid time. */\nexport function isValidDate(value: unknown): value is Date {\n return value instanceof Date && !Number.isNaN(value.getTime());\n}\n\nfunction getValidDate(date: Date): Date | null {\n return isValidDate(date) ? date : null;\n}\n\n/** Parses an ISO 8601 date, or a time only string against the current date. */\nfunction parseISODate(value: string): Date | null {\n const string = value.trim();\n\n if (ISO_DATE_PATTERN.test(string)) {\n const timeComponent = !string.includes('T') ? 'T00:00:00' : '';\n return getValidDate(new Date(`${string}${timeComponent}`));\n }\n\n if (TIME_PATTERN.test(string)) {\n const today = CalendarDay.today;\n const month = `${today.month + 1}`.padStart(2, '0');\n const date = `${today.date}`.padStart(2, '0');\n\n return getValidDate(new Date(`${today.year}-${month}-${date}T${string}`));\n }\n\n return null;\n}\n\n/** Converts `value` to a `Date`, or `null` when empty or unparsable. */\nexport function convertToDate(value?: Date | string | null): Date | null {\n if (!value) {\n return null;\n }\n\n return isString(value) ? parseISODate(value) : getValidDate(value);\n}\n\n/**\n * Converts a comma-separated string of ISO 8601 dates, or an array of dates\n * and ISO 8601 strings, into an array of `Date` objects. Unparsable items\n * are dropped.\n */\nexport function convertToDates(\n value?: (Date | string)[] | string | null\n): Date[] | null {\n if (!value) {\n return null;\n }\n\n const values: Date[] = [];\n const sources = isString(value) ? value.split(',') : value;\n\n for (const source of sources) {\n const trimmed = isString(source) ? source.trim() : source;\n const date = convertToDate(trimmed);\n if (date) {\n values.push(date);\n }\n }\n\n return values;\n}\n\n/**\n * Converts `value` to a `DateRangeValue`, parsing a string as JSON and\n * truncating the time of both endpoints.\n *\n * @remarks\n * Malformed input gives `null`, because this runs as an attribute converter.\n */\nexport function convertToDateRange(\n value?: DateRangeValue | string | null\n): DateRangeValue | null {\n if (!value) {\n return null;\n }\n\n if (!isString(value)) {\n return value;\n }\n\n let parsed: unknown;\n\n try {\n parsed = JSON.parse(value);\n } catch {\n return null;\n }\n\n if (!isPlainObject(parsed)) {\n return null;\n }\n\n const start = convertToDate(parsed.start as Date | string | null);\n const end = convertToDate(parsed.end as Date | string | null);\n\n return { start: truncateTime(start), end: truncateTime(end) };\n}\n\n/** Converts a `Date` to an ISO 8601 string. */\nexport function getDateFormValue(value: Date | null): string | null {\n return value ? value.toISOString() : null;\n}\n"]}
|
|
@@ -13,20 +13,19 @@ type CalendarDayParams = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare const DAYS_IN_WEEK = 7;
|
|
15
15
|
export declare function toCalendarDay(date: DayParameter): CalendarDay;
|
|
16
|
-
/**
|
|
16
|
+
/** Returns the {@link toCalendarDay} result of `date`, or `null` if empty. */
|
|
17
17
|
export declare function toCalendarDayOrNull(date?: DayParameter | null): CalendarDay | null;
|
|
18
|
-
/** Truncates the time portion of `date
|
|
18
|
+
/** Truncates the time portion of `date`. An empty value gives `null`. */
|
|
19
19
|
export declare function truncateTime(date?: Date | null): Date | null;
|
|
20
20
|
/**
|
|
21
|
-
* Yields the days between `start` and `end`,
|
|
22
|
-
* `end
|
|
21
|
+
* Yields the days between `start` and `end`, stepped by `unit`. Stops before
|
|
22
|
+
* `end`, unless `inclusive` is `true`.
|
|
23
23
|
*/
|
|
24
24
|
export declare function calendarRange(options: CalendarRangeParams): Generator<CalendarDay, void, unknown>;
|
|
25
25
|
export declare class CalendarDay {
|
|
26
26
|
private readonly _date;
|
|
27
27
|
/** Constructs and returns the current day. */
|
|
28
28
|
static get today(): CalendarDay;
|
|
29
|
-
/** Constructs a new CalendarDay instance from a Date object. */
|
|
30
29
|
static from(date: Date): CalendarDay;
|
|
31
30
|
/**
|
|
32
31
|
* Compares the date portion of two date objects.
|
|
@@ -40,18 +39,14 @@ export declare class CalendarDay {
|
|
|
40
39
|
*/
|
|
41
40
|
static compare(first: DayParameter, second: DayParameter): number;
|
|
42
41
|
constructor(args: CalendarDayParams);
|
|
43
|
-
/** Returns a copy of this instance. */
|
|
44
42
|
clone(): CalendarDay;
|
|
45
43
|
/** Returns a new instance with the given values replaced. */
|
|
46
44
|
set(args: Partial<CalendarDayParams>): CalendarDay;
|
|
47
45
|
add(unit: DayInterval, value: number): CalendarDay;
|
|
48
46
|
/** Returns the day of the week (Sunday = 0). */
|
|
49
47
|
get day(): number;
|
|
50
|
-
/** Returns the full year. */
|
|
51
48
|
get year(): number;
|
|
52
|
-
/** Returns the month. */
|
|
53
49
|
get month(): number;
|
|
54
|
-
/** Returns the date */
|
|
55
50
|
get date(): number;
|
|
56
51
|
/** Returns the timestamp since epoch in milliseconds. */
|
|
57
52
|
get timestamp(): number;
|
|
@@ -59,17 +54,15 @@ export declare class CalendarDay {
|
|
|
59
54
|
* Returns the ISO 8601 week number.
|
|
60
55
|
*
|
|
61
56
|
* @remarks
|
|
62
|
-
* Week 1
|
|
63
|
-
*
|
|
57
|
+
* Week 1 holds the first Thursday of the year, weeks start on Monday, and
|
|
58
|
+
* a year can have 53 weeks.
|
|
64
59
|
*/
|
|
65
60
|
get week(): number;
|
|
66
|
-
/** Returns the underlying native
|
|
61
|
+
/** Returns a copy of the underlying native `Date` instance. */
|
|
67
62
|
get native(): Date;
|
|
68
63
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* @remarks
|
|
72
|
-
* This is naive, since it does not account for locale specifics.
|
|
64
|
+
* Returns whether the current date is a weekend day. The check is naive
|
|
65
|
+
* and ignores locale specifics.
|
|
73
66
|
*/
|
|
74
67
|
get weekend(): boolean;
|
|
75
68
|
equalTo(value: DayParameter): boolean;
|