@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
|
@@ -18,10 +18,16 @@ export type ExportFormat = 'csv' | 'json';
|
|
|
18
18
|
export declare class LyraExportButton extends LyraElement {
|
|
19
19
|
static styles: import("lit").CSSResultGroup[];
|
|
20
20
|
rows: Record<string, unknown>[];
|
|
21
|
+
/** Column allow-list (and CSV header labels) for both export formats. Left
|
|
22
|
+
* at its default empty array, both formats fall back to the union of the
|
|
23
|
+
* rows' own keys instead (see `effectiveColumns()`), rather than CSV
|
|
24
|
+
* degrading to a blank file while only JSON had a fallback. */
|
|
21
25
|
columns: CsvColumn[];
|
|
22
26
|
filename: string;
|
|
23
27
|
formats: ExportFormat[];
|
|
24
28
|
disabled: boolean;
|
|
29
|
+
/** Trigger button text, also feeds the format menu's `aria-label` (as
|
|
30
|
+
* "`${label} format`") so assistive tech gets an accessible name for it. */
|
|
25
31
|
label: string;
|
|
26
32
|
open: boolean;
|
|
27
33
|
private triggerEl?;
|
|
@@ -42,6 +48,12 @@ export declare class LyraExportButton extends LyraElement {
|
|
|
42
48
|
private onKeyDown;
|
|
43
49
|
protected firstUpdated(): void;
|
|
44
50
|
protected updated(changed: PropertyValues): void;
|
|
51
|
+
/** Falls back to the union of the rows' own keys when `columns` is left at
|
|
52
|
+
* its default empty array, so an unconfigured export still produces a
|
|
53
|
+
* proper header + data file instead of blank lines. Both `rowsForExport()`
|
|
54
|
+
* and the CSV branch of `doExport()` share this same fallback, rather than
|
|
55
|
+
* only the JSON path having one. */
|
|
56
|
+
private effectiveColumns;
|
|
45
57
|
/** Applies the same `columns` allow-list CSV exports use, so JSON can't leak fields CSV hides. */
|
|
46
58
|
private rowsForExport;
|
|
47
59
|
private doExport;
|
|
@@ -29,10 +29,16 @@ export class LyraExportButton extends LyraElement {
|
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
31
|
this.rows = [];
|
|
32
|
+
/** Column allow-list (and CSV header labels) for both export formats. Left
|
|
33
|
+
* at its default empty array, both formats fall back to the union of the
|
|
34
|
+
* rows' own keys instead (see `effectiveColumns()`), rather than CSV
|
|
35
|
+
* degrading to a blank file while only JSON had a fallback. */
|
|
32
36
|
this.columns = [];
|
|
33
37
|
this.filename = 'export';
|
|
34
38
|
this.formats = ['csv'];
|
|
35
39
|
this.disabled = false;
|
|
40
|
+
/** Trigger button text, also feeds the format menu's `aria-label` (as
|
|
41
|
+
* "`${label} format`") so assistive tech gets an accessible name for it. */
|
|
36
42
|
this.label = 'Export';
|
|
37
43
|
this.open = false;
|
|
38
44
|
this.menuId = nextId('export-menu');
|
|
@@ -76,6 +82,12 @@ export class LyraExportButton extends LyraElement {
|
|
|
76
82
|
this.focusMenuItem(items.length - 1);
|
|
77
83
|
}
|
|
78
84
|
break;
|
|
85
|
+
case 'Tab':
|
|
86
|
+
// No preventDefault -- native Tab navigation proceeds untouched, only
|
|
87
|
+
// the now-stale open menu closes (mirrors lyra-menu's identical
|
|
88
|
+
// Tab handling).
|
|
89
|
+
this.closeMenu();
|
|
90
|
+
break;
|
|
79
91
|
}
|
|
80
92
|
};
|
|
81
93
|
}
|
|
@@ -83,7 +95,9 @@ export class LyraExportButton extends LyraElement {
|
|
|
83
95
|
disconnectedCallback() {
|
|
84
96
|
super.disconnectedCallback();
|
|
85
97
|
this.cleanup?.();
|
|
98
|
+
this.cleanup = undefined;
|
|
86
99
|
document.removeEventListener('pointerdown', this.onDocPointer);
|
|
100
|
+
this.open = false;
|
|
87
101
|
}
|
|
88
102
|
openMenu() {
|
|
89
103
|
if (this.open)
|
|
@@ -141,11 +155,24 @@ export class LyraExportButton extends LyraElement {
|
|
|
141
155
|
}
|
|
142
156
|
}
|
|
143
157
|
}
|
|
158
|
+
/** Falls back to the union of the rows' own keys when `columns` is left at
|
|
159
|
+
* its default empty array, so an unconfigured export still produces a
|
|
160
|
+
* proper header + data file instead of blank lines. Both `rowsForExport()`
|
|
161
|
+
* and the CSV branch of `doExport()` share this same fallback, rather than
|
|
162
|
+
* only the JSON path having one. */
|
|
163
|
+
effectiveColumns() {
|
|
164
|
+
if (this.columns.length > 0)
|
|
165
|
+
return this.columns;
|
|
166
|
+
const keys = new Set();
|
|
167
|
+
for (const row of this.rows) {
|
|
168
|
+
for (const key of Object.keys(row))
|
|
169
|
+
keys.add(key);
|
|
170
|
+
}
|
|
171
|
+
return Array.from(keys, (key) => ({ key, label: key }));
|
|
172
|
+
}
|
|
144
173
|
/** Applies the same `columns` allow-list CSV exports use, so JSON can't leak fields CSV hides. */
|
|
145
174
|
rowsForExport() {
|
|
146
|
-
|
|
147
|
-
return this.rows;
|
|
148
|
-
const keys = this.columns.map((c) => c.key);
|
|
175
|
+
const keys = this.effectiveColumns().map((c) => c.key);
|
|
149
176
|
return this.rows.map((row) => {
|
|
150
177
|
const picked = {};
|
|
151
178
|
for (const key of keys)
|
|
@@ -154,13 +181,15 @@ export class LyraExportButton extends LyraElement {
|
|
|
154
181
|
});
|
|
155
182
|
}
|
|
156
183
|
doExport(format) {
|
|
184
|
+
if (this.disabled)
|
|
185
|
+
return;
|
|
157
186
|
this.closeMenu();
|
|
158
187
|
this.triggerEl?.focus();
|
|
159
188
|
const ev = this.emit('lyra-export', { format });
|
|
160
189
|
if (ev.defaultPrevented)
|
|
161
190
|
return;
|
|
162
191
|
if (format === 'csv') {
|
|
163
|
-
downloadBlob(buildCsv(this.rows, this.
|
|
192
|
+
downloadBlob(buildCsv(this.rows, this.effectiveColumns()), `${this.filename}.csv`, 'text/csv;charset=utf-8;');
|
|
164
193
|
}
|
|
165
194
|
else {
|
|
166
195
|
downloadBlob(JSON.stringify(this.rowsForExport(), null, 2), `${this.filename}.json`, 'application/json');
|
|
@@ -189,11 +218,12 @@ export class LyraExportButton extends LyraElement {
|
|
|
189
218
|
${this.label}
|
|
190
219
|
</button>
|
|
191
220
|
${this.formats.length > 1
|
|
192
|
-
? html `<div id=${this.menuId} part="menu" role="menu">
|
|
221
|
+
? html `<div id=${this.menuId} part="menu" role="menu" aria-label="${this.label} format">
|
|
193
222
|
${this.formats.map((f) => html `<button
|
|
194
223
|
part="menu-item"
|
|
195
224
|
role="menuitem"
|
|
196
225
|
type="button"
|
|
226
|
+
?disabled=${this.disabled}
|
|
197
227
|
@click=${() => this.doExport(f)}
|
|
198
228
|
>
|
|
199
229
|
${f.toUpperCase()}
|
|
@@ -77,11 +77,15 @@ export const styles = css `
|
|
|
77
77
|
cursor: pointer;
|
|
78
78
|
border-radius: var(--lyra-radius);
|
|
79
79
|
}
|
|
80
|
-
[part='menu-item']:hover {
|
|
80
|
+
[part='menu-item']:hover:not(:disabled) {
|
|
81
81
|
background: var(--lyra-color-brand-quiet);
|
|
82
82
|
}
|
|
83
83
|
[part='menu-item']:focus-visible {
|
|
84
84
|
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
85
85
|
outline-offset: var(--lyra-focus-ring-offset);
|
|
86
86
|
}
|
|
87
|
+
[part='menu-item']:disabled {
|
|
88
|
+
opacity: var(--lyra-opacity-disabled);
|
|
89
|
+
cursor: not-allowed;
|
|
90
|
+
}
|
|
87
91
|
`;
|
|
@@ -28,6 +28,8 @@ export function matchesAccept(file, accept, assumeExtensionMatch = false) {
|
|
|
28
28
|
return parts.some((p) => {
|
|
29
29
|
if (p.startsWith('.'))
|
|
30
30
|
return name === undefined ? assumeExtensionMatch : name.endsWith(p);
|
|
31
|
+
if (p === '*/*')
|
|
32
|
+
return true;
|
|
31
33
|
if (p.endsWith('/*'))
|
|
32
34
|
return type.startsWith(p.slice(0, -1));
|
|
33
35
|
return type === p;
|
|
@@ -14,7 +14,9 @@ export interface RejectedFile {
|
|
|
14
14
|
* accessible name always comes from `label`, so icon-only slot content
|
|
15
15
|
* remains announced correctly.
|
|
16
16
|
* @event lyra-files - `detail: { files, rejected }`, fired on drop and manual selection.
|
|
17
|
-
* @csspart base
|
|
17
|
+
* @csspart base - The dropzone's root, clickable/focusable container.
|
|
18
|
+
* @csspart input - The visually-hidden native `<input type="file">`.
|
|
19
|
+
* @csspart status - The visually-hidden live region announcing drag accept/reject state.
|
|
18
20
|
*/
|
|
19
21
|
export declare class LyraFileInput extends LyraElement {
|
|
20
22
|
static styles: import("lit").CSSResultGroup[];
|
|
@@ -25,7 +27,14 @@ export declare class LyraFileInput extends LyraElement {
|
|
|
25
27
|
forbiddenMimeTypes: string[];
|
|
26
28
|
maxFileSize: number;
|
|
27
29
|
label: string;
|
|
30
|
+
/** Message announced after an accepted selection; `{count}` is replaced by
|
|
31
|
+
* the number of accepted files. */
|
|
32
|
+
acceptedMessage: string;
|
|
33
|
+
/** Message announced after rejected files; `{count}` is replaced by the
|
|
34
|
+
* number of rejected files. */
|
|
35
|
+
rejectedMessage: string;
|
|
28
36
|
private dragState;
|
|
37
|
+
private resultStatus;
|
|
29
38
|
private inputEl?;
|
|
30
39
|
private dragCounter;
|
|
31
40
|
private isAllowed;
|
|
@@ -21,7 +21,9 @@ import { matchesAccept } from './accept.js';
|
|
|
21
21
|
* accessible name always comes from `label`, so icon-only slot content
|
|
22
22
|
* remains announced correctly.
|
|
23
23
|
* @event lyra-files - `detail: { files, rejected }`, fired on drop and manual selection.
|
|
24
|
-
* @csspart base
|
|
24
|
+
* @csspart base - The dropzone's root, clickable/focusable container.
|
|
25
|
+
* @csspart input - The visually-hidden native `<input type="file">`.
|
|
26
|
+
* @csspart status - The visually-hidden live region announcing drag accept/reject state.
|
|
25
27
|
*/
|
|
26
28
|
export class LyraFileInput extends LyraElement {
|
|
27
29
|
constructor() {
|
|
@@ -33,20 +35,30 @@ export class LyraFileInput extends LyraElement {
|
|
|
33
35
|
this.forbiddenMimeTypes = [];
|
|
34
36
|
this.maxFileSize = 0;
|
|
35
37
|
this.label = 'Drop files here or click to browse';
|
|
38
|
+
/** Message announced after an accepted selection; `{count}` is replaced by
|
|
39
|
+
* the number of accepted files. */
|
|
40
|
+
this.acceptedMessage = '{count} file(s) added.';
|
|
41
|
+
/** Message announced after rejected files; `{count}` is replaced by the
|
|
42
|
+
* number of rejected files. */
|
|
43
|
+
this.rejectedMessage = '{count} file(s) rejected.';
|
|
36
44
|
this.dragState = 'default';
|
|
45
|
+
this.resultStatus = '';
|
|
37
46
|
this.dragCounter = 0;
|
|
38
47
|
this.onDragEnter = (e) => {
|
|
48
|
+
e.preventDefault();
|
|
39
49
|
if (this.disabled)
|
|
40
50
|
return;
|
|
41
|
-
e.preventDefault();
|
|
42
51
|
this.dragCounter++;
|
|
43
52
|
const items = e.dataTransfer ? [...e.dataTransfer.items].filter((i) => i.kind === 'file') : [];
|
|
44
53
|
this.dragState = items.length ? this.previewState(items) : 'default';
|
|
45
54
|
};
|
|
46
55
|
this.onDragOver = (e) => {
|
|
56
|
+
// Always suppress the browser's default drop action (e.g. navigating the
|
|
57
|
+
// whole page to the dropped file), even while disabled — only the
|
|
58
|
+
// subsequent classification/emit logic is gated on `disabled`.
|
|
59
|
+
e.preventDefault();
|
|
47
60
|
if (this.disabled)
|
|
48
61
|
return;
|
|
49
|
-
e.preventDefault();
|
|
50
62
|
};
|
|
51
63
|
this.onDragLeave = (e) => {
|
|
52
64
|
if (this.disabled)
|
|
@@ -57,9 +69,11 @@ export class LyraFileInput extends LyraElement {
|
|
|
57
69
|
this.dragState = 'default';
|
|
58
70
|
};
|
|
59
71
|
this.onDrop = (e) => {
|
|
72
|
+
// Same rationale as `onDragOver`: prevent the browser's default drop
|
|
73
|
+
// action unconditionally, before the `disabled` gate.
|
|
74
|
+
e.preventDefault();
|
|
60
75
|
if (this.disabled)
|
|
61
76
|
return;
|
|
62
|
-
e.preventDefault();
|
|
63
77
|
this.dragCounter = 0;
|
|
64
78
|
this.dragState = 'default';
|
|
65
79
|
const files = [...(e.dataTransfer?.files ?? [])];
|
|
@@ -118,10 +132,18 @@ export class LyraFileInput extends LyraElement {
|
|
|
118
132
|
}
|
|
119
133
|
emitFiles(fileList) {
|
|
120
134
|
const { files, rejected } = this.classify(fileList);
|
|
135
|
+
const messages = [];
|
|
136
|
+
if (files.length)
|
|
137
|
+
messages.push(this.acceptedMessage.replace('{count}', String(files.length)));
|
|
138
|
+
if (rejected.length)
|
|
139
|
+
messages.push(this.rejectedMessage.replace('{count}', String(rejected.length)));
|
|
140
|
+
this.resultStatus = messages.join(' ');
|
|
121
141
|
this.emit('lyra-files', { files, rejected });
|
|
122
142
|
}
|
|
123
143
|
/** Programmatically open the native file picker. */
|
|
124
144
|
openPicker() {
|
|
145
|
+
if (this.disabled)
|
|
146
|
+
return;
|
|
125
147
|
this.inputEl?.click();
|
|
126
148
|
}
|
|
127
149
|
previewState(fileList) {
|
|
@@ -133,7 +155,7 @@ export class LyraFileInput extends LyraElement {
|
|
|
133
155
|
return 'Release to add the file.';
|
|
134
156
|
if (this.dragState === 'reject')
|
|
135
157
|
return 'This file type is not accepted.';
|
|
136
|
-
return
|
|
158
|
+
return this.resultStatus;
|
|
137
159
|
}
|
|
138
160
|
render() {
|
|
139
161
|
return html `
|
|
@@ -188,9 +210,18 @@ __decorate([
|
|
|
188
210
|
__decorate([
|
|
189
211
|
property()
|
|
190
212
|
], LyraFileInput.prototype, "label", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ attribute: 'accepted-message' })
|
|
215
|
+
], LyraFileInput.prototype, "acceptedMessage", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
property({ attribute: 'rejected-message' })
|
|
218
|
+
], LyraFileInput.prototype, "rejectedMessage", void 0);
|
|
191
219
|
__decorate([
|
|
192
220
|
state()
|
|
193
221
|
], LyraFileInput.prototype, "dragState", void 0);
|
|
222
|
+
__decorate([
|
|
223
|
+
state()
|
|
224
|
+
], LyraFileInput.prototype, "resultStatus", void 0);
|
|
194
225
|
__decorate([
|
|
195
226
|
query('input[type="file"]')
|
|
196
227
|
], LyraFileInput.prototype, "inputEl", void 0);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
2
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
3
|
import '../skeleton/skeleton.js';
|
|
4
|
+
export type FlagVariant = 'compact' | 'standard' | 'detailed';
|
|
4
5
|
type FlagUrlResolver = (code: string, options?: {
|
|
5
|
-
variant?:
|
|
6
|
+
variant?: FlagVariant;
|
|
6
7
|
}) => Promise<string | undefined>;
|
|
7
8
|
/**
|
|
8
9
|
* Resolves the optional peer dependency `@aceshooting/lyra-flags`'s `flagUrl`
|
|
@@ -33,16 +34,19 @@ export declare function loadFlagUrl(importFlags?: () => Promise<{
|
|
|
33
34
|
* `src` instead to skip the peer-package round trip (and its loading-skeleton
|
|
34
35
|
* flash) entirely.
|
|
35
36
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* The ~65 flags whose design includes a detailed coat of arms/seal/emblem (e.g. `es`, `pt`) ship
|
|
38
|
+
* three fidelity tiers; choose one with `variant`: `"compact"` (a tiny WebP raster for icon-scale
|
|
39
|
+
* use — menu items, language selectors, dense lists), the default `"standard"` (icon-optimized
|
|
40
|
+
* vector for card/row sizes), or `"detailed"` (the pristine full-detail vector for hero-scale
|
|
41
|
+
* display). A no-op for every other code — all tiers resolve to the same file. See `variant`'s own
|
|
42
|
+
* doc.
|
|
40
43
|
*
|
|
41
44
|
* @customElement lyra-flag
|
|
42
45
|
* @example <lyra-flag country="fr"></lyra-flag>
|
|
43
46
|
* @example <lyra-flag language="en" label="English"></lyra-flag>
|
|
44
47
|
* @example <lyra-flag src=${frUrl} label="French"></lyra-flag>
|
|
45
|
-
* @example <lyra-flag country="es"
|
|
48
|
+
* @example <lyra-flag country="es" variant="compact"></lyra-flag>
|
|
49
|
+
* @example <lyra-flag country="es" variant="detailed"></lyra-flag>
|
|
46
50
|
* @csspart image - The underlying <img>.
|
|
47
51
|
*/
|
|
48
52
|
export declare class LyraFlag extends LyraElement {
|
|
@@ -73,15 +77,27 @@ export declare class LyraFlag extends LyraElement {
|
|
|
73
77
|
/** Render as a circular flag. */
|
|
74
78
|
round: boolean;
|
|
75
79
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* Which fidelity tier to load, for the ~65 `country`/`language` codes whose source art embeds a
|
|
81
|
+
* coat of arms/seal/emblem (for every other code all tiers are the same file, so this is a safe
|
|
82
|
+
* no-op):
|
|
83
|
+
* - `"compact"` — a tiny WebP raster for icon-scale use (menu items, language selectors, dense
|
|
84
|
+
* lists; ~12–28px), where the emblem detail is invisible anyway.
|
|
85
|
+
* - `"standard"` (default) — the icon-optimized vector, for card/row sizes (~28–96px).
|
|
86
|
+
* - `"detailed"` — the pristine, full-detail vector, for rendering larger than icon scale (e.g.
|
|
87
|
+
* a hero display) where the extra illustrative detail is actually visible.
|
|
88
|
+
*
|
|
89
|
+
* Has no effect when `src` is set — a pre-resolved URL is used as-is regardless. Takes precedence
|
|
90
|
+
* over the deprecated `detailed` boolean.
|
|
91
|
+
*/
|
|
92
|
+
variant?: FlagVariant;
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated Use `variant="detailed"` instead. Kept as an alias for one minor cycle; when
|
|
95
|
+
* `variant` is unset, `detailed` still maps to the detailed tier. Removed in the next major.
|
|
83
96
|
*/
|
|
84
97
|
detailed: boolean;
|
|
98
|
+
/** The effective tier to request: an explicit `variant` wins; otherwise the deprecated
|
|
99
|
+
* `detailed` boolean is honored; otherwise `"standard"`. */
|
|
100
|
+
private get effectiveVariant();
|
|
85
101
|
private resolvedSrc?;
|
|
86
102
|
/** True while the lazy-loaded `@aceshooting/lyra-flags` peer resolver is in flight. */
|
|
87
103
|
private loading;
|
|
@@ -28,6 +28,14 @@ export async function loadFlagUrl(importFlags = () => import('@aceshooting/lyra-
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* One `Intl.DisplayNames` instance per locale, shared across every `<lyra-flag>` on the page.
|
|
33
|
+
* Constructing one is an ICU locale-data lookup, and `displayNameFor()` runs on every `render()`
|
|
34
|
+
* pass for a flag without an explicit `label` (e.g. toggling `round`), not just on country/language
|
|
35
|
+
* change -- multi-flag lists (language pickers, country lists) would otherwise pay this cost once
|
|
36
|
+
* per element per render. Mirrors the module-level caching `flagUrlResolver` already gets above.
|
|
37
|
+
*/
|
|
38
|
+
const displayNamesCache = new Map();
|
|
31
39
|
/**
|
|
32
40
|
* Resolves an ISO 3166-1 alpha-2 region code to a human-readable, localized
|
|
33
41
|
* display name (e.g. `'FR'` -> `'France'`) via `Intl.DisplayNames`, for use as
|
|
@@ -38,7 +46,13 @@ export async function loadFlagUrl(importFlags = () => import('@aceshooting/lyra-
|
|
|
38
46
|
*/
|
|
39
47
|
function displayNameFor(code) {
|
|
40
48
|
try {
|
|
41
|
-
|
|
49
|
+
const locale = navigator.language;
|
|
50
|
+
let dn = displayNamesCache.get(locale);
|
|
51
|
+
if (!dn) {
|
|
52
|
+
dn = new Intl.DisplayNames([locale], { type: 'region' });
|
|
53
|
+
displayNamesCache.set(locale, dn);
|
|
54
|
+
}
|
|
55
|
+
return dn.of(code.toUpperCase()) ?? code.toUpperCase();
|
|
42
56
|
}
|
|
43
57
|
catch {
|
|
44
58
|
return code.toUpperCase();
|
|
@@ -56,6 +70,17 @@ function loadFlagUrlResolver() {
|
|
|
56
70
|
}
|
|
57
71
|
return flagUrlResolver;
|
|
58
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* @internal Test-only seam: overrides (or, with `undefined`, clears) the module-level cache that
|
|
75
|
+
* `willUpdate()` reads through `loadFlagUrlResolver()`. The real `@aceshooting/lyra-flags` peer's
|
|
76
|
+
* `flagUrl(code)` never actually rejects (unknown codes just resolve `undefined`), so this is the
|
|
77
|
+
* only way to exercise a resolver-function rejection — e.g. a network failure fetching a flag
|
|
78
|
+
* asset — without uninstalling the real package. Not part of the public API; not re-exported from
|
|
79
|
+
* the root barrel.
|
|
80
|
+
*/
|
|
81
|
+
export function __setFlagUrlResolverForTesting(value) {
|
|
82
|
+
flagUrlResolver = value;
|
|
83
|
+
}
|
|
59
84
|
/**
|
|
60
85
|
* `<lyra-flag>` — a country/language flag.
|
|
61
86
|
*
|
|
@@ -75,16 +100,19 @@ function loadFlagUrlResolver() {
|
|
|
75
100
|
* `src` instead to skip the peer-package round trip (and its loading-skeleton
|
|
76
101
|
* flash) entirely.
|
|
77
102
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
103
|
+
* The ~65 flags whose design includes a detailed coat of arms/seal/emblem (e.g. `es`, `pt`) ship
|
|
104
|
+
* three fidelity tiers; choose one with `variant`: `"compact"` (a tiny WebP raster for icon-scale
|
|
105
|
+
* use — menu items, language selectors, dense lists), the default `"standard"` (icon-optimized
|
|
106
|
+
* vector for card/row sizes), or `"detailed"` (the pristine full-detail vector for hero-scale
|
|
107
|
+
* display). A no-op for every other code — all tiers resolve to the same file. See `variant`'s own
|
|
108
|
+
* doc.
|
|
82
109
|
*
|
|
83
110
|
* @customElement lyra-flag
|
|
84
111
|
* @example <lyra-flag country="fr"></lyra-flag>
|
|
85
112
|
* @example <lyra-flag language="en" label="English"></lyra-flag>
|
|
86
113
|
* @example <lyra-flag src=${frUrl} label="French"></lyra-flag>
|
|
87
|
-
* @example <lyra-flag country="es"
|
|
114
|
+
* @example <lyra-flag country="es" variant="compact"></lyra-flag>
|
|
115
|
+
* @example <lyra-flag country="es" variant="detailed"></lyra-flag>
|
|
88
116
|
* @csspart image - The underlying <img>.
|
|
89
117
|
*/
|
|
90
118
|
export class LyraFlag extends LyraElement {
|
|
@@ -93,13 +121,8 @@ export class LyraFlag extends LyraElement {
|
|
|
93
121
|
/** Render as a circular flag. */
|
|
94
122
|
this.round = false;
|
|
95
123
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* enough to need optimizing (e.g. `es`, `pt`, a national coat of arms/seal/emblem); for every
|
|
99
|
-
* other code this is a safe no-op (the default and detailed variants are the same file). Has no
|
|
100
|
-
* effect when `src` is set — a pre-resolved URL is used as-is regardless. Intended for rendering
|
|
101
|
-
* a flag larger than icon scale (e.g. a hero display) where the extra illustrative detail is
|
|
102
|
-
* actually visible.
|
|
124
|
+
* @deprecated Use `variant="detailed"` instead. Kept as an alias for one minor cycle; when
|
|
125
|
+
* `variant` is unset, `detailed` still maps to the detailed tier. Removed in the next major.
|
|
103
126
|
*/
|
|
104
127
|
this.detailed = false;
|
|
105
128
|
/** True while the lazy-loaded `@aceshooting/lyra-flags` peer resolver is in flight. */
|
|
@@ -113,6 +136,11 @@ export class LyraFlag extends LyraElement {
|
|
|
113
136
|
this.resolveToken = 0;
|
|
114
137
|
}
|
|
115
138
|
static { this.styles = [LyraElement.styles, styles]; }
|
|
139
|
+
/** The effective tier to request: an explicit `variant` wins; otherwise the deprecated
|
|
140
|
+
* `detailed` boolean is honored; otherwise `"standard"`. */
|
|
141
|
+
get effectiveVariant() {
|
|
142
|
+
return this.variant ?? (this.detailed ? 'detailed' : 'standard');
|
|
143
|
+
}
|
|
116
144
|
get code() {
|
|
117
145
|
if (this.country) {
|
|
118
146
|
return ALPHA2_RE.test(this.country) ? this.country.toLowerCase() : undefined;
|
|
@@ -132,6 +160,7 @@ export class LyraFlag extends LyraElement {
|
|
|
132
160
|
!changed.has('country') &&
|
|
133
161
|
!changed.has('language') &&
|
|
134
162
|
!changed.has('src') &&
|
|
163
|
+
!changed.has('variant') &&
|
|
135
164
|
!changed.has('detailed')) {
|
|
136
165
|
return;
|
|
137
166
|
}
|
|
@@ -148,13 +177,21 @@ export class LyraFlag extends LyraElement {
|
|
|
148
177
|
return;
|
|
149
178
|
}
|
|
150
179
|
this.loading = true;
|
|
180
|
+
const variant = this.effectiveVariant;
|
|
151
181
|
void loadFlagUrlResolver()
|
|
152
|
-
.then((resolve) => resolve?.(code,
|
|
182
|
+
.then((resolve) => resolve?.(code, variant === 'standard' ? undefined : { variant }))
|
|
153
183
|
.then((url) => {
|
|
154
184
|
if (token !== this.resolveToken)
|
|
155
185
|
return; // superseded by a later country/language/src change
|
|
156
186
|
this.resolvedSrc = url;
|
|
157
187
|
this.loading = false;
|
|
188
|
+
})
|
|
189
|
+
.catch((err) => {
|
|
190
|
+
if (token !== this.resolveToken)
|
|
191
|
+
return; // superseded by a later country/language/src change
|
|
192
|
+
console.warn(`<lyra-flag> failed to resolve a flag URL for "${code}":`, err);
|
|
193
|
+
this.resolvedSrc = undefined;
|
|
194
|
+
this.loading = false;
|
|
158
195
|
});
|
|
159
196
|
}
|
|
160
197
|
updated() {
|
|
@@ -189,6 +226,9 @@ __decorate([
|
|
|
189
226
|
__decorate([
|
|
190
227
|
property({ type: Boolean, reflect: true })
|
|
191
228
|
], LyraFlag.prototype, "round", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
property()
|
|
231
|
+
], LyraFlag.prototype, "variant", void 0);
|
|
192
232
|
__decorate([
|
|
193
233
|
property({ type: Boolean, reflect: true })
|
|
194
234
|
], LyraFlag.prototype, "detailed", void 0);
|
|
@@ -11,7 +11,7 @@ export const styles = css `
|
|
|
11
11
|
display: block;
|
|
12
12
|
block-size: 100%;
|
|
13
13
|
inline-size: 100%;
|
|
14
|
-
border-radius: var(--lyra-flag-radius,
|
|
14
|
+
border-radius: var(--lyra-flag-radius, calc(var(--lyra-radius) * 0.33));
|
|
15
15
|
box-shadow: 0 0 0 1px var(--lyra-color-border) inset;
|
|
16
16
|
object-fit: cover;
|
|
17
17
|
}
|
|
@@ -17,6 +17,9 @@ export declare const ALPHA2_RE: RegExp;
|
|
|
17
17
|
export declare const LANGUAGE_TO_COUNTRY: Record<string, string>;
|
|
18
18
|
/**
|
|
19
19
|
* Resolve a BCP-47-ish language tag to a flag country code.
|
|
20
|
-
* A region subtag wins (`en-US` → `us`); otherwise the base language is mapped.
|
|
20
|
+
* A region subtag wins (`en-US` → `us`); otherwise the base language is mapped. The region subtag
|
|
21
|
+
* isn't always in the second position -- a script subtag (e.g. `zh-Hant-TW`, ISO 15924, always 4
|
|
22
|
+
* letters) can sit between the base language and the region, so every subtag after the base is
|
|
23
|
+
* scanned for the first 2-letter alpha match rather than assuming it's always `parts[1]`.
|
|
21
24
|
*/
|
|
22
25
|
export declare function languageToCountry(language: string): string | undefined;
|
|
@@ -61,13 +61,16 @@ export const LANGUAGE_TO_COUNTRY = {
|
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
63
|
* Resolve a BCP-47-ish language tag to a flag country code.
|
|
64
|
-
* A region subtag wins (`en-US` → `us`); otherwise the base language is mapped.
|
|
64
|
+
* A region subtag wins (`en-US` → `us`); otherwise the base language is mapped. The region subtag
|
|
65
|
+
* isn't always in the second position -- a script subtag (e.g. `zh-Hant-TW`, ISO 15924, always 4
|
|
66
|
+
* letters) can sit between the base language and the region, so every subtag after the base is
|
|
67
|
+
* scanned for the first 2-letter alpha match rather than assuming it's always `parts[1]`.
|
|
65
68
|
*/
|
|
66
69
|
export function languageToCountry(language) {
|
|
67
70
|
const parts = language.toLowerCase().split(/[-_]/);
|
|
68
71
|
const base = parts[0];
|
|
69
|
-
const region = parts
|
|
70
|
-
if (region
|
|
72
|
+
const region = parts.slice(1).find((part) => ALPHA2_RE.test(part));
|
|
73
|
+
if (region)
|
|
71
74
|
return region;
|
|
72
75
|
return LANGUAGE_TO_COUNTRY[base];
|
|
73
76
|
}
|
|
@@ -6,7 +6,11 @@ export type GaugeType = 'radial' | 'linear';
|
|
|
6
6
|
* generic gauge widget exists in Web Awesome.
|
|
7
7
|
*
|
|
8
8
|
* @customElement lyra-gauge
|
|
9
|
-
* @csspart base
|
|
9
|
+
* @csspart base - The root `<svg>`.
|
|
10
|
+
* @csspart track - The background track arc/line.
|
|
11
|
+
* @csspart fill - The animated fill arc/line.
|
|
12
|
+
* @csspart value - The value text.
|
|
13
|
+
* @csspart label - The label text.
|
|
10
14
|
*/
|
|
11
15
|
export declare class LyraGauge extends LyraElement {
|
|
12
16
|
static styles: import("lit").CSSResultGroup[];
|
|
@@ -18,7 +22,12 @@ export declare class LyraGauge extends LyraElement {
|
|
|
18
22
|
/** Imperative override for the displayed/announced value text, e.g. `'72°F'` for a raw `value` of `72`.
|
|
19
23
|
* An empty string is treated the same as unset and falls back to the numeric `value`. */
|
|
20
24
|
valueLabel?: string;
|
|
25
|
+
private get domain();
|
|
21
26
|
private get ratio();
|
|
27
|
+
/** The text rendered/announced for the current value: `valueLabel` when set,
|
|
28
|
+
* else the numeric `value`, blanked (like the ARIA attributes and fill) when
|
|
29
|
+
* `value` is non-finite (NaN/undefined/Infinity/-Infinity). */
|
|
30
|
+
private get displayText();
|
|
22
31
|
protected willUpdate(): void;
|
|
23
32
|
private renderRadial;
|
|
24
33
|
private renderLinear;
|