@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
|
@@ -19,7 +19,11 @@ export interface BoxPlotSeries {
|
|
|
19
19
|
* Awesome's chart set — useful for summarizing distributions.
|
|
20
20
|
*
|
|
21
21
|
* @customElement lyra-box-plot
|
|
22
|
-
* @csspart base
|
|
22
|
+
* @csspart base - The chart wrapper.
|
|
23
|
+
* @csspart canvas - The box-plot canvas.
|
|
24
|
+
* @csspart description - The accessible box-plot summary.
|
|
25
|
+
* @csspart data-table - The optional generated or slotted data table.
|
|
26
|
+
* @slot data-table - An optional consumer-provided accessible table alternative.
|
|
23
27
|
*/
|
|
24
28
|
export declare class LyraBoxPlot extends LyraElement {
|
|
25
29
|
static styles: import("lit").CSSResultGroup[];
|
|
@@ -29,21 +33,41 @@ export declare class LyraBoxPlot extends LyraElement {
|
|
|
29
33
|
height: string;
|
|
30
34
|
yLabel: string;
|
|
31
35
|
beginAtZero: boolean;
|
|
36
|
+
/** Accessible name applied to the canvas. Falls back to the box labels. */
|
|
37
|
+
accessibleLabel: string;
|
|
38
|
+
/** Accessible description for the canvas. When unset, a five-number summary is generated. */
|
|
39
|
+
accessibleDescription: string;
|
|
40
|
+
/** Makes the generated data table visible; it remains screen-reader available when false. */
|
|
41
|
+
showDataTable: boolean;
|
|
32
42
|
/**
|
|
33
43
|
* True until the lazy-loaded `chart.js` + `@sgratzl/chartjs-chart-boxplot`
|
|
34
44
|
* peer dependencies have settled (success or failure) — mirrors
|
|
35
45
|
* `LyraChart`'s `loading` state.
|
|
36
46
|
*/
|
|
37
47
|
private loading;
|
|
48
|
+
private visible;
|
|
49
|
+
private intersectionObserver?;
|
|
38
50
|
private canvasEl?;
|
|
39
51
|
private chart?;
|
|
40
52
|
private chartJsModule?;
|
|
53
|
+
private descriptionId;
|
|
41
54
|
connectedCallback(): void;
|
|
42
55
|
private onBoxPlotPluginLoaded;
|
|
43
56
|
disconnectedCallback(): void;
|
|
44
57
|
protected updated(changed: PropertyValues): void;
|
|
58
|
+
/**
|
|
59
|
+
* Resolves the `--lyra-chart-*` theme tokens (declared in
|
|
60
|
+
* `box-plot.styles.ts`, each layered over an existing semantic token) via
|
|
61
|
+
* `getComputedStyle`. Chart.js renders to canvas, not the DOM, so it can't
|
|
62
|
+
* consume CSS `var()` directly — same constraint `chart.ts`'s
|
|
63
|
+
* `themeColors()` documents — so this is called fresh from `buildConfig()`
|
|
64
|
+
* on every draw rather than cached.
|
|
65
|
+
*/
|
|
66
|
+
private themeColors;
|
|
45
67
|
private buildConfig;
|
|
46
68
|
private draw;
|
|
69
|
+
private boxPlotDescription;
|
|
70
|
+
private renderDataTable;
|
|
47
71
|
render(): TemplateResult;
|
|
48
72
|
}
|
|
49
73
|
declare global {
|
|
@@ -8,9 +8,21 @@ import { html } from 'lit';
|
|
|
8
8
|
import { property, query, state } from 'lit/decorators.js';
|
|
9
9
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
10
|
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { nextId, srOnly } from '../../internal/a11y.js';
|
|
11
12
|
import { loadChartJs } from './chart-loader.js';
|
|
12
13
|
import { styles } from './box-plot.styles.js';
|
|
13
14
|
import '../skeleton/skeleton.js';
|
|
15
|
+
// Defensive JS-side fallbacks for themeColors() below, mirroring the
|
|
16
|
+
// light-mode default of each `--lyra-chart-*` token's own fallback chain
|
|
17
|
+
// (see box-plot.styles.ts) — only reached if getComputedStyle somehow can't
|
|
18
|
+
// resolve the custom property at all (e.g. host detached from the document).
|
|
19
|
+
// Same values as chart.ts's own fallbacks, since both default to the same
|
|
20
|
+
// semantic tokens.
|
|
21
|
+
const FALLBACK_GRID_COLOR = '#8a8a90';
|
|
22
|
+
const FALLBACK_TICK_COLOR = '#6b7280';
|
|
23
|
+
const FALLBACK_LEGEND_COLOR = '#1a1a1a';
|
|
24
|
+
const FALLBACK_TOOLTIP_BG = '#fff';
|
|
25
|
+
const FALLBACK_TOOLTIP_TEXT = '#1a1a1a';
|
|
14
26
|
let boxPlotPlugin;
|
|
15
27
|
/**
|
|
16
28
|
* Lazily loads `@sgratzl/chartjs-chart-boxplot` and registers its controller
|
|
@@ -40,7 +52,11 @@ function loadBoxPlotPlugin() {
|
|
|
40
52
|
* Awesome's chart set — useful for summarizing distributions.
|
|
41
53
|
*
|
|
42
54
|
* @customElement lyra-box-plot
|
|
43
|
-
* @csspart base
|
|
55
|
+
* @csspart base - The chart wrapper.
|
|
56
|
+
* @csspart canvas - The box-plot canvas.
|
|
57
|
+
* @csspart description - The accessible box-plot summary.
|
|
58
|
+
* @csspart data-table - The optional generated or slotted data table.
|
|
59
|
+
* @slot data-table - An optional consumer-provided accessible table alternative.
|
|
44
60
|
*/
|
|
45
61
|
export class LyraBoxPlot extends LyraElement {
|
|
46
62
|
constructor() {
|
|
@@ -51,17 +67,34 @@ export class LyraBoxPlot extends LyraElement {
|
|
|
51
67
|
this.height = '280px';
|
|
52
68
|
this.yLabel = '';
|
|
53
69
|
this.beginAtZero = true;
|
|
70
|
+
/** Accessible name applied to the canvas. Falls back to the box labels. */
|
|
71
|
+
this.accessibleLabel = '';
|
|
72
|
+
/** Accessible description for the canvas. When unset, a five-number summary is generated. */
|
|
73
|
+
this.accessibleDescription = '';
|
|
74
|
+
/** Makes the generated data table visible; it remains screen-reader available when false. */
|
|
75
|
+
this.showDataTable = false;
|
|
54
76
|
/**
|
|
55
77
|
* True until the lazy-loaded `chart.js` + `@sgratzl/chartjs-chart-boxplot`
|
|
56
78
|
* peer dependencies have settled (success or failure) — mirrors
|
|
57
79
|
* `LyraChart`'s `loading` state.
|
|
58
80
|
*/
|
|
59
81
|
this.loading = true;
|
|
82
|
+
this.visible = true;
|
|
83
|
+
this.descriptionId = nextId('box-plot-description');
|
|
60
84
|
}
|
|
61
|
-
static { this.styles = [LyraElement.styles, styles]; }
|
|
85
|
+
static { this.styles = [LyraElement.styles, styles, srOnly]; }
|
|
62
86
|
connectedCallback() {
|
|
63
87
|
super.connectedCallback();
|
|
64
88
|
void loadBoxPlotPlugin().then((boxMod) => this.onBoxPlotPluginLoaded(boxMod));
|
|
89
|
+
if (typeof IntersectionObserver !== 'undefined') {
|
|
90
|
+
this.intersectionObserver = new IntersectionObserver((entries) => {
|
|
91
|
+
const wasVisible = this.visible;
|
|
92
|
+
this.visible = entries[0]?.isIntersecting ?? true;
|
|
93
|
+
if (this.visible && !wasVisible)
|
|
94
|
+
this.draw();
|
|
95
|
+
});
|
|
96
|
+
this.intersectionObserver.observe(this);
|
|
97
|
+
}
|
|
65
98
|
}
|
|
66
99
|
// Split out from `connectedCallback()` so the partial-peer-dependency-
|
|
67
100
|
// failure path (chart.js loads fine, `@sgratzl/chartjs-chart-boxplot`
|
|
@@ -70,17 +103,28 @@ export class LyraBoxPlot extends LyraElement {
|
|
|
70
103
|
// case, so this must gate on its resolved value — mirroring the correct,
|
|
71
104
|
// established pattern in `LyraChart.connectedCallback()` — instead of
|
|
72
105
|
// unconditionally re-awaiting the already-cached `loadChartJs()` promise.
|
|
106
|
+
//
|
|
107
|
+
// Also guards against a disconnect while either lazy peer import is still
|
|
108
|
+
// in flight: `this.isConnected` is re-checked after each `await` gap, so a
|
|
109
|
+
// `<lyra-box-plot>` removed before the load settles never constructs a
|
|
110
|
+
// `Chart` bound to a (possibly detached) canvas.
|
|
73
111
|
async onBoxPlotPluginLoaded(boxMod) {
|
|
112
|
+
if (!this.isConnected)
|
|
113
|
+
return;
|
|
74
114
|
this.loading = false;
|
|
75
115
|
if (!boxMod)
|
|
76
116
|
return;
|
|
77
|
-
|
|
117
|
+
const chartMod = await loadChartJs();
|
|
118
|
+
if (!this.isConnected)
|
|
119
|
+
return;
|
|
120
|
+
this.chartJsModule = chartMod ?? undefined;
|
|
78
121
|
this.draw();
|
|
79
122
|
}
|
|
80
123
|
disconnectedCallback() {
|
|
81
124
|
super.disconnectedCallback();
|
|
82
125
|
this.chart?.destroy();
|
|
83
126
|
this.chart = undefined;
|
|
127
|
+
this.intersectionObserver?.disconnect();
|
|
84
128
|
}
|
|
85
129
|
updated(changed) {
|
|
86
130
|
if (this.loading)
|
|
@@ -95,9 +139,35 @@ export class LyraBoxPlot extends LyraElement {
|
|
|
95
139
|
if (changed.has('height')) {
|
|
96
140
|
this.style.setProperty('--lyra-chart-height', this.height);
|
|
97
141
|
}
|
|
142
|
+
if (this.loading)
|
|
143
|
+
return;
|
|
144
|
+
if (!this.visible)
|
|
145
|
+
return; // becoming visible again triggers its own draw() via the observer above
|
|
146
|
+
const contentChanged = ['labels', 'boxes', 'legend', 'height', 'yLabel', 'beginAtZero', 'loading'].some((name) => changed.has(name));
|
|
147
|
+
if (!contentChanged)
|
|
148
|
+
return;
|
|
98
149
|
this.draw();
|
|
99
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Resolves the `--lyra-chart-*` theme tokens (declared in
|
|
153
|
+
* `box-plot.styles.ts`, each layered over an existing semantic token) via
|
|
154
|
+
* `getComputedStyle`. Chart.js renders to canvas, not the DOM, so it can't
|
|
155
|
+
* consume CSS `var()` directly — same constraint `chart.ts`'s
|
|
156
|
+
* `themeColors()` documents — so this is called fresh from `buildConfig()`
|
|
157
|
+
* on every draw rather than cached.
|
|
158
|
+
*/
|
|
159
|
+
themeColors() {
|
|
160
|
+
const cs = getComputedStyle(this);
|
|
161
|
+
return {
|
|
162
|
+
grid: cs.getPropertyValue('--lyra-chart-grid-color').trim() || FALLBACK_GRID_COLOR,
|
|
163
|
+
tick: cs.getPropertyValue('--lyra-chart-tick-color').trim() || FALLBACK_TICK_COLOR,
|
|
164
|
+
legend: cs.getPropertyValue('--lyra-chart-legend-color').trim() || FALLBACK_LEGEND_COLOR,
|
|
165
|
+
tooltipBg: cs.getPropertyValue('--lyra-chart-tooltip-bg').trim() || FALLBACK_TOOLTIP_BG,
|
|
166
|
+
tooltipText: cs.getPropertyValue('--lyra-chart-tooltip-text').trim() || FALLBACK_TOOLTIP_TEXT,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
100
169
|
buildConfig() {
|
|
170
|
+
const theme = this.themeColors();
|
|
101
171
|
return {
|
|
102
172
|
// boxplot isn't in chart.js's static ChartType union — same cast the seed uses.
|
|
103
173
|
type: 'boxplot',
|
|
@@ -113,8 +183,15 @@ export class LyraBoxPlot extends LyraElement {
|
|
|
113
183
|
options: {
|
|
114
184
|
responsive: true,
|
|
115
185
|
maintainAspectRatio: false,
|
|
116
|
-
plugins: { legend: { display: this.legend } },
|
|
117
|
-
scales: {
|
|
186
|
+
plugins: { legend: { display: this.legend, labels: { color: theme.legend } } },
|
|
187
|
+
scales: {
|
|
188
|
+
y: {
|
|
189
|
+
beginAtZero: this.beginAtZero,
|
|
190
|
+
title: { display: !!this.yLabel, text: this.yLabel },
|
|
191
|
+
ticks: { color: theme.tick },
|
|
192
|
+
grid: { color: theme.grid },
|
|
193
|
+
},
|
|
194
|
+
},
|
|
118
195
|
},
|
|
119
196
|
};
|
|
120
197
|
}
|
|
@@ -138,6 +215,51 @@ export class LyraBoxPlot extends LyraElement {
|
|
|
138
215
|
}
|
|
139
216
|
this.chart = new this.chartJsModule.Chart(this.canvasEl, config);
|
|
140
217
|
}
|
|
218
|
+
boxPlotDescription() {
|
|
219
|
+
if (this.accessibleDescription)
|
|
220
|
+
return this.accessibleDescription;
|
|
221
|
+
const summaries = this.boxes.map((series) => {
|
|
222
|
+
if (!series.data.length)
|
|
223
|
+
return `${series.label}: no data`;
|
|
224
|
+
const medians = series.data.map((point) => point.median);
|
|
225
|
+
const first = medians[0];
|
|
226
|
+
const last = medians[medians.length - 1];
|
|
227
|
+
const trend = last > first ? 'increasing' : last < first ? 'decreasing' : 'flat';
|
|
228
|
+
return `${series.label}: ${series.data.length} distributions, median range ${Math.min(...medians)} to ${Math.max(...medians)}, ${trend} median trend`;
|
|
229
|
+
});
|
|
230
|
+
return `Box plot${summaries.length ? `. ${summaries.join('. ')}` : ' with no data'}.`;
|
|
231
|
+
}
|
|
232
|
+
renderDataTable() {
|
|
233
|
+
return html `
|
|
234
|
+
<table class=${this.showDataTable ? '' : 'sr-only'}>
|
|
235
|
+
<caption>${this.accessibleLabel || 'Box plot data'}</caption>
|
|
236
|
+
<thead>
|
|
237
|
+
<tr>
|
|
238
|
+
<th scope="col">Category</th>
|
|
239
|
+
<th scope="col">Series</th>
|
|
240
|
+
<th scope="col">Min</th>
|
|
241
|
+
<th scope="col">Q1</th>
|
|
242
|
+
<th scope="col">Median</th>
|
|
243
|
+
<th scope="col">Q3</th>
|
|
244
|
+
<th scope="col">Max</th>
|
|
245
|
+
</tr>
|
|
246
|
+
</thead>
|
|
247
|
+
<tbody>
|
|
248
|
+
${this.boxes.flatMap((series) => series.data.map((point, index) => html `
|
|
249
|
+
<tr>
|
|
250
|
+
<th scope="row">${this.labels[index] ?? `Point ${index + 1}`}</th>
|
|
251
|
+
<td>${series.label}</td>
|
|
252
|
+
<td>${point.min}</td>
|
|
253
|
+
<td>${point.q1}</td>
|
|
254
|
+
<td>${point.median}</td>
|
|
255
|
+
<td>${point.q3}</td>
|
|
256
|
+
<td>${point.max}</td>
|
|
257
|
+
</tr>
|
|
258
|
+
`))}
|
|
259
|
+
</tbody>
|
|
260
|
+
</table>
|
|
261
|
+
`;
|
|
262
|
+
}
|
|
141
263
|
render() {
|
|
142
264
|
if (this.loading) {
|
|
143
265
|
return html `
|
|
@@ -146,10 +268,16 @@ export class LyraBoxPlot extends LyraElement {
|
|
|
146
268
|
</div>
|
|
147
269
|
`;
|
|
148
270
|
}
|
|
149
|
-
const label = this.boxes.map((b) => b.label).join(', ') || 'Box plot';
|
|
271
|
+
const label = this.accessibleLabel || this.boxes.map((b) => b.label).join(', ') || 'Box plot';
|
|
272
|
+
const description = this.boxPlotDescription();
|
|
150
273
|
return html `
|
|
151
274
|
<div part="base">
|
|
152
|
-
<canvas part="canvas" role="img" aria-label=${label}></canvas>
|
|
275
|
+
<canvas part="canvas" role="img" aria-label=${label} aria-describedby=${this.descriptionId}></canvas>
|
|
276
|
+
<p part="description" id=${this.descriptionId} class="sr-only">${description}</p>
|
|
277
|
+
<div part="data-table">
|
|
278
|
+
<slot name="data-table"></slot>
|
|
279
|
+
${this.renderDataTable()}
|
|
280
|
+
</div>
|
|
153
281
|
</div>
|
|
154
282
|
`;
|
|
155
283
|
}
|
|
@@ -172,9 +300,21 @@ __decorate([
|
|
|
172
300
|
__decorate([
|
|
173
301
|
property({ type: Boolean, attribute: 'begin-at-zero' })
|
|
174
302
|
], LyraBoxPlot.prototype, "beginAtZero", void 0);
|
|
303
|
+
__decorate([
|
|
304
|
+
property({ attribute: 'accessible-label' })
|
|
305
|
+
], LyraBoxPlot.prototype, "accessibleLabel", void 0);
|
|
306
|
+
__decorate([
|
|
307
|
+
property({ attribute: 'accessible-description' })
|
|
308
|
+
], LyraBoxPlot.prototype, "accessibleDescription", void 0);
|
|
309
|
+
__decorate([
|
|
310
|
+
property({ type: Boolean, attribute: 'show-data-table' })
|
|
311
|
+
], LyraBoxPlot.prototype, "showDataTable", void 0);
|
|
175
312
|
__decorate([
|
|
176
313
|
state()
|
|
177
314
|
], LyraBoxPlot.prototype, "loading", void 0);
|
|
315
|
+
__decorate([
|
|
316
|
+
state()
|
|
317
|
+
], LyraBoxPlot.prototype, "visible", void 0);
|
|
178
318
|
__decorate([
|
|
179
319
|
query('canvas')
|
|
180
320
|
], LyraBoxPlot.prototype, "canvasEl", void 0);
|
|
@@ -9,6 +9,19 @@ export const styles = css `
|
|
|
9
9
|
display: block;
|
|
10
10
|
position: relative;
|
|
11
11
|
block-size: var(--lyra-chart-height, 280px);
|
|
12
|
+
/* Same theme tokens as chart.styles.ts's :host — Chart.js renders to
|
|
13
|
+
canvas, not the DOM, so it can't consume CSS var() directly;
|
|
14
|
+
box-plot.ts's themeColors() resolves these once per draw() via
|
|
15
|
+
getComputedStyle, mirroring chart.ts. Each is its own token (rather
|
|
16
|
+
than reusing the semantic ones directly) so a host can retheme just
|
|
17
|
+
the chart's grid/ticks/legend/tooltip without affecting unrelated
|
|
18
|
+
text/border/surface colors elsewhere in the component, while still
|
|
19
|
+
defaulting to those semantic tokens. */
|
|
20
|
+
--lyra-chart-grid-color: var(--lyra-color-border);
|
|
21
|
+
--lyra-chart-tick-color: var(--lyra-color-text-quiet);
|
|
22
|
+
--lyra-chart-legend-color: var(--lyra-color-text);
|
|
23
|
+
--lyra-chart-tooltip-bg: var(--lyra-color-surface);
|
|
24
|
+
--lyra-chart-tooltip-text: var(--lyra-color-text);
|
|
12
25
|
}
|
|
13
26
|
[part='base'] {
|
|
14
27
|
position: relative;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LyraChart } from './chart.js';
|
|
1
|
+
import { LyraChart, lockChartType } from './chart.js';
|
|
2
2
|
import { defineElement } from '../../internal/prefix.js';
|
|
3
3
|
/**
|
|
4
4
|
* `<lyra-bubble-chart>` — `<lyra-chart>` with `type` locked to `"bubble"`. Feed
|
|
@@ -11,21 +11,5 @@ import { defineElement } from '../../internal/prefix.js';
|
|
|
11
11
|
*/
|
|
12
12
|
export class LyraBubbleChart extends LyraChart {
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
// default value — `LyraChart` declares it as a plain (decorator-managed)
|
|
16
|
-
// class field, and TypeScript forbids a subclass from re-declaring a base
|
|
17
|
-
// field as a getter/setter pair via ordinary class syntax (TS2611) — so the
|
|
18
|
-
// accessor pair is installed directly on the prototype instead, which is
|
|
19
|
-
// runtime-equivalent (same shadowing semantics as a class-syntax override)
|
|
20
|
-
// without tripping that check.
|
|
21
|
-
Object.defineProperty(LyraBubbleChart.prototype, 'type', {
|
|
22
|
-
configurable: true,
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get() {
|
|
25
|
-
return 'bubble';
|
|
26
|
-
},
|
|
27
|
-
set(_v) {
|
|
28
|
-
/* locked to 'bubble'; direct writes are ignored */
|
|
29
|
-
},
|
|
30
|
-
});
|
|
14
|
+
lockChartType(LyraBubbleChart, 'bubble');
|
|
31
15
|
defineElement('bubble-chart', LyraBubbleChart);
|
|
@@ -1,25 +1,56 @@
|
|
|
1
1
|
import type * as ChartJsModule from 'chart.js';
|
|
2
2
|
import type ZoomPlugin from 'chartjs-plugin-zoom';
|
|
3
3
|
/**
|
|
4
|
-
* Independently loads the mandatory `chart.js` peer dependency and
|
|
5
|
-
* opt-in `chartjs-plugin-zoom` peer dependency
|
|
6
|
-
* (`chart.js` only, which `peerDependenciesMeta`
|
|
7
|
-
* combination) degrades to "charts render, zoom is inert"
|
|
8
|
-
* chart breaking.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* Independently loads the mandatory `chart.js` peer dependency and, only
|
|
5
|
+
* when `needsZoom` is true, the opt-in `chartjs-plugin-zoom` peer dependency
|
|
6
|
+
* — so a partial install (`chart.js` only, which `peerDependenciesMeta`
|
|
7
|
+
* marks as a valid combination) degrades to "charts render, zoom is inert"
|
|
8
|
+
* instead of every chart breaking. `needsZoom` defaults to `false` because
|
|
9
|
+
* most charts never set `zoom`, and `chartjs-plugin-zoom` has a hard
|
|
10
|
+
* dependency on `hammerjs` — no point paying that import cost for every
|
|
11
|
+
* chart on the page. Exported (in addition to `loadChartJs()`/
|
|
12
|
+
* `loadChartJsWithZoom()` below) so both failure paths — and the real caught
|
|
13
|
+
* error each one logs — are directly testable without needing to actually
|
|
14
|
+
* uninstall either package.
|
|
11
15
|
*/
|
|
12
16
|
export declare function loadChartAndZoom(importChart?: () => Promise<typeof ChartJsModule>, importZoom?: () => Promise<{
|
|
13
17
|
default: typeof ZoomPlugin;
|
|
14
|
-
}
|
|
18
|
+
}>, needsZoom?: boolean): Promise<{
|
|
15
19
|
mod: typeof ChartJsModule;
|
|
16
20
|
zoomPlugin: typeof ZoomPlugin | undefined;
|
|
17
21
|
} | null>;
|
|
18
22
|
/**
|
|
19
|
-
* Lazily loads the optional peer dependency `chart.js`
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* Lazily loads the optional peer dependency `chart.js` once per page,
|
|
24
|
+
* registering only the tree-shaken subset this library uses.
|
|
25
|
+
* `chartjs-plugin-zoom` is *not* loaded here — see `loadChartJsWithZoom()`
|
|
26
|
+
* below, which any chart that actually sets `zoom` should call instead.
|
|
27
|
+
* Resolves to `null` if chart.js isn't installed.
|
|
24
28
|
*/
|
|
25
29
|
export declare function loadChartJs(): Promise<typeof ChartJsModule | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Loads `chart.js` (reusing the cached load above) plus `chartjs-plugin-zoom`,
|
|
32
|
+
* on first actual demand — most charts never set `zoom`, and the plugin has
|
|
33
|
+
* a hard dependency on `hammerjs`. Registers the plugin at most once across
|
|
34
|
+
* the page. Call this instead of `loadChartJs()` from any chart that has
|
|
35
|
+
* `zoom` set (at connect time, or later once `zoom` turns on).
|
|
36
|
+
*
|
|
37
|
+
* The whole operation (chart.js core + the zoom plugin import + its
|
|
38
|
+
* registration) is memoized behind a single `zoomLoad` promise, assigned
|
|
39
|
+
* synchronously before any `await` — mirroring `loadChartJs()`'s own
|
|
40
|
+
* `chartJs` memoization above. A plain boolean "already registered" guard
|
|
41
|
+
* checked before an `await` and only set after would leave a check-then-act
|
|
42
|
+
* race across that `await` boundary: two callers racing to turn `zoom` on
|
|
43
|
+
* close together (e.g. two `<lyra-chart zoom>` elements connecting around
|
|
44
|
+
* the same time) could both pass the check before either sets the flag,
|
|
45
|
+
* each independently re-importing the plugin and calling
|
|
46
|
+
* `mod.Chart.register()`. A single promise assigned up front closes that
|
|
47
|
+
* window — the second caller synchronously observes `zoomLoad` already set
|
|
48
|
+
* and awaits the same in-flight load instead of starting its own.
|
|
49
|
+
*
|
|
50
|
+
* `importZoom` defaults to the real dynamic import; it's a parameter purely
|
|
51
|
+
* so tests can instrument/count the underlying import without needing to
|
|
52
|
+
* actually uninstall the package.
|
|
53
|
+
*/
|
|
54
|
+
export declare function loadChartJsWithZoom(importZoom?: () => Promise<{
|
|
55
|
+
default: typeof ZoomPlugin;
|
|
56
|
+
}>): Promise<typeof ChartJsModule | null>;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
let chartJs;
|
|
2
|
+
let zoomLoad;
|
|
2
3
|
let registered = false;
|
|
3
4
|
/**
|
|
4
|
-
* Independently loads the mandatory `chart.js` peer dependency and
|
|
5
|
-
* opt-in `chartjs-plugin-zoom` peer dependency
|
|
6
|
-
* (`chart.js` only, which `peerDependenciesMeta`
|
|
7
|
-
* combination) degrades to "charts render, zoom is inert"
|
|
8
|
-
* chart breaking.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* Independently loads the mandatory `chart.js` peer dependency and, only
|
|
6
|
+
* when `needsZoom` is true, the opt-in `chartjs-plugin-zoom` peer dependency
|
|
7
|
+
* — so a partial install (`chart.js` only, which `peerDependenciesMeta`
|
|
8
|
+
* marks as a valid combination) degrades to "charts render, zoom is inert"
|
|
9
|
+
* instead of every chart breaking. `needsZoom` defaults to `false` because
|
|
10
|
+
* most charts never set `zoom`, and `chartjs-plugin-zoom` has a hard
|
|
11
|
+
* dependency on `hammerjs` — no point paying that import cost for every
|
|
12
|
+
* chart on the page. Exported (in addition to `loadChartJs()`/
|
|
13
|
+
* `loadChartJsWithZoom()` below) so both failure paths — and the real caught
|
|
14
|
+
* error each one logs — are directly testable without needing to actually
|
|
15
|
+
* uninstall either package.
|
|
11
16
|
*/
|
|
12
|
-
export async function loadChartAndZoom(importChart = () => import('chart.js'), importZoom = () => import('chartjs-plugin-zoom')) {
|
|
17
|
+
export async function loadChartAndZoom(importChart = () => import('chart.js'), importZoom = () => import('chartjs-plugin-zoom'), needsZoom = false) {
|
|
13
18
|
let mod;
|
|
14
19
|
try {
|
|
15
20
|
mod = await importChart();
|
|
@@ -18,6 +23,8 @@ export async function loadChartAndZoom(importChart = () => import('chart.js'), i
|
|
|
18
23
|
console.warn('<lyra-chart> needs the optional peer dependency `chart.js` — install it with `pnpm add chart.js`:', err);
|
|
19
24
|
return null;
|
|
20
25
|
}
|
|
26
|
+
if (!needsZoom)
|
|
27
|
+
return { mod, zoomPlugin: undefined };
|
|
21
28
|
let zoomPlugin;
|
|
22
29
|
try {
|
|
23
30
|
zoomPlugin = (await importZoom()).default;
|
|
@@ -29,25 +36,65 @@ export async function loadChartAndZoom(importChart = () => import('chart.js'), i
|
|
|
29
36
|
}
|
|
30
37
|
return { mod, zoomPlugin };
|
|
31
38
|
}
|
|
39
|
+
function registerCore(mod) {
|
|
40
|
+
if (registered)
|
|
41
|
+
return;
|
|
42
|
+
mod.Chart.register(mod.LineController, mod.BarController, mod.ScatterController, mod.DoughnutController, mod.PieController, mod.RadarController, mod.PolarAreaController, mod.BubbleController, mod.LineElement, mod.PointElement, mod.BarElement, mod.ArcElement, mod.LinearScale, mod.CategoryScale, mod.RadialLinearScale, mod.Filler, mod.Tooltip, mod.Legend);
|
|
43
|
+
registered = true;
|
|
44
|
+
}
|
|
32
45
|
/**
|
|
33
|
-
* Lazily loads the optional peer dependency `chart.js`
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
46
|
+
* Lazily loads the optional peer dependency `chart.js` once per page,
|
|
47
|
+
* registering only the tree-shaken subset this library uses.
|
|
48
|
+
* `chartjs-plugin-zoom` is *not* loaded here — see `loadChartJsWithZoom()`
|
|
49
|
+
* below, which any chart that actually sets `zoom` should call instead.
|
|
50
|
+
* Resolves to `null` if chart.js isn't installed.
|
|
38
51
|
*/
|
|
39
52
|
export function loadChartJs() {
|
|
40
53
|
if (!chartJs) {
|
|
41
54
|
chartJs = loadChartAndZoom().then((result) => {
|
|
42
55
|
if (!result)
|
|
43
56
|
return null;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
registerCore(result.mod);
|
|
58
|
+
return result.mod;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return chartJs;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Loads `chart.js` (reusing the cached load above) plus `chartjs-plugin-zoom`,
|
|
65
|
+
* on first actual demand — most charts never set `zoom`, and the plugin has
|
|
66
|
+
* a hard dependency on `hammerjs`. Registers the plugin at most once across
|
|
67
|
+
* the page. Call this instead of `loadChartJs()` from any chart that has
|
|
68
|
+
* `zoom` set (at connect time, or later once `zoom` turns on).
|
|
69
|
+
*
|
|
70
|
+
* The whole operation (chart.js core + the zoom plugin import + its
|
|
71
|
+
* registration) is memoized behind a single `zoomLoad` promise, assigned
|
|
72
|
+
* synchronously before any `await` — mirroring `loadChartJs()`'s own
|
|
73
|
+
* `chartJs` memoization above. A plain boolean "already registered" guard
|
|
74
|
+
* checked before an `await` and only set after would leave a check-then-act
|
|
75
|
+
* race across that `await` boundary: two callers racing to turn `zoom` on
|
|
76
|
+
* close together (e.g. two `<lyra-chart zoom>` elements connecting around
|
|
77
|
+
* the same time) could both pass the check before either sets the flag,
|
|
78
|
+
* each independently re-importing the plugin and calling
|
|
79
|
+
* `mod.Chart.register()`. A single promise assigned up front closes that
|
|
80
|
+
* window — the second caller synchronously observes `zoomLoad` already set
|
|
81
|
+
* and awaits the same in-flight load instead of starting its own.
|
|
82
|
+
*
|
|
83
|
+
* `importZoom` defaults to the real dynamic import; it's a parameter purely
|
|
84
|
+
* so tests can instrument/count the underlying import without needing to
|
|
85
|
+
* actually uninstall the package.
|
|
86
|
+
*/
|
|
87
|
+
export function loadChartJsWithZoom(importZoom = () => import('chartjs-plugin-zoom')) {
|
|
88
|
+
if (!zoomLoad) {
|
|
89
|
+
zoomLoad = loadChartJs().then(async (mod) => {
|
|
90
|
+
if (!mod)
|
|
91
|
+
return null;
|
|
92
|
+
const result = await loadChartAndZoom(() => Promise.resolve(mod), importZoom, true);
|
|
93
|
+
if (result?.zoomPlugin) {
|
|
94
|
+
mod.Chart.register(result.zoomPlugin);
|
|
48
95
|
}
|
|
49
96
|
return mod;
|
|
50
97
|
});
|
|
51
98
|
}
|
|
52
|
-
return
|
|
99
|
+
return zoomLoad;
|
|
53
100
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
-
import type { ChartConfiguration } from 'chart.js';
|
|
3
2
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
4
3
|
import '../skeleton/skeleton.js';
|
|
5
4
|
export interface Series {
|
|
@@ -46,7 +45,12 @@ export type LyraChartType = 'line' | 'bar' | 'scatter' | 'pie' | 'doughnut' | 'r
|
|
|
46
45
|
* intersect-only — see `handlePointClick()`) a data point/segment.
|
|
47
46
|
* `detail: { datasetIndex: number, index: number, label: string |
|
|
48
47
|
* undefined, value: unknown }`.
|
|
49
|
-
* @csspart base
|
|
48
|
+
* @csspart base - The chart wrapper.
|
|
49
|
+
* @csspart canvas - The Chart.js canvas.
|
|
50
|
+
* @csspart reset-zoom-button - The reset-zoom control when zoom is active.
|
|
51
|
+
* @csspart description - The accessible chart summary.
|
|
52
|
+
* @csspart data-table - The optional generated or slotted data table.
|
|
53
|
+
* @slot data-table - An optional consumer-provided accessible table alternative.
|
|
50
54
|
*/
|
|
51
55
|
export declare class LyraChart extends LyraElement {
|
|
52
56
|
static styles: import("lit").CSSResultGroup[];
|
|
@@ -61,6 +65,12 @@ export declare class LyraChart extends LyraElement {
|
|
|
61
65
|
yLabel: string;
|
|
62
66
|
y2Label: string;
|
|
63
67
|
beginAtZero: boolean;
|
|
68
|
+
/** Accessible name applied to the canvas. Falls back to the dataset labels. */
|
|
69
|
+
accessibleLabel: string;
|
|
70
|
+
/** Accessible description for the canvas. When unset, a concise data/trend summary is generated. */
|
|
71
|
+
accessibleDescription: string;
|
|
72
|
+
/** Makes the generated data table visible; it remains screen-reader available when false. */
|
|
73
|
+
showDataTable: boolean;
|
|
64
74
|
/** Sets `options.indexAxis = 'y'`, Chart.js's own mechanism for horizontal bars (also applies to line/area types). */
|
|
65
75
|
horizontal: boolean;
|
|
66
76
|
/** Stacks the `x`/`y`(/`y2`) scale entries `buildScales()` returns; only meaningful for `bar` and `line` types. */
|
|
@@ -73,20 +83,35 @@ export declare class LyraChart extends LyraElement {
|
|
|
73
83
|
* without discarding sibling keys the generated config set), for consumers
|
|
74
84
|
* who need full Chart.js control beyond the simplified `Series` shape.
|
|
75
85
|
*/
|
|
76
|
-
config?: Partial<ChartConfiguration>;
|
|
86
|
+
config?: Partial<import('chart.js').ChartConfiguration>;
|
|
77
87
|
/** True until the lazy-loaded `chart.js` peer dependency has settled (success or failure). */
|
|
78
88
|
private loading;
|
|
79
89
|
private zoomed;
|
|
80
90
|
private visible;
|
|
81
91
|
private intersectionObserver?;
|
|
82
|
-
private lastSignature;
|
|
83
92
|
private canvasEl?;
|
|
84
93
|
private chart?;
|
|
85
94
|
private chartJsModule?;
|
|
86
95
|
private builtType?;
|
|
87
96
|
private suppressZoomComplete;
|
|
97
|
+
private descriptionId;
|
|
88
98
|
connectedCallback(): void;
|
|
89
99
|
disconnectedCallback(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Resets a stale `zoomed` flag before the render pass that's about to call
|
|
102
|
+
* `draw()`: a `type` (or `config.type` override) change that lands on a
|
|
103
|
+
* *different* effective Chart.js type makes `draw()` destroy the old
|
|
104
|
+
* `Chart` instance and construct a brand-new one, which was never zoomed —
|
|
105
|
+
* without this, `render()`'s reset-zoom-button stays visible for an
|
|
106
|
+
* instance that has no zoom/pan state left to reset. Computed here (before
|
|
107
|
+
* render), not in `updated()`/`draw()`, because setting `zoomed` — a
|
|
108
|
+
* reactive `@state` property — from `updated()` would schedule a second,
|
|
109
|
+
* redundant update pass; `willUpdate()` runs before this cycle's render is
|
|
110
|
+
* considered complete, so the same set just folds into the render already
|
|
111
|
+
* in progress. Same rationale as `toast-item.ts`'s `willUpdate()`-vs-
|
|
112
|
+
* `updated()` split.
|
|
113
|
+
*/
|
|
114
|
+
protected willUpdate(): void;
|
|
90
115
|
protected updated(changed: PropertyValues): void;
|
|
91
116
|
private seriesToDataset;
|
|
92
117
|
/**
|
|
@@ -98,14 +123,6 @@ export declare class LyraChart extends LyraElement {
|
|
|
98
123
|
* is called fresh from `buildConfig()` on every draw rather than cached.
|
|
99
124
|
*/
|
|
100
125
|
private themeColors;
|
|
101
|
-
/**
|
|
102
|
-
* A content-affecting-properties fingerprint used by `updated()` to skip a
|
|
103
|
-
* redundant `draw()` when neither visibility nor any of these properties
|
|
104
|
-
* actually changed since the last draw (e.g. an unrelated property/state
|
|
105
|
-
* update, or `requestUpdate()` with nothing changed). Mirrors
|
|
106
|
-
* `lite-chart.ts`'s `computeSignature()`.
|
|
107
|
-
*/
|
|
108
|
-
private computeSignature;
|
|
109
126
|
/**
|
|
110
127
|
* Builds `options.scales` for the effective chart type: no scale at all for
|
|
111
128
|
* pie/doughnut (a proportional-area chart has no axis), the single radial
|
|
@@ -130,6 +147,15 @@ export declare class LyraChart extends LyraElement {
|
|
|
130
147
|
* chart type (bar/line/pie/doughnut/etc.), not just bars.
|
|
131
148
|
*/
|
|
132
149
|
private handlePointClick;
|
|
150
|
+
/**
|
|
151
|
+
* `config.type` (if set) overrides the attribute `type` post-merge — this
|
|
152
|
+
* is the one place that resolution logic lives, shared by `buildConfig()`
|
|
153
|
+
* (which needs it to build scales/interaction for the right type) and
|
|
154
|
+
* `willUpdate()` (which needs it to detect a type change against the last
|
|
155
|
+
* *actually built* type, `this.builtType`, before the render pass that
|
|
156
|
+
* would rebuild the `Chart` instance).
|
|
157
|
+
*/
|
|
158
|
+
private effectiveType;
|
|
133
159
|
private buildConfig;
|
|
134
160
|
private draw;
|
|
135
161
|
/** Reset any active zoom/pan back to the original view. */
|
|
@@ -144,6 +170,9 @@ export declare class LyraChart extends LyraElement {
|
|
|
144
170
|
* update loop has nothing of its own to trigger `draw()` on.
|
|
145
171
|
*/
|
|
146
172
|
refreshTheme(): void;
|
|
173
|
+
private seriesValues;
|
|
174
|
+
private chartDescription;
|
|
175
|
+
private renderDataTable;
|
|
147
176
|
render(): TemplateResult;
|
|
148
177
|
}
|
|
149
178
|
declare global {
|
|
@@ -151,3 +180,17 @@ declare global {
|
|
|
151
180
|
'lyra-chart': LyraChart;
|
|
152
181
|
}
|
|
153
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Installs a read-only `type` accessor pair on a `LyraChart` subclass's
|
|
185
|
+
* prototype, locking it to `value` — assigning `.type` afterwards (attribute
|
|
186
|
+
* or property) is silently ignored. `LyraChart` declares `type` as a plain
|
|
187
|
+
* (decorator-managed) class field, and TypeScript forbids a subclass from
|
|
188
|
+
* re-declaring a base field as a getter/setter pair via ordinary class
|
|
189
|
+
* syntax (TS2611), so the accessor pair is installed directly on the
|
|
190
|
+
* prototype instead, which is runtime-equivalent (same shadowing semantics
|
|
191
|
+
* as a class-syntax override) without tripping that check. Shared by every
|
|
192
|
+
* `lyra-*-chart` subclass (bar/line/pie/doughnut/scatter/bubble/radar/
|
|
193
|
+
* polarArea) plus `lyra-histogram`, replacing what used to be an identical
|
|
194
|
+
* ~16-line `Object.defineProperty` block copy-pasted into each file.
|
|
195
|
+
*/
|
|
196
|
+
export declare function lockChartType(ctor: Function, value: string): void;
|