@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,129 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reason a dialog was dismissed, forwarded as the `lyra-dialog-close` event
|
|
5
|
+
* detail. `'escape'` and `'backdrop'` are emitted by the dialog's own built-in
|
|
6
|
+
* dismiss triggers; `'close-button'` by the built-in header close button
|
|
7
|
+
* (rendered when `closable` is set); `'unmount'` is emitted when the dialog is
|
|
8
|
+
* removed from the DOM while still open by something other than its own
|
|
9
|
+
* `close()` (e.g. a consumer's own cleanup code, or a parent re-render that
|
|
10
|
+
* drops it); any other string is whatever a caller passes to `close()` (e.g. a
|
|
11
|
+
* consumer's own footer close button, or confirm.ts's `'confirm'`/`'cancel'`).
|
|
12
|
+
*/
|
|
13
|
+
export type DialogCloseReason = 'escape' | 'backdrop' | 'close-button' | 'api' | 'unmount' | string;
|
|
14
|
+
/**
|
|
15
|
+
* `<lyra-dialog>` — a general-purpose modal/overlay. `role="dialog"`,
|
|
16
|
+
* focus-trapped while open, dismissible via Escape or a backdrop click, and
|
|
17
|
+
* scroll-locks the document for as long as it's open. Chrome stays minimal by
|
|
18
|
+
* default — no built-in title bar or close button; a consumer supplies a
|
|
19
|
+
* heading and any close affordance itself via the default/`footer` slots.
|
|
20
|
+
* `heading`/`closable` are an opt-in convenience for the common case where
|
|
21
|
+
* hand-building that chrome isn't worth it (see below).
|
|
22
|
+
*
|
|
23
|
+
* Accessible name / visible header, in priority order:
|
|
24
|
+
* 1. If a heading element (`h1`–`h6` or `[role="heading"]`) is a *direct
|
|
25
|
+
* child* (not inside `slot="footer"`), its text content becomes
|
|
26
|
+
* `aria-label` on the panel — unchanged, and takes priority over `heading`
|
|
27
|
+
* below so an existing consumer that already slots its own heading keeps
|
|
28
|
+
* rendering it exactly as before.
|
|
29
|
+
* 2. Otherwise, when `heading` is set, a visible header row (`part="header"`)
|
|
30
|
+
* renders containing that text (`part="heading"`), which becomes the
|
|
31
|
+
* `aria-labelledby` target.
|
|
32
|
+
* 3. Otherwise, when `label` is set, an invisible (`.sr-only`, exposed as the
|
|
33
|
+
* `label` part) element carrying that text is rendered inside the panel
|
|
34
|
+
* and `aria-labelledby` points at it instead.
|
|
35
|
+
* Only one of cases 2/3 ever renders at a time, so exactly one element ever
|
|
36
|
+
* claims `aria-labelledby`. `label` itself never renders visible chrome on
|
|
37
|
+
* its own — `::part(label)` can be restyled to make the sr-only text visible,
|
|
38
|
+
* or `heading` can be set instead, if a consumer wants visible chrome without
|
|
39
|
+
* slotting a real heading element.
|
|
40
|
+
*
|
|
41
|
+
* The slotted-heading case deliberately uses `aria-label` (a copied string)
|
|
42
|
+
* rather than `aria-labelledby` pointing at the heading's `id`: the heading is
|
|
43
|
+
* *light-DOM* content while `[part="panel"]` lives in this element's
|
|
44
|
+
* *shadow* tree, and an ID-reference attribute can't resolve across that
|
|
45
|
+
* boundary (verified against axe's `aria-dialog-name` rule) — unlike the
|
|
46
|
+
* `heading`/`label`-prop cases above, where the target element is rendered
|
|
47
|
+
* inside the same shadow root it labels, so `aria-labelledby` there is safe.
|
|
48
|
+
*
|
|
49
|
+
* `closable` renders a close (X) button in the header row (creating one, with
|
|
50
|
+
* no heading text, if `heading` is unset) that closes the dialog via the same
|
|
51
|
+
* `close()` path as Escape/backdrop-dismiss, with reason `'close-button'`.
|
|
52
|
+
*
|
|
53
|
+
* Stacking: opening one `<lyra-dialog>` while another is already open (e.g. a
|
|
54
|
+
* `confirm()` launched from within an already-open dialog) is supported --
|
|
55
|
+
* Escape and the Tab focus trap only ever act on the topmost open dialog, so
|
|
56
|
+
* dialogs beneath it stay open and untouched until the one on top closes.
|
|
57
|
+
*
|
|
58
|
+
* @customElement lyra-dialog
|
|
59
|
+
* @slot - The dialog body.
|
|
60
|
+
* @slot footer - Action buttons, rendered in a bottom row.
|
|
61
|
+
* @event lyra-dialog-close - `detail: DialogCloseReason`. Fired whenever the
|
|
62
|
+
* dialog is dismissed via Escape, a backdrop click, the built-in close
|
|
63
|
+
* button (`closable`), a `close()` call, or (with reason `'unmount'`)
|
|
64
|
+
* removal from the DOM by anything else while still open.
|
|
65
|
+
* @csspart backdrop - The full-viewport scrim behind the panel.
|
|
66
|
+
* @csspart panel - The dialog panel itself (`role="dialog"` while open). Its
|
|
67
|
+
* max-inline-size is controlled by the `--lyra-dialog-max-width` custom
|
|
68
|
+
* property (default `32rem`).
|
|
69
|
+
* @csspart header - The header row, rendered when `heading` is set (and no
|
|
70
|
+
* heading is slotted) and/or `closable` is `true`.
|
|
71
|
+
* @csspart heading - The visible `heading`-text element inside `header`,
|
|
72
|
+
* rendered only when `heading` is set and no heading is slotted.
|
|
73
|
+
* @csspart close-button - The built-in close button, rendered inside `header`
|
|
74
|
+
* only when `closable` is `true`.
|
|
75
|
+
* @csspart label - The invisible `label`-text element used for
|
|
76
|
+
* `aria-labelledby` when no heading is slotted and `heading` is unset.
|
|
77
|
+
* @csspart body - The wrapper around the default slot.
|
|
78
|
+
* @csspart footer - The wrapper around the `footer` slot.
|
|
79
|
+
*/
|
|
80
|
+
export declare class LyraDialog extends LyraElement {
|
|
81
|
+
static styles: import("lit").CSSResultGroup[];
|
|
82
|
+
/** Whether the dialog is open. Set this (or call `close()`) — there is no separate `show()`/`hide()` pair. */
|
|
83
|
+
open: boolean;
|
|
84
|
+
/** Accessible name used when no heading is slotted — see the class doc for the full fallback order. */
|
|
85
|
+
label: string;
|
|
86
|
+
/** Visible header text, rendered when no heading element is slotted into
|
|
87
|
+
* the default slot — see the class doc for the full fallback order. Has
|
|
88
|
+
* no effect (renders nothing) if a light-DOM heading is slotted; that case
|
|
89
|
+
* keeps working completely unchanged whether or not `heading` is set. */
|
|
90
|
+
heading?: string;
|
|
91
|
+
/** Renders a built-in close (X) button in the header row (creating one,
|
|
92
|
+
* with no heading text, if `heading` is unset), wired to the same
|
|
93
|
+
* `close()` path Escape/backdrop-dismiss already use, with reason
|
|
94
|
+
* `'close-button'`. */
|
|
95
|
+
closable: boolean;
|
|
96
|
+
private hasFooterSlot;
|
|
97
|
+
private headingText?;
|
|
98
|
+
private releaseScrollLock?;
|
|
99
|
+
private overlay?;
|
|
100
|
+
private readonly srLabelId;
|
|
101
|
+
private readonly headingId;
|
|
102
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
103
|
+
protected updated(changed: PropertyValues): void;
|
|
104
|
+
connectedCallback(): void;
|
|
105
|
+
disconnectedCallback(): void;
|
|
106
|
+
private onDefaultSlotChange;
|
|
107
|
+
private onFooterSlotChange;
|
|
108
|
+
private detectHeading;
|
|
109
|
+
/**
|
|
110
|
+
* Close the dialog and return focus to whatever had it before the dialog
|
|
111
|
+
* opened. `reason` is forwarded as the `lyra-dialog-close` detail --
|
|
112
|
+
* built-in triggers pass `'escape'`/`'backdrop'`/`'close-button'`; a
|
|
113
|
+
* consumer's own close affordance (e.g. a footer Cancel button) should
|
|
114
|
+
* call this directly with its own reason string, so every dismissal path
|
|
115
|
+
* funnels through the same event instead of the consumer having to also
|
|
116
|
+
* toggle `open` itself.
|
|
117
|
+
*/
|
|
118
|
+
close(reason?: DialogCloseReason): void;
|
|
119
|
+
private onBackdropClick;
|
|
120
|
+
private onCloseButtonClick;
|
|
121
|
+
private activateOverlay;
|
|
122
|
+
private deactivateOverlay;
|
|
123
|
+
render(): TemplateResult;
|
|
124
|
+
}
|
|
125
|
+
declare global {
|
|
126
|
+
interface HTMLElementTagNameMap {
|
|
127
|
+
'lyra-dialog': LyraDialog;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,288 @@
|
|
|
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, state } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { lockScroll } from '../../internal/scroll-lock.js';
|
|
12
|
+
import { activateOverlay } from '../../internal/overlay-manager.js';
|
|
13
|
+
import { nextId, srOnly } from '../../internal/a11y.js';
|
|
14
|
+
import { closeIcon } from '../../internal/icons.js';
|
|
15
|
+
import { styles } from './dialog.styles.js';
|
|
16
|
+
const HEADING_SELECTOR = 'h1, h2, h3, h4, h5, h6, [role="heading"]';
|
|
17
|
+
/**
|
|
18
|
+
* `<lyra-dialog>` — a general-purpose modal/overlay. `role="dialog"`,
|
|
19
|
+
* focus-trapped while open, dismissible via Escape or a backdrop click, and
|
|
20
|
+
* scroll-locks the document for as long as it's open. Chrome stays minimal by
|
|
21
|
+
* default — no built-in title bar or close button; a consumer supplies a
|
|
22
|
+
* heading and any close affordance itself via the default/`footer` slots.
|
|
23
|
+
* `heading`/`closable` are an opt-in convenience for the common case where
|
|
24
|
+
* hand-building that chrome isn't worth it (see below).
|
|
25
|
+
*
|
|
26
|
+
* Accessible name / visible header, in priority order:
|
|
27
|
+
* 1. If a heading element (`h1`–`h6` or `[role="heading"]`) is a *direct
|
|
28
|
+
* child* (not inside `slot="footer"`), its text content becomes
|
|
29
|
+
* `aria-label` on the panel — unchanged, and takes priority over `heading`
|
|
30
|
+
* below so an existing consumer that already slots its own heading keeps
|
|
31
|
+
* rendering it exactly as before.
|
|
32
|
+
* 2. Otherwise, when `heading` is set, a visible header row (`part="header"`)
|
|
33
|
+
* renders containing that text (`part="heading"`), which becomes the
|
|
34
|
+
* `aria-labelledby` target.
|
|
35
|
+
* 3. Otherwise, when `label` is set, an invisible (`.sr-only`, exposed as the
|
|
36
|
+
* `label` part) element carrying that text is rendered inside the panel
|
|
37
|
+
* and `aria-labelledby` points at it instead.
|
|
38
|
+
* Only one of cases 2/3 ever renders at a time, so exactly one element ever
|
|
39
|
+
* claims `aria-labelledby`. `label` itself never renders visible chrome on
|
|
40
|
+
* its own — `::part(label)` can be restyled to make the sr-only text visible,
|
|
41
|
+
* or `heading` can be set instead, if a consumer wants visible chrome without
|
|
42
|
+
* slotting a real heading element.
|
|
43
|
+
*
|
|
44
|
+
* The slotted-heading case deliberately uses `aria-label` (a copied string)
|
|
45
|
+
* rather than `aria-labelledby` pointing at the heading's `id`: the heading is
|
|
46
|
+
* *light-DOM* content while `[part="panel"]` lives in this element's
|
|
47
|
+
* *shadow* tree, and an ID-reference attribute can't resolve across that
|
|
48
|
+
* boundary (verified against axe's `aria-dialog-name` rule) — unlike the
|
|
49
|
+
* `heading`/`label`-prop cases above, where the target element is rendered
|
|
50
|
+
* inside the same shadow root it labels, so `aria-labelledby` there is safe.
|
|
51
|
+
*
|
|
52
|
+
* `closable` renders a close (X) button in the header row (creating one, with
|
|
53
|
+
* no heading text, if `heading` is unset) that closes the dialog via the same
|
|
54
|
+
* `close()` path as Escape/backdrop-dismiss, with reason `'close-button'`.
|
|
55
|
+
*
|
|
56
|
+
* Stacking: opening one `<lyra-dialog>` while another is already open (e.g. a
|
|
57
|
+
* `confirm()` launched from within an already-open dialog) is supported --
|
|
58
|
+
* Escape and the Tab focus trap only ever act on the topmost open dialog, so
|
|
59
|
+
* dialogs beneath it stay open and untouched until the one on top closes.
|
|
60
|
+
*
|
|
61
|
+
* @customElement lyra-dialog
|
|
62
|
+
* @slot - The dialog body.
|
|
63
|
+
* @slot footer - Action buttons, rendered in a bottom row.
|
|
64
|
+
* @event lyra-dialog-close - `detail: DialogCloseReason`. Fired whenever the
|
|
65
|
+
* dialog is dismissed via Escape, a backdrop click, the built-in close
|
|
66
|
+
* button (`closable`), a `close()` call, or (with reason `'unmount'`)
|
|
67
|
+
* removal from the DOM by anything else while still open.
|
|
68
|
+
* @csspart backdrop - The full-viewport scrim behind the panel.
|
|
69
|
+
* @csspart panel - The dialog panel itself (`role="dialog"` while open). Its
|
|
70
|
+
* max-inline-size is controlled by the `--lyra-dialog-max-width` custom
|
|
71
|
+
* property (default `32rem`).
|
|
72
|
+
* @csspart header - The header row, rendered when `heading` is set (and no
|
|
73
|
+
* heading is slotted) and/or `closable` is `true`.
|
|
74
|
+
* @csspart heading - The visible `heading`-text element inside `header`,
|
|
75
|
+
* rendered only when `heading` is set and no heading is slotted.
|
|
76
|
+
* @csspart close-button - The built-in close button, rendered inside `header`
|
|
77
|
+
* only when `closable` is `true`.
|
|
78
|
+
* @csspart label - The invisible `label`-text element used for
|
|
79
|
+
* `aria-labelledby` when no heading is slotted and `heading` is unset.
|
|
80
|
+
* @csspart body - The wrapper around the default slot.
|
|
81
|
+
* @csspart footer - The wrapper around the `footer` slot.
|
|
82
|
+
*/
|
|
83
|
+
export class LyraDialog extends LyraElement {
|
|
84
|
+
constructor() {
|
|
85
|
+
super(...arguments);
|
|
86
|
+
/** Whether the dialog is open. Set this (or call `close()`) — there is no separate `show()`/`hide()` pair. */
|
|
87
|
+
this.open = false;
|
|
88
|
+
/** Accessible name used when no heading is slotted — see the class doc for the full fallback order. */
|
|
89
|
+
this.label = '';
|
|
90
|
+
/** Renders a built-in close (X) button in the header row (creating one,
|
|
91
|
+
* with no heading text, if `heading` is unset), wired to the same
|
|
92
|
+
* `close()` path Escape/backdrop-dismiss already use, with reason
|
|
93
|
+
* `'close-button'`. */
|
|
94
|
+
this.closable = false;
|
|
95
|
+
this.hasFooterSlot = false;
|
|
96
|
+
this.srLabelId = nextId('dialog-label');
|
|
97
|
+
this.headingId = nextId('dialog-heading');
|
|
98
|
+
this.onDefaultSlotChange = () => {
|
|
99
|
+
this.detectHeading();
|
|
100
|
+
};
|
|
101
|
+
this.onFooterSlotChange = (e) => {
|
|
102
|
+
this.hasFooterSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
103
|
+
};
|
|
104
|
+
this.onBackdropClick = () => {
|
|
105
|
+
this.overlay?.dismissBackdrop();
|
|
106
|
+
};
|
|
107
|
+
this.onCloseButtonClick = () => {
|
|
108
|
+
this.close('close-button');
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
static { this.styles = [LyraElement.styles, srOnly, styles]; }
|
|
112
|
+
willUpdate(changed) {
|
|
113
|
+
if (!this.hasUpdated) {
|
|
114
|
+
this.hasFooterSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'footer');
|
|
115
|
+
this.detectHeading();
|
|
116
|
+
}
|
|
117
|
+
if (changed.has('open')) {
|
|
118
|
+
if (this.open) {
|
|
119
|
+
this.activateOverlay();
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.deactivateOverlay();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Runs after render so the manager can resolve the panel and its composed
|
|
127
|
+
// focus targets, including controls projected through either slot.
|
|
128
|
+
updated(changed) {
|
|
129
|
+
if (changed.has('open') && this.open) {
|
|
130
|
+
this.overlay?.focusInitial();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
connectedCallback() {
|
|
134
|
+
super.connectedCallback();
|
|
135
|
+
// A reconnect (e.g. a drag-and-drop reparent keeping this same element
|
|
136
|
+
// instance) fires disconnectedCallback then connectedCallback
|
|
137
|
+
// synchronously with no update in between, so willUpdate never reruns to
|
|
138
|
+
// notice `open` is still true -- restore the scroll lock/trap it dropped.
|
|
139
|
+
if (this.hasUpdated && this.open) {
|
|
140
|
+
if (this.overlay?.isActive()) {
|
|
141
|
+
this.overlay.resume();
|
|
142
|
+
this.releaseScrollLock ??= lockScroll(this.ownerDocument);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
this.activateOverlay();
|
|
146
|
+
}
|
|
147
|
+
queueMicrotask(() => this.overlay?.focusInitial());
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
disconnectedCallback() {
|
|
151
|
+
super.disconnectedCallback();
|
|
152
|
+
this.releaseScrollLock?.();
|
|
153
|
+
this.releaseScrollLock = undefined;
|
|
154
|
+
this.overlay?.suspend();
|
|
155
|
+
if (this.open) {
|
|
156
|
+
// A reparent (drag-and-drop moving this same element instance to a new
|
|
157
|
+
// parent) fires disconnectedCallback immediately followed by a
|
|
158
|
+
// synchronous connectedCallback, with no turn of the event loop in
|
|
159
|
+
// between -- deferring this check a microtask lets that case
|
|
160
|
+
// short-circuit here once isConnected is true again, so only a genuine
|
|
161
|
+
// removal (the element still disconnected once microtasks flush) ever
|
|
162
|
+
// reaches the assignment below. Without this, removing an open dialog
|
|
163
|
+
// any way other than its own close() (a consumer's own DOM cleanup, a
|
|
164
|
+
// parent re-render that drops it, etc.) never fires
|
|
165
|
+
// `lyra-dialog-close`, so e.g. confirm()'s returned promise hangs forever.
|
|
166
|
+
queueMicrotask(() => {
|
|
167
|
+
if (!this.isConnected && this.open) {
|
|
168
|
+
this.open = false;
|
|
169
|
+
this.emit('lyra-dialog-close', 'unmount');
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Only direct children are scanned -- a heading nested several layers deep
|
|
175
|
+
// (or inside a slotted custom element's own shadow root) is left to the
|
|
176
|
+
// consumer to label explicitly via `label` instead. Same depth limit
|
|
177
|
+
// lyra-widget applies to its own actions-slot presence check. Recomputed
|
|
178
|
+
// only on slot assignment changes, not on every render -- a consumer that
|
|
179
|
+
// mutates an already-slotted heading's textContent in place (rather than
|
|
180
|
+
// replacing the node) won't retroactively update aria-label; set `label`
|
|
181
|
+
// instead for a title that needs to change live.
|
|
182
|
+
detectHeading() {
|
|
183
|
+
const heading = Array.from(this.children).find((el) => el.getAttribute('slot') !== 'footer' && el.matches(HEADING_SELECTOR));
|
|
184
|
+
this.headingText = heading?.textContent?.trim() || undefined;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Close the dialog and return focus to whatever had it before the dialog
|
|
188
|
+
* opened. `reason` is forwarded as the `lyra-dialog-close` detail --
|
|
189
|
+
* built-in triggers pass `'escape'`/`'backdrop'`/`'close-button'`; a
|
|
190
|
+
* consumer's own close affordance (e.g. a footer Cancel button) should
|
|
191
|
+
* call this directly with its own reason string, so every dismissal path
|
|
192
|
+
* funnels through the same event instead of the consumer having to also
|
|
193
|
+
* toggle `open` itself.
|
|
194
|
+
*/
|
|
195
|
+
close(reason = 'api') {
|
|
196
|
+
if (!this.open)
|
|
197
|
+
return;
|
|
198
|
+
this.open = false;
|
|
199
|
+
this.emit('lyra-dialog-close', reason);
|
|
200
|
+
}
|
|
201
|
+
activateOverlay() {
|
|
202
|
+
if (this.overlay?.isActive())
|
|
203
|
+
return;
|
|
204
|
+
this.releaseScrollLock ??= lockScroll(this.ownerDocument);
|
|
205
|
+
this.overlay = activateOverlay({
|
|
206
|
+
host: this,
|
|
207
|
+
panel: () => this.shadowRoot?.querySelector('[part="panel"]') ?? null,
|
|
208
|
+
onEscape: () => this.close('escape'),
|
|
209
|
+
onBackdrop: () => this.close('backdrop'),
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
deactivateOverlay() {
|
|
213
|
+
this.releaseScrollLock?.();
|
|
214
|
+
this.releaseScrollLock = undefined;
|
|
215
|
+
this.overlay?.deactivate();
|
|
216
|
+
this.overlay = undefined;
|
|
217
|
+
}
|
|
218
|
+
render() {
|
|
219
|
+
// Priority order (see class doc): a slotted heading always wins; only
|
|
220
|
+
// when there isn't one does `heading` get a turn, then `label`'s
|
|
221
|
+
// sr-only fallback -- never more than one of the two below claims
|
|
222
|
+
// aria-labelledby for the same panel.
|
|
223
|
+
const useHeadingProp = !this.headingText && !!this.heading;
|
|
224
|
+
const useSrLabel = !this.headingText && !useHeadingProp && this.label.length > 0;
|
|
225
|
+
const showHeader = useHeadingProp || this.closable;
|
|
226
|
+
return html `
|
|
227
|
+
<div part="backdrop" @click=${this.onBackdropClick}></div>
|
|
228
|
+
<div
|
|
229
|
+
part="panel"
|
|
230
|
+
role=${this.open ? 'dialog' : nothing}
|
|
231
|
+
aria-modal=${this.open ? 'true' : nothing}
|
|
232
|
+
aria-label=${this.headingText ?? nothing}
|
|
233
|
+
aria-labelledby=${useHeadingProp ? this.headingId : useSrLabel ? this.srLabelId : nothing}
|
|
234
|
+
tabindex="-1"
|
|
235
|
+
>
|
|
236
|
+
${useSrLabel
|
|
237
|
+
? html `<span id=${this.srLabelId} part="label" class="sr-only">${this.label}</span>`
|
|
238
|
+
: nothing}
|
|
239
|
+
${showHeader
|
|
240
|
+
? html `
|
|
241
|
+
<div part="header">
|
|
242
|
+
${useHeadingProp
|
|
243
|
+
? html `<span id=${this.headingId} part="heading">${this.heading}</span>`
|
|
244
|
+
: nothing}
|
|
245
|
+
${this.closable
|
|
246
|
+
? html `
|
|
247
|
+
<button
|
|
248
|
+
part="close-button"
|
|
249
|
+
type="button"
|
|
250
|
+
aria-label="Close"
|
|
251
|
+
@click=${this.onCloseButtonClick}
|
|
252
|
+
>
|
|
253
|
+
${closeIcon()}
|
|
254
|
+
</button>
|
|
255
|
+
`
|
|
256
|
+
: nothing}
|
|
257
|
+
</div>
|
|
258
|
+
`
|
|
259
|
+
: nothing}
|
|
260
|
+
<div part="body">
|
|
261
|
+
<slot @slotchange=${this.onDefaultSlotChange}></slot>
|
|
262
|
+
</div>
|
|
263
|
+
<div part="footer" ?hidden=${!this.hasFooterSlot}>
|
|
264
|
+
<slot name="footer" @slotchange=${this.onFooterSlotChange}></slot>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
`;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
__decorate([
|
|
271
|
+
property({ type: Boolean, reflect: true })
|
|
272
|
+
], LyraDialog.prototype, "open", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
property()
|
|
275
|
+
], LyraDialog.prototype, "label", void 0);
|
|
276
|
+
__decorate([
|
|
277
|
+
property()
|
|
278
|
+
], LyraDialog.prototype, "heading", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
property({ type: Boolean, attribute: 'closable' })
|
|
281
|
+
], LyraDialog.prototype, "closable", void 0);
|
|
282
|
+
__decorate([
|
|
283
|
+
state()
|
|
284
|
+
], LyraDialog.prototype, "hasFooterSlot", void 0);
|
|
285
|
+
__decorate([
|
|
286
|
+
state()
|
|
287
|
+
], LyraDialog.prototype, "headingText", void 0);
|
|
288
|
+
defineElement('dialog', LyraDialog);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
/* Backdrop scrim color -- component-specific so a host can retheme it
|
|
5
|
+
without a raw literal leaking into the public API (no shared
|
|
6
|
+
--wa-*-overlay token exists in the design system to resolve through,
|
|
7
|
+
same rationale as lyra-widget's --lyra-widget-overlay-color). */
|
|
8
|
+
--lyra-dialog-overlay-color: rgb(0 0 0 / 0.5);
|
|
9
|
+
display: none;
|
|
10
|
+
position: fixed;
|
|
11
|
+
inset: 0;
|
|
12
|
+
z-index: var(--lyra-overlay-stack-index, 1000);
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
padding: var(--lyra-space-l);
|
|
16
|
+
}
|
|
17
|
+
:host([open]) {
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
20
|
+
[part='backdrop'] {
|
|
21
|
+
position: absolute;
|
|
22
|
+
inset: 0;
|
|
23
|
+
background: var(--lyra-dialog-overlay-color);
|
|
24
|
+
}
|
|
25
|
+
[part='panel'] {
|
|
26
|
+
position: relative;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
/* --lyra-dialog-max-width lets a consumer widen/narrow the panel per
|
|
30
|
+
instance (e.g. inline on the host) without overriding the whole rule --
|
|
31
|
+
same convention as lyra-media-card's --lyra-media-card-max-height. */
|
|
32
|
+
max-inline-size: min(var(--lyra-dialog-max-width, 32rem), 100%);
|
|
33
|
+
max-block-size: 100%;
|
|
34
|
+
background: var(--lyra-color-surface);
|
|
35
|
+
border: 1px solid var(--lyra-color-border);
|
|
36
|
+
border-radius: var(--lyra-radius);
|
|
37
|
+
box-shadow: var(--lyra-shadow);
|
|
38
|
+
overflow: auto;
|
|
39
|
+
}
|
|
40
|
+
[part='header'] {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: var(--lyra-space-s);
|
|
44
|
+
padding: var(--lyra-space-m) var(--lyra-space-l);
|
|
45
|
+
border-block-end: 1px solid var(--lyra-color-border);
|
|
46
|
+
}
|
|
47
|
+
[part='heading'] {
|
|
48
|
+
flex: 1 1 auto;
|
|
49
|
+
min-inline-size: 0;
|
|
50
|
+
margin: 0;
|
|
51
|
+
font-weight: 600;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
text-overflow: ellipsis;
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
}
|
|
56
|
+
[part='close-button'] {
|
|
57
|
+
flex: 0 0 auto;
|
|
58
|
+
margin-inline-start: auto;
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
min-inline-size: var(--lyra-icon-button-size);
|
|
63
|
+
min-block-size: var(--lyra-icon-button-size);
|
|
64
|
+
border: none;
|
|
65
|
+
background: transparent;
|
|
66
|
+
color: var(--lyra-color-text-quiet);
|
|
67
|
+
border-radius: var(--lyra-radius);
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
[part='close-button']:hover {
|
|
71
|
+
background: var(--lyra-color-brand-quiet);
|
|
72
|
+
color: var(--lyra-color-brand);
|
|
73
|
+
}
|
|
74
|
+
[part='close-button']:focus-visible {
|
|
75
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
76
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
77
|
+
}
|
|
78
|
+
[part='close-button'] svg {
|
|
79
|
+
display: block;
|
|
80
|
+
}
|
|
81
|
+
[part='body'] {
|
|
82
|
+
padding: var(--lyra-space-l);
|
|
83
|
+
overflow: auto;
|
|
84
|
+
}
|
|
85
|
+
[part='footer'] {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: flex-end;
|
|
89
|
+
gap: var(--lyra-space-s);
|
|
90
|
+
padding: var(--lyra-space-m) var(--lyra-space-l);
|
|
91
|
+
border-block-start: 1px solid var(--lyra-color-border);
|
|
92
|
+
}
|
|
93
|
+
[part='footer'][hidden] {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
/** Which edge of the panel's own container it's docked to. `'start'`/`'end'`
|
|
4
|
+
* are logical-inline (mirror left/right depending on writing direction);
|
|
5
|
+
* `'top'`/`'bottom'` are block-direction and unaffected by RTL. */
|
|
6
|
+
export type DockPanelEdge = 'start' | 'end' | 'top' | 'bottom';
|
|
7
|
+
export interface DockPanelResizeDetail {
|
|
8
|
+
size: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DockPanelCollapseChangeDetail {
|
|
11
|
+
collapsed: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolves an arbitrary CSS length (`px`, `rem`, `em`, `vw`, `vh`, `%`, or a
|
|
15
|
+
* bare/unitless number treated as `px`) to a live pixel value, without a DOM
|
|
16
|
+
* probe measurement -- `min-size`/`max-size` are pure constraints that are
|
|
17
|
+
* never themselves rendered anywhere, so there's nothing to measure; the
|
|
18
|
+
* *current* `size` is instead always read back from the host's own
|
|
19
|
+
* `getBoundingClientRect()` (see `currentSizePx()`), which handles any unit
|
|
20
|
+
* for free since the browser already resolved it during layout. Returns
|
|
21
|
+
* `undefined` for an empty/unparseable string.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseLengthPx(length: string, containerPx: number, fontSizeEl?: Element): number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* `<lyra-dock-panel>` — a single panel docked to one edge of whatever
|
|
26
|
+
* contains it, resizable by dragging its inner edge. Unlike `<lyra-split>`
|
|
27
|
+
* (which owns and lays out N sibling panels, and requires restructuring a
|
|
28
|
+
* layout so every panel becomes its direct child), this is one self-
|
|
29
|
+
* contained element you drop next to your existing content -- typically as
|
|
30
|
+
* an absolutely-positioned child of a `position: relative` parent, or as a
|
|
31
|
+
* flex item alongside a main-content sibling. It deliberately imposes no
|
|
32
|
+
* `position`/`inset` of its own (see the styles module): it only manages its
|
|
33
|
+
* own size along the resize axis (`inline-size` for `start`/`end`,
|
|
34
|
+
* `block-size` for `top`/`bottom`) and fills 100% of the cross axis, leaving
|
|
35
|
+
* where it sits in the page entirely up to the consumer's own layout.
|
|
36
|
+
*
|
|
37
|
+
* `lyra-split` stays the right primitive for the multi-sibling-panel case;
|
|
38
|
+
* this is the primitive for the single-edge-docked case, kept as a separate
|
|
39
|
+
* component rather than a second mode bolted onto `lyra-split`'s API.
|
|
40
|
+
*
|
|
41
|
+
* Pointer-drag-resize mirrors `lyra-split`'s pointer-capture technique
|
|
42
|
+
* (pointerdown captures the pointer on the handle, pointermove computes a
|
|
43
|
+
* new size, pointerup/pointercancel/lostpointercapture all release it) but
|
|
44
|
+
* for a single draggable edge instead of N-1 dividers between N panels, and
|
|
45
|
+
* reasons in raw pixels throughout rather than percent -- `size` is a CSS
|
|
46
|
+
* length, and pointer movement is naturally pixels, so there's no percent
|
|
47
|
+
* domain to convert through here. Every resize (drag step, drag release, or
|
|
48
|
+
* keyboard step) always commits `size` as a `px` string regardless of what
|
|
49
|
+
* unit `size`/`min-size`/`max-size` were originally expressed in -- a drag
|
|
50
|
+
* inherently produces a pixel-precise result, so re-expressing it in the
|
|
51
|
+
* caller's original unit (e.g. back into `rem`) would just be lossy
|
|
52
|
+
* re-derivation for no benefit.
|
|
53
|
+
*
|
|
54
|
+
* Collapsing hides the slotted content but keeps the panel itself at a
|
|
55
|
+
* small persistent "rail" width/height (`--lyra-dock-panel-collapsed-size`,
|
|
56
|
+
* default `var(--lyra-icon-button-size)`) rather than collapsing to zero --
|
|
57
|
+
* a zero-size collapsed panel would have nowhere left to host the toggle
|
|
58
|
+
* button that re-expands it. `size` itself is left untouched while
|
|
59
|
+
* collapsed, so re-expanding restores exactly what it was.
|
|
60
|
+
*
|
|
61
|
+
* @customElement lyra-dock-panel
|
|
62
|
+
* @slot - The panel's own content.
|
|
63
|
+
* @event lyra-resize - `detail: { size }` (a `px` CSS length string), fired on every drag step,
|
|
64
|
+
* drag release, and keyboard step.
|
|
65
|
+
* @event lyra-collapse-change - `detail: { collapsed }`, fired whenever the collapse toggle changes
|
|
66
|
+
* `collapsed`.
|
|
67
|
+
* @csspart base - The panel root.
|
|
68
|
+
* @csspart content - The wrapper around the default slot; hidden while `collapsed`.
|
|
69
|
+
* @csspart handle - The draggable resize handle on the panel's inner edge. Only rendered when
|
|
70
|
+
* `resizable` and not `collapsed`.
|
|
71
|
+
* @csspart collapse-toggle - The collapse/expand toggle button. Only rendered when `collapsible`.
|
|
72
|
+
*/
|
|
73
|
+
export declare class LyraDockPanel extends LyraElement {
|
|
74
|
+
static styles: import("lit").CSSResultGroup[];
|
|
75
|
+
edge: DockPanelEdge;
|
|
76
|
+
/** The current docked size along the resize axis, as a CSS length (e.g. `"320px"`). */
|
|
77
|
+
size: string;
|
|
78
|
+
/** Minimum resize bound, as a CSS length. */
|
|
79
|
+
minSize: string;
|
|
80
|
+
/** Maximum resize bound, as a CSS length. Empty means "no explicit cap" -- the live extent of
|
|
81
|
+
* the containing element is used instead, so the panel still can't be dragged wider/taller than
|
|
82
|
+
* its container. */
|
|
83
|
+
maxSize: string;
|
|
84
|
+
collapsible: boolean;
|
|
85
|
+
collapsed: boolean;
|
|
86
|
+
/** When `false`, no drag handle renders at all and the panel is a fixed size. */
|
|
87
|
+
resizable: boolean;
|
|
88
|
+
private drag;
|
|
89
|
+
private readonly contentId;
|
|
90
|
+
private containerResizeObserver?;
|
|
91
|
+
connectedCallback(): void;
|
|
92
|
+
disconnectedCallback(): void;
|
|
93
|
+
/** Creates (idempotently) and (re-)observes the containing element with a
|
|
94
|
+
* `ResizeObserver` that just requests a re-render on every callback --
|
|
95
|
+
* `containerPx()`/`currentSizePx()` already read the live DOM on every
|
|
96
|
+
* render, so there's no separate cached value to update here, only the
|
|
97
|
+
* render that was otherwise never being triggered. A no-op when not yet
|
|
98
|
+
* connected (no `parentElement`). */
|
|
99
|
+
private armContainerResizeObserver;
|
|
100
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
101
|
+
/** `'inline'` for the `start`/`end` edges (resizing changes `inline-size`), `'block'` for
|
|
102
|
+
* `top`/`bottom` (resizing changes `block-size`). */
|
|
103
|
+
private get axis();
|
|
104
|
+
/** +1 or -1: which physical pointer-movement/keyboard direction *grows* the panel, folding in
|
|
105
|
+
* both which edge is pinned (the opposite edge is what's dragged) and, for the inline axis
|
|
106
|
+
* only, the current RTL-ness -- mirrors lyra-split's own horizontal+RTL delta inversion, just
|
|
107
|
+
* generalized to four possible pinned edges instead of split's always-LTR-authored pair order. */
|
|
108
|
+
private get growSign();
|
|
109
|
+
private applyHostSize;
|
|
110
|
+
/** Live pixel size of the containing block along the resize axis, used both to resolve a `%`
|
|
111
|
+
* `min-size`/`max-size` and as the `max-size` fallback when unset. Falls back to the viewport
|
|
112
|
+
* when there's no parent element (e.g. not yet connected). */
|
|
113
|
+
private containerPx;
|
|
114
|
+
private resolveBoundsPx;
|
|
115
|
+
/** The panel's own current rendered size (px) along the resize axis, read straight off the
|
|
116
|
+
* live box -- this is what lets `size` be expressed in any CSS unit and still drag/step
|
|
117
|
+
* correctly from wherever it actually rendered, with no separate unit-conversion path for the
|
|
118
|
+
* "current" value (only `min-size`/`max-size`, which are never themselves rendered, need
|
|
119
|
+
* `parseLengthPx`). */
|
|
120
|
+
private currentSizePx;
|
|
121
|
+
private applySize;
|
|
122
|
+
private onPointerDown;
|
|
123
|
+
private onPointerMove;
|
|
124
|
+
private onPointerUp;
|
|
125
|
+
private onHandleKeyDown;
|
|
126
|
+
private toggleCollapsed;
|
|
127
|
+
/** Rotation (deg) for the collapse-toggle's chevron: it points toward the
|
|
128
|
+
* panel's pinned edge when expanded (that's the direction clicking it
|
|
129
|
+
* will shrink toward) and away from it when collapsed (the direction
|
|
130
|
+
* clicking it will grow toward) -- mirrors lyra-widget's collapse-button
|
|
131
|
+
* rotate-the-wrapping-part technique, generalized across four possible
|
|
132
|
+
* pinned edges and, for `start`/`end`, RTL. */
|
|
133
|
+
private get toggleChevronDeg();
|
|
134
|
+
private handleTemplate;
|
|
135
|
+
private collapseToggleTemplate;
|
|
136
|
+
render(): TemplateResult;
|
|
137
|
+
}
|
|
138
|
+
declare global {
|
|
139
|
+
interface HTMLElementTagNameMap {
|
|
140
|
+
'lyra-dock-panel': LyraDockPanel;
|
|
141
|
+
}
|
|
142
|
+
}
|