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,67 +1,64 @@
|
|
|
1
1
|
import { type IResourceChangeEventArgs } from 'igniteui-i18n-core';
|
|
2
2
|
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
-
import { type
|
|
4
|
-
/**
|
|
5
|
-
* Defines the structure for the host element that will use this controller.
|
|
6
|
-
* The host must be a Lit element (ReactiveControllerHost) and an HTMLElement.
|
|
7
|
-
*/
|
|
3
|
+
import { type ResourceMap } from './utils.js';
|
|
8
4
|
interface I18nControllerHost extends ReactiveControllerHost, HTMLElement {
|
|
9
5
|
resourceStrings?: unknown;
|
|
10
6
|
locale?: string;
|
|
11
7
|
}
|
|
12
8
|
type ResourceChangeCallback = (event: CustomEvent<IResourceChangeEventArgs>) => unknown;
|
|
13
|
-
/** Configuration object for the I18nController
|
|
9
|
+
/** Configuration object for the `I18nController`. */
|
|
14
10
|
export type I18nControllerConfig<T extends object> = {
|
|
15
|
-
/**
|
|
11
|
+
/** Default English resource strings, always from `igniteui-i18n-core`. */
|
|
16
12
|
defaultEN: T;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated since 7.2.0. The map of the component, if it uses mixed
|
|
15
|
+
* resource strings. To be removed with the deprecated resources.
|
|
16
|
+
*/
|
|
17
|
+
resourceMap?: ResourceMap;
|
|
18
|
+
/** Optional callback for a change of the global locale. */
|
|
20
19
|
onResourceChange?: ResourceChangeCallback;
|
|
21
20
|
};
|
|
22
21
|
/**
|
|
23
|
-
* Manages localization (i18n)
|
|
24
|
-
*
|
|
25
|
-
* and updates when the global localization state changes.
|
|
22
|
+
* Manages the localization (i18n) of a Lit web component, and updates it on
|
|
23
|
+
* a change of the global localization state.
|
|
26
24
|
*/
|
|
27
25
|
declare class I18nController<T extends object> implements ReactiveController {
|
|
28
26
|
private readonly _host;
|
|
29
27
|
private readonly _defaultEN;
|
|
30
|
-
/**
|
|
31
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated since 7.2.0. The map that converts between the new and the old
|
|
30
|
+
* resource objects.
|
|
31
|
+
*/
|
|
32
|
+
private readonly _resourceMap?;
|
|
32
33
|
private readonly _resourceChangeCallback?;
|
|
33
34
|
private _locale?;
|
|
34
|
-
/** Resolved lazily, and again
|
|
35
|
+
/** Resolved lazily, and again after a locale or locale data change. */
|
|
35
36
|
private _dateTimeFormats?;
|
|
36
|
-
/** Cache of default resource strings
|
|
37
|
+
/** Cache of the default resource strings from the i18n manager. */
|
|
37
38
|
private _defaultResourceStrings;
|
|
38
|
-
/**
|
|
39
|
+
/** Only the custom strings, which override a part of the defaults. */
|
|
39
40
|
private _customResourceStrings?;
|
|
40
|
-
/**
|
|
41
|
+
/** The custom resource strings merged over the default ones. */
|
|
41
42
|
private _resourceStrings?;
|
|
42
43
|
/**
|
|
43
|
-
* Sets a custom locale
|
|
44
|
-
*
|
|
44
|
+
* Sets a custom locale for this host component instance, which overrides
|
|
45
|
+
* the global locale.
|
|
45
46
|
*/
|
|
46
47
|
set locale(value: string | undefined);
|
|
47
48
|
/**
|
|
48
|
-
* Gets the resolved locale
|
|
49
|
-
*
|
|
50
|
-
* global locale.
|
|
49
|
+
* Gets the resolved locale of the host component: its custom locale, or
|
|
50
|
+
* the global one.
|
|
51
51
|
*/
|
|
52
52
|
get locale(): string;
|
|
53
|
-
/**
|
|
54
|
-
* Sets custom resource string for component with this controller.
|
|
55
|
-
* Gets the resolved resource string for component.
|
|
56
|
-
*/
|
|
53
|
+
/** Sets the custom resource strings of the component. */
|
|
57
54
|
set resourceStrings(value: T | undefined);
|
|
58
|
-
/**
|
|
55
|
+
/** Gets the resolved resource strings of the component. */
|
|
59
56
|
get resourceStrings(): T;
|
|
60
57
|
/** The locale-default format for displaying a date-time value. */
|
|
61
58
|
get localeDisplayFormat(): string;
|
|
62
59
|
/**
|
|
63
|
-
* The locale-default format for editing a date-time value
|
|
64
|
-
* format with leading zeros
|
|
60
|
+
* The locale-default format for editing a date-time value: the display
|
|
61
|
+
* format with the leading zeros a mask needs.
|
|
65
62
|
*/
|
|
66
63
|
get localeInputFormat(): string;
|
|
67
64
|
constructor(host: I18nControllerHost, config: I18nControllerConfig<T>);
|
|
@@ -72,33 +69,34 @@ declare class I18nController<T extends object> implements ReactiveController {
|
|
|
72
69
|
/** @internal */
|
|
73
70
|
handleEvent(event: CustomEvent<IResourceChangeEventArgs>): void;
|
|
74
71
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
72
|
+
* Resolves the locale defaults again, then applies the custom overrides, so
|
|
73
|
+
* that the merged strings keep no value of an earlier locale.
|
|
77
74
|
*/
|
|
78
75
|
private _refreshResourceStrings;
|
|
79
76
|
/**
|
|
80
|
-
*
|
|
81
|
-
* The logic maps component keys (from defaultEN) to core library keys
|
|
82
|
-
* and retrieves the localized string from the i18n manager.
|
|
77
|
+
* The resource strings of the component for the current locale.
|
|
83
78
|
*
|
|
84
|
-
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* Maps the `defaultEN` keys to the core library keys, and reads each string
|
|
81
|
+
* from the i18n manager. Each instance gets the same result, so the result is
|
|
82
|
+
* cached. See {@link defaultStringsCache}.
|
|
85
83
|
*/
|
|
86
84
|
private _getDefaultResourceStrings;
|
|
87
85
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
86
|
+
* The date-time formats of the resolved locale.
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* An `Intl` format string is expensive, and the date editors read these on
|
|
90
|
+
* each render, so they are cached against the locale. A global resource
|
|
91
|
+
* change clears the cache, because the shared date formatter can then hold
|
|
92
|
+
* new locale data.
|
|
92
93
|
*/
|
|
93
94
|
private _getDateTimeFormats;
|
|
94
95
|
private getMixedResourceStrings;
|
|
95
96
|
}
|
|
96
|
-
/** Returns the date-time format string with
|
|
97
|
+
/** Returns the date-time format string with a predefined style suffix. */
|
|
97
98
|
export declare function getDateTimeFormat(format?: string, suffix?: 'Date' | 'Time'): string | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* Formats a date for display using the specified format.
|
|
100
|
-
*/
|
|
101
99
|
export declare function formatDisplayDate(value: Date, locale: string, displayFormat?: string): string;
|
|
102
|
-
/**
|
|
100
|
+
/** Creates an `I18nController`, and adds it to the host. */
|
|
103
101
|
export declare function addI18nController<T extends object>(host: I18nControllerHost, config: I18nControllerConfig<T>): I18nController<T>;
|
|
104
102
|
export type { I18nController };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getCurrentI18n, getDateFormatter, getI18nManager, } from 'igniteui-i18n-core';
|
|
2
2
|
import { convertToCoreResource, convertToIgcResource, } from './utils.js';
|
|
3
|
+
const defaultStringsCache = new WeakMap();
|
|
4
|
+
const registeredDefaults = new WeakSet();
|
|
3
5
|
class I18nController {
|
|
4
6
|
set locale(value) {
|
|
5
7
|
if (this._locale !== value) {
|
|
@@ -14,7 +16,7 @@ class I18nController {
|
|
|
14
16
|
set resourceStrings(value) {
|
|
15
17
|
if (this._resourceStrings !== value) {
|
|
16
18
|
if (value) {
|
|
17
|
-
this._customResourceStrings = this.
|
|
19
|
+
this._customResourceStrings = this._resourceMap
|
|
18
20
|
? this.getMixedResourceStrings(value)
|
|
19
21
|
: value;
|
|
20
22
|
this._resourceStrings = Object.assign({}, this._defaultResourceStrings, this._customResourceStrings);
|
|
@@ -38,10 +40,14 @@ class I18nController {
|
|
|
38
40
|
constructor(host, config) {
|
|
39
41
|
this._host = host;
|
|
40
42
|
this._defaultEN = config.defaultEN;
|
|
41
|
-
this.
|
|
43
|
+
this._resourceMap = config.resourceMap;
|
|
42
44
|
this._resourceChangeCallback = config.onResourceChange;
|
|
45
|
+
if (!registeredDefaults.has(this._defaultEN)) {
|
|
46
|
+
registeredDefaults.add(this._defaultEN);
|
|
47
|
+
const manager = getI18nManager();
|
|
48
|
+
manager.registerI18n(this._defaultEN, manager.defaultLocale);
|
|
49
|
+
}
|
|
43
50
|
this._defaultResourceStrings = this._getDefaultResourceStrings();
|
|
44
|
-
getI18nManager().registerI18n(this._defaultEN, getI18nManager().defaultLocale);
|
|
45
51
|
this._host.addController(this);
|
|
46
52
|
}
|
|
47
53
|
hostConnected() {
|
|
@@ -67,16 +73,26 @@ class I18nController {
|
|
|
67
73
|
}
|
|
68
74
|
_getDefaultResourceStrings() {
|
|
69
75
|
const coreResourceStrings = getI18nManager().getCurrentResourceStrings(this.locale);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
let perResources = defaultStringsCache.get(this._defaultEN);
|
|
77
|
+
if (!perResources) {
|
|
78
|
+
perResources = new WeakMap();
|
|
79
|
+
defaultStringsCache.set(this._defaultEN, perResources);
|
|
80
|
+
}
|
|
81
|
+
let strings = perResources.get(coreResourceStrings);
|
|
82
|
+
if (!strings) {
|
|
83
|
+
const normalizedResourceStrings = {};
|
|
84
|
+
const defaultComponentKeys = Object.keys(this._defaultEN);
|
|
85
|
+
for (const key of defaultComponentKeys) {
|
|
86
|
+
let resolvedValue = this._defaultEN[key];
|
|
87
|
+
if (key in coreResourceStrings) {
|
|
88
|
+
resolvedValue = coreResourceStrings[key];
|
|
89
|
+
}
|
|
90
|
+
normalizedResourceStrings[key] = resolvedValue;
|
|
76
91
|
}
|
|
77
|
-
|
|
92
|
+
strings = this.getMixedResourceStrings(normalizedResourceStrings);
|
|
93
|
+
perResources.set(coreResourceStrings, strings);
|
|
78
94
|
}
|
|
79
|
-
return
|
|
95
|
+
return { ...strings };
|
|
80
96
|
}
|
|
81
97
|
_getDateTimeFormats() {
|
|
82
98
|
const locale = this.locale;
|
|
@@ -91,8 +107,9 @@ class I18nController {
|
|
|
91
107
|
return this._dateTimeFormats;
|
|
92
108
|
}
|
|
93
109
|
getMixedResourceStrings(value) {
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
const map = this._resourceMap;
|
|
111
|
+
if (map) {
|
|
112
|
+
return Object.assign({}, convertToCoreResource(value, map), convertToIgcResource(value, map));
|
|
96
113
|
}
|
|
97
114
|
return value;
|
|
98
115
|
}
|
|
@@ -105,29 +122,25 @@ export function getDateTimeFormat(format, suffix = 'Date') {
|
|
|
105
122
|
return format && DATE_TIME_STYLES.has(format) ? `${format}${suffix}` : format;
|
|
106
123
|
}
|
|
107
124
|
export function formatDisplayDate(value, locale, displayFormat) {
|
|
125
|
+
const formatter = getDateFormatter();
|
|
126
|
+
let options;
|
|
108
127
|
if (!displayFormat) {
|
|
109
|
-
|
|
128
|
+
options = {};
|
|
110
129
|
}
|
|
111
|
-
if (DATE_TIME_STYLES.has(displayFormat)) {
|
|
130
|
+
else if (DATE_TIME_STYLES.has(displayFormat)) {
|
|
112
131
|
const style = displayFormat;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (displayFormat.endsWith('
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
timeStyle: extractStyle(displayFormat, 'time'),
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
return getDateFormatter().formatDateCustomFormat(value, displayFormat, {
|
|
129
|
-
locale,
|
|
130
|
-
});
|
|
132
|
+
options = { dateStyle: style, timeStyle: style };
|
|
133
|
+
}
|
|
134
|
+
else if (displayFormat.endsWith('Date')) {
|
|
135
|
+
options = { dateStyle: extractStyle(displayFormat, 'date') };
|
|
136
|
+
}
|
|
137
|
+
else if (displayFormat.endsWith('Time')) {
|
|
138
|
+
options = { timeStyle: extractStyle(displayFormat, 'time') };
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return formatter.formatDateCustomFormat(value, displayFormat, { locale });
|
|
142
|
+
}
|
|
143
|
+
return formatter.formatDateTime(value, locale, options);
|
|
131
144
|
}
|
|
132
145
|
export function addI18nController(host, config) {
|
|
133
146
|
return new I18nController(host, config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-controller.js","sourceRoot":"","sources":["../../../src/internals/i18n/i18n-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,GAGf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GAErB,MAAM,YAAY,CAAC;AAsCpB,MAAM,cAAc;IA2BlB,IAAW,MAAM,CAAC,KAAyB;QACzC,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,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C,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE;YACtD,SAAS,EAAE,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC;SAC/C,CAAC,CAAC;IACL,CAAC;IAGD,OAAO,gBAAgB,EAAE,CAAC,sBAAsB,CAAC,KAAK,EAAE,aAAa,EAAE;QACrE,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAGD,MAAM,UAAU,iBAAiB,CAC/B,IAAwB,EACxB,MAA+B;IAE/B,OAAO,IAAI,cAAc,CAAI,IAAI,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import {\n getCurrentI18n,\n getDateFormatter,\n getI18nManager,\n type IResourceChangeEventArgs,\n type IResourceStrings,\n} from 'igniteui-i18n-core';\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport {\n convertToCoreResource,\n convertToIgcResource,\n type I18nResourceMapNames,\n} from './utils.js';\n\n/**\n * Defines the structure for the host element that will use this controller.\n * The host must be a Lit element (ReactiveControllerHost) and an HTMLElement.\n */\ninterface I18nControllerHost extends ReactiveControllerHost, HTMLElement {\n // Properties the host is expected to have/use, though they are managed by the controller.\n resourceStrings?: unknown;\n locale?: string;\n}\n\ntype ResourceChangeCallback = (\n event: CustomEvent<IResourceChangeEventArgs>\n) => unknown;\n\n/** The date-time formats a locale resolves to, cached against that locale. */\ntype LocaleDateTimeFormats = {\n locale: string;\n display: string;\n input: string;\n};\n\n/** Configuration object for the I18nController. */\nexport type I18nControllerConfig<T extends object> = {\n /** The full default English resource strings object for the component. Should always come from igniteui-i18n-core. */\n defaultEN: T;\n /** @deprecated since 7.2.0. Optional name if component uses mixed resource strings. To be removed with deprecated resources. */\n resourceMapName?: I18nResourceMapNames;\n /** An optional callback to execute when the global locale changes. */\n onResourceChange?: ResourceChangeCallback;\n};\n\n/**\n * Manages localization (i18n) for a Lit web component.\n * It handles the current locale, component-specific resource overrides,\n * and updates when the global localization state changes.\n */\nclass I18nController<T extends object> implements ReactiveController {\n //#region Internal properties and state\n\n private readonly _host: I18nControllerHost;\n private readonly _defaultEN: T;\n /** @deprecated since 7.2.0. Resource name to use when converting new to old and vice versa resource objects. */\n private readonly _resourceMapName?: I18nResourceMapNames;\n private readonly _resourceChangeCallback?: ResourceChangeCallback;\n\n private _locale?: string;\n /** Resolved lazily, and again whenever the locale or the locale data changes. */\n private _dateTimeFormats?: LocaleDateTimeFormats;\n /** Cache of default resource strings coming from i18n Manager. */\n private _defaultResourceStrings: T;\n /** Collection containing only custom resource strings provided. Allows for partial override of resource strings. */\n private _customResourceStrings?: T;\n /** Merged collection of custom resource strings and default resource strings. */\n private _resourceStrings?: T;\n\n //#endregion\n\n //#region Public properties\n\n /**\n * Sets a custom locale that overrides the global one for this host component instance.\n * Setting a new locale triggers an update of the resource strings.\n */\n public set locale(value: string | undefined) {\n if (this._locale !== value) {\n this._locale = value;\n this._refreshResourceStrings();\n this._host.requestUpdate();\n }\n }\n\n /**\n * Gets the resolved locale for the host component.\n * This is the component's custom locale if set, otherwise it falls back to the\n * global locale.\n */\n public get locale(): string {\n return this._locale ?? getCurrentI18n();\n }\n\n /**\n * Sets custom resource string for component with this controller.\n * Gets the resolved resource string for component.\n */\n public set resourceStrings(value: T | undefined) {\n if (this._resourceStrings !== value) {\n if (value) {\n this._customResourceStrings = this._resourceMapName\n ? this.getMixedResourceStrings(value)\n : value;\n this._resourceStrings = Object.assign(\n {},\n this._defaultResourceStrings,\n this._customResourceStrings\n );\n } else {\n this._customResourceStrings = value;\n this._resourceStrings = value;\n }\n\n this._host.requestUpdate();\n }\n }\n\n /** Get resolved resource strings for component */\n public get resourceStrings(): T {\n return this._resourceStrings ?? this._defaultResourceStrings;\n }\n\n /** The locale-default format for displaying a date-time value. */\n public get localeDisplayFormat(): string {\n return this._getDateTimeFormats().display;\n }\n\n /**\n * The locale-default format for editing a date-time value - the display\n * format with leading zeros forced, the shape a mask needs.\n */\n public get localeInputFormat(): string {\n return this._getDateTimeFormats().input;\n }\n\n //#endregion\n\n //#region Life-cycle hooks and event listener\n\n constructor(host: I18nControllerHost, config: I18nControllerConfig<T>) {\n this._host = host;\n this._defaultEN = config.defaultEN;\n this._resourceMapName = config.resourceMapName;\n this._resourceChangeCallback = config.onResourceChange;\n\n this._defaultResourceStrings = this._getDefaultResourceStrings();\n getI18nManager().registerI18n(\n this._defaultEN,\n getI18nManager().defaultLocale\n );\n\n this._host.addController(this);\n }\n\n /** @internal */\n public hostConnected(): void {\n getI18nManager().addEventListener('onResourceChange', this);\n\n // A global change while detached went unheard, so the resolved state can\n // be one of a locale that is no longer current.\n this._dateTimeFormats = undefined;\n this._refreshResourceStrings();\n this._host.requestUpdate();\n }\n\n /** @internal */\n public hostDisconnected(): void {\n getI18nManager().removeEventListener('onResourceChange', this);\n }\n\n /** @internal */\n public handleEvent(event: CustomEvent<IResourceChangeEventArgs>): void {\n this._dateTimeFormats = undefined;\n this._refreshResourceStrings();\n this._resourceChangeCallback?.call(this._host, event);\n this._host.requestUpdate();\n }\n\n //#endregion\n\n //#region Internal API\n\n /**\n * Re-resolves the locale defaults and re-applies the custom overrides on top,\n * so the merged strings never keep values resolved for a previous locale.\n */\n private _refreshResourceStrings(): void {\n this._defaultResourceStrings = this._getDefaultResourceStrings();\n\n if (this._customResourceStrings) {\n this._resourceStrings = Object.assign(\n {},\n this._defaultResourceStrings,\n this._customResourceStrings\n );\n }\n }\n\n /**\n * Gets the current, locale-specific resource strings for the component.\n * The logic maps component keys (from defaultEN) to core library keys\n * and retrieves the localized string from the i18n manager.\n *\n * Result is truncated, containing only relevant locale strings.\n */\n private _getDefaultResourceStrings(): T {\n const coreResourceStrings = getI18nManager().getCurrentResourceStrings(\n this.locale\n );\n\n // Get all related resources to the component, based on the default resources.\n const normalizedResourceStrings: T = {} as T;\n const defaultComponentKeys = Object.keys(this._defaultEN) as (keyof T)[];\n for (const key of defaultComponentKeys) {\n let resolvedValue: T[keyof T] = this._defaultEN[key];\n if (key in coreResourceStrings) {\n // For a mix of old and core resources.\n // Only for internal default resources. Users shouldn't mix them.\n resolvedValue = coreResourceStrings[\n key as keyof IResourceStrings\n ] as T[keyof T];\n }\n\n normalizedResourceStrings[key] = resolvedValue;\n }\n\n return this.getMixedResourceStrings(normalizedResourceStrings);\n }\n\n /**\n * Deriving a format string from `Intl` is not free and the date editors\n * consult these on every render, so they are cached against the resolved\n * locale. A global resource change invalidates the cache, since the shared\n * date formatter may have received new locale data.\n */\n private _getDateTimeFormats(): LocaleDateTimeFormats {\n const locale = this.locale;\n\n if (this._dateTimeFormats?.locale !== locale) {\n const formatter = getDateFormatter();\n this._dateTimeFormats = {\n locale,\n display: formatter.getLocaleDateTimeFormat(locale),\n input: formatter.getLocaleDateTimeFormat(locale, true),\n };\n }\n\n return this._dateTimeFormats;\n }\n\n private getMixedResourceStrings(value: T): T {\n if (this._resourceMapName) {\n return Object.assign(\n {},\n convertToCoreResource(value, this._resourceMapName),\n convertToIgcResource(value, this._resourceMapName)\n ) as T;\n }\n return value;\n }\n\n //#endregion\n}\n\n/**\n * Formats a date for display based on the specified format and locale.\n */\ntype DateTimeStyle = 'short' | 'long' | 'medium' | 'full';\n\nconst DATE_TIME_STYLES = new Set<string>(['short', 'long', 'medium', 'full']);\n\nfunction extractStyle(format: string, suffix: string): DateTimeStyle {\n return format.toLowerCase().split(suffix)[0] as DateTimeStyle;\n}\n\n/** Returns the date-time format string with the appropriate suffix if it's a predefined style */\nexport function getDateTimeFormat(\n format?: string,\n suffix: 'Date' | 'Time' = 'Date'\n): string | undefined {\n return format && DATE_TIME_STYLES.has(format) ? `${format}${suffix}` : format;\n}\n\n/**\n * Formats a date for display using the specified format.\n */\nexport function formatDisplayDate(\n value: Date,\n locale: string,\n displayFormat?: string\n): string {\n if (!displayFormat) {\n return getDateFormatter().formatDateTime(value, locale, {});\n }\n\n // Full date+time styles (short, long, medium, full)\n if (DATE_TIME_STYLES.has(displayFormat)) {\n const style = displayFormat as DateTimeStyle;\n return getDateFormatter().formatDateTime(value, locale, {\n dateStyle: style,\n timeStyle: style,\n });\n }\n\n // Date-only styles (shortDate, longDate, etc.)\n if (displayFormat.endsWith('Date')) {\n return getDateFormatter().formatDateTime(value, locale, {\n dateStyle: extractStyle(displayFormat, 'date'),\n });\n }\n\n // Time-only styles (shortTime, longTime, etc.)\n if (displayFormat.endsWith('Time')) {\n return getDateFormatter().formatDateTime(value, locale, {\n timeStyle: extractStyle(displayFormat, 'time'),\n });\n }\n\n // Custom format string\n return getDateFormatter().formatDateCustomFormat(value, displayFormat, {\n locale,\n });\n}\n\n/** Factory function to create and attach the I18nController to a host. */\nexport function addI18nController<T extends object>(\n host: I18nControllerHost,\n config: I18nControllerConfig<T>\n): I18nController<T> {\n return new I18nController<T>(host, config);\n}\n\nexport type { I18nController };\n"]}
|
|
1
|
+
{"version":3,"file":"i18n-controller.js","sourceRoot":"","sources":["../../../src/internals/i18n/i18n-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,GAGf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GAErB,MAAM,YAAY,CAAC;AA0CpB,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAmC,CAAC;AAG3E,MAAM,kBAAkB,GAAG,IAAI,OAAO,EAAU,CAAC;AAMjD,MAAM,cAAc;IA8BlB,IAAW,MAAM,CAAC,KAAyB;QACzC,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;IAMD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,IAAI,cAAc,EAAE,CAAC;IAC1C,CAAC;IAGD,IAAW,eAAe,CAAC,KAAoB;QAC7C,IAAI,IAAI,CAAC,gBAAgB,KAAK,KAAK,EAAE,CAA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,EAAE,KAAK,EAAE,CAAC;IACnD,CAAC;SAAM,IAAI,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1C,OAAO,GAAG,EAAE,SAAS,EAAE,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;IAC/D,CAAC;SAAM,IAAI,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1C,OAAO,GAAG,EAAE,SAAS,EAAE,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;IAC/D,CAAC;SAAM,CAAC;QACN,OAAO,SAAS,CAAC,sBAAsB,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC;AAGD,MAAM,UAAU,iBAAiB,CAC/B,IAAwB,EACxB,MAA+B;IAE/B,OAAO,IAAI,cAAc,CAAI,IAAI,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import {\n getCurrentI18n,\n getDateFormatter,\n getI18nManager,\n type IResourceChangeEventArgs,\n type IResourceStrings,\n} from 'igniteui-i18n-core';\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport {\n convertToCoreResource,\n convertToIgcResource,\n type ResourceMap,\n} from './utils.js';\n\ninterface I18nControllerHost extends ReactiveControllerHost, HTMLElement {\n // Declared by the host, managed by the controller.\n resourceStrings?: unknown;\n locale?: string;\n}\n\ntype ResourceChangeCallback = (\n event: CustomEvent<IResourceChangeEventArgs>\n) => unknown;\n\n/** The date-time formats a locale resolves to, cached against that locale. */\ntype LocaleDateTimeFormats = {\n locale: string;\n display: string;\n input: string;\n};\n\n/** Configuration object for the `I18nController`. */\nexport type I18nControllerConfig<T extends object> = {\n /** Default English resource strings, always from `igniteui-i18n-core`. */\n defaultEN: T;\n /**\n * @deprecated since 7.2.0. The map of the component, if it uses mixed\n * resource strings. To be removed with the deprecated resources.\n */\n resourceMap?: ResourceMap;\n /** Optional callback for a change of the global locale. */\n onResourceChange?: ResourceChangeCallback;\n};\n\n/**\n * The default strings each component resolves, keyed by `defaultEN` and by\n * the core resource object of the locale.\n *\n * @remarks\n * Every instance resolves the same strings through the same key walk and\n * converters, so they share one result. The manager replaces the core\n * resource object on each store, so its identity expires the entry. An event\n * cannot, because `registerI18n` for a non-current locale fires none.\n */\nconst defaultStringsCache = new WeakMap<object, WeakMap<object, object>>();\n\n/** The `defaultEN` objects already registered with the i18n manager. */\nconst registeredDefaults = new WeakSet<object>();\n\n/**\n * Manages the localization (i18n) of a Lit web component, and updates it on\n * a change of the global localization state.\n */\nclass I18nController<T extends object> implements ReactiveController {\n //#region Internal properties and state\n\n private readonly _host: I18nControllerHost;\n private readonly _defaultEN: T;\n /**\n * @deprecated since 7.2.0. The map that converts between the new and the old\n * resource objects.\n */\n private readonly _resourceMap?: ResourceMap;\n private readonly _resourceChangeCallback?: ResourceChangeCallback;\n\n private _locale?: string;\n /** Resolved lazily, and again after a locale or locale data change. */\n private _dateTimeFormats?: LocaleDateTimeFormats;\n /** Cache of the default resource strings from the i18n manager. */\n private _defaultResourceStrings: T;\n /** Only the custom strings, which override a part of the defaults. */\n private _customResourceStrings?: T;\n /** The custom resource strings merged over the default ones. */\n private _resourceStrings?: T;\n\n //#endregion\n\n //#region Public properties\n\n /**\n * Sets a custom locale for this host component instance, which overrides\n * the global locale.\n */\n public set locale(value: string | undefined) {\n if (this._locale !== value) {\n this._locale = value;\n this._refreshResourceStrings();\n this._host.requestUpdate();\n }\n }\n\n /**\n * Gets the resolved locale of the host component: its custom locale, or\n * the global one.\n */\n public get locale(): string {\n return this._locale ?? getCurrentI18n();\n }\n\n /** Sets the custom resource strings of the component. */\n public set resourceStrings(value: T | undefined) {\n if (this._resourceStrings !== value) {\n if (value) {\n this._customResourceStrings = this._resourceMap\n ? this.getMixedResourceStrings(value)\n : value;\n this._resourceStrings = Object.assign(\n {},\n this._defaultResourceStrings,\n this._customResourceStrings\n );\n } else {\n this._customResourceStrings = value;\n this._resourceStrings = value;\n }\n\n this._host.requestUpdate();\n }\n }\n\n /** Gets the resolved resource strings of the component. */\n public get resourceStrings(): T {\n return this._resourceStrings ?? this._defaultResourceStrings;\n }\n\n /** The locale-default format for displaying a date-time value. */\n public get localeDisplayFormat(): string {\n return this._getDateTimeFormats().display;\n }\n\n /**\n * The locale-default format for editing a date-time value: the display\n * format with the leading zeros a mask needs.\n */\n public get localeInputFormat(): string {\n return this._getDateTimeFormats().input;\n }\n\n //#endregion\n\n //#region Life-cycle hooks and event listener\n\n constructor(host: I18nControllerHost, config: I18nControllerConfig<T>) {\n this._host = host;\n this._defaultEN = config.defaultEN;\n this._resourceMap = config.resourceMap;\n this._resourceChangeCallback = config.onResourceChange;\n\n if (!registeredDefaults.has(this._defaultEN)) {\n registeredDefaults.add(this._defaultEN);\n const manager = getI18nManager();\n manager.registerI18n(this._defaultEN, manager.defaultLocale);\n }\n\n this._defaultResourceStrings = this._getDefaultResourceStrings();\n\n this._host.addController(this);\n }\n\n /** @internal */\n public hostConnected(): void {\n getI18nManager().addEventListener('onResourceChange', this);\n\n // Global changes are missed while disconnected, so the resolved state\n // can hold a locale that is no longer current.\n this._dateTimeFormats = undefined;\n this._refreshResourceStrings();\n this._host.requestUpdate();\n }\n\n /** @internal */\n public hostDisconnected(): void {\n getI18nManager().removeEventListener('onResourceChange', this);\n }\n\n /** @internal */\n public handleEvent(event: CustomEvent<IResourceChangeEventArgs>): void {\n this._dateTimeFormats = undefined;\n this._refreshResourceStrings();\n this._resourceChangeCallback?.call(this._host, event);\n this._host.requestUpdate();\n }\n\n //#endregion\n\n //#region Internal API\n\n /**\n * Resolves the locale defaults again, then applies the custom overrides, so\n * that the merged strings keep no value of an earlier locale.\n */\n private _refreshResourceStrings(): void {\n this._defaultResourceStrings = this._getDefaultResourceStrings();\n\n if (this._customResourceStrings) {\n this._resourceStrings = Object.assign(\n {},\n this._defaultResourceStrings,\n this._customResourceStrings\n );\n }\n }\n\n /**\n * The resource strings of the component for the current locale.\n *\n * @remarks\n * Maps the `defaultEN` keys to the core library keys, and reads each string\n * from the i18n manager. Each instance gets the same result, so the result is\n * cached. See {@link defaultStringsCache}.\n */\n private _getDefaultResourceStrings(): T {\n const coreResourceStrings = getI18nManager().getCurrentResourceStrings(\n this.locale\n );\n\n let perResources = defaultStringsCache.get(this._defaultEN);\n\n if (!perResources) {\n perResources = new WeakMap();\n defaultStringsCache.set(this._defaultEN, perResources);\n }\n\n let strings = perResources.get(coreResourceStrings) as T | undefined;\n\n if (!strings) {\n const normalizedResourceStrings: T = {} as T;\n const defaultComponentKeys = Object.keys(this._defaultEN) as (keyof T)[];\n for (const key of defaultComponentKeys) {\n let resolvedValue: T[keyof T] = this._defaultEN[key];\n if (key in coreResourceStrings) {\n // Internal defaults only. A user must not mix old and core\n // resources.\n resolvedValue = coreResourceStrings[\n key as keyof IResourceStrings\n ] as T[keyof T];\n }\n\n normalizedResourceStrings[key] = resolvedValue;\n }\n\n strings = this.getMixedResourceStrings(normalizedResourceStrings);\n perResources.set(coreResourceStrings, strings);\n }\n\n // A copy per instance, because the cached object is shared.\n return { ...strings };\n }\n\n /**\n * The date-time formats of the resolved locale.\n *\n * @remarks\n * An `Intl` format string is expensive, and the date editors read these on\n * each render, so they are cached against the locale. A global resource\n * change clears the cache, because the shared date formatter can then hold\n * new locale data.\n */\n private _getDateTimeFormats(): LocaleDateTimeFormats {\n const locale = this.locale;\n\n if (this._dateTimeFormats?.locale !== locale) {\n const formatter = getDateFormatter();\n this._dateTimeFormats = {\n locale,\n display: formatter.getLocaleDateTimeFormat(locale),\n input: formatter.getLocaleDateTimeFormat(locale, true),\n };\n }\n\n return this._dateTimeFormats;\n }\n\n private getMixedResourceStrings(value: T): T {\n const map = this._resourceMap;\n\n if (map) {\n return Object.assign(\n {},\n convertToCoreResource(value, map),\n convertToIgcResource(value, map)\n ) as T;\n }\n return value;\n }\n\n //#endregion\n}\n\ntype DateTimeStyle = 'short' | 'long' | 'medium' | 'full';\n\nconst DATE_TIME_STYLES = new Set<string>(['short', 'long', 'medium', 'full']);\n\nfunction extractStyle(format: string, suffix: string): DateTimeStyle {\n return format.toLowerCase().split(suffix)[0] as DateTimeStyle;\n}\n\n/** Returns the date-time format string with a predefined style suffix. */\nexport function getDateTimeFormat(\n format?: string,\n suffix: 'Date' | 'Time' = 'Date'\n): string | undefined {\n return format && DATE_TIME_STYLES.has(format) ? `${format}${suffix}` : format;\n}\n\nexport function formatDisplayDate(\n value: Date,\n locale: string,\n displayFormat?: string\n): string {\n const formatter = getDateFormatter();\n let options: Intl.DateTimeFormatOptions;\n\n if (!displayFormat) {\n options = {};\n } else if (DATE_TIME_STYLES.has(displayFormat)) {\n const style = displayFormat as DateTimeStyle;\n options = { dateStyle: style, timeStyle: style };\n } else if (displayFormat.endsWith('Date')) {\n options = { dateStyle: extractStyle(displayFormat, 'date') };\n } else if (displayFormat.endsWith('Time')) {\n options = { timeStyle: extractStyle(displayFormat, 'time') };\n } else {\n return formatter.formatDateCustomFormat(value, displayFormat, { locale });\n }\n\n return formatter.formatDateTime(value, locale, options);\n}\n\n/** Creates an `I18nController`, and adds it to the host. */\nexport function addI18nController<T extends object>(\n host: I18nControllerHost,\n config: I18nControllerConfig<T>\n): I18nController<T> {\n return new I18nController<T>(host, config);\n}\n\nexport type { I18nController };\n"]}
|
|
@@ -3,11 +3,16 @@ import type { IgcCalendarResourceStrings } from './EN/calendar.resources.js';
|
|
|
3
3
|
import type { IgcChatResourceStrings } from './EN/chat.resources.js';
|
|
4
4
|
import type { IgcDatePickerResourceStrings } from './EN/date-picker.resources.js';
|
|
5
5
|
import type { IgcDateRangePickerResourceStrings } from './EN/date-range-picker.resources.js';
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Maps the resource keys of a component to the keys of the core library. An
|
|
8
|
+
* `undefined` core key has no counterpart in the core resources.
|
|
9
|
+
*/
|
|
10
|
+
export type ResourceMap = ReadonlyMap<string, string | undefined>;
|
|
8
11
|
export declare const calendarResourcesMap: Map<keyof IgcCalendarResourceStrings, string | undefined>;
|
|
9
12
|
export declare const chatResourcesMap: Map<keyof IgcChatResourceStrings, string>;
|
|
10
13
|
export declare const dateRangePickerResourcesMap: Map<keyof IgcDateRangePickerResourceStrings, string | undefined>;
|
|
11
14
|
export declare const datePickerResourcesMap: Map<keyof IgcDatePickerResourceStrings, string | undefined>;
|
|
12
|
-
|
|
13
|
-
export declare function
|
|
15
|
+
/** Converts core resource strings to the deprecated shape via `resourceMap`. */
|
|
16
|
+
export declare function convertToIgcResource<T extends object>(resource: IResourceStrings, resourceMap: ResourceMap): T;
|
|
17
|
+
/** Converts the deprecated shape to core resource strings via `resourceMap`. */
|
|
18
|
+
export declare function convertToCoreResource<T extends object>(resource: T, resourceMap: ResourceMap): IResourceStrings;
|
package/internals/i18n/utils.js
CHANGED
|
@@ -33,34 +33,15 @@ export const dateRangePickerResourcesMap = new Map([
|
|
|
33
33
|
['last30Days', 'date_range_picker_last30Days'],
|
|
34
34
|
['currentMonth', 'date_range_picker_currentMonth'],
|
|
35
35
|
['yearToDate', 'date_range_picker_yearToDate'],
|
|
36
|
-
...calendarResourcesMap
|
|
36
|
+
...calendarResourcesMap,
|
|
37
37
|
]);
|
|
38
38
|
export const datePickerResourcesMap = new Map([
|
|
39
39
|
['changeDate', 'date_picker_change_date'],
|
|
40
40
|
['chooseDate', 'date_picker_choose_date'],
|
|
41
|
-
...calendarResourcesMap
|
|
41
|
+
...calendarResourcesMap,
|
|
42
42
|
]);
|
|
43
|
-
function
|
|
44
|
-
switch (name) {
|
|
45
|
-
case 'calendar':
|
|
46
|
-
return calendarResourcesMap;
|
|
47
|
-
case 'chat':
|
|
48
|
-
return chatResourcesMap;
|
|
49
|
-
case 'date-picker':
|
|
50
|
-
return datePickerResourcesMap;
|
|
51
|
-
case 'date-range-picker':
|
|
52
|
-
return dateRangePickerResourcesMap;
|
|
53
|
-
default:
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
return new Map();
|
|
57
|
-
}
|
|
58
|
-
export function convertToIgcResource(resource, resourceMapName) {
|
|
43
|
+
export function convertToIgcResource(resource, resourceMap) {
|
|
59
44
|
const result = {};
|
|
60
|
-
const resourceMap = getResourceMap(resourceMapName);
|
|
61
|
-
if (!resourceMap) {
|
|
62
|
-
return resource;
|
|
63
|
-
}
|
|
64
45
|
for (const [igcKey, coreKey] of resourceMap) {
|
|
65
46
|
if (igcKey in resource) {
|
|
66
47
|
result[igcKey] = resource[igcKey];
|
|
@@ -74,12 +55,8 @@ export function convertToIgcResource(resource, resourceMapName) {
|
|
|
74
55
|
}
|
|
75
56
|
return result;
|
|
76
57
|
}
|
|
77
|
-
export function convertToCoreResource(resource,
|
|
58
|
+
export function convertToCoreResource(resource, resourceMap) {
|
|
78
59
|
const result = {};
|
|
79
|
-
const resourceMap = getResourceMap(resourceMapName);
|
|
80
|
-
if (!resourceMap) {
|
|
81
|
-
return resource;
|
|
82
|
-
}
|
|
83
60
|
for (const [igcKey, coreKey] of resourceMap) {
|
|
84
61
|
if (coreKey && coreKey in resource) {
|
|
85
62
|
result[coreKey] = resource[coreKey];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/internals/i18n/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/internals/i18n/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAY7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAGzC;IACA,CAAC,aAAa,EAAE,uBAAuB,CAAC;IACxC,CAAC,YAAY,EAAE,sBAAsB,CAAC;IACtC,CAAC,YAAY,EAA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YACpD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { IResourceStrings } from 'igniteui-i18n-core';\nimport { isString } from '../utils/types.js';\nimport type { IgcCalendarResourceStrings } from './EN/calendar.resources.js';\nimport type { IgcChatResourceStrings } from './EN/chat.resources.js';\nimport type { IgcDatePickerResourceStrings } from './EN/date-picker.resources.js';\nimport type { IgcDateRangePickerResourceStrings } from './EN/date-range-picker.resources.js';\n\n/**\n * Maps the resource keys of a component to the keys of the core library. An\n * `undefined` core key has no counterpart in the core resources.\n */\nexport type ResourceMap = ReadonlyMap<string, string | undefined>;\n\nexport const calendarResourcesMap = new Map<\n keyof IgcCalendarResourceStrings,\n string | undefined\n>([\n ['selectMonth', 'calendar_select_month'],\n ['selectYear', 'calendar_select_year'],\n ['selectDate', 'calendar_select_date'],\n ['selectRange', 'calendar_range_placeholder'],\n ['selectedDate', undefined], // This key is not in use.\n ['startDate', 'calendar_range_label_start'],\n ['endDate', 'calendar_range_label_end'],\n ['previousMonth', 'calendar_previous_month'],\n ['nextMonth', 'calendar_next_month'],\n ['previousYear', 'calendar_previous_year'],\n ['nextYear', 'calendar_next_year'],\n ['previousYears', 'calendar_previous_years'],\n ['nextYears', 'calendar_next_years'],\n ['weekLabel', 'i18n/getWeekLabel'],\n]);\n\nexport const chatResourcesMap = new Map<keyof IgcChatResourceStrings, string>([\n ['suggestionsHeader', 'chat_suggestions_header'],\n ['reactionCopy', 'chat_reaction_copy'],\n ['reactionLike', 'chat_reaction_like'],\n ['reactionDislike', 'chat_reaction_dislike'],\n ['reactionRegenerate', 'chat_reaction_regenerate'],\n ['attachmentLabel', 'chat_attachment_label'],\n ['attachmentsListLabel', 'chat_attachments_list_label'],\n ['messageCopied', 'chat_message_copied'],\n]);\n\nexport const dateRangePickerResourcesMap = new Map<\n keyof IgcDateRangePickerResourceStrings,\n string | undefined\n>([\n ['separator', 'date_range_picker_date_separator'],\n ['done', 'date_range_picker_done_button'],\n ['cancel', 'date_range_picker_cancel_button'],\n ['last7Days', 'date_range_picker_last7Days'],\n ['last30Days', 'date_range_picker_last30Days'],\n ['currentMonth', 'date_range_picker_currentMonth'],\n ['yearToDate', 'date_range_picker_yearToDate'],\n ...calendarResourcesMap,\n]);\n\nexport const datePickerResourcesMap = new Map<\n keyof IgcDatePickerResourceStrings,\n string | undefined\n>([\n ['changeDate', 'date_picker_change_date'],\n ['chooseDate', 'date_picker_choose_date'],\n ...calendarResourcesMap,\n]);\n\n/** Converts core resource strings to the deprecated shape via `resourceMap`. */\nexport function convertToIgcResource<T extends object>(\n resource: IResourceStrings,\n resourceMap: ResourceMap\n): T {\n const result = {} as T;\n\n for (const [igcKey, coreKey] of resourceMap) {\n if (igcKey in resource) {\n result[igcKey as keyof T] = resource[\n igcKey as keyof IResourceStrings\n ] as T[keyof T];\n } else if (coreKey && coreKey in resource) {\n const value = resource[coreKey as keyof IResourceStrings];\n if (isString(value)) {\n result[igcKey as keyof T] = value as T[keyof T];\n }\n }\n }\n\n return result;\n}\n\n/** Converts the deprecated shape to core resource strings via `resourceMap`. */\nexport function convertToCoreResource<T extends object>(\n resource: T,\n resourceMap: ResourceMap\n): IResourceStrings {\n const result: IResourceStrings = {};\n\n for (const [igcKey, coreKey] of resourceMap) {\n if (coreKey && coreKey in resource) {\n result[coreKey as keyof IResourceStrings] = resource[\n coreKey as keyof T\n ] as string;\n } else if (coreKey) {\n const value = resource[igcKey as keyof T];\n if (isString(value)) {\n result[coreKey as keyof IResourceStrings] = value;\n }\n }\n }\n\n return result;\n}\n"]}
|
|
@@ -4,21 +4,21 @@ export declare abstract class IgcBaseAlertLikeComponent extends LitElement {
|
|
|
4
4
|
protected readonly _player: import("#animations/player.js").AnimationController;
|
|
5
5
|
private readonly _autoHideTimer;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Sets the open state of the component.
|
|
8
8
|
*
|
|
9
9
|
* @attr open
|
|
10
10
|
* @default false
|
|
11
11
|
*/
|
|
12
12
|
open: boolean;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Sets the time in milliseconds that the component stays visible.
|
|
15
15
|
*
|
|
16
16
|
* @attr display-time
|
|
17
17
|
* @default 4000
|
|
18
18
|
*/
|
|
19
19
|
displayTime: number;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Keeps the component open after the `displayTime` is over.
|
|
22
22
|
*
|
|
23
23
|
* @attr keep-open
|
|
24
24
|
* @default false
|
|
@@ -27,10 +27,6 @@ export declare abstract class IgcBaseAlertLikeComponent extends LitElement {
|
|
|
27
27
|
/**
|
|
28
28
|
* Sets the position of the component in the viewport.
|
|
29
29
|
*
|
|
30
|
-
* `bottom` - positions the component at the bottom. This is the default.
|
|
31
|
-
* `middle` - positions the component at the center.
|
|
32
|
-
* `top` - positions the component at the top.
|
|
33
|
-
*
|
|
34
30
|
* @attr position
|
|
35
31
|
* @default 'bottom'
|
|
36
32
|
*/
|
|
@@ -38,8 +34,9 @@ export declare abstract class IgcBaseAlertLikeComponent extends LitElement {
|
|
|
38
34
|
/**
|
|
39
35
|
* Sets the positioning strategy of the component.
|
|
40
36
|
*
|
|
41
|
-
* `viewport` - positions
|
|
42
|
-
* `container` - positions
|
|
37
|
+
* `viewport` - positions against the viewport, ignoring every ancestor.
|
|
38
|
+
* `container` - positions inside the bounding box of the closest visible
|
|
39
|
+
* ancestor, at the place that `position` sets.
|
|
43
40
|
*
|
|
44
41
|
* @attr positioning
|
|
45
42
|
* @default 'viewport'
|
|
@@ -52,24 +49,12 @@ export declare abstract class IgcBaseAlertLikeComponent extends LitElement {
|
|
|
52
49
|
private _setOpenState;
|
|
53
50
|
private _setAutoHideTimer;
|
|
54
51
|
/**
|
|
55
|
-
* Opens the component.
|
|
56
|
-
*
|
|
57
|
-
* Returns a promise that resolves to `true` if the component was successfully opened, or `false`
|
|
58
|
-
* if it was already open or could not be shown (e.g., in `container` positioning mode with no visible ancestors).
|
|
52
|
+
* Opens the component. Resolves to `false` when it is already open, or
|
|
53
|
+
* when `container` positioning finds no visible ancestor.
|
|
59
54
|
*/
|
|
60
55
|
show(): Promise<boolean>;
|
|
61
|
-
/**
|
|
62
|
-
* Closes the component.
|
|
63
|
-
*
|
|
64
|
-
* Returns a promise that resolves to `true` if the component was successfully closed, or `false`
|
|
65
|
-
* if it was already closed.
|
|
66
|
-
*/
|
|
56
|
+
/** Closes the component. Resolves to `false` when it is already closed. */
|
|
67
57
|
hide(): Promise<boolean>;
|
|
68
|
-
/**
|
|
69
|
-
* Toggles the open state of the component.
|
|
70
|
-
*
|
|
71
|
-
* Returns a promise that resolves to `true` if the operation completed successfully, or `false`
|
|
72
|
-
* if it was already in the desired state.
|
|
73
|
-
*/
|
|
58
|
+
/** Toggles the component. Resolves to `true` when the state changed. */
|
|
74
59
|
toggle(): Promise<boolean>;
|
|
75
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../src/internals/mixins/alert.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAKpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGpE,MAAM,OAAgB,yBAA0B,SAAQ,UAAU;
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../src/internals/mixins/alert.ts"],"names":[],"mappings":";;;;;;AAAA,OA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C,MAAM;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/C,CAAC;CACF;AApJQ;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDACvB;AASb;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;8DAC5B;AASnB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;2DAC3C;AASjB;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2DACiB;AAatC;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8DAC6B","sourcesContent":["import { LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { addAnimationController } from '#animations/player.js';\nimport { fadeIn, fadeOut } from '#animations/presets/fade/index.js';\nimport type {\n AbsolutePosition,\n NotificationPositioning,\n} from '../../components/types.js';\nimport { addCommandController } from '../controllers/command.js';\nimport { addInternalsController } from '../controllers/internals.js';\nimport { createTimer } from '../timing.js';\nimport { getVisibleAncestor, isPopoverOpen } from '../utils/dom.js';\n\n/* omitModule */\nexport abstract class IgcBaseAlertLikeComponent extends LitElement {\n protected readonly _player = addAnimationController(this);\n\n private readonly _autoHideTimer = createTimer(() => this.hide());\n\n /**\n * Sets the open state of the component.\n *\n * @attr open\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * Sets the time in milliseconds that the component stays visible.\n *\n * @attr display-time\n * @default 4000\n */\n @property({ type: Number, attribute: 'display-time' })\n public displayTime = 4000;\n\n /**\n * Keeps the component open after the `displayTime` is over.\n *\n * @attr keep-open\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'keep-open' })\n public keepOpen = false;\n\n /**\n * Sets the position of the component in the viewport.\n *\n * @attr position\n * @default 'bottom'\n */\n @property({ reflect: true })\n public position: AbsolutePosition = 'bottom';\n\n /**\n * Sets the positioning strategy of the component.\n *\n * `viewport` - positions against the viewport, ignoring every ancestor.\n * `container` - positions inside the bounding box of the closest visible\n * ancestor, at the place that `position` sets.\n *\n * @attr positioning\n * @default 'viewport'\n */\n @property({ reflect: true })\n public positioning: NotificationPositioning = 'viewport';\n\n constructor() {\n super();\n\n addCommandController(this)\n .set('--show', this.show)\n .set('--hide', this.hide)\n .set('--toggle', this.toggle);\n\n addInternalsController(this, {\n initialARIA: {\n role: 'status',\n ariaLive: 'polite',\n },\n });\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.popover = 'manual';\n }\n\n protected override update(props: PropertyValues<this>): void {\n if (props.has('open')) {\n if (this.open && !isPopoverOpen(this)) {\n this._showPopover();\n } else if (!this.open && isPopoverOpen(this)) {\n this.hidePopover();\n }\n }\n\n if (this.open && (props.has('positioning') || props.has('position'))) {\n this.hidePopover();\n this._showPopover();\n }\n\n if (\n props.has('open') ||\n props.has('displayTime') ||\n props.has('keepOpen')\n ) {\n this._setAutoHideTimer();\n }\n\n super.update(props);\n }\n\n private _showPopover(): boolean {\n if (this.positioning !== 'container') {\n this.showPopover();\n return true;\n }\n\n const visibleAncestor = getVisibleAncestor(this);\n if (!visibleAncestor) {\n return false;\n }\n\n this.showPopover({ source: visibleAncestor });\n return true;\n }\n\n private async _setOpenState(open: boolean): Promise<boolean> {\n if (open) {\n this.open = true;\n\n if (!this._showPopover()) {\n this.open = false;\n return false;\n }\n\n const state = await this._player.playExclusive(fadeIn());\n this._setAutoHideTimer();\n return state;\n }\n\n this._autoHideTimer.stop();\n const state = await this._player.playExclusive(fadeOut());\n this.hidePopover();\n this.open = false;\n return state;\n }\n\n private _setAutoHideTimer(): void {\n this._autoHideTimer.stop();\n if (this.open && this.displayTime > 0 && !this.keepOpen) {\n this._autoHideTimer.start(this.displayTime);\n }\n }\n\n /**\n * Opens the component. Resolves to `false` when it is already open, or\n * when `container` positioning finds no visible ancestor.\n */\n public async show(): Promise<boolean> {\n return this.open ? false : this._setOpenState(true);\n }\n\n /** Closes the component. Resolves to `false` when it is already closed. */\n public async hide(): Promise<boolean> {\n return this.open ? this._setOpenState(false) : false;\n }\n\n /** Toggles the component. Resolves to `true` when the state changed. */\n public async toggle(): Promise<boolean> {\n return this.open ? this.hide() : this.show();\n }\n}\n"]}
|