@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,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{snapshotPublicCollection}from"../../../internal/collection-snapshot.js";import{html,nothing,svg}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{srOnly}from"../../../internal/a11y.js";import{isRtl}from"../../../internal/rtl.js";import{finiteCount}from"../../../internal/numbers.js";import{resolveCssTokenLength}from"../../../internal/css-token-length.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{decimateMindMapLayout,layoutMindMap}from"./mind-map-layout.js";import{styles}from"./mind-map.styles.js";import{LYRA_DEFAULT_mindMapCollapsed,LYRA_DEFAULT_mindMapExpanded,LYRA_DEFAULT_mindMapLabel,LYRA_DEFAULT_mindMapLeafStatus,LYRA_DEFAULT_mindMapNodeLimit,LYRA_DEFAULT_mindMapTopicStatus}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_noData}from"../../../internal/default-strings/shared.generated.js";const DEFAULT_RING_GAP_PX=96,MAX_RENDERED_MIND_MAP_NODES=500,TOPIC_COPY_LIMIT=5e4;function copyTopicTree(roots){const top=[],copies=[],queue=(Array.isArray(roots)?roots:[]).map(root=>[root,top]);for(let i=0;i<queue.length&&copies.length<TOPIC_COPY_LIMIT;i++){const[topic,siblings]=queue[i];if(topic===null||typeof topic!="object")continue;const{id,label,children}=topic,copy=Array.isArray(children)?{id,label,children:[]}:{id,label};copies.push(copy),siblings.push(copy);for(const child of copy.children?children:[])queue.length<TOPIC_COPY_LIMIT&&queue.push([child,copy.children])}for(const copy of copies)Object.freeze(Object.freeze(copy).children);return Object.freeze(top)}const NAV_KEYS=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","Enter"," "]);class LyraMindMap extends LyraElement{constructor(){super(...arguments),this._topics=Object.freeze([]),this.topicsSource=this._topics,this.expandDepth=1,this.expandedOverrides=new Map,this.focusedId=null,this.liveText="",this.cachedLayout={placed:[],links:[],width:0,height:0,centerX:0,centerY:0},this.totalTopicCount=0,this.topicsTruncated=!1,this.ownerRealmGeneration=0,this.observedSize="",this.layoutInvalidated=!0,this.layoutContext="",this.onKeyDown=e=>{const placed=this.cachedLayout.placed;if(placed.length===0||!NAV_KEYS.has(e.key))return;if(e.preventDefault(),this.focusedId===null){this.focusNodeById(placed[0].id);return}const current=placed.find(p=>p.id===this.focusedId);if(!current)return;if(e.key==="Enter"||e.key===" "){e.repeat||this.activate(current);return}if(e.key==="ArrowUp"){current.parentId&&this.focusNodeById(current.parentId);return}if(e.key==="ArrowDown"){if(!current.hasChildren)return;this.isExpanded(current.id,current.depth)||(this.toggle(current,!1),this.relayout());const child=this.childrenOf(current.id)[0];child&&this.focusNodeById(child.id);return}const rtl=isRtl(this),forwardKey=rtl?"ArrowLeft":"ArrowRight",backwardKey=rtl?"ArrowRight":"ArrowLeft";if(e.key===forwardKey||e.key===backwardKey||e.key==="Home"||e.key==="End"){const siblings=this.siblingsOf(current),index=siblings.findIndex(s=>s.id===current.id);let next=index;e.key===forwardKey?next=Math.min(siblings.length-1,index+1):e.key===backwardKey?next=Math.max(0,index-1):e.key==="Home"?next=0:next=siblings.length-1;const target=siblings[next];target&&this.focusNodeById(target.id)}},this.onFocusIn=()=>{if(this.focusedId!==null)return;const first=this.cachedLayout.placed[0];first&&(this.focusedId=first.id)}}static{this.defaultStrings={...super.defaultStrings,mindMapCollapsed:LYRA_DEFAULT_mindMapCollapsed,mindMapExpanded:LYRA_DEFAULT_mindMapExpanded,mindMapLabel:LYRA_DEFAULT_mindMapLabel,mindMapLeafStatus:LYRA_DEFAULT_mindMapLeafStatus,mindMapNodeLimit:LYRA_DEFAULT_mindMapNodeLimit,mindMapTopicStatus:LYRA_DEFAULT_mindMapTopicStatus,noData:LYRA_DEFAULT_noData}}static{this.styles=[LyraElement.styles,styles,srOnly]}static get observedAttributes(){return[...new Set([...super.observedAttributes,"dir","lang"])]}get topics(){return this._topics}set topics(value){if(Object.is(value,this.topicsSource)||Object.is(value,this._topics))return;const previous=this._topics;let truncated=!1;const snapshot=snapshotPublicCollection(value,this.ownerDocument?.defaultView,{onTruncate:()=>truncated=!0});this.topicsSource=value,this._topics=truncated?copyTopicTree(value):snapshot,this.requestUpdate("topics",previous)}connectedCallback(){super.connectedCallback(),this.announcementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.layoutInvalidated=!0,this.armResizeObserver()}armResizeObserver(){const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!this.isConnected||!ownerWindow?.ResizeObserver||this.resizeObserver&&this.resizeObserverDocument===ownerDocument)return;this.resetResizeWork();const generation=this.ownerRealmGeneration,observer=new ownerWindow.ResizeObserver(entries=>{if(this.resizeObserver!==observer||this.resizeObserverDocument!==ownerDocument||this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument)return;const rect=entries[0]?.contentRect,size=rect?`${rect.width}:${rect.height}`:"";if(size&&size===this.observedSize)return;this.observedSize=size,this.resizeRafId!=null&&this.resizeRafOwner?.cancelAnimationFrame(this.resizeRafId);const handle=ownerWindow.requestAnimationFrame(()=>{this.resizeRafId!==handle||this.resizeRafOwner!==ownerWindow||this.resizeRafDocument!==ownerDocument||this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.resizeRafId=void 0,this.resizeRafOwner=void 0,this.resizeRafDocument=void 0,this.layoutInvalidated=!0,this.requestUpdate())});this.resizeRafId=handle,this.resizeRafOwner=ownerWindow,this.resizeRafDocument=ownerDocument});this.resizeObserver=observer,this.resizeObserverDocument=ownerDocument,observer.observe(this)}disconnectedCallback(){this.resetResizeWork(),this.announcementSink?.release(),this.announcementSink=void 0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetResizeWork(),this.announcementSink?.release(),this.announcementSink=void 0}resetResizeWork(){this.ownerRealmGeneration+=1,this.resizeRafId!=null&&this.resizeRafOwner?.cancelAnimationFrame(this.resizeRafId),this.resizeRafId=void 0,this.resizeRafOwner=void 0,this.resizeRafDocument=void 0,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeObserverDocument=void 0,this.observedSize=""}attributeChangedCallback(name,oldValue,value){super.attributeChangedCallback(name,oldValue,value),(name==="dir"||name==="lang")&&oldValue!==value&&(this.layoutInvalidated=!0,this.requestUpdate())}get effectiveExpandDepth(){return finiteCount(this.expandDepth,1)}isExpanded(id,depth){return this.expandedOverrides.get(id)??depth<this.effectiveExpandDepth}ringGapPx(){const hostStyle=this.ownerDocument.defaultView?.getComputedStyle(this)??this.style,raw=hostStyle.getPropertyValue("--lr-mind-map-ring-gap").trim()||hostStyle.getPropertyValue("--_lr-mind-map-ring-gap").trim();return resolveCssTokenLength(raw,{host:this})??DEFAULT_RING_GAP_PX}relayout(){const hubLabel=this.label==null?this.localize("mindMapLabel"):this.label,fullLayout=layoutMindMap(this.topics,hubLabel,{ringGap:this.ringGapPx(),rtl:isRtl(this),isExpanded:(id,depth)=>this.isExpanded(id,depth)}),decimated=decimateMindMapLayout(fullLayout.placed,fullLayout.links,MAX_RENDERED_MIND_MAP_NODES);this.totalTopicCount=decimated.totalCount,this.topicsTruncated=decimated.truncated,this.cachedLayout={...fullLayout,placed:[...decimated.placed],links:[...decimated.links]}}willUpdate(changed){super.willUpdate(changed);const context=`${this.label==null?this.localize("mindMapLabel"):this.label}\0${isRtl(this)?"rtl":"ltr"}`,structuralChange=changed.has("topics")||changed.has("expandDepth")||changed.has("expandedOverrides")||changed.has("label")||changed.has("strings")||changed.has("locale");(this.layoutInvalidated||structuralChange||context!==this.layoutContext)&&(this.relayout(),this.layoutContext=context,this.layoutInvalidated=!1,this.focusedId&&!this.cachedLayout.placed.some(topic=>topic.id===this.focusedId)&&(this.focusedId=this.cachedLayout.placed[0]?.id??null))}setAnnouncement(text){this.liveText=text,this.announcementSink?.announce(text)}toggle(node,announce=!0){const expanded=!this.isExpanded(node.id,node.depth),next=new Map(this.expandedOverrides);next.set(node.id,expanded),this.expandedOverrides=next,this.emit("lr-topic-toggle",{topicId:node.id,expanded}),announce&&this.setAnnouncement(this.localize(expanded?"mindMapExpanded":"mindMapCollapsed",void 0,{label:node.label}))}activate(node){node.hasChildren?this.toggle(node):this.emit("lr-topic-select",{topicId:node.id})}siblingsOf(node){return this.cachedLayout.placed.filter(p=>p.parentId===node.parentId)}childrenOf(id){return this.cachedLayout.placed.filter(p=>p.parentId===id)}announce(node){const numberFormat=getNumberFormat(this.effectiveLocale);this.setAnnouncement(node.hasChildren?this.localize("mindMapTopicStatus",void 0,{label:node.label,level:numberFormat.format(node.depth+1),count:numberFormat.format(this.childrenOf(node.id).length)}):this.localize("mindMapLeafStatus",void 0,{label:node.label,level:numberFormat.format(node.depth+1)}))}focusNodeById(id){this.focusedId=id;const node=this.cachedLayout.placed.find(p=>p.id===id);node&&this.announce(node)}onNodeClick(node){this.focusedId=node.id,this.svgEl?.focus(),node.hasChildren||this.announce(node),this.activate(node)}connectorControlPoint(from,to){const layout=this.cachedLayout,parentR=Math.hypot(from.x-layout.centerX,from.y-layout.centerY),dir=isRtl(this)?-1:1;return{x:layout.centerX+dir*parentR*Math.sin(to.angle),y:layout.centerY-parentR*Math.cos(to.angle)}}renderSemanticNode(node,childrenByParent){const children=childrenByParent.get(node.id)??[];return html`
|
|
1
|
+
import{__decorate}from"tslib";import{HierarchySourceController,hierarchyField,hierarchyKey,hierarchyText}from"../../../internal/hierarchy-source-controller.js";import{hierarchySourceView}from"../../../internal/hierarchy-source-view.js";import{hierarchySourceStyles}from"../../../internal/hierarchy-source-view.styles.js";import{snapshotMindMapTopics}from"./mind-map-model.js";import{html,nothing,svg}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{srOnly}from"../../../internal/a11y.js";import{isRtl}from"../../../internal/rtl.js";import{finiteCount}from"../../../internal/numbers.js";import{resolveCssTokenLength}from"../../../internal/css-token-length.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{decimateMindMapLayout,createMindMapLayout}from"./mind-map-layout.js";import{styles}from"./mind-map.styles.js";import{LYRA_DEFAULT_mindMapCollapsed,LYRA_DEFAULT_mindMapExpanded,LYRA_DEFAULT_mindMapInputLimit,LYRA_DEFAULT_mindMapLabel,LYRA_DEFAULT_mindMapLeafStatus,LYRA_DEFAULT_mindMapNodeLimit,LYRA_DEFAULT_mindMapTopicStatus}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_expand,LYRA_DEFAULT_loading,LYRA_DEFAULT_noData,LYRA_DEFAULT_retry,LYRA_DEFAULT_treeSourceError,LYRA_DEFAULT_treeSourceSummary}from"../../../internal/default-strings/shared.generated.js";const DEFAULT_RING_GAP_PX=96,MAX_RENDERED_MIND_MAP_NODES=500,NAV_KEYS=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","Enter"," "]);class LyraMindMap extends LyraElement{constructor(){super(...arguments),this.sourceVersion=0,this.sourceViewAuthority=new WeakMap,this.sourcePaint=0,this.sourceDiagramScheduled=!1,this.sourceDiagramRows=new Map,this.sourceDiagramCurrent=()=>!1,this.sourceControl=new HierarchySourceController(this,{normalize:(value,key)=>{const current=this.sourceAuthority(),field=name=>{if(!current())throw new Error("Topic source changed");const result=hierarchyField(value,name);if(!current())throw new Error("Topic source changed");return result},id=hierarchyKey(field("id"));if(id!==key)throw new TypeError("Topic key mismatch");return Object.freeze({id,label:hierarchyText(field("label"))})},payload:{maxUnits:2e6,maxRowUnits:65536,unitsOf:topic=>topic.id.length+topic.label.length},onChange:()=>{this._treeSource!==void 0&&this.clearSourceDiagram();const old=this.sourcePaint++;this.requestUpdate("sourcePaint",old)},accepted:(action,row,_state,current)=>{!current()||this.treeSource===void 0||(action.type==="toggle"?this.emit("lr-topic-toggle",{topicId:action.key,expanded:action.expanded}):action.type==="select"&&row?.childCount===0&&this.emit("lr-topic-select",{topicId:action.key}))}}),this._topics=Object.freeze([]),this.topicsSource=this._topics,this.inputTruncated=!1,this.expandDepth=1,this.expandedOverrides=new Map,this.focusedId=null,this.liveText="",this.cachedLayout={placed:[],links:[],width:0,height:0,centerX:0,centerY:0},this.totalTopicCount=0,this.topicsTruncated=!1,this.ownerRealmGeneration=0,this.observedSize="",this.layoutInvalidated=!0,this.layoutContext="",this.onKeyDown=e=>{if(this.treeSource!==void 0){if(!this.sourceDiagramCurrent())return;const row=this.sourceDiagramRows.get(this.focusedId??"")??this.sourceDiagramRows.values().next().value;if(!row)return;const index=this.sourceControl.window.source.indexOfKey?.(row.key);typeof index=="number"&&index>=0&&this.sourceControl.keydown(e,row,index,isRtl(this),selected=>this.selectSourceRow(selected));return}const placed=this.cachedLayout.placed;if(placed.length===0||!NAV_KEYS.has(e.key))return;if(e.preventDefault(),this.focusedId===null){this.focusNodeById(placed[0].id);return}const current=placed.find(p=>p.id===this.focusedId);if(!current)return;if(e.key==="Enter"||e.key===" "){e.repeat||this.activate(current);return}if(e.key==="ArrowUp"){current.parentId&&this.focusNodeById(current.parentId);return}if(e.key==="ArrowDown"){if(!current.hasChildren)return;this.isExpanded(current.id,current.depth)||(this.toggle(current,!1),this.relayout());const child=this.childrenOf(current.id)[0];child&&this.focusNodeById(child.id);return}const rtl=isRtl(this),forwardKey=rtl?"ArrowLeft":"ArrowRight",backwardKey=rtl?"ArrowRight":"ArrowLeft";if(e.key===forwardKey||e.key===backwardKey||e.key==="Home"||e.key==="End"){const siblings=this.siblingsOf(current),index=siblings.findIndex(s=>s.id===current.id);let next=index;e.key===forwardKey?next=Math.min(siblings.length-1,index+1):e.key===backwardKey?next=Math.max(0,index-1):e.key==="Home"?next=0:next=siblings.length-1;const target=siblings[next];target&&this.focusNodeById(target.id)}},this.onFocusIn=()=>{if(this.focusedId!==null)return;const first=this.cachedLayout.placed[0];first&&(this.focusedId=first.id)}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,expand:LYRA_DEFAULT_expand,loading:LYRA_DEFAULT_loading,mindMapCollapsed:LYRA_DEFAULT_mindMapCollapsed,mindMapExpanded:LYRA_DEFAULT_mindMapExpanded,mindMapInputLimit:LYRA_DEFAULT_mindMapInputLimit,mindMapLabel:LYRA_DEFAULT_mindMapLabel,mindMapLeafStatus:LYRA_DEFAULT_mindMapLeafStatus,mindMapNodeLimit:LYRA_DEFAULT_mindMapNodeLimit,mindMapTopicStatus:LYRA_DEFAULT_mindMapTopicStatus,noData:LYRA_DEFAULT_noData,retry:LYRA_DEFAULT_retry,treeSourceError:LYRA_DEFAULT_treeSourceError,treeSourceSummary:LYRA_DEFAULT_treeSourceSummary}}static{this.styles=[LyraElement.styles,hierarchySourceStyles,styles,srOnly]}static get observedAttributes(){return[...new Set([...super.observedAttributes,"dir","lang"])]}get treeSource(){return this._treeSource}set treeSource(value){const old=this._treeSource;this._treeSource=value,this.sourceVersion++,this.sourceWrapper=value===void 0?void 0:this.wrapSource(value),this.clearSourceDiagram(),this.sourceControl?.update(this.sourceWrapper,this.effectiveLocale,!0),this.layoutInvalidated=!0,this.requestUpdate("treeSource",old)}revealSourceKey(key){return this.treeSource===void 0?Promise.resolve(!1):this.sourceControl.reveal(key)}sourceAuthority(){const source=this.treeSource,version=this.sourceVersion,owner=this.ownerDocument,epoch=this.sourceControl.epoch,projection=this.sourceControl.projection,accepted=projection?this.sourceViewAuthority.get(projection.rows):void 0,owned=()=>this.isConnected&&this.ownerDocument===owner&&this.treeSource===source&&this.sourceVersion===version&&this.sourceControl.epoch===epoch&&this.sourceControl.projection===projection&&(source===void 0||!this.sourceControl.loading);return()=>owned()&&(source===void 0||!!accepted?.())&&owned()}wrapSource(source){const host=this,wrapper={get revision(){return source.revision},async project(request){const version=host.sourceVersion,owner=host.ownerDocument,owned=()=>host.isConnected&&host.ownerDocument===owner&&host.treeSource===source&&host.sourceWrapper===wrapper&&host.sourceVersion===version&&!request.signal.aborted,current=()=>{if(!owned())return!1;try{const revision=source.revision;return owned()&&revision===request.revision}catch{return!1}},check=()=>{if(!current())throw new Error("Topic source changed")};check();const project=source.project;check();const result=await project.call(source,request);check();const rows=result.rows;if(check(),rows===null||typeof rows!="object")throw new TypeError("Invalid topic source rows");return host.sourceViewAuthority.set(rows,current),result}};return wrapper}clearSourceDiagram(){this.sourceDiagramRows=new Map,this.sourceDiagramCurrent=()=>!1,this.cachedLayout={placed:[],links:[],width:0,height:0,centerX:0,centerY:0}}requestUpdate(name,oldValue){this._treeSource!==void 0&&name===void 0&&(this.sourceVersion++,this.sourceWrapper=this.wrapSource(this._treeSource),this.clearSourceDiagram(),this.sourceControl?.update(this.sourceWrapper,this.effectiveLocale,!0)),super.requestUpdate(name,oldValue)}selectSourceRow(row){if(row.disabled||this.sourceControl.loading||this.sourceControl.error)return;const current=this.sourceAuthority(),index=this.sourceControl.adapter.indexOfKey?.(row.key);if(!current()||typeof index!="number"||index<0)return;const slot=this.sourceControl.slot(index);!current()||slot.state!=="ready"||slot.value!==row||this.sourceControl.project(row.childCount?{type:"toggle",key:row.key,expanded:!row.expanded}:{type:"select",key:row.key,selected:!0,scope:"item"},!0,row)}scheduleSourceDiagram(){this.sourceDiagramScheduled||(this.sourceDiagramScheduled=!0,queueMicrotask(()=>{if(this.sourceDiagramScheduled=!1,this.treeSource===void 0||!this.isConnected)return;const current=this.sourceAuthority(),control=this.sourceControl,rows=new Map;if(!control.loading&&!control.error)for(const element of control.list?.projectedRows??[]){if(rows.size===301)break;const key=element.querySelector("[data-source-key]")?.dataset.sourceKey;if(!key)continue;const slot=control.slot(Number(element.dataset.rowIndex));if(!current())return;slot.state==="ready"&&slot.value.key===key&&rows.set(key,slot.value)}const previous=this.sourceDiagramRows,root=[...rows.values()].find(row=>row.parentKey===null||!rows.has(row.parentKey)),connected=new Map,topics=new Map;if(root)for(const row of rows.values()){if(row!==root&&(!row.parentKey||!connected.has(row.parentKey)))continue;const topic={id:row.key,label:row.value.label,children:[]};connected.set(row.key,row),topics.set(row.key,topic),row!==root&&topics.get(row.parentKey).children.push(topic)}if(!this.layoutInvalidated&&connected.size===previous.size&&[...connected].every(([key,row])=>previous.get(key)===row)&&this.sourceDiagramCurrent())return;const layout=createMindMapLayout(root?[topics.get(root.key)]:[])(this.label??this.localize("mindMapLabel"),{ringGap:this.ringGapPx(),rtl:isRtl(this),isExpanded:id=>connected.get(id)?.expanded??!1});current()&&(this.sourceDiagramRows=connected,this.sourceDiagramCurrent=current,this.cachedLayout={...layout,placed:layout.placed.map(node=>({...node,hasChildren:!!connected.get(node.id)?.childCount,expanded:connected.get(node.id)?.expanded??!1}))},this.layoutInvalidated=!1,this.requestUpdate("sourceDiagram",!1))}))}get topics(){return this._topics}set topics(value){if(Object.is(value,this.topicsSource)||Object.is(value,this._topics))return;const previous=this._topics,snapshot=snapshotMindMapTopics(value);this.topicsSource=value,this._topics=snapshot.topics,this.inputTruncated=snapshot.truncated,this.requestUpdate("topics",previous)}connectedCallback(){super.connectedCallback(),this.announcementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.layoutInvalidated=!0,this.armResizeObserver()}armResizeObserver(){const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!this.isConnected||!ownerWindow?.ResizeObserver||this.resizeObserver&&this.resizeObserverDocument===ownerDocument)return;this.resetResizeWork();const generation=this.ownerRealmGeneration,observer=new ownerWindow.ResizeObserver(entries=>{if(this.resizeObserver!==observer||this.resizeObserverDocument!==ownerDocument||this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument)return;const rect=entries[0]?.contentRect,size=rect?`${rect.width}:${rect.height}`:"";if(size&&size===this.observedSize)return;this.observedSize=size,this.resizeRafId!=null&&this.resizeRafOwner?.cancelAnimationFrame(this.resizeRafId);const handle=ownerWindow.requestAnimationFrame(()=>{this.resizeRafId!==handle||this.resizeRafOwner!==ownerWindow||this.resizeRafDocument!==ownerDocument||this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.resizeRafId=void 0,this.resizeRafOwner=void 0,this.resizeRafDocument=void 0,this.layoutInvalidated=!0,this.requestUpdate("layout",!1))});this.resizeRafId=handle,this.resizeRafOwner=ownerWindow,this.resizeRafDocument=ownerDocument});this.resizeObserver=observer,this.resizeObserverDocument=ownerDocument,observer.observe(this)}disconnectedCallback(){this.sourceVersion++,this.clearSourceDiagram(),this.resetResizeWork(),this.announcementSink?.release(),this.announcementSink=void 0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.sourceControl.adopted(),this.sourceVersion++,this.clearSourceDiagram(),this.resetResizeWork(),this.announcementSink?.release(),this.announcementSink=void 0}resetResizeWork(){this.ownerRealmGeneration+=1,this.resizeRafId!=null&&this.resizeRafOwner?.cancelAnimationFrame(this.resizeRafId),this.resizeRafId=void 0,this.resizeRafOwner=void 0,this.resizeRafDocument=void 0,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeObserverDocument=void 0,this.observedSize=""}attributeChangedCallback(name,oldValue,value){super.attributeChangedCallback(name,oldValue,value),(name==="dir"||name==="lang")&&oldValue!==value&&(this.layoutInvalidated=!0,this.requestUpdate("layout",!1))}get effectiveExpandDepth(){return finiteCount(this.expandDepth,1)}isExpanded(id,depth){return this.expandedOverrides.get(id)??depth<this.effectiveExpandDepth}ringGapPx(){const hostStyle=this.ownerDocument.defaultView?.getComputedStyle(this)??this.style,raw=hostStyle.getPropertyValue("--lr-mind-map-ring-gap").trim()||hostStyle.getPropertyValue("--_lr-mind-map-ring-gap").trim();return resolveCssTokenLength(raw,{host:this})??DEFAULT_RING_GAP_PX}layoutInputs(){return[this.topics,this.expandDepth,this.expandedOverrides,this.label,this.strings,this.effectiveLocale]}relayout(){this.topicLayout?.source!==this.topics&&(this.topicLayout={source:this.topics,compute:createMindMapLayout(this.topics)});const hubLabel=this.label==null?this.localize("mindMapLabel"):this.label,fullLayout=this.topicLayout.compute(hubLabel,{ringGap:this.ringGapPx(),rtl:isRtl(this),isExpanded:(id,depth)=>this.isExpanded(id,depth)});this.laidOutInputs=this.layoutInputs();const decimated=decimateMindMapLayout(fullLayout.placed,fullLayout.links,MAX_RENDERED_MIND_MAP_NODES);this.totalTopicCount=decimated.totalCount,this.topicsTruncated=decimated.truncated,this.cachedLayout={...fullLayout,placed:[...decimated.placed],links:[...decimated.links]}}willUpdate(changed){if(super.willUpdate(changed),this.sourceControl.update(this.sourceWrapper,this.effectiveLocale),this.treeSource!==void 0){(changed.has("label")||changed.has("strings")||changed.has("locale"))&&(this.layoutInvalidated=!0),this.scheduleSourceDiagram();return}this.hasUpdated&&changed.has("topics")&&this.inputTruncated&&this.announcementSink?.announce(this.localize("mindMapInputLimit"));const context=`${this.label==null?this.localize("mindMapLabel"):this.label}\0${isRtl(this)?"rtl":"ltr"}`,structuralChange=changed.has("topics")||changed.has("expandDepth")||changed.has("expandedOverrides")||changed.has("label")||changed.has("strings")||changed.has("locale");(this.layoutInvalidated||structuralChange&&(!this.laidOutInputs||this.layoutInputs().some((value,index)=>value!==this.laidOutInputs[index]))||context!==this.layoutContext)&&(this.relayout(),this.layoutContext=context,this.layoutInvalidated=!1,this.focusedId&&!this.cachedLayout.placed.some(topic=>topic.id===this.focusedId)&&(this.focusedId=this.cachedLayout.placed[0]?.id??null))}setAnnouncement(text){this.liveText=text,this.announcementSink?.announce(text)}toggle(node,announce=!0){if(this.treeSource!==void 0){const row=this.sourceDiagramRows.get(node.id);row&&this.sourceDiagramCurrent()&&this.selectSourceRow(row);return}const expanded=!this.isExpanded(node.id,node.depth),next=new Map(this.expandedOverrides);next.set(node.id,expanded),this.expandedOverrides=next,this.emit("lr-topic-toggle",{topicId:node.id,expanded}),announce&&this.setAnnouncement(this.localize(expanded?"mindMapExpanded":"mindMapCollapsed",void 0,{label:node.label}))}activate(node){if(this.treeSource!==void 0){const row=this.sourceDiagramRows.get(node.id);row&&this.sourceDiagramCurrent()&&this.selectSourceRow(row);return}node.hasChildren?this.toggle(node):this.emit("lr-topic-select",{topicId:node.id})}siblingsOf(node){return this.cachedLayout.placed.filter(p=>p.parentId===node.parentId)}childrenOf(id){return this.cachedLayout.placed.filter(p=>p.parentId===id)}announce(node){const numberFormat=getNumberFormat(this.effectiveLocale);this.setAnnouncement(node.hasChildren?this.localize("mindMapTopicStatus",void 0,{label:node.label,level:numberFormat.format(node.depth+1),count:numberFormat.format(this.childrenOf(node.id).length)}):this.localize("mindMapLeafStatus",void 0,{label:node.label,level:numberFormat.format(node.depth+1)}))}focusNodeById(id){this.focusedId=id;const node=this.cachedLayout.placed.find(p=>p.id===id);node&&this.announce(node)}onNodeClick(node){if(this.treeSource!==void 0){this.activate(node);return}this.focusedId=node.id,this.svgEl?.focus(),node.hasChildren||this.announce(node),this.activate(node)}connectorControlPoint(from,to){const layout=this.cachedLayout,parentR=Math.hypot(from.x-layout.centerX,from.y-layout.centerY),dir=isRtl(this)?-1:1;return{x:layout.centerX+dir*parentR*Math.sin(to.angle),y:layout.centerY-parentR*Math.cos(to.angle)}}renderSemanticNode(node,childrenByParent){const children=childrenByParent.get(node.id)??[];return html`
|
|
2
2
|
<div
|
|
3
3
|
role="treeitem"
|
|
4
4
|
aria-level=${node.depth+1}
|
|
@@ -9,8 +9,10 @@ import{__decorate}from"tslib";import{snapshotPublicCollection}from"../../../inte
|
|
|
9
9
|
${children.map(child=>this.renderSemanticNode(child,childrenByParent))}
|
|
10
10
|
</div>`:nothing}
|
|
11
11
|
</div>
|
|
12
|
-
`}render(){const
|
|
12
|
+
`}renderInputLimit(){return this.inputTruncated?html`<p part="input-limit" role="note">${this.localize("mindMapInputLimit")}</p>`:nothing}render(){if(this.treeSource===void 0)return this.renderDiagram();const projection=this.sourceControl.projection;return html`${hierarchySourceView(this.sourceControl,{label:this.label??this.localize("mindMapLabel"),rtl:this.effectiveDirection==="rtl",multiple:!1,loading:this.localize("loading"),error:this.localize("treeSourceError"),empty:this.localize("noData"),retry:this.localize("retry"),expand:this.localize("expand"),collapse:this.localize("collapse"),summary:projection?this.localize("treeSourceSummary",void 0,{visible:getNumberFormat(this.effectiveLocale).format(projection.rows.count),total:getNumberFormat(this.effectiveLocale).format(projection.total)}):"",content:topic=>(this.scheduleSourceDiagram(),topic.label),name:topic=>topic.label,select:row=>this.selectSourceRow(row)})}<div part="source-diagram">${this.renderDiagram()}</div>
|
|
13
|
+
<p part="limit" role="note">${this.localize("mindMapNodeLimit",void 0,{shown:getNumberFormat(this.effectiveLocale).format(this.cachedLayout.placed.length),total:getNumberFormat(this.effectiveLocale).format(projection?.rows.count??0)})}</p>`}renderDiagram(){const sourceMode=this.treeSource!==void 0,current=this.sourceAuthority(),layout=this.cachedLayout;if(layout.placed.length===0)return sourceMode?html``:html`<div part="base">
|
|
13
14
|
<div part="empty">${this.localize("noData")}</div>
|
|
15
|
+
${sourceMode?nothing:this.renderInputLimit()}
|
|
14
16
|
</div>`;const ariaLabel=this.label==null?this.localize("mindMapLabel"):this.label,byId=new Map(layout.placed.map(p=>[p.id,p])),childrenByParent=new Map;for(const topic of layout.placed){const siblings=childrenByParent.get(topic.parentId);siblings?siblings.push(topic):childrenByParent.set(topic.parentId,[topic])}const focused=this.focusedId?byId.get(this.focusedId):void 0;return html`
|
|
15
17
|
<div part="base">
|
|
16
18
|
<svg
|
|
@@ -20,12 +22,12 @@ import{__decorate}from"tslib";import{snapshotPublicCollection}from"../../../inte
|
|
|
20
22
|
aria-describedby="mind-map-live"
|
|
21
23
|
tabindex="0"
|
|
22
24
|
viewBox="0 0 ${layout.width} ${layout.height}"
|
|
23
|
-
@keydown=${this.onKeyDown}
|
|
25
|
+
@keydown=${event=>{current()&&this.onKeyDown(event)}}
|
|
24
26
|
@focusin=${this.onFocusIn}
|
|
25
27
|
>
|
|
26
28
|
${layout.links.map(link=>{const from=byId.get(link.fromId),to=byId.get(link.toId);if(!from||!to)return nothing;const control=this.connectorControlPoint(from,to);return svg`<path part="link" d="M ${from.x} ${from.y} Q ${control.x} ${control.y} ${to.x} ${to.y}" fill="none"></path>`})}
|
|
27
29
|
${layout.placed.map(node=>svg`
|
|
28
|
-
<g part="node" data-id=${node.id} style=${`transform: translate(${node.x}px, ${node.y}px)`} @click=${()=>this.onNodeClick(node)}>
|
|
30
|
+
<g part="node" data-id=${node.id} style=${`transform: translate(${node.x}px, ${node.y}px)`} @click=${()=>current()&&this.onNodeClick(node)}>
|
|
29
31
|
<line
|
|
30
32
|
class="node-hit"
|
|
31
33
|
x1="0"
|
|
@@ -42,12 +44,14 @@ import{__decorate}from"tslib";import{snapshotPublicCollection}from"../../../inte
|
|
|
42
44
|
`)}
|
|
43
45
|
${focused?svg`<circle part="focus-ring" cx=${focused.x} cy=${focused.y} r="10"></circle>`:nothing}
|
|
44
46
|
</svg>
|
|
45
|
-
${
|
|
46
|
-
|
|
47
|
+
${sourceMode?nothing:this.renderInputLimit()}
|
|
48
|
+
${!sourceMode&&this.topicsTruncated?html`<p part="limit" role="note">${this.localize("mindMapNodeLimit",void 0,{shown:getNumberFormat(this.effectiveLocale).format(layout.placed.length),total:getNumberFormat(this.effectiveLocale).format(this.totalTopicCount)})}</p>`:nothing}
|
|
49
|
+
${sourceMode?nothing:html`<div class="sr-only" role="tree">
|
|
47
50
|
${(childrenByParent.get(null)??[]).map(topic=>this.renderSemanticNode(topic,childrenByParent))}
|
|
48
51
|
</div>
|
|
52
|
+
`}
|
|
49
53
|
<div id="mind-map-live" part="live-region" class="sr-only">
|
|
50
54
|
${this.liveText}
|
|
51
55
|
</div>
|
|
52
56
|
</div>
|
|
53
|
-
`}}__decorate([property({attribute:!1})],LyraMindMap.prototype,"topics",null),__decorate([property()],LyraMindMap.prototype,"label",void 0),__decorate([property({type:Number,attribute:"expand-depth"})],LyraMindMap.prototype,"expandDepth",void 0),__decorate([query('[part="svg"]')],LyraMindMap.prototype,"svgEl",void 0),__decorate([state()],LyraMindMap.prototype,"expandedOverrides",void 0),__decorate([state()],LyraMindMap.prototype,"focusedId",void 0),__decorate([state()],LyraMindMap.prototype,"liveText",void 0);export{LyraMindMap};
|
|
57
|
+
`}}__decorate([property({attribute:!1})],LyraMindMap.prototype,"treeSource",null),__decorate([property({attribute:!1})],LyraMindMap.prototype,"topics",null),__decorate([property()],LyraMindMap.prototype,"label",void 0),__decorate([property({type:Number,attribute:"expand-depth"})],LyraMindMap.prototype,"expandDepth",void 0),__decorate([query('[part="svg"]')],LyraMindMap.prototype,"svgEl",void 0),__decorate([state()],LyraMindMap.prototype,"expandedOverrides",void 0),__decorate([state()],LyraMindMap.prototype,"focusedId",void 0),__decorate([state()],LyraMindMap.prototype,"liveText",void 0);export{LyraMindMap};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./mind-map.class.js";import{LyraMindMap}from"./mind-map.class.js";import{defineElement}from"../../../internal/prefix.js";defineElement("mind-map",LyraMindMap);
|
|
1
|
+
import"../../layout/virtual-list/virtual-list.js";export*from"./mind-map.class.js";import{LyraMindMap}from"./mind-map.class.js";import{defineElement}from"../../../internal/prefix.js";defineElement("mind-map",LyraMindMap);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from"lit";const styles=css`:host{--_lr-mind-map-ring-gap:var(--lr-size-6rem);display:block}[part=base]{display:block}[part=svg]{block-size:100%;inline-size:100%;display:block}[part=svg]:focus-visible{outline:none}[part=link]{stroke:var(--lr-color-border);stroke-width:1.5px}[part=node]{cursor:pointer;transition:transform var(--lr-transition-base)}.node-hit{fill:none;stroke:#0000;stroke-width:var(--lr-icon-button-size);stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:stroke}[part=node] circle{fill:var(--lr-color-brand);stroke:#0000;stroke-width:var(--lr-border-width-thick);transition:stroke var(--lr-transition-fast)}[part=node]:hover circle{stroke:var(--lr-mind-map-node-hover-halo,var(--lr-color-brand-quiet))}[part=node]:active circle{stroke:color-mix(in oklab, var(--lr-mind-map-node-hover-halo,var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=node-label]{fill:var(--lr-color-text);font-size:var(--lr-font-size-sm)}[part=focus-ring]{fill:none;stroke:var(--lr-focus-ring-color);stroke-width:var(--lr-focus-ring-width);pointer-events:none}[part=empty]{padding:var(--lr-space-m);color:var(--lr-color-text-quiet)}`;export{styles};
|
|
1
|
+
import{css}from"lit";const styles=css`:host{--_lr-mind-map-ring-gap:var(--lr-size-6rem);display:block}[part=base]{display:block}[part=source-diagram]{block-size:var(--lr-size-20rem);min-inline-size:0;overflow:hidden}[part=svg]{block-size:100%;inline-size:100%;display:block}[part=svg]:focus-visible{outline:none}[part=link]{stroke:var(--lr-color-border);stroke-width:1.5px}[part=node]{cursor:pointer;transition:transform var(--lr-transition-base)}.node-hit{fill:none;stroke:#0000;stroke-width:var(--lr-icon-button-size);stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:stroke}[part=node] circle{fill:var(--lr-color-brand);stroke:#0000;stroke-width:var(--lr-border-width-thick);transition:stroke var(--lr-transition-fast)}[part=node]:hover circle{stroke:var(--lr-mind-map-node-hover-halo,var(--lr-color-brand-quiet))}[part=node]:active circle{stroke:color-mix(in oklab, var(--lr-mind-map-node-hover-halo,var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=node-label]{fill:var(--lr-color-text);font-size:var(--lr-font-size-sm)}[part=focus-ring]{fill:none;stroke:var(--lr-focus-ring-color);stroke-width:var(--lr-focus-ring-width);pointer-events:none}[part=empty]{padding:var(--lr-space-m);color:var(--lr-color-text-quiet)}[part=input-limit]{margin-block:var(--lr-space-xs);color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-sm)}`;export{styles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraEntity}from'../entity-card/entity-card.class.js';import type{LyraNodeTypeStyle}from'../../../internal/node-type-style.js';import'../../overlays/empty/empty.class.js';export interface LyraNeighborRow{
|
|
1
|
+
import type{GraphSource}from'../graph/graph.class.js';import type{LyraGraphSourceQuery}from'../../../data-sources.js';import'../../data/pagination/pagination.class.js';export type NeighborListSource=GraphSource;export type NeighborSourceDirection=LyraGraphSourceQuery['direction'];import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraEntity}from'../entity-card/entity-card.class.js';import type{LyraNodeTypeStyle}from'../../../internal/node-type-style.js';import'../../overlays/empty/empty.class.js';export interface LyraNeighborRow{
|
|
2
2
|
/** Edge label, e.g. `'works_for'`. */
|
|
3
3
|
relation:string;direction:'in'|'out'|'both';node:LyraEntity;}export interface LyraNeighborListEventMap{
|
|
4
4
|
/** Canonical name for the "user picked this entity" gesture. */
|
|
@@ -31,6 +31,10 @@ relation:string;direction:'in'|'out'|'both';node:LyraEntity;}export interface Ly
|
|
|
31
31
|
* @csspart node-label - The row's node `<button>`.
|
|
32
32
|
* @csspart node-meta - Secondary node text (type/degree), when present.
|
|
33
33
|
* @csspart expand-button - The per-row expand-in-graph icon button, only rendered when `expandable`.
|
|
34
|
+
* @csspart limit - Localized retained/source counts when the row assignment exceeds its input boundary.
|
|
35
|
+
* @csspart source-status - Source loading, failure, empty, or missing-center status.
|
|
36
|
+
* @csspart source-summary - Exact neighborhood total and current page count.
|
|
37
|
+
* @csspart source-retry - Retry action for the current failed source request.
|
|
34
38
|
* @csspart empty - The empty-state message, shown when `rows` is empty.
|
|
35
39
|
* @status stable
|
|
36
40
|
* @since 4.0.0
|
|
@@ -50,4 +54,22 @@ virtualizeAt:number;
|
|
|
50
54
|
/** Accessible name for the stable group when the host has no `aria-label`; falls back to the
|
|
51
55
|
* localized `neighborListLabel` default when omitted. An explicitly empty host label stays
|
|
52
56
|
* empty, and so does an explicitly empty `label`. */
|
|
53
|
-
label?:string;private
|
|
57
|
+
label?:string;private _graphSource?;
|
|
58
|
+
/** Full node-neighborhood provider. Wins over rows while defined. Reassign (even the same
|
|
59
|
+
* source) or call requestUpdate() to refresh; unset restores rows. Relation grouping and
|
|
60
|
+
* per-row direction are unavailable because node records do not carry edge metadata. */
|
|
61
|
+
get graphSource():NeighborListSource|undefined;set graphSource(value:NeighborListSource|undefined);
|
|
62
|
+
/** Canonical node key whose neighborhood is shown; null makes no provider request. */
|
|
63
|
+
centerKey:string|null;
|
|
64
|
+
/** Direction filter for the entire neighborhood, not a per-row edge direction. */
|
|
65
|
+
sourceDirection:NeighborSourceDirection;private _sourceNodeTypes;private sourceTypesError;private sourceTypesVersion;
|
|
66
|
+
/** At most 500 distinct nonblank type IDs; 65,536 units each and 2,000,000 combined. */
|
|
67
|
+
get sourceNodeTypes():readonly string[];set sourceNodeTypes(value:readonly string[]);
|
|
68
|
+
/** Zero-based full-neighborhood page. */
|
|
69
|
+
sourcePage:number;
|
|
70
|
+
/** Requested page size, normalized to 1–500, default 100. */
|
|
71
|
+
sourcePageSize:number;
|
|
72
|
+
/** Exact matching neighborhood count, or null before a current successful query. */
|
|
73
|
+
get sourceTotal():number|null;private sourceEpoch;private sourceNavigation;private sourcePaint;private sourceBinding?;private sourcePageBinding?;private sourceError;private sourceFailedEpoch?;private sourceSyncing;private sourcePromise;private readonly sourcePages;private sourceCurrent;private syncSource;
|
|
74
|
+
/** Reveals and focuses a global neighborhood node without selecting or expanding it. */
|
|
75
|
+
revealSourceKey(key:string):Promise<boolean>;connectedCallback():void;disconnectedCallback():void;private get effectiveVirtualizeAt();private readonly announcements;private sortedRowsCache;private groupsCache;private hasComputedRows;private processedSignature;private explicitRefresh;private groupDeps?;private presentationDeps?;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;protected willUpdate(changed:PropertyValues<this>):void;private sortedRows;private computeSortedRows;private groups;private computeGroups;private directionGlyph;private directionText;private renderRow;private readonly virtualListKeyFunction;private renderNeighborRow;adoptedCallback():void;private renderSource;protected updated(changed:PropertyValues<this>):void;private inputLimitMessage;private renderInputLimit;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-neighbor-list':LyraNeighborList;}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity}from"../retrieval-identity.js";import{expandIcon}from"../../../internal/icons.js";import{finiteCount}from"../../../internal/numbers.js";import{getCollator,getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import"../../overlays/empty/empty.class.js";import{styles}from"./neighbor-list.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_neighborExpand,LYRA_DEFAULT_neighborGroupHeader,LYRA_DEFAULT_neighborListEmpty,LYRA_DEFAULT_neighborListLabel,LYRA_DEFAULT_neighborRowLabel}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_neighborDirectionBoth,LYRA_DEFAULT_neighborDirectionIn,LYRA_DEFAULT_neighborDirectionOut}from"../../../internal/default-strings/shared.generated.js";let virtualListRegistration;class LyraNeighborList extends LyraElement{constructor(){super(...arguments),this.rows=[],this.types=[],this.groupByRelation=!1,this.expandable=!1,this.virtualizeAt=100,this.sortedRowsCache=[],this.hasComputedRows=!1,this.processedSignature="",this.renderRow=item=>this.renderNeighborRow(item),this.virtualListKeyFunction=item=>item.node.id}static{this.defaultStrings={...super.defaultStrings,neighborDirectionBoth:LYRA_DEFAULT_neighborDirectionBoth,neighborDirectionIn:LYRA_DEFAULT_neighborDirectionIn,neighborDirectionOut:LYRA_DEFAULT_neighborDirectionOut,neighborExpand:LYRA_DEFAULT_neighborExpand,neighborGroupHeader:LYRA_DEFAULT_neighborGroupHeader,neighborListEmpty:LYRA_DEFAULT_neighborListEmpty,neighborListLabel:LYRA_DEFAULT_neighborListLabel,neighborRowLabel:LYRA_DEFAULT_neighborRowLabel}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["rows","types"])}static{this.styles=[LyraElement.styles,styles]}get effectiveVirtualizeAt(){return finiteCount(this.virtualizeAt,100)}willUpdate(changed){super.willUpdate(changed);const signature=`${this.effectiveLocale} ${this.groupByRelation}`;(!this.hasComputedRows||changed.has("rows")||changed.has("groupByRelation")||signature!==this.processedSignature)&&(this.hasComputedRows=!0,this.processedSignature=signature,this.sortedRowsCache=this.computeSortedRows(),this.groupsCache=this.computeGroups(this.sortedRowsCache)),this.sortedRowsCache.length>this.effectiveVirtualizeAt&&(virtualListRegistration??=import("../../layout/virtual-list/virtual-list.js").catch(()=>virtualListRegistration=void 0))}sortedRows(){return this.sortedRowsCache}computeSortedRows(){const rows=firstByRetrievalIdentity(this.rows,row=>row?.node?.id);if(!this.groupByRelation)return rows;const compare=getCollator(this.effectiveLocale).compare;return rows.sort((a,b)=>compare(a.relation,b.relation))}groups(sorted){return sorted===this.sortedRowsCache?this.groupsCache:this.computeGroups(sorted)}computeGroups(sorted){if(!this.groupByRelation)return;const groups=[],counts=new Map;for(const row of sorted)counts.set(row.relation,(counts.get(row.relation)??0)+1);const numberFormat=getNumberFormat(this.effectiveLocale);let lastRelation;return sorted.forEach((row,i)=>{if(row.relation!==lastRelation){const count=numberFormat.format(counts.get(row.relation)??0);groups.push({key:row.relation,label:this.localize("neighborGroupHeader",void 0,{relation:row.relation,count}),startIndex:i}),lastRelation=row.relation}}),groups}directionGlyph(direction){return direction==="both"?"↔":direction==="out"?"→":"←"}directionText(direction){return this.localize(direction==="in"?"neighborDirectionIn":direction==="out"?"neighborDirectionOut":"neighborDirectionBoth")}renderNeighborRow(row){const nodeLabel=row.node.label||row.node.id,directionText=this.directionText(row.direction),accessibleName=this.localize("neighborRowLabel",void 0,{label:nodeLabel,relation:row.relation,direction:directionText}),nodeType=typeof row.node.type=="string"&&row.node.type.trim()!==""?row.node.type:void 0;this.typeLabels?.[0]!==this.types&&(this.typeLabels=[this.types,new Map(firstByRetrievalIdentity(this.types,type=>type?.id).map(type=>[type.id,type.label]))]);const meta=[nodeType&&(this.typeLabels[1].get(nodeType)??nodeType),row.node.degree!=null?getNumberFormat(this.effectiveLocale).format(finiteCount(row.node.degree)):void 0].filter(v=>typeof v=="string"&&v!==""),metaText=getListFormat(this.effectiveLocale,{style:"short",type:"unit"}).format(meta);return html`
|
|
1
|
+
import{__decorate}from"tslib";import{SourcePageController}from"../../../internal/source-page-controller.js";import{sourceCount,sourceRevision}from"../../../internal/source-request-controller.js";import"../../data/pagination/pagination.class.js";function sourceField(value,key){if(!value||typeof value!="object")throw new TypeError("Invalid neighborhood value");const descriptor=Object.getOwnPropertyDescriptor(value,key);if(descriptor&&!("value"in descriptor))throw new TypeError("Accessor neighborhood field");return descriptor?.value}function sourceRows(raw,limit){if(!Array.isArray(raw))throw new TypeError("Invalid neighborhood page");const length=sourceCount(sourceField(raw,"length"));if(length>limit)throw new RangeError("Neighborhood page limit");let units=0;const text=(value,required=!1)=>{if(!(value===void 0&&!required)){if(typeof value!="string"||required&&!value.trim()||value.length>65536||(units+=value.length)>2e6)throw new TypeError("Invalid neighborhood text");return value}};return Object.freeze(Array.from({length},(_,index)=>{const entry=sourceField(raw,index),record=sourceField(entry,"value");if(sourceField(record,"kind")!=="node")throw new TypeError("Expected neighborhood node");const node=sourceField(record,"value"),key=text(sourceField(entry,"key"),!0),id=text(sourceField(node,"id"),!0);if(key!==`node:${id}`)throw new TypeError("Invalid neighborhood identity");const label=text(sourceField(node,"label")),accessibleLabel=text(sourceField(node,"accessibleLabel")),type=text(sourceField(node,"type"));return Object.freeze({key,order:sourceCount(sourceField(entry,"order")),value:Object.freeze({id,...label===void 0?{}:{label},...accessibleLabel===void 0?{}:{accessibleLabel},...type===void 0?{}:{type}})})}))}function sourceSummary(raw){return Object.freeze({nodes:sourceCount(sourceField(raw,"nodes")),edges:sourceCount(sourceField(raw,"edges"))})}import{AnnouncementSinkController}from"../../../internal/announcer.js";import{lyraLocaleCatalogVersion}from"../../../internal/localization-runtime.js";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity}from"../retrieval-identity.js";import{expandIcon}from"../../../internal/icons.js";import{finiteInteger,finiteCount}from"../../../internal/numbers.js";import{getCollator,getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import"../../overlays/empty/empty.class.js";import{styles}from"./neighbor-list.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_graphDataListLimit,LYRA_DEFAULT_neighborExpand,LYRA_DEFAULT_neighborGroupHeader,LYRA_DEFAULT_neighborListEmpty,LYRA_DEFAULT_neighborListLabel,LYRA_DEFAULT_neighborRowLabel,LYRA_DEFAULT_neighborSourceChoose,LYRA_DEFAULT_neighborSourceError,LYRA_DEFAULT_neighborSourceSummary}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_loading,LYRA_DEFAULT_neighborDirectionBoth,LYRA_DEFAULT_neighborDirectionIn,LYRA_DEFAULT_neighborDirectionOut,LYRA_DEFAULT_retry}from"../../../internal/default-strings/shared.generated.js";let virtualListRegistration;class LyraNeighborList extends LyraElement{constructor(){super(...arguments),this.rows=[],this.types=[],this.groupByRelation=!1,this.expandable=!1,this.virtualizeAt=100,this.centerKey=null,this.sourceDirection="both",this._sourceNodeTypes=Object.freeze([]),this.sourceTypesError=!1,this.sourceTypesVersion=0,this.sourcePage=0,this.sourcePageSize=100,this.sourceEpoch=0,this.sourceNavigation=0,this.sourcePaint=0,this.sourceError=!1,this.sourceSyncing=!1,this.sourcePromise=Promise.resolve(!1),this.sourcePages=new SourcePageController(this,{normalizeRecord:row=>row,normalizeSummary:sourceSummary,validateMetadata:result=>{if(result.total>result.summary.nodes)throw new RangeError("Invalid neighborhood total")},onChange:()=>{const old=this.sourcePaint++;this.requestUpdate("sourcePaint",old)}}),this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.sortedRowsCache=[],this.hasComputedRows=!1,this.processedSignature="",this.explicitRefresh=0,this.renderRow=item=>this.renderNeighborRow(item),this.virtualListKeyFunction=item=>item.node.id}static{this.defaultStrings={...super.defaultStrings,graphDataListLimit:LYRA_DEFAULT_graphDataListLimit,loading:LYRA_DEFAULT_loading,neighborDirectionBoth:LYRA_DEFAULT_neighborDirectionBoth,neighborDirectionIn:LYRA_DEFAULT_neighborDirectionIn,neighborDirectionOut:LYRA_DEFAULT_neighborDirectionOut,neighborExpand:LYRA_DEFAULT_neighborExpand,neighborGroupHeader:LYRA_DEFAULT_neighborGroupHeader,neighborListEmpty:LYRA_DEFAULT_neighborListEmpty,neighborListLabel:LYRA_DEFAULT_neighborListLabel,neighborRowLabel:LYRA_DEFAULT_neighborRowLabel,neighborSourceChoose:LYRA_DEFAULT_neighborSourceChoose,neighborSourceError:LYRA_DEFAULT_neighborSourceError,neighborSourceSummary:LYRA_DEFAULT_neighborSourceSummary,retry:LYRA_DEFAULT_retry}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["rows","types"])}static{this.styles=[LyraElement.styles,styles]}get graphSource(){return this._graphSource}set graphSource(value){const previous=this._graphSource;this._graphSource=value,this.requestUpdate("graphSource",previous),previous===value&&super.requestUpdate()}get sourceNodeTypes(){return this._sourceNodeTypes}set sourceNodeTypes(value){const previous=this._sourceNodeTypes,transaction=++this.sourceTypesVersion;try{if(!Array.isArray(value))throw new TypeError("Invalid neighborhood types");const length=sourceCount(sourceField(value,"length"));if(length>500)throw new RangeError("Neighborhood type limit");const types=new Set;let units=0;for(let i=0;i<length;i++){const item=sourceField(value,i);if(typeof item!="string"||!item.trim()||item.length>65536)throw new TypeError("Invalid neighborhood type");if(!types.has(item)){if(units+=item.length,units>2e6)throw new RangeError("Neighborhood type budget");types.add(item)}}if(transaction!==this.sourceTypesVersion)return;this._sourceNodeTypes=Object.freeze([...types].sort()),this.sourceTypesError=!1}catch{if(transaction!==this.sourceTypesVersion)return;this._sourceNodeTypes=Object.freeze([]),this.sourceTypesError=!0}this.requestUpdate("sourceNodeTypes",previous)}get sourceTotal(){return this.graphSource!==void 0&&this.centerKey!==null&&!this.sourceError&&this.sourceBinding?.[3]===this.sourceEpoch?this.sourcePages.state.result?.total??null:null}sourceCurrent(){const source=this.graphSource,epoch=this.sourceEpoch,owner=this.ownerDocument;let revision;try{revision=source?.revision}catch{return()=>!1}return()=>{try{return source?.revision===revision&&this.isConnected&&this.ownerDocument===owner&&this.graphSource===source&&this.sourceEpoch===epoch}catch{return!1}}}syncSource(){if(!this.sourcePages||this.sourceSyncing)return;this.sourceSyncing=!0;const epoch=this.sourceEpoch;try{if(this.sourceError&&this.sourceFailedEpoch===epoch)return;const source=this.graphSource;if(source===void 0||this.centerKey===null||!this.isConnected){(this.sourceBinding||this.sourcePageBinding)&&this.sourcePages.bind(void 0),this.sourceBinding=void 0,this.sourcePageBinding=void 0,this.sourceError=!1;return}if(this.sourceTypesError||typeof this.centerKey!="string"||!this.centerKey.startsWith("node:")||!this.centerKey.slice(5).trim()||this.centerKey.length>65536||!["in","out","both"].includes(this.sourceDirection))throw new TypeError("Invalid neighborhood scope");const revision=sourceRevision(source.revision),records=source.records,locale=this.effectiveLocale,queryRead=records.query,lookupRead=records.lookup,locateRead=records.locate;if(sourceRevision(records.revision)!==revision||typeof queryRead!="function"||typeof lookupRead!="function"||typeof locateRead!="function")throw new TypeError("Invalid neighborhood provider");if(epoch!==this.sourceEpoch||source!==this.graphSource)return;const binding=[source,records,revision,epoch,locale];if(!this.sourceBinding||binding.some((value,index)=>value!==this.sourceBinding[index])){this.sourceBinding=binding,this.sourcePageBinding=void 0,this.sourceError=!1;const current=()=>source.revision===revision&&source.records===records&&records.revision===revision&&this.isConnected&&epoch===this.sourceEpoch&&source===this.graphSource,check=()=>{if(!current())throw new Error("Obsolete neighborhood")};if(this.sourcePages.bind({revision,epoch,locale,source:{revision,query:async request=>{check();const raw=await queryRead.call(records,request);if(check(),sourceField(raw,"groups")!==void 0||sourceField(raw,"tags")!==void 0)throw new TypeError("Unexpected neighborhood metadata");const result={rows:sourceRows(sourceField(raw,"rows"),request.pageSize),total:sourceCount(sourceField(raw,"total")),summary:sourceSummary(sourceField(raw,"summary"))};return check(),result},lookup:async(keys,context)=>{check();const raw=await lookupRead.call(records,keys,context);check();const rows=sourceRows(raw,keys.length);return check(),rows},locate:async(key,query,context)=>{check();const result=await locateRead.call(records,key,query,context);return check(),result}}}),epoch!==this.sourceEpoch||source!==this.graphSource)return}const size=finiteInteger(this.sourcePageSize,100,1,500),page=finiteInteger(this.sourcePage,0,0,Math.floor(Number.MAX_SAFE_INTEGER/size)),signature=[page,size,this.centerKey,this.sourceDirection,this.sourceNodeTypes];(!this.sourcePageBinding||signature.some((value,index)=>value!==this.sourcePageBinding[index]))&&(this.sourcePageBinding=signature,this.sourcePromise=this.sourcePages.request(Object.freeze({kind:"nodes",search:"",centerKey:this.centerKey,direction:this.sourceDirection,nodeTypes:this.sourceNodeTypes}),page,size))}catch{epoch===this.sourceEpoch&&(this.sourceError=!0,this.sourceFailedEpoch=epoch,this.sourcePages.bind(void 0),this.sourceBinding=void 0,this.sourcePageBinding=void 0)}finally{this.sourceSyncing=!1,epoch!==this.sourceEpoch&&queueMicrotask(()=>{const old=this.sourcePaint++;this.requestUpdate("sourcePaint",old)})}}async revealSourceKey(key){const navigation=++this.sourceNavigation;if(this.graphSource===void 0||this.centerKey===null||typeof key!="string"||!key.startsWith("node:")||!key.slice(5).trim()||key.length>65536)return!1;this.syncSource();const sourceCurrent=this.sourceCurrent(),current=()=>sourceCurrent()&&this.sourceNavigation===navigation;if(await this.sourcePromise,!current()||this.sourceError)return!1;const index=await this.sourcePages.locate(key);if(!current()||index===null||(this.sourceSyncing=!0,this.sourcePage=Math.floor(index/finiteInteger(this.sourcePageSize,100,1,500)),this.sourceSyncing=!1,this.syncSource(),await this.sourcePromise,await this.updateComplete,!current()))return!1;const target=[...this.renderRoot.querySelectorAll("[data-source-key]")].find(node=>node.dataset.sourceKey===key);return!target||!current()||(target.scrollIntoView({block:"nearest"}),!current())?!1:(target.focus(),current()&&this.renderRoot.querySelector("[data-source-key]:focus")===target)}connectedCallback(){super.connectedCallback(),this.sourceEpoch++,this.syncSource()}disconnectedCallback(){this.sourceEpoch++,this.sourceNavigation++,this.sourcePages.bind(void 0),this.sourceBinding=void 0,this.sourcePageBinding=void 0,super.disconnectedCallback()}get effectiveVirtualizeAt(){return finiteCount(this.virtualizeAt,100)}requestUpdate(...args){if(this.sourcePages&&(!this.sourceSyncing||args[0]!=="sourcePage"))if(args[0]===void 0||["graphSource","centerKey","sourceDirection","sourceNodeTypes","sourcePageSize"].includes(String(args[0]))){if(this.sourceEpoch++,this.sourceNavigation++,["centerKey","sourceDirection","sourceNodeTypes","sourcePageSize"].includes(String(args[0]))){const syncing=this.sourceSyncing;this.sourceSyncing=!0,this.sourcePage=0,this.sourceSyncing=syncing}}else args[0]==="sourcePage"&&this.sourceNavigation++;args[0]===void 0&&(this.explicitRefresh=(this.explicitRefresh??0)+1),super.requestUpdate(...args)}willUpdate(changed){if(super.willUpdate(changed),this.syncSource(),this.graphSource!==void 0){(changed.has("rows")||changed.has("groupByRelation"))&&(this.hasComputedRows=!1);return}if(this.hasUpdated&&changed.has("rows")){const message=this.inputLimitMessage();message&&this.announcements.announcePolite(message)}const signature=`${this.effectiveLocale} ${this.groupByRelation}`;(!this.hasComputedRows||changed.has("rows")||changed.has("groupByRelation")||signature!==this.processedSignature)&&(this.hasComputedRows=!0,this.processedSignature=signature,this.sortedRowsCache=this.computeSortedRows());const groupDeps=[this.sortedRowsCache,this.effectiveLocale,this.strings,lyraLocaleCatalogVersion(this.effectiveLocale),this.explicitRefresh];(!this.groupDeps||groupDeps.some((value,index)=>value!==this.groupDeps[index]))&&(this.groupDeps=groupDeps,this.groupsCache=this.computeGroups(this.sortedRowsCache));const presentationDeps=[...groupDeps,this.types,this.expandable];(!this.presentationDeps||presentationDeps.some((value,index)=>value!==this.presentationDeps[index]))&&(this.presentationDeps=presentationDeps,this.renderRow=item=>this.renderNeighborRow(item)),this.sortedRowsCache.length>this.effectiveVirtualizeAt&&(virtualListRegistration??=import("../../layout/virtual-list/virtual-list.js").catch(()=>virtualListRegistration=void 0))}sortedRows(){return this.sortedRowsCache}computeSortedRows(){const rows=firstByRetrievalIdentity(this.rows,row=>row?.node?.id);if(!this.groupByRelation)return rows;const compare=getCollator(this.effectiveLocale).compare;return rows.sort((a,b)=>compare(a.relation,b.relation))}groups(sorted){return sorted===this.sortedRowsCache?this.groupsCache:this.computeGroups(sorted)}computeGroups(sorted){if(!this.groupByRelation)return;const groups=[],counts=new Map;for(const row of sorted)counts.set(row.relation,(counts.get(row.relation)??0)+1);const numberFormat=getNumberFormat(this.effectiveLocale);let lastRelation;return sorted.forEach((row,i)=>{if(row.relation!==lastRelation){const count=numberFormat.format(counts.get(row.relation)??0);groups.push({key:row.relation,label:this.localize("neighborGroupHeader",void 0,{relation:row.relation,count}),startIndex:i}),lastRelation=row.relation}}),groups}directionGlyph(direction){return direction==="both"?"↔":direction==="out"?"→":"←"}directionText(direction){return this.localize(direction==="in"?"neighborDirectionIn":direction==="out"?"neighborDirectionOut":"neighborDirectionBoth")}renderNeighborRow(row){const nodeLabel=row.node.label||row.node.id,directionText=this.directionText(row.direction),accessibleName=this.localize("neighborRowLabel",void 0,{label:nodeLabel,relation:row.relation,direction:directionText}),nodeType=typeof row.node.type=="string"&&row.node.type.trim()!==""?row.node.type:void 0;this.typeLabels?.[0]!==this.types&&(this.typeLabels=[this.types,new Map(firstByRetrievalIdentity(this.types,type=>type?.id).map(type=>[type.id,type.label]))]);const meta=[nodeType&&(this.typeLabels[1].get(nodeType)??nodeType),row.node.degree!=null?getNumberFormat(this.effectiveLocale).format(finiteCount(row.node.degree)):void 0].filter(v=>typeof v=="string"&&v!==""),metaText=getListFormat(this.effectiveLocale,{style:"short",type:"unit"}).format(meta);return html`
|
|
2
2
|
<button
|
|
3
3
|
part="node-label"
|
|
4
4
|
type="button"
|
|
@@ -21,11 +21,23 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
|
|
|
21
21
|
>
|
|
22
22
|
${expandIcon()}
|
|
23
23
|
</button>`:nothing}
|
|
24
|
-
`}
|
|
24
|
+
`}adoptedCallback(){super.adoptedCallback(),this.announcements.adopted(),this.sourceEpoch++,this.sourceNavigation++,this.sourcePages.adopted(),this.syncSource()}renderSource(){const state=this.sourcePages.state,failed=this.sourceError||!!state.error,sourceCurrent=this.sourceCurrent(),page=this.sourcePage,current=()=>sourceCurrent()&&Object.is(this.sourcePage,page),valid=()=>current()&&this.sourcePages.state===state&&!this.sourceError,rows=!failed&&this.centerKey!==null?state.result?.rows??[]:[],label=retrievalSemanticLabel(this,this.label??this.localize("neighborListLabel")),role=retrievalSemanticRole(this,"group"),status=this.centerKey===null?this.localize("neighborSourceChoose"):failed?this.localize("neighborSourceError"):state.pending?this.localize("loading"):rows.length?"":this.localize("neighborListEmpty"),total=this.sourceTotal;return html`<div part="base" role=${role??nothing} aria-label=${label??nothing} aria-busy=${String(state.pending)}>
|
|
25
|
+
${status?html`<p part="source-status">${status}</p>`:nothing}
|
|
26
|
+
${failed?html`<button part="source-retry" type="button" @click=${()=>{current()&&this.sourcePages.state===state&&(this.sourceError||state.error)&&this.requestUpdate()}}>${this.localize("retry")}</button>`:nothing}
|
|
27
|
+
${total!==null?html`<p part="source-summary">${this.localize("neighborSourceSummary",void 0,{shown:getNumberFormat(this.effectiveLocale).format(rows.length),total:getNumberFormat(this.effectiveLocale).format(total)})}</p>`:nothing}
|
|
28
|
+
<div role="list">${rows.map(row=>{const name=row.value.accessibleLabel||row.value.label||row.value.id;return html`<div part="row" role="listitem"><button part="node-label" type="button" data-source-key=${row.key} aria-label=${name}
|
|
29
|
+
@click=${()=>{valid()&&rows.includes(row)&&this.emit("lr-entity-select",{entityId:row.value.id})}}>${row.value.label||row.value.id}</button>
|
|
30
|
+
${this.expandable?html`<button part="expand-button" type="button" aria-label=${this.localize("neighborExpand",void 0,{label:name})}
|
|
31
|
+
@click=${()=>{valid()&&this.expandable&&rows.includes(row)&&this.emit("lr-node-expand",{nodeId:row.value.id})}}>${expandIcon()}</button>`:nothing}</div>`})}</div>
|
|
32
|
+
${this.centerKey!==null?html`<lr-pagination format="compact" with-edges .page=${finiteInteger(this.sourcePage,0,0,Number.MAX_SAFE_INTEGER-1)+1}
|
|
33
|
+
.pageSize=${finiteInteger(this.sourcePageSize,100,1,500)} .total=${total??-1} .disabled=${failed||state.pending||total===null}
|
|
34
|
+
.strings=${this.strings} @lr-page-change=${event=>{event.stopPropagation(),valid()&&(this.sourcePage=event.detail.page-1)}}></lr-pagination>`:nothing}
|
|
35
|
+
</div>`}updated(changed){if(super.updated(changed),this.graphSource!==void 0){const state=this.sourcePages.state,status=this.sourceError||state.error?"error":state.pending?"loading":"ready";this.announcements.transition("source",status,status==="error"?this.localize("neighborSourceError"):status==="loading"?this.localize("loading"):""),state.result&&this.sourcePage!==state.page&&(this.sourceSyncing=!0,this.sourcePage=state.page,this.sourceSyncing=!1,this.sourcePageBinding&&(this.sourcePageBinding=[state.page,...this.sourcePageBinding.slice(1)]))}}inputLimitMessage(){const loss=publicCollectionTruncation(this,"rows"),format=getNumberFormat(this.effectiveLocale);return loss?this.localize("graphDataListLimit",void 0,{shown:format.format(loss.retained),total:format.format(loss.source)}):""}renderInputLimit(){const message=this.inputLimitMessage();return message?html`<p part="limit" role="note">${message}</p>`:nothing}render(){if(this.graphSource!==void 0)return this.renderSource();const sorted=this.sortedRows(),label=retrievalSemanticLabel(this,this.label==null?this.localize("neighborListLabel"):this.label),role=retrievalSemanticRole(this,"group");if(sorted.length===0)return html`<div
|
|
25
36
|
part="base"
|
|
26
37
|
role=${role??nothing}
|
|
27
38
|
aria-label=${label??nothing}
|
|
28
39
|
>
|
|
40
|
+
${this.renderInputLimit()}
|
|
29
41
|
<lr-empty part="empty"
|
|
30
42
|
><span slot="heading"
|
|
31
43
|
>${this.localize("neighborListEmpty")}</span
|
|
@@ -33,6 +45,7 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
|
|
|
33
45
|
>
|
|
34
46
|
</div>`;if(sorted.length>this.effectiveVirtualizeAt)return html`
|
|
35
47
|
<div part="base" role=${role??nothing} aria-label=${label??nothing}>
|
|
48
|
+
${this.renderInputLimit()}
|
|
36
49
|
<lr-virtual-list
|
|
37
50
|
exportparts="row:row, node-label:node-label, direction:direction, relation:relation, node-meta:node-meta, expand-button:expand-button, group:group-header"
|
|
38
51
|
.items=${guard([sorted],()=>sorted)}
|
|
@@ -43,6 +56,7 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
|
|
|
43
56
|
</div>
|
|
44
57
|
`;const groups=this.groups(sorted),groupsByStartIndex=new Map(groups?.map(g=>[g.startIndex,g])??[]);return html`
|
|
45
58
|
<div part="base" role=${role??nothing} aria-label=${label??nothing}>
|
|
59
|
+
${this.renderInputLimit()}
|
|
46
60
|
<div role="list">
|
|
47
61
|
${sorted.map((row,i)=>{const group=groupsByStartIndex.get(i);return html`${group?html`<div part="group-header" role="presentation">
|
|
48
62
|
${group.label}
|
|
@@ -52,4 +66,4 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
|
|
|
52
66
|
</div>`})}
|
|
53
67
|
</div>
|
|
54
68
|
</div>
|
|
55
|
-
`}}__decorate([property({attribute:!1})],LyraNeighborList.prototype,"rows",void 0),__decorate([property({attribute:!1})],LyraNeighborList.prototype,"types",void 0),__decorate([property({type:Boolean,attribute:"group-by-relation"})],LyraNeighborList.prototype,"groupByRelation",void 0),__decorate([property({type:Boolean})],LyraNeighborList.prototype,"expandable",void 0),__decorate([property({type:Number,attribute:"virtualize-at"})],LyraNeighborList.prototype,"virtualizeAt",void 0),__decorate([property()],LyraNeighborList.prototype,"label",void 0);export{LyraNeighborList};
|
|
69
|
+
`}}__decorate([property({attribute:!1})],LyraNeighborList.prototype,"rows",void 0),__decorate([property({attribute:!1})],LyraNeighborList.prototype,"types",void 0),__decorate([property({type:Boolean,attribute:"group-by-relation"})],LyraNeighborList.prototype,"groupByRelation",void 0),__decorate([property({type:Boolean})],LyraNeighborList.prototype,"expandable",void 0),__decorate([property({type:Number,attribute:"virtualize-at"})],LyraNeighborList.prototype,"virtualizeAt",void 0),__decorate([property()],LyraNeighborList.prototype,"label",void 0),__decorate([property({attribute:!1})],LyraNeighborList.prototype,"graphSource",null),__decorate([property({attribute:!1})],LyraNeighborList.prototype,"centerKey",void 0),__decorate([property({attribute:"source-direction"})],LyraNeighborList.prototype,"sourceDirection",void 0),__decorate([property({attribute:!1})],LyraNeighborList.prototype,"sourceNodeTypes",null),__decorate([property({type:Number,attribute:"source-page"})],LyraNeighborList.prototype,"sourcePage",void 0),__decorate([property({type:Number,attribute:"source-page-size"})],LyraNeighborList.prototype,"sourcePageSize",void 0);export{LyraNeighborList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @deprecated Import @aceshooting/lyra-ui/components/lr-neighbor-list.js to register this component. */
|
|
2
|
-
export*from'./neighbor-list.class.js';import'../../overlays/empty/empty.js';
|
|
2
|
+
export*from'./neighbor-list.class.js';import'../../overlays/empty/empty.js';import'../../data/pagination/pagination.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./neighbor-list.class.js";import{LyraNeighborList}from"./neighbor-list.class.js";import{defineElement}from"../../../internal/prefix.js";import"../../overlays/empty/empty.js";defineElement("neighbor-list",LyraNeighborList);
|
|
1
|
+
export*from"./neighbor-list.class.js";import{LyraNeighborList}from"./neighbor-list.class.js";import{defineElement}from"../../../internal/prefix.js";import"../../overlays/empty/empty.js";import"../../data/pagination/pagination.js";defineElement("neighbor-list",LyraNeighborList);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; } [part='row'], lr-virtual-list::part(row) { display: flex; align-items: center; gap: var(--lr-space-xs); padding-block: var(--lr-space-xs); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); } [part='node-label'], lr-virtual-list::part(node-label) { flex: 1 1 auto; display: flex; align-items: baseline; gap: var(--lr-space-xs); box-sizing: border-box; ${iconHitTarget} padding: var(--lr-size-2px) 0; border: none; background: transparent; color: var(--lr-color-text); font: inherit; text-align: start; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part='node-label']:focus-visible, lr-virtual-list::part(node-label):focus-visible { ${focusRing} } [part='node-label']:hover, lr-virtual-list::part(node-label):hover { background: var(--lr-color-brand-quiet); } [part='node-label']:active, lr-virtual-list::part(node-label):active { background: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='direction'], lr-virtual-list::part(direction) { flex: 0 0 auto; color: var(--lr-color-text-quiet); } [part='relation'], lr-virtual-list::part(relation) { flex: 0 0 auto; color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } [part='node-meta'], lr-virtual-list::part(node-meta) { min-inline-size: 0; color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part='expand-button'], lr-virtual-list::part(expand-button) { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; inline-size: var(--lr-size-1-25rem); block-size: var(--lr-size-1-25rem); ${iconHitTarget} border: none; border-radius: var(--lr-radius-xs); background: transparent; color: var(--lr-color-text-quiet); font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part='expand-button']:hover, lr-virtual-list::part(expand-button):hover { background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } [part='expand-button']:active, lr-virtual-list::part(expand-button):active { background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='expand-button']:focus-visible, lr-virtual-list::part(expand-button):focus-visible { ${focusRing} } [part='group-header'], lr-virtual-list::part(group) { padding-block: var(--lr-space-xs); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); font-weight: var(--lr-font-weight-semibold); text-transform: uppercase; } `;export{styles};
|
|
1
|
+
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; } [part='source-summary'], [part='source-status'] { margin-block: var(--lr-space-xs); color: var(--lr-color-text-quiet); overflow-wrap: anywhere; } [part='source-retry'] { ${iconHitTarget} font: inherit; color: var(--lr-color-text); background: var(--lr-color-surface-raised); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-xs); cursor: pointer; transition: var(--lr-transition-interactive); } [part='source-retry']:hover { background: var(--lr-color-brand-quiet); } [part='source-retry']:active { background: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='source-retry']:focus-visible { ${focusRing} } [data-source-key] { min-inline-size: 0; overflow-wrap: anywhere; } [part='row'], lr-virtual-list::part(row) { display: flex; align-items: center; gap: var(--lr-space-xs); padding-block: var(--lr-space-xs); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); } [part='node-label'], lr-virtual-list::part(node-label) { flex: 1 1 auto; display: flex; align-items: baseline; gap: var(--lr-space-xs); box-sizing: border-box; ${iconHitTarget} padding: var(--lr-size-2px) 0; border: none; background: transparent; color: var(--lr-color-text); font: inherit; text-align: start; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part='node-label']:focus-visible, lr-virtual-list::part(node-label):focus-visible { ${focusRing} } [part='node-label']:hover, lr-virtual-list::part(node-label):hover { background: var(--lr-color-brand-quiet); } [part='node-label']:active, lr-virtual-list::part(node-label):active { background: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='direction'], lr-virtual-list::part(direction) { flex: 0 0 auto; color: var(--lr-color-text-quiet); } [part='relation'], lr-virtual-list::part(relation) { flex: 0 0 auto; color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } [part='node-meta'], lr-virtual-list::part(node-meta) { min-inline-size: 0; color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part='expand-button'], lr-virtual-list::part(expand-button) { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; inline-size: var(--lr-size-1-25rem); block-size: var(--lr-size-1-25rem); ${iconHitTarget} border: none; border-radius: var(--lr-radius-xs); background: transparent; color: var(--lr-color-text-quiet); font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part='expand-button']:hover, lr-virtual-list::part(expand-button):hover { background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } [part='expand-button']:active, lr-virtual-list::part(expand-button):active { background: color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='expand-button']:focus-visible, lr-virtual-list::part(expand-button):focus-visible { ${focusRing} } [part='group-header'], lr-virtual-list::part(group) { padding-block: var(--lr-space-xs); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); font-weight: var(--lr-font-weight-semibold); text-transform: uppercase; } [part='limit'] { margin-block: var(--lr-space-xs); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-sm); } `;export{styles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';import'../../charts/chart/lite-chart.class.js';import'../../data/stat/stat.class.js';import'../../overlays/empty/empty.class.js';export type LyraRagEvaluationMetricCategory='retrieval'|'generation'|'system'|(string&{});export type LyraRagEvaluationMetricFormat='number'|'percent';export interface LyraRagEvaluationMetric{id:string;label:string;category:LyraRagEvaluationMetricCategory;format?:LyraRagEvaluationMetricFormat;}export interface LyraRagEvaluationRun{id:string;label:string;metrics:Record<string,number>;slice?:string;timestamp?:string;metadata?:Record<string,unknown>;}export interface LyraRagEvalDashboardEventMap{'lr-metric-change-request':CustomEvent<{metricId:string;}>;
|
|
1
|
+
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';import'../../charts/chart/lite-chart.class.js';import'../../data/stat/stat.class.js';import'../../overlays/empty/empty.class.js';export type LyraRagEvaluationMetricCategory='retrieval'|'generation'|'system'|(string&{});export type LyraRagEvaluationMetricFormat='number'|'percent';export interface LyraRagEvaluationMetric{id:string;label:string;category:LyraRagEvaluationMetricCategory;format?:LyraRagEvaluationMetricFormat;}export interface LyraRagEvaluationRun{id:string;label:string;metrics:Record<string,number>;slice?:string;timestamp?:string;metadata?:Record<string,unknown>;}export interface LyraRagEvalDashboardEventMap{'lr-metric-change-request':CustomEvent<{metricId:string;}>;
|
|
2
2
|
/** @deprecated Use `lr-metric-change-request`. */
|
|
3
3
|
'lr-metric-change':CustomEvent<{metricId:string;}>;'lr-slice-change-request':CustomEvent<{slice:string;}>;
|
|
4
4
|
/** @deprecated Use `lr-slice-change-request`. */
|
|
@@ -20,7 +20,9 @@ import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/l
|
|
|
20
20
|
* At most the 500 most recent of the currently filtered runs (the array end is newest) render as
|
|
21
21
|
* `[part="run"]` buttons and feed the trend chart; a filtered set past that length renders a
|
|
22
22
|
* localized `[part="limit"]` notice after the run history rather than mounting an unbounded number
|
|
23
|
-
* of rows.
|
|
23
|
+
* of rows. Runs retain the newest admitted tail. At most 500 slice controls, including All,
|
|
24
|
+
* render with an available controlled slice reserved. Metrics use the full admitted filtered set;
|
|
25
|
+
* input-limit and slices-limit disclose admission and facet omissions separately.
|
|
24
26
|
*
|
|
25
27
|
* Nothing here changes on a click: the host owns `metricId`, `slice` and the selected run, and the
|
|
26
28
|
* events only report what the user asked for.
|
|
@@ -35,6 +37,8 @@ import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/l
|
|
|
35
37
|
* @event lr-run-activate - An evaluation run was activated. `detail: { runId, run }`.
|
|
36
38
|
* @event lr-run-change - Deprecated alias of `lr-run-activate` (`detail: { run }`), dispatched right
|
|
37
39
|
* after it.
|
|
40
|
+
* @csspart input-limit - Original run admission-loss notice.
|
|
41
|
+
* @csspart slices-limit - Notice of available slices outside the bounded controls.
|
|
38
42
|
* @csspart base - The named dashboard region.
|
|
39
43
|
* @csspart heading - The visible dashboard heading.
|
|
40
44
|
* @csspart slices - Slice filter controls.
|
|
@@ -55,7 +59,7 @@ import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/l
|
|
|
55
59
|
* @status stable
|
|
56
60
|
* @since 7.0.0
|
|
57
61
|
*/
|
|
58
|
-
export declare class LyraRagEvalDashboard extends LyraElement<LyraRagEvalDashboardEventMap>{protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];
|
|
62
|
+
export declare class LyraRagEvalDashboard extends LyraElement<LyraRagEvalDashboardEventMap>{protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly ownedCollectionProperties:readonly string[];protected static readonly appendOrderedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];
|
|
59
63
|
/** Metric definitions shown as controls and used to format run values. */
|
|
60
64
|
metrics:readonly LyraRagEvaluationMetric[];
|
|
61
65
|
/** Evaluation runs displayed in the trend chart and run history. */
|
|
@@ -78,4 +82,4 @@ withoutChart:boolean;
|
|
|
78
82
|
* `none` keeps the visible text without heading semantics. */
|
|
79
83
|
headingLevel:LyraHeadingLevel;
|
|
80
84
|
/** CSS block size forwarded to the composed trend chart. */
|
|
81
|
-
chartHeight:string;private metricsCache?;private runsCache?;private rovingRunId;private get normalizedMetrics();private get normalizedRuns();private activeMetric;private slices;private filteredRuns;private formatMetric;private latestValue;private requestMetric;private requestSlice;private activateRun;private onRunKeyDown;private renderSlices;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-rag-eval-dashboard':LyraRagEvalDashboard;}}
|
|
85
|
+
chartHeight:string;private metricsCache?;private runsCache?;private rovingRunId;private activeMetricCache?;private get normalizedMetrics();private get normalizedRuns();private readonly inputAnnouncements;private lastInputNotice;private inputNoticeMounted;private derivationCache?;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected updated(changed:PropertyValues):void;private inputLimitMessage;private derived;private activeMetric;private slices;private filteredRuns;private formatMetric;private latestValue;private requestMetric;private requestSlice;private activateRun;private onRunKeyDown;private slicesLimitMessage;private renderSlices;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-rag-eval-dashboard':LyraRagEvalDashboard;}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity,isNonBlankIdentity,isRecord}from"../retrieval-identity.js";import{finiteRange}from"../../../internal/numbers.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import"../../charts/chart/lite-chart.class.js";import"../../data/stat/stat.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./rag-eval-dashboard.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_ragEvalDashboardAllSlices,LYRA_DEFAULT_ragEvalDashboardEmpty,LYRA_DEFAULT_ragEvalDashboardLabel,LYRA_DEFAULT_ragEvalDashboardRuns,LYRA_DEFAULT_ragEvalDashboardSliceUnavailable,LYRA_DEFAULT_ragEvalDashboardSlices}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_ragEvalDashboardRunsLimit}from"../../../internal/default-strings/shared.generated.js";const MAX_RENDERED_RUNS=500;class LyraRagEvalDashboard extends LyraElement{constructor(){super(...arguments),this.metrics=[],this.runs=[],this.metricId="",this.slice="",this.withoutChart=!1,this.headingLevel="2",this.chartHeight="220px",this.rovingRunId=""}static{this.defaultStrings={...super.defaultStrings,ragEvalDashboardAllSlices:LYRA_DEFAULT_ragEvalDashboardAllSlices,ragEvalDashboardEmpty:LYRA_DEFAULT_ragEvalDashboardEmpty,ragEvalDashboardLabel:LYRA_DEFAULT_ragEvalDashboardLabel,ragEvalDashboardRuns:LYRA_DEFAULT_ragEvalDashboardRuns,ragEvalDashboardRunsLimit:LYRA_DEFAULT_ragEvalDashboardRunsLimit,ragEvalDashboardSliceUnavailable:LYRA_DEFAULT_ragEvalDashboardSliceUnavailable,ragEvalDashboardSlices:LYRA_DEFAULT_ragEvalDashboardSlices}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["metrics","runs"])}static{this.styles=[LyraElement.styles,styles]}get normalizedMetrics(){return this.metricsCache?.source!==this.metrics&&(this.metricsCache={source:this.metrics,value:firstByRetrievalIdentity(Array.isArray(this.metrics)?this.metrics:[],metric=>metric.id)}),this.metricsCache.value}get normalizedRuns(){return this.runsCache?.source!==this.runs&&(this.runsCache={source:this.runs,value:firstByRetrievalIdentity(Array.isArray(this.runs)?this.runs.filter(run=>isRecord(run)&&isNonBlankIdentity(run.id)&&typeof run.label=="string"&&isRecord(run.metrics)):[],run=>run.id)}),this.runsCache.value}activeMetric(metrics){return this.metricId?metrics.find(metric=>metric.id===this.metricId):metrics[0]}slices(runs){return[...new Set(runs.map(run=>run.slice).filter(slice=>!!slice))]}filteredRuns(runs){return this.slice?runs.filter(run=>run.slice===this.slice):runs}formatMetric(metric,raw){const value=Number.isFinite(raw)?raw:0;return metric.format==="percent"?getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:1}).format(finiteRange(value,0,0,1)):getNumberFormat(this.effectiveLocale,{maximumFractionDigits:3}).format(value)}latestValue(metric,runs){for(let index=runs.length-1;index>=0;index-=1){const value=runs[index].metrics[metric.id];if(Number.isFinite(value))return value}}requestMetric(metricId){this.emit("lr-metric-change-request",{metricId}),this.emit("lr-metric-change",{metricId})}requestSlice(slice){this.emit("lr-slice-change-request",{slice}),this.emit("lr-slice-change",{slice})}activateRun(run){this.emit("lr-run-activate",{runId:run.id,run}),this.emit("lr-run-change",{run})}onRunKeyDown(event,index,count){const buttons=this.shadowRoot?.querySelectorAll('[part="run"]'),next=resolveListMove(event,{count,current:index,orientation:"vertical",isAvailable:candidate=>!!(buttons?.[candidate]&&isRovingTargetAvailable(buttons[candidate]))});next!==null&&(event.preventDefault(),buttons?.[next]?.focus())}renderSlices(slices){if(!slices.length)return nothing;const allSlicesPart=this.slice?"slice":"slice slice-selected";return html`
|
|
1
|
+
import{__decorate}from"tslib";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{property}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity,isNonBlankIdentity,isRecord}from"../retrieval-identity.js";import{finiteRange}from"../../../internal/numbers.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import"../../charts/chart/lite-chart.class.js";import"../../data/stat/stat.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./rag-eval-dashboard.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_ragEvalDashboardAllSlices,LYRA_DEFAULT_ragEvalDashboardEmpty,LYRA_DEFAULT_ragEvalDashboardInputLimit,LYRA_DEFAULT_ragEvalDashboardLabel,LYRA_DEFAULT_ragEvalDashboardRuns,LYRA_DEFAULT_ragEvalDashboardSliceUnavailable,LYRA_DEFAULT_ragEvalDashboardSlices,LYRA_DEFAULT_ragEvalDashboardSlicesLimit}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_ragEvalDashboardRunsLimit}from"../../../internal/default-strings/shared.generated.js";const MAX_RENDERED_RUNS=500,MAX_SLICE_CONTROLS=500;class LyraRagEvalDashboard extends LyraElement{constructor(){super(...arguments),this.metrics=[],this.runs=[],this.metricId="",this.slice="",this.withoutChart=!1,this.headingLevel="2",this.chartHeight="220px",this.rovingRunId="",this.inputAnnouncements=new AnnouncementSinkController(this),this.lastInputNotice="",this.inputNoticeMounted=!1}static{this.defaultStrings={...super.defaultStrings,ragEvalDashboardAllSlices:LYRA_DEFAULT_ragEvalDashboardAllSlices,ragEvalDashboardEmpty:LYRA_DEFAULT_ragEvalDashboardEmpty,ragEvalDashboardInputLimit:LYRA_DEFAULT_ragEvalDashboardInputLimit,ragEvalDashboardLabel:LYRA_DEFAULT_ragEvalDashboardLabel,ragEvalDashboardRuns:LYRA_DEFAULT_ragEvalDashboardRuns,ragEvalDashboardRunsLimit:LYRA_DEFAULT_ragEvalDashboardRunsLimit,ragEvalDashboardSliceUnavailable:LYRA_DEFAULT_ragEvalDashboardSliceUnavailable,ragEvalDashboardSlices:LYRA_DEFAULT_ragEvalDashboardSlices,ragEvalDashboardSlicesLimit:LYRA_DEFAULT_ragEvalDashboardSlicesLimit}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["metrics","runs"])}static{this.appendOrderedCollectionProperties=Object.freeze(["runs"])}static{this.styles=[LyraElement.styles,styles]}get normalizedMetrics(){return this.metricsCache?.source!==this.metrics&&(this.metricsCache={source:this.metrics,value:firstByRetrievalIdentity(Array.isArray(this.metrics)?this.metrics:[],metric=>metric.id)}),this.metricsCache.value}get normalizedRuns(){return this.runsCache?.source!==this.runs&&(this.runsCache={source:this.runs,value:firstByRetrievalIdentity(Array.isArray(this.runs)?this.runs.filter(run=>isRecord(run)&&isNonBlankIdentity(run.id)&&typeof run.label=="string"&&isRecord(run.metrics)):[],run=>run.id)}),this.runsCache.value}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.inputNoticeMounted=!1}adoptedCallback(){super.adoptedCallback(),this.inputAnnouncements.adopted()}updated(changed){super.updated(changed);const derived=this.derivationCache,notice=[this.inputLimitMessage(),derived?this.slicesLimitMessage(derived.visibleSlices.length,derived.slices.length):""].filter(Boolean).join(" ");this.inputNoticeMounted&¬ice&¬ice!==this.lastInputNotice&&this.inputAnnouncements.announcePolite(notice),this.lastInputNotice=notice,this.inputNoticeMounted=!0}inputLimitMessage(){const loss=publicCollectionTruncation(this,"runs"),format=getNumberFormat(this.effectiveLocale);return loss?this.localize("ragEvalDashboardInputLimit",void 0,{count:format.format(loss.retained),total:format.format(loss.source)}):""}derived(runs,metrics){if(this.derivationCache?.runs===runs&&this.derivationCache.metrics===metrics&&this.derivationCache.slice===this.slice)return this.derivationCache;const slices=this.derivationCache?.runs===runs?this.derivationCache.slices:this.slices(runs),filtered=this.filteredRuns(runs),sliceAvailable=!this.slice||slices.includes(this.slice),visibleSlices=slices.slice(0,MAX_SLICE_CONTROLS-1);return this.slice&&sliceAvailable&&!visibleSlices.includes(this.slice)&&(visibleSlices[visibleSlices.length-1]=this.slice),this.derivationCache={runs,metrics,slice:this.slice,slices,visibleSlices,sliceAvailable,filtered,rendered:filtered.slice(-MAX_RENDERED_RUNS),latest:new Map(metrics.map(metric=>[metric.id,this.latestValue(metric,filtered)]))}}activeMetric(metrics){if(this.activeMetricCache?.metrics===metrics&&this.activeMetricCache.id===this.metricId)return this.activeMetricCache.value;const value=this.metricId?metrics.find(metric=>metric.id===this.metricId):metrics[0];return this.activeMetricCache={metrics,id:this.metricId,value},value}slices(runs){return[...new Set(runs.map(run=>run.slice).filter(slice=>!!slice))]}filteredRuns(runs){return this.slice?runs.filter(run=>run.slice===this.slice):runs}formatMetric(metric,raw){const value=Number.isFinite(raw)?raw:0;return metric.format==="percent"?getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:1}).format(finiteRange(value,0,0,1)):getNumberFormat(this.effectiveLocale,{maximumFractionDigits:3}).format(value)}latestValue(metric,runs){for(let index=runs.length-1;index>=0;index-=1){const value=runs[index].metrics[metric.id];if(Number.isFinite(value))return value}}requestMetric(metricId){this.emit("lr-metric-change-request",{metricId}),this.emit("lr-metric-change",{metricId})}requestSlice(slice){this.emit("lr-slice-change-request",{slice}),this.emit("lr-slice-change",{slice})}activateRun(run){this.emit("lr-run-activate",{runId:run.id,run}),this.emit("lr-run-change",{run})}onRunKeyDown(event,index,count){const buttons=this.shadowRoot?.querySelectorAll('[part="run"]'),next=resolveListMove(event,{count,current:index,orientation:"vertical",isAvailable:candidate=>!!(buttons?.[candidate]&&isRovingTargetAvailable(buttons[candidate]))});next!==null&&(event.preventDefault(),buttons?.[next]?.focus())}slicesLimitMessage(count,total){return total>count?this.localize("ragEvalDashboardSlicesLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(count),total:getNumberFormat(this.effectiveLocale).format(total)}):""}renderSlices(slices,total=slices.length){if(!slices.length)return nothing;const allSlicesPart=this.slice?"slice":"slice slice-selected";return html`
|
|
2
2
|
<nav part="slices" aria-label=${this.localize("ragEvalDashboardSlices")}>
|
|
3
3
|
<button
|
|
4
4
|
part=${allSlicesPart}
|
|
@@ -20,37 +20,41 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
|
|
|
20
20
|
${slice}
|
|
21
21
|
</button>
|
|
22
22
|
`})}
|
|
23
|
+
${total>slices.length?html`<p part="slices-limit" role="note">${this.slicesLimitMessage(slices.length,total)}</p>`:nothing}
|
|
23
24
|
</nav>
|
|
24
|
-
`}render(){const metrics=this.normalizedMetrics,runs=this.normalizedRuns,
|
|
25
|
+
`}render(){const metrics=this.normalizedMetrics,runs=this.normalizedRuns,derived=this.derived(runs,metrics),slices=derived.slices,visibleLabel=this.label==null?this.localize("ragEvalDashboardLabel"):this.label,level=resolveHeadingLevel(this.headingLevel),runsLevel=level&&String(Math.min(6,+level+1)),label=retrievalSemanticLabel(this,visibleLabel),role=retrievalSemanticRole(this,"region");if(!runs.length)return html`<section
|
|
25
26
|
part="base"
|
|
26
27
|
role=${role??nothing}
|
|
27
28
|
aria-label=${label??nothing}
|
|
28
29
|
>
|
|
30
|
+
${this.inputLimitMessage()?html`<p part="input-limit" role="note">${this.inputLimitMessage()}</p>`:nothing}
|
|
29
31
|
<lr-empty
|
|
30
32
|
part="empty"
|
|
31
33
|
heading=${this.localize("ragEvalDashboardEmpty")}
|
|
32
34
|
></lr-empty>
|
|
33
|
-
</section>`;const active=this.activeMetric(metrics),filtered=
|
|
35
|
+
</section>`;const active=this.activeMetric(metrics),filtered=derived.filtered;if(!derived.sliceAvailable)return html`
|
|
34
36
|
<section
|
|
35
37
|
part="base"
|
|
36
38
|
role=${role??nothing}
|
|
37
39
|
aria-label=${label??nothing}
|
|
38
40
|
>
|
|
41
|
+
${this.inputLimitMessage()?html`<p part="input-limit" role="note">${this.inputLimitMessage()}</p>`:nothing}
|
|
39
42
|
<div part="heading" role=${level?"heading":nothing} aria-level=${level??nothing}>${visibleLabel}</div>
|
|
40
|
-
${this.renderSlices(slices)}
|
|
43
|
+
${this.renderSlices(derived.visibleSlices,slices.length)}
|
|
41
44
|
<lr-empty
|
|
42
45
|
part="empty"
|
|
43
46
|
heading=${this.localize("ragEvalDashboardSliceUnavailable",void 0,{slice:this.slice})}
|
|
44
47
|
></lr-empty>
|
|
45
48
|
</section>
|
|
46
|
-
`;const runsTruncated=filtered.length>MAX_RENDERED_RUNS,renderedRuns=
|
|
49
|
+
`;const runsTruncated=filtered.length>MAX_RENDERED_RUNS,renderedRuns=derived.rendered,rovingRunId=renderedRuns.some(run=>run.id===this.rovingRunId)?this.rovingRunId:renderedRuns[0]?.id;return html`
|
|
47
50
|
<section
|
|
48
51
|
part="base"
|
|
49
52
|
role=${role??nothing}
|
|
50
53
|
aria-label=${label??nothing}
|
|
51
54
|
>
|
|
55
|
+
${this.inputLimitMessage()?html`<p part="input-limit" role="note">${this.inputLimitMessage()}</p>`:nothing}
|
|
52
56
|
<div part="heading" role=${level?"heading":nothing} aria-level=${level??nothing}>${visibleLabel}</div>
|
|
53
|
-
${this.renderSlices(slices)}
|
|
57
|
+
${this.renderSlices(derived.visibleSlices,slices.length)}
|
|
54
58
|
<div part="metrics">
|
|
55
59
|
${metrics.map(metric=>{const selected=metric.id===active?.id;return html`
|
|
56
60
|
<button
|
|
@@ -63,7 +67,7 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
|
|
|
63
67
|
<lr-stat
|
|
64
68
|
frame="plain"
|
|
65
69
|
.label=${metric.label}
|
|
66
|
-
.value=${this.formatMetric(metric,
|
|
70
|
+
.value=${this.formatMetric(metric,derived.latest.get(metric.id))}
|
|
67
71
|
></lr-stat>
|
|
68
72
|
<span part="metric-category">${metric.category}</span>
|
|
69
73
|
</button>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{compactContainerQuery}from"../../../internal/container-breakpoints.styles.js";const styles=css` :host { display: block; container-type: inline-size; contain-intrinsic-inline-size: var(--lr-size-20rem); } [part='base'] { display: flex; flex-direction: column; gap: var(--lr-space-m); } [part='heading'], [part='runs-heading'] { margin: 0; color: var(--lr-color-text); font-size: var(--lr-font-size-lg); } [part='slices'] { display: flex; flex-wrap: wrap; gap: var(--lr-space-xs); } [part~='slice'], [part~='metric'], [part='run'] { box-sizing: border-box; ${iconHitTarget} 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); font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part~='slice'] { min-inline-size: var(--lr-icon-button-size); padding: var(--lr-space-xs) var(--lr-space-s); } [part~='metric'] { display: grid; gap: var(--lr-space-2xs); padding: var(--lr-space-xs); text-align: start; } [part~='slice-selected'], [part~='metric-selected'] { border-color: var( --lr-rag-eval-dashboard-selected-border-color, var(--lr-color-brand) ); } @media (forced-colors: active) { [part~='slice-selected'], [part~='metric-selected'] { outline: var(--lr-border-width-medium) solid Highlight; outline-offset: calc(-1 * var(--lr-border-width-medium)); } } [part='metric-category'] { color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); overflow-wrap: anywhere; } [part~='slice-selected'] { ${iconHitTarget} } [part~='slice']:hover, [part~='metric']:hover, [part='run']:hover { background: var(--lr-color-surface-raised); } [part~='slice']:active, [part~='metric']:active, [part='run']:active { background: color-mix( in oklab, var(--lr-color-surface-raised), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part~='slice']:focus-visible, [part~='metric']:focus-visible, [part='run']:focus-visible { ${focusRing} } [part='metrics'] { display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--lr-size-10rem), 1fr)); gap: var(--lr-space-s); } [part='chart'] { min-inline-size: 0; } [part='runs'] { display: flex; flex-direction: column; gap: var(--lr-space-xs); } [part='run'] { display: flex; justify-content: space-between; gap: var(--lr-space-s); align-items: center; inline-size: 100%; padding: var(--lr-space-s); text-align: start; } @container ${compactContainerQuery} { [part='metrics'] { grid-template-columns: 1fr; } [part='run'] { align-items: flex-start; flex-direction: column; } } [part='limit'] { margin: var(--lr-space-s); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } `;export{styles};
|
|
1
|
+
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{compactContainerQuery}from"../../../internal/container-breakpoints.styles.js";const styles=css` [part='input-limit'], [part='slices-limit'] { margin: 0; font-size: var(--lr-font-size-sm); color: var(--lr-color-text-quiet); overflow-wrap: anywhere; } :host { display: block; container-type: inline-size; contain-intrinsic-inline-size: var(--lr-size-20rem); } [part='base'] { display: flex; flex-direction: column; gap: var(--lr-space-m); } [part='heading'], [part='runs-heading'] { margin: 0; color: var(--lr-color-text); font-size: var(--lr-font-size-lg); } [part='slices'] { display: flex; flex-wrap: wrap; gap: var(--lr-space-xs); } [part~='slice'], [part~='metric'], [part='run'] { box-sizing: border-box; ${iconHitTarget} 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); font: inherit; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part~='slice'] { min-inline-size: var(--lr-icon-button-size); padding: var(--lr-space-xs) var(--lr-space-s); } [part~='metric'] { display: grid; gap: var(--lr-space-2xs); padding: var(--lr-space-xs); text-align: start; } [part~='slice-selected'], [part~='metric-selected'] { border-color: var( --lr-rag-eval-dashboard-selected-border-color, var(--lr-color-brand) ); } @media (forced-colors: active) { [part~='slice-selected'], [part~='metric-selected'] { outline: var(--lr-border-width-medium) solid Highlight; outline-offset: calc(-1 * var(--lr-border-width-medium)); } } [part='metric-category'] { color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); overflow-wrap: anywhere; } [part~='slice-selected'] { ${iconHitTarget} } [part~='slice']:hover, [part~='metric']:hover, [part='run']:hover { background: var(--lr-color-surface-raised); } [part~='slice']:active, [part~='metric']:active, [part='run']:active { background: color-mix( in oklab, var(--lr-color-surface-raised), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part~='slice']:focus-visible, [part~='metric']:focus-visible, [part='run']:focus-visible { ${focusRing} } [part='metrics'] { display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--lr-size-10rem), 1fr)); gap: var(--lr-space-s); } [part='chart'] { min-inline-size: 0; } [part='runs'] { display: flex; flex-direction: column; gap: var(--lr-space-xs); } [part='run'] { display: flex; justify-content: space-between; gap: var(--lr-space-s); align-items: center; inline-size: 100%; padding: var(--lr-space-s); text-align: start; } @container ${compactContainerQuery} { [part='metrics'] { grid-template-columns: 1fr; } [part='run'] { align-items: flex-start; flex-direction: column; } } [part='limit'] { margin: var(--lr-space-s); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } `;export{styles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type{LyraFrame,LyraSize}from'../../../internal/variants.js';import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type TemplateResult}from'lit';import type{RetrievalChunk}from'../../../ai/types.js';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';import'../../overlays/empty/empty.class.js';export interface RetrievalComparisonSet{id:string;label:string;chunks:RetrievalChunk[];}export interface LyraRetrievalCompareEventMap{'lr-chunk-select':CustomEvent<LyraEventDetailSnapshot<{setId:string;chunk:RetrievalChunk;}>>;}
|
|
1
|
+
import type{LyraFrame,LyraSize}from'../../../internal/variants.js';import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import type{RetrievalChunk}from'../../../ai/types.js';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';import'../../overlays/empty/empty.class.js';export interface RetrievalComparisonSet{id:string;label:string;chunks:RetrievalChunk[];}export interface LyraRetrievalCompareEventMap{'lr-chunk-select':CustomEvent<LyraEventDetailSnapshot<{setId:string;chunk:RetrievalChunk;}>>;}
|
|
2
2
|
/**
|
|
3
3
|
* `<lr-retrieval-compare>` — a side-by-side retrieval/reranking workbench that makes rank,
|
|
4
4
|
* overlap, and dense/sparse/rerank/final score changes inspectable. It never performs retrieval.
|
|
@@ -11,7 +11,12 @@ import type{LyraFrame,LyraSize}from'../../../internal/variants.js';import type{L
|
|
|
11
11
|
* @customElement lr-retrieval-compare
|
|
12
12
|
* @event lr-chunk-select - A result was activated. `detail: { setId, chunk }`.
|
|
13
13
|
* @csspart base - The named comparison region.
|
|
14
|
-
* @csspart overlap -
|
|
14
|
+
* @csspart overlap - Pairwise top-k Jaccard overlap for the current page of at most eight sets.
|
|
15
|
+
* @csspart input-limit - The input-admission loss notice.
|
|
16
|
+
* @csspart result-limit - Retained/result counts for a column's top-k subset.
|
|
17
|
+
* @csspart pagination - Internal comparison page controls.
|
|
18
|
+
* @csspart page-status - Localized current page and page count.
|
|
19
|
+
* @csspart page-button - One page navigation button.
|
|
15
20
|
* @csspart sets - Horizontally scrollable set grid.
|
|
16
21
|
* @csspart set - One result-set column.
|
|
17
22
|
* @csspart set-heading - A caller-supplied result-set label.
|
|
@@ -29,11 +34,12 @@ import type{LyraFrame,LyraSize}from'../../../internal/variants.js';import type{L
|
|
|
29
34
|
* @status stable
|
|
30
35
|
* @since 7.0.0
|
|
31
36
|
*/
|
|
32
|
-
export declare class LyraRetrievalCompare extends LyraElement<LyraRetrievalCompareEventMap>{private readonly rovingChunkBySet;private onChunkKeyDown;protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];protected static readonly immutableEventDetails:readonly string[];
|
|
33
|
-
/** Named retrieval
|
|
37
|
+
export declare class LyraRetrievalCompare extends LyraElement<LyraRetrievalCompareEventMap>{private page;private readonly announcements;private canonicalSource?;private canonicalSets;private readonly rankedBySet;private comparisonDeps?;private visibleSets;private visibleOrdered;private visibleOverlaps;private pendingFocus?;private readonly rovingChunkBySet;private onChunkKeyDown;protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];protected static readonly immutableEventDetails:readonly string[];
|
|
38
|
+
/** Named retrieval sets, shown in internal pages of eight columns; pairwise overlap covers
|
|
39
|
+
* only the current page. Every admitted set remains reachable through page controls. */
|
|
34
40
|
sets:readonly RetrievalComparisonSet[];
|
|
35
41
|
/** Maximum ranked chunks shown from each set, ordered by effective rank (an explicit `rank`,
|
|
36
|
-
* else input position) and then score. */
|
|
42
|
+
* else input position) and then score. Rendering is capped at 100 per set. */
|
|
37
43
|
topK:number;
|
|
38
44
|
/** Controlled chunk id highlighted across every set that contains it. */
|
|
39
45
|
selectedChunkId:string;
|
|
@@ -46,4 +52,4 @@ label?:string;
|
|
|
46
52
|
/** Density on the shared size scale. `s` (and the smaller `xs`/`2xs`) tightens chunk-button padding; `m` (the default) and larger keep the full padding. */
|
|
47
53
|
size:LyraSize;
|
|
48
54
|
/** Container treatment, in the shared `LyraFrame` vocabulary. `'card'` (the default) keeps each compared chunk's bordered, filled button. `'plain'` removes the border, background and corner radius from every compared chunk button, for use inside an already-bordered container. */
|
|
49
|
-
frame:LyraFrame;private readonly headingIdPrefix;private get effectiveTopK();private get normalizedSets();private orderedChunks;private rank;private formatScore;private overlaps;private scoreEntries;private renderSet;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-retrieval-compare':LyraRetrievalCompare;}}
|
|
55
|
+
frame:LyraFrame;private readonly headingIdPrefix;private get effectiveTopK();private get normalizedSets();private orderedChunks;private updateComparison;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;adoptedCallback():void;disconnectedCallback():void;private changePage;private pageText;private renderPagination;private rank;private formatScore;private overlaps;private scoreEntries;private renderSet;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-retrieval-compare':LyraRetrievalCompare;}}
|