@aceshooting/lyra-ui 29.0.2 → 29.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/CHANGELOG.md +37 -0
- package/README.md +19 -26
- package/design-tokens.json +1 -1
- package/dist/cli/migrate-wa.mjs +2 -0
- package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +5 -3
- package/dist/components/agent-tools/activity-feed/activity-feed.class.js +4 -3
- package/dist/components/agent-tools/activity-feed/activity-feed.styles.js +1 -1
- package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +21 -5
- package/dist/components/agent-tools/agent-trace/agent-trace.class.js +14 -11
- package/dist/components/agent-tools/agent-trace/agent-trace.styles.js +1 -1
- package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
- package/dist/components/agent-tools/eval-dataset/eval-dataset.class.d.ts +34 -7
- package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +25 -11
- package/dist/components/agent-tools/eval-result/eval-result-source.js +1 -0
- package/dist/components/agent-tools/eval-result/eval-result.class.d.ts +31 -11
- package/dist/components/agent-tools/eval-result/eval-result.class.js +29 -15
- package/dist/components/agent-tools/eval-result/eval-result.styles.js +1 -1
- package/dist/components/agent-tools/eval-result/eval-run-result.d.ts +10 -0
- package/dist/components/agent-tools/span-waterfall/span-waterfall.class.d.ts +26 -5
- package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +16 -6
- package/dist/components/agent-tools/span-waterfall/span-waterfall.d.ts +1 -1
- package/dist/components/agent-tools/span-waterfall/span-waterfall.js +1 -1
- package/dist/components/agent-tools/span-waterfall/span-waterfall.styles.js +1 -1
- package/dist/components/agent-tools/task-list/task-list.class.d.ts +29 -6
- package/dist/components/agent-tools/task-list/task-list.class.js +13 -7
- package/dist/components/agent-tools/task-list/task-list.d.ts +1 -1
- package/dist/components/agent-tools/task-list/task-list.js +1 -1
- package/dist/components/agent-tools/task-list/task-list.styles.js +1 -1
- package/dist/components/agent-tools/terminal/terminal.class.d.ts +9 -5
- package/dist/components/agent-tools/terminal/terminal.class.js +8 -8
- package/dist/components/agent-tools/test-results/test-results.class.d.ts +16 -4
- package/dist/components/agent-tools/test-results/test-results.class.js +15 -6
- package/dist/components/agent-tools/test-results/test-results.d.ts +1 -0
- package/dist/components/agent-tools/test-results/test-results.js +1 -1
- package/dist/components/agent-tools/test-results/test-results.styles.js +1 -1
- package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +7 -4
- package/dist/components/agent-tools/tool-timeline/tool-timeline.class.js +2 -1
- package/dist/components/agent-tools/trace-tree/span-projection.js +1 -0
- package/dist/components/agent-tools/trace-tree/span-shared.d.ts +29 -0
- package/dist/components/agent-tools/trace-tree/span-shared.js +1 -0
- package/dist/components/agent-tools/trace-tree/span.d.ts +5 -35
- package/dist/components/agent-tools/trace-tree/span.js +1 -1
- package/dist/components/agent-tools/trace-tree/trace-tree.class.d.ts +27 -5
- package/dist/components/agent-tools/trace-tree/trace-tree.class.js +19 -9
- package/dist/components/agent-tools/trace-tree/trace-tree.d.ts +1 -1
- package/dist/components/agent-tools/trace-tree/trace-tree.js +1 -1
- package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +1 -1
- package/dist/components/charts/chart/bar-chart.class.d.ts +5 -1
- package/dist/components/charts/chart/box-plot.class.d.ts +2 -2
- package/dist/components/charts/chart/box-plot.class.js +3 -3
- package/dist/components/charts/chart/bubble-chart.class.d.ts +5 -1
- package/dist/components/charts/chart/chart-prepared-data.d.ts +9 -0
- package/dist/components/charts/chart/chart-prepared-data.js +1 -0
- package/dist/components/charts/chart/chart-spatial-data.js +2 -0
- package/dist/components/charts/chart/chart-sync.js +1 -1
- package/dist/components/charts/chart/chart-table-sampling.js +1 -1
- package/dist/components/charts/chart/chart.class.d.ts +56 -6
- package/dist/components/charts/chart/chart.class.js +18 -8
- package/dist/components/charts/chart/chart.styles.js +1 -1
- package/dist/components/charts/chart/doughnut-chart.class.d.ts +5 -1
- package/dist/components/charts/chart/histogram-buckets.d.ts +1 -1
- package/dist/components/charts/chart/histogram-buckets.js +1 -1
- package/dist/components/charts/chart/histogram.class.d.ts +19 -4
- package/dist/components/charts/chart/histogram.class.js +1 -1
- package/dist/components/charts/chart/line-chart.class.d.ts +5 -1
- package/dist/components/charts/chart/lite-chart.class.d.ts +51 -11
- package/dist/components/charts/chart/lite-chart.class.js +33 -27
- package/dist/components/charts/chart/lite-chart.styles.js +1 -1
- package/dist/components/charts/chart/pie-chart.class.d.ts +5 -1
- package/dist/components/charts/chart/polar-area-chart.class.d.ts +5 -1
- package/dist/components/charts/chart/radar-chart.class.d.ts +5 -1
- package/dist/components/charts/chart/scatter-chart.class.d.ts +5 -1
- package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +6 -3
- package/dist/components/conversation/agent-workspace/agent-workspace.class.js +6 -5
- package/dist/components/conversation/agent-workspace/agent-workspace.styles.js +1 -1
- package/dist/components/conversation/chat-viewport/chat-viewport.class.d.ts +8 -0
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/code-block/code-block-base.class.d.ts +5 -3
- package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
- package/dist/components/conversation/code-block/code-block-core.class.d.ts +4 -1
- package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
- package/dist/components/conversation/code-block/code-block-shared.d.ts +6 -4
- package/dist/components/conversation/code-block/code-block-shared.js +3 -2
- package/dist/components/conversation/code-block/code-block.class.d.ts +11 -4
- package/dist/components/conversation/code-block/code-block.class.js +1 -1
- package/dist/components/conversation/code-block/code-block.d.ts +1 -1
- package/dist/components/conversation/code-block/code-block.styles.js +1 -1
- package/dist/components/conversation/code-block/shiki-types.d.ts +2 -0
- package/dist/components/conversation/code-block/shiki-types.js +1 -1
- package/dist/components/conversation/markdown/markdown-base.class.d.ts +6 -4
- package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-code-header.d.ts +2 -2
- package/dist/components/conversation/markdown/markdown-code-header.js +1 -1
- package/dist/components/conversation/markdown/markdown-core.class.d.ts +8 -3
- package/dist/components/conversation/markdown/markdown-progressive.js +2 -2
- package/dist/components/conversation/markdown/markdown-shared.d.ts +5 -10
- package/dist/components/conversation/markdown/markdown-shared.js +5 -5
- package/dist/components/conversation/markdown/markdown-streaming-tail.js +1 -1
- package/dist/components/conversation/markdown/markdown.class.d.ts +17 -10
- package/dist/components/conversation/markdown/markdown.class.js +1 -1
- package/dist/components/conversation/markdown/markdown.styles.js +1 -1
- package/dist/components/conversation/model-select/model-select.class.d.ts +4 -3
- package/dist/components/conversation/model-select/model-select.class.js +3 -2
- package/dist/components/conversation/model-select/model-select.styles.js +1 -1
- package/dist/components/conversation/model-settings-panel/model-settings-panel.class.d.ts +2 -1
- package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +2 -1
- package/dist/components/conversation/model-settings-panel/model-settings-panel.styles.js +1 -1
- package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +3 -2
- package/dist/components/conversation/prompt-input/prompt-input.class.js +2 -1
- package/dist/components/conversation/prompt-input/prompt-input.styles.js +1 -1
- package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +10 -2
- package/dist/components/conversation/prompt-queue/prompt-queue.class.js +15 -6
- package/dist/components/conversation/prompt-queue/prompt-queue.styles.js +1 -1
- package/dist/components/conversation/realtime-session/realtime-session.class.d.ts +3 -1
- package/dist/components/conversation/realtime-session/realtime-session.class.js +2 -1
- package/dist/components/conversation/realtime-session/realtime-session.styles.js +1 -1
- package/dist/components/conversation/streaming-text/markdown-detection.d.ts +2 -0
- package/dist/components/conversation/streaming-text/markdown-detection.js +4 -1
- package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +6 -2
- package/dist/components/conversation/streaming-text/streaming-text-base.class.js +3 -3
- package/dist/components/conversation/streaming-text/streaming-text-core.class.js +1 -1
- package/dist/components/conversation/streaming-text/streaming-text.class.js +1 -0
- package/dist/components/conversation/thread-list/thread-list.class.d.ts +34 -4
- package/dist/components/conversation/thread-list/thread-list.class.js +22 -15
- package/dist/components/conversation/thread-list/thread-list.d.ts +1 -1
- package/dist/components/conversation/thread-list/thread-list.js +1 -1
- package/dist/components/conversation/thread-list/thread-list.styles.js +1 -1
- package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +6 -2
- package/dist/components/conversation/transcript-feed/transcript-feed.class.js +3 -2
- package/dist/components/conversation/transcript-feed/transcript-feed.styles.js +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +3 -2
- package/dist/components/conversation/voice-picker/voice-picker.class.js +3 -2
- package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
- package/dist/components/data/calendar/calendar.class.d.ts +5 -2
- package/dist/components/data/calendar/calendar.class.js +1 -1
- package/dist/components/data/data-grid/data-grid-processing.js +2 -2
- package/dist/components/data/data-grid/data-grid.class.d.ts +22 -8
- package/dist/components/data/data-grid/data-grid.class.js +20 -19
- package/dist/components/data/data-grid/data-grid.styles.js +1 -1
- package/dist/components/data/document-library/document-library.class.d.ts +31 -4
- package/dist/components/data/document-library/document-library.class.js +25 -12
- package/dist/components/data/document-library/document-library.styles.js +1 -1
- package/dist/components/data/file-tree/file-tree.class.d.ts +30 -6
- package/dist/components/data/file-tree/file-tree.class.js +4 -3
- package/dist/components/data/file-tree/file-tree.d.ts +1 -0
- package/dist/components/data/file-tree/file-tree.js +1 -1
- package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +31 -6
- package/dist/components/data/flow-canvas/flow-canvas.class.js +40 -19
- package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
- package/dist/components/data/flow-canvas/flow-model.js +1 -1
- package/dist/components/data/flow-canvas/flow-source.js +1 -0
- package/dist/components/data/flow-canvas/flow-types.d.ts +4 -2
- package/dist/components/data/flow-canvas/flow-viewport-index.js +1 -0
- package/dist/components/data/flow-minimap/flow-minimap.class.d.ts +9 -3
- package/dist/components/data/flow-minimap/flow-minimap.class.js +11 -2
- package/dist/components/data/flow-minimap/flow-minimap.styles.js +1 -1
- package/dist/components/data/funnel/funnel.class.d.ts +7 -3
- package/dist/components/data/funnel/funnel.class.js +2 -2
- package/dist/components/data/heatmap/calendar-grid.d.ts +1 -1
- package/dist/components/data/heatmap/calendar-grid.js +1 -1
- package/dist/components/data/heatmap/heatmap-grid-navigation.js +1 -1
- package/dist/components/data/heatmap/heatmap-limits.d.ts +1 -1
- package/dist/components/data/heatmap/heatmap-matrix-source-controller.js +1 -0
- package/dist/components/data/heatmap/heatmap-matrix-source.d.ts +5 -0
- package/dist/components/data/heatmap/heatmap-matrix-source.js +1 -0
- package/dist/components/data/heatmap/heatmap-scale.d.ts +0 -16
- package/dist/components/data/heatmap/heatmap-scale.js +1 -1
- package/dist/components/data/heatmap/heatmap.class.d.ts +40 -11
- package/dist/components/data/heatmap/heatmap.class.js +26 -6
- package/dist/components/data/heatmap/heatmap.styles.js +1 -1
- package/dist/components/data/pagination/pagination.class.js +1 -1
- package/dist/components/data/sequence-strip/sequence-strip-item.d.ts +17 -0
- package/dist/components/data/sequence-strip/sequence-strip-source-controller.js +1 -0
- package/dist/components/data/sequence-strip/sequence-strip-source.d.ts +5 -0
- package/dist/components/data/sequence-strip/sequence-strip-source.js +1 -0
- package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +24 -19
- package/dist/components/data/sequence-strip/sequence-strip.class.js +23 -4
- package/dist/components/data/sequence-strip/sequence-strip.styles.js +1 -1
- package/dist/components/data/sparkline/sparkline.class.d.ts +17 -4
- package/dist/components/data/sparkline/sparkline.class.js +3 -3
- package/dist/components/data/sparkline/sparkline.styles.js +1 -1
- package/dist/components/data/table/table.class.d.ts +14 -10
- package/dist/components/data/table/table.class.js +17 -16
- package/dist/components/data/timeline/timeline.class.d.ts +5 -2
- package/dist/components/data/timeline/timeline.class.js +1 -1
- package/dist/components/data/tree/tree-item.class.js +1 -1
- package/dist/components/data/tree/tree-owner-controller.js +1 -1
- package/dist/components/data/tree/tree.class.d.ts +28 -6
- package/dist/components/data/tree/tree.class.js +3 -3
- package/dist/components/data/tree/tree.d.ts +1 -0
- package/dist/components/data/tree/tree.js +1 -1
- package/dist/components/data/word-cloud/word-cloud.class.d.ts +17 -7
- package/dist/components/data/word-cloud/word-cloud.class.js +6 -4
- package/dist/components/data/word-cloud/word-cloud.styles.js +1 -1
- package/dist/components/forms/catalog-picker-base.d.ts +1 -1
- package/dist/components/forms/catalog-picker-base.js +6 -6
- package/dist/components/forms/catalog-picker-base.styles.js +1 -1
- package/dist/components/forms/combobox/combobox.class.d.ts +7 -3
- package/dist/components/forms/combobox/combobox.class.js +1 -1
- package/dist/components/forms/combobox/option.class.d.ts +4 -2
- package/dist/components/forms/combobox/option.class.js +2 -2
- package/dist/components/forms/country-picker/country-picker.class.d.ts +3 -1
- package/dist/components/forms/country-picker/country-picker.class.js +1 -1
- package/dist/components/forms/currency-picker/currency-picker.class.d.ts +2 -0
- package/dist/components/forms/currency-picker/currency-picker.class.js +1 -1
- package/dist/components/forms/currency-picker/currency-presentation.js +1 -1
- package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +6 -2
- package/dist/components/forms/emoji-picker/emoji-picker.class.js +3 -2
- package/dist/components/forms/emoji-picker/emoji-picker.styles.js +1 -1
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +8 -2
- package/dist/components/forms/locale-picker/locale-picker.class.js +5 -4
- package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
- package/dist/components/forms/select/select.class.d.ts +11 -3
- package/dist/components/forms/select/select.class.js +4 -4
- package/dist/components/forms/time-zone-picker/time-zone-picker.class.d.ts +2 -0
- package/dist/components/forms/time-zone-picker/time-zone-picker.class.js +1 -1
- package/dist/components/forms/token-input/token-input.class.d.ts +6 -1
- package/dist/components/forms/token-input/token-input.class.js +15 -13
- package/dist/components/forms/unit-picker/unit-picker.class.d.ts +2 -0
- package/dist/components/forms/unit-picker/unit-picker.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail.class.d.ts +1 -1
- package/dist/components/layout/app-rail/app-rail.class.js +1 -1
- package/dist/components/layout/command-palette/command-palette.class.d.ts +5 -2
- package/dist/components/layout/command-palette/command-palette.class.js +2 -1
- package/dist/components/layout/command-palette/command-palette.styles.js +1 -1
- package/dist/components/layout/menu/menu-item.class.d.ts +2 -2
- package/dist/components/layout/menu/menu-item.class.js +2 -2
- package/dist/components/layout/menu/menu.class.d.ts +1 -1
- package/dist/components/layout/menu/menu.class.js +1 -1
- package/dist/components/layout/menubar/menubar.class.d.ts +1 -1
- package/dist/components/layout/menubar/menubar.class.js +1 -1
- package/dist/components/layout/reorder-list/reorder-item.class.d.ts +2 -2
- package/dist/components/layout/reorder-list/reorder-item.class.js +2 -2
- package/dist/components/layout/reorder-list/reorder-list.class.d.ts +1 -1
- package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.class.d.ts +13 -9
- package/dist/components/layout/virtual-list/virtual-list.class.js +21 -17
- package/dist/components/media/av-player/av-cue-index.js +1 -0
- package/dist/components/media/av-player/av-cue-source.d.ts +13 -0
- package/dist/components/media/av-player/av-cue-source.js +1 -0
- package/dist/components/media/av-player/av-metadata.d.ts +2 -2
- package/dist/components/media/av-player/av-metadata.js +1 -1
- package/dist/components/media/av-player/av-player-cue-source-controller.js +1 -0
- package/dist/components/media/av-player/av-player.class.d.ts +34 -12
- package/dist/components/media/av-player/av-player.class.js +15 -10
- package/dist/components/media/flag/flag.class.js +1 -1
- package/dist/components/media/flag/language-map.js +1 -1
- package/dist/components/media/lightbox/lightbox-source.js +1 -0
- package/dist/components/media/lightbox/lightbox-types.d.ts +15 -0
- package/dist/components/media/lightbox/lightbox.class.d.ts +22 -21
- package/dist/components/media/lightbox/lightbox.class.js +6 -4
- package/dist/components/media/lightbox/lightbox.styles.js +1 -1
- package/dist/components/media/map/map-geojson-diff.d.ts +6 -6
- package/dist/components/media/map/map-geojson-diff.js +1 -1
- package/dist/components/media/map/map-loader.d.ts +5 -1
- package/dist/components/media/map/map.class.d.ts +24 -6
- package/dist/components/media/map/map.class.js +2 -2
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/media/video-playlist/video-playlist.class.d.ts +2 -1
- package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
- package/dist/components/overlays/chip/chip.class.d.ts +1 -1
- package/dist/components/overlays/chip/chip.class.js +1 -1
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.d.ts +30 -8
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +22 -8
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
- package/dist/components/retrieval/graph/graph-canvas.js +1 -1
- package/dist/components/retrieval/graph/graph-source-composition.js +1 -0
- package/dist/components/retrieval/graph/graph-source-controller.js +1 -0
- package/dist/components/retrieval/graph/graph-spatial-controller.js +2 -2
- package/dist/components/retrieval/graph/graph-spatial-model.js +1 -0
- package/dist/components/retrieval/graph/graph-spatial.js +1 -1
- package/dist/components/retrieval/graph/graph.class.d.ts +31 -6
- package/dist/components/retrieval/graph/graph.class.js +26 -5
- package/dist/components/retrieval/graph/graph.d.ts +1 -1
- package/dist/components/retrieval/graph/graph.js +1 -1
- package/dist/components/retrieval/graph/graph.styles.js +1 -1
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +33 -4
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +27 -17
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.d.ts +1 -1
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.js +1 -1
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.styles.js +1 -1
- package/dist/components/retrieval/knowledge-base/knowledge-base.class.d.ts +27 -4
- package/dist/components/retrieval/knowledge-base/knowledge-base.class.js +29 -14
- package/dist/components/retrieval/knowledge-base/knowledge-base.styles.js +1 -1
- package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.d.ts +17 -3
- package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.js +15 -10
- package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.styles.js +1 -1
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +24 -5
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +17 -10
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.d.ts +1 -1
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.js +1 -1
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.styles.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map-layout.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map-model.js +1 -0
- package/dist/components/retrieval/mind-map/mind-map.class.d.ts +27 -4
- package/dist/components/retrieval/mind-map/mind-map.class.js +11 -7
- package/dist/components/retrieval/mind-map/mind-map.d.ts +1 -0
- package/dist/components/retrieval/mind-map/mind-map.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map.styles.js +1 -1
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +24 -2
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +17 -3
- package/dist/components/retrieval/neighbor-list/neighbor-list.d.ts +1 -1
- package/dist/components/retrieval/neighbor-list/neighbor-list.js +1 -1
- package/dist/components/retrieval/neighbor-list/neighbor-list.styles.js +1 -1
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +8 -4
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +11 -7
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.styles.js +1 -1
- package/dist/components/retrieval/retrieval-compare/retrieval-compare.class.d.ts +12 -6
- package/dist/components/retrieval/retrieval-compare/retrieval-compare.class.js +30 -17
- package/dist/components/retrieval/retrieval-compare/retrieval-compare.styles.js +1 -1
- package/dist/components/retrieval/retrieval-results/retrieval-results-model.js +1 -0
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +46 -5
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +31 -9
- package/dist/components/retrieval/retrieval-results/retrieval-results.d.ts +1 -1
- package/dist/components/retrieval/retrieval-results/retrieval-results.js +1 -1
- package/dist/components/retrieval/retrieval-results/retrieval-results.styles.js +1 -1
- package/dist/components/utility/diff-view/diff-view.class.d.ts +16 -8
- package/dist/components/utility/diff-view/diff-view.class.js +3 -2
- package/dist/components/utility/diff-view/diff-view.styles.js +1 -1
- package/dist/components/utility/json-viewer/json-viewer.class.d.ts +31 -3
- package/dist/components/utility/json-viewer/json-viewer.class.js +13 -4
- package/dist/components/utility/json-viewer/json-viewer.d.ts +1 -0
- package/dist/components/utility/json-viewer/json-viewer.js +1 -1
- package/dist/components/utility/json-viewer/json-viewer.styles.js +1 -1
- package/dist/components/utility/mention-popover/mention-popover.class.d.ts +6 -4
- package/dist/components/utility/mention-popover/mention-popover.class.js +6 -5
- package/dist/components/viewers/csv-viewer/csv-viewer.class.d.ts +34 -7
- package/dist/components/viewers/csv-viewer/csv-viewer.class.js +9 -7
- package/dist/components/viewers/dataset-viewer/dataset-viewer.class.d.ts +28 -4
- package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +12 -11
- package/dist/components/viewers/geojson-view/geojson-viewer.class.d.ts +3 -1
- package/dist/components/viewers/geojson-view/geojson-viewer.class.js +17 -16
- package/dist/components/viewers/geojson-view/geojson-viewer.d.ts +1 -1
- package/dist/components/viewers/geojson-view/geojson-viewer.js +1 -1
- package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.d.ts +31 -5
- package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +11 -8
- package/dist/components/viewers/table-viewer-shared.js +19 -3
- package/dist/components/viewers/viewer-search-limits.js +1 -1
- package/dist/components/viewers/xml-viewer/xml-viewer.class.d.ts +35 -3
- package/dist/components/viewers/xml-viewer/xml-viewer.class.js +20 -5
- package/dist/components/viewers/xml-viewer/xml-viewer.d.ts +1 -1
- package/dist/components/viewers/xml-viewer/xml-viewer.js +1 -1
- package/dist/components/viewers/xml-viewer/xml-viewer.styles.js +1 -1
- package/dist/countries.js +1 -1
- package/dist/data-sources.d.ts +34 -0
- package/dist/data-sources.js +1 -0
- package/dist/events.d.ts +51 -7
- package/dist/framework-types.d.ts +1 -1
- package/dist/internal/accessibility-visibility.d.ts +4 -2
- package/dist/internal/accessibility-visibility.js +1 -1
- package/dist/internal/accessible-text-controller.js +1 -1
- package/dist/internal/anchor-target.js +2 -2
- package/dist/internal/catalog-picker.d.ts +1 -7
- package/dist/internal/catalog-picker.js +1 -1
- package/dist/internal/collection-snapshot.js +1 -1
- package/dist/internal/default-strings/agent-tools.generated.js +1 -1
- package/dist/internal/default-strings/charts.generated.js +1 -1
- package/dist/internal/default-strings/conversation.generated.js +1 -1
- package/dist/internal/default-strings/data.generated.js +1 -1
- package/dist/internal/default-strings/forms.generated.js +1 -1
- package/dist/internal/default-strings/layout.generated.js +1 -1
- package/dist/internal/default-strings/media.generated.js +1 -1
- package/dist/internal/default-strings/retrieval.generated.js +1 -1
- package/dist/internal/default-strings/shared.generated.js +1 -1
- package/dist/internal/default-strings/utility.generated.js +1 -1
- package/dist/internal/delimited-data.js +1 -1
- package/dist/internal/fixed-containing-block.js +1 -1
- package/dist/internal/flow-scene-envelope.js +1 -0
- package/dist/internal/graph-scene-controller.js +1 -0
- package/dist/internal/hierarchy-source-controller.js +1 -0
- package/dist/internal/hierarchy-source-view.js +29 -0
- package/dist/internal/hierarchy-source-view.styles.js +1 -0
- package/dist/internal/inherited-attribute-hub.d.ts +6 -0
- package/dist/internal/inherited-attribute-hub.js +1 -1
- package/dist/internal/intl-cache.js +1 -1
- package/dist/internal/keyed-index.js +1 -0
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +2 -2
- package/dist/internal/lyra-element.d.ts +2 -2
- package/dist/internal/lyra-element.js +3 -2
- package/dist/internal/native-modal-context.js +1 -1
- package/dist/internal/option-selection.js +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/positioner.js +1 -1
- package/dist/internal/resource-loader.d.ts +2 -0
- package/dist/internal/resource-loader.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/internal/search-haystack.js +1 -0
- package/dist/internal/selection-catalog.d.ts +5 -0
- package/dist/internal/selection-catalog.js +1 -1
- package/dist/internal/shiki-language-sources.js +1 -0
- package/dist/internal/source-page-controller.js +1 -0
- package/dist/internal/source-page-scope.js +1 -0
- package/dist/internal/source-request-controller.js +1 -0
- package/dist/internal/source-window-controller.js +1 -0
- package/dist/internal/spatial-source-controller.js +1 -0
- package/dist/internal/text-quote.d.ts +2 -6
- package/dist/internal/text-quote.js +1 -1
- package/dist/internal/theme-watcher.js +1 -1
- package/dist/internal/virtual-list-composition.js +1 -0
- package/dist/lyra.d.ts +1 -1
- package/dist/lyra.js +1 -1
- package/dist/testing/interaction-drivers.js +1 -1
- package/dist/testing/lyra-tag-event-map.js +1 -1
- package/dist/units.js +1 -1
- package/dist/utilities/data-preparation.d.ts +56 -0
- package/dist/utilities/data-preparation.js +1 -0
- package/dist/utilities/data-spatial.d.ts +26 -0
- package/dist/utilities/data-spatial.js +1 -0
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/index.js +1 -1
- package/llms/components/lr-activity-feed.md +7 -2
- package/llms/components/lr-agent-trace.md +49 -9
- package/llms/components/lr-agent-workspace.md +15 -8
- package/llms/components/lr-av-player.md +180 -10
- package/llms/components/lr-bar-chart.md +1 -1
- package/llms/components/lr-box-plot.md +8 -0
- package/llms/components/lr-bubble-chart.md +1 -1
- package/llms/components/lr-calendar.md +26 -3
- package/llms/components/lr-chart.md +310 -23
- package/llms/components/lr-chat-viewport.md +6 -0
- package/llms/components/lr-code-block-core.md +12 -7
- package/llms/components/lr-code-block.md +23 -9
- package/llms/components/lr-combobox.md +27 -15
- package/llms/components/lr-command-palette.md +16 -3
- package/llms/components/lr-country-picker.md +23 -6
- package/llms/components/lr-csv-viewer.md +95 -12
- package/llms/components/lr-currency-picker.md +23 -3
- package/llms/components/lr-data-grid.md +24 -6
- package/llms/components/lr-dataset-viewer.md +92 -11
- package/llms/components/lr-dialog.md +1 -1
- package/llms/components/lr-diff-view.md +19 -6
- package/llms/components/lr-document-library.md +60 -5
- package/llms/components/lr-doughnut-chart.md +1 -1
- package/llms/components/lr-embedding-explorer.md +89 -9
- package/llms/components/lr-emoji-picker.md +7 -2
- package/llms/components/lr-eval-dataset.md +56 -7
- package/llms/components/lr-eval-result.md +89 -4
- package/llms/components/lr-export-button.md +1 -1
- package/llms/components/lr-file-tree.md +60 -6
- package/llms/components/lr-flag.md +5 -2
- package/llms/components/lr-flow-canvas.md +152 -14
- package/llms/components/lr-flow-minimap.md +32 -4
- package/llms/components/lr-funnel.md +14 -0
- package/llms/components/lr-geojson-viewer.md +27 -10
- package/llms/components/lr-graph.md +43 -7
- package/llms/components/lr-heatmap.md +161 -5
- package/llms/components/lr-histogram.md +55 -9
- package/llms/components/lr-ingestion-queue.md +54 -3
- package/llms/components/lr-json-viewer.md +87 -7
- package/llms/components/lr-knowledge-base-admin.md +60 -4
- package/llms/components/lr-knowledge-base.md +121 -9
- package/llms/components/lr-knowledge-graph-explorer.md +106 -11
- package/llms/components/lr-lightbox.md +42 -6
- package/llms/components/lr-line-chart.md +28 -5
- package/llms/components/lr-lite-chart.md +96 -31
- package/llms/components/lr-locale-picker.md +6 -4
- package/llms/components/lr-map.md +67 -8
- package/llms/components/lr-markdown-core.md +10 -5
- package/llms/components/lr-markdown.md +23 -6
- package/llms/components/lr-mention-popover.md +11 -6
- package/llms/components/lr-mind-map.md +91 -10
- package/llms/components/lr-model-select.md +8 -4
- package/llms/components/lr-model-settings-panel.md +10 -2
- package/llms/components/lr-navigation-menu.md +1 -1
- package/llms/components/lr-neighbor-list.md +69 -2
- package/llms/components/lr-pie-chart.md +1 -1
- package/llms/components/lr-polar-area-chart.md +1 -1
- package/llms/components/lr-prompt-input.md +9 -2
- package/llms/components/lr-prompt-queue.md +11 -3
- package/llms/components/lr-radar-chart.md +1 -1
- package/llms/components/lr-rag-eval-dashboard.md +9 -2
- package/llms/components/lr-realtime-session.md +6 -2
- package/llms/components/lr-reorder-list.md +4 -0
- package/llms/components/lr-retrieval-compare.md +9 -4
- package/llms/components/lr-retrieval-results.md +104 -6
- package/llms/components/lr-scatter-chart.md +1 -1
- package/llms/components/lr-select.md +20 -10
- package/llms/components/lr-sequence-strip.md +92 -2
- package/llms/components/lr-span-waterfall.md +78 -8
- package/llms/components/lr-sparkline.md +42 -11
- package/llms/components/lr-spreadsheet-viewer.md +109 -14
- package/llms/components/lr-streaming-text-core.md +4 -2
- package/llms/components/lr-streaming-text.md +5 -1
- package/llms/components/lr-table.md +96 -115
- package/llms/components/lr-task-list.md +93 -9
- package/llms/components/lr-terminal.md +9 -0
- package/llms/components/lr-test-results.md +77 -3
- package/llms/components/lr-thread-list.md +86 -1
- package/llms/components/lr-time-zone-picker.md +8 -3
- package/llms/components/lr-timeline.md +5 -0
- package/llms/components/lr-token-input.md +7 -2
- package/llms/components/lr-tool-timeline.md +13 -4
- package/llms/components/lr-trace-tree.md +96 -10
- package/llms/components/lr-transcript-feed.md +9 -2
- package/llms/components/lr-tree.md +87 -15
- package/llms/components/lr-unit-picker.md +8 -3
- package/llms/components/lr-video-playlist.md +2 -0
- package/llms/components/lr-virtual-list.md +17 -8
- package/llms/components/lr-voice-picker.md +8 -3
- package/llms/components/lr-word-cloud.md +128 -12
- package/llms/components/lr-xml-viewer.md +106 -9
- package/llms/index.md +1 -1
- package/llms/peers.md +1 -1
- package/llms/shared/events-and-types.md +725 -264
- package/llms/shared/forms-and-accessibility.md +3 -17
- package/llms/shared/imports-and-registration.md +3 -17
- package/llms/shared/localization-and-rtl.md +0 -2
- package/llms/shared/styles-and-tokens.md +27 -36
- package/llms/shared/testing-and-utilities.md +4 -5
- package/llms/shared.md +770 -349
- package/llms.txt +1 -2
- package/locales.json +139 -139
- package/package.json +13 -4
- package/registrations.json +1 -1
- package/skills/compose-lyra-interfaces/SKILL.md +6 -8
- package/skills/lyra-ui/SKILL.md +20 -51
- package/skills/lyra-ui/commands/review.md +16 -33
- package/skills/lyra-ui/commands/update.md +6 -5
- package/skills/lyra-ui/online-api.md +15 -0
- package/skills/lyra-ui/reporting.md +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-lazy.js";import{chartDataTableVisible,hasSlottedChartDataTable,hasArraySeriesData}from"./chart-data-table.js";import{collectionSupport,snapshotPublicCollection}from"../../../internal/collection-snapshot.js";import{boundChartSeriesValues,chartSeriesValueLimit}from"./chart-series-bounds.js";import{nativeSvgTitle}from"../../../internal/svg-title.js";import{html,svg,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{specialistTokens}from"../../../internal/specialist-host-tokens.styles.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{formatChartValue}from"./chart-number-format.js";import{decimalPlaces,finiteAdd,finiteCount,finiteNumber,finiteRange}from"../../../internal/numbers.js";import{escapeCsvField}from"../../utility/export-button/csv.js";import"../../utility/live-region/live-region.class.js";import{styles}from"./lite-chart.styles.js";import{bidiStyles,isolateHtml,isolatedMessage}from"./chart-bidi.js";import{forcedColorEncoding,forcedColorsActive}from"./chart-forced-colors.js";import{literalSetConverter}from"../../../internal/converters.js";import{sanitizeCssColor,sanitizeCssLength}from"../../../internal/safe-css.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{MAX_RENDERED_CHART_RECORDS,sampleChartTableIndexes}from"./chart-table-sampling.js";import{chartChromeLegendPlacement,normalizeChartChromeLegendPosition}from"./chart-chrome.js";import{categoryLabelGrowth,hasCategoryLabelText,sparseCategoryLabelExtent,visibleCategoryLabelIndexes,widestEstimatedCategoryLabel}from"./lite-chart-axis-layout.js";import{LYRA_DEFAULT_chartCategory,LYRA_DEFAULT_chartData,LYRA_DEFAULT_chartDataSampled,LYRA_DEFAULT_chartPlotSampled,LYRA_DEFAULT_chartSeriesLabel,LYRA_DEFAULT_chartTotal,LYRA_DEFAULT_liteChartBarLabel,LYRA_DEFAULT_liteChartCustomMarkSummary,LYRA_DEFAULT_liteChartMarkSummary}from"../../../internal/default-strings/charts.generated.js";import{LYRA_DEFAULT_chart}from"../../../internal/default-strings/shared.generated.js";function isLiteChartSeries(value){return hasArraySeriesData(value)}function normalizeLiteChartSeries(value){try{return Object.freeze(Array.isArray(value)?value.filter(isLiteChartSeries):[])}catch{return Object.freeze([])}}function normalizeLiteChartType(value){return value==="line"||value==="bar"?value:"bar"}const LITE_CHART_LAYOUT=literalSetConverter(["fit","scroll"],"fit"),autoNumberConverter={fromAttribute:value=>{if(value===null)return;const trimmed=value.trim();return trimmed.toLowerCase()==="auto"?"auto":Number(trimmed)}},DEFAULT_PALETTE=["var(--lr-chart-color-1, var(--lr-color-chart-1))","var(--lr-chart-color-2, var(--lr-color-chart-2))","var(--lr-chart-color-3, var(--lr-color-chart-3))","var(--lr-chart-color-4, var(--lr-color-chart-4))","var(--lr-chart-color-5, var(--lr-color-chart-5))","var(--lr-chart-color-6, var(--lr-color-chart-6))","var(--lr-chart-color-7, var(--lr-color-chart-7))","var(--lr-chart-color-8, var(--lr-color-chart-8))"],PAD_LEFT=36,PAD_RIGHT=8,PAD_TOP=8,PAD_BOTTOM=30,CATEGORY_LABEL_OFFSET=24,AXIS_TITLE_SPACE=14,TICK_COUNT=4,BAR_GROUP_GAP=.2,BAR_GAP=.08,BAR_CORNER_RADIUS=4,APPROX_LABEL_CHARACTER_WIDTH=7,AUTO_CATEGORY_LABEL_INSET=10,VALUE_AXIS_TICK_OFFSET=6,AUTO_VALUE_AXIS_SAFETY_INSET=8,MAX_AUTO_VALUE_AXIS_GUTTER=240,MAX_AUTO_VALUE_AXIS_GUTTER_FRACTION=.4,MAX_SCROLL_CONTENT_WIDTH=1e6,CATEGORY_LABEL_SELECTION_BOUNDS=Object.freeze({characterWidth:APPROX_LABEL_CHARACTER_WIDTH,laneInset:AUTO_CATEGORY_LABEL_INSET,maxContentWidth:MAX_SCROLL_CONTENT_WIDTH,maxRenderedRecords:MAX_RENDERED_CHART_RECORDS});function niceStep(span,count){const rough=span/Math.max(1,count),magnitude=10**Math.floor(Math.log10(rough)),residual=rough/magnitude;return(residual<1.5?1:residual<3?2:residual<7?5:10)*magnitude}function logDomainFraction(value,lo,hi){const top=Math.max(hi,0);if(!Number.isFinite(top)||top<=0)return domainFraction(value,lo,hi);const bottom=lo>0?lo:top/10;if(!Number.isFinite(bottom)||bottom<=0||bottom>=top)return domainFraction(value,lo,hi);if(!Number.isFinite(value)||value<=bottom)return 0;if(value>=top)return 1;const fraction=(Math.log10(value)-Math.log10(bottom))/(Math.log10(top)-Math.log10(bottom));return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function domainFraction(value,lo,hi){const span=hi-lo;if(Number.isFinite(span)&&span>0)return Math.min(1,Math.max(0,(value-lo)/span));const scale=Math.max(Math.abs(value),Math.abs(lo),Math.abs(hi),1),scaledSpan=hi/scale-lo/scale;if(!Number.isFinite(scaledSpan)||scaledSpan<=0)return 0;const fraction=(value/scale-lo/scale)/scaledSpan;return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function snapToStep(value,step){return Number.isFinite(step)&&step>0?Number(value.toFixed(Math.min(decimalPlaces(step),100))):value}function safeDomainTicks(lo,hi,count){return Array.from({length:Math.max(1,count)+1},(_,index)=>{if(index===0)return lo;if(index===count)return hi;const ratio=index/count;return Number((lo*(1-ratio)+hi*ratio).toPrecision(15))}).filter(Number.isFinite)}function logarithmicTicks(lo,hi,count){if(!(lo>0&&hi>lo)||!Number.isFinite(lo)||!Number.isFinite(hi))return;const start=Math.log10(lo),end=Math.log10(hi),span=end-start;if(!(span>0))return;const decades=span>=1,step=decades?Math.ceil(span/count):niceStep(hi-lo,count);if(!Number.isFinite(step)||step<=0)return[...new Set(safeDomainTicks(lo,hi,count))];const ticks=[lo],minimumGap=decades?step/2:span/(count*2),first=Math.ceil((decades?start:lo)/step);for(let index=0;index<=count+1;index++){const value=decades?10**((first+index)*step):snapToStep((first+index)*step,step);if(!Number.isFinite(value)||value>=hi)break;if(value<=ticks.at(-1))continue;const logarithm=Math.log10(value);logarithm-Math.log10(ticks.at(-1))>=minimumGap&&end-logarithm>=minimumGap&&ticks.push(value)}return ticks.push(hi),ticks}function niceDomain(dataLo,dataHi,beginAtZero,count){let lo=beginAtZero?Math.min(0,dataLo):dataLo,hi=beginAtZero?Math.max(0,dataHi):dataHi;lo===hi&&(Math.abs(lo)>Number.MAX_VALUE/2?(lo=lo>0?lo/2:lo,hi=hi<0?hi/2:hi):(lo-=1,hi+=1));const span=hi-lo;if(!Number.isFinite(span))return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const step=niceStep(span,count);if(!Number.isFinite(step)||step<=0)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const snap=value=>snapToStep(value,step),roundedLo=snap(Math.floor(lo/step)*step),roundedHi=snap(Math.ceil(hi/step)*step);Number.isFinite(roundedLo)&&(lo=roundedLo),Number.isFinite(roundedHi)&&(hi=roundedHi);const slots=Math.floor((hi-lo)/step);if(!Number.isFinite(slots)||slots<0||slots>100)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const ticks=[];for(let index=0;index<=slots;index++){const value=snap(lo+index*step);Number.isFinite(value)&&ticks.push(value)}return ticks.at(-1)!==hi&&ticks.push(hi),{lo,hi,ticks}}class LyraLiteChart extends LyraElement{constructor(){super(...arguments),this.type="bar",this.labels=[],this._datasets=Object.freeze([]),this.datasetsSource=this._datasets,this.withLegend=!1,this.legendPosition="bottom",this.height="280px",this.xLabel="",this.yLabel="",this.withoutZeroBaseline=!1,this.stacked=!1,this.tableTotals=!1,this.withDataTable=!1,this.dataTableToggle=!1,this.dataTableExpandedOverride=null,this.dataTableId=nextId("lite-chart-data-table"),this._layout="fit",this.barWidth=32,this.roundedBars=!1,this.skipZero=!1,this.scale="linear",this.withoutValueAxis=!1,this.selectedIndices=[],this.hostAccessibleLabel=null,this.label=null,this.description=null,this.forcedColorPatternId=nextId("lite-chart-pattern"),this.descriptionId=nextId("lite-chart-description"),this.plotWidth=0,this.plotHeight=0,this.fitMeasurementAvailable=!1,this.activeMarkIndex=0,this.syncPlot={y:0,height:0},this.syncCategoryPositions=new Map,this.resizeObserverGeneration=0,this.axisTitleTargets=new Set,this.axisTitleFits=new WeakMap,this.categoryLabelFits=new WeakMap,this.refocusMarkAfterUpdate=!1,this.refocusChartAfterUpdate=!1,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.syncGroup="",this.chartSync=new LazyChartSyncController(this,(label,index)=>this.syncPresentation(label,index),void 0,target=>target.nodeType===1&&target.hasAttribute("data-mark-index"),()=>this.requestUpdate()),this.onForcedColorsChange=()=>{!this.isConnected||this.ownerDocument.defaultView!==this.forcedColorsWindow||this.requestUpdate()}}static{this.defaultStrings={...super.defaultStrings,chart:LYRA_DEFAULT_chart,chartCategory:LYRA_DEFAULT_chartCategory,chartData:LYRA_DEFAULT_chartData,chartDataSampled:LYRA_DEFAULT_chartDataSampled,chartPlotSampled:LYRA_DEFAULT_chartPlotSampled,chartSeriesLabel:LYRA_DEFAULT_chartSeriesLabel,chartTotal:LYRA_DEFAULT_chartTotal,liteChartBarLabel:LYRA_DEFAULT_liteChartBarLabel,liteChartCustomMarkSummary:LYRA_DEFAULT_liteChartCustomMarkSummary,liteChartMarkSummary:LYRA_DEFAULT_liteChartMarkSummary}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["labels","selectedIndices"])}static{this.styles=[LyraElement.styles,specialistTokens,styles,srOnly,bidiStyles]}get datasets(){return this._datasets}set datasets(value){if(Object.is(value,this.datasetsSource)||Object.is(value,this._datasets))return;const previous=this._datasets;this.datasetsSource=value,this._datasets=normalizeLiteChartSeries(snapshotPublicCollection(boundChartSeriesValues(value)??value,this.ownerDocument?.defaultView)),this.requestUpdate("datasets",previous)}get dataTableVisible(){return chartDataTableVisible(this.withDataTable,this.dataTableToggle,this.dataTableExpandedOverride)}toggleDataTable(){this.dataTableExpandedOverride=!this.dataTableVisible}get layout(){return this._layout}set layout(next){const normalized=LITE_CHART_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}appendData(label,values,maxPoints=0){const bound=chartSeriesValueLimit(this.datasets.length),requested=Math.max(0,finiteCount(maxPoints,0)),limit=requested>0?Math.min(requested,bound):bound;let domainLength=this.labels.length;for(const series of this.datasets)domainLength=Math.max(domainLength,series.data.length);const labels=[...this.labels,...Array.from({length:Math.max(0,domainLength-this.labels.length)},()=>""),label];this.labels=labels.slice(-limit),this.datasets=this.datasets.map((series,index)=>({...series,data:[...series.data,...Array.from({length:Math.max(0,domainLength-series.data.length)},()=>null),values[index]??null].slice(-limit)}))}exportData(format){if(format==="svg"){const XMLSerializerCtor=this.ownerDocument.defaultView?.XMLSerializer;return!this.svgEl||typeof XMLSerializerCtor!="function"?"":new XMLSerializerCtor().serializeToString(this.svgEl)}const header=["label",...this.datasets.map(series=>series.label)].map(escapeCsvField).join(","),rows=Array.from({length:this.recordCount()},(_,index)=>{const label=this.labels[index]??"";return[label,...this.datasets.map((series,datasetIndex)=>{const value=series.data[index];return typeof value=="number"&&Number.isFinite(value)?this.formatter?.({value,surface:"export",datasetIndex,index,label,seriesLabel:series.label,axis:"y"})??value:""})].map(escapeCsvField).join(",")});return[header,...rows].join(`\r
|
|
2
|
-
`)}attributeChangedCallback(name,oldValue,value){super.attributeChangedCallback(name,oldValue,value),oldValue!==value&&(name==="style"||name==="class")&&(this.fitAxisTitles(),this.fitCategoryLabels())}connectedCallback(){super.connectedCallback(),this.requestUpdate(),this.armResizeObserver(),this.armForcedColorsWatcher()}armResizeObserver(){const target=this.svgEl,ownerDocument=this.ownerDocument;if(!this.isConnected||!target||this.resizeObserver&&this.resizeObserverDocument===ownerDocument&&this.resizeObserverTarget===target)return;this.resetResizeObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.resizeObserverGeneration,observer=new ResizeObserverCtor(entries=>{if(this.resizeObserver!==observer||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.resizeObserverTarget!==target)return;const svgEntry=entries.find(entry=>entry.target===target);if(svgEntry){const box=svgEntry.contentBoxSize?.[0];if(box)this.plotWidth=box.inlineSize,this.plotHeight=box.blockSize;else{const rect=target.getBoundingClientRect();this.plotWidth=rect.width,this.plotHeight=rect.height}}entries.some(entry=>this.axisTitleTargets.has(entry.target))&&this.queueAxisTitleFit()});this.resizeObserver=observer,this.resizeObserverDocument=ownerDocument,this.resizeObserverTarget=target,target&&observer.observe(target),this.syncAxisTitleTargets()}disconnectedCallback(){this.chartSync.disconnect(),super.disconnectedCallback(),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.resetResizeObserver(),this.disarmForcedColorsWatcher()}adoptedCallback(){this.chartSync.disconnect(),super.adoptedCallback(),this.requestUpdate(),this.resetResizeObserver(),this.announcements.adopted(),this.refreshFitMeasurementAvailability(),this.armForcedColorsWatcher()}armForcedColorsWatcher(){const ownerWindow=this.ownerDocument?.defaultView??void 0;ownerWindow?.matchMedia&&(this.forcedColorsWindow===ownerWindow&&this.forcedColorsQuery||(this.disarmForcedColorsWatcher(),this.forcedColorsWindow=ownerWindow,this.forcedColorsQuery=ownerWindow.matchMedia("(forced-colors: active)"),this.forcedColorsQuery.addEventListener("change",this.onForcedColorsChange)))}disarmForcedColorsWatcher(){this.forcedColorsQuery?.removeEventListener("change",this.onForcedColorsChange),this.forcedColorsQuery=void 0,this.forcedColorsWindow=void 0}resetResizeObserver(){this.axisTitleFrame!==void 0&&(this.resizeObserverDocument?.defaultView?.cancelAnimationFrame(this.axisTitleFrame),this.axisTitleFrame=void 0),this.axisTitleTargets.clear(),this.resizeObserverGeneration+=1,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeObserverDocument=void 0,this.resizeObserverTarget=void 0}firstUpdated(changed){super.firstUpdated(changed),this.armResizeObserver()}willUpdate(changed){super.willUpdate(changed);const shouldSync=this.isConnected&&typeof this.syncGroup=="string"&&this.syncGroup.trim()!=="";if(this.chartSync.enabled!==shouldSync&&this.chartSync.update(this.syncGroup,!0),this.seedFirstRenderState(()=>{this.refreshFitMeasurementAvailability()}),!["type","labels","datasets","skipZero"].some(name=>changed.has(name)))return;const active=shadowFocusTarget(this)??null,hadFocusedMark=active?.matches('[part="bar"], [part="point"]')??!1,priorPosition=Number(active?.getAttribute("data-mark-index")??this.activeMarkIndex),datasetAttribute=active?.getAttribute("data-dataset-index"),indexAttribute=active?.getAttribute("data-index"),datasetIndex=Number(datasetAttribute),index=Number(indexAttribute),marks=this.interactiveMarks(),sameIdentity=datasetAttribute!=null&&indexAttribute!==null&&indexAttribute!==void 0?marks.findIndex(mark=>mark.datasetIndex===datasetIndex&&mark.index===index):-1;this.activeMarkIndex=marks.length?sameIdentity>=0?sameIdentity:Math.min(Math.max(priorPosition,0),marks.length-1):0,this.refocusMarkAfterUpdate=hadFocusedMark&&marks.length>0,this.refocusChartAfterUpdate=hadFocusedMark&&marks.length===0}updated(changed){super.updated(changed);const wasMounting=this.isMounting;if(this.isMounting=!1,changed.has("height")){const height=sanitizeCssLength(this.height,"height");height?this.style.setProperty("--_lr-chart-height",height):this.style.removeProperty("--_lr-chart-height")}const dataTruncation=this.dataTruncationMessage();wasMounting?this.lastDataTruncationAnnouncement=dataTruncation:dataTruncation!==this.lastDataTruncationAnnouncement&&(this.lastDataTruncationAnnouncement=dataTruncation,dataTruncation&&this.announcements.announcePolite(dataTruncation)),this.refocusMarkAfterUpdate&&(this.refocusMarkAfterUpdate=!1,this.renderRoot.querySelectorAll('[part="bar"], [part="point"]')[this.normalizedMarkIndex()]?.focus()),this.refocusChartAfterUpdate&&(this.refocusChartAfterUpdate=!1,this.svgEl?.focus()),[...changed.keys()].some(name=>name!=="activeMarkIndex")&&(this.fitAxisTitles(),this.fitCategoryLabels()),this.syncAxisTitleTargets();const dataChanged=["datasets","labels","type","skipZero","layout","maxRecords","maxSeries"].some(name=>changed.has(name));this.chartSync.update(this.syncGroup,!0,dataChanged)}fitAxisTitles(){if(!(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length))for(const title of this.svgEl.querySelectorAll('[part="axis-title"]')){const text=Array.from(title.childNodes).find(node=>node.nodeType===3);if(!text)continue;const source=title.getAttribute("aria-label")??"",extent=finiteRange(Number(title.getAttribute("data-title-extent")),0,0,MAX_SCROLL_CONTENT_WIDTH),previous=this.axisTitleFits.get(title);if(!(previous?.source===source&&previous.extent===extent&&previous.display===text.data&&previous.width===title.getComputedTextLength())){if(title.style.removeProperty("opacity"),text.data=source,title.getComputedTextLength()>extent)if(text.data="…",title.getComputedTextLength()>extent)title.style.opacity="0";else{let lower=0,upper=source.length;for(;lower<upper;){const middle=Math.ceil((lower+upper)/2);text.data=`${source.slice(0,middle)}…`,title.getComputedTextLength()<=extent?lower=middle:upper=middle-1}const last=source.charCodeAt(lower-1);last>=55296&&last<=56319&&(lower-=1),text.data=`${source.slice(0,lower)}…`}this.axisTitleFits.set(title,{source,extent,display:text.data,width:title.getComputedTextLength()})}}}fitOneCategoryLabel(tick,x,anchor,extent){const bounded=finiteRange(extent,0,0,MAX_SCROLL_CONTENT_WIDTH);tick.setAttribute("data-label-extent",String(bounded));const text=Array.from(tick.childNodes).find(node=>node.nodeType===3);if(!text)return x;const source=tick.getAttribute("data-full-label")??"",previous=this.categoryLabelFits.get(tick);if(previous?.source===source&&previous.extent===bounded&&previous.display===text.data&&previous.width===tick.getComputedTextLength())return anchor==="start"?x+previous.width:anchor==="end"?x-previous.width:x;if(text.data=source,tick.getComputedTextLength()>bounded)if(source.length<=1)text.data=source.length===0?source:"…";else{let lower=0,upper=source.length;for(;lower<upper;){const middle=Math.ceil((lower+upper)/2);text.data=middle===0?"…":`${source.slice(0,middle)}…`,tick.getComputedTextLength()<=bounded?lower=middle:upper=middle-1}const lastCode=source.charCodeAt(lower-1);lastCode>=55296&&lastCode<=56319&&(lower-=1),text.data=lower===0?"…":`${source.slice(0,lower)}…`}text.data===source?tick.removeAttribute("aria-label"):tick.setAttribute("aria-label",source);const width=tick.getComputedTextLength();return this.categoryLabelFits.set(tick,{source,extent:bounded,display:text.data,width}),anchor==="start"?x+width:anchor==="end"?x-width:x}fitCategoryLabels(){if(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length)return;const ticks=[...this.svgEl.querySelectorAll('[part="axis-label"][data-full-label]')].filter(tick=>hasCategoryLabelText(tick.getAttribute("data-full-label"))).sort((a,b)=>Number(a.getAttribute("x"))-Number(b.getAttribute("x"))),count=ticks.length;if(count===0)return;const MARGIN=BAR_CORNER_RADIUS,positionOf=tick=>Number(tick.getAttribute("x"))||0,anchorOf=tick=>tick.getAttribute("text-anchor")??"middle",first=ticks[0],last=ticks[count-1],firstIsBoundary=count>1&&anchorOf(first)!=="middle",lastIsBoundary=count>1&&anchorOf(last)!=="middle";let firstRightEdge=positionOf(first),lastLeftEdge=positionOf(last);if(firstIsBoundary&&lastIsBoundary&&count===2){const half=Math.max(0,(positionOf(last)-positionOf(first))/2-MARGIN);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),half),lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),half)}else{if(firstIsBoundary){const gap=positionOf(ticks[1])-positionOf(first);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),gap-MARGIN)}if(lastIsBoundary){const gap=positionOf(last)-positionOf(ticks[count-2]);lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),gap-MARGIN)}}for(let index=0;index<count;index++){if(index===0&&firstIsBoundary||index===count-1&&lastIsBoundary)continue;const tick=ticks[index],x=positionOf(tick),leftAvailable=index===0?MAX_SCROLL_CONTENT_WIDTH:index===1&&firstIsBoundary?x-firstRightEdge:(x-positionOf(ticks[index-1]))/2,rightAvailable=index===count-1?MAX_SCROLL_CONTENT_WIDTH:index===count-2&&lastIsBoundary?lastLeftEdge-x:(positionOf(ticks[index+1])-x)/2,extent=2*Math.min(leftAvailable,rightAvailable)-MARGIN;this.fitOneCategoryLabel(tick,x,anchorOf(tick),extent)}}syncAxisTitleTargets(){if(!this.resizeObserver||!this.svgEl)return;const current=new Set(this.svgEl.querySelectorAll('[part="axis-title"]'));for(const title of this.axisTitleTargets)current.has(title)||this.resizeObserver.unobserve(title);for(const title of current)this.axisTitleTargets.has(title)||this.resizeObserver.observe(title);this.axisTitleTargets=current}queueAxisTitleFit(){const document=this.resizeObserverDocument,window=document?.defaultView;if(!window||this.axisTitleFrame!==void 0)return;const generation=this.resizeObserverGeneration,frame=window.requestAnimationFrame(()=>{this.axisTitleFrame!==frame||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==document||(this.axisTitleFrame=void 0,this.fitAxisTitles())});this.axisTitleFrame=frame}colorFor(index,series){return sanitizeCssColor(series.color)??DEFAULT_PALETTE[index%DEFAULT_PALETTE.length]}get effectiveType(){return normalizeLiteChartType(this.type)}forcedColors(){return forcedColorsActive(this.ownerDocument?.defaultView)}markPaint(index,series){const color=this.colorFor(index,series);return this.effectiveType==="bar"&&this.forcedColors()?`url(#${this.forcedColorPatternId}-${index})`:color}legendEncoding(index){return this.forcedColors()?forcedColorEncoding(index).name:nothing}markDash(index){if(!this.forcedColors())return nothing;const dash=forcedColorEncoding(index).dash;return dash.length?dash.join(" "):"none"}renderForcedColorPatterns(){if(this.effectiveType!=="bar"||!this.forcedColors())return nothing;const size=8,half=size/2,texture="var(--lr-color-surface)";return svg`<defs>
|
|
3
|
-
${this.recordSample().seriesIndexes.map(index=>{const series=this.datasets[index],encoding=forcedColorEncoding(index).name,shapes=(()=>{switch(encoding){case"horizontal":return svg`<rect y=${half} width=${size} height="1" fill=${texture}></rect>`;case"vertical":return svg`<rect x=${half} width="1" height=${size} fill=${texture}></rect>`;case"diagonal":return svg`<path
|
|
1
|
+
import{__decorate}from"tslib";import{SourceRequestController}from"../../../internal/source-request-controller.js";import{prepareChartModel,withPreparedPoint,withPreparedRange,preparedResponse}from"./chart-prepared-data.js";import{ThemeWatcher}from"../../../internal/theme-watcher.js";import{CollectionSourceTracker}from"../../../internal/collection-source-tracker.js";import{LazyChartSyncController}from"./chart-sync-lazy.js";import{chartDataTableVisible,hasSlottedChartDataTable,hasArraySeriesData}from"./chart-data-table.js";import{collectionSupport,snapshotPublicCollection,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{boundChartSeriesValues,chartSeriesValueLimit}from"./chart-series-bounds.js";import{nativeSvgTitle}from"../../../internal/svg-title.js";import{html,svg,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{specialistTokens}from"../../../internal/specialist-host-tokens.styles.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{formatChartValue}from"./chart-number-format.js";import{decimalPlaces,finiteAdd,finiteCount,finiteNumber,finiteRange}from"../../../internal/numbers.js";import{escapeCsvField}from"../../utility/export-button/csv.js";import"../../utility/live-region/live-region.class.js";import{styles}from"./lite-chart.styles.js";import{bidiStyles,isolateHtml,isolatedMessage}from"./chart-bidi.js";import{forcedColorEncoding,forcedColorsActive}from"./chart-forced-colors.js";import{literalSetConverter}from"../../../internal/converters.js";import{sanitizeCssColor,sanitizeCssLength}from"../../../internal/safe-css.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{MAX_RENDERED_CHART_RECORDS,sampleChartTableIndexes,normalizeChartRecordLimit}from"./chart-table-sampling.js";import{chartChromeLegendPlacement,normalizeChartChromeLegendPosition}from"./chart-chrome.js";import{categoryLabelGrowth,hasCategoryLabelText,sparseCategoryLabelExtent,visibleCategoryLabelIndexes,widestEstimatedCategoryLabel}from"./lite-chart-axis-layout.js";import{LYRA_DEFAULT_chartCategory,LYRA_DEFAULT_chartData,LYRA_DEFAULT_chartDataSampled,LYRA_DEFAULT_chartInputLimit,LYRA_DEFAULT_chartPlotSampled,LYRA_DEFAULT_chartPointCoordinates,LYRA_DEFAULT_chartSeriesLabel,LYRA_DEFAULT_chartTotal,LYRA_DEFAULT_liteChartBarLabel,LYRA_DEFAULT_liteChartCustomMarkSummary,LYRA_DEFAULT_liteChartMarkSummary}from"../../../internal/default-strings/charts.generated.js";import{LYRA_DEFAULT_chart,LYRA_DEFAULT_chartPreparedSummary,LYRA_DEFAULT_chartPreparedUnavailable,LYRA_DEFAULT_chartSummary,LYRA_DEFAULT_chartSummarySeparator,LYRA_DEFAULT_chartTrendDecreasing,LYRA_DEFAULT_chartTrendFlat,LYRA_DEFAULT_chartTrendIncreasing,LYRA_DEFAULT_loading}from"../../../internal/default-strings/shared.generated.js";function isLiteChartSeries(value){return hasArraySeriesData(value)}function normalizeLiteChartSeries(value){try{return Object.freeze(Array.isArray(value)?value.filter(isLiteChartSeries):[])}catch{return Object.freeze([])}}function normalizeLiteChartType(value){return value==="line"||value==="bar"?value:"bar"}const LITE_CHART_LAYOUT=literalSetConverter(["fit","scroll"],"fit"),autoNumberConverter={fromAttribute:value=>{if(value===null)return;const trimmed=value.trim();return trimmed.toLowerCase()==="auto"?"auto":Number(trimmed)}},DEFAULT_PALETTE=["var(--lr-chart-color-1, var(--lr-color-chart-1))","var(--lr-chart-color-2, var(--lr-color-chart-2))","var(--lr-chart-color-3, var(--lr-color-chart-3))","var(--lr-chart-color-4, var(--lr-color-chart-4))","var(--lr-chart-color-5, var(--lr-color-chart-5))","var(--lr-chart-color-6, var(--lr-color-chart-6))","var(--lr-chart-color-7, var(--lr-color-chart-7))","var(--lr-chart-color-8, var(--lr-color-chart-8))"],PAD_LEFT=36,PAD_RIGHT=8,PAD_TOP=8,PAD_BOTTOM=30,CATEGORY_LABEL_OFFSET=24,AXIS_TITLE_SPACE=14,TICK_COUNT=4,BAR_GROUP_GAP=.2,BAR_GAP=.08,BAR_CORNER_RADIUS=4,APPROX_LABEL_CHARACTER_WIDTH=7,AUTO_CATEGORY_LABEL_INSET=10,VALUE_AXIS_TICK_OFFSET=6,AUTO_VALUE_AXIS_SAFETY_INSET=8,MAX_AUTO_VALUE_AXIS_GUTTER=240,MAX_AUTO_VALUE_AXIS_GUTTER_FRACTION=.4,MAX_SCROLL_CONTENT_WIDTH=1e6,CATEGORY_LABEL_SELECTION_BOUNDS=Object.freeze({characterWidth:APPROX_LABEL_CHARACTER_WIDTH,laneInset:AUTO_CATEGORY_LABEL_INSET,maxContentWidth:MAX_SCROLL_CONTENT_WIDTH,maxRenderedRecords:MAX_RENDERED_CHART_RECORDS});function niceStep(span,count){const rough=span/Math.max(1,count),magnitude=10**Math.floor(Math.log10(rough)),residual=rough/magnitude;return(residual<1.5?1:residual<3?2:residual<7?5:10)*magnitude}function logDomainFraction(value,lo,hi){const top=Math.max(hi,0);if(!Number.isFinite(top)||top<=0)return domainFraction(value,lo,hi);const bottom=lo>0?lo:top/10;if(!Number.isFinite(bottom)||bottom<=0||bottom>=top)return domainFraction(value,lo,hi);if(!Number.isFinite(value)||value<=bottom)return 0;if(value>=top)return 1;const fraction=(Math.log10(value)-Math.log10(bottom))/(Math.log10(top)-Math.log10(bottom));return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function domainFraction(value,lo,hi){const span=hi-lo;if(Number.isFinite(span)&&span>0)return Math.min(1,Math.max(0,(value-lo)/span));const scale=Math.max(Math.abs(value),Math.abs(lo),Math.abs(hi),1),scaledSpan=hi/scale-lo/scale;if(!Number.isFinite(scaledSpan)||scaledSpan<=0)return 0;const fraction=(value/scale-lo/scale)/scaledSpan;return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function snapToStep(value,step){return Number.isFinite(step)&&step>0?Number(value.toFixed(Math.min(decimalPlaces(step),100))):value}function safeDomainTicks(lo,hi,count){return Array.from({length:Math.max(1,count)+1},(_,index)=>{if(index===0)return lo;if(index===count)return hi;const ratio=index/count;return Number((lo*(1-ratio)+hi*ratio).toPrecision(15))}).filter(Number.isFinite)}function logarithmicTicks(lo,hi,count){if(!(lo>0&&hi>lo)||!Number.isFinite(lo)||!Number.isFinite(hi))return;const start=Math.log10(lo),end=Math.log10(hi),span=end-start;if(!(span>0))return;const decades=span>=1,step=decades?Math.ceil(span/count):niceStep(hi-lo,count);if(!Number.isFinite(step)||step<=0)return[...new Set(safeDomainTicks(lo,hi,count))];const ticks=[lo],minimumGap=decades?step/2:span/(count*2),first=Math.ceil((decades?start:lo)/step);for(let index=0;index<=count+1;index++){const value=decades?10**((first+index)*step):snapToStep((first+index)*step,step);if(!Number.isFinite(value)||value>=hi)break;if(value<=ticks.at(-1))continue;const logarithm=Math.log10(value);logarithm-Math.log10(ticks.at(-1))>=minimumGap&&end-logarithm>=minimumGap&&ticks.push(value)}return ticks.push(hi),ticks}function niceDomain(dataLo,dataHi,beginAtZero,count){let lo=beginAtZero?Math.min(0,dataLo):dataLo,hi=beginAtZero?Math.max(0,dataHi):dataHi;lo===hi&&(Math.abs(lo)>Number.MAX_VALUE/2?(lo=lo>0?lo/2:lo,hi=hi<0?hi/2:hi):(lo-=1,hi+=1));const span=hi-lo;if(!Number.isFinite(span))return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const step=niceStep(span,count);if(!Number.isFinite(step)||step<=0)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const snap=value=>snapToStep(value,step),roundedLo=snap(Math.floor(lo/step)*step),roundedHi=snap(Math.ceil(hi/step)*step);Number.isFinite(roundedLo)&&(lo=roundedLo),Number.isFinite(roundedHi)&&(hi=roundedHi);const slots=Math.floor((hi-lo)/step);if(!Number.isFinite(slots)||slots<0||slots>100)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const ticks=[];for(let index=0;index<=slots;index++){const value=snap(lo+index*step);Number.isFinite(value)&&ticks.push(value)}return ticks.at(-1)!==hi&&ticks.push(hi),{lo,hi,ticks}}class LyraLiteChart extends LyraElement{constructor(){super(...arguments),this.type="bar",this._preparedData=null,this.preparedDirty=!0,this.preparedActive=!1,this.preparedChanged=!1,this.preparedInvalid=!1,this.preparedPending=!1,this.preparedRequestFailed=!1,this.announcedPreparedInvalid=!1,this.preparedRequests=new SourceRequestController(this,{channels:["point"],onReset:()=>{this.preparedPending=!1}}),this.labels=[],this.maxRecords=1e3,this._datasets=Object.freeze([]),this.datasetsTruncated=!1,this.datasetsSources=new CollectionSourceTracker,this.withLegend=!1,this.legendPosition="bottom",this.height="280px",this.xLabel="",this.yLabel="",this.withoutZeroBaseline=!1,this.stacked=!1,this.tableTotals=!1,this.withDataTable=!1,this.dataTableToggle=!1,this.dataTableExpandedOverride=null,this.dataTableId=nextId("lite-chart-data-table"),this._layout="fit",this.barWidth=32,this.roundedBars=!1,this.skipZero=!1,this.scale="linear",this.withoutValueAxis=!1,this.selectedIndices=[],this.hostAccessibleLabel=null,this.label=null,this.description=null,this.forcedColorPatternId=nextId("lite-chart-pattern"),this.descriptionId=nextId("lite-chart-description"),this.plotWidth=0,this.plotHeight=0,this.fitMeasurementAvailable=!1,this._activeMarkIndex=0,this.syncPlot={y:0,height:0},this.syncCategoryPositions=new Map,this.resizeObserverGeneration=0,this.axisTitleTargets=new Set,this.axisTitleFits=new WeakMap,this.themeWatcher=new ThemeWatcher(this,()=>this.requestUpdate()),this.refocusMarkAfterUpdate=!1,this.refocusChartAfterUpdate=!1,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.syncGroup="",this.chartSync=new LazyChartSyncController(this,(label,index)=>this.syncPresentation(label,index),void 0,target=>target.nodeType===1&&target.hasAttribute("data-mark-index"),()=>this.requestUpdate()),this.deferredTableGeneration=0,this.streamingTableUpdate=!1}static{this.defaultStrings={...super.defaultStrings,chart:LYRA_DEFAULT_chart,chartCategory:LYRA_DEFAULT_chartCategory,chartData:LYRA_DEFAULT_chartData,chartDataSampled:LYRA_DEFAULT_chartDataSampled,chartInputLimit:LYRA_DEFAULT_chartInputLimit,chartPlotSampled:LYRA_DEFAULT_chartPlotSampled,chartPointCoordinates:LYRA_DEFAULT_chartPointCoordinates,chartPreparedSummary:LYRA_DEFAULT_chartPreparedSummary,chartPreparedUnavailable:LYRA_DEFAULT_chartPreparedUnavailable,chartSeriesLabel:LYRA_DEFAULT_chartSeriesLabel,chartSummary:LYRA_DEFAULT_chartSummary,chartSummarySeparator:LYRA_DEFAULT_chartSummarySeparator,chartTotal:LYRA_DEFAULT_chartTotal,chartTrendDecreasing:LYRA_DEFAULT_chartTrendDecreasing,chartTrendFlat:LYRA_DEFAULT_chartTrendFlat,chartTrendIncreasing:LYRA_DEFAULT_chartTrendIncreasing,liteChartBarLabel:LYRA_DEFAULT_liteChartBarLabel,liteChartCustomMarkSummary:LYRA_DEFAULT_liteChartCustomMarkSummary,liteChartMarkSummary:LYRA_DEFAULT_liteChartMarkSummary,loading:LYRA_DEFAULT_loading}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["labels","selectedIndices"])}static{this.styles=[LyraElement.styles,specialistTokens,styles,srOnly,bidiStyles]}get preparedData(){return this._preparedData}set preparedData(value){const previous=this._preparedData;this._preparedData=value,this.requestUpdate("preparedData",previous),value===previous&&this.requestUpdate()}refreshPreparedModel(){if(!this.preparedDirty)return;this.preparedDirty=!1,this.preparedChanged=!0,this.preparedInvalid=!1,this.preparedRequestFailed=!1,this.preparedBaseModel=this.preparedModel=void 0,this.preparedEffective=void 0;const input=this._preparedData;this.preparedActive=input!==null;try{if(input!==null){const model=prepareChartModel(input,this.effectiveType,normalizeChartRecordLimit(this.maxRecords));if(model.kind==="series"&&this.stacked)throw new TypeError("Ordered series cannot be stacked");this.preparedBaseModel=this.preparedModel=model,this.preparedRequests.setSource(input,model.revision)}else this.preparedRequests.setSource(void 0,void 0)}catch{this.preparedInvalid=!0,this.preparedRequests.setSource(void 0,void 0)}}async revealSourcePoint(ref){if(!this.isConnected||!ref||typeof ref.seriesId!="string")return!1;ref=Object.freeze({seriesId:ref.seriesId,sourceIndex:ref.sourceIndex}),this.preparedDirty&&await this.updateComplete;const model=this.preparedBaseModel;if(!model||model.kind!=="series")return!1;const series=model.series.find(series2=>series2.id===ref.seriesId);if(!series||!Number.isSafeInteger(ref.sourceIndex)||ref.sourceIndex<0||ref.sourceIndex>=series.counts.sourceCount)return!1;const lease=this.preparedRequests.begin("point",this.effectiveLocale);if(!lease)return!1;this.preparedPending=!0,this.preparedRequestFailed=!1,this.requestUpdate("preparedView",null);const signal=lease.context.signal;try{const source=model.source;if(source.kind!=="series"||source.revision!==model.revision)throw new Error("Prepared source revision changed");const response=source.getPoint(ref,{signal}),point=await preparedResponse(response,signal);if(!lease.isCurrent()||this.preparedBaseModel!==model||source.revision!==model.revision||point===null)return!1;let next=model;const refinement=Object.getOwnPropertyDescriptor(source,"queryRange");if(refinement){if(!("value"in refinement)||typeof refinement.value!="function")throw new TypeError("Invalid indexed refinement");const otherEntries=model.peerCount-series.samples.length,entryBudget=Math.min(model.limit-otherEntries,Math.floor(1e3/model.series.length)),maxPoints=Math.max(1,Math.floor((entryBudget-1)/2)),startIndex=Math.max(0,ref.sourceIndex-maxPoints),endIndex=Math.min(series.counts.sourceCount,ref.sourceIndex+Math.min(maxPoints+1,series.counts.sourceCount-ref.sourceIndex)),request={seriesId:ref.seriesId,startIndex,endIndex,maxPoints,signal},points=await preparedResponse(source.queryRange(request),signal);if(!lease.isCurrent()||this.preparedBaseModel!==model||source.revision!==model.revision)return!1;next=withPreparedRange(model,request,points)}const overlay=withPreparedPoint(next,ref,point);return!lease.isCurrent()||this.preparedBaseModel!==model||source.revision!==model.revision?!1:(this.preparedModel=overlay,this.preparedChanged=!0,this.preparedEffective=void 0,this.recordSampleMemo=void 0,this.marksMemo=void 0,this.dataTableRows=void 0,!0)}catch{return lease.isCurrent()&&(this.preparedRequestFailed=!0,this.announcements.announceAssertive(this.localize("chartPreparedUnavailable"))),!1}finally{lease.isCurrent()&&(this.preparedPending=!1,this.requestUpdate("preparedView",null))}}get displayDatasets(){if(!this.preparedActive)return this.datasets;const model=this.preparedModel;if(!model)return[];if(this.preparedEffective?.model===model)return this.preparedEffective.datasets;const datasets=model.series.map(series=>Object.freeze({label:series.label,data:model.kind==="series"?Object.freeze(series.samples.map(point=>point?.y??null)):series.values}));return this.preparedEffective={model,datasets},datasets}get displayLabels(){return this.preparedActive?this.preparedModel?.labels??[]:this.labels}datumLabel(datasetIndex,index){const point=this.preparedModel?.kind==="series"?this.preparedModel.series[datasetIndex]?.samples[index]:void 0;return point?`${point.sourceIndex}: ${this.localize("chartPointCoordinates",void 0,{x:formatChartValue(point.x,this.effectiveLocale),y:point.y===null?"":formatChartValue(point.y,this.effectiveLocale)})}`:this.displayLabels[index]??""}preparedX(datasetIndex,index,plotX,plotW){const model=this.preparedModel,point=model?.series[datasetIndex]?.samples[index];if(!model||!point)return plotX;let lo=1/0,hi=-1/0;for(const series of model.series)series.xDomain&&(lo=Math.min(lo,series.xDomain.min),hi=Math.max(hi,series.xDomain.max));const fraction=lo===hi?.5:domainFraction(point.x,lo,hi);return plotX+(this.effectiveDirection==="rtl"?1-fraction:fraction)*plotW}preparedDescription(){const model=this.preparedModel;if(!model)return this.description??"";const summary=this.localize("chartPreparedSummary",void 0,{validCount:formatChartValue(model.validCount,this.effectiveLocale),invalidCount:formatChartValue(model.invalidCount,this.effectiveLocale),displayedCount:formatChartValue(model.displayedCount,this.effectiveLocale)}),domains=(this.preparedBaseModel??model).series.flatMap(series=>{if(!series.yDomain)return[];const first=series.samples[0]?.y??0,last=series.samples.at(-1)?.y??0;return[this.localize("chartSummary",void 0,{label:series.label,count:formatChartValue(series.counts.validCount,this.effectiveLocale),min:formatChartValue(series.yDomain.min,this.effectiveLocale),max:formatChartValue(series.yDomain.max,this.effectiveLocale),trend:this.localize(last>first?"chartTrendIncreasing":last<first?"chartTrendDecreasing":"chartTrendFlat")})]});return[this.description,...domains,summary].filter(Boolean).join(this.localize("chartSummarySeparator"))}get datasets(){return this._datasets}set datasets(value){if(this.datasetsSources.isRebind("datasets",value,this._datasets))return;const previous=this._datasets,bounded=boundChartSeriesValues(value);this.datasetsTruncated=bounded!==void 0,this._datasets=normalizeLiteChartSeries(snapshotPublicCollection(bounded??value,this.ownerDocument?.defaultView,{onResult:result=>{this.datasetsTruncated||=result.truncated}})),this.requestUpdate("datasets",previous)}get dataTableVisible(){return chartDataTableVisible(this.withDataTable,this.dataTableToggle,this.dataTableExpandedOverride)}toggleDataTable(){this.dataTableExpandedOverride=!this.dataTableVisible}get layout(){return this._layout}set layout(next){const normalized=LITE_CHART_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}get activeMarkIndex(){return this._activeMarkIndex}set activeMarkIndex(index){index!==this._activeMarkIndex&&(this.renderRoot?.querySelector(`[data-mark-index="${this._activeMarkIndex}"]`)?.setAttribute("tabindex","-1"),this._activeMarkIndex=index,this.renderRoot?.querySelector(`[data-mark-index="${index}"]`)?.setAttribute("tabindex","0"))}appendData(label,values,maxPoints=0){if(this._preparedData===null){this.deferStreamedTable(),this.streamingTableUpdate=!0;try{const bound=chartSeriesValueLimit(this.datasets.length),requested=Math.max(0,finiteCount(maxPoints,0)),limit=requested>0?Math.min(requested,bound):bound;let domainLength=this.labels.length;for(const series of this.datasets)domainLength=Math.max(domainLength,series.data.length);const retained=Math.min(domainLength+1,limit),start=domainLength+1-retained,labels=new Array(retained);for(let i=0;i<retained-1;i++)labels[i]=this.labels[start+i]??"";labels[retained-1]=label,this.labels=labels;const previous=this._datasets;this._datasets=Object.freeze(previous.map((series,index)=>{const data=new Array(retained);for(let i=0;i<retained-1;i++)data[i]=start+i<series.data.length?series.data[start+i]:null;return data[retained-1]=snapshotPublicCollection(values[index]??null,this.ownerDocument?.defaultView),Object.freeze({...series,data:Object.freeze(data)})})),this.datasetsSources.isRebind("datasets",this._datasets,previous),this.datasetsTruncated=!1,this.requestUpdate("datasets",previous)}finally{this.streamingTableUpdate=!1}}}exportData(format){if(format==="svg"){const XMLSerializerCtor=this.ownerDocument.defaultView?.XMLSerializer;return!this.svgEl||typeof XMLSerializerCtor!="function"?"":new XMLSerializerCtor().serializeToString(this.svgEl)}const header=["label",...this.displayDatasets.map(series=>series.label)].map(escapeCsvField).join(",");if(this.preparedModel?.kind==="series"){const rows2=[];return this.preparedModel.series.forEach((entry,datasetIndex)=>entry.samples.forEach((point,index)=>{if(!point||point.y===null)return;const label=this.datumLabel(datasetIndex,index),value=this.formatter?.({value:point.y,surface:"export",datasetIndex,index,label,seriesLabel:entry.label,axis:"y"})??point.y;rows2.push([label,...this.displayDatasets.map((_series,position)=>position===datasetIndex?value:"")].map(escapeCsvField).join(","))})),[header,...rows2].join(`\r
|
|
2
|
+
`)}const rows=Array.from({length:this.recordCount()},(_,index)=>{const label=this.displayLabels[index]??"";return[label,...this.displayDatasets.map((series,datasetIndex)=>{const value=series.data[index];return typeof value=="number"&&Number.isFinite(value)?this.formatter?.({value,surface:"export",datasetIndex,index,label,seriesLabel:series.label,axis:"y"})??value:""})].map(escapeCsvField).join(",")});return[header,...rows].join(`\r
|
|
3
|
+
`)}attributeChangedCallback(name,oldValue,value){super.attributeChangedCallback(name,oldValue,value),oldValue!==value&&(name==="style"||name==="class")&&(this.fitAxisTitles(),this.fitCategoryLabels())}connectedCallback(){super.connectedCallback(),this.requestUpdate(),this.armResizeObserver()}armResizeObserver(){const target=this.svgEl,ownerDocument=this.ownerDocument;if(!this.isConnected||!target||this.resizeObserver&&this.resizeObserverDocument===ownerDocument&&this.resizeObserverTarget===target)return;this.resetResizeObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.resizeObserverGeneration,observer=new ResizeObserverCtor(entries=>{if(this.resizeObserver!==observer||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.resizeObserverTarget!==target)return;const svgEntry=entries.find(entry=>entry.target===target);if(svgEntry){const box=svgEntry.contentBoxSize?.[0];if(box)this.plotWidth=box.inlineSize,this.plotHeight=box.blockSize;else{const rect=target.getBoundingClientRect();this.plotWidth=rect.width,this.plotHeight=rect.height}}entries.some(entry=>this.axisTitleTargets.has(entry.target))&&this.queueAxisTitleFit()});this.resizeObserver=observer,this.resizeObserverDocument=ownerDocument,this.resizeObserverTarget=target,target&&observer.observe(target),this.syncAxisTitleTargets()}disconnectedCallback(){this.preparedRequests.refresh(),this.preparedModel=this.preparedBaseModel=void 0,this.preparedEffective=void 0,this.preparedDirty=!0,this.clearDeferredTable(),this.chartSync.disconnect(),super.disconnectedCallback(),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.resetResizeObserver()}adoptedCallback(){this.preparedRequests.adopted(),this.clearDeferredTable(),this.chartSync.disconnect(),super.adoptedCallback(),this.requestUpdate(),this.resetResizeObserver(),this.announcements.adopted(),this.isConnected?this.themeWatcher.hostConnected():this.themeWatcher.hostDisconnected(),this.refreshFitMeasurementAvailability()}resetResizeObserver(){this.axisTitleFrame!==void 0&&(this.resizeObserverDocument?.defaultView?.cancelAnimationFrame(this.axisTitleFrame),this.axisTitleFrame=void 0),this.axisTitleTargets.clear(),this.resizeObserverGeneration+=1,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeObserverDocument=void 0,this.resizeObserverTarget=void 0}firstUpdated(changed){super.firstUpdated(changed),this.armResizeObserver()}willUpdate(changed){super.willUpdate(changed),this.refreshPreparedModel();const shouldSync=this.preparedModel?.kind!=="series"&&this.isConnected&&typeof this.syncGroup=="string"&&this.syncGroup.trim()!=="";if(this.chartSync.enabled!==shouldSync&&this.chartSync.update(this.syncGroup,shouldSync),this.seedFirstRenderState(()=>{this.refreshFitMeasurementAvailability()}),!(this.preparedChanged||["type","labels","datasets","skipZero","maxRecords","plotWidth","layout"].some(name=>changed.has(name))))return;const active=shadowFocusTarget(this)??null,hadFocusedMark=active?.matches('[part="bar"], [part="point"]')??!1,priorPosition=Number(active?.getAttribute("data-mark-index")??this.activeMarkIndex),datasetAttribute=active?.getAttribute("data-dataset-index"),indexAttribute=active?.getAttribute("data-index"),datasetIndex=Number(datasetAttribute),index=Number(indexAttribute),marks=this.interactiveMarks(),sameIdentity=datasetAttribute!=null&&indexAttribute!==null&&indexAttribute!==void 0?marks.findIndex(mark=>mark.datasetIndex===datasetIndex&&mark.index===index):-1;this.activeMarkIndex=marks.length?sameIdentity>=0?sameIdentity:Math.min(Math.max(priorPosition,0),marks.length-1):0,this.refocusMarkAfterUpdate=hadFocusedMark&&marks.length>0,this.refocusChartAfterUpdate=hadFocusedMark&&marks.length===0}updated(changed){super.updated(changed);const wasMounting=this.isMounting;if(this.preparedChanged=!1,this.setAttribute("aria-busy",String(this.preparedPending)),!wasMounting&&this.preparedInvalid&&!this.announcedPreparedInvalid&&this.announcements.announceAssertive(this.localize("chartPreparedUnavailable")),this.announcedPreparedInvalid=this.preparedInvalid,this.isMounting=!1,changed.has("height")){const height=sanitizeCssLength(this.height,"height");height?this.style.setProperty("--_lr-chart-height",height):this.style.removeProperty("--_lr-chart-height")}const inputLimit=this.inputLimitMessage(),sampling=this.dataTruncationMessage(),dataTruncation=inputLimit&&sampling?[inputLimit,sampling].join(this.localize("chartSummarySeparator")):inputLimit||sampling;wasMounting?this.lastDataTruncationAnnouncement=dataTruncation:dataTruncation!==this.lastDataTruncationAnnouncement&&(this.lastDataTruncationAnnouncement=dataTruncation,dataTruncation&&this.announcements.announcePolite(dataTruncation)),this.refocusMarkAfterUpdate&&(this.refocusMarkAfterUpdate=!1,this.renderRoot.querySelectorAll('[part="bar"], [part="point"]')[this.normalizedMarkIndex()]?.focus()),this.refocusChartAfterUpdate&&(this.refocusChartAfterUpdate=!1,this.svgEl?.focus()),(changed.size===0||[...changed.keys()].some(name=>!["selectedIndices","dataTableExpandedOverride","dataTable","dataTableToggle","description","label"].includes(String(name))))&&(this.fitAxisTitles(),this.fitCategoryLabels()),this.syncAxisTitleTargets();const dataChanged=["datasets","labels","type","skipZero","layout","maxRecords","maxSeries"].some(name=>changed.has(name));this.chartSync.update(this.syncGroup,this.preparedModel?.kind!=="series",dataChanged)}fitAxisTitles(){if(!(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length))for(const title of this.svgEl.querySelectorAll('[part="axis-title"]')){const text=Array.from(title.childNodes).find(node=>node.nodeType===3);if(!text)continue;const source=title.getAttribute("aria-label")??"",extent=finiteRange(Number(title.getAttribute("data-title-extent")),0,0,MAX_SCROLL_CONTENT_WIDTH),previous=this.axisTitleFits.get(title);if(!(previous?.source===source&&previous.extent===extent&&previous.display===text.data&&previous.width===title.getComputedTextLength())){if(title.style.removeProperty("opacity"),text.data=source,title.getComputedTextLength()>extent)if(text.data="…",title.getComputedTextLength()>extent)title.style.opacity="0";else{let lower=0,upper=source.length;for(;lower<upper;){const middle=Math.ceil((lower+upper)/2);text.data=`${source.slice(0,middle)}…`,title.getComputedTextLength()<=extent?lower=middle:upper=middle-1}const last=source.charCodeAt(lower-1);last>=55296&&last<=56319&&(lower-=1),text.data=`${source.slice(0,lower)}…`}this.axisTitleFits.set(title,{source,extent,display:text.data,width:title.getComputedTextLength()})}}}fitOneCategoryLabel(tick,x,anchor,extent){const width=this.fitCategoryBatch([{tick,extent}])[0]??0;return anchor==="start"?x+width:anchor==="end"?x-width:x}fitCategoryBatch(items){const candidates=items.map(({tick,extent})=>{const text=Array.from(tick.childNodes).find(node=>node.nodeType===3),source=tick.getAttribute("data-full-label")??"",bounded=finiteRange(extent,0,0,MAX_SCROLL_CONTENT_WIDTH);return tick.setAttribute("data-label-extent",String(bounded)),text&&(text.data=source),{tick,text,source,bounded,lower:0,upper:source.length,middle:0,overflow:!1}}),fullWidths=candidates.map(item=>item.tick.getComputedTextLength());candidates.forEach((item,index)=>{item.overflow=!!item.text&&fullWidths[index]>item.bounded});let searching=candidates.filter(item=>item.overflow&&item.source.length>1);for(;searching.length;){for(const item of searching)item.middle=Math.ceil((item.lower+item.upper)/2),item.text.data=`${item.source.slice(0,item.middle)}…`;const widths2=searching.map(item=>item.tick.getComputedTextLength());searching.forEach((item,index)=>{widths2[index]<=item.bounded?item.lower=item.middle:item.upper=item.middle-1}),searching=searching.filter(item=>item.lower<item.upper)}for(const item of candidates)if(item.text){if(item.overflow){const last=item.source.charCodeAt(item.lower-1);last>=55296&&last<=56319&&item.lower--,item.text.data=item.source.length?`${item.source.slice(0,item.lower)}…`:""}item.text.data===item.source?item.tick.removeAttribute("aria-label"):item.tick.setAttribute("aria-label",item.source)}return candidates.map(item=>item.tick.getComputedTextLength())}fitCategoryLabels(){if(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length)return;const ticks=[...this.svgEl.querySelectorAll('[part="axis-label"][data-full-label]')].filter(tick=>hasCategoryLabelText(tick.getAttribute("data-full-label"))).sort((a,b)=>Number(a.getAttribute("x"))-Number(b.getAttribute("x"))),count=ticks.length;if(count===0)return;const MARGIN=BAR_CORNER_RADIUS,positionOf=tick=>Number(tick.getAttribute("x"))||0,anchorOf=tick=>tick.getAttribute("text-anchor")??"middle",first=ticks[0],last=ticks[count-1],firstIsBoundary=count>1&&anchorOf(first)!=="middle",lastIsBoundary=count>1&&anchorOf(last)!=="middle";let firstRightEdge=positionOf(first),lastLeftEdge=positionOf(last);if(firstIsBoundary&&lastIsBoundary&&count===2){const half=Math.max(0,(positionOf(last)-positionOf(first))/2-MARGIN);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),half),lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),half)}else{if(firstIsBoundary){const gap=positionOf(ticks[1])-positionOf(first);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),gap-MARGIN)}if(lastIsBoundary){const gap=positionOf(last)-positionOf(ticks[count-2]);lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),gap-MARGIN)}}const interiors=[];for(let index=0;index<count;index++){if(index===0&&firstIsBoundary||index===count-1&&lastIsBoundary)continue;const tick=ticks[index],x=positionOf(tick),leftAvailable=index===0?MAX_SCROLL_CONTENT_WIDTH:index===1&&firstIsBoundary?x-firstRightEdge:(x-positionOf(ticks[index-1]))/2,rightAvailable=index===count-1?MAX_SCROLL_CONTENT_WIDTH:index===count-2&&lastIsBoundary?lastLeftEdge-x:(positionOf(ticks[index+1])-x)/2,extent=2*Math.min(leftAvailable,rightAvailable)-MARGIN;interiors.push({tick,extent})}this.fitCategoryBatch(interiors)}syncAxisTitleTargets(){if(!this.resizeObserver||!this.svgEl)return;const current=new Set(this.svgEl.querySelectorAll('[part="axis-title"]'));for(const title of this.axisTitleTargets)current.has(title)||this.resizeObserver.unobserve(title);for(const title of current)this.axisTitleTargets.has(title)||this.resizeObserver.observe(title);this.axisTitleTargets=current}queueAxisTitleFit(){const document=this.resizeObserverDocument,window=document?.defaultView;if(!window||this.axisTitleFrame!==void 0)return;const generation=this.resizeObserverGeneration,frame=window.requestAnimationFrame(()=>{this.axisTitleFrame!==frame||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==document||(this.axisTitleFrame=void 0,this.fitAxisTitles())});this.axisTitleFrame=frame}colorFor(index,series){return sanitizeCssColor(series.color)??DEFAULT_PALETTE[index%DEFAULT_PALETTE.length]}get effectiveType(){return normalizeLiteChartType(this.type)}forcedColors(){return this.forcedColorsMemo??=forcedColorsActive(this.ownerDocument?.defaultView)}markPaint(index,series){const color=this.colorFor(index,series);return this.effectiveType==="bar"&&this.forcedColors()?`url(#${this.forcedColorPatternId}-${index})`:color}legendEncoding(index){return this.forcedColors()?forcedColorEncoding(index).name:nothing}markDash(index){if(!this.forcedColors())return nothing;const dash=forcedColorEncoding(index).dash;return dash.length?dash.join(" "):"none"}renderForcedColorPatterns(){if(this.effectiveType!=="bar"||!this.forcedColors())return nothing;const size=8,half=size/2,texture="var(--lr-color-surface)";return svg`<defs>
|
|
4
|
+
${this.recordSample().seriesIndexes.map(index=>{const series=this.displayDatasets[index],encoding=forcedColorEncoding(index).name,shapes=(()=>{switch(encoding){case"horizontal":return svg`<rect y=${half} width=${size} height="1" fill=${texture}></rect>`;case"vertical":return svg`<rect x=${half} width="1" height=${size} fill=${texture}></rect>`;case"diagonal":return svg`<path
|
|
4
5
|
d=${`M${-half},${size} L${half},0 M${half},${size} L${size+half},0`}
|
|
5
6
|
stroke=${texture}
|
|
6
7
|
stroke-width="1"
|
|
@@ -19,11 +20,11 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
19
20
|
<rect width=${size} height=${size} fill=${this.colorFor(index,series)}></rect>
|
|
20
21
|
${shapes}
|
|
21
22
|
</pattern>`})}
|
|
22
|
-
</defs>`}resolvePointText(label,value,datasetIndex,index){return this.formatter?.({value,surface:"visual",datasetIndex,...index===void 0?{}:{index},label,seriesLabel:this.
|
|
23
|
+
</defs>`}resolvePointText(label,value,datasetIndex,index){return this.formatter?.({value,surface:"visual",datasetIndex,...index===void 0?{}:{index},label,seriesLabel:this.displayDatasets[datasetIndex]?.label,axis:"y"})??this.pointText?.(label,value,datasetIndex)}formatTableCell(value,context,numberFormat){return this.formatter?.({value,surface:"table",datasetIndex:context.datasetIndex??void 0,index:context.index,label:context.label,seriesLabel:context.seriesLabel??void 0,axis:"y",...context.kind==="total"?{statistic:"total"}:{}})??this.tableCellFormatter?.(value,context)??formatChartValue(value,this.effectiveLocale,numberFormat)}tableTotalAt(index,seriesIndexes){let total=0,hasValue=!1;for(const seriesIndex of seriesIndexes){const series=this.displayDatasets[seriesIndex];if(!series)continue;const value=series.data[index];value==null||!Number.isFinite(value)||(total=finiteAdd(total,value),hasValue=!0)}return hasValue?total:null}recordCount(){let count=this.displayLabels.length;for(const series of this.displayDatasets)count=Math.max(count,series.data.length);return count}recordSample(){const memo=this.recordSampleMemo,limit=normalizeChartRecordLimit(this.maxRecords),width=this.layout==="scroll"?void 0:this.plotWidth||void 0;if(memo?.labels===this.displayLabels&&memo.datasets===this.displayDatasets&&memo.limit===limit&&memo.width===width)return memo.value;const rowCount=this.recordCount(),seriesCount=this.displayDatasets.length;if(this.preparedActive){const value2={rowCount,seriesCount,rowIndexes:Array.from({length:rowCount},(_,index)=>index),seriesIndexes:Array.from({length:seriesCount},(_,index)=>index)};return this.recordSampleMemo={labels:this.displayLabels,datasets:this.displayDatasets,limit,width,value:value2},value2}const value={rowCount,seriesCount,...sampleChartTableIndexes(rowCount,seriesCount,{maxRecords:limit,width,valueAt:(row,series)=>this.displayDatasets[series]?.data[row]})};return this.recordSampleMemo={labels:this.displayLabels,datasets:this.displayDatasets,limit,width,value},value}generatedDataIsSampled(){const sample=this.recordSample();return sample.rowCount===0||sample.seriesCount===0?!1:sample.rowIndexes.length<sample.rowCount||sample.seriesIndexes.length<sample.seriesCount}inputLimitMessage(){return this.preparedActive?"":this.datasetsTruncated||publicCollectionTruncation(this,"labels")?this.localize("chartInputLimit"):""}dataTruncationMessage(){return this.generatedDataIsSampled()?this.localize(this.hasCustomDataTable()?"chartPlotSampled":"chartDataSampled"):""}hasCustomDataTable(){return hasSlottedChartDataTable(this)}interactiveMarks(){const sample=this.recordSample(),memo=this.marksMemo;if(memo?.sample===sample&&memo.type===this.effectiveType&&memo.skipZero===this.skipZero)return memo.value;const marks=[];if(this.effectiveType==="bar")for(const index of sample.rowIndexes)for(const datasetIndex of sample.seriesIndexes){const value=this.displayDatasets[datasetIndex]?.data[index];value==null||!Number.isFinite(value)||this.skipZero&&value===0||marks.push({datasetIndex,index,label:this.datumLabel(datasetIndex,index),value})}else sample.seriesIndexes.forEach(datasetIndex=>{const series=this.displayDatasets[datasetIndex];series&&sample.rowIndexes.forEach(index=>{const value=series.data[index];value==null||!Number.isFinite(value)||marks.push({datasetIndex,index,label:this.datumLabel(datasetIndex,index),value})})});return this.marksMemo={sample,type:this.effectiveType,skipZero:this.skipZero,value:marks},marks}awaitingFitMeasurement(){return this.layout==="fit"&&this.fitMeasurementAvailable&&(this.plotWidth<=0||this.plotHeight<=0)}refreshFitMeasurementAvailability(){this.fitMeasurementAvailable=typeof this.ownerDocument?.defaultView?.ResizeObserver=="function"}markIndexMap(){const marks=this.interactiveMarks(),memo=this.marksMemo;return memo.indexes??=new Map(marks.map((mark,index)=>[`${mark.datasetIndex}:${mark.index}`,index])),memo.indexes}normalizedMarkIndex(marks=this.interactiveMarks()){return marks.length?Math.min(Math.max(this.activeMarkIndex,0),marks.length-1):-1}markSummary(index,marks){const mark=marks[index];if(!mark)return;const series=this.displayDatasets[mark.datasetIndex]?.label??this.localize("chartSeriesLabel"),custom=this.formatter?.({value:mark.value,surface:"spoken",datasetIndex:mark.datasetIndex,index:mark.index,label:mark.label,seriesLabel:series,axis:"y"})??this.resolvePointText(mark.label,mark.value,mark.datasetIndex,mark.index);return custom?{format:values=>this.localize("liteChartCustomMarkSummary",void 0,values),values:{content:custom,index:getNumberFormat(this.effectiveLocale).format(index+1),total:getNumberFormat(this.effectiveLocale).format(marks.length)},isolated:["content"]}:{format:values=>this.localize("liteChartMarkSummary",void 0,values),values:{series,label:mark.label,value:formatChartValue(mark.value,this.effectiveLocale),index:getNumberFormat(this.effectiveLocale).format(index+1),total:getNumberFormat(this.effectiveLocale).format(marks.length)},isolated:["series","label","value"]}}clearDeferredTable(){this.deferredTableGeneration++,this.cancelDeferredTable?.(),this.cancelDeferredTable=void 0,this.deferredTableRows=void 0}deferStreamedTable(){if(this.dataTableVisible||this.displayDatasets.length<2||this.hasCustomDataTable()){this.clearDeferredTable();return}const view=this.ownerDocument?.defaultView;if(!this.isConnected||!view||this.cancelDeferredTable||!this.dataTableRows)return;const generation=++this.deferredTableGeneration;this.deferredTableRows=this.dataTableRows;const refresh=()=>{generation!==this.deferredTableGeneration||!this.isConnected||this.ownerDocument.defaultView!==view||(this.deferredTableGeneration++,this.cancelDeferredTable=void 0,this.deferredTableRows=void 0,this.dataTableRows=void 0,super.requestUpdate())};if(view.requestIdleCallback&&view.cancelIdleCallback){const handle=view.requestIdleCallback(refresh,{timeout:250});this.cancelDeferredTable=()=>view.cancelIdleCallback(handle)}else{const handle=view.setTimeout(refresh,0);this.cancelDeferredTable=()=>view.clearTimeout(handle)}}requestUpdate(...args){(args[0]===void 0||["preparedData","type","maxRecords","stacked"].includes(String(args[0])))&&(this.preparedDirty=!0,this.preparedRequests?.refresh()),this.forcedColorsMemo=void 0,(args[0]===void 0||["preparedData","preparedView","labels","datasets","type","stacked","tableTotals","formatter","tableCellFormatter","pointText","skipZero","maxRecords","plotWidth","layout","locale","lang","dir","strings","withDataTable","dataTableToggle","dataTableExpandedOverride"].includes(String(args[0])))&&(this.dataTableRows=void 0,this.dataListMemo=void 0,(!this.streamingTableUpdate||this.dataTableVisible)&&this.clearDeferredTable()),super.requestUpdate(...args)}renderDataTableRows(){if(!this.dataTableVisible&&this.deferredTableRows)return this.deferredTableRows;if(this.dataTableRows)return this.dataTableRows;const recordSample=this.recordSample(),direction=this.effectiveDirection==="rtl"?"rtl":"ltr",tableNumberFormat=getNumberFormat(this.effectiveLocale),showTableTotals=this.effectiveType==="bar"&&this.stacked&&this.tableTotals;return this.dataTableRows=recordSample.rowIndexes.map(index=>{const label=this.displayLabels[index]??"";return html`<tr>
|
|
23
24
|
<th scope="row">${isolateHtml(label||getNumberFormat(this.effectiveLocale).format(index+1),direction)}</th>
|
|
24
|
-
${recordSample.seriesIndexes.map(datasetIndex=>{const series=this.
|
|
25
|
+
${recordSample.seriesIndexes.map(datasetIndex=>{const series=this.displayDatasets[datasetIndex],value=series.data[index];return html`<td>${isolateHtml(value==null||!Number.isFinite(value)?"":this.formatTableCell(value,{kind:"value",datasetIndex,index,label,seriesLabel:series.label},tableNumberFormat),direction)}</td>`})}
|
|
25
26
|
${showTableTotals?(()=>{const total=this.tableTotalAt(index,recordSample.seriesIndexes);return html`<td>${isolateHtml(total==null?"":this.formatTableCell(total,{kind:"total",datasetIndex:null,index,label,seriesLabel:null},tableNumberFormat),direction)}</td>`})():nothing}
|
|
26
|
-
</tr>`})}dataListItems(marks){const visible=this.dataTableVisible,memo=this.dataListMemo;if(memo?.marks===marks&&memo.visible===visible)return memo.value;const value=marks.map((_mark,index)=>html`<li>${visible?this.markListItem(index,marks):this.markAnnouncement(index,marks)}</li>`);return this.dataListMemo={marks,visible,value},value}markAnnouncement(index,marks=this.interactiveMarks()){const summary=this.markSummary(index,marks);return summary?summary.format(summary.values):""}markListItem(index,marks){const summary=this.markSummary(index,marks);return summary?isolatedMessage(summary.format,summary.values,summary.isolated):""}onMarkFocus(index){const marks=this.interactiveMarks();marks[index]&&(this.activeMarkIndex=index,this.publishSyncMark(marks[index]),this.liveRegion?.announce(this.markAnnouncement(index,marks),{force:!0}))}focusMark(index){this.interactiveMarks()[index]&&(this.activeMarkIndex=index,this.updateComplete.then(()=>{const mark=Array.from(this.renderRoot.querySelectorAll('[part="bar"], [part="point"]'))[index];mark&&(shadowFocusTarget(this)===mark?this.onMarkFocus(index):mark.focus())}))}barValueToY(value,plotY,plotH,lo,hi){if(this.scale==="sqrt"){const zeroY=plotY+plotH-domainFraction(0,lo,hi)*plotH;if(value>=0){const domainMax2=hi>0?hi:1,fraction2=Math.sqrt(Math.min(domainMax2,value)/domainMax2);return zeroY-fraction2*(zeroY-plotY)}const domainMax=lo<0?-lo:1,fraction=Math.sqrt(Math.min(domainMax,-value)/domainMax);return zeroY+fraction*(plotY+plotH-zeroY)}return plotY+plotH-this.valueFraction(value,lo,hi)*plotH}valueFraction(value,lo,hi){return this.scale==="logarithmic"?logDomainFraction(value,this.logDomainFloor(lo,hi),hi):domainFraction(value,lo,hi)}logDomainFloor(lo,hi){if(lo>0)return lo;if(this.smallestPositive?.datasets!==this.
|
|
27
|
+
</tr>`})}dataListItems(marks){const visible=this.dataTableVisible,memo=this.dataListMemo;if(memo?.marks===marks&&memo.visible===visible)return memo.value;const value=marks.map((_mark,index)=>html`<li>${visible?this.markListItem(index,marks):this.markAnnouncement(index,marks)}</li>`);return this.dataListMemo={marks,visible,value},value}markAnnouncement(index,marks=this.interactiveMarks()){const summary=this.markSummary(index,marks);return summary?summary.format(summary.values):""}markListItem(index,marks){const summary=this.markSummary(index,marks);return summary?isolatedMessage(summary.format,summary.values,summary.isolated):""}onMarkFocus(index){const marks=this.interactiveMarks();marks[index]&&(this.activeMarkIndex=index,this.publishSyncMark(marks[index]),this.liveRegion?.announce(this.markAnnouncement(index,marks),{force:!0}))}focusMark(index){this.interactiveMarks()[index]&&(this.activeMarkIndex=index,this.updateComplete.then(()=>{const mark=Array.from(this.renderRoot.querySelectorAll('[part="bar"], [part="point"]'))[index];mark&&(shadowFocusTarget(this)===mark?this.onMarkFocus(index):mark.focus())}))}barValueToY(value,plotY,plotH,lo,hi){if(this.scale==="sqrt"){const zeroY=plotY+plotH-domainFraction(0,lo,hi)*plotH;if(value>=0){const domainMax2=hi>0?hi:1,fraction2=Math.sqrt(Math.min(domainMax2,value)/domainMax2);return zeroY-fraction2*(zeroY-plotY)}const domainMax=lo<0?-lo:1,fraction=Math.sqrt(Math.min(domainMax,-value)/domainMax);return zeroY+fraction*(plotY+plotH-zeroY)}return plotY+plotH-this.valueFraction(value,lo,hi)*plotH}valueFraction(value,lo,hi){return this.scale==="logarithmic"?logDomainFraction(value,this.logDomainFloor(lo,hi),hi):domainFraction(value,lo,hi)}logDomainFloor(lo,hi){if(lo>0)return lo;if(this.smallestPositive?.datasets!==this.displayDatasets){let smallest2=Number.POSITIVE_INFINITY;for(const series of this.displayDatasets)for(const value of series.data)value==null||!Number.isFinite(value)||value<=0||value<smallest2&&(smallest2=value);this.smallestPositive={datasets:this.displayDatasets,value:smallest2}}const smallest=this.smallestPositive.value;return Number.isFinite(smallest)?smallest:hi>0?hi/10:1}effectiveMinBarHeight(){return this.minBarHeight==null?void 0:finiteRange(this.minBarHeight,0,0,MAX_SCROLL_CONTENT_WIDTH)}roundedBarPath(x,y,w,h){const r=Math.max(0,Math.min(BAR_CORNER_RADIUS,w/2,h));return r<=0?`M${x},${y} h${w} v${h} h${-w} Z`:`M${x},${y+r} Q${x},${y} ${x+r},${y} H${x+w-r} Q${x+w},${y} ${x+w},${y+r} V${y+h} H${x} Z`}domain(){let lo=1/0,hi=-1/0;if(this.preparedModel?.kind==="series")for(const series of this.preparedModel.series)series.yDomain&&(lo=Math.min(lo,series.yDomain.min),hi=Math.max(hi,series.yDomain.max));else if(this.effectiveType==="bar"&&this.stacked)for(let i=0;i<this.recordCount();i++){let pos=0,neg=0;for(const s of this.displayDatasets){const v=s.data[i];v==null||!Number.isFinite(v)||(v>=0?pos=finiteAdd(pos,v):neg=finiteAdd(neg,v))}lo=Math.min(lo,neg),hi=Math.max(hi,pos)}else for(const s of this.displayDatasets)for(const v of s.data)v==null||!Number.isFinite(v)||(lo=Math.min(lo,v),hi=Math.max(hi,v));(!Number.isFinite(lo)||!Number.isFinite(hi))&&(lo=0,hi=1);const domain=niceDomain(lo,hi,!this.withoutZeroBaseline,TICK_COUNT);if(this.scale==="logarithmic"){const ticks=logarithmicTicks(this.logDomainFloor(domain.lo,domain.hi),domain.hi,TICK_COUNT);if(ticks)return{...domain,ticks}}return domain}emitPoint(datasetIndex,index){if(!this.isConnected)return;const model=this.preparedModel;if(model){const series=model.series[datasetIndex];if(!series)return;if(model.kind==="series"){const point=series.samples[index];if(!point)return;this.emit("lr-source-point-select",{revision:model.revision,seriesId:series.id,sourceIndex:point.sourceIndex,point:Object.freeze({x:point.x,y:point.y})})}else{const categoryId=model.categoryIds[index],value2=series.values[index];if(categoryId===void 0||value2===void 0)return;this.emit("lr-source-category-select",{revision:model.revision,seriesId:series.id,categoryId,value:value2,observationCount:model.categoryCounts[index]})}}const label=this.datumLabel(datasetIndex,index),value=this.displayDatasets[datasetIndex]?.data[index]??null;this.emit("lr-datum-activate",{kind:this.effectiveType==="bar"?"bar":"point",datasetIndex,index,label,value}),this.emit("lr-point-activate",{datasetIndex,index,label,value})}emitNearestLinePoint(event,points,fallbackDatasetIndex,fallbackIndex){let selected=points.find(point=>point.datasetIndex===fallbackDatasetIndex&&point.index===fallbackIndex);const currentTarget=event.currentTarget,svgElement=currentTarget instanceof SVGElement?currentTarget.ownerSVGElement:null,screenMatrix=svgElement?.getScreenCTM();if(event.detail>0&&svgElement&&screenMatrix&&points.length){const renderedPoint=svgElement.createSVGPoint(),squaredDistance=point=>{renderedPoint.x=point.x,renderedPoint.y=point.y;const screenPoint=renderedPoint.matrixTransform(screenMatrix),dx=event.clientX-screenPoint.x,dy=event.clientY-screenPoint.y;return dx*dx+dy*dy};let bestDistance=selected?squaredDistance(selected):Number.POSITIVE_INFINITY;for(const point of points){const distance=squaredDistance(point);distance<bestDistance&&(selected=point,bestDistance=distance)}}this.emitPoint(selected?.datasetIndex??fallbackDatasetIndex,selected?.index??fallbackIndex)}publishSyncMark(mark){this.chartSync.publish(mark.label,mark.index)}syncPresentation(label,sourceIndex){const marks=this.interactiveMarks();let index=sourceIndex??void 0;if(index===void 0)for(const mark of marks)mark.label===label&&(index===void 0||mark.index<index)&&(index=mark.index);if(index===void 0||this.displayLabels[index]!==label)return;const matched=marks.filter(mark=>mark.index===index);if(!matched.length||!this.svgEl)return;const target=this.svgEl.querySelector(`[data-dataset-index="${matched[0].datasetIndex}"][data-index="${index}"]`),container=this.renderRoot.querySelector('[part="base"]');if(!target||!container||!target.getClientRects().length)return;const bounds=container.getBoundingClientRect(),matrix=this.svgEl.getScreenCTM();if(!matrix)return;const rows=matched.map(mark=>{const series=this.displayDatasets[mark.datasetIndex]?.label??"";return this.resolvePointText(mark.label,mark.value,mark.datasetIndex,mark.index)??this.localize("liteChartBarLabel",void 0,{series,label:mark.label,value:formatChartValue(mark.value,this.effectiveLocale)})});return{container,x:matrix.a*(this.syncCategoryPositions.get(index)??0)+matrix.e-bounds.left+container.scrollLeft,top:matrix.d*this.syncPlot.y+matrix.f-bounds.top+container.scrollTop,height:Math.abs(matrix.d*this.syncPlot.height),tooltip:{title:label,rows}}}onPointKeyDown(e,datasetIndex,index,markIndex){if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.onMarkFocus(markIndex),this.emitPoint(datasetIndex,index);return}const marks=this.interactiveMarks();if(!marks.length)return;const rtl=this.effectiveDirection==="rtl",forwardKey=rtl?"ArrowLeft":"ArrowRight",backwardKey=rtl?"ArrowRight":"ArrowLeft";let next=markIndex;if(e.key===forwardKey||e.key==="ArrowDown")next=Math.min(marks.length-1,markIndex+1);else if(e.key===backwardKey||e.key==="ArrowUp")next=Math.max(0,markIndex-1);else if(e.key==="Home")next=0;else if(e.key==="End")next=marks.length-1;else return;e.preventDefault(),this.focusMark(next)}formatValueAxisTick(value){return this.formatter?.({value,surface:"tick",axis:"y"})??(this.tickFormat?this.tickFormat(value):formatTick(value,this.effectiveLocale))}renderGrid(plotX,plotY,plotW,plotH,ticks,lo,hi){const rtl=this.effectiveDirection==="rtl";return ticks.map(({value,label})=>{const y=plotY+plotH-this.valueFraction(value,lo,hi)*plotH;return svg`
|
|
27
28
|
<line part="grid-line" x1=${plotX} y1=${y} x2=${plotX+plotW} y2=${y}></line>
|
|
28
29
|
<text
|
|
29
30
|
part="axis-label"
|
|
@@ -32,7 +33,7 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
32
33
|
text-anchor="end"
|
|
33
34
|
dominant-baseline="middle"
|
|
34
35
|
>${label}</text>
|
|
35
|
-
`})}renderBars(plotX,plotY,plotH,slot,lo,hi,barOrigins,recordSample,selectedIndices){const groupCount=this.stacked?1:Math.max(1,recordSample.seriesIndexes.length),groupGap=finiteRange(this.barGapRatio??BAR_GROUP_GAP,BAR_GROUP_GAP,0,1),groupW=slot*(1-groupGap),barGap=groupCount>1?Math.min(BAR_GAP*slot,groupW/(2*(groupCount-1))):0,barW=(groupW-barGap*(groupCount-1))/groupCount,markIndexes=this.markIndexMap(),activeMarkIndex=this.normalizedMarkIndex(),numberFormat=getNumberFormat(this.effectiveLocale),minBarHeight=this.effectiveMinBarHeight(),stackedSqrt=this.stacked&&this.scale==="sqrt",stackedLog=this.stacked&&this.scale==="logarithmic",domainMax=hi>0?hi:1,negDomainMax=lo<0?-lo:1,zeroY=plotY+plotH-(stackedLog?0:domainFraction(0,lo,hi))*plotH,clampSvgCoordinate=(value,fallback=zeroY)=>finiteRange(value,fallback,-MAX_SCROLL_CONTENT_WIDTH,MAX_SCROLL_CONTENT_WIDTH),clampSvgLength=value=>finiteRange(value,0,0,MAX_SCROLL_CONTENT_WIDTH),posAvailH=zeroY-plotY,negAvailH=plotY+plotH-zeroY,posTotals=new Map,negTotals=new Map;if(stackedSqrt||stackedLog)for(const i of recordSample.rowIndexes){let pos=0,neg=0;for(const datasetIndex of recordSample.seriesIndexes){const s=this.
|
|
36
|
+
`})}renderBars(plotX,plotY,plotH,plotW,slot,lo,hi,barOrigins,recordSample,selectedIndices){const prepared=this.preparedModel,groupCount=this.stacked||prepared?.kind==="series"?1:Math.max(1,recordSample.seriesIndexes.length),groupGap=finiteRange(this.barGapRatio??BAR_GROUP_GAP,BAR_GROUP_GAP,0,1),groupW=slot*(1-groupGap),barGap=groupCount>1?Math.min(BAR_GAP*slot,groupW/(2*(groupCount-1))):0,barW=(groupW-barGap*(groupCount-1))/groupCount,markIndexes=this.markIndexMap(),activeMarkIndex=this.normalizedMarkIndex(),numberFormat=getNumberFormat(this.effectiveLocale),minBarHeight=this.effectiveMinBarHeight(),stackedSqrt=this.stacked&&this.scale==="sqrt",stackedLog=this.stacked&&this.scale==="logarithmic",domainMax=hi>0?hi:1,negDomainMax=lo<0?-lo:1,zeroY=plotY+plotH-(stackedLog?0:domainFraction(0,lo,hi))*plotH,clampSvgCoordinate=(value,fallback=zeroY)=>finiteRange(value,fallback,-MAX_SCROLL_CONTENT_WIDTH,MAX_SCROLL_CONTENT_WIDTH),clampSvgLength=value=>finiteRange(value,0,0,MAX_SCROLL_CONTENT_WIDTH),posAvailH=zeroY-plotY,negAvailH=plotY+plotH-zeroY,posTotals=new Map,negTotals=new Map;if(stackedSqrt||stackedLog)for(const i of recordSample.rowIndexes){let pos=0,neg=0;for(const datasetIndex of recordSample.seriesIndexes){const s=this.displayDatasets[datasetIndex];if(!s)continue;const v=s.data[i];v==null||!Number.isFinite(v)||this.skipZero&&v===0||(v>=0?pos=finiteAdd(pos,v):neg=finiteAdd(neg,v))}posTotals.set(i,pos),negTotals.set(i,neg)}const bars=[];for(const i of recordSample.rowIndexes){const slotStart=(barOrigins.get(i)??plotX+i*slot)+(slot-groupW)/2;let stackPos=0,stackNeg=0,posPixelTop=zeroY,negPixelBottom=zeroY;const posCompressedH=stackedSqrt?Math.sqrt(Math.min(domainMax,posTotals.get(i)??0)/domainMax)*posAvailH:0,negCompressedH=stackedSqrt?Math.sqrt(Math.min(negDomainMax,-(negTotals.get(i)??0))/negDomainMax)*negAvailH:0,logTotal=posTotals.get(i)??0,logStackH=stackedLog?this.valueFraction(logTotal,lo,hi)*plotH:0;let logShareTotal=0;if(stackedLog&&logTotal>0)for(const datasetIndex of recordSample.seriesIndexes){const value=this.displayDatasets[datasetIndex]?.data[i];value!=null&&Number.isFinite(value)&&value>0&&(logShareTotal+=value/logTotal)}recordSample.seriesIndexes.forEach((di,sampledDatasetIndex)=>{const s=this.displayDatasets[di];if(!s)return;const v=s.data[i];if(v==null||!Number.isFinite(v)||this.skipZero&&v===0)return;const color=this.colorFor(di,s),paint=this.markPaint(di,s);let rectX,y1,y2;if(this.stacked&&stackedSqrt)if(rectX=slotStart,v>=0){const total=posTotals.get(i)??0,shareLo=total>0?stackPos/total:0,nextStackPos=finiteAdd(stackPos,v),shareHi=total>0?nextStackPos/total:0;y1=zeroY-shareHi*posCompressedH,y2=zeroY-shareLo*posCompressedH,stackPos=nextStackPos}else{const total=-(negTotals.get(i)??0),shareLo=-stackNeg/total,nextStackNeg=finiteAdd(stackNeg,v),shareHi=-nextStackNeg/total;y1=zeroY+shareLo*negCompressedH,y2=zeroY+shareHi*negCompressedH,stackNeg=nextStackNeg}else if(stackedLog){rectX=slotStart;const naturalH=v>0&&logShareTotal>0?v/logTotal/logShareTotal*logStackH:0,segH=clampSvgLength(minBarHeight!=null&&v!==0&&naturalH<minBarHeight?minBarHeight:naturalH);v>=0?(y2=posPixelTop,y1=clampSvgCoordinate(finiteAdd(posPixelTop,-segH),posPixelTop),posPixelTop=y1):(y1=negPixelBottom,y2=clampSvgCoordinate(finiteAdd(negPixelBottom,segH),negPixelBottom),negPixelBottom=y2)}else if(this.stacked)if(rectX=slotStart,v>=0){const naturalH=clampSvgLength(Math.max(0,zeroY-this.barValueToY(v,plotY,plotH,lo,hi))),segH=clampSvgLength(minBarHeight!=null&&v!==0&&naturalH<minBarHeight?minBarHeight:naturalH);y2=posPixelTop,y1=clampSvgCoordinate(finiteAdd(posPixelTop,-segH),posPixelTop),posPixelTop=y1}else{const naturalH=clampSvgLength(Math.max(0,this.barValueToY(v,plotY,plotH,lo,hi)-zeroY)),segH=clampSvgLength(minBarHeight!=null&&v!==0&&naturalH<minBarHeight?minBarHeight:naturalH);y1=negPixelBottom,y2=clampSvgCoordinate(finiteAdd(negPixelBottom,segH),negPixelBottom),negPixelBottom=y2}else{rectX=prepared?.kind==="series"?this.preparedX(di,i,plotX+barW/2,Math.max(0,plotW-barW))-barW/2:slotStart+sampledDatasetIndex*(barW+barGap);const zeroClamped=Math.min(hi,Math.max(lo,0)),barValLo=Math.min(zeroClamped,v),barValHi=Math.max(zeroClamped,v);y1=this.barValueToY(barValHi,plotY,plotH,lo,hi),y2=this.barValueToY(barValLo,plotY,plotH,lo,hi)}rectX=clampSvgCoordinate(rectX,plotX),y1=clampSvgCoordinate(y1),y2=clampSvgCoordinate(y2);const label=this.datumLabel(di,i),titleText=this.resolvePointText(label,v,di,i)??this.localize("liteChartBarLabel",void 0,{series:s.label,label,value:formatChartValue(v,this.effectiveLocale,numberFormat)}),w=clampSvgLength(Math.max(0,barW));let h=clampSvgLength(Math.max(0,y2-y1));if(!(this.stacked&&!stackedSqrt)&&minBarHeight!=null&&v!==0&&h<minBarHeight){const extra=minBarHeight-h;y1=clampSvgCoordinate(finiteAdd(y1,-extra),y1),h=clampSvgLength(Math.max(0,y2-y1))}const markIndex=markIndexes.get(`${di}:${i}`),selected=selectedIndices.has(i),intraGroupSpacing=barW+barGap,crossCategorySpacing=slot-Math.max(0,groupCount-1)*intraGroupSpacing,horizontalSpacing=Math.max(0,groupCount>1?Math.min(intraGroupSpacing,crossCategorySpacing):slot),hitWidth=clampSvgLength(Math.max(w,Math.min(24,horizontalSpacing))),hitHeight=this.stacked?h:clampSvgLength(Math.max(24,h)),hitX=clampSvgCoordinate(rectX-(hitWidth-w)/2,rectX),hitY=clampSvgCoordinate(y1-(hitHeight-h)/2,y1),hitTarget=svg`
|
|
36
37
|
<rect
|
|
37
38
|
data-mark-hit-target="bar"
|
|
38
39
|
aria-hidden="true"
|
|
@@ -41,7 +42,7 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
41
42
|
width=${hitWidth}
|
|
42
43
|
height=${hitHeight}
|
|
43
44
|
style="fill: transparent; pointer-events: all"
|
|
44
|
-
@click=${()=>this.emitPoint(di,i)}
|
|
45
|
+
@click=${()=>{prepared===this.preparedModel&&this.emitPoint(di,i)}}
|
|
45
46
|
></rect>
|
|
46
47
|
`;bars.push(this.roundedBars?svg`
|
|
47
48
|
<g class="mark-hit-group" @pointermove=${()=>this.publishSyncMark({datasetIndex:di,index:i,label,value:v})}>
|
|
@@ -59,9 +60,9 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
59
60
|
data-mark-index=${markIndex}
|
|
60
61
|
data-dataset-index=${di}
|
|
61
62
|
data-index=${i}
|
|
62
|
-
@click=${()=>this.emitPoint(di,i)}
|
|
63
|
+
@click=${()=>{prepared===this.preparedModel&&this.emitPoint(di,i)}}
|
|
63
64
|
@focus=${()=>this.onMarkFocus(markIndex)}
|
|
64
|
-
@keydown=${e=>this.onPointKeyDown(e,di,i,markIndex)}
|
|
65
|
+
@keydown=${e=>{prepared===this.preparedModel&&this.onPointKeyDown(e,di,i,markIndex)}}
|
|
65
66
|
>${this.chartSync.enabled?nothing:nativeSvgTitle(titleText)}</path>
|
|
66
67
|
</g>
|
|
67
68
|
`:svg`
|
|
@@ -83,25 +84,25 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
83
84
|
data-mark-index=${markIndex}
|
|
84
85
|
data-dataset-index=${di}
|
|
85
86
|
data-index=${i}
|
|
86
|
-
@click=${()=>this.emitPoint(di,i)}
|
|
87
|
+
@click=${()=>{prepared===this.preparedModel&&this.emitPoint(di,i)}}
|
|
87
88
|
@focus=${()=>this.onMarkFocus(markIndex)}
|
|
88
|
-
@keydown=${e=>this.onPointKeyDown(e,di,i,markIndex)}
|
|
89
|
+
@keydown=${e=>{prepared===this.preparedModel&&this.onPointKeyDown(e,di,i,markIndex)}}
|
|
89
90
|
>${this.chartSync.enabled?nothing:nativeSvgTitle(titleText)}</rect>
|
|
90
91
|
</g>
|
|
91
|
-
`)})}return bars}renderLines(plotX,plotY,plotW,plotH,lo,hi,recordSample,selectedIndices){const n=this.recordCount(),xFor=i=>plotX+(n>1?i/(n-1)*plotW:plotW/2),yFor=v=>plotY+plotH-this.valueFraction(v,lo,hi)*plotH,markIndexes=this.markIndexMap(),activeMarkIndex=this.normalizedMarkIndex(),numberFormat=getNumberFormat(this.effectiveLocale),hitPoints=[];return recordSample.seriesIndexes.forEach(datasetIndex=>{const series=this.
|
|
92
|
+
`)})}return bars}renderLines(plotX,plotY,plotW,plotH,lo,hi,recordSample,selectedIndices){const n=this.recordCount(),prepared=this.preparedModel,xFor=(i,datasetIndex)=>prepared?.kind==="series"?this.preparedX(datasetIndex,i,plotX,plotW):plotX+(n>1?i/(n-1)*plotW:plotW/2),yFor=v=>plotY+plotH-this.valueFraction(v,lo,hi)*plotH,markIndexes=this.markIndexMap(),activeMarkIndex=this.normalizedMarkIndex(),numberFormat=getNumberFormat(this.effectiveLocale),hitPoints=[];return recordSample.seriesIndexes.forEach(datasetIndex=>{const series=this.displayDatasets[datasetIndex];series&&recordSample.rowIndexes.forEach(index=>{const value=series.data[index];value==null||!Number.isFinite(value)||hitPoints.push({datasetIndex,index,x:xFor(index,datasetIndex),y:yFor(value)})})}),recordSample.seriesIndexes.map(di=>{const s=this.displayDatasets[di];if(!s)return nothing;const color=this.colorFor(di,s);let d="",penDown=!1,previousSourceIndex=-1;recordSample.rowIndexes.forEach(i=>{const v=s.data[i];if(v==null||!Number.isFinite(v)){penDown=!1,previousSourceIndex=i;return}if(penDown&&previousSourceIndex>=0&&i>previousSourceIndex+1)for(let skipped=previousSourceIndex+1;skipped<i;skipped++){const candidate=s.data[skipped];if(candidate==null||!Number.isFinite(candidate)){penDown=!1;break}}d+=`${penDown?"L":"M"}${xFor(i,di)},${yFor(v)} `,penDown=!0,previousSourceIndex=i});const dots=recordSample.rowIndexes.map(i=>{const v=s.data[i];if(v==null||!Number.isFinite(v))return nothing;const label=this.datumLabel(di,i),titleText=this.resolvePointText(label,v,di,i)??this.localize("liteChartBarLabel",void 0,{series:s.label,label,value:formatChartValue(v,this.effectiveLocale,numberFormat)}),markIndex=markIndexes.get(`${di}:${i}`),selected=selectedIndices.has(i);return svg`
|
|
92
93
|
<g class="mark-hit-group" @pointermove=${()=>this.publishSyncMark({datasetIndex:di,index:i,label,value:v})}>
|
|
93
94
|
<circle
|
|
94
95
|
data-mark-hit-target="point"
|
|
95
96
|
aria-hidden="true"
|
|
96
|
-
cx=${xFor(i)}
|
|
97
|
+
cx=${xFor(i,di)}
|
|
97
98
|
cy=${yFor(v)}
|
|
98
99
|
r=${n>1?Math.min(12,plotW/(n-1)/2):12}
|
|
99
100
|
style="fill: transparent; pointer-events: all"
|
|
100
|
-
@click=${event=>this.emitNearestLinePoint(event,hitPoints,di,i)}
|
|
101
|
+
@click=${event=>{prepared===this.preparedModel&&this.emitNearestLinePoint(event,hitPoints,di,i)}}
|
|
101
102
|
></circle>
|
|
102
103
|
<circle
|
|
103
104
|
part="point"
|
|
104
|
-
cx=${xFor(i)}
|
|
105
|
+
cx=${xFor(i,di)}
|
|
105
106
|
cy=${yFor(v)}
|
|
106
107
|
r="4"
|
|
107
108
|
fill=${color}
|
|
@@ -114,9 +115,9 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
114
115
|
data-mark-index=${markIndex}
|
|
115
116
|
data-dataset-index=${di}
|
|
116
117
|
data-index=${i}
|
|
117
|
-
@click=${event=>this.emitNearestLinePoint(event,hitPoints,di,i)}
|
|
118
|
+
@click=${event=>{prepared===this.preparedModel&&this.emitNearestLinePoint(event,hitPoints,di,i)}}
|
|
118
119
|
@focus=${()=>this.onMarkFocus(markIndex)}
|
|
119
|
-
@keydown=${e=>this.onPointKeyDown(e,di,i,markIndex)}
|
|
120
|
+
@keydown=${e=>{prepared===this.preparedModel&&this.onPointKeyDown(e,di,i,markIndex)}}
|
|
120
121
|
>${this.chartSync.enabled?nothing:nativeSvgTitle(titleText)}</circle>
|
|
121
122
|
</g>
|
|
122
123
|
`});return svg`<path
|
|
@@ -124,7 +125,7 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
124
125
|
d=${d.trim()}
|
|
125
126
|
stroke=${color}
|
|
126
127
|
stroke-dasharray=${this.markDash(di)}
|
|
127
|
-
></path>${dots}`})}render(){return this.renderChart()}resolvedValueAxisGutter(ticks,measuredWidth){if(typeof this.valueAxisGutter=="number")return finiteRange(this.valueAxisGutter,PAD_LEFT,0,MAX_SCROLL_CONTENT_WIDTH);if(this.valueAxisGutter!=="auto"||ticks.length===0)return PAD_LEFT;let widest=0;for(const tick of ticks)widest=Math.max(widest,tick.label.length*APPROX_LABEL_CHARACTER_WIDTH);const requested=Math.ceil(widest)+VALUE_AXIS_TICK_OFFSET+AUTO_VALUE_AXIS_SAFETY_INSET,maximum=this.layout==="scroll"?MAX_AUTO_VALUE_AXIS_GUTTER:Math.max(PAD_LEFT,Math.min(MAX_AUTO_VALUE_AXIS_GUTTER,measuredWidth*MAX_AUTO_VALUE_AXIS_GUTTER_FRACTION));return finiteRange(requested,PAD_LEFT,PAD_LEFT,maximum)}widestEstimatedCategoryLabel(renderedIndexes){return widestEstimatedCategoryLabel(this.
|
|
128
|
+
></path>${dots}`})}render(){return this.refreshPreparedModel(),this.preparedInvalid?html`<div part="base"><p part="description">${this.localize("chartPreparedUnavailable")}</p></div>`:this.renderChart()}resolvedValueAxisGutter(ticks,measuredWidth){if(typeof this.valueAxisGutter=="number")return finiteRange(this.valueAxisGutter,PAD_LEFT,0,MAX_SCROLL_CONTENT_WIDTH);if(this.valueAxisGutter!=="auto"||ticks.length===0)return PAD_LEFT;let widest=0;for(const tick of ticks)widest=Math.max(widest,tick.label.length*APPROX_LABEL_CHARACTER_WIDTH);const requested=Math.ceil(widest)+VALUE_AXIS_TICK_OFFSET+AUTO_VALUE_AXIS_SAFETY_INSET,maximum=this.layout==="scroll"?MAX_AUTO_VALUE_AXIS_GUTTER:Math.max(PAD_LEFT,Math.min(MAX_AUTO_VALUE_AXIS_GUTTER,measuredWidth*MAX_AUTO_VALUE_AXIS_GUTTER_FRACTION));return finiteRange(requested,PAD_LEFT,PAD_LEFT,maximum)}widestEstimatedCategoryLabel(renderedIndexes){return widestEstimatedCategoryLabel(this.displayLabels,renderedIndexes,APPROX_LABEL_CHARACTER_WIDTH)}visibleLabelIndexes(n,plotW,renderedIndexes,tickX){if(this.maxLabels==null)return;let estimatedWidth,positions;return this.maxLabels==="auto"&&tickX&&n>1&&(estimatedWidth=this.widestEstimatedCategoryLabel(renderedIndexes),estimatedWidth>0&&(positions=renderedIndexes.map(tickX))),visibleCategoryLabelIndexes(n,plotW,renderedIndexes,this.displayLabels,this.maxLabels,positions,CATEGORY_LABEL_SELECTION_BOUNDS,estimatedWidth)}fixedBarSlotWidth(n){const requested=typeof this.barSlotWidth=="number"?finiteNumber(this.barSlotWidth,0):0;if(requested<=0)return;const maxSlot=n>0?MAX_SCROLL_CONTENT_WIDTH/n:MAX_SCROLL_CONTENT_WIDTH;return finiteRange(requested,0,0,maxSlot)}displayCategoryLabel(label,availableWidth){const maxCharacters=Math.max(1,Math.floor(availableWidth/APPROX_LABEL_CHARACTER_WIDTH));return label.length<=maxCharacters?label:maxCharacters===1?"…":`${label.slice(0,maxCharacters-1)}…`}renderChart(){const direction=this.effectiveDirection==="rtl"?"rtl":"ltr",n=this.recordCount(),recordSample=this.recordSample(),scrollCount=recordSample.rowIndexes.length,awaitingFitMeasurement=this.awaitingFitMeasurement(),h=finiteRange(this.plotHeight||200,200,0,MAX_SCROLL_CONTENT_WIDTH),measuredWidth=finiteRange(this.plotWidth||400,400,0,MAX_SCROLL_CONTENT_WIDTH),{lo,hi,ticks}=this.domain(),formattedTicks=awaitingFitMeasurement||this.withoutValueAxis?[]:ticks.map(value=>({value,label:this.formatValueAxisTick(value)})),axisGutter=this.resolvedValueAxisGutter(formattedTicks,measuredWidth)+(this.yLabel?AXIS_TITLE_SPACE:0),rtl=this.effectiveDirection==="rtl",padBottom=PAD_BOTTOM+(this.xLabel?AXIS_TITLE_SPACE:0),plotX=rtl?PAD_RIGHT:axisGutter,plotY=PAD_TOP,plotH=Math.max(0,h-plotY-padBottom);this.syncPlot={y:plotY,height:plotH};let w,plotW,slot,fixedSlot;if(this.layout==="scroll"){const maxSlot=scrollCount>0?MAX_SCROLL_CONTENT_WIDTH/scrollCount:MAX_SCROLL_CONTENT_WIDTH;slot=finiteRange(this.barWidth,32,0,maxSlot),plotW=scrollCount*slot,w=axisGutter+plotW+PAD_RIGHT}else w=measuredWidth,plotW=Math.max(0,w-axisGutter-PAD_RIGHT),fixedSlot=this.preparedModel?.kind==="series"?void 0:this.fixedBarSlotWidth(n),slot=fixedSlot??(n>0?plotW/n:0);const selectedIndices=new Set,renderedRows=new Set(recordSample.rowIndexes);for(let index=0;index<this.selectedIndices.length;index++){const candidate=this.selectedIndices[index];typeof candidate=="number"&&Number.isInteger(candidate)&&renderedRows.has(candidate)&&selectedIndices.add(candidate)}const barOrigins=this.effectiveType==="bar"&&!awaitingFitMeasurement?new Map(recordSample.rowIndexes.map((index,ordinal)=>{const fallback=plotX+(this.layout==="scroll"?ordinal:index)*slot,candidate=this.preparedModel?.kind!=="series"&&typeof this.barX=="function"?this.barX(index):fallback;return[index,finiteRange(candidate,fallback,-MAX_SCROLL_CONTENT_WIDTH,MAX_SCROLL_CONTENT_WIDTH)]})):new Map,grid=awaitingFitMeasurement||this.withoutValueAxis?[]:this.renderGrid(plotX,plotY,plotW,plotH,formattedTicks,lo,hi),marks=awaitingFitMeasurement?[]:this.effectiveType==="bar"?this.renderBars(plotX,plotY,plotH,plotW,slot,lo,hi,barOrigins,recordSample,selectedIndices):this.renderLines(plotX,plotY,plotW,plotH,lo,hi,recordSample,selectedIndices),categoryLabelX=i=>this.effectiveType==="bar"&&n>0?(barOrigins.get(i)??plotX+i*slot)+slot/2:plotX+(n>1?i/(n-1)*plotW:plotW/2);if(typeof this.syncGroup=="string"&&this.syncGroup.trim()){for(const index of this.syncCategoryPositions.keys())renderedRows.has(index)||this.syncCategoryPositions.delete(index);for(const index of recordSample.rowIndexes)this.syncCategoryPositions.set(index,categoryLabelX(index))}else this.syncCategoryPositions.clear();const visibleLabelIndexes=this.visibleLabelIndexes(n,fixedSlot===void 0||this.effectiveType!=="bar"?plotW:n*slot,recordSample.rowIndexes,categoryLabelX),tickOverrides=new Map,renderedTickIndexes=[];for(const i of recordSample.rowIndexes){if(visibleLabelIndexes&&!visibleLabelIndexes.has(i)||this.preparedModel?.kind==="series")continue;const label=this.displayLabels[i]??"",override=this.axisLabelText?.(label,i);override!==null&&(tickOverrides.set(i,override),renderedTickIndexes.push(i))}const categoryLabelPitch=(renderedTickIndexes.length?n/renderedTickIndexes.length:1)*(this.effectiveType==="bar"?slot:n>1?plotW/(n-1):plotW),categoryLabelWidth=Math.max(0,categoryLabelPitch-BAR_CORNER_RADIUS),tickFullLabels=renderedTickIndexes.map(i=>{const override=tickOverrides.get(i);return typeof override=="string"?override:this.displayLabels[i]??""}),tickXs=renderedTickIndexes.map(categoryLabelX),categoryLabels=awaitingFitMeasurement?[]:renderedTickIndexes.map((i,position)=>{const fullLabel=tickFullLabels[position],x=tickXs[position],growth=categoryLabelGrowth(i,n),textAnchor=growth==="middle"?"middle":growth==="right"?rtl?"end":"start":rtl?"start":"end",labelExtent=sparseCategoryLabelExtent(tickFullLabels,tickXs,position,growth,categoryLabelPitch,categoryLabelWidth,BAR_CORNER_RADIUS,MAX_SCROLL_CONTENT_WIDTH),displayLabel=this.displayCategoryLabel(fullLabel,labelExtent);return svg`<text
|
|
128
129
|
part="axis-label"
|
|
129
130
|
x=${x}
|
|
130
131
|
y=${plotY+plotH+CATEGORY_LABEL_OFFSET}
|
|
@@ -132,7 +133,7 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
132
133
|
data-label-extent=${labelExtent}
|
|
133
134
|
data-full-label=${fullLabel}
|
|
134
135
|
aria-label=${displayLabel===fullLabel?nothing:fullLabel}
|
|
135
|
-
>${displayLabel}</text>`}),datasetLabels=recordSample.seriesIndexes.map(datasetIndex=>this.
|
|
136
|
+
>${displayLabel}</text>`}),datasetLabels=recordSample.seriesIndexes.map(datasetIndex=>this.displayDatasets[datasetIndex].label).filter(Boolean),chartLabel=this.hostAccessibleLabel??(this.label||(datasetLabels.length?getListFormat(this.effectiveLocale,{type:"conjunction"}).format(datasetLabels):"")||this.localize("chart")),marksForA11y=this.interactiveMarks(),showTableTotals=this.effectiveType==="bar"&&this.stacked&&this.tableTotals,dataTruncation=this.dataTruncationMessage(),inputLimit=this.inputLimitMessage(),hasCustomDataTable=this.hasCustomDataTable();return html`
|
|
136
137
|
<div
|
|
137
138
|
part="base"
|
|
138
139
|
data-legend-position=${this.withLegend?chartChromeLegendPlacement(this.legendPosition):nothing}
|
|
@@ -143,7 +144,7 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
143
144
|
style=${this.layout==="scroll"?`inline-size: ${w}px`:nothing}
|
|
144
145
|
role="group"
|
|
145
146
|
aria-label=${chartLabel}
|
|
146
|
-
aria-describedby=${this.
|
|
147
|
+
aria-describedby=${this.preparedDescription()?this.descriptionId:nothing}
|
|
147
148
|
tabindex=${!awaitingFitMeasurement&&marksForA11y.length?"-1":"0"}
|
|
148
149
|
>
|
|
149
150
|
${this.renderForcedColorPatterns()}
|
|
@@ -162,8 +163,13 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
162
163
|
${!awaitingFitMeasurement&&this.xLabel?svg`<text part="axis-title" aria-label=${this.xLabel} data-title-extent=${plotW} x=${plotX+plotW/2} y=${plotY+plotH+padBottom-2} text-anchor="middle">${this.xLabel}</text>`:nothing}
|
|
163
164
|
</svg>
|
|
164
165
|
<lr-live-region part="live-region"></lr-live-region>
|
|
165
|
-
${this.
|
|
166
|
-
${
|
|
166
|
+
${this.preparedDescription()?html`<p part="description" id=${this.descriptionId} class="sr-only">${this.preparedDescription()}</p>`:nothing}
|
|
167
|
+
${this.preparedPending?html`<p part="description">${this.localize("loading")}</p>`:nothing}
|
|
168
|
+
${this.preparedRequestFailed?html`<p part="description">${this.localize("chartPreparedUnavailable")}</p>`:nothing}
|
|
169
|
+
${inputLimit||dataTruncation?html`<div class="notices">
|
|
170
|
+
${inputLimit?html`<p part="limit">${inputLimit}</p>`:nothing}
|
|
171
|
+
${dataTruncation?html`<p part="data-truncation">${dataTruncation}</p>`:nothing}
|
|
172
|
+
</div>`:nothing}
|
|
167
173
|
${this.dataTableToggle?html`<button
|
|
168
174
|
part="data-table-toggle"
|
|
169
175
|
type="button"
|
|
@@ -179,12 +185,12 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
179
185
|
?data-visually-hidden=${!this.dataTableVisible}
|
|
180
186
|
>
|
|
181
187
|
<slot name="data-table" @slotchange=${()=>this.requestUpdate()}></slot>
|
|
182
|
-
${hasCustomDataTable?nothing:this.
|
|
188
|
+
${hasCustomDataTable?nothing:this.preparedModel?.kind!=="series"&&this.displayDatasets.length>1?html`<table part="table" class=${this.dataTableVisible?nothing:"sr-only"}>
|
|
183
189
|
<caption>${this.localize("chartData")}</caption>
|
|
184
190
|
<thead>
|
|
185
191
|
<tr>
|
|
186
192
|
<th scope="col">${this.localize("chartCategory")}</th>
|
|
187
|
-
${recordSample.seriesIndexes.map(datasetIndex=>{const series=this.
|
|
193
|
+
${recordSample.seriesIndexes.map(datasetIndex=>{const series=this.displayDatasets[datasetIndex];return html`<th scope="col">${isolateHtml(series.label||this.localize("chartSeriesLabel"),direction)}</th>`})}
|
|
188
194
|
${showTableTotals?html`<th scope="col">${this.localize("chartTotal")}</th>`:nothing}
|
|
189
195
|
</tr>
|
|
190
196
|
</thead>
|
|
@@ -200,7 +206,7 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
200
206
|
</ul>`}
|
|
201
207
|
</div>
|
|
202
208
|
${this.withLegend?html`<div part="legend">
|
|
203
|
-
${recordSample.seriesIndexes.map(i=>{const s=this.
|
|
209
|
+
${recordSample.seriesIndexes.map(i=>{const s=this.displayDatasets[i];return html`
|
|
204
210
|
<span part="legend-item">
|
|
205
211
|
<span
|
|
206
212
|
part="legend-swatch"
|
|
@@ -212,4 +218,4 @@ import{__decorate}from"tslib";import{LazyChartSyncController}from"./chart-sync-l
|
|
|
212
218
|
`})}
|
|
213
219
|
</div>`:nothing}
|
|
214
220
|
</div>
|
|
215
|
-
`}}__decorate([property({converter:{fromAttribute:value=>normalizeLiteChartType(value)}})],LyraLiteChart.prototype,"type",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"labels",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"datasets",null),__decorate([property({type:Boolean,attribute:"with-legend"})],LyraLiteChart.prototype,"withLegend",void 0),__decorate([property({attribute:"legend-position",converter:{fromAttribute:normalizeChartChromeLegendPosition}})],LyraLiteChart.prototype,"legendPosition",void 0),__decorate([property()],LyraLiteChart.prototype,"height",void 0),__decorate([property({attribute:"x-label"})],LyraLiteChart.prototype,"xLabel",void 0),__decorate([property({attribute:"y-label"})],LyraLiteChart.prototype,"yLabel",void 0),__decorate([property({type:Boolean,attribute:"without-zero-baseline"})],LyraLiteChart.prototype,"withoutZeroBaseline",void 0),__decorate([property({type:Boolean})],LyraLiteChart.prototype,"stacked",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"tickFormat",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"tableCellFormatter",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"formatter",void 0),__decorate([property({type:Boolean,attribute:"table-totals"})],LyraLiteChart.prototype,"tableTotals",void 0),__decorate([property({type:Boolean,attribute:"with-data-table"})],LyraLiteChart.prototype,"withDataTable",void 0),__decorate([property({type:Boolean,attribute:"data-table-toggle"})],LyraLiteChart.prototype,"dataTableToggle",void 0),__decorate([state()],LyraLiteChart.prototype,"dataTableExpandedOverride",void 0),__decorate([property({reflect:!0,converter:LITE_CHART_LAYOUT})],LyraLiteChart.prototype,"layout",null),__decorate([property({type:Number,attribute:"bar-width"})],LyraLiteChart.prototype,"barWidth",void 0),__decorate([property({type:Number,attribute:"bar-slot-width"})],LyraLiteChart.prototype,"barSlotWidth",void 0),__decorate([property({converter:autoNumberConverter,attribute:"max-labels"})],LyraLiteChart.prototype,"maxLabels",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"barX",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"pointText",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"legendText",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"axisLabelText",void 0),__decorate([property({type:Boolean,attribute:"rounded-bars"})],LyraLiteChart.prototype,"roundedBars",void 0),__decorate([property({type:Boolean,attribute:"skip-zero"})],LyraLiteChart.prototype,"skipZero",void 0),__decorate([property({converter:autoNumberConverter,attribute:"value-axis-gutter"})],LyraLiteChart.prototype,"valueAxisGutter",void 0),__decorate([property({type:Number,attribute:"bar-gap-ratio"})],LyraLiteChart.prototype,"barGapRatio",void 0),__decorate([property()],LyraLiteChart.prototype,"scale",void 0),__decorate([property({type:Boolean,attribute:"without-value-axis"})],LyraLiteChart.prototype,"withoutValueAxis",void 0),__decorate([property({type:Number,attribute:"min-bar-height"})],LyraLiteChart.prototype,"minBarHeight",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"selectedIndices",void 0),__decorate([property({attribute:"aria-label"})],LyraLiteChart.prototype,"hostAccessibleLabel",void 0),__decorate([property()],LyraLiteChart.prototype,"label",void 0),__decorate([property()],LyraLiteChart.prototype,"description",void 0),__decorate([state()],LyraLiteChart.prototype,"plotWidth",void 0),__decorate([state()],LyraLiteChart.prototype,"plotHeight",void 0),__decorate([state()],LyraLiteChart.prototype,"fitMeasurementAvailable",void 0),__decorate([
|
|
221
|
+
`}}__decorate([property({converter:{fromAttribute:value=>normalizeLiteChartType(value)}})],LyraLiteChart.prototype,"type",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"preparedData",null),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"labels",void 0),__decorate([property({type:Number,attribute:"max-records"})],LyraLiteChart.prototype,"maxRecords",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"datasets",null),__decorate([property({type:Boolean,attribute:"with-legend"})],LyraLiteChart.prototype,"withLegend",void 0),__decorate([property({attribute:"legend-position",converter:{fromAttribute:normalizeChartChromeLegendPosition}})],LyraLiteChart.prototype,"legendPosition",void 0),__decorate([property()],LyraLiteChart.prototype,"height",void 0),__decorate([property({attribute:"x-label"})],LyraLiteChart.prototype,"xLabel",void 0),__decorate([property({attribute:"y-label"})],LyraLiteChart.prototype,"yLabel",void 0),__decorate([property({type:Boolean,attribute:"without-zero-baseline"})],LyraLiteChart.prototype,"withoutZeroBaseline",void 0),__decorate([property({type:Boolean})],LyraLiteChart.prototype,"stacked",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"tickFormat",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"tableCellFormatter",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"formatter",void 0),__decorate([property({type:Boolean,attribute:"table-totals"})],LyraLiteChart.prototype,"tableTotals",void 0),__decorate([property({type:Boolean,attribute:"with-data-table"})],LyraLiteChart.prototype,"withDataTable",void 0),__decorate([property({type:Boolean,attribute:"data-table-toggle"})],LyraLiteChart.prototype,"dataTableToggle",void 0),__decorate([state()],LyraLiteChart.prototype,"dataTableExpandedOverride",void 0),__decorate([property({reflect:!0,converter:LITE_CHART_LAYOUT})],LyraLiteChart.prototype,"layout",null),__decorate([property({type:Number,attribute:"bar-width"})],LyraLiteChart.prototype,"barWidth",void 0),__decorate([property({type:Number,attribute:"bar-slot-width"})],LyraLiteChart.prototype,"barSlotWidth",void 0),__decorate([property({converter:autoNumberConverter,attribute:"max-labels"})],LyraLiteChart.prototype,"maxLabels",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"barX",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"pointText",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"legendText",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"axisLabelText",void 0),__decorate([property({type:Boolean,attribute:"rounded-bars"})],LyraLiteChart.prototype,"roundedBars",void 0),__decorate([property({type:Boolean,attribute:"skip-zero"})],LyraLiteChart.prototype,"skipZero",void 0),__decorate([property({converter:autoNumberConverter,attribute:"value-axis-gutter"})],LyraLiteChart.prototype,"valueAxisGutter",void 0),__decorate([property({type:Number,attribute:"bar-gap-ratio"})],LyraLiteChart.prototype,"barGapRatio",void 0),__decorate([property()],LyraLiteChart.prototype,"scale",void 0),__decorate([property({type:Boolean,attribute:"without-value-axis"})],LyraLiteChart.prototype,"withoutValueAxis",void 0),__decorate([property({type:Number,attribute:"min-bar-height"})],LyraLiteChart.prototype,"minBarHeight",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"selectedIndices",void 0),__decorate([property({attribute:"aria-label"})],LyraLiteChart.prototype,"hostAccessibleLabel",void 0),__decorate([property()],LyraLiteChart.prototype,"label",void 0),__decorate([property()],LyraLiteChart.prototype,"description",void 0),__decorate([state()],LyraLiteChart.prototype,"plotWidth",void 0),__decorate([state()],LyraLiteChart.prototype,"plotHeight",void 0),__decorate([state()],LyraLiteChart.prototype,"fitMeasurementAvailable",void 0),__decorate([query("svg")],LyraLiteChart.prototype,"svgEl",void 0),__decorate([query("lr-live-region")],LyraLiteChart.prototype,"liveRegion",void 0),__decorate([property({attribute:"sync-group"})],LyraLiteChart.prototype,"syncGroup",void 0);function formatTick(v,locale){return getNumberFormat(locale,{maximumFractionDigits:6}).format(Number(v.toFixed(6)))}export{LyraLiteChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{mediumContainerQuery}from"../../../internal/container-breakpoints.styles.js";import{forcedColorLegendSwatchStyles}from"./chart-forced-colors.js";const styles=css` :host { display: block; position: relative; inline-size: 100%; min-inline-size: 0; min-block-size: var(--lr-chart-height, var(--_lr-chart-height, var(--lr-size-280px))); block-size: auto; container-type: inline-size; contain-intrinsic-inline-size: var(--lr-size-20rem); --_lr-chart-grid-color: var(--lr-color-border-subtle); --_lr-chart-tick-color: var(--lr-color-text-quiet); --_lr-chart-tick-font-size: var(--lr-font-size-2xs); --_lr-chart-legend-color: var(--lr-color-text); --_lr-chart-tooltip-bg: var(--lr-color-surface); --_lr-chart-tooltip-color: var(--lr-color-text); } [part='base'] { position: relative; inline-size: 100%; block-size: 100%; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'plot' 'notice' 'legend' 'table'; gap: var(--lr-space-xs); } :host([layout='scroll']) [part='base'] { overflow-x: auto; overflow-y: hidden; } svg { grid-area: plot; display: block; inline-size: 100%; block-size: var(--lr-chart-height, var(--_lr-chart-height, var(--lr-size-280px))); min-block-size: var(--lr-icon-button-size); overflow: hidden; } [part='grid-line'] { stroke: var(--lr-chart-grid-color, var(--_lr-chart-grid-color)); stroke-width: var(--lr-border-width-thin); } [part='axis-label'] { fill: var(--lr-chart-tick-color, var(--_lr-chart-tick-color)); font-size: var(--lr-chart-tick-font-size, var(--_lr-chart-tick-font-size)); font-family: var(--lr-font); } [part='axis-title'] { fill: var(--lr-chart-tick-color, var(--_lr-chart-tick-color)); font-size: var(--lr-font-size-xs); font-weight: var(--lr-font-weight-semibold); font-family: var(--lr-font); } [part='axis-label'], [part='axis-title'] { unicode-bidi: plaintext; } [part='bar'] { cursor: pointer; } [data-mark-hit-target] { cursor: pointer; } :where([part='bar']):hover, :where([part='point']):hover, :where(.mark-hit-group):hover [part='bar'], :where(.mark-hit-group):hover [part='point'] { fill: color-mix(in oklab, currentColor, var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } :where([part='bar']):active, :where([part='point']):active, :where(.mark-hit-group):active [part='bar'], :where(.mark-hit-group):active [part='point'] { fill: color-mix(in oklab, currentColor, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='bar'][data-selected], [part='point'][data-selected] { stroke: var(--lr-lite-chart-selected-outline-color, var(--lr-color-brand)); stroke-width: var(--lr-lite-chart-selected-outline-width, var(--lr-border-width-medium)); } [part='bar']:focus-visible, [part='point']:focus-visible { ${focusRing} } :where(.mark-hit-group):has([part='bar']:focus-visible, [part='point']:focus-visible) [data-mark-hit-target] { stroke: var(--lr-focus-ring-color); stroke-width: var(--lr-focus-ring-width); } [part='line'] { fill: none; stroke-width: var(--lr-border-width-medium); } [part='bar'], [part='line'], [part='point'], pattern { forced-color-adjust: none; } [part='point'] { cursor: pointer; } [part='legend'] { grid-area: legend; display: flex; flex-wrap: wrap; gap: var(--lr-space-s); justify-content: center; flex: 0 0 auto; } [part='legend-item'] { display: inline-flex; align-items: center; min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; gap: var(--lr-size-0-35em); font-size: var(--lr-size-0-8rem); color: var(--lr-chart-legend-color, var(--_lr-chart-legend-color)); } [part='legend-swatch'] { inline-size: var(--lr-size-0-7em); block-size: var(--lr-size-0-7em); border-radius: var(--lr-size-2px); flex: 0 0 auto; } ${forcedColorLegendSwatchStyles} [part='legend-text'] { margin-inline-start: var(--lr-space-2xs); color: var(--lr-chart-tick-color, var(--_lr-chart-tick-color)); } [part='data-table'][data-visually-hidden] { position: absolute; inline-size: var(--lr-size-1px); block-size: var(--lr-size-1px); overflow: clip; clip-path: inset(50%); white-space: nowrap; } [part='data-table'] { grid-area: table; min-inline-size: 0; max-inline-size: 100%; overflow-x: auto; overflow-y: hidden; } [part='data-truncation'] {
|
|
1
|
+
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{mediumContainerQuery}from"../../../internal/container-breakpoints.styles.js";import{forcedColorLegendSwatchStyles}from"./chart-forced-colors.js";const styles=css` :host { display: block; position: relative; inline-size: 100%; min-inline-size: 0; min-block-size: var(--lr-chart-height, var(--_lr-chart-height, var(--lr-size-280px))); block-size: auto; container-type: inline-size; contain-intrinsic-inline-size: var(--lr-size-20rem); --_lr-chart-grid-color: var(--lr-color-border-subtle); --_lr-chart-tick-color: var(--lr-color-text-quiet); --_lr-chart-tick-font-size: var(--lr-font-size-2xs); --_lr-chart-legend-color: var(--lr-color-text); --_lr-chart-tooltip-bg: var(--lr-color-surface); --_lr-chart-tooltip-color: var(--lr-color-text); } [part='base'] { position: relative; inline-size: 100%; block-size: 100%; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'plot' 'notice' 'legend' 'table'; gap: var(--lr-space-xs); } :host([layout='scroll']) [part='base'] { overflow-x: auto; overflow-y: hidden; } svg { grid-area: plot; display: block; inline-size: 100%; block-size: var(--lr-chart-height, var(--_lr-chart-height, var(--lr-size-280px))); min-block-size: var(--lr-icon-button-size); overflow: hidden; } [part='grid-line'] { stroke: var(--lr-chart-grid-color, var(--_lr-chart-grid-color)); stroke-width: var(--lr-border-width-thin); } [part='axis-label'] { fill: var(--lr-chart-tick-color, var(--_lr-chart-tick-color)); font-size: var(--lr-chart-tick-font-size, var(--_lr-chart-tick-font-size)); font-family: var(--lr-font); } [part='axis-title'] { fill: var(--lr-chart-tick-color, var(--_lr-chart-tick-color)); font-size: var(--lr-font-size-xs); font-weight: var(--lr-font-weight-semibold); font-family: var(--lr-font); } [part='axis-label'], [part='axis-title'] { unicode-bidi: plaintext; } [part='bar'] { cursor: pointer; } [data-mark-hit-target] { cursor: pointer; } :where([part='bar']):hover, :where([part='point']):hover, :where(.mark-hit-group):hover [part='bar'], :where(.mark-hit-group):hover [part='point'] { fill: color-mix(in oklab, currentColor, var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } :where([part='bar']):active, :where([part='point']):active, :where(.mark-hit-group):active [part='bar'], :where(.mark-hit-group):active [part='point'] { fill: color-mix(in oklab, currentColor, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='bar'][data-selected], [part='point'][data-selected] { stroke: var(--lr-lite-chart-selected-outline-color, var(--lr-color-brand)); stroke-width: var(--lr-lite-chart-selected-outline-width, var(--lr-border-width-medium)); } [part='bar']:focus-visible, [part='point']:focus-visible { ${focusRing} } :where(.mark-hit-group):has([part='bar']:focus-visible, [part='point']:focus-visible) [data-mark-hit-target] { stroke: var(--lr-focus-ring-color); stroke-width: var(--lr-focus-ring-width); } [part='line'] { fill: none; stroke-width: var(--lr-border-width-medium); } [part='bar'], [part='line'], [part='point'], pattern { forced-color-adjust: none; } [part='point'] { cursor: pointer; } [part='legend'] { grid-area: legend; display: flex; flex-wrap: wrap; gap: var(--lr-space-s); justify-content: center; flex: 0 0 auto; } [part='legend-item'] { display: inline-flex; align-items: center; min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; gap: var(--lr-size-0-35em); font-size: var(--lr-size-0-8rem); color: var(--lr-chart-legend-color, var(--_lr-chart-legend-color)); } [part='legend-swatch'] { inline-size: var(--lr-size-0-7em); block-size: var(--lr-size-0-7em); border-radius: var(--lr-size-2px); flex: 0 0 auto; } ${forcedColorLegendSwatchStyles} [part='legend-text'] { margin-inline-start: var(--lr-space-2xs); color: var(--lr-chart-tick-color, var(--_lr-chart-tick-color)); } [part='data-table'][data-visually-hidden] { position: absolute; inline-size: var(--lr-size-1px); block-size: var(--lr-size-1px); overflow: clip; clip-path: inset(50%); white-space: nowrap; } [part='data-table'] { grid-area: table; min-inline-size: 0; max-inline-size: 100%; overflow-x: auto; overflow-y: hidden; } .notices { grid-area: notice; } [part='limit'], [part='data-truncation'] { margin: 0; padding: var(--lr-space-xs); color: var(--lr-color-warning); font-size: var(--lr-font-size-sm); overflow-wrap: anywhere; } [part='base']:where([data-legend-position='top']) { grid-template-areas: 'legend' 'plot' 'notice' 'table'; } [part='base']:where([data-legend-position='inline-start']) { grid-template-areas: 'legend plot' 'notice notice' 'table table'; grid-template-columns: minmax(0, min(33cqi, var(--lr-chart-legend-side-max, var(--lr-size-15rem)))) minmax(0, 1fr); } [part='base']:where([data-legend-position='inline-end']) { grid-template-areas: 'plot legend' 'notice notice' 'table table'; grid-template-columns: minmax(0, 1fr) minmax(0, min(33cqi, var(--lr-chart-legend-side-max, var(--lr-size-15rem)))); } @container ${mediumContainerQuery} { [part='base']:where([data-legend-position='inline-start']), [part='base']:where([data-legend-position='inline-end']) { grid-template-areas: 'plot' 'notice' 'legend' 'table'; grid-template-columns: minmax(0, 1fr); } } [part='base']:where([data-table-toggle]) { grid-template-areas: 'plot' 'notice' 'legend' 'table-toggle' 'table'; } [part='base']:where([data-table-toggle][data-legend-position='top']) { grid-template-areas: 'legend' 'plot' 'notice' 'table-toggle' 'table'; } [part='base']:where([data-table-toggle][data-legend-position='inline-start']) { grid-template-areas: 'legend plot' 'notice notice' 'table-toggle table-toggle' 'table table'; } [part='base']:where([data-table-toggle][data-legend-position='inline-end']) { grid-template-areas: 'plot legend' 'notice notice' 'table-toggle table-toggle' 'table table'; } @container ${mediumContainerQuery} { [part='base']:where([data-table-toggle][data-legend-position='inline-start']), [part='base']:where([data-table-toggle][data-legend-position='inline-end']) { grid-template-areas: 'plot' 'notice' 'legend' 'table-toggle' 'table'; } } [part='data-table-toggle'] { grid-area: table-toggle; align-self: flex-start; font: inherit; font-size: var(--lr-font-size-xs); ${iconHitTarget} padding: var(--lr-size-0-15rem) var(--lr-size-0-5rem); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text); max-inline-size: 100%; white-space: normal; overflow-wrap: break-word; cursor: pointer; } [part='data-table-toggle']:hover { background: var( --lr-lite-chart-data-table-toggle-hover-bg, var(--lr-chart-data-table-toggle-hover-bg, var(--lr-color-brand-quiet)) ); } [part='data-table-toggle']:active { background: var( --lr-lite-chart-data-table-toggle-active-bg, var( --lr-chart-data-table-toggle-active-bg, color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)) ) ); } [part='data-table-toggle']:focus-visible { outline: var(--lr-focus-ring); outline-offset: var(--lr-focus-ring-offset); } `;export{styles};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import{LyraChart,type LyraChartType}from'./chart.class.js';
|
|
1
|
+
export type{LyraChartPreparedData,LyraChartSourcePointSelectDetail,LyraChartSourceCategorySelectDetail,LyraPreparedSeriesData,LyraPreparedCategoryData,LyraSeriesPointRef}from'./chart.class.js';import{LyraChart,type LyraChartType}from'./chart.class.js';
|
|
2
2
|
/**
|
|
3
3
|
* `<lr-pie-chart>` — `<lr-chart>` with a `"pie"` default and the mirrored writable type. Single-series:
|
|
4
4
|
* one `LyraChartSeries` with `data: number[]` and `color: string[]` as the slice palette.
|
|
5
5
|
*
|
|
6
|
+
* Prepared-data compatibility follows the current writable type: line accepts series, bar
|
|
7
|
+
* accepts series/categories, radial category types accept categories. Spatial types require
|
|
8
|
+
* their own source route and reject these prepared kinds.
|
|
9
|
+
*
|
|
6
10
|
* @customElement lr-pie-chart
|
|
7
11
|
* @status stable
|
|
8
12
|
* @since 4.0.0
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import{LyraChart,type LyraChartType}from'./chart.class.js';
|
|
1
|
+
export type{LyraChartPreparedData,LyraChartSourcePointSelectDetail,LyraChartSourceCategorySelectDetail,LyraPreparedSeriesData,LyraPreparedCategoryData,LyraSeriesPointRef}from'./chart.class.js';import{LyraChart,type LyraChartType}from'./chart.class.js';
|
|
2
2
|
/**
|
|
3
3
|
* `<lr-polar-area-chart>` — `<lr-chart>` with a `"polarArea"` default and the mirrored writable type.
|
|
4
4
|
*
|
|
5
|
+
* Prepared-data compatibility follows the current writable type: line accepts series, bar
|
|
6
|
+
* accepts series/categories, radial category types accept categories. Spatial types require
|
|
7
|
+
* their own source route and reject these prepared kinds.
|
|
8
|
+
*
|
|
5
9
|
* @customElement lr-polar-area-chart
|
|
6
10
|
* @status stable
|
|
7
11
|
* @since 4.0.0
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import{LyraChart,type LyraChartType}from'./chart.class.js';
|
|
1
|
+
export type{LyraChartPreparedData,LyraChartSourcePointSelectDetail,LyraChartSourceCategorySelectDetail,LyraPreparedSeriesData,LyraPreparedCategoryData,LyraSeriesPointRef}from'./chart.class.js';import{LyraChart,type LyraChartType}from'./chart.class.js';
|
|
2
2
|
/**
|
|
3
3
|
* `<lr-radar-chart>` — `<lr-chart>` with a `"radar"` default and the mirrored writable type.
|
|
4
4
|
*
|
|
5
|
+
* Prepared-data compatibility follows the current writable type: line accepts series, bar
|
|
6
|
+
* accepts series/categories, radial category types accept categories. Spatial types require
|
|
7
|
+
* their own source route and reject these prepared kinds.
|
|
8
|
+
*
|
|
5
9
|
* @customElement lr-radar-chart
|
|
6
10
|
* @status stable
|
|
7
11
|
* @since 4.0.0
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import{LyraChart,type LyraChartType}from'./chart.class.js';
|
|
1
|
+
export type{LyraSpatialBounds,LyraSpatialChartSource,LyraSpatialChartPoint,LyraSpatialChartSeries,LyraChartSpatialPointSelectDetail,LyraSpatialBinSelectDetail}from'./chart.class.js';export type{LyraChartPreparedData,LyraChartSourcePointSelectDetail,LyraChartSourceCategorySelectDetail,LyraPreparedSeriesData,LyraPreparedCategoryData,LyraSeriesPointRef}from'./chart.class.js';import{LyraChart,type LyraChartType}from'./chart.class.js';
|
|
2
2
|
/**
|
|
3
3
|
* `<lr-scatter-chart>` — `<lr-chart>` with a `"scatter"` default and the mirrored writable type. Feed
|
|
4
4
|
* points via `LyraChartSeries.points`.
|
|
5
5
|
*
|
|
6
|
+
* Prepared-data compatibility follows the current writable type: line accepts series, bar
|
|
7
|
+
* accepts series/categories, radial category types accept categories. Spatial types require
|
|
8
|
+
* the spatial source route with bounded density and exact original point identity.
|
|
9
|
+
*
|
|
6
10
|
* @customElement lr-scatter-chart
|
|
7
11
|
* @status stable
|
|
8
12
|
* @since 4.0.0
|