@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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
declare const LyraSlider_base: typeof LyraElement & (new (...args: any[]) => import("../../internal/form-associated.js").FormAssociatedInterface);
|
|
4
|
+
/**
|
|
5
|
+
* `<lyra-slider>` — a numeric range control (e.g. an LLM "temperature"
|
|
6
|
+
* setting), form-associated. Mirrors native `<input type="range">`
|
|
7
|
+
* semantics: `value` is the string form-submitted via `FormAssociated`,
|
|
8
|
+
* `valueAsNumber` is the ergonomic numeric accessor (mirroring the native
|
|
9
|
+
* `<input type=range>` IDL attribute of the same name) kept in sync with it
|
|
10
|
+
* in both directions — reads parse `value`, writes stringify back to it.
|
|
11
|
+
*
|
|
12
|
+
* Unlike the mixin's other consumers, an unset `value` is eagerly defaulted
|
|
13
|
+
* — on connect, and again after `form.reset()` — to the midpoint of
|
|
14
|
+
* `[min, max]` snapped to `step`, the same "range sanitization algorithm"
|
|
15
|
+
* default a native range input applies. A slider always represents *some*
|
|
16
|
+
* number, so `required` (inherited from `FormAssociated`) only has a window
|
|
17
|
+
* to block submission before that default lands, matching how `required`
|
|
18
|
+
* isn't a meaningful constraint on a native range input either.
|
|
19
|
+
*
|
|
20
|
+
* Clicking anywhere on the track (not just the 16px thumb) jumps the thumb
|
|
21
|
+
* to that point and continues the same gesture as a drag, matching native
|
|
22
|
+
* `<input type=range>` click-to-seek.
|
|
23
|
+
*
|
|
24
|
+
* @customElement lyra-slider
|
|
25
|
+
* @event lyra-input - Fired continuously during an active drag or a
|
|
26
|
+
* keyboard step (including OS key-repeat while a key is held), mirroring
|
|
27
|
+
* native `<input type=range>`'s own `input` event. `detail: { value: number }`.
|
|
28
|
+
* @event lyra-change - Fired once an interaction commits: on pointerup for a
|
|
29
|
+
* drag, or on keyup for a keyboard step — so a single Arrow/Home/End/
|
|
30
|
+
* PageUp/PageDown press fires both `lyra-input` and `lyra-change`,
|
|
31
|
+
* mirroring how native `<input type=range>` fires `change` on every
|
|
32
|
+
* committed step too. `detail: { value: number }`.
|
|
33
|
+
* @csspart base - The row wrapping the track and the optional value readout.
|
|
34
|
+
* @csspart track - The full-width background line.
|
|
35
|
+
* @csspart fill - The filled portion of the track from `min` up to the current value.
|
|
36
|
+
* @csspart thumb - The draggable handle (`role="slider"`).
|
|
37
|
+
* @csspart value - The visible numeric readout, rendered when `show-value` is true.
|
|
38
|
+
*/
|
|
39
|
+
export declare class LyraSlider extends LyraSlider_base {
|
|
40
|
+
static styles: import("lit").CSSResultGroup[];
|
|
41
|
+
static properties: {
|
|
42
|
+
min: {
|
|
43
|
+
type: NumberConstructor;
|
|
44
|
+
noAccessor: boolean;
|
|
45
|
+
};
|
|
46
|
+
max: {
|
|
47
|
+
type: NumberConstructor;
|
|
48
|
+
noAccessor: boolean;
|
|
49
|
+
};
|
|
50
|
+
step: {
|
|
51
|
+
type: NumberConstructor;
|
|
52
|
+
noAccessor: boolean;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
private _min;
|
|
56
|
+
private _max;
|
|
57
|
+
private _step;
|
|
58
|
+
private pendingValue;
|
|
59
|
+
get min(): number;
|
|
60
|
+
set min(next: number);
|
|
61
|
+
get max(): number;
|
|
62
|
+
set max(next: number);
|
|
63
|
+
get step(): number;
|
|
64
|
+
set step(next: number);
|
|
65
|
+
/** Accessible name for the slider, used when no visible label context
|
|
66
|
+
* exists around it (e.g. no wrapping `<label>` or adjacent heading). Set
|
|
67
|
+
* as `aria-label` on the interactive `role="slider"` element. A plain
|
|
68
|
+
* `aria-label` attribute on the host itself is honored as a fallback when
|
|
69
|
+
* this is left unset, matching `<lyra-checkbox>`/`<lyra-switch>`. */
|
|
70
|
+
label: string;
|
|
71
|
+
/** Whether to render the current numeric value as visible text next to
|
|
72
|
+
* the track. Like `<lyra-markdown>`'s `sanitize`/`gfm`, this is a plain
|
|
73
|
+
* `type: Boolean` property defaulting `true` — turn it off via the
|
|
74
|
+
* `.showValue=${false}` property binding (a bare `show-value="false"`
|
|
75
|
+
* content attribute is still truthy, since presence is all Lit's default
|
|
76
|
+
* boolean converter checks). */
|
|
77
|
+
showValue: boolean;
|
|
78
|
+
private activePointers;
|
|
79
|
+
private changedPointers;
|
|
80
|
+
private keyboardChanged;
|
|
81
|
+
connectedCallback(): void;
|
|
82
|
+
disconnectedCallback(): void;
|
|
83
|
+
/** The numeric counterpart of `value`, mirroring native `<input
|
|
84
|
+
* type=range>.valueAsNumber`. Reading always returns a finite, clamped,
|
|
85
|
+
* step-snapped number — even if `value` is momentarily `""` (e.g. right
|
|
86
|
+
* after `form.reset()` restores an undeclared default) — by falling back
|
|
87
|
+
* to the midpoint of `[min, max]`. Writing stringifies the clamped result
|
|
88
|
+
* back into `value`. */
|
|
89
|
+
get valueAsNumber(): number;
|
|
90
|
+
set valueAsNumber(next: number);
|
|
91
|
+
/**
|
|
92
|
+
* `FormAssociated` provides the form plumbing; this override adds the
|
|
93
|
+
* slider's native-range sanitization at the IDL boundary so invalid direct
|
|
94
|
+
* assignments cannot briefly submit a literal `NaN`/`Infinity`.
|
|
95
|
+
*/
|
|
96
|
+
get value(): string;
|
|
97
|
+
set value(next: string);
|
|
98
|
+
formResetCallback(): void;
|
|
99
|
+
/** If `value` is still unset, seed it with the sanitized default — the
|
|
100
|
+
* midpoint of `[min, max]`, snapped to `step` — so `value`/`valueAsNumber`
|
|
101
|
+
* and rendering never have to treat "" as a real, distinct state. */
|
|
102
|
+
private ensureValue;
|
|
103
|
+
/** Re-sanitize an already assigned value immediately after range settings change. */
|
|
104
|
+
private sanitizeCurrentValue;
|
|
105
|
+
private domain;
|
|
106
|
+
private defaultNumericValue;
|
|
107
|
+
private percentOf;
|
|
108
|
+
private clampValue;
|
|
109
|
+
private formatValue;
|
|
110
|
+
private setValue;
|
|
111
|
+
private onKeyDown;
|
|
112
|
+
private onKeyUp;
|
|
113
|
+
/** Start tracking `pointerId` as an active drag, transferring pointer
|
|
114
|
+
* capture to `captureTarget` and wiring the shared window-level move/end
|
|
115
|
+
* listeners. Shared by a pointerdown that starts on the thumb itself and
|
|
116
|
+
* one that starts elsewhere on the track (see `onBasePointerDown`), so
|
|
117
|
+
* both gestures continue identically from here on. */
|
|
118
|
+
private beginDrag;
|
|
119
|
+
private onPointerDown;
|
|
120
|
+
/** A pointerdown anywhere on `[part="base"]` other than the thumb itself
|
|
121
|
+
* (the vast majority of the control's clickable area) jumps the thumb to
|
|
122
|
+
* that point and continues the same gesture as a drag, mirroring native
|
|
123
|
+
* `<input type=range>` click-to-seek. A pointerdown that started on the
|
|
124
|
+
* thumb bubbles up to this same listener too — already fully handled by
|
|
125
|
+
* `onPointerDown` above, so it's ignored here via the `e.target === thumb`
|
|
126
|
+
* check. Unlike the two-handle `lyra-time-range` (where a track click is
|
|
127
|
+
* ambiguous about which handle should move), a single thumb has no such
|
|
128
|
+
* ambiguity. */
|
|
129
|
+
private onBasePointerDown;
|
|
130
|
+
private onPointerMove;
|
|
131
|
+
private onPointerUp;
|
|
132
|
+
/** Stop the drag owned by `pointerId`, optionally committing a final lyra-change. */
|
|
133
|
+
private endDrag;
|
|
134
|
+
render(): TemplateResult;
|
|
135
|
+
}
|
|
136
|
+
declare global {
|
|
137
|
+
interface HTMLElementTagNameMap {
|
|
138
|
+
'lyra-slider': LyraSlider;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export {};
|
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { FormAssociated } from '../../internal/form-associated.js';
|
|
11
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
12
|
+
import { isRtl } from '../../internal/rtl.js';
|
|
13
|
+
import { finiteNumber, finiteRange } from '../../internal/numbers.js';
|
|
14
|
+
import { styles } from './slider.styles.js';
|
|
15
|
+
/** PageUp/PageDown move by a larger increment than a single Arrow step,
|
|
16
|
+
* matching the WAI-ARIA APG slider pattern's expected keyboard interactions
|
|
17
|
+
* (and native `<input type=range>`). Mirrors lyra-time-range's identical
|
|
18
|
+
* constant. */
|
|
19
|
+
const PAGE_STEP_MULTIPLIER = 10;
|
|
20
|
+
function isArrowKey(key) {
|
|
21
|
+
return key === 'ArrowRight' || key === 'ArrowUp' || key === 'ArrowLeft' || key === 'ArrowDown';
|
|
22
|
+
}
|
|
23
|
+
/** Keys that onKeyDown acts on and onKeyUp commits after. */
|
|
24
|
+
function isSliderKey(key) {
|
|
25
|
+
return isArrowKey(key) || key === 'Home' || key === 'End' || key === 'PageUp' || key === 'PageDown';
|
|
26
|
+
}
|
|
27
|
+
/** Number of decimal places implied by `n`, including exponent notation.
|
|
28
|
+
* `0.1` -> 1, `5` -> 0, and `1e-7` -> 7. Used to round a stepped value back
|
|
29
|
+
* to the precision `step` itself implies, instead of leaving binary
|
|
30
|
+
* floating-point noise in place. */
|
|
31
|
+
function decimalPlaces(n) {
|
|
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));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* `<lyra-slider>` — a numeric range control (e.g. an LLM "temperature"
|
|
40
|
+
* setting), form-associated. Mirrors native `<input type="range">`
|
|
41
|
+
* semantics: `value` is the string form-submitted via `FormAssociated`,
|
|
42
|
+
* `valueAsNumber` is the ergonomic numeric accessor (mirroring the native
|
|
43
|
+
* `<input type=range>` IDL attribute of the same name) kept in sync with it
|
|
44
|
+
* in both directions — reads parse `value`, writes stringify back to it.
|
|
45
|
+
*
|
|
46
|
+
* Unlike the mixin's other consumers, an unset `value` is eagerly defaulted
|
|
47
|
+
* — on connect, and again after `form.reset()` — to the midpoint of
|
|
48
|
+
* `[min, max]` snapped to `step`, the same "range sanitization algorithm"
|
|
49
|
+
* default a native range input applies. A slider always represents *some*
|
|
50
|
+
* number, so `required` (inherited from `FormAssociated`) only has a window
|
|
51
|
+
* to block submission before that default lands, matching how `required`
|
|
52
|
+
* isn't a meaningful constraint on a native range input either.
|
|
53
|
+
*
|
|
54
|
+
* Clicking anywhere on the track (not just the 16px thumb) jumps the thumb
|
|
55
|
+
* to that point and continues the same gesture as a drag, matching native
|
|
56
|
+
* `<input type=range>` click-to-seek.
|
|
57
|
+
*
|
|
58
|
+
* @customElement lyra-slider
|
|
59
|
+
* @event lyra-input - Fired continuously during an active drag or a
|
|
60
|
+
* keyboard step (including OS key-repeat while a key is held), mirroring
|
|
61
|
+
* native `<input type=range>`'s own `input` event. `detail: { value: number }`.
|
|
62
|
+
* @event lyra-change - Fired once an interaction commits: on pointerup for a
|
|
63
|
+
* drag, or on keyup for a keyboard step — so a single Arrow/Home/End/
|
|
64
|
+
* PageUp/PageDown press fires both `lyra-input` and `lyra-change`,
|
|
65
|
+
* mirroring how native `<input type=range>` fires `change` on every
|
|
66
|
+
* committed step too. `detail: { value: number }`.
|
|
67
|
+
* @csspart base - The row wrapping the track and the optional value readout.
|
|
68
|
+
* @csspart track - The full-width background line.
|
|
69
|
+
* @csspart fill - The filled portion of the track from `min` up to the current value.
|
|
70
|
+
* @csspart thumb - The draggable handle (`role="slider"`).
|
|
71
|
+
* @csspart value - The visible numeric readout, rendered when `show-value` is true.
|
|
72
|
+
*/
|
|
73
|
+
export class LyraSlider extends FormAssociated(LyraElement) {
|
|
74
|
+
constructor() {
|
|
75
|
+
super(...arguments);
|
|
76
|
+
this._min = 0;
|
|
77
|
+
this._max = 100;
|
|
78
|
+
this._step = 1;
|
|
79
|
+
/** Accessible name for the slider, used when no visible label context
|
|
80
|
+
* exists around it (e.g. no wrapping `<label>` or adjacent heading). Set
|
|
81
|
+
* as `aria-label` on the interactive `role="slider"` element. A plain
|
|
82
|
+
* `aria-label` attribute on the host itself is honored as a fallback when
|
|
83
|
+
* this is left unset, matching `<lyra-checkbox>`/`<lyra-switch>`. */
|
|
84
|
+
this.label = '';
|
|
85
|
+
/** Whether to render the current numeric value as visible text next to
|
|
86
|
+
* the track. Like `<lyra-markdown>`'s `sanitize`/`gfm`, this is a plain
|
|
87
|
+
* `type: Boolean` property defaulting `true` — turn it off via the
|
|
88
|
+
* `.showValue=${false}` property binding (a bare `show-value="false"`
|
|
89
|
+
* content attribute is still truthy, since presence is all Lit's default
|
|
90
|
+
* boolean converter checks). */
|
|
91
|
+
this.showValue = true;
|
|
92
|
+
// Keyed by pointerId (a Set, not a single scalar) purely for
|
|
93
|
+
// multi-touch/robustness parity with lyra-split and lyra-time-range, even
|
|
94
|
+
// though a single thumb has no per-pointer state of its own to track.
|
|
95
|
+
this.activePointers = new Set();
|
|
96
|
+
this.changedPointers = new Set();
|
|
97
|
+
this.keyboardChanged = false;
|
|
98
|
+
this.onKeyDown = (e) => {
|
|
99
|
+
if (this.effectiveDisabled)
|
|
100
|
+
return;
|
|
101
|
+
const current = this.valueAsNumber;
|
|
102
|
+
// Under RTL, physical ArrowRight moves toward inset-inline-start, i.e. a
|
|
103
|
+
// lower value — swap which physical key counts as "forward", matching
|
|
104
|
+
// lyra-split/lyra-time-range's onKeyDown/onPointerMove convention.
|
|
105
|
+
// ArrowUp/ArrowDown are never swapped (direction only affects the
|
|
106
|
+
// horizontal inline axis).
|
|
107
|
+
const rtl = isRtl(this);
|
|
108
|
+
const forwardKey = rtl ? 'ArrowLeft' : 'ArrowRight';
|
|
109
|
+
const backwardKey = rtl ? 'ArrowRight' : 'ArrowLeft';
|
|
110
|
+
if (e.key === forwardKey || e.key === 'ArrowUp') {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
this.keyboardChanged = this.setValue(current + this.step, false) || this.keyboardChanged;
|
|
113
|
+
}
|
|
114
|
+
else if (e.key === backwardKey || e.key === 'ArrowDown') {
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
this.keyboardChanged = this.setValue(current - this.step, false) || this.keyboardChanged;
|
|
117
|
+
}
|
|
118
|
+
else if (e.key === 'PageUp') {
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
this.keyboardChanged =
|
|
121
|
+
this.setValue(current + this.step * PAGE_STEP_MULTIPLIER, false) || this.keyboardChanged;
|
|
122
|
+
}
|
|
123
|
+
else if (e.key === 'PageDown') {
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
this.keyboardChanged =
|
|
126
|
+
this.setValue(current - this.step * PAGE_STEP_MULTIPLIER, false) || this.keyboardChanged;
|
|
127
|
+
}
|
|
128
|
+
else if (e.key === 'Home') {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
this.keyboardChanged = this.setValue(this.domain().lo, false) || this.keyboardChanged;
|
|
131
|
+
}
|
|
132
|
+
else if (e.key === 'End') {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
this.keyboardChanged = this.setValue(this.domain().hi, false) || this.keyboardChanged;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
this.onKeyUp = (e) => {
|
|
138
|
+
// Only commit on release of the keys onKeyDown acts on — releasing an
|
|
139
|
+
// unrelated key (Tab, Shift, ...) while the thumb happens to be focused
|
|
140
|
+
// must not emit a spurious lyra-change. For a single discrete press this
|
|
141
|
+
// pairs one onKeyDown (lyra-input) with one onKeyUp (lyra-change); OS
|
|
142
|
+
// key-repeat while a key is held re-fires onKeyDown (and thus
|
|
143
|
+
// lyra-input) repeatedly but still commits only once, on the eventual
|
|
144
|
+
// keyup — the same drag-like "continuous input, single final change"
|
|
145
|
+
// shape a pointer drag has.
|
|
146
|
+
if (this.effectiveDisabled || !isSliderKey(e.key))
|
|
147
|
+
return;
|
|
148
|
+
if (this.keyboardChanged) {
|
|
149
|
+
this.emit('lyra-change', { value: this.valueAsNumber });
|
|
150
|
+
this.keyboardChanged = false;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
this.onPointerDown = (e) => {
|
|
154
|
+
if (this.effectiveDisabled)
|
|
155
|
+
return;
|
|
156
|
+
this.beginDrag(e.pointerId, e.target);
|
|
157
|
+
};
|
|
158
|
+
/** A pointerdown anywhere on `[part="base"]` other than the thumb itself
|
|
159
|
+
* (the vast majority of the control's clickable area) jumps the thumb to
|
|
160
|
+
* that point and continues the same gesture as a drag, mirroring native
|
|
161
|
+
* `<input type=range>` click-to-seek. A pointerdown that started on the
|
|
162
|
+
* thumb bubbles up to this same listener too — already fully handled by
|
|
163
|
+
* `onPointerDown` above, so it's ignored here via the `e.target === thumb`
|
|
164
|
+
* check. Unlike the two-handle `lyra-time-range` (where a track click is
|
|
165
|
+
* ambiguous about which handle should move), a single thumb has no such
|
|
166
|
+
* ambiguity. */
|
|
167
|
+
this.onBasePointerDown = (e) => {
|
|
168
|
+
if (this.effectiveDisabled)
|
|
169
|
+
return;
|
|
170
|
+
const thumb = this.renderRoot.querySelector('[part="thumb"]');
|
|
171
|
+
if (!thumb || e.target === thumb)
|
|
172
|
+
return;
|
|
173
|
+
const track = this.renderRoot.querySelector('[part="track"]');
|
|
174
|
+
if (!track)
|
|
175
|
+
return;
|
|
176
|
+
const rect = track.getBoundingClientRect();
|
|
177
|
+
const raw = rect.width === 0 ? 0 : (e.clientX - rect.left) / rect.width;
|
|
178
|
+
// Mirrors onPointerMove's own RTL handling below.
|
|
179
|
+
const ratio = Math.min(1, Math.max(0, isRtl(this) ? 1 - raw : raw));
|
|
180
|
+
const { lo, hi } = this.domain();
|
|
181
|
+
if (this.setValue(lo + ratio * (hi - lo), false))
|
|
182
|
+
this.changedPointers.add(e.pointerId);
|
|
183
|
+
this.beginDrag(e.pointerId, thumb);
|
|
184
|
+
// Keyboard interaction (arrow keys, Home/End, ...) can continue
|
|
185
|
+
// seamlessly right after the click, exactly as if the user had tabbed to
|
|
186
|
+
// the thumb and started dragging it directly.
|
|
187
|
+
thumb.focus();
|
|
188
|
+
};
|
|
189
|
+
this.onPointerMove = (e) => {
|
|
190
|
+
if (!this.activePointers.has(e.pointerId))
|
|
191
|
+
return;
|
|
192
|
+
if (this.effectiveDisabled) {
|
|
193
|
+
// These are window-level listeners driven by setPointerCapture, so
|
|
194
|
+
// they keep firing for this pointerId regardless of the `disabled`
|
|
195
|
+
// reflection — a drag already in progress would otherwise keep
|
|
196
|
+
// mutating `value` (and emitting lyra-input) after `disabled` flips
|
|
197
|
+
// true mid-drag. Abort the drag instead of continuing to process it.
|
|
198
|
+
this.endDrag(e.pointerId, false);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const track = this.renderRoot.querySelector('[part="track"]');
|
|
202
|
+
if (!track)
|
|
203
|
+
return;
|
|
204
|
+
const rect = track.getBoundingClientRect();
|
|
205
|
+
const raw = rect.width === 0 ? 0 : (e.clientX - rect.left) / rect.width;
|
|
206
|
+
// The track is positioned with inset-inline-start (0% at the visual
|
|
207
|
+
// right edge under RTL), so the pointer ratio has to mirror that or a
|
|
208
|
+
// rightward drag would move the thumb the wrong way.
|
|
209
|
+
const ratio = Math.min(1, Math.max(0, isRtl(this) ? 1 - raw : raw));
|
|
210
|
+
const { lo, hi } = this.domain();
|
|
211
|
+
if (this.setValue(lo + ratio * (hi - lo), false))
|
|
212
|
+
this.changedPointers.add(e.pointerId);
|
|
213
|
+
};
|
|
214
|
+
this.onPointerUp = (e) => {
|
|
215
|
+
this.endDrag(e.pointerId, true);
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
219
|
+
// These accessors sanitize the live value synchronously when a range
|
|
220
|
+
// setting changes. Keeping the properties `noAccessor` prevents Lit's
|
|
221
|
+
// default async field setter from leaving `.value`, `.valueAsNumber`, and
|
|
222
|
+
// ElementInternals' form value disagreeing until the next update flush.
|
|
223
|
+
static { this.properties = {
|
|
224
|
+
min: { type: Number, noAccessor: true },
|
|
225
|
+
max: { type: Number, noAccessor: true },
|
|
226
|
+
step: { type: Number, noAccessor: true },
|
|
227
|
+
}; }
|
|
228
|
+
get min() {
|
|
229
|
+
return this._min;
|
|
230
|
+
}
|
|
231
|
+
set min(next) {
|
|
232
|
+
const old = this._min;
|
|
233
|
+
this._min = finiteNumber(next, 0);
|
|
234
|
+
this.requestUpdate('min', old);
|
|
235
|
+
this.sanitizeCurrentValue();
|
|
236
|
+
}
|
|
237
|
+
get max() {
|
|
238
|
+
return this._max;
|
|
239
|
+
}
|
|
240
|
+
set max(next) {
|
|
241
|
+
const old = this._max;
|
|
242
|
+
this._max = finiteNumber(next, 100);
|
|
243
|
+
this.requestUpdate('max', old);
|
|
244
|
+
this.sanitizeCurrentValue();
|
|
245
|
+
}
|
|
246
|
+
get step() {
|
|
247
|
+
return this._step;
|
|
248
|
+
}
|
|
249
|
+
set step(next) {
|
|
250
|
+
const old = this._step;
|
|
251
|
+
// A zero/negative step is retained as an explicit "unstepped" mode;
|
|
252
|
+
// invalid/non-finite input follows the same safe path without poisoning
|
|
253
|
+
// the current value with NaN.
|
|
254
|
+
this._step = finiteRange(next, 0, 0);
|
|
255
|
+
this.requestUpdate('step', old);
|
|
256
|
+
this.sanitizeCurrentValue();
|
|
257
|
+
}
|
|
258
|
+
connectedCallback() {
|
|
259
|
+
super.connectedCallback();
|
|
260
|
+
if (this.pendingValue !== undefined) {
|
|
261
|
+
const pending = this.pendingValue;
|
|
262
|
+
this.pendingValue = undefined;
|
|
263
|
+
this.value = pending;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
this.ensureValue();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
disconnectedCallback() {
|
|
270
|
+
super.disconnectedCallback();
|
|
271
|
+
// Mirror lyra-split/lyra-time-range's cleanup: if the element is removed
|
|
272
|
+
// mid-drag (or a pointercancel/alt-tab means pointerup never reaches
|
|
273
|
+
// `window`), these window-level listeners would otherwise leak.
|
|
274
|
+
this.activePointers.clear();
|
|
275
|
+
this.changedPointers.clear();
|
|
276
|
+
this.keyboardChanged = false;
|
|
277
|
+
window.removeEventListener('pointermove', this.onPointerMove);
|
|
278
|
+
window.removeEventListener('pointerup', this.onPointerUp);
|
|
279
|
+
window.removeEventListener('pointercancel', this.onPointerUp);
|
|
280
|
+
window.removeEventListener('lostpointercapture', this.onPointerUp);
|
|
281
|
+
}
|
|
282
|
+
/** The numeric counterpart of `value`, mirroring native `<input
|
|
283
|
+
* type=range>.valueAsNumber`. Reading always returns a finite, clamped,
|
|
284
|
+
* step-snapped number — even if `value` is momentarily `""` (e.g. right
|
|
285
|
+
* after `form.reset()` restores an undeclared default) — by falling back
|
|
286
|
+
* to the midpoint of `[min, max]`. Writing stringifies the clamped result
|
|
287
|
+
* back into `value`. */
|
|
288
|
+
get valueAsNumber() {
|
|
289
|
+
if (super.value === '')
|
|
290
|
+
return this.defaultNumericValue();
|
|
291
|
+
const n = Number(super.value);
|
|
292
|
+
return Number.isFinite(n) ? this.clampValue(n) : this.defaultNumericValue();
|
|
293
|
+
}
|
|
294
|
+
set valueAsNumber(next) {
|
|
295
|
+
this.value = String(Number.isFinite(next) ? this.clampValue(next) : this.defaultNumericValue());
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* `FormAssociated` provides the form plumbing; this override adds the
|
|
299
|
+
* slider's native-range sanitization at the IDL boundary so invalid direct
|
|
300
|
+
* assignments cannot briefly submit a literal `NaN`/`Infinity`.
|
|
301
|
+
*/
|
|
302
|
+
get value() {
|
|
303
|
+
return super.value;
|
|
304
|
+
}
|
|
305
|
+
set value(next) {
|
|
306
|
+
const raw = next ?? '';
|
|
307
|
+
if (!this.isConnected) {
|
|
308
|
+
this.pendingValue = raw;
|
|
309
|
+
super.value = raw;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const numeric = Number(raw);
|
|
313
|
+
const sanitized = raw === '' || !Number.isFinite(numeric) ? this.defaultNumericValue() : this.clampValue(numeric);
|
|
314
|
+
super.value = String(sanitized);
|
|
315
|
+
}
|
|
316
|
+
formResetCallback() {
|
|
317
|
+
super.formResetCallback();
|
|
318
|
+
this.value = String(this.valueAsNumber);
|
|
319
|
+
}
|
|
320
|
+
/** If `value` is still unset, seed it with the sanitized default — the
|
|
321
|
+
* midpoint of `[min, max]`, snapped to `step` — so `value`/`valueAsNumber`
|
|
322
|
+
* and rendering never have to treat "" as a real, distinct state. */
|
|
323
|
+
ensureValue() {
|
|
324
|
+
if (this.value === '')
|
|
325
|
+
this.value = String(this.defaultNumericValue());
|
|
326
|
+
}
|
|
327
|
+
/** Re-sanitize an already assigned value immediately after range settings change. */
|
|
328
|
+
sanitizeCurrentValue() {
|
|
329
|
+
if (!this.isConnected)
|
|
330
|
+
return;
|
|
331
|
+
const current = super.value;
|
|
332
|
+
if (current === '')
|
|
333
|
+
return;
|
|
334
|
+
const sanitized = String(this.clampValue(Number(current)));
|
|
335
|
+
if (sanitized !== current)
|
|
336
|
+
this.value = sanitized;
|
|
337
|
+
}
|
|
338
|
+
domain() {
|
|
339
|
+
// A caller-supplied min/max that fails Number attribute conversion
|
|
340
|
+
// arrives here as NaN, and a literal `min="Infinity"`/`max="Infinity"`
|
|
341
|
+
// arrives as +-Infinity; `isNaN(...)` alone only catches the former, so
|
|
342
|
+
// test finiteness instead -- otherwise Infinity propagates into every
|
|
343
|
+
// clampValue()/percentOf() caller (e.g. the midpoint default computing
|
|
344
|
+
// `0 + Infinity / 2`).
|
|
345
|
+
const min = finiteNumber(this.min, 0);
|
|
346
|
+
const max = finiteNumber(this.max, 100);
|
|
347
|
+
return { lo: Math.min(min, max), hi: Math.max(min, max) };
|
|
348
|
+
}
|
|
349
|
+
defaultNumericValue() {
|
|
350
|
+
const { lo, hi } = this.domain();
|
|
351
|
+
return this.clampValue(lo + (hi - lo) / 2);
|
|
352
|
+
}
|
|
353
|
+
percentOf(value) {
|
|
354
|
+
const { lo, hi } = this.domain();
|
|
355
|
+
const safeValue = finiteRange(value, lo, lo, hi);
|
|
356
|
+
const span = hi - lo || 1;
|
|
357
|
+
return ((safeValue - lo) / span) * 100;
|
|
358
|
+
}
|
|
359
|
+
clampValue(raw) {
|
|
360
|
+
const { lo, hi } = this.domain();
|
|
361
|
+
// A NaN/Infinity `raw` (e.g. `valueAsNumber = NaN`, or a `value` string
|
|
362
|
+
// that fails Number conversion) would otherwise propagate straight
|
|
363
|
+
// through the Math.round/Math.max/Math.min calls below and poison the
|
|
364
|
+
// submitted FormAssociated value with the literal "NaN"/"Infinity" —
|
|
365
|
+
// resolve it to a real, finite, in-domain number instead.
|
|
366
|
+
raw = finiteNumber(raw, lo);
|
|
367
|
+
// A non-positive or non-finite step would otherwise divide by zero/NaN
|
|
368
|
+
// below; treat it as "unstepped" instead of propagating NaN.
|
|
369
|
+
const step = finiteRange(this.step, 0, 0);
|
|
370
|
+
const hasStep = step > 0;
|
|
371
|
+
let stepped = raw;
|
|
372
|
+
if (hasStep) {
|
|
373
|
+
// Anchor the step grid at the domain's own `lo` (matching native
|
|
374
|
+
// `<input type=range>`) instead of absolute 0, and round back to
|
|
375
|
+
// `step`'s own decimal precision so repeated steps land on exact
|
|
376
|
+
// values like 0.7 instead of 0.7000000000000001.
|
|
377
|
+
const stepsFromLo = Math.round((raw - lo) / step);
|
|
378
|
+
const factor = 10 ** decimalPlaces(step);
|
|
379
|
+
stepped = Math.round((lo + stepsFromLo * step) * factor) / factor;
|
|
380
|
+
}
|
|
381
|
+
return Math.min(hi, Math.max(lo, stepped));
|
|
382
|
+
}
|
|
383
|
+
formatValue(v) {
|
|
384
|
+
return String(v);
|
|
385
|
+
}
|
|
386
|
+
setValue(raw, commit) {
|
|
387
|
+
const previous = this.valueAsNumber;
|
|
388
|
+
const clamped = this.clampValue(raw);
|
|
389
|
+
if (clamped === previous)
|
|
390
|
+
return false;
|
|
391
|
+
this.value = String(clamped);
|
|
392
|
+
this.emit('lyra-input', { value: clamped });
|
|
393
|
+
if (commit)
|
|
394
|
+
this.emit('lyra-change', { value: clamped });
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
/** Start tracking `pointerId` as an active drag, transferring pointer
|
|
398
|
+
* capture to `captureTarget` and wiring the shared window-level move/end
|
|
399
|
+
* listeners. Shared by a pointerdown that starts on the thumb itself and
|
|
400
|
+
* one that starts elsewhere on the track (see `onBasePointerDown`), so
|
|
401
|
+
* both gestures continue identically from here on. */
|
|
402
|
+
beginDrag(pointerId, captureTarget) {
|
|
403
|
+
this.activePointers.add(pointerId);
|
|
404
|
+
this.changedPointers.delete(pointerId);
|
|
405
|
+
captureTarget.setPointerCapture(pointerId);
|
|
406
|
+
window.addEventListener('pointermove', this.onPointerMove);
|
|
407
|
+
window.addEventListener('pointerup', this.onPointerUp);
|
|
408
|
+
// A drag can end without a pointerup: a system gesture / palm rejection
|
|
409
|
+
// can fire `pointercancel`, and losing capture (e.g. element removed)
|
|
410
|
+
// fires `lostpointercapture` — both need the same teardown as pointerup.
|
|
411
|
+
window.addEventListener('pointercancel', this.onPointerUp);
|
|
412
|
+
window.addEventListener('lostpointercapture', this.onPointerUp);
|
|
413
|
+
}
|
|
414
|
+
/** Stop the drag owned by `pointerId`, optionally committing a final lyra-change. */
|
|
415
|
+
endDrag(pointerId, commit) {
|
|
416
|
+
if (!this.activePointers.has(pointerId))
|
|
417
|
+
return;
|
|
418
|
+
this.activePointers.delete(pointerId);
|
|
419
|
+
const changed = this.changedPointers.delete(pointerId);
|
|
420
|
+
if (commit && changed)
|
|
421
|
+
this.emit('lyra-change', { value: this.valueAsNumber });
|
|
422
|
+
// Only the last concurrent drag to end tears down the shared window
|
|
423
|
+
// listeners — an overlapping second pointer may still be down.
|
|
424
|
+
if (this.activePointers.size === 0) {
|
|
425
|
+
window.removeEventListener('pointermove', this.onPointerMove);
|
|
426
|
+
window.removeEventListener('pointerup', this.onPointerUp);
|
|
427
|
+
window.removeEventListener('pointercancel', this.onPointerUp);
|
|
428
|
+
window.removeEventListener('lostpointercapture', this.onPointerUp);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
render() {
|
|
432
|
+
const num = this.valueAsNumber;
|
|
433
|
+
const pct = this.percentOf(num);
|
|
434
|
+
const text = this.formatValue(num);
|
|
435
|
+
const { lo, hi } = this.domain();
|
|
436
|
+
const ariaLabel = this.label || this.getAttribute('aria-label') || nothing;
|
|
437
|
+
return html `
|
|
438
|
+
<div part="base" @pointerdown=${this.onBasePointerDown}>
|
|
439
|
+
<div part="track"></div>
|
|
440
|
+
<div part="fill" style=${`inline-size:${pct}%`}></div>
|
|
441
|
+
<div
|
|
442
|
+
part="thumb"
|
|
443
|
+
role="slider"
|
|
444
|
+
tabindex=${this.effectiveDisabled ? '-1' : '0'}
|
|
445
|
+
aria-valuemin=${lo}
|
|
446
|
+
aria-valuemax=${hi}
|
|
447
|
+
aria-valuenow=${num}
|
|
448
|
+
aria-valuetext=${text}
|
|
449
|
+
aria-label=${ariaLabel}
|
|
450
|
+
aria-disabled=${this.effectiveDisabled ? 'true' : nothing}
|
|
451
|
+
style=${`inset-inline-start:${pct}%`}
|
|
452
|
+
@pointerdown=${this.onPointerDown}
|
|
453
|
+
@keydown=${this.onKeyDown}
|
|
454
|
+
@keyup=${this.onKeyUp}
|
|
455
|
+
></div>
|
|
456
|
+
</div>
|
|
457
|
+
${this.showValue ? html `<span part="value" aria-hidden="true">${text}</span>` : nothing}
|
|
458
|
+
`;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
__decorate([
|
|
462
|
+
property()
|
|
463
|
+
], LyraSlider.prototype, "label", void 0);
|
|
464
|
+
__decorate([
|
|
465
|
+
property({ type: Boolean, attribute: 'show-value' })
|
|
466
|
+
], LyraSlider.prototype, "showValue", void 0);
|
|
467
|
+
defineElement('slider', LyraSlider);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|