@aceshooting/lyra-ui 1.2.0 → 2.1.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/README.md +98 -14
- package/custom-elements.json +30279 -12124
- package/dist/components/app-rail/app-rail-item.d.ts +30 -0
- package/dist/components/app-rail/app-rail-item.js +68 -0
- package/dist/components/app-rail/app-rail-item.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail-item.styles.js +65 -0
- package/dist/components/app-rail/app-rail.d.ts +168 -0
- package/dist/components/app-rail/app-rail.js +419 -0
- package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail.styles.js +128 -0
- package/dist/components/attachment-chip/attachment-chip.d.ts +141 -0
- package/dist/components/attachment-chip/attachment-chip.js +356 -0
- package/dist/components/attachment-chip/attachment-chip.styles.d.ts +1 -0
- package/dist/components/attachment-chip/attachment-chip.styles.js +184 -0
- package/dist/components/attachment-trigger/attachment-trigger.d.ts +96 -0
- package/dist/components/attachment-trigger/attachment-trigger.js +270 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.js +90 -0
- package/dist/components/chart/bar-chart.js +2 -18
- package/dist/components/chart/box-plot.d.ts +25 -1
- package/dist/components/chart/box-plot.js +147 -7
- package/dist/components/chart/box-plot.styles.js +13 -0
- package/dist/components/chart/bubble-chart.js +2 -18
- package/dist/components/chart/chart-loader.d.ts +44 -13
- package/dist/components/chart/chart-loader.js +65 -18
- package/dist/components/chart/chart.d.ts +55 -12
- package/dist/components/chart/chart.js +247 -49
- package/dist/components/chart/doughnut-chart.js +2 -18
- package/dist/components/chart/histogram-bin.d.ts +7 -1
- package/dist/components/chart/histogram-bin.js +32 -14
- package/dist/components/chart/histogram.js +8 -16
- package/dist/components/chart/line-chart.js +2 -18
- package/dist/components/chart/lite-chart.d.ts +134 -3
- package/dist/components/chart/lite-chart.js +382 -67
- package/dist/components/chart/lite-chart.styles.js +9 -0
- package/dist/components/chart/pie-chart.js +2 -18
- package/dist/components/chart/polar-area-chart.js +2 -18
- package/dist/components/chart/radar-chart.js +2 -18
- package/dist/components/chart/scatter-chart.js +2 -18
- package/dist/components/chat-composer/chat-composer.d.ts +133 -0
- package/dist/components/chat-composer/chat-composer.js +366 -0
- package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
- package/dist/components/chat-composer/chat-composer.styles.js +145 -0
- package/dist/components/chat-message/chat-message.d.ts +141 -0
- package/dist/components/chat-message/chat-message.js +331 -0
- package/dist/components/chat-message/chat-message.styles.d.ts +1 -0
- package/dist/components/chat-message/chat-message.styles.js +203 -0
- package/dist/components/checkbox/checkbox.d.ts +117 -0
- package/dist/components/checkbox/checkbox.js +353 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
- package/dist/components/checkbox/checkbox.styles.js +77 -0
- package/dist/components/chip/chip-group.d.ts +56 -0
- package/dist/components/chip/chip-group.js +130 -0
- package/dist/components/chip/chip-group.styles.d.ts +1 -0
- package/dist/components/chip/chip-group.styles.js +57 -0
- package/dist/components/chip/chip.d.ts +64 -0
- package/dist/components/chip/chip.js +122 -0
- package/dist/components/chip/chip.styles.d.ts +1 -0
- package/dist/components/chip/chip.styles.js +115 -0
- package/dist/components/citation-badge/citation-badge.d.ts +113 -0
- package/dist/components/citation-badge/citation-badge.js +318 -0
- package/dist/components/citation-badge/citation-badge.styles.d.ts +1 -0
- package/dist/components/citation-badge/citation-badge.styles.js +96 -0
- package/dist/components/code-block/code-block.d.ts +127 -0
- package/dist/components/code-block/code-block.js +382 -0
- package/dist/components/code-block/code-block.styles.d.ts +1 -0
- package/dist/components/code-block/code-block.styles.js +187 -0
- package/dist/components/code-block/code-loader.d.ts +87 -0
- package/dist/components/code-block/code-loader.js +142 -0
- package/dist/components/combobox/combobox.d.ts +65 -6
- package/dist/components/combobox/combobox.js +258 -48
- package/dist/components/combobox/combobox.styles.js +3 -3
- package/dist/components/combobox/option.d.ts +5 -1
- package/dist/components/combobox/option.js +35 -0
- package/dist/components/context-meter/context-meter.d.ts +53 -0
- package/dist/components/context-meter/context-meter.js +159 -0
- package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
- package/dist/components/context-meter/context-meter.styles.js +114 -0
- package/dist/components/conversation-item/conversation-item.d.ts +125 -0
- package/dist/components/conversation-item/conversation-item.js +331 -0
- package/dist/components/conversation-item/conversation-item.styles.d.ts +1 -0
- package/dist/components/conversation-item/conversation-item.styles.js +155 -0
- package/dist/components/date-picker/calendar-core.d.ts +24 -0
- package/dist/components/date-picker/calendar-core.js +51 -4
- package/dist/components/date-picker/date-input.d.ts +100 -9
- package/dist/components/date-picker/date-input.js +383 -66
- package/dist/components/date-picker/date-picker.d.ts +35 -4
- package/dist/components/date-picker/date-picker.js +171 -44
- package/dist/components/dialog/confirm.d.ts +40 -0
- package/dist/components/dialog/confirm.js +76 -0
- package/dist/components/dialog/dialog.d.ts +129 -0
- package/dist/components/dialog/dialog.js +288 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +96 -0
- package/dist/components/dock-panel/dock-panel.d.ts +142 -0
- package/dist/components/dock-panel/dock-panel.js +359 -0
- package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
- package/dist/components/dock-panel/dock-panel.styles.js +159 -0
- package/dist/components/document-preview/document-preview.d.ts +143 -0
- package/dist/components/document-preview/document-preview.js +388 -0
- package/dist/components/document-preview/document-preview.styles.d.ts +1 -0
- package/dist/components/document-preview/document-preview.styles.js +191 -0
- package/dist/components/empty/empty.d.ts +1 -2
- package/dist/components/empty/empty.js +18 -12
- package/dist/components/empty/empty.styles.js +0 -3
- package/dist/components/export-button/csv.js +1 -1
- package/dist/components/export-button/export-button.d.ts +12 -0
- package/dist/components/export-button/export-button.js +35 -5
- package/dist/components/export-button/export-button.styles.js +5 -1
- package/dist/components/file-input/accept.js +2 -0
- package/dist/components/file-input/file-input.d.ts +10 -1
- package/dist/components/file-input/file-input.js +36 -5
- package/dist/components/flag/flag.d.ts +29 -13
- package/dist/components/flag/flag.js +54 -14
- package/dist/components/flag/flag.styles.js +1 -1
- package/dist/components/flag/language-map.d.ts +4 -1
- package/dist/components/flag/language-map.js +6 -3
- package/dist/components/gauge/gauge.d.ts +10 -1
- package/dist/components/gauge/gauge.js +41 -13
- package/dist/components/generation-status/generation-status.d.ts +117 -0
- package/dist/components/generation-status/generation-status.js +327 -0
- package/dist/components/generation-status/generation-status.styles.d.ts +1 -0
- package/dist/components/generation-status/generation-status.styles.js +84 -0
- package/dist/components/graph/graph.d.ts +37 -3
- package/dist/components/graph/graph.js +132 -20
- package/dist/components/heatmap/calendar-grid.d.ts +19 -7
- package/dist/components/heatmap/calendar-grid.js +42 -18
- package/dist/components/heatmap/heatmap-scale.d.ts +11 -1
- package/dist/components/heatmap/heatmap-scale.js +14 -2
- package/dist/components/heatmap/heatmap.d.ts +227 -12
- package/dist/components/heatmap/heatmap.js +488 -93
- package/dist/components/json-viewer/json-viewer.d.ts +70 -0
- package/dist/components/json-viewer/json-viewer.js +361 -0
- package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
- package/dist/components/json-viewer/json-viewer.styles.js +177 -0
- package/dist/components/kbd/kbd.d.ts +77 -0
- package/dist/components/kbd/kbd.js +231 -0
- package/dist/components/kbd/kbd.styles.d.ts +1 -0
- package/dist/components/kbd/kbd.styles.js +52 -0
- package/dist/components/live-region/live-region.d.ts +90 -0
- package/dist/components/live-region/live-region.js +189 -0
- package/dist/components/live-region/live-region.styles.d.ts +1 -0
- package/dist/components/live-region/live-region.styles.js +10 -0
- package/dist/components/map/map.d.ts +32 -7
- package/dist/components/map/map.js +133 -32
- package/dist/components/markdown/markdown-loader.d.ts +58 -0
- package/dist/components/markdown/markdown-loader.js +77 -0
- package/dist/components/markdown/markdown.d.ts +119 -0
- package/dist/components/markdown/markdown.js +389 -0
- package/dist/components/markdown/markdown.styles.d.ts +1 -0
- package/dist/components/markdown/markdown.styles.js +88 -0
- package/dist/components/media-card/media-card.d.ts +130 -0
- package/dist/components/media-card/media-card.js +273 -0
- package/dist/components/media-card/media-card.styles.d.ts +1 -0
- package/dist/components/media-card/media-card.styles.js +132 -0
- package/dist/components/mention-popover/mention-popover.d.ts +203 -0
- package/dist/components/mention-popover/mention-popover.js +493 -0
- package/dist/components/mention-popover/mention-popover.styles.d.ts +1 -0
- package/dist/components/mention-popover/mention-popover.styles.js +101 -0
- package/dist/components/menu/menu-item.d.ts +91 -0
- package/dist/components/menu/menu-item.js +206 -0
- package/dist/components/menu/menu-item.styles.d.ts +1 -0
- package/dist/components/menu/menu-item.styles.js +75 -0
- package/dist/components/menu/menu.d.ts +167 -0
- package/dist/components/menu/menu.js +461 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +67 -0
- package/dist/components/model-select/model-select.d.ts +170 -0
- package/dist/components/model-select/model-select.js +588 -0
- package/dist/components/model-select/model-select.styles.d.ts +1 -0
- package/dist/components/model-select/model-select.styles.js +203 -0
- package/dist/components/model-settings-panel/model-settings-panel.d.ts +93 -0
- package/dist/components/model-settings-panel/model-settings-panel.js +209 -0
- package/dist/components/model-settings-panel/model-settings-panel.styles.d.ts +1 -0
- package/dist/components/model-settings-panel/model-settings-panel.styles.js +82 -0
- package/dist/components/playback/playback.d.ts +19 -3
- package/dist/components/playback/playback.js +109 -33
- package/dist/components/playback/playback.styles.js +6 -1
- package/dist/components/responsive-panel/responsive-panel.d.ts +163 -0
- package/dist/components/responsive-panel/responsive-panel.js +363 -0
- package/dist/components/responsive-panel/responsive-panel.styles.d.ts +1 -0
- package/dist/components/responsive-panel/responsive-panel.styles.js +103 -0
- package/dist/components/result-card/result-card.d.ts +50 -0
- package/dist/components/result-card/result-card.js +89 -0
- package/dist/components/result-card/result-card.styles.d.ts +1 -0
- package/dist/components/result-card/result-card.styles.js +49 -0
- package/dist/components/result-card/result-field.d.ts +36 -0
- package/dist/components/result-card/result-field.js +87 -0
- package/dist/components/result-card/result-field.styles.d.ts +1 -0
- package/dist/components/result-card/result-field.styles.js +32 -0
- package/dist/components/select/select.d.ts +84 -4
- package/dist/components/select/select.js +251 -36
- package/dist/components/skeleton/skeleton.d.ts +3 -0
- package/dist/components/skeleton/skeleton.js +7 -1
- package/dist/components/skeleton/skeleton.styles.js +5 -4
- package/dist/components/slider/slider.d.ts +141 -0
- package/dist/components/slider/slider.js +467 -0
- package/dist/components/slider/slider.styles.d.ts +1 -0
- package/dist/components/slider/slider.styles.js +87 -0
- package/dist/components/source-card/source-card.d.ts +104 -0
- package/dist/components/source-card/source-card.js +195 -0
- package/dist/components/source-card/source-card.styles.d.ts +1 -0
- package/dist/components/source-card/source-card.styles.js +69 -0
- package/dist/components/source-list/source-list.d.ts +63 -0
- package/dist/components/source-list/source-list.js +130 -0
- package/dist/components/source-list/source-list.styles.d.ts +1 -0
- package/dist/components/source-list/source-list.styles.js +59 -0
- package/dist/components/sparkline/sparkline.js +58 -20
- package/dist/components/split/split.d.ts +224 -5
- package/dist/components/split/split.js +617 -43
- package/dist/components/split/split.styles.js +47 -0
- package/dist/components/stat/stat.d.ts +15 -4
- package/dist/components/stat/stat.js +53 -12
- package/dist/components/stream-status/stream-status.d.ts +126 -0
- package/dist/components/stream-status/stream-status.js +292 -0
- package/dist/components/stream-status/stream-status.styles.d.ts +1 -0
- package/dist/components/stream-status/stream-status.styles.js +103 -0
- package/dist/components/streaming-text/streaming-text.d.ts +104 -0
- package/dist/components/streaming-text/streaming-text.js +224 -0
- package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
- package/dist/components/streaming-text/streaming-text.styles.js +63 -0
- package/dist/components/switch/switch.d.ts +103 -0
- package/dist/components/switch/switch.js +250 -0
- package/dist/components/switch/switch.styles.d.ts +1 -0
- package/dist/components/switch/switch.styles.js +75 -0
- package/dist/components/table/table.d.ts +89 -5
- package/dist/components/table/table.js +243 -26
- package/dist/components/table/table.styles.js +6 -1
- package/dist/components/tabs/tabs.d.ts +74 -0
- package/dist/components/tabs/tabs.js +254 -0
- package/dist/components/tabs/tabs.styles.d.ts +1 -0
- package/dist/components/tabs/tabs.styles.js +74 -0
- package/dist/components/thinking-panel/thinking-panel.d.ts +123 -0
- package/dist/components/thinking-panel/thinking-panel.js +260 -0
- package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
- package/dist/components/thinking-panel/thinking-panel.styles.js +123 -0
- package/dist/components/time-range/time-range.d.ts +59 -2
- package/dist/components/time-range/time-range.js +163 -67
- package/dist/components/toast/toast-item.d.ts +12 -2
- package/dist/components/toast/toast-item.js +106 -44
- package/dist/components/toast/toast-item.styles.js +59 -28
- package/dist/components/toast/toast.js +17 -5
- package/dist/components/toast/toaster.js +10 -1
- package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +131 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.js +329 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.d.ts +1 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.js +160 -0
- package/dist/components/tool-call-chip/tool-call-chip.d.ts +105 -0
- package/dist/components/tool-call-chip/tool-call-chip.js +349 -0
- package/dist/components/tool-call-chip/tool-call-chip.styles.d.ts +1 -0
- package/dist/components/tool-call-chip/tool-call-chip.styles.js +203 -0
- package/dist/components/tool-param-form/tool-param-form.d.ts +206 -0
- package/dist/components/tool-param-form/tool-param-form.js +610 -0
- package/dist/components/tool-param-form/tool-param-form.styles.d.ts +1 -0
- package/dist/components/tool-param-form/tool-param-form.styles.js +75 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.d.ts +122 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.js +358 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.styles.d.ts +1 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.styles.js +176 -0
- package/dist/components/tool-result-view/registry.d.ts +73 -0
- package/dist/components/tool-result-view/registry.js +89 -0
- package/dist/components/tool-result-view/tool-result-view.d.ts +58 -0
- package/dist/components/tool-result-view/tool-result-view.js +152 -0
- package/dist/components/tool-result-view/tool-result-view.styles.d.ts +1 -0
- package/dist/components/tool-result-view/tool-result-view.styles.js +13 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.d.ts +151 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.js +350 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.styles.d.ts +1 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.styles.js +191 -0
- package/dist/components/tree/tree-node.d.ts +15 -3
- package/dist/components/tree/tree-node.js +20 -7
- package/dist/components/tree/tree.d.ts +25 -10
- package/dist/components/tree/tree.js +39 -31
- package/dist/components/typing-indicator/typing-indicator.d.ts +70 -0
- package/dist/components/typing-indicator/typing-indicator.js +108 -0
- package/dist/components/typing-indicator/typing-indicator.styles.d.ts +1 -0
- package/dist/components/typing-indicator/typing-indicator.styles.js +132 -0
- package/dist/components/virtual-list/virtual-list.d.ts +210 -0
- package/dist/components/virtual-list/virtual-list.js +607 -0
- package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
- package/dist/components/virtual-list/virtual-list.styles.js +56 -0
- package/dist/components/widget/widget.d.ts +5 -4
- package/dist/components/widget/widget.js +54 -120
- package/dist/components/widget/widget.styles.js +8 -2
- package/dist/components/word-cloud/word-cloud-layout.d.ts +7 -0
- package/dist/components/word-cloud/word-cloud-layout.js +29 -2
- package/dist/components/word-cloud/word-cloud.d.ts +28 -2
- package/dist/components/word-cloud/word-cloud.js +69 -19
- package/dist/components/word-cloud/word-cloud.styles.js +16 -3
- package/dist/internal/anchored-validity.d.ts +1 -0
- package/dist/internal/anchored-validity.js +86 -0
- package/dist/internal/announcer.d.ts +57 -0
- package/dist/internal/announcer.js +71 -0
- package/dist/internal/form-associated.d.ts +8 -0
- package/dist/internal/form-associated.js +98 -15
- package/dist/internal/group-by-recency.d.ts +50 -0
- package/dist/internal/group-by-recency.js +80 -0
- package/dist/internal/numbers.d.ts +12 -0
- package/dist/internal/numbers.js +26 -0
- package/dist/internal/overlay-manager.d.ts +51 -0
- package/dist/internal/overlay-manager.js +523 -0
- package/dist/internal/positioner.js +27 -3
- package/dist/internal/rtl.d.ts +23 -0
- package/dist/internal/rtl.js +28 -0
- package/dist/internal/safe-url.d.ts +12 -0
- package/dist/internal/safe-url.js +41 -0
- package/dist/internal/scroll-lock.d.ts +10 -5
- package/dist/internal/scroll-lock.js +30 -14
- package/dist/internal/tokens.styles.js +22 -10
- package/dist/lyra.d.ts +133 -31
- package/dist/lyra.js +96 -26
- package/llms-full.txt +4546 -183
- package/llms.txt +21 -5
- package/package.json +41 -6
- package/dist/components/chart/bar-chart.stories.d.ts +0 -5
- package/dist/components/chart/bar-chart.stories.js +0 -20
- package/dist/components/chart/box-plot.stories.d.ts +0 -5
- package/dist/components/chart/box-plot.stories.js +0 -29
- package/dist/components/chart/bubble-chart.stories.d.ts +0 -5
- package/dist/components/chart/bubble-chart.stories.js +0 -26
- package/dist/components/chart/chart.stories.d.ts +0 -32
- package/dist/components/chart/chart.stories.js +0 -141
- package/dist/components/chart/doughnut-chart.stories.d.ts +0 -5
- package/dist/components/chart/doughnut-chart.stories.js +0 -26
- package/dist/components/chart/histogram.stories.d.ts +0 -5
- package/dist/components/chart/histogram.stories.js +0 -17
- package/dist/components/chart/line-chart.stories.d.ts +0 -22
- package/dist/components/chart/line-chart.stories.js +0 -99
- package/dist/components/chart/lite-chart.stories.d.ts +0 -14
- package/dist/components/chart/lite-chart.stories.js +0 -114
- package/dist/components/chart/pie-chart.stories.d.ts +0 -5
- package/dist/components/chart/pie-chart.stories.js +0 -26
- package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
- package/dist/components/chart/polar-area-chart.stories.js +0 -20
- package/dist/components/chart/radar-chart.stories.d.ts +0 -5
- package/dist/components/chart/radar-chart.stories.js +0 -20
- package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
- package/dist/components/chart/scatter-chart.stories.js +0 -31
- package/dist/components/combobox/combobox.stories.d.ts +0 -24
- package/dist/components/combobox/combobox.stories.js +0 -102
- package/dist/components/date-picker/date-input.stories.d.ts +0 -10
- package/dist/components/date-picker/date-input.stories.js +0 -48
- package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
- package/dist/components/date-picker/date-picker.stories.js +0 -25
- package/dist/components/empty/empty.stories.d.ts +0 -7
- package/dist/components/empty/empty.stories.js +0 -34
- package/dist/components/export-button/export-button.stories.d.ts +0 -7
- package/dist/components/export-button/export-button.stories.js +0 -37
- package/dist/components/file-input/file-input.stories.d.ts +0 -7
- package/dist/components/file-input/file-input.stories.js +0 -19
- package/dist/components/flag/flag.stories.d.ts +0 -6
- package/dist/components/flag/flag.stories.js +0 -31
- package/dist/components/gauge/gauge.stories.d.ts +0 -8
- package/dist/components/gauge/gauge.stories.js +0 -19
- package/dist/components/graph/graph.stories.d.ts +0 -8
- package/dist/components/graph/graph.stories.js +0 -68
- package/dist/components/heatmap/heatmap.stories.d.ts +0 -27
- package/dist/components/heatmap/heatmap.stories.js +0 -179
- package/dist/components/map/map.stories.d.ts +0 -15
- package/dist/components/map/map.stories.js +0 -135
- package/dist/components/playback/playback.stories.d.ts +0 -7
- package/dist/components/playback/playback.stories.js +0 -16
- package/dist/components/select/select.stories.d.ts +0 -21
- package/dist/components/select/select.stories.js +0 -91
- package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
- package/dist/components/skeleton/skeleton.stories.js +0 -16
- package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
- package/dist/components/sparkline/sparkline.stories.js +0 -39
- package/dist/components/split/split.stories.d.ts +0 -7
- package/dist/components/split/split.stories.js +0 -36
- package/dist/components/stat/stat.stories.d.ts +0 -9
- package/dist/components/stat/stat.stories.js +0 -81
- package/dist/components/table/table.stories.d.ts +0 -12
- package/dist/components/table/table.stories.js +0 -67
- package/dist/components/time-range/time-range.stories.d.ts +0 -8
- package/dist/components/time-range/time-range.stories.js +0 -26
- package/dist/components/toast/toast.stories.d.ts +0 -8
- package/dist/components/toast/toast.stories.js +0 -72
- package/dist/components/tree/tree.stories.d.ts +0 -9
- package/dist/components/tree/tree.stories.js +0 -52
- package/dist/components/widget/widget.stories.d.ts +0 -9
- package/dist/components/widget/widget.stories.js +0 -74
- package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
- package/dist/components/word-cloud/word-cloud.stories.js +0 -55
|
@@ -9,6 +9,7 @@ import { property } from 'lit/decorators.js';
|
|
|
9
9
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
10
|
import { defineElement } from '../../internal/prefix.js';
|
|
11
11
|
import { isRtl } from '../../internal/rtl.js';
|
|
12
|
+
import { finiteNumber, finiteRange } from '../../internal/numbers.js';
|
|
12
13
|
import { styles } from './time-range.styles.js';
|
|
13
14
|
function isArrowKey(key) {
|
|
14
15
|
return key === 'ArrowRight' || key === 'ArrowUp' || key === 'ArrowLeft' || key === 'ArrowDown';
|
|
@@ -22,14 +23,17 @@ function isSliderKey(key) {
|
|
|
22
23
|
* step, matching the WAI-ARIA APG slider pattern's expected keyboard
|
|
23
24
|
* interactions (and native `<input type=range>`). */
|
|
24
25
|
const PAGE_STEP_MULTIPLIER = 10;
|
|
25
|
-
/** Number of decimal
|
|
26
|
-
* `0.1` -> 1, `5` -> 0. Used to round a stepped value back
|
|
27
|
-
* the caller's `step` itself implies, instead of leaving
|
|
28
|
-
* binary floating-point noise `value / step` happened to
|
|
26
|
+
/** Number of decimal places implied by `n`, including exponent notation.
|
|
27
|
+
* `0.1` -> 1, `5` -> 0, and `1e-7` -> 7. Used to round a stepped value back
|
|
28
|
+
* to the precision the caller's `step` itself implies, instead of leaving
|
|
29
|
+
* it at whatever binary floating-point noise `value / step` happened to
|
|
30
|
+
* produce. */
|
|
29
31
|
function decimalPlaces(n) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
if (!Number.isFinite(n) || n === 0)
|
|
33
|
+
return 0;
|
|
34
|
+
const [mantissa, exponentText] = n.toExponential().split('e');
|
|
35
|
+
const mantissaPlaces = mantissa.includes('.') ? mantissa.length - mantissa.indexOf('.') - 1 : 0;
|
|
36
|
+
return Math.max(0, mantissaPlaces - Number(exponentText));
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* `<lyra-time-range>` — a two-handle brush/scrubber over a numeric domain.
|
|
@@ -41,26 +45,72 @@ function decimalPlaces(n) {
|
|
|
41
45
|
* shortcut that sets both handles at once, the continuous brush underneath
|
|
42
46
|
* is unaffected and both interaction modes coexist.
|
|
43
47
|
*
|
|
48
|
+
* Form-associated (via a directly-attached `ElementInternals`, mirroring
|
|
49
|
+
* `<lyra-combobox>`'s minimal pattern rather than the single-string-value
|
|
50
|
+
* `FormAssociated` mixin, which doesn't fit a two-handle range): an ancestor
|
|
51
|
+
* `<fieldset disabled>` disables both handles and every preset button
|
|
52
|
+
* through `effectiveDisabled`, the same way it would a native `<input>`,
|
|
53
|
+
* without touching the consumer-facing `disabled` property/attribute itself.
|
|
54
|
+
*
|
|
44
55
|
* @customElement lyra-time-range
|
|
45
56
|
* @event lyra-input - Fired continuously while dragging or on each arrow-key press. `detail: { start, end }`.
|
|
46
57
|
* @event lyra-change - Fired on release / keyup-commit, or when a preset button is clicked. `detail: { start, end }`.
|
|
47
|
-
* @csspart base
|
|
58
|
+
* @csspart base - The time-range wrapper.
|
|
59
|
+
* @csspart track - The complete range track.
|
|
60
|
+
* @csspart range - The selected range.
|
|
61
|
+
* @csspart handle-start - The start handle.
|
|
62
|
+
* @csspart handle-end - The end handle.
|
|
63
|
+
* @csspart presets - The preset controls wrapper.
|
|
64
|
+
* @csspart preset-button - A preset button.
|
|
48
65
|
*/
|
|
49
66
|
export class LyraTimeRange extends LyraElement {
|
|
67
|
+
static { this.formAssociated = true; }
|
|
68
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
69
|
+
static { this.properties = {
|
|
70
|
+
// Hand-written accessor (see the `get`/`set disabled` pair below)
|
|
71
|
+
// instead of a plain `@property({ reflect: true })`: this element is
|
|
72
|
+
// form-associated, and the browser invokes `formDisabledCallback`
|
|
73
|
+
// synchronously for *this element's own* `disabled` attribute changes
|
|
74
|
+
// too, not only for an ancestor `<fieldset disabled>` toggling. A plain
|
|
75
|
+
// reflecting property defers its attribute write into the async Lit
|
|
76
|
+
// update cycle, so that browser callback would otherwise fire nested
|
|
77
|
+
// *inside* this same element's own in-progress update -- the
|
|
78
|
+
// `requestUpdate()` it triggers (to pick up `_fieldsetDisabled`) then
|
|
79
|
+
// races Lit's own scheduling and can resolve `updateComplete` before the
|
|
80
|
+
// corrected value actually renders. Reflecting the attribute
|
|
81
|
+
// synchronously, right in the setter (mirrors `<lyra-combobox>`'s and
|
|
82
|
+
// `FormAssociated`'s identical `disabled` accessor), makes the browser
|
|
83
|
+
// invoke that callback *before* any Lit update even starts, so it never
|
|
84
|
+
// interleaves with one.
|
|
85
|
+
disabled: { type: Boolean, reflect: true, noAccessor: true },
|
|
86
|
+
}; }
|
|
50
87
|
constructor() {
|
|
51
|
-
super(
|
|
88
|
+
super();
|
|
52
89
|
this.min = 0;
|
|
53
90
|
this.max = 100;
|
|
54
91
|
this.start = 0;
|
|
55
92
|
this.end = 100;
|
|
56
93
|
this.step = 1;
|
|
57
|
-
|
|
94
|
+
/** Accessible name for the start handle, used as its `aria-label`.
|
|
95
|
+
* Overridable for i18n/custom copy; defaults to the same literal text
|
|
96
|
+
* this component always rendered before the property existed. */
|
|
97
|
+
this.startLabel = 'Range start';
|
|
98
|
+
/** Accessible name for the end handle, used as its `aria-label`.
|
|
99
|
+
* Overridable for i18n/custom copy; defaults to the same literal text
|
|
100
|
+
* this component always rendered before the property existed. */
|
|
101
|
+
this.endLabel = 'Range end';
|
|
58
102
|
/**
|
|
59
103
|
* Optional discrete presets rendered as a `[part="presets"]` button row
|
|
60
104
|
* above the track. Purely additive: leaving this empty (the default)
|
|
61
105
|
* renders nothing extra and leaves the continuous brush untouched.
|
|
62
106
|
*/
|
|
63
107
|
this.presets = [];
|
|
108
|
+
this._disabled = false;
|
|
109
|
+
// Tracked separately from the consumer's own `disabled` -- a fieldset
|
|
110
|
+
// cascade must never mutate that IDL property/attribute itself (mirrors
|
|
111
|
+
// combobox.ts's/slider.ts's identical `_fieldsetDisabled`/
|
|
112
|
+
// `effectiveDisabled` pattern), only the combined getter below.
|
|
113
|
+
this._fieldsetDisabled = false;
|
|
64
114
|
// Keyed by pointerId rather than a single scalar so two concurrent drags
|
|
65
115
|
// (e.g. a two-finger touch, one per handle) each keep tracking their own
|
|
66
116
|
// handle instead of the second pointerdown hijacking which handle the
|
|
@@ -69,12 +119,14 @@ export class LyraTimeRange extends LyraElement {
|
|
|
69
119
|
this.onKeyDown = (handle, e) => {
|
|
70
120
|
// A handle that already has focus when the component becomes disabled
|
|
71
121
|
// must not still respond to arrow keys (new pointerdowns are already
|
|
72
|
-
// blocked by the `if (this.
|
|
73
|
-
// and disabled handles carry `tabindex="-1"`, but a
|
|
74
|
-
// can bypass both of those).
|
|
75
|
-
if (this.
|
|
122
|
+
// blocked by the `if (this.effectiveDisabled) return;` guard in
|
|
123
|
+
// onPointerDown, and disabled handles carry `tabindex="-1"`, but a
|
|
124
|
+
// pre-existing focus can bypass both of those).
|
|
125
|
+
if (this.effectiveDisabled)
|
|
76
126
|
return;
|
|
77
|
-
const current = handle === 'start'
|
|
127
|
+
const current = handle === 'start'
|
|
128
|
+
? finiteRange(this.start, this.domain().lo)
|
|
129
|
+
: finiteRange(this.end, this.domain().hi);
|
|
78
130
|
// Mirror the same left/right swap as onPointerMove: under RTL, physical
|
|
79
131
|
// ArrowRight moves toward inset-inline-start, i.e. a lower value.
|
|
80
132
|
const rtl = isRtl(this);
|
|
@@ -109,12 +161,12 @@ export class LyraTimeRange extends LyraElement {
|
|
|
109
161
|
// Only commit on release of the keys that onKeyDown acts on — releasing
|
|
110
162
|
// an unrelated key (Tab, Shift, ...) while a handle happens to be
|
|
111
163
|
// focused must not emit a spurious lyra-change.
|
|
112
|
-
if (this.
|
|
164
|
+
if (this.effectiveDisabled || !isSliderKey(e.key))
|
|
113
165
|
return;
|
|
114
166
|
this.emit('lyra-change', { start: this.start, end: this.end });
|
|
115
167
|
};
|
|
116
168
|
this.onPointerDown = (handle, e) => {
|
|
117
|
-
if (this.
|
|
169
|
+
if (this.effectiveDisabled)
|
|
118
170
|
return;
|
|
119
171
|
const base = this.renderRoot.querySelector('[part="base"]');
|
|
120
172
|
this.drags.set(e.pointerId, { handle, base });
|
|
@@ -134,15 +186,15 @@ export class LyraTimeRange extends LyraElement {
|
|
|
134
186
|
const drag = this.drags.get(e.pointerId);
|
|
135
187
|
if (drag === undefined)
|
|
136
188
|
return;
|
|
137
|
-
if (this.
|
|
189
|
+
if (this.effectiveDisabled) {
|
|
138
190
|
// These are window-level listeners driven by setPointerCapture, so
|
|
139
191
|
// they keep firing for this pointerId regardless of any CSS on the
|
|
140
192
|
// host (this was already true even back when the host used
|
|
141
193
|
// `pointer-events: none`, since that never governed an
|
|
142
194
|
// already-captured window listener) — a drag already in progress
|
|
143
195
|
// would otherwise keep mutating start/end (and emitting lyra-input)
|
|
144
|
-
// after `disabled` flips true mid-drag.
|
|
145
|
-
// continuing to process it.
|
|
196
|
+
// after `disabled` (or an ancestor fieldset) flips true mid-drag.
|
|
197
|
+
// Abort the drag instead of continuing to process it.
|
|
146
198
|
this.endDrag(e.pointerId, false);
|
|
147
199
|
return;
|
|
148
200
|
}
|
|
@@ -152,14 +204,41 @@ export class LyraTimeRange extends LyraElement {
|
|
|
152
204
|
// right edge under RTL), so the pointer ratio has to mirror that or a
|
|
153
205
|
// rightward drag would move the handle the wrong way.
|
|
154
206
|
const ratio = Math.min(1, Math.max(0, isRtl(this) ? 1 - raw : raw));
|
|
155
|
-
const
|
|
207
|
+
const { lo, hi } = this.domain();
|
|
208
|
+
const value = lo + ratio * (hi - lo);
|
|
156
209
|
this.setValue(drag.handle, value, false);
|
|
157
210
|
};
|
|
158
211
|
this.onPointerUp = (e) => {
|
|
159
212
|
this.endDrag(e.pointerId, true);
|
|
160
213
|
};
|
|
214
|
+
this.internals = this.attachInternals();
|
|
215
|
+
}
|
|
216
|
+
get disabled() {
|
|
217
|
+
return this._disabled;
|
|
218
|
+
}
|
|
219
|
+
set disabled(next) {
|
|
220
|
+
const old = this._disabled;
|
|
221
|
+
this._disabled = Boolean(next);
|
|
222
|
+
this.toggleAttribute('disabled', this._disabled);
|
|
223
|
+
this.requestUpdate('disabled', old);
|
|
224
|
+
}
|
|
225
|
+
/** Effective disabled state: this element's own `disabled` OR an ancestor
|
|
226
|
+
* `<fieldset disabled>`'s inherited state -- mirrors native `<input>`,
|
|
227
|
+
* whose own `disabled` IDL property/attribute is never mutated by a
|
|
228
|
+
* fieldset. */
|
|
229
|
+
get effectiveDisabled() {
|
|
230
|
+
return this.disabled || this._fieldsetDisabled;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Called by the browser when an ancestor `<fieldset disabled>` toggles.
|
|
234
|
+
* Tracked separately from the consumer's own `disabled` (see
|
|
235
|
+
* `effectiveDisabled`) so a consumer's explicit `disabled` survives the
|
|
236
|
+
* fieldset re-enabling instead of being permanently overwritten.
|
|
237
|
+
*/
|
|
238
|
+
formDisabledCallback(disabled) {
|
|
239
|
+
this._fieldsetDisabled = disabled;
|
|
240
|
+
this.requestUpdate();
|
|
161
241
|
}
|
|
162
|
-
static { this.styles = [LyraElement.styles, styles]; }
|
|
163
242
|
disconnectedCallback() {
|
|
164
243
|
super.disconnectedCallback();
|
|
165
244
|
// Mirror lyra-split's cleanup: if the element is removed mid-drag (or a
|
|
@@ -184,8 +263,8 @@ export class LyraTimeRange extends LyraElement {
|
|
|
184
263
|
// percentOf()/clamp() caller. Mirror lyra-gauge's `ratio` getter, which
|
|
185
264
|
// short-circuits on isNaN(...) instead, by falling back to this
|
|
186
265
|
// property's own default.
|
|
187
|
-
const min =
|
|
188
|
-
const max =
|
|
266
|
+
const min = finiteNumber(this.min, 0);
|
|
267
|
+
const max = finiteNumber(this.max, 100);
|
|
189
268
|
return { lo: Math.min(min, max), hi: Math.max(min, max) };
|
|
190
269
|
}
|
|
191
270
|
percentOf(value) {
|
|
@@ -193,11 +272,10 @@ export class LyraTimeRange extends LyraElement {
|
|
|
193
272
|
// the rendered `inset-inline-start:NaN%` — that's an invalid CSS value
|
|
194
273
|
// the browser silently drops, leaving the handle stuck with no visible
|
|
195
274
|
// recovery. 0% is at least a stable, well-defined position.
|
|
196
|
-
if (isNaN(value))
|
|
197
|
-
return 0;
|
|
198
275
|
const { lo, hi } = this.domain();
|
|
276
|
+
const safeValue = finiteRange(value, lo, lo, hi);
|
|
199
277
|
const span = hi - lo || 1;
|
|
200
|
-
return ((
|
|
278
|
+
return ((safeValue - lo) / span) * 100;
|
|
201
279
|
}
|
|
202
280
|
/** Each handle's actual reachable sub-range, bounded by its sibling
|
|
203
281
|
* handle's current value the same way clamp() already enforces it — used
|
|
@@ -209,8 +287,8 @@ export class LyraTimeRange extends LyraElement {
|
|
|
209
287
|
// A NaN sibling value (e.g. an invalid `end` attribute) must not leak
|
|
210
288
|
// into the *other* handle's aria-valuemin/aria-valuemax as a literal
|
|
211
289
|
// "NaN" — fall back to the domain bound it would otherwise report.
|
|
212
|
-
const start =
|
|
213
|
-
const end =
|
|
290
|
+
const start = finiteRange(this.start, lo, lo, hi);
|
|
291
|
+
const end = finiteRange(this.end, hi, lo, hi);
|
|
214
292
|
return handle === 'start' ? { min: lo, max: end } : { min: start, max: hi };
|
|
215
293
|
}
|
|
216
294
|
clamp(handle, value) {
|
|
@@ -220,7 +298,6 @@ export class LyraTimeRange extends LyraElement {
|
|
|
220
298
|
// zero/NaN below and permanently poison start/end with NaN, since the
|
|
221
299
|
// other handle's clamp cross-references this one's (already-NaN) value.
|
|
222
300
|
// Treat it as "unstepped" instead of propagating NaN.
|
|
223
|
-
const hasStep = Number.isFinite(this.step) && this.step > 0;
|
|
224
301
|
// Anchor the step grid at the domain's own `lo` (matching native
|
|
225
302
|
// `<input type=range>`) instead of absolute 0 — otherwise a `min` that
|
|
226
303
|
// isn't itself a multiple of `step` makes the very first nudge off `min`
|
|
@@ -229,16 +306,17 @@ export class LyraTimeRange extends LyraElement {
|
|
|
229
306
|
// (rather than leaving raw `value / step` binary-float noise in place)
|
|
230
307
|
// so repeated steps land on exact values like 20.1 instead of
|
|
231
308
|
// 20.200000000000003.
|
|
232
|
-
let stepped = value;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
|
|
309
|
+
let stepped = finiteNumber(value, lo);
|
|
310
|
+
const step = finiteRange(this.step, 0, 0);
|
|
311
|
+
if (Number.isFinite(step) && step > 0) {
|
|
312
|
+
const stepsFromLo = Math.round((stepped - lo) / step);
|
|
313
|
+
const factor = 10 ** decimalPlaces(step);
|
|
314
|
+
stepped = Math.round((lo + stepsFromLo * step) * factor) / factor;
|
|
237
315
|
}
|
|
238
316
|
const bounded = Math.min(hi, Math.max(lo, stepped));
|
|
239
317
|
if (handle === 'start')
|
|
240
|
-
return Math.min(bounded, this.end);
|
|
241
|
-
return Math.max(bounded, this.start);
|
|
318
|
+
return Math.min(bounded, finiteRange(this.end, hi, lo, hi));
|
|
319
|
+
return Math.max(bounded, finiteRange(this.start, lo, lo, hi));
|
|
242
320
|
}
|
|
243
321
|
setValue(handle, value, commit) {
|
|
244
322
|
const clamped = this.clamp(handle, value);
|
|
@@ -253,22 +331,28 @@ export class LyraTimeRange extends LyraElement {
|
|
|
253
331
|
/**
|
|
254
332
|
* Apply a discrete preset: sets both handles and emits the same
|
|
255
333
|
* lyra-input/lyra-change pair a committed drag or keyboard step would.
|
|
334
|
+
*
|
|
335
|
+
* Deliberately bypasses `setValue()`/`clamp()` — a preset is an explicit
|
|
336
|
+
* discrete jump to the caller's own exact numbers, not a stepped nudge, so
|
|
337
|
+
* routing it through `clamp()`'s step-grid rounding would silently round
|
|
338
|
+
* a preset's values away from what the caller specified (and desync the
|
|
339
|
+
* active-button match in render(), which compares against these exact
|
|
340
|
+
* numbers). Only the domain bounds and the start<=end invariant apply
|
|
341
|
+
* here, not `step`. Both handles are also assigned before either event
|
|
342
|
+
* fires — routing them through two sequential `setValue()` calls instead
|
|
343
|
+
* would emit an extra lyra-input whose detail still held the stale
|
|
344
|
+
* pre-preset value for whichever handle hadn't been assigned yet.
|
|
256
345
|
*/
|
|
257
346
|
applyPreset(preset) {
|
|
258
|
-
if (this.
|
|
347
|
+
if (this.effectiveDisabled)
|
|
259
348
|
return;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
// land on the preset's exact values regardless of direction.
|
|
268
|
-
this.start = Math.min(this.start, preset.start);
|
|
269
|
-
this.end = Math.max(this.end, preset.end);
|
|
270
|
-
this.setValue('start', preset.start, false);
|
|
271
|
-
this.setValue('end', preset.end, true);
|
|
349
|
+
const { lo, hi } = this.domain();
|
|
350
|
+
const start = finiteRange(preset.start, lo, lo, hi);
|
|
351
|
+
const end = finiteRange(preset.end, hi, lo, hi);
|
|
352
|
+
this.start = Math.min(start, end);
|
|
353
|
+
this.end = Math.max(start, end);
|
|
354
|
+
this.emit('lyra-input', { start: this.start, end: this.end });
|
|
355
|
+
this.emit('lyra-change', { start: this.start, end: this.end });
|
|
272
356
|
}
|
|
273
357
|
/** Stop the drag owned by `pointerId`, optionally committing a final lyra-change. */
|
|
274
358
|
endDrag(pointerId, commit) {
|
|
@@ -298,20 +382,25 @@ export class LyraTimeRange extends LyraElement {
|
|
|
298
382
|
// the track, since percentOf() would otherwise produce <0%/>100%.
|
|
299
383
|
// Guard against a caller passing min > max so the bounds themselves
|
|
300
384
|
// stay well-formed.
|
|
301
|
-
const lo =
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
385
|
+
const { lo, hi } = this.domain();
|
|
386
|
+
if (Number.isFinite(this.start))
|
|
387
|
+
this.start = finiteRange(this.start, lo, lo, hi);
|
|
388
|
+
if (Number.isFinite(this.end))
|
|
389
|
+
this.end = finiteRange(this.end, hi, lo, hi);
|
|
305
390
|
}
|
|
306
391
|
// Keep start <= end regardless of which side changed (a controlled
|
|
307
392
|
// caller may set only `end`, e.g. two-way-binding an external store).
|
|
308
393
|
// The handle that just moved wins; the other side is pulled to meet it,
|
|
309
394
|
// mirroring the direction `clamp()` already uses during interactive
|
|
310
395
|
// dragging.
|
|
311
|
-
if (changed.has('start') || changed.has('min') || changed.has('max'))
|
|
396
|
+
if ((changed.has('start') || changed.has('min') || changed.has('max')) &&
|
|
397
|
+
Number.isFinite(this.start) &&
|
|
398
|
+
Number.isFinite(this.end)) {
|
|
312
399
|
this.start = Math.min(this.start, this.end);
|
|
313
400
|
}
|
|
314
|
-
if (changed.has('end') || changed.has('min') || changed.has('max'))
|
|
401
|
+
if ((changed.has('end') || changed.has('min') || changed.has('max')) &&
|
|
402
|
+
Number.isFinite(this.start) &&
|
|
403
|
+
Number.isFinite(this.end)) {
|
|
315
404
|
this.end = Math.max(this.end, this.start);
|
|
316
405
|
}
|
|
317
406
|
}
|
|
@@ -328,7 +417,7 @@ export class LyraTimeRange extends LyraElement {
|
|
|
328
417
|
return html `<button
|
|
329
418
|
part="preset-button"
|
|
330
419
|
type="button"
|
|
331
|
-
?disabled=${this.
|
|
420
|
+
?disabled=${this.effectiveDisabled}
|
|
332
421
|
aria-pressed=${active ? 'true' : 'false'}
|
|
333
422
|
?data-active=${active}
|
|
334
423
|
@click=${() => this.applyPreset(preset)}
|
|
@@ -347,12 +436,14 @@ export class LyraTimeRange extends LyraElement {
|
|
|
347
436
|
<div
|
|
348
437
|
part="handle-start"
|
|
349
438
|
role="slider"
|
|
350
|
-
tabindex=${this.
|
|
351
|
-
aria-label
|
|
352
|
-
aria-disabled=${this.
|
|
439
|
+
tabindex=${this.effectiveDisabled ? '-1' : '0'}
|
|
440
|
+
aria-label=${this.startLabel}
|
|
441
|
+
aria-disabled=${this.effectiveDisabled ? 'true' : nothing}
|
|
353
442
|
aria-valuemin=${startBounds.min}
|
|
354
443
|
aria-valuemax=${startBounds.max}
|
|
355
|
-
aria-valuenow=${
|
|
444
|
+
aria-valuenow=${Number.isFinite(this.start)
|
|
445
|
+
? finiteRange(this.start, startBounds.min, startBounds.min, startBounds.max)
|
|
446
|
+
: nothing}
|
|
356
447
|
style=${`inset-inline-start:${startPct}%`}
|
|
357
448
|
@pointerdown=${(e) => this.onPointerDown('start', e)}
|
|
358
449
|
@keydown=${(e) => this.onKeyDown('start', e)}
|
|
@@ -361,12 +452,14 @@ export class LyraTimeRange extends LyraElement {
|
|
|
361
452
|
<div
|
|
362
453
|
part="handle-end"
|
|
363
454
|
role="slider"
|
|
364
|
-
tabindex=${this.
|
|
365
|
-
aria-label
|
|
366
|
-
aria-disabled=${this.
|
|
455
|
+
tabindex=${this.effectiveDisabled ? '-1' : '0'}
|
|
456
|
+
aria-label=${this.endLabel}
|
|
457
|
+
aria-disabled=${this.effectiveDisabled ? 'true' : nothing}
|
|
367
458
|
aria-valuemin=${endBounds.min}
|
|
368
459
|
aria-valuemax=${endBounds.max}
|
|
369
|
-
aria-valuenow=${
|
|
460
|
+
aria-valuenow=${Number.isFinite(this.end)
|
|
461
|
+
? finiteRange(this.end, endBounds.min, endBounds.min, endBounds.max)
|
|
462
|
+
: nothing}
|
|
370
463
|
style=${`inset-inline-start:${endPct}%`}
|
|
371
464
|
@pointerdown=${(e) => this.onPointerDown('end', e)}
|
|
372
465
|
@keydown=${(e) => this.onKeyDown('end', e)}
|
|
@@ -392,8 +485,11 @@ __decorate([
|
|
|
392
485
|
property({ type: Number })
|
|
393
486
|
], LyraTimeRange.prototype, "step", void 0);
|
|
394
487
|
__decorate([
|
|
395
|
-
property({
|
|
396
|
-
], LyraTimeRange.prototype, "
|
|
488
|
+
property({ attribute: 'start-label' })
|
|
489
|
+
], LyraTimeRange.prototype, "startLabel", void 0);
|
|
490
|
+
__decorate([
|
|
491
|
+
property({ attribute: 'end-label' })
|
|
492
|
+
], LyraTimeRange.prototype, "endLabel", void 0);
|
|
397
493
|
__decorate([
|
|
398
494
|
property({ attribute: false })
|
|
399
495
|
], LyraTimeRange.prototype, "presets", void 0);
|
|
@@ -34,11 +34,12 @@ export declare class LyraToastItem extends LyraElement {
|
|
|
34
34
|
private startedAt;
|
|
35
35
|
private timerStarted;
|
|
36
36
|
private showRafId?;
|
|
37
|
-
private
|
|
38
|
-
private
|
|
37
|
+
private cancelShowAnimation?;
|
|
38
|
+
private cancelHideAnimation?;
|
|
39
39
|
private hovering;
|
|
40
40
|
private focused;
|
|
41
41
|
private hiding;
|
|
42
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
42
43
|
protected updated(changed: PropertyValues): void;
|
|
43
44
|
firstUpdated(): void;
|
|
44
45
|
disconnectedCallback(): void;
|
|
@@ -46,6 +47,15 @@ export declare class LyraToastItem extends LyraElement {
|
|
|
46
47
|
private resumeTimer;
|
|
47
48
|
private pauseTimer;
|
|
48
49
|
private clearTimer;
|
|
50
|
+
/**
|
|
51
|
+
* Wait for the actual CSS transition/animation on the toast surface. The
|
|
52
|
+
* computed duration is intentionally read at runtime so a consumer's
|
|
53
|
+
* `--lyra-toast-show-duration`/`--lyra-toast-hide-duration` override keeps
|
|
54
|
+
* lifecycle events and removal in sync with the pixels on screen. A small
|
|
55
|
+
* timeout remains as a safety net for zero-duration transitions, disabled
|
|
56
|
+
* animation, and browsers that do not dispatch an end event.
|
|
57
|
+
*/
|
|
58
|
+
private waitForVisualCompletion;
|
|
49
59
|
private onPointerEnter;
|
|
50
60
|
private onPointerLeave;
|
|
51
61
|
private onFocusIn;
|
|
@@ -10,23 +10,19 @@ import { LyraElement } from '../../internal/lyra-element.js';
|
|
|
10
10
|
import { defineElement } from '../../internal/prefix.js';
|
|
11
11
|
import { closeIcon } from '../../internal/icons.js';
|
|
12
12
|
import { styles } from './toast-item.styles.js';
|
|
13
|
-
// Must stay in sync with --lyra-transition-base's 180ms fallback
|
|
14
|
-
// (internal/tokens.styles.ts) — toast-item.styles.ts derives
|
|
15
|
-
// --show-duration/--hide-duration from that same token. Kept as a literal
|
|
16
|
-
// here rather than read via getComputedStyle() because the token's value is
|
|
17
|
-
// a full transition shorthand ("180ms ease-out"), not a bare duration, and
|
|
18
|
-
// parsing that back out in JS for a single setTimeout would be more fragile
|
|
19
|
-
// than this documented literal.
|
|
20
|
-
const ANIM_MS = 180;
|
|
21
13
|
function prefersReducedMotion() {
|
|
22
14
|
return typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
|
|
23
15
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
function parseTime(value) {
|
|
17
|
+
const trimmed = value.trim();
|
|
18
|
+
if (trimmed.endsWith('ms'))
|
|
19
|
+
return Number.parseFloat(trimmed);
|
|
20
|
+
if (trimmed.endsWith('s'))
|
|
21
|
+
return Number.parseFloat(trimmed) * 1000;
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
function maxCssTime(value) {
|
|
25
|
+
return Math.max(0, ...value.split(',').map(parseTime).filter(Number.isFinite));
|
|
30
26
|
}
|
|
31
27
|
/**
|
|
32
28
|
* `<lyra-toast-item>` — a single toast notification.
|
|
@@ -76,8 +72,12 @@ export class LyraToastItem extends LyraElement {
|
|
|
76
72
|
if (!isFinite(this.duration) || this.duration <= 0)
|
|
77
73
|
return;
|
|
78
74
|
const remaining = this.duration - this.elapsedMs;
|
|
79
|
-
|
|
75
|
+
// A duration shortened below the already-elapsed time must hide promptly,
|
|
76
|
+
// not silently never schedule anything.
|
|
77
|
+
if (remaining <= 0) {
|
|
78
|
+
void this.hide();
|
|
80
79
|
return;
|
|
80
|
+
}
|
|
81
81
|
this.startedAt = performance.now();
|
|
82
82
|
this.timer = window.setTimeout(() => this.hide(), remaining);
|
|
83
83
|
};
|
|
@@ -113,6 +113,28 @@ export class LyraToastItem extends LyraElement {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
static { this.styles = [LyraElement.styles, styles]; }
|
|
116
|
+
willUpdate(changed) {
|
|
117
|
+
// `elapsedMs`/`duration` are re-read fresh every time the timer is
|
|
118
|
+
// (re)scheduled, so a `duration` change while paused (hovering/focused)
|
|
119
|
+
// or before the timer has ever started needs no action here -- the next
|
|
120
|
+
// resumeTimer()/startTimer() call already picks up the new value.
|
|
121
|
+
// Re-evaluate on any duration change once the show sequence has started,
|
|
122
|
+
// not only while a timer is already actively counting down -- this also
|
|
123
|
+
// covers duration flipping from disabled (0/Infinity) back to a positive
|
|
124
|
+
// value, which previously never had `this.timer !== undefined` to gate on.
|
|
125
|
+
//
|
|
126
|
+
// This runs in willUpdate() (before render), not updated(), because a
|
|
127
|
+
// duration shortened below the already-elapsed time makes resumeTimer()
|
|
128
|
+
// call hide(), which sets the `hiding` state property synchronously --
|
|
129
|
+
// doing that from updated() sets a reactive property after Lit considers
|
|
130
|
+
// the update cycle finished, scheduling a redundant extra render pass.
|
|
131
|
+
// willUpdate() runs before that cycle is considered complete, so the same
|
|
132
|
+
// set just folds into the render already in progress.
|
|
133
|
+
if (changed.has('duration') && this.timerStarted && !this.hovering && !this.focused) {
|
|
134
|
+
this.pauseTimer();
|
|
135
|
+
this.resumeTimer();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
116
138
|
updated(changed) {
|
|
117
139
|
if (changed.has('variant')) {
|
|
118
140
|
// Assertive for actionable severities, polite otherwise. Re-evaluated
|
|
@@ -121,27 +143,21 @@ export class LyraToastItem extends LyraElement {
|
|
|
121
143
|
// interruption instead of keeping its original, now-stale role.
|
|
122
144
|
this.setAttribute('role', this.variant === 'danger' || this.variant === 'warning' ? 'alert' : 'status');
|
|
123
145
|
}
|
|
124
|
-
// `elapsedMs`/`duration` are re-read fresh every time the timer is
|
|
125
|
-
// (re)scheduled, so a `duration` change while paused (hovering/focused)
|
|
126
|
-
// or before the timer has ever started needs no action here -- the next
|
|
127
|
-
// resumeTimer()/startTimer() call already picks up the new value. Only a
|
|
128
|
-
// timer that's actively counting down right now is running against a
|
|
129
|
-
// setTimeout scheduled for the *old* duration, so that's the one case
|
|
130
|
-
// that needs an explicit reschedule.
|
|
131
|
-
if (changed.has('duration') && this.timerStarted && this.timer !== undefined) {
|
|
132
|
-
this.pauseTimer();
|
|
133
|
-
this.resumeTimer();
|
|
134
|
-
}
|
|
135
146
|
}
|
|
136
147
|
firstUpdated() {
|
|
137
148
|
this.showRafId = requestAnimationFrame(() => {
|
|
138
149
|
this.showRafId = undefined;
|
|
150
|
+
// hide() may have already run synchronously before this frame fired
|
|
151
|
+
// (e.g. a caller creates the toast and immediately dismisses it) --
|
|
152
|
+
// don't resurrect the show sequence on top of an already-hiding item.
|
|
153
|
+
if (this.hiding)
|
|
154
|
+
return;
|
|
139
155
|
this.setAttribute('data-visible', '');
|
|
140
156
|
this.emit('lyra-show');
|
|
141
|
-
this.
|
|
142
|
-
this.
|
|
143
|
-
|
|
144
|
-
}
|
|
157
|
+
void this.waitForVisualCompletion('show').then(() => {
|
|
158
|
+
if (this.isConnected && !this.hiding)
|
|
159
|
+
this.emit('lyra-after-show');
|
|
160
|
+
});
|
|
145
161
|
this.startTimer();
|
|
146
162
|
});
|
|
147
163
|
}
|
|
@@ -151,14 +167,10 @@ export class LyraToastItem extends LyraElement {
|
|
|
151
167
|
cancelAnimationFrame(this.showRafId);
|
|
152
168
|
this.showRafId = undefined;
|
|
153
169
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (this.hideAnimTimer !== undefined) {
|
|
159
|
-
clearTimeout(this.hideAnimTimer);
|
|
160
|
-
this.hideAnimTimer = undefined;
|
|
161
|
-
}
|
|
170
|
+
this.cancelShowAnimation?.();
|
|
171
|
+
this.cancelShowAnimation = undefined;
|
|
172
|
+
this.cancelHideAnimation?.();
|
|
173
|
+
this.cancelHideAnimation = undefined;
|
|
162
174
|
this.clearTimer();
|
|
163
175
|
}
|
|
164
176
|
startTimer() {
|
|
@@ -171,6 +183,53 @@ export class LyraToastItem extends LyraElement {
|
|
|
171
183
|
clearTimeout(this.timer);
|
|
172
184
|
this.timer = undefined;
|
|
173
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Wait for the actual CSS transition/animation on the toast surface. The
|
|
188
|
+
* computed duration is intentionally read at runtime so a consumer's
|
|
189
|
+
* `--lyra-toast-show-duration`/`--lyra-toast-hide-duration` override keeps
|
|
190
|
+
* lifecycle events and removal in sync with the pixels on screen. A small
|
|
191
|
+
* timeout remains as a safety net for zero-duration transitions, disabled
|
|
192
|
+
* animation, and browsers that do not dispatch an end event.
|
|
193
|
+
*/
|
|
194
|
+
waitForVisualCompletion(kind) {
|
|
195
|
+
const previous = kind === 'show' ? this.cancelShowAnimation : this.cancelHideAnimation;
|
|
196
|
+
previous?.();
|
|
197
|
+
const surface = this.shadowRoot?.querySelector('[part="toast-item"]');
|
|
198
|
+
if (!surface || prefersReducedMotion())
|
|
199
|
+
return Promise.resolve();
|
|
200
|
+
const computed = getComputedStyle(surface);
|
|
201
|
+
const transitionMs = maxCssTime(computed.transitionDuration) + maxCssTime(computed.transitionDelay);
|
|
202
|
+
const animationMs = maxCssTime(computed.animationDuration) + maxCssTime(computed.animationDelay);
|
|
203
|
+
const fallbackMs = Math.max(transitionMs, animationMs);
|
|
204
|
+
if (fallbackMs <= 0)
|
|
205
|
+
return Promise.resolve();
|
|
206
|
+
return new Promise((resolve) => {
|
|
207
|
+
let settled = false;
|
|
208
|
+
let timeout;
|
|
209
|
+
const cancelKey = kind === 'show' ? 'cancelShowAnimation' : 'cancelHideAnimation';
|
|
210
|
+
const finish = () => {
|
|
211
|
+
if (settled)
|
|
212
|
+
return;
|
|
213
|
+
settled = true;
|
|
214
|
+
if (timeout !== undefined)
|
|
215
|
+
window.clearTimeout(timeout);
|
|
216
|
+
surface.removeEventListener('transitionend', onEnd);
|
|
217
|
+
surface.removeEventListener('animationend', onEnd);
|
|
218
|
+
if (this[cancelKey] === cancel)
|
|
219
|
+
this[cancelKey] = undefined;
|
|
220
|
+
resolve();
|
|
221
|
+
};
|
|
222
|
+
const onEnd = (event) => {
|
|
223
|
+
if (event.target === surface)
|
|
224
|
+
finish();
|
|
225
|
+
};
|
|
226
|
+
const cancel = () => finish();
|
|
227
|
+
surface.addEventListener('transitionend', onEnd);
|
|
228
|
+
surface.addEventListener('animationend', onEnd);
|
|
229
|
+
timeout = window.setTimeout(finish, fallbackMs + 50);
|
|
230
|
+
this[cancelKey] = cancel;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
174
233
|
// A stack of several simultaneously-open toasts otherwise gives every
|
|
175
234
|
// close button the same bare "Close" label, so screen-reader/switch-access
|
|
176
235
|
// users can't tell which toast a given button dismisses without first
|
|
@@ -199,15 +258,18 @@ export class LyraToastItem extends LyraElement {
|
|
|
199
258
|
if (this.hiding)
|
|
200
259
|
return;
|
|
201
260
|
this.hiding = true;
|
|
261
|
+
this.cancelShowAnimation?.();
|
|
262
|
+
this.cancelShowAnimation = undefined;
|
|
202
263
|
this.clearTimer();
|
|
203
264
|
this.emit('lyra-hide');
|
|
204
265
|
this.removeAttribute('data-visible');
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
266
|
+
this.setAttribute('data-hiding', '');
|
|
267
|
+
await this.waitForVisualCompletion('hide');
|
|
268
|
+
// A disconnect cancels the visual wait, but it does so without this
|
|
269
|
+
// reaching its normal completion -- guard against emitting a finished
|
|
270
|
+
// event or redundantly removing a node already torn down elsewhere.
|
|
271
|
+
if (!this.isConnected)
|
|
272
|
+
return;
|
|
211
273
|
this.emit('lyra-after-hide');
|
|
212
274
|
this.remove();
|
|
213
275
|
}
|