@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,14 +1,15 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{nextId}from"../../../internal/a11y.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,isValidRetrievalChunk}from"../retrieval-identity.js";import{finiteCount,finiteRange}from"../../../internal/numbers.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import"../../overlays/empty/empty.class.js";import{styles}from"./retrieval-compare.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_retrievalCompareDenseScore,LYRA_DEFAULT_retrievalCompareEmpty,LYRA_DEFAULT_retrievalCompareFinalScore,LYRA_DEFAULT_retrievalCompareLabel,LYRA_DEFAULT_retrievalCompareOverlap,LYRA_DEFAULT_retrievalCompareRank,LYRA_DEFAULT_retrievalCompareRerankScore,LYRA_DEFAULT_retrievalCompareSparseScore,LYRA_DEFAULT_untitledSource}from"../../../internal/default-strings/retrieval.generated.js";class LyraRetrievalCompare extends LyraElement{constructor(){super(...arguments),this.rovingChunkBySet=new Map,this.sets=[],this.topK=10,this.selectedChunkId="",this.headingLevel="3",this.size="m",this.frame="card",this.headingIdPrefix=nextId("retrieval-compare"),this.renderSet=(set,setIndex,chunks)=>{const headingId=`${this.headingIdPrefix}-set-${setIndex}`,level=resolveHeadingLevel(this.headingLevel),remembered=this.rovingChunkBySet.get(set.id),rovingChunkId=chunks.some(chunk=>chunk.id===remembered)?remembered:chunks[0]?.id;return html`
|
|
2
|
-
<section part="set" aria-labelledby=${headingId}>
|
|
1
|
+
import{__decorate}from"tslib";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{activeElementIn,shadowFocusTarget}from"../../../internal/active-element.js";import{repeat}from"lit/directives/repeat.js";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{nextId}from"../../../internal/a11y.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,isValidRetrievalChunk}from"../retrieval-identity.js";import{finiteCount,finiteRange}from"../../../internal/numbers.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import"../../overlays/empty/empty.class.js";import{styles}from"./retrieval-compare.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_retrievalCompareDenseScore,LYRA_DEFAULT_retrievalCompareEmpty,LYRA_DEFAULT_retrievalCompareFinalScore,LYRA_DEFAULT_retrievalCompareInputLimit,LYRA_DEFAULT_retrievalCompareLabel,LYRA_DEFAULT_retrievalCompareOverlap,LYRA_DEFAULT_retrievalCompareRank,LYRA_DEFAULT_retrievalCompareRerankScore,LYRA_DEFAULT_retrievalCompareResultLimit,LYRA_DEFAULT_retrievalCompareSparseScore,LYRA_DEFAULT_untitledSource}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_next,LYRA_DEFAULT_paginationApplied,LYRA_DEFAULT_paginationFirstPage,LYRA_DEFAULT_paginationLabel,LYRA_DEFAULT_paginationLastPage,LYRA_DEFAULT_previous}from"../../../internal/default-strings/shared.generated.js";const COMPARISON_PAGE_SIZE=8,MAX_COMPARISON_RESULTS=100;class LyraRetrievalCompare extends LyraElement{constructor(){super(...arguments),this.page=0,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.canonicalSets=[],this.rankedBySet=new WeakMap,this.visibleSets=[],this.visibleOrdered=new Map,this.visibleOverlaps=[],this.rovingChunkBySet=new Map,this.sets=[],this.topK=10,this.selectedChunkId="",this.headingLevel="3",this.size="m",this.frame="card",this.headingIdPrefix=nextId("retrieval-compare"),this.renderSet=(set,setIndex,chunks)=>{const headingId=`${this.headingIdPrefix}-set-${setIndex}`,level=resolveHeadingLevel(this.headingLevel),remembered=this.rovingChunkBySet.get(set.id),rovingChunkId=chunks.some(chunk=>chunk.id===remembered)?remembered:chunks[0]?.id;return html`
|
|
2
|
+
<section part="set" data-set-id=${set.id} aria-labelledby=${headingId}>
|
|
3
3
|
<div part="set-heading" id=${headingId} role=${level?"heading":nothing} aria-level=${level??nothing}>${set.label}</div>
|
|
4
4
|
<ol part="chunks">
|
|
5
|
-
${chunks.
|
|
5
|
+
${repeat(chunks,chunk=>chunk.id,(chunk,index)=>{const selected=chunk.id===this.selectedChunkId,rank=this.rankedBySet.get(set)?.ranks.get(chunk)??this.rank(chunk,index),chunkPart=selected?"chunk chunk-selected":"chunk",id=`${headingId}-chunk-${index}`;return html`
|
|
6
6
|
<li>
|
|
7
7
|
<button
|
|
8
8
|
part=${chunkPart}
|
|
9
|
+
data-chunk-id=${chunk.id}
|
|
9
10
|
type="button"
|
|
10
11
|
tabindex=${chunk.id===rovingChunkId?"0":"-1"}
|
|
11
|
-
@focus=${()=>{this.rovingChunkBySet.set(set.id,chunk.id),this.requestUpdate()}}
|
|
12
|
+
@focus=${()=>{this.rovingChunkBySet.set(set.id,chunk.id),chunk.id!==rovingChunkId&&this.requestUpdate()}}
|
|
12
13
|
@keydown=${event=>this.onChunkKeyDown(event,index,chunks.length)}
|
|
13
14
|
aria-pressed=${selected?"true":"false"}
|
|
14
15
|
aria-labelledby="${id}-rank ${id}-title"
|
|
@@ -34,25 +35,37 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
|
|
|
34
35
|
</li>
|
|
35
36
|
`})}
|
|
36
37
|
</ol>
|
|
38
|
+
${(this.rankedBySet.get(set)?.total??0)>chunks.length?html`<p part="result-limit" role="note">${this.localize("retrievalCompareResultLimit",void 0,{shown:getNumberFormat(this.effectiveLocale).format(chunks.length),total:getNumberFormat(this.effectiveLocale).format(this.rankedBySet.get(set).total)})}</p>`:nothing}
|
|
37
39
|
</section>
|
|
38
|
-
`}}static{this.defaultStrings={...super.defaultStrings,retrievalCompareDenseScore:LYRA_DEFAULT_retrievalCompareDenseScore,retrievalCompareEmpty:LYRA_DEFAULT_retrievalCompareEmpty,retrievalCompareFinalScore:LYRA_DEFAULT_retrievalCompareFinalScore,retrievalCompareLabel:LYRA_DEFAULT_retrievalCompareLabel,retrievalCompareOverlap:LYRA_DEFAULT_retrievalCompareOverlap,retrievalCompareRank:LYRA_DEFAULT_retrievalCompareRank,retrievalCompareRerankScore:LYRA_DEFAULT_retrievalCompareRerankScore,retrievalCompareSparseScore:LYRA_DEFAULT_retrievalCompareSparseScore,untitledSource:LYRA_DEFAULT_untitledSource}}onChunkKeyDown(event,index,count){const buttons=event.currentTarget.closest('[part="chunks"]')?.querySelectorAll('[part~="chunk"]'),next=resolveListMove(event,{count,current:index,orientation:"vertical",isAvailable:candidate=>!!(buttons?.[candidate]&&isRovingTargetAvailable(buttons[candidate]))});next!==null&&(event.preventDefault(),buttons?.[next]?.focus())}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["sets"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-chunk-select"])}get effectiveTopK(){return Math.max(1,finiteCount(this.topK,10))}get normalizedSets(){
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
heading=${this.localize("retrievalCompareEmpty")}
|
|
46
|
-
></lr-empty>
|
|
47
|
-
</section>`;const ordered=new Map(sets.map(set=>[set.id,this.orderedChunks(set)])),overlaps=this.overlaps(sets,ordered);return html`
|
|
40
|
+
`}}static{this.defaultStrings={...super.defaultStrings,next:LYRA_DEFAULT_next,paginationApplied:LYRA_DEFAULT_paginationApplied,paginationFirstPage:LYRA_DEFAULT_paginationFirstPage,paginationLabel:LYRA_DEFAULT_paginationLabel,paginationLastPage:LYRA_DEFAULT_paginationLastPage,previous:LYRA_DEFAULT_previous,retrievalCompareDenseScore:LYRA_DEFAULT_retrievalCompareDenseScore,retrievalCompareEmpty:LYRA_DEFAULT_retrievalCompareEmpty,retrievalCompareFinalScore:LYRA_DEFAULT_retrievalCompareFinalScore,retrievalCompareInputLimit:LYRA_DEFAULT_retrievalCompareInputLimit,retrievalCompareLabel:LYRA_DEFAULT_retrievalCompareLabel,retrievalCompareOverlap:LYRA_DEFAULT_retrievalCompareOverlap,retrievalCompareRank:LYRA_DEFAULT_retrievalCompareRank,retrievalCompareRerankScore:LYRA_DEFAULT_retrievalCompareRerankScore,retrievalCompareResultLimit:LYRA_DEFAULT_retrievalCompareResultLimit,retrievalCompareSparseScore:LYRA_DEFAULT_retrievalCompareSparseScore,untitledSource:LYRA_DEFAULT_untitledSource}}onChunkKeyDown(event,index,count){const buttons=event.currentTarget.closest('[part="chunks"]')?.querySelectorAll('[part~="chunk"]'),next=resolveListMove(event,{count,current:index,orientation:"vertical",isAvailable:candidate=>!!(buttons?.[candidate]&&isRovingTargetAvailable(buttons[candidate]))});next!==null&&(event.preventDefault(),buttons?.[next]?.focus())}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["sets"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-chunk-select"])}get effectiveTopK(){return Math.min(MAX_COMPARISON_RESULTS,Math.max(1,finiteCount(this.topK,10)))}get normalizedSets(){if(this.canonicalSource!==this.sets){this.canonicalSource=this.sets,this.canonicalSets=firstByRetrievalIdentity(Array.isArray(this.sets)?this.sets:[],set=>set.id);const ids=new Set(this.canonicalSets.map(set=>set.id));for(const id of this.rovingChunkBySet.keys())ids.has(id)||this.rovingChunkBySet.delete(id)}return this.canonicalSets}orderedChunks(set){const cached=this.rankedBySet.get(set);if(cached?.topK===this.effectiveTopK)return cached.chunks;const ranked=firstByRetrievalIdentity(Array.isArray(set.chunks)?set.chunks.filter(isValidRetrievalChunk):[],chunk=>chunk.id).map((chunk,index)=>({chunk,index,rank:this.rank(chunk,index)})).sort((a,b)=>a.rank-b.rank||b.chunk.score-a.chunk.score||a.index-b.index),visible=ranked.slice(0,this.effectiveTopK),chunks=visible.map(({chunk})=>chunk);return this.rankedBySet.set(set,{topK:this.effectiveTopK,chunks,total:ranked.length,ranks:new Map(visible.map(entry=>[entry.chunk,entry.rank]))}),chunks}updateComparison(){const sets=this.normalizedSets;this.page=Math.min(this.page,Math.max(0,Math.ceil(sets.length/COMPARISON_PAGE_SIZE)-1));const deps=[sets,this.effectiveTopK,this.page];this.comparisonDeps&&deps.every((value,index)=>value===this.comparisonDeps[index])||(this.comparisonDeps=deps,this.visibleSets=sets.slice(this.page*COMPARISON_PAGE_SIZE,(this.page+1)*COMPARISON_PAGE_SIZE),this.visibleOrdered=new Map(this.visibleSets.map(set=>[set.id,this.orderedChunks(set)])),this.visibleOverlaps=this.overlaps(this.visibleSets,this.visibleOrdered))}willUpdate(changed){if(super.willUpdate(changed),changed.has("sets")||changed.has("topK")||changed.has("page")){const focused=shadowFocusTarget(this),setId=focused?.closest("[data-set-id]")?.dataset.setId,chunkId=focused?.dataset.chunkId,pageAction=focused?.dataset.pageAction;if(focused&&pageAction&&(this.pendingFocus={pageAction,origin:focused}),focused&&setId&&chunkId&&(changed.has("sets")||changed.has("topK"))){const index=this.normalizedSets.findIndex(set=>set.id===setId);index>=0&&(this.page=Math.floor(index/COMPARISON_PAGE_SIZE)),this.pendingFocus={setId,chunkId,origin:focused}}this.hasUpdated&&changed.has("sets")&&publicCollectionTruncation(this,"sets")&&this.announcements.announcePolite(this.localize("retrievalCompareInputLimit"))}this.updateComparison()}updated(changed){super.updated(changed);const pending=this.pendingFocus;if(this.pendingFocus=void 0,!pending)return;const current=shadowFocusTarget(this),outer=activeElementIn(this.ownerDocument);if(current&¤t!==pending.origin||outer&&outer!==this&&outer!==this.ownerDocument.body)return;if(pending.pageAction){const pages=[...this.shadowRoot?.querySelectorAll("[data-page-action]:not(:disabled)")??[]],page=pages.find(button=>button.dataset.pageAction===pending.pageAction)??pages[0];if(page){current!==page&&page.focus();return}}const buttons=[...this.shadowRoot?.querySelectorAll("[data-chunk-id]")??[]],target=buttons.find(button=>button.dataset.chunkId===pending.chunkId&&button.closest("[data-set-id]")?.dataset.setId===pending.setId)??buttons[0]??this.shadowRoot?.querySelector('[part="base"]');current!==target&&target?.focus()}adoptedCallback(){super.adoptedCallback(),this.announcements.adopted()}disconnectedCallback(){this.pendingFocus=void 0,super.disconnectedCallback()}changePage(page){this.page=Math.max(0,Math.min(page,Math.ceil(this.normalizedSets.length/COMPARISON_PAGE_SIZE)-1)),this.announcements.announcePolite(this.pageText())}pageText(){const format=getNumberFormat(this.effectiveLocale);return this.localize("paginationApplied",void 0,{page:format.format(this.page+1),totalPages:format.format(Math.ceil(this.normalizedSets.length/COMPARISON_PAGE_SIZE))})}renderPagination(){const pages=Math.ceil(this.normalizedSets.length/COMPARISON_PAGE_SIZE);return pages>1?html`<div part="pagination" role="group" aria-label=${this.localize("paginationLabel")}>
|
|
41
|
+
<button part="page-button" data-page-action="first" type="button" ?disabled=${this.page===0} @click=${()=>this.changePage(0)}>${this.localize("paginationFirstPage")}</button>
|
|
42
|
+
<button part="page-button" data-page-action="previous" type="button" ?disabled=${this.page===0} @click=${()=>this.changePage(this.page-1)}>${this.localize("previous")}</button>
|
|
43
|
+
<span part="page-status">${this.pageText()}</span>
|
|
44
|
+
<button part="page-button" data-page-action="next" type="button" ?disabled=${this.page>=pages-1} @click=${()=>this.changePage(this.page+1)}>${this.localize("next")}</button>
|
|
45
|
+
<button part="page-button" data-page-action="last" type="button" ?disabled=${this.page>=pages-1} @click=${()=>this.changePage(pages-1)}>${this.localize("paginationLastPage")}</button>
|
|
46
|
+
</div>`:nothing}rank(chunk,index){return Math.max(1,finiteCount(typeof chunk.rank=="number"?chunk.rank:index+1,index+1))}formatScore(value){return getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:1}).format(finiteRange(value,0,0,1))}overlaps(sets,ordered){const summaries=[],identities=sets.map(set=>new Set((ordered.get(set.id)??[]).map(chunk=>chunk.id)));for(let leftIndex=0;leftIndex<sets.length;leftIndex++){const left=identities[leftIndex];for(let rightIndex=leftIndex+1;rightIndex<sets.length;rightIndex++){const right=identities[rightIndex];let intersection=0;for(const id of left)right.has(id)&&intersection++;const union=left.size+right.size-intersection;summaries.push({left:sets[leftIndex].label,right:sets[rightIndex].label,ratio:union?intersection/union:0})}}return summaries}scoreEntries(chunk){const scores=chunk.scores??{final:chunk.score};return[[this.localize("retrievalCompareDenseScore"),scores.dense],[this.localize("retrievalCompareSparseScore"),scores.sparse],[this.localize("retrievalCompareRerankScore"),scores.rerank],[this.localize("retrievalCompareFinalScore"),scores.final]].filter(entry=>typeof entry[1]=="number")}render(){this.updateComparison();const sets=this.visibleSets,inputLimit=publicCollectionTruncation(this,"sets")?html`<p part="input-limit" role="note">${this.localize("retrievalCompareInputLimit")}</p>`:nothing,label=retrievalSemanticLabel(this,this.label==null?this.localize("retrievalCompareLabel"):this.label),role=retrievalSemanticRole(this,"region");return sets.length?html`
|
|
48
47
|
<section
|
|
49
48
|
part="base"
|
|
49
|
+
tabindex="-1"
|
|
50
50
|
role=${role??nothing}
|
|
51
51
|
aria-label=${label??nothing}
|
|
52
52
|
>
|
|
53
|
-
${
|
|
53
|
+
${inputLimit}
|
|
54
|
+
${this.renderPagination()}
|
|
55
|
+
${this.visibleOverlaps.map(summary=>html`<p part="overlap">${this.localize("retrievalCompareOverlap",void 0,{left:summary.left,right:summary.right,percent:this.formatScore(summary.ratio)})}</p>`)}
|
|
54
56
|
<div part="sets">
|
|
55
|
-
${sets.
|
|
57
|
+
${repeat(sets,set=>set.id,(set,index)=>this.renderSet(set,this.page*COMPARISON_PAGE_SIZE+index,this.visibleOrdered.get(set.id)??[]))}
|
|
56
58
|
</div>
|
|
57
59
|
</section>
|
|
58
|
-
|
|
60
|
+
`:html`<section
|
|
61
|
+
part="base"
|
|
62
|
+
tabindex="-1"
|
|
63
|
+
role=${role??nothing}
|
|
64
|
+
aria-label=${label??nothing}
|
|
65
|
+
>
|
|
66
|
+
${inputLimit}
|
|
67
|
+
<lr-empty
|
|
68
|
+
part="empty"
|
|
69
|
+
heading=${this.localize("retrievalCompareEmpty")}
|
|
70
|
+
></lr-empty>
|
|
71
|
+
</section>`}}__decorate([state()],LyraRetrievalCompare.prototype,"page",void 0),__decorate([property({attribute:!1})],LyraRetrievalCompare.prototype,"sets",void 0),__decorate([property({type:Number,attribute:"top-k"})],LyraRetrievalCompare.prototype,"topK",void 0),__decorate([property({attribute:"selected-chunk-id"})],LyraRetrievalCompare.prototype,"selectedChunkId",void 0),__decorate([property({attribute:"heading-level"})],LyraRetrievalCompare.prototype,"headingLevel",void 0),__decorate([property()],LyraRetrievalCompare.prototype,"label",void 0),__decorate([property({reflect:!0})],LyraRetrievalCompare.prototype,"size",void 0),__decorate([property({reflect:!0})],LyraRetrievalCompare.prototype,"frame",void 0);export{LyraRetrievalCompare};
|
|
@@ -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'] { min-inline-size: 0; } [part='overlap'] { margin: 0 0 var(--lr-space-s); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-sm); } [part='sets'] { display: grid; grid-auto-columns: minmax(var(--lr-size-16rem), 1fr); grid-auto-flow: column; gap: var(--lr-space-m); overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; } [part='set'] { min-inline-size: 0; } [part='set-heading'] { margin: 0 0 var(--lr-space-s); font-size: var(--lr-font-size-m); } [part='chunks'] { display: flex; flex-direction: column; gap: var(--lr-space-s); margin: 0; padding: 0; list-style: none; } [part~='chunk'] { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--lr-space-xs) var(--lr-space-s); inline-size: 100%; box-sizing: border-box; ${iconHitTarget} padding: var(--lr-space-s); 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; text-align: start; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part~='chunk']:hover { background: var(--lr-color-surface-raised); } [part~='chunk']:active { background: color-mix(in oklab, var(--lr-color-surface-raised), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part~='chunk']:focus-visible { ${focusRing} } [part~='chunk-selected'] { border-color: var(--lr-retrieval-compare-selected-border, var(--lr-color-brand)); } @media (forced-colors: active) { [part~='chunk-selected'] { outline: var(--lr-border-width-medium) solid Highlight; outline-offset: calc(-1 * var(--lr-border-width-medium)); } } [part='chunk-rank'] { color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } [part='chunk-title'], [part='chunk-text'], [part='scores'] { min-inline-size: 0; overflow-wrap: anywhere; } [part='chunk-text'], [part='scores'] { grid-column: 1 / -1; } [part='chunk-text'] { font-size: var(--lr-font-size-sm); } [part='scores'] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lr-space-2xs) var(--lr-space-s); } [part='score'] { display: flex; justify-content: space-between; gap: var(--lr-space-xs); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } @container ${compactContainerQuery} { [part='sets'] { grid-auto-columns: minmax(var(--lr-size-14rem), 100%); } [part='scores'] { grid-template-columns: 1fr; } } :host(:is([size='2xs'], [size='xs'], [size='s'], [size='small'])) [part~='chunk'] { padding: var(--lr-space-xs); } :host([frame='plain']) [part~='chunk'] { border: 0; border-radius: 0; background: transparent; } `;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` :host { display: block; container-type: inline-size; contain-intrinsic-inline-size: var(--lr-size-20rem); } [part='base'] { min-inline-size: 0; } [part='overlap'] { margin: 0 0 var(--lr-space-s); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-sm); } [part='sets'] { display: grid; grid-auto-columns: minmax(var(--lr-size-16rem), 1fr); grid-auto-flow: column; gap: var(--lr-space-m); overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; } [part='set'] { min-inline-size: 0; } [part='set-heading'] { margin: 0 0 var(--lr-space-s); font-size: var(--lr-font-size-m); } [part='chunks'] { display: flex; flex-direction: column; gap: var(--lr-space-s); margin: 0; padding: 0; list-style: none; } [part~='chunk'] { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--lr-space-xs) var(--lr-space-s); inline-size: 100%; box-sizing: border-box; ${iconHitTarget} padding: var(--lr-space-s); 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; text-align: start; cursor: pointer; transition: background-color var(--lr-transition-fast); } [part~='chunk']:hover { background: var(--lr-color-surface-raised); } [part~='chunk']:active { background: color-mix(in oklab, var(--lr-color-surface-raised), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part~='chunk']:focus-visible { ${focusRing} } [part~='chunk-selected'] { border-color: var(--lr-retrieval-compare-selected-border, var(--lr-color-brand)); } @media (forced-colors: active) { [part~='chunk-selected'] { outline: var(--lr-border-width-medium) solid Highlight; outline-offset: calc(-1 * var(--lr-border-width-medium)); } } [part='chunk-rank'] { color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } [part='chunk-title'], [part='chunk-text'], [part='scores'] { min-inline-size: 0; overflow-wrap: anywhere; } [part='chunk-text'], [part='scores'] { grid-column: 1 / -1; } [part='chunk-text'] { font-size: var(--lr-font-size-sm); } [part='scores'] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lr-space-2xs) var(--lr-space-s); } [part='score'] { display: flex; justify-content: space-between; gap: var(--lr-space-xs); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-xs); } @container ${compactContainerQuery} { [part='sets'] { grid-auto-columns: minmax(var(--lr-size-14rem), 100%); } [part='scores'] { grid-template-columns: 1fr; } } :host(:is([size='2xs'], [size='xs'], [size='s'], [size='small'])) [part~='chunk'] { padding: var(--lr-space-xs); } :host([frame='plain']) [part~='chunk'] { border: 0; border-radius: 0; background: transparent; } [part='pagination'] { display: flex; flex-wrap: wrap; align-items: center; gap: var(--lr-space-xs); margin-block: var(--lr-space-s); } [part='page-button'] { ${iconHitTarget} padding: var(--lr-space-2xs) var(--lr-space-xs); 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; } [part='page-button']:hover:where(:not(:disabled)) { background: var(--lr-color-surface-raised); } [part='page-button']:active:where(:not(:disabled)) { background: color-mix(in oklab, var(--lr-color-surface-raised), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='page-button']:focus-visible { ${focusRing} } [part='page-button']:disabled { opacity: var(--lr-opacity-disabled); cursor: default; } [part='page-status'], [part='input-limit'], [part='result-limit'] { color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-sm); margin-block: var(--lr-space-xs); } `;export{styles};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readOwnDataValue}from"../../../internal/data-descriptors.js";import{snapshotPublicCollection}from"../../../internal/collection-snapshot.js";import{isValidRetrievalChunk}from"../retrieval-identity.js";function fields(value,keys){const result={};for(const key of keys){const field=readOwnDataValue(value,key);field!==void 0&&(result[key]=field)}return result}function projectRetrievalChunk(value){try{if(!value||typeof value!="object"||Array.isArray(value))return;const sourceValue=readOwnDataValue(value,"source");if(!sourceValue||typeof sourceValue!="object"||Array.isArray(sourceValue))return;const source=fields(sourceValue,["id","name","mimeType","uri","version"]),row=fields(value,["id","text","score","metadata","rank","queryId","stage","traceId"]);if(row.source=Object.freeze(source),!isValidRetrievalChunk(row))return;const locator=readOwnDataValue(value,"locator");locator!==void 0&&(row.locator=snapshotPublicCollection(locator));const scores=readOwnDataValue(value,"scores");return scores&&typeof scores=="object"&&!Array.isArray(scores)&&(row.scores=Object.freeze(fields(scores,["dense","sparse","rerank","final"]))),Object.freeze(row)}catch{return}}export{projectRetrievalChunk};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{DocumentLocator,RetrievalChunk}from'../../../ai/types.js';import type{LyraScoreThresholds}from'../../../internal/score-tiers.js';export type{LyraScoreThresholds}from'../../../internal/score-tiers.js';
|
|
1
|
+
import type{LyraPageSource}from'../../../data-sources.js';import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{DocumentLocator,RetrievalChunk}from'../../../ai/types.js';import type{LyraScoreThresholds}from'../../../internal/score-tiers.js';export type{LyraScoreThresholds}from'../../../internal/score-tiers.js';
|
|
2
2
|
/** The deprecated `lr-select`'s detail: the complete updated selection, both as bare ids and as one
|
|
3
3
|
* deterministic canonical `RetrievalChunk` record per id (`lr-selection-change` carries the same as
|
|
4
4
|
* `selectedChunkIds`). This contract is independent of the visible `without-dedupe` projection:
|
|
@@ -6,6 +6,8 @@ import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';impo
|
|
|
6
6
|
export interface RetrievalResultsSelectDetail{chunkIds:string[];chunks:RetrievalChunk[];}export interface LyraRetrievalResultsEventMap{'lr-selection-change':CustomEvent<LyraEventDetailSnapshot<{selectedChunkIds:string[];chunks:RetrievalChunk[];}>>;
|
|
7
7
|
/** @deprecated Use `lr-selection-change`. */
|
|
8
8
|
'lr-select':CustomEvent<LyraEventDetailSnapshot<RetrievalResultsSelectDetail>>;'lr-load-more':CustomEvent<null>;'lr-chunk-open':CustomEvent<LyraEventDetailSnapshot<{chunkId:string;sourceId:string;anchor?:DocumentLocator;}>>;}export type RetrievalResultsGrouping='source'|'custom'|'none';export type RetrievalResultsPresentation='compact'|'expanded';
|
|
9
|
+
/** Query semantics apply to the complete provider collection before paging. */
|
|
10
|
+
export interface RetrievalResultsSourceQuery{readonly sort:'score'|'none';readonly withoutDedupe:boolean;readonly grouping:RetrievalResultsGrouping;readonly groupBy:LyraRetrievalResults['groupBy'];readonly groupLabel:LyraRetrievalResults['groupLabel'];readonly groupOrder:LyraRetrievalResults['groupOrder'];}export type RetrievalResultsSource=LyraPageSource<RetrievalChunk,RetrievalResultsSourceQuery>;
|
|
9
11
|
/**
|
|
10
12
|
* `<lr-retrieval-results>` — the orchestration-level ranked-chunk-list surface: takes raw
|
|
11
13
|
* `RetrievalChunk[]` (the shared retrieval-and-grounding type from `src/ai/types.ts`) and adds
|
|
@@ -27,7 +29,7 @@ export interface RetrievalResultsSelectDetail{chunkIds:string[];chunks:Retrieval
|
|
|
27
29
|
*
|
|
28
30
|
* **Controlled component.** `chunks`/`selectedChunkIds`/`loading`/`errorText`/`hasMore` are all
|
|
29
31
|
* host-owned;
|
|
30
|
-
* this component never fetches, retries, or mutates its own copy of `chunks`. Selecting a row
|
|
32
|
+
* without a dataSource, this component never fetches, retries, or mutates its own copy of `chunks`. Selecting a row
|
|
31
33
|
* updates `selectedChunkIds` locally *then* emits `lr-selection-change` (the same "update own copy, then
|
|
32
34
|
* emit; reassign to control" convention `<lr-source-picker>` already uses) so a host can either
|
|
33
35
|
* accept the update as-is or override it before the next render.
|
|
@@ -49,6 +51,31 @@ export interface RetrievalResultsSelectDetail{chunkIds:string[];chunks:Retrieval
|
|
|
49
51
|
* Public collection properties take bounded, clone-owned readonly snapshots. Create a new
|
|
50
52
|
* collection and reassign it after changes; mutating the assigned array does not update the view.
|
|
51
53
|
*
|
|
54
|
+
* Input retains the first 10,000 results; the limit note reports the assigned source count.
|
|
55
|
+
* Closed display fields are copied after identity admission, so nested records do not consume the
|
|
56
|
+
* shared 50,000-value deep-copy budget. Replace the collection to publish source-record changes.
|
|
57
|
+
*
|
|
58
|
+
* With dataSource, the provider owns global sorting, deduplication, grouping and page totals.
|
|
59
|
+
* Each page retains at most 500 records; required rendered text is bounded to 65,536 UTF-16 units
|
|
60
|
+
* per record and locator paths to 500 segments. Oversized records fail visibly without truncating
|
|
61
|
+
* their full text. Group labels come from globally computed provider metadata, never partial-page
|
|
62
|
+
* callbacks. sourceTotal is unknown until an accepted response; legacy hasMore is inactive.
|
|
63
|
+
* withoutDedupe permits distinct occurrence keys while row selection and events retain canonical
|
|
64
|
+
* value.id. Canonical lookup must return key===value.id and complete records in global order.
|
|
65
|
+
* Up to 10,000 explicit selected IDs resolve in sequential batches of at most 500; page/query/retry
|
|
66
|
+
* changes retain their independent cache. Failed selection remains pending user intent until
|
|
67
|
+
* retried, without partial events. External assignments and reconnect reconciliation are silent.
|
|
68
|
+
* Active IDs locate once; manual page navigation does not reapply an unchanged active ID.
|
|
69
|
+
* Same-source assignment or requestUpdate() refreshes; named paints retain pages and selection.
|
|
70
|
+
* Source selection events freeze the complete record sequence and projected record fields while
|
|
71
|
+
* retaining opaque metadata identity. Legacy events retain their complete-detail deep snapshot
|
|
72
|
+
* and its existing failure budget. Removing dataSource restores the legacy chunks route.
|
|
73
|
+
*
|
|
74
|
+
* @csspart source-status - Provider loading or failure text.
|
|
75
|
+
* @csspart source-retry - Failed provider page retry button.
|
|
76
|
+
* @csspart source-pagination - Provider page navigation.
|
|
77
|
+
* @csspart source-selection-status - Canonical selected-record loading or failure text.
|
|
78
|
+
* @csspart source-selection-retry - Failed canonical selection lookup retry button.
|
|
52
79
|
* @customElement lr-retrieval-results
|
|
53
80
|
* @event lr-selection-change - The selected-chunk set changed. `detail: { selectedChunkIds, chunks }` —
|
|
54
81
|
* `selectedChunkIds` is the complete updated selection (not just the toggled id), `chunks` the
|
|
@@ -88,6 +115,7 @@ export interface RetrievalResultsSelectDetail{chunkIds:string[];chunks:Retrieval
|
|
|
88
115
|
* `::part(row-body)[data-selected]` is invalid CSS, and while virtualized `::part()` is the only
|
|
89
116
|
* way in. A state part is a second token in the same `part` attribute, so a `[part~="…"]` (not
|
|
90
117
|
* `[part="…"]`) selector is the one that matches inside a tree.
|
|
118
|
+
* @csspart limit - Notice that only the first 10,000 input results were retained.
|
|
91
119
|
* @csspart metadata - The `<dl>` of a chunk's `metadata` entries — omitted entirely when a chunk
|
|
92
120
|
* has no `metadata`, or while `presentation="compact"`.
|
|
93
121
|
* @csspart metadata-entry - One metadata key/value pair's wrapper.
|
|
@@ -116,7 +144,19 @@ export interface RetrievalResultsSelectDetail{chunkIds:string[];chunks:Retrieval
|
|
|
116
144
|
* @status stable
|
|
117
145
|
* @since 4.1.0
|
|
118
146
|
*/
|
|
119
|
-
export declare class LyraRetrievalResults extends LyraElement<LyraRetrievalResultsEventMap>{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[];
|
|
147
|
+
export declare class LyraRetrievalResults extends LyraElement<LyraRetrievalResultsEventMap>{protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly identityCollectionProperties:readonly string[];protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];protected static readonly immutableEventDetails:readonly string[];
|
|
148
|
+
/** Canonical source records are frozen projections with opaque metadata. Legacy details are
|
|
149
|
+
* detached as one complete snapshot before entering this identity-preserving envelope. */
|
|
150
|
+
protected static readonly identityEventDetailCollectionItems:Readonly<{'lr-selection-change':readonly string[];'lr-select':readonly string[];}>;private _dataSource?;private sourceEpoch;private sourceVersion;private sourceLifecycle;private sourceSyncing;private sourceInputs?;private sourceQueryInputs?;private sourceResult?;private sourceRows;private sourceGroups;private sourceSelectionInputs?;private sourceSelectionEvent?;private sourceSelectionFailed;private sourceActiveInputs?;private sourceReveal?;private sourceAdapter?;private readonly sourceRowKeys;private sourceStateVersion;private readonly sourcePages;
|
|
151
|
+
/** Full-source provider; a present invalid source fails visibly instead of using chunks.
|
|
152
|
+
* Reassign the same provider or call requestUpdate() to refresh its revision/cache. */
|
|
153
|
+
get dataSource():RetrievalResultsSource|undefined;set dataSource(value:RetrievalResultsSource|undefined);
|
|
154
|
+
/** Zero-based provider page. */
|
|
155
|
+
sourcePage:number;
|
|
156
|
+
/** Provider records per page, normalized to 1..500; changing size resets page 0. */
|
|
157
|
+
sourcePageSize:number;
|
|
158
|
+
/** Current query total, or null before success/without a source. */
|
|
159
|
+
get sourceTotal():number|null;private get sourceMode();private get sourceBlocked();private get sourceSelectionBlocked();private projectSourceChunk;private validateSourcePage;private canonicalSourceAdapter;private syncSource;private syncSourceSelection;private acceptSourcePage;private syncSourceActive;private revealSourceActive;private currentSourceRow;private invalidateSourceLifecycle;adoptedCallback():void;
|
|
120
160
|
/** The raw (not deduplicated/sorted/grouped) result set. Host-owned. */
|
|
121
161
|
chunks:readonly RetrievalChunk[];
|
|
122
162
|
/** Controlled selection, by chunk `id`. The component updates its own copy on toggle *then*
|
|
@@ -125,7 +165,8 @@ chunks:readonly RetrievalChunk[];
|
|
|
125
165
|
selectedChunkIds:readonly string[];
|
|
126
166
|
/** Omits the per-row `<lr-checkbox>`. */
|
|
127
167
|
withoutSelection:boolean;
|
|
128
|
-
/**
|
|
168
|
+
/** Legacy chunks remain first-wins. In source mode, permits distinct occurrence keys for rows
|
|
169
|
+
* sharing a canonical value.id; selection and active IDs still use the canonical ID. */
|
|
129
170
|
withoutDedupe:boolean;
|
|
130
171
|
/** `'score'` (default) sorts the canonical list descending by `score`; `'none'` preserves
|
|
131
172
|
* `chunks`' own given order. */
|
|
@@ -186,4 +227,4 @@ announce:boolean;
|
|
|
186
227
|
* says exactly what this region is. An explicit empty string clears the fallback. A non-empty
|
|
187
228
|
* host `aria-label` makes the host the sole overall owner; an explicitly empty host label stays
|
|
188
229
|
* empty on the region. */
|
|
189
|
-
label?:string;private expandedChunkIds;private pendingFocusTarget;private previousProcessedChunkIds;private focusRestoreGeneration;private isMounting;private initialStateAnnounced;private connectionGeneration;private errorAnnouncementSink?;private emptyAnnouncementSink?;private readonly retrievalChunkKey;private wasEmptyPresented;private processedChunksCache?;private processedGroupingLocaleSignature;connectedCallback():void;disconnectedCallback():void;private deepActiveElement;private chunkAnchor;private renderedChunkIds;protected willUpdate(changed:PropertyValues<this>):void;protected updated(changed:PropertyValues<this>):void;private announcePresentedState;private restoreControlledFocus;private get effectiveVirtualizeAt();private canonicalChunks;private normalizedSelectedChunkIds;private get processedChunks();private computeProcessedChunks;private orderedGroupKeys;private bucketed;private stopOwnedEvent;private reportSelection;private toggleSelect;private stopRowToggle;private onChunkToggle;private readonly rowChunks;private rowChunksFor;private renderMetadata;private selectedMembership?;private isChunkSelected;private renderRow;private renderLoadMoreFooter;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-retrieval-results':LyraRetrievalResults;}}
|
|
230
|
+
label?:string;private expandedChunkIds;private pendingFocusTarget;private previousProcessedChunkIds;private focusRestoreGeneration;private isMounting;private initialStateAnnounced;private connectionGeneration;private errorAnnouncementSink?;private emptyAnnouncementSink?;private readonly retrievalChunkKey;private wasEmptyPresented;private processedChunksCache?;private processedGroupingLocaleSignature;private explicitRefresh;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;private canonicalSource?;private canonicalCache;private canonicalById;private canonicalOrder;private ordinalSource?;private ordinalById;private limitInitialized;private previouslyInputTruncated;private inputLimitText;private renderInputLimit;connectedCallback():void;disconnectedCallback():void;private deepActiveElement;private chunkAnchor;private renderedChunkIds;protected willUpdate(changed:PropertyValues<this>):void;private sourceStatusInitialized;private sourceStatus;protected updated(changed:PropertyValues<this>):void;private announcePresentedState;private restoreControlledFocus;private get effectiveVirtualizeAt();private canonicalChunks;private normalizedSelectedChunkIds;private get processedChunks();private computeProcessedChunks;private orderedGroupKeys;private bucketed;private stopOwnedEvent;private reportSelection;private toggleSelect;private stopRowToggle;private onChunkToggle;private readonly rowChunks;private rowChunksFor;private renderMetadata;private selectedMembership?;private isChunkSelected;private renderRow;private legacyLoadMoreHandler;private renderLoadMoreFooter;private renderSource;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-retrieval-results':LyraRetrievalResults;}}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{collectionSupport,writeNormalizedOwnedCollection}from"../../../internal/collection-snapshot.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity,canonicalIdentityList
|
|
1
|
+
import{__decorate}from"tslib";import{SourcePageController}from"../../../internal/source-page-controller.js";import{readOwnDataValue}from"../../../internal/data-descriptors.js";import{collectionSupport,publicCollectionTruncation,writeNormalizedOwnedCollection,snapshotEventDetail}from"../../../internal/collection-snapshot.js";import{projectRetrievalChunk}from"./retrieval-results-model.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity,canonicalIdentityList}from"../retrieval-identity.js";import{finiteCount,finiteRange,finiteInteger}from"../../../internal/numbers.js";import{styles}from"./retrieval-results.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{renderRetrievalMetadata}from"../retrieval-metadata.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{announceAfterFirstPaint}from"../retrieval-announcements.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{LYRA_DEFAULT_chunkInspectorEmpty,LYRA_DEFAULT_chunkInspectorLabel,LYRA_DEFAULT_retrievalResultsInputLimit,LYRA_DEFAULT_retrievalResultsSelectRowOrdinal,LYRA_DEFAULT_untitledSource,LYRA_DEFAULT_valueTruncated}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_loadMore,LYRA_DEFAULT_loading,LYRA_DEFAULT_retry,LYRA_DEFAULT_sourceSelectionFailed,LYRA_DEFAULT_sourceSelectionLoading,LYRA_DEFAULT_tableLoadFailed,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";function toLyraChunk(chunk){return{id:chunk.id,text:chunk.text,score:chunk.score,sourceId:chunk.source.id,title:chunk.source.name,anchor:chunk.locator,page:chunk.locator?.kind==="page"?chunk.locator.page:void 0}}function safeScore(score){return finiteRange(score,0,0,1)}class LyraRetrievalResults extends LyraElement{constructor(){super(...arguments),this.sourceEpoch=0,this.sourceVersion=0,this.sourceLifecycle=0,this.sourceSyncing=!1,this.sourceRows=[],this.sourceGroups=[],this.sourceSelectionFailed=!1,this.sourceRowKeys=new WeakMap,this.sourceStateVersion=0,this.sourcePages=new SourcePageController(this,{normalizeRecord:(record,isCurrent)=>this.projectSourceChunk(record,isCurrent),validateMetadata:(result,query)=>this.validateSourcePage(result,query),onChange:()=>{this.sourceStateVersion++}}),this.sourcePage=0,this.sourcePageSize=100,this.chunks=[],this.selectedChunkIds=[],this.withoutSelection=!1,this.withoutDedupe=!1,this.sort="score",this.grouping="none",this.presentation="expanded",this.thresholds={high:.75,medium:.5},this.virtualizeAt=50,this.activeChunkId="",this.loading=!1,this.hasMore=!1,this.errorText="",this.announce=!1,this.expandedChunkIds=[],this.previousProcessedChunkIds=[],this.focusRestoreGeneration=0,this.isMounting=!0,this.initialStateAnnounced=!1,this.connectionGeneration=0,this.retrievalChunkKey=item=>this.sourceRowKeys.get(item)??item.id,this.wasEmptyPresented=!1,this.processedGroupingLocaleSignature="",this.explicitRefresh=!1,this.canonicalCache=[],this.canonicalById=new Map,this.canonicalOrder=new Map,this.ordinalById=new Map,this.limitInitialized=!1,this.previouslyInputTruncated=!1,this.sourceStatusInitialized=!1,this.sourceStatus="",this.stopOwnedEvent=event=>{event.stopPropagation()},this.stopRowToggle=event=>{event.stopPropagation()},this.onChunkToggle=event=>{event.stopPropagation();const{chunkId,expanded}=event.detail,rest=this.expandedChunkIds.filter(id=>id!==chunkId);this.expandedChunkIds=expanded?[...rest,chunkId]:rest},this.rowChunks=new WeakMap,this.renderRow=(item,index,total)=>{const chunk=item,selected=this.isChunkSelected(chunk.id),rowLabel=chunk.source.name||this.localize("untitledSource");return html`
|
|
2
2
|
${this.withoutSelection?nothing:html`<lr-checkbox
|
|
3
3
|
part="select"
|
|
4
4
|
data-chunk-id=${chunk.id}
|
|
5
5
|
.checked=${selected}
|
|
6
|
+
.disabled=${this.sourceSelectionBlocked}
|
|
6
7
|
aria-label=${this.localize("retrievalResultsSelectRowOrdinal",void 0,{index:getNumberFormat(this.effectiveLocale).format(index+1),total:getNumberFormat(this.effectiveLocale).format(total),label:rowLabel})}
|
|
7
8
|
@lr-checkbox-toggle-request=${this.stopOwnedEvent}
|
|
8
9
|
@input=${this.stopOwnedEvent}
|
|
@@ -25,38 +26,59 @@ import{__decorate}from"tslib";import{collectionSupport,writeNormalizedOwnedColle
|
|
|
25
26
|
.ordinalIndex=${index+1}
|
|
26
27
|
.ordinalTotal=${total}
|
|
27
28
|
label=${rowLabel}
|
|
28
|
-
@lr-chunk-open=${e=>{e.stopPropagation(),this.emit("lr-chunk-open",e.detail)}}
|
|
29
|
-
@lr-chunk-toggle=${this.onChunkToggle}
|
|
29
|
+
@lr-chunk-open=${e=>{e.stopPropagation(),this.currentSourceRow(chunk)&&this.emit("lr-chunk-open",e.detail)}}
|
|
30
|
+
@lr-chunk-toggle=${event=>{event.stopPropagation(),this.currentSourceRow(chunk)&&this.onChunkToggle(event)}}
|
|
30
31
|
@lr-toggle=${this.stopRowToggle}
|
|
31
32
|
></lr-chunk-inspector>
|
|
32
33
|
${this.presentation==="expanded"?this.renderMetadata(chunk.metadata):nothing}
|
|
33
34
|
</div>
|
|
34
|
-
`}}static{this.defaultStrings={...super.defaultStrings,chunkInspectorEmpty:LYRA_DEFAULT_chunkInspectorEmpty,chunkInspectorLabel:LYRA_DEFAULT_chunkInspectorLabel,loadMore:LYRA_DEFAULT_loadMore,retrievalResultsSelectRowOrdinal:LYRA_DEFAULT_retrievalResultsSelectRowOrdinal,untitledSource:LYRA_DEFAULT_untitledSource,valueInvalid:LYRA_DEFAULT_valueInvalid,valueTruncated:LYRA_DEFAULT_valueTruncated}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["chunks","selectedChunkIds","groupOrder"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-selection-change","lr-select","lr-chunk-open"])}connectedCallback(){super.connectedCallback(),this.errorAnnouncementSink??=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}),this.emptyAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this});const generation=++this.connectionGeneration;announceAfterFirstPaint(this,()=>generation===this.connectionGeneration,()=>{!this.announce||this.initialStateAnnounced||(this.initialStateAnnounced=!0,this.announcePresentedState())})}disconnectedCallback(){this.isMounting=!0,this.connectionGeneration+=1,this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0,this.emptyAnnouncementSink?.release(),this.emptyAnnouncementSink=void 0,this.wasEmptyPresented=!1,super.disconnectedCallback()}deepActiveElement(){return deepActiveElementIn(this.isConnected?this.shadowRoot:null)}chunkAnchor(start){let current=start;for(;current&¤t!==this;){if(current.hasAttribute("data-chunk-id"))return current;if(current.parentElement){current=current.parentElement;continue}const root=current.getRootNode();current=root.nodeType===11&&"host"in root?root.host:null}return null}renderedChunkIds(){const roots=[this.renderRoot],virtualList=this.renderRoot.querySelector(tag("virtual-list"));return virtualList?.shadowRoot&&roots.push(virtualList.shadowRoot),roots.flatMap(root=>[...root.querySelectorAll(`${tag("chunk-inspector")}[data-chunk-id]`)].map(element=>element.getAttribute("data-chunk-id")).filter(id=>id!==null))}willUpdate(changed){super.willUpdate(changed);const groupingLocaleSignature=this.grouping==="source"?`${this.effectiveLocale}\0${this.localize("untitledSource")}`:"";if((this.processedChunksCache===void 0||changed.has("chunks")||changed.has("withoutDedupe")||changed.has("sort")||changed.has("grouping")||changed.has("groupBy")||changed.has("groupLabel")||changed.has("groupOrder")||groupingLocaleSignature!==this.processedGroupingLocaleSignature)&&(this.processedGroupingLocaleSignature=groupingLocaleSignature,this.processedChunksCache=this.computeProcessedChunks()),changed.has("chunks")){const present=new Set(this.processedChunks.chunks.map(chunk=>chunk.id)),kept=this.expandedChunkIds.filter(id=>present.has(id));kept.length!==this.expandedChunkIds.length&&(this.expandedChunkIds=kept)}if(changed.has("chunks")||changed.has("selectedChunkIds")){const normalized=this.normalizedSelectedChunkIds();if(normalized.length!==this.selectedChunkIds.length||normalized.some((id,index)=>id!==this.selectedChunkIds[index])){const shouldAnnounce=this.hasUpdated&&changed.has("chunks");writeNormalizedOwnedCollection(this,"selectedChunkIds",()=>{this.selectedChunkIds=normalized}),shouldAnnounce&&this.reportSelection(normalized)}}if(!changed.has("chunks")&&!changed.has("withoutDedupe")&&!changed.has("sort")&&!changed.has("grouping")&&!changed.has("groupBy")&&!changed.has("groupLabel")&&!changed.has("groupOrder")&&!changed.has("presentation")&&!changed.has("withoutSelection")&&!changed.has("virtualizeAt")&&!changed.has("loading")&&!changed.has("errorText"))return;const focusedId=this.chunkAnchor(this.deepActiveElement())?.getAttribute("data-chunk-id");if(!focusedId)return;const previousIds=this.previousProcessedChunkIds.length?this.previousProcessedChunkIds:this.renderedChunkIds(),focusedIndex=Math.max(0,previousIds.indexOf(focusedId)),nextChunks=this.errorText?[]:this.processedChunks.chunks;if(nextChunks.length===0){this.pendingFocusTarget="base";return}const survivingIndex=nextChunks.findIndex(chunk=>chunk.id===focusedId),nextIndex=survivingIndex>=0?survivingIndex:Math.min(focusedIndex,nextChunks.length-1);this.pendingFocusTarget=nextChunks[nextIndex].id}updated(changed){super.updated(changed);const wasMounting=this.isMounting;this.isMounting=!1,!wasMounting&&changed.has("errorText")&&this.errorText!==""&&this.isConnected&&(this.initialStateAnnounced=!0,this.errorAnnouncementSink?.announce(this.errorText));const emptyPresented=!this.loading&&this.errorText===""&&this.processedChunks.chunks.length===0;!wasMounting&&!this.wasEmptyPresented&&emptyPresented&&this.isConnected&&(this.initialStateAnnounced=!0,this.emptyAnnouncementSink?.announce(this.localize("chunkInspectorEmpty"))),this.wasEmptyPresented=emptyPresented,this.previousProcessedChunkIds=this.errorText?[]:this.processedChunks.chunks.map(chunk=>chunk.id);const generation=++this.focusRestoreGeneration,target=this.pendingFocusTarget;target!==void 0&&(this.pendingFocusTarget=void 0,this.restoreControlledFocus(target,generation))}announcePresentedState(){if(this.errorText!==""){this.errorAnnouncementSink?.announce(this.errorText);return}!this.loading&&this.processedChunks.chunks.length===0&&this.emptyAnnouncementSink?.announce(this.localize("chunkInspectorEmpty"))}async restoreControlledFocus(target,generation){if(await this.updateComplete,generation!==this.focusRestoreGeneration||!this.isConnected)return;if(target==="base"){this.renderRoot.querySelector('[part="base"]')?.focus();return}const virtualList=this.renderRoot.querySelector(tag("virtual-list"));if(await virtualList?.updateComplete,generation!==this.focusRestoreGeneration||!this.isConnected)return;const roots=[this.renderRoot];virtualList?.shadowRoot&&roots.push(virtualList.shadowRoot);const candidates=roots.flatMap(root=>[...root.querySelectorAll("[data-chunk-id]")]),checkbox=candidates.find(element=>element.localName===tag("checkbox")&&element.getAttribute("data-chunk-id")===target);if(checkbox){checkbox.focus();return}const inspector=candidates.find(element=>element.localName===tag("chunk-inspector")&&element.getAttribute("data-chunk-id")===target);await inspector?.updateComplete,!(generation!==this.focusRestoreGeneration||!this.isConnected)&&inspector?.shadowRoot?.querySelector('[part="open-button"]')?.focus()}get effectiveVirtualizeAt(){return finiteCount(this.virtualizeAt,50)}canonicalChunks(){return firstByRetrievalIdentity(Array.isArray(this.chunks)?this.chunks.filter(isValidRetrievalChunk):[],chunk=>chunk.id)}normalizedSelectedChunkIds(){const validIds=new Set(this.canonicalChunks().map(chunk=>chunk.id));return canonicalIdentityList(this.selectedChunkIds).filter(id=>validIds.has(id))}get processedChunks(){return this.processedChunksCache??=this.computeProcessedChunks()}computeProcessedChunks(){const canonical=this.canonicalChunks(),sorted=this.sort==="score"?canonical.sort((a,b)=>safeScore(b.score)-safeScore(a.score)):canonical;if(this.grouping==="source")return this.bucketed(sorted,chunk=>chunk.source.id,(_id,groupChunks)=>groupChunks[0].source.name||this.localize("untitledSource"));if(this.grouping==="custom"&&this.groupBy){const groupBy=this.groupBy;return this.bucketed(sorted,groupBy,(id,groupChunks)=>this.groupLabel?.(id,groupChunks)??id)}return{chunks:sorted,groups:[]}}orderedGroupKeys(grouped){const firstSeen=[...grouped.keys()];if(this.grouping!=="custom"||!this.groupOrder)return firstSeen;if(typeof this.groupOrder=="function")return firstSeen.sort(this.groupOrder);const ordered=[...new Set(this.groupOrder)].filter(id=>grouped.has(id)),listed=new Set(ordered);return[...ordered,...firstSeen.filter(id=>!listed.has(id))]}bucketed(sorted,keyOf,labelOf){const grouped=new Map;for(const chunk of sorted){const key=keyOf(chunk),existing=grouped.get(key);existing?existing.push(chunk):grouped.set(key,[chunk])}const rows=[],groups=[];for(const key of this.orderedGroupKeys(grouped)){const groupChunks=grouped.get(key);!groupChunks||groupChunks.length===0||(groups.push({key,label:labelOf(key,groupChunks),startIndex:rows.length}),rows.push(...groupChunks))}return{chunks:rows,groups}}reportSelection(chunkIds){const selected=new Set(chunkIds),chunks=this.canonicalChunks().filter(chunk=>selected.has(chunk.id));this.emit("lr-selection-change",{selectedChunkIds:chunkIds,chunks}),this.emit("lr-select",{chunkIds,chunks})}toggleSelect(chunk){const next=new Set(this.normalizedSelectedChunkIds());next.has(chunk.id)?next.delete(chunk.id):next.add(chunk.id),this.selectedChunkIds=[...next],this.reportSelection(this.selectedChunkIds)}rowChunksFor(chunk){let row=this.rowChunks.get(chunk);return row||this.rowChunks.set(chunk,row=[toLyraChunk(chunk)]),row}renderMetadata(metadata){return renderRetrievalMetadata(metadata,this.effectiveLocale,this.localize("valueInvalid"),this.localize("valueTruncated"))}isChunkSelected(id){const source=this.selectedChunkIds;return source.length===0||this.processedChunks.chunks.length<=1?(this.selectedMembership=void 0,source.includes(id)):(this.selectedMembership?.source!==source&&(this.selectedMembership={source,ids:new Set(source)}),this.selectedMembership.ids.has(id))}renderLoadMoreFooter(){return this.hasMore?html`
|
|
35
|
+
`}}static{this.defaultStrings={...super.defaultStrings,chunkInspectorEmpty:LYRA_DEFAULT_chunkInspectorEmpty,chunkInspectorLabel:LYRA_DEFAULT_chunkInspectorLabel,loadMore:LYRA_DEFAULT_loadMore,loading:LYRA_DEFAULT_loading,retrievalResultsInputLimit:LYRA_DEFAULT_retrievalResultsInputLimit,retrievalResultsSelectRowOrdinal:LYRA_DEFAULT_retrievalResultsSelectRowOrdinal,retry:LYRA_DEFAULT_retry,sourceSelectionFailed:LYRA_DEFAULT_sourceSelectionFailed,sourceSelectionLoading:LYRA_DEFAULT_sourceSelectionLoading,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,untitledSource:LYRA_DEFAULT_untitledSource,valueInvalid:LYRA_DEFAULT_valueInvalid,valueTruncated:LYRA_DEFAULT_valueTruncated}}static{this.collectionSupport=collectionSupport}static{this.identityCollectionProperties=Object.freeze(["chunks"])}static{this.ownedCollectionProperties=Object.freeze(["chunks","selectedChunkIds","groupOrder"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-selection-change","lr-select","lr-chunk-open"])}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-selection-change":Object.freeze(["chunks"]),"lr-select":Object.freeze(["chunks"])})}get dataSource(){return this._dataSource}set dataSource(value){const old=this._dataSource;this._dataSource=value,this.sourceEpoch++,this.requestUpdate("dataSource",old)}get sourceTotal(){return this.sourceMode?this.sourcePages.state.result?.total??null:null}get sourceMode(){return this.dataSource!==void 0}get sourceBlocked(){return this.sourceMode&&(!this.isConnected||!!this.errorText||this.sourcePages.state.pending||!this.sourcePages.state.result)}get sourceSelectionBlocked(){return this.sourceBlocked||this.sourceMode&&(this.sourcePages.state.selectionPending||this.sourceSelectionFailed)}projectSourceChunk(record,isCurrent){let units=0;const read=(input,key)=>{if(!isCurrent())throw new Error("Obsolete source chunk");const value2=readOwnDataValue(input,key);if(!isCurrent())throw new Error("Obsolete source chunk");return value2},fields=(input,keys)=>{if(!input||typeof input!="object"||Array.isArray(input))throw new TypeError("Invalid source chunk");const copy={};for(const key of keys){const value2=read(input,key);if(typeof value2=="string"&&(units+=value2.length,value2.length>65536||units>65536))throw new RangeError("Source chunk text too large");value2!==void 0&&(copy[key]=value2)}return copy},raw=fields(record.value,["id","text","score","metadata","rank","queryId","stage","traceId","scores"]);raw.source=fields(read(record.value,"source"),["id","name","mimeType","uri","version"]);const locator=read(record.value,"locator");if(locator!==void 0){const projected=fields(locator,["kind","page","quote","prefix","suffix","id","start","end","sheet","range","cfi"]);for(const key of["kind","quote","prefix","suffix","id","sheet","range","cfi"])if(projected[key]!==void 0&&typeof projected[key]!="string")throw new TypeError("Invalid source locator text");for(const key of["page","start","end"])if(projected[key]!==void 0&&(typeof projected[key]!="number"||!Number.isFinite(projected[key])))throw new TypeError("Invalid source locator number");const rect=read(locator,"rect");if(rect!==void 0){const coordinates=fields(rect,["x","y","width","height"]);for(const key of["x","y","width","height"])if(typeof coordinates[key]!="number"||!Number.isFinite(coordinates[key]))throw new TypeError("Invalid source locator rectangle");projected.rect=coordinates}const path=read(locator,"path");if(path!==void 0){if(!Array.isArray(path))throw new TypeError("Invalid source locator path");const length=read(path,"length");if(typeof length!="number"||!Number.isSafeInteger(length)||length<0||length>500)throw new RangeError("Source locator path too large");projected.path=Array.from({length},(_,index)=>{const value2=read(path,String(index));if(typeof value2!="string"&&typeof value2!="number")throw new TypeError("Invalid source locator path");if(typeof value2=="string"&&(units+=value2.length,units>65536))throw new RangeError("Source chunk text too large");return value2})}raw.locator=projected}const scores=raw.scores;scores&&typeof scores=="object"&&!Array.isArray(scores)&&(raw.scores=fields(scores,["dense","sparse","rerank","final"]));const value=projectRetrievalChunk(raw);if(!isCurrent())throw new Error("Obsolete source chunk");if(!value)throw new TypeError("Invalid source chunk");return this.sourceRowKeys.set(value,record.key),{key:record.key,order:record.order,value}}validateSourcePage(result,query){if(!query.withoutDedupe&&result.rows.some(record=>record.key!==record.value.id))throw new TypeError("Invalid canonical source identity");if(query.grouping==="none"){if(result.groups?.length)throw new TypeError("Unexpected source groups");return}if(!result.groups)throw new TypeError("Missing source groups");if(!result.rows.length)return;const size=this.sourcePages.state.pageSize,start=Math.min(this.sourcePages.state.page,Math.floor((result.total-1)/size))*size,end=start+result.rows.length;let covered=start,previousEnd=-1;for(const group of result.groups){if(group.startIndex<previousEnd||Math.max(start,group.startIndex)!==covered)throw new TypeError("Invalid source group coverage");previousEnd=group.startIndex+group.itemCount,covered=Math.min(end,previousEnd)}if(covered!==end)throw new TypeError("Incomplete source groups")}canonicalSourceAdapter(source){if(this.sourceAdapter?.original===source)return this.sourceAdapter.adapter;if(!source||typeof source.query!="function"||typeof source.lookup!="function"||typeof source.locate!="function")throw new TypeError("Invalid source");const adapter={revision:source.revision,query:request=>source.query(request),locate:(key,query,context)=>source.locate(key,query,context),lookup:async(keys,context)=>{const records=await source.lookup(keys,context);if(!Array.isArray(records)||records.length>500)throw new TypeError("Invalid canonical lookup");for(let index=0;index<records.length;index++){const record=readOwnDataValue(records,String(index)),key=readOwnDataValue(record,"key"),value=readOwnDataValue(record,"value");if(key!==readOwnDataValue(value,"id"))throw new TypeError("Invalid canonical lookup identity")}return records}};return this.sourceAdapter={original:source,adapter},adapter}syncSource(force=!1){if(!(!this.sourcePages||this.sourceSyncing)){this.sourceSyncing=!0;try{if(!this.sourceMode){this.sourceInputs&&(this.sourceVersion++,this.focusRestoreGeneration++,this.sourcePages.bind(void 0),this.processedChunksCache=void 0),this.sourceInputs=void 0,this.sourceQueryInputs=void 0,this.sourceResult=void 0,this.sourceRows=[],this.sourceGroups=[],this.sourceSelectionInputs=void 0,this.sourceSelectionEvent=void 0,this.sourceActiveInputs=void 0,this.sourceReveal=void 0;return}const source=this.dataSource,size=finiteInteger(this.sourcePageSize,100,1,500);let page=finiteInteger(this.sourcePage,0,0,Math.floor(Number.MAX_SAFE_INTEGER/size));const queryInputs=[this.sort,this.withoutDedupe,this.grouping,this.groupBy,this.groupLabel,this.groupOrder,size];this.hasUpdated&&this.sourceQueryInputs&&queryInputs.some((value,index)=>value!==this.sourceQueryInputs[index])&&(page=0,this.sourcePage=0),this.sourceQueryInputs=queryInputs;const inputs=[source,source.revision,this.sourceEpoch,this.effectiveLocale,...queryInputs,page];if(!force&&this.sourceInputs&&inputs.every((value,index)=>value===this.sourceInputs[index]))return;(!this.sourceInputs||inputs.slice(0,3).some((value,index)=>value!==this.sourceInputs[index]))&&(this.sourceSelectionInputs=void 0,this.sourceSelectionEvent=void 0),this.sourceInputs=inputs,this.sourceVersion++,this.focusRestoreGeneration++,this.sourceRows=[],this.sourceGroups=[],this.sourceResult=void 0,this.sourceReveal=void 0,this.expandedChunkIds=[],this.sourcePages.bind({source:this.canonicalSourceAdapter(source),revision:source.revision,epoch:this.sourceEpoch,locale:this.effectiveLocale});const query=Object.freeze({sort:this.sort,withoutDedupe:this.withoutDedupe,grouping:this.grouping,groupBy:this.groupBy,groupLabel:this.groupLabel,groupOrder:this.groupOrder});this.sourcePages.request(query,page,size)}catch{this.sourcePages.bind(void 0),this.sourceRows=[],this.sourceGroups=[],this.sourceResult=void 0}finally{this.sourceSyncing=!1}}}syncSourceSelection(){if(!this.sourceMode||!this.isConnected||!this.sourceAdapter||!this.sourceInputs)return;const ids=this.selectedChunkIds,source=this.dataSource,epoch=this.sourceEpoch,revision=source.revision,inputs=[source,revision,epoch,ids];if(this.sourceSelectionInputs&&inputs.every((value,index)=>value===this.sourceSelectionInputs[index]))return;this.sourceSelectionInputs=inputs,this.sourceSelectionFailed=!1;const owner=this.ownerDocument,lifecycle=this.sourceLifecycle,canonicalIds=canonicalIdentityList(ids);this.sourcePages.resolveSelection(canonicalIds).then(records=>{if(source.revision!==revision||lifecycle!==this.sourceLifecycle||!this.isConnected||this.ownerDocument!==owner||this.dataSource!==source||this.sourceEpoch!==epoch||this.selectedChunkIds!==ids)return;if(!records){this.sourceSelectionFailed=!0,this.sourceStateVersion++;return}const retained=new Set(records.map(record=>record.key)),accepted=canonicalIds.filter(id=>retained.has(id)),report=this.sourceSelectionEvent===ids;this.sourceSelectionEvent=void 0,accepted.length!==ids.length&&(this.selectedChunkIds=accepted);const committed=this.selectedChunkIds;if(report){const chunks=records.map(record=>record.value);this.emit("lr-selection-change",{selectedChunkIds:[...committed],chunks}),source.revision===revision&&lifecycle===this.sourceLifecycle&&this.isConnected&&this.ownerDocument===owner&&this.dataSource===source&&this.sourceEpoch===epoch&&this.selectedChunkIds===committed&&this.emit("lr-select",{chunkIds:[...committed],chunks})}this.sourceStateVersion++})}acceptSourcePage(){const result=this.sourcePages.state.result;if(!result||result===this.sourceResult)return;this.sourceResult=result,this.sourceRows=result.rows.map(record=>record.value);const start=this.sourcePages.state.page*this.sourcePages.state.pageSize;this.sourceGroups=(result.groups??[]).map(group=>({key:group.key,label:group.label,startIndex:Math.max(0,group.startIndex-start)})),this.sourcePage!==this.sourcePages.state.page&&(this.sourceSyncing=!0,this.sourcePage=this.sourcePages.state.page,this.sourceSyncing=!1,this.sourceInputs=this.sourceInputs?[...this.sourceInputs.slice(0,-1),this.sourcePages.state.page]:void 0);const reveal=this.sourceReveal;this.sourceReveal=void 0,reveal?.version===this.sourceVersion&&this.revealSourceActive(reveal.id,reveal.version)}syncSourceActive(){if(!this.activeChunkId){this.sourceActiveInputs=void 0;return}if(this.sourceBlocked)return;const source=this.dataSource,id=this.activeChunkId,inputs=[source,source.revision,this.sourceEpoch,this.effectiveLocale,...this.sourceQueryInputs??[],id];if(this.sourceActiveInputs&&inputs.every((value,index)=>value===this.sourceActiveInputs[index]))return;this.sourceActiveInputs=inputs;const version=this.sourceVersion,owner=this.ownerDocument;this.sourcePages.locate(id).then(index=>{if(index===null||!this.isConnected||this.ownerDocument!==owner||!this.sourceMode||this.dataSource!==source||this.sourceVersion!==version||this.activeChunkId!==id)return;const page=Math.floor(index/finiteInteger(this.sourcePageSize,100,1,500));if(page===this.sourcePage){this.revealSourceActive(id,version);return}this.sourcePage=page,this.sourceReveal={id,version:this.sourceVersion}})}revealSourceActive(id,version){const owner=this.ownerDocument;this.updateComplete.then(async()=>{const list=this.renderRoot.querySelector(tag("virtual-list"));if(!list||(await list.updateComplete,!this.isConnected||this.ownerDocument!==owner||!this.sourceMode||this.sourceBlocked||this.sourceVersion!==version||this.activeChunkId!==id||list!==this.renderRoot.querySelector(tag("virtual-list"))))return;const index=this.sourceRows.findIndex(chunk=>chunk.id===id);index>=0&&list.scrollToIndex(index,{align:"auto",behavior:"auto"})})}currentSourceRow(chunk){return!(this.sourceMode||this.sourceRowKeys.has(chunk))||this.sourceMode&&!this.sourceBlocked&&this.sourceRows.includes(chunk)}invalidateSourceLifecycle(){this.sourceLifecycle++,this.sourceVersion++,this.focusRestoreGeneration++,this.sourceSelectionInputs=void 0,this.sourceSelectionEvent=void 0,this.sourceActiveInputs=void 0,this.sourceReveal=void 0,this.sourceStatusInitialized=!1,this.sourceStatus=""}adoptedCallback(){this.invalidateSourceLifecycle(),this.sourcePages.adopted(),super.adoptedCallback()}requestUpdate(...args){args[0]===void 0&&(this.explicitRefresh=!0,this.sourceEpoch=(this.sourceEpoch??0)+1),args[0]==="selectedChunkIds"&&(this.sourceSelectionEvent=void 0),(args[0]===void 0||["dataSource","sourcePage","sourcePageSize","sort","withoutDedupe","grouping","groupBy","groupLabel","groupOrder"].includes(String(args[0])))&&this.syncSource(),super.requestUpdate(...args)}inputLimitText(){if(this.sourceMode)return"";const truncation=publicCollectionTruncation(this,"chunks"),number=getNumberFormat(this.effectiveLocale);return truncation?this.localize("retrievalResultsInputLimit",void 0,{count:number.format(truncation.retained),total:number.format(truncation.source)}):""}renderInputLimit(){const text=this.inputLimitText();return text?html`<p part="limit" role="note">${text}</p>`:nothing}connectedCallback(){super.connectedCallback(),this.errorAnnouncementSink??=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}),this.emptyAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this});const generation=++this.connectionGeneration;announceAfterFirstPaint(this,()=>generation===this.connectionGeneration,()=>{!this.announce||this.initialStateAnnounced||(this.initialStateAnnounced=!0,this.announcePresentedState())})}disconnectedCallback(){this.invalidateSourceLifecycle(),this.isMounting=!0,this.connectionGeneration+=1,this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0,this.emptyAnnouncementSink?.release(),this.emptyAnnouncementSink=void 0,this.wasEmptyPresented=!1,super.disconnectedCallback()}deepActiveElement(){return deepActiveElementIn(this.isConnected?this.shadowRoot:null)}chunkAnchor(start){let current=start;for(;current&¤t!==this;){if(current.hasAttribute("data-chunk-id"))return current;if(current.parentElement){current=current.parentElement;continue}const root=current.getRootNode();current=root.nodeType===11&&"host"in root?root.host:null}return null}renderedChunkIds(){const roots=[this.renderRoot],virtualList=this.renderRoot.querySelector(tag("virtual-list"));return virtualList?.shadowRoot&&roots.push(virtualList.shadowRoot),roots.flatMap(root=>[...root.querySelectorAll(`${tag("chunk-inspector")}[data-chunk-id]`)].map(element=>element.getAttribute("data-chunk-id")).filter(id=>id!==null))}willUpdate(changed){if(super.willUpdate(changed),this.syncSource(),this.sourceMode){this.acceptSourcePage(),this.syncSourceSelection(),this.syncSourceActive();return}const refresh=this.explicitRefresh;this.explicitRefresh=!1;const groupingLocaleSignature=this.grouping==="source"?`${this.effectiveLocale}\0${this.localize("untitledSource")}`:"";if((this.processedChunksCache===void 0||refresh||changed.has("chunks")||changed.has("withoutDedupe")||changed.has("sort")||changed.has("grouping")||changed.has("groupBy")||changed.has("groupLabel")||changed.has("groupOrder")||groupingLocaleSignature!==this.processedGroupingLocaleSignature)&&(this.processedGroupingLocaleSignature=groupingLocaleSignature,this.processedChunksCache=this.computeProcessedChunks()),changed.has("chunks")){const present=new Set(this.processedChunks.chunks.map(chunk=>chunk.id)),kept=this.expandedChunkIds.filter(id=>present.has(id));kept.length!==this.expandedChunkIds.length&&(this.expandedChunkIds=kept)}if(changed.has("chunks")||changed.has("selectedChunkIds")){const normalized=this.normalizedSelectedChunkIds();if(normalized.length!==this.selectedChunkIds.length||normalized.some((id,index)=>id!==this.selectedChunkIds[index])){const shouldAnnounce=this.hasUpdated&&changed.has("chunks");writeNormalizedOwnedCollection(this,"selectedChunkIds",()=>{this.selectedChunkIds=normalized}),shouldAnnounce&&this.reportSelection(normalized)}}if(!changed.has("chunks")&&!changed.has("withoutDedupe")&&!changed.has("sort")&&!changed.has("grouping")&&!changed.has("groupBy")&&!changed.has("groupLabel")&&!changed.has("groupOrder")&&!changed.has("presentation")&&!changed.has("withoutSelection")&&!changed.has("virtualizeAt")&&!changed.has("loading")&&!changed.has("errorText"))return;const focusedId=this.chunkAnchor(this.deepActiveElement())?.getAttribute("data-chunk-id");if(!focusedId)return;const previousIds=this.previousProcessedChunkIds.length?this.previousProcessedChunkIds:this.renderedChunkIds(),focusedIndex=Math.max(0,previousIds.indexOf(focusedId)),nextChunks=this.errorText?[]:this.processedChunks.chunks;if(nextChunks.length===0){this.pendingFocusTarget="base";return}const survivingIndex=nextChunks.findIndex(chunk=>chunk.id===focusedId),nextIndex=survivingIndex>=0?survivingIndex:Math.min(focusedIndex,nextChunks.length-1);this.pendingFocusTarget=nextChunks[nextIndex].id}updated(changed){if(super.updated(changed),this.sourceMode){const status=this.sourcePages.state.pending?this.localize("loading"):this.sourcePages.state.result?this.sourcePages.state.selectionPending?this.localize("sourceSelectionLoading"):this.sourceSelectionFailed?this.localize("sourceSelectionFailed"):"":this.localize("tableLoadFailed");this.sourceStatusInitialized&&status&&status!==this.sourceStatus&&this.emptyAnnouncementSink?.announce(status),this.sourceStatusInitialized=!0,this.sourceStatus=status;return}const inputTruncated=publicCollectionTruncation(this,"chunks")!==void 0;this.limitInitialized&&inputTruncated&&!this.previouslyInputTruncated&&this.emptyAnnouncementSink?.announce(this.inputLimitText()),this.limitInitialized=!0,this.previouslyInputTruncated=inputTruncated;const wasMounting=this.isMounting;this.isMounting=!1,!wasMounting&&changed.has("errorText")&&this.errorText!==""&&this.isConnected&&(this.initialStateAnnounced=!0,this.errorAnnouncementSink?.announce(this.errorText));const emptyPresented=!this.loading&&this.errorText===""&&this.processedChunks.chunks.length===0;!wasMounting&&!this.wasEmptyPresented&&emptyPresented&&this.isConnected&&(this.initialStateAnnounced=!0,this.emptyAnnouncementSink?.announce(this.localize("chunkInspectorEmpty"))),this.wasEmptyPresented=emptyPresented,this.previousProcessedChunkIds=this.errorText?[]:this.processedChunks.chunks.map(chunk=>chunk.id);const generation=++this.focusRestoreGeneration,target=this.pendingFocusTarget;target!==void 0&&(this.pendingFocusTarget=void 0,this.restoreControlledFocus(target,generation))}announcePresentedState(){if(!this.sourceMode){if(this.errorText!==""){this.errorAnnouncementSink?.announce(this.errorText);return}!this.loading&&this.processedChunks.chunks.length===0&&this.emptyAnnouncementSink?.announce(this.localize("chunkInspectorEmpty"))}}async restoreControlledFocus(target,generation){if(await this.updateComplete,generation!==this.focusRestoreGeneration||!this.isConnected)return;if(target==="base"){this.renderRoot.querySelector('[part="base"]')?.focus();return}const virtualList=this.renderRoot.querySelector(tag("virtual-list"));if(await virtualList?.updateComplete,generation!==this.focusRestoreGeneration||!this.isConnected)return;const roots=[this.renderRoot];virtualList?.shadowRoot&&roots.push(virtualList.shadowRoot);const candidates=roots.flatMap(root=>[...root.querySelectorAll("[data-chunk-id]")]),checkbox=candidates.find(element=>element.localName===tag("checkbox")&&element.getAttribute("data-chunk-id")===target);if(checkbox){checkbox.focus();return}const inspector=candidates.find(element=>element.localName===tag("chunk-inspector")&&element.getAttribute("data-chunk-id")===target);await inspector?.updateComplete,!(generation!==this.focusRestoreGeneration||!this.isConnected)&&inspector?.shadowRoot?.querySelector('[part="open-button"]')?.focus()}get effectiveVirtualizeAt(){return finiteCount(this.virtualizeAt,50)}canonicalChunks(){return this.canonicalSource!==this.chunks&&(this.canonicalSource=this.chunks,this.canonicalCache=firstByRetrievalIdentity(this.chunks.flatMap(value=>projectRetrievalChunk(value)??[]),chunk=>chunk.id),this.canonicalById=new Map(this.canonicalCache.map(chunk=>[chunk.id,chunk])),this.canonicalOrder=new Map(this.canonicalCache.map((chunk,index)=>[chunk.id,index]))),this.canonicalCache}normalizedSelectedChunkIds(){return this.canonicalSource!==this.chunks&&this.canonicalChunks(),canonicalIdentityList(this.selectedChunkIds).filter(id=>this.canonicalById.has(id))}get processedChunks(){return this.sourceMode?{chunks:this.sourceRows,groups:this.sourceGroups}:this.processedChunksCache??=this.computeProcessedChunks()}computeProcessedChunks(){const canonical=this.canonicalChunks(),sorted=this.sort==="score"?[...canonical].sort((a,b)=>safeScore(b.score)-safeScore(a.score)):canonical;if(this.grouping==="source")return this.bucketed(sorted,chunk=>chunk.source.id,(_id,groupChunks)=>groupChunks[0].source.name||this.localize("untitledSource"));if(this.grouping==="custom"&&this.groupBy){const groupBy=this.groupBy;return this.bucketed(sorted,groupBy,(id,groupChunks)=>this.groupLabel?.(id,groupChunks)??id)}return{chunks:sorted,groups:[]}}orderedGroupKeys(grouped){const firstSeen=[...grouped.keys()];if(this.grouping!=="custom"||!this.groupOrder)return firstSeen;if(typeof this.groupOrder=="function")return firstSeen.sort(this.groupOrder);const ordered=[...new Set(this.groupOrder)].filter(id=>grouped.has(id)),listed=new Set(ordered);return[...ordered,...firstSeen.filter(id=>!listed.has(id))]}bucketed(sorted,keyOf,labelOf){const grouped=new Map;for(const chunk of sorted){const key=keyOf(chunk),existing=grouped.get(key);existing?existing.push(chunk):grouped.set(key,[chunk])}const rows=[],groups=[];for(const key of this.orderedGroupKeys(grouped)){const groupChunks=grouped.get(key);!groupChunks||groupChunks.length===0||(groups.push({key,label:labelOf(key,groupChunks),startIndex:rows.length}),rows.push(...groupChunks))}return{chunks:rows,groups}}reportSelection(chunkIds){this.canonicalSource!==this.chunks&&this.canonicalChunks();const chunks=[...new Set(chunkIds)].flatMap(id=>this.canonicalById.get(id)??[]).sort((a,b)=>this.canonicalOrder.get(a.id)-this.canonicalOrder.get(b.id));this.emit("lr-selection-change",snapshotEventDetail({selectedChunkIds:chunkIds,chunks},this.ownerDocument.defaultView)),this.emit("lr-select",snapshotEventDetail({chunkIds,chunks},this.ownerDocument.defaultView))}toggleSelect(chunk){if(!this.currentSourceRow(chunk)||this.sourceSelectionBlocked)return;if(this.sourceMode){const next2=new Set(this.selectedChunkIds);next2.has(chunk.id)?next2.delete(chunk.id):next2.size<1e4&&next2.add(chunk.id),this.selectedChunkIds=[...next2],this.sourceSelectionEvent=this.selectedChunkIds;return}const next=new Set(this.normalizedSelectedChunkIds());next.has(chunk.id)?next.delete(chunk.id):next.add(chunk.id),this.selectedChunkIds=[...next],this.reportSelection(this.selectedChunkIds)}rowChunksFor(chunk){let row=this.rowChunks.get(chunk);return row||this.rowChunks.set(chunk,row=[toLyraChunk(chunk)]),row}renderMetadata(metadata){return renderRetrievalMetadata(metadata,this.effectiveLocale,this.localize("valueInvalid"),this.localize("valueTruncated"))}isChunkSelected(id){const source=this.selectedChunkIds;return source.length===0||this.processedChunks.chunks.length<=1?(this.selectedMembership=void 0,source.includes(id)):(this.selectedMembership?.source!==source&&(this.selectedMembership={source,ids:new Set(source)}),this.selectedMembership.ids.has(id))}legacyLoadMoreHandler(){const chunks=this.chunks,version=this.sourceVersion;return event=>{event.stopPropagation(),!(!this.isConnected||this.sourceMode||this.sourceVersion!==version||this.chunks!==chunks||!this.hasMore||this.loading||this.errorText||event.currentTarget?.getRootNode()!==this.renderRoot)&&this.emit("lr-load-more")}}renderLoadMoreFooter(){return this.hasMore?html`
|
|
35
36
|
<div part="load-more-row">
|
|
36
37
|
${this.loading?html`<lr-spinner part="spinner"></lr-spinner>`:html`<button
|
|
37
38
|
type="button"
|
|
38
39
|
part="load-more"
|
|
39
|
-
@click=${
|
|
40
|
+
@click=${this.legacyLoadMoreHandler()}
|
|
40
41
|
>
|
|
41
42
|
${this.localize("loadMore")}
|
|
42
43
|
</button>`}
|
|
43
44
|
</div>
|
|
44
|
-
`:nothing}
|
|
45
|
+
`:nothing}renderSource(){const state2=this.sourcePages.state,source=this.dataSource,version=this.sourceVersion,current=()=>this.isConnected&&this.sourceMode&&this.dataSource===source&&this.sourcePages.state===state2&&this.sourceVersion===version,rows=this.sourceRows;return html`<div part="base" tabindex="-1" role=${retrievalSemanticRole(this,"group")??nothing}
|
|
46
|
+
aria-label=${retrievalSemanticLabel(this,this.label??this.localize("chunkInspectorLabel"))??nothing}>
|
|
47
|
+
${this.errorText?html`<div part="error">${this.errorText}</div>`:state2.pending?html`<p part="source-status">${this.localize("loading")}</p>`:state2.result?rows.length?html`<lr-virtual-list
|
|
48
|
+
exportparts="row:row, group:group-header, select:select, row-body:row-body, row-body-selected:row-body-selected, metadata:metadata, metadata-entry:metadata-entry, metadata-term:metadata-term, metadata-value:metadata-value, chunk:chunk, chunk-current:chunk-current, chunk-score:chunk-score, chunk-score-current:chunk-score-current, chunk-score-bar:chunk-score-bar, chunk-score-fill:chunk-score-fill, chunk-score-fill-success:chunk-score-fill-success, chunk-score-fill-warning:chunk-score-fill-warning, chunk-score-fill-danger:chunk-score-fill-danger, chunk-open-button:chunk-open-button, chunk-title:chunk-title, chunk-text:chunk-text, chunk-text-clamped:chunk-text-clamped, chunk-toggle:chunk-toggle"
|
|
49
|
+
.items=${guard([rows],()=>rows)} .groups=${this.sourceGroups}
|
|
50
|
+
.keyFunction=${this.retrievalChunkKey}
|
|
51
|
+
.renderItem=${(item,index)=>this.renderRow(item,state2.page*state2.pageSize+index,state2.result.total)}
|
|
52
|
+
@lr-load-more=${this.stopOwnedEvent} @lr-virtual-scroll=${this.stopOwnedEvent} @lr-visible-range-change=${this.stopOwnedEvent}
|
|
53
|
+
></lr-virtual-list>`:html`<lr-empty part="empty" heading=${this.localize("chunkInspectorEmpty")}></lr-empty>`:html`<p part="source-status">${this.localize("tableLoadFailed")} <button type="button" part="source-retry" @click=${()=>{current()&&(this.syncSource(!0),this.sourceStateVersion++)}}>${this.localize("retry")}</button></p>`}
|
|
54
|
+
${state2.selectionPending||this.sourceSelectionFailed?html`<p part="source-selection-status">${this.localize(state2.selectionPending?"sourceSelectionLoading":"sourceSelectionFailed")}
|
|
55
|
+
${this.sourceSelectionFailed?html`<button type="button" part="source-selection-retry" @click=${()=>{current()&&(this.sourceSelectionInputs=void 0,this.syncSourceSelection())}}>${this.localize("retry")}</button>`:nothing}</p>`:nothing}
|
|
56
|
+
<lr-pagination part="source-pagination" format="compact" .strings=${this.strings}
|
|
57
|
+
.page=${finiteInteger(this.sourcePage,0,0,Number.MAX_SAFE_INTEGER-1)+1} .pageSize=${finiteInteger(this.sourcePageSize,100,1,500)}
|
|
58
|
+
.total=${this.sourceTotal??-1} .disabled=${this.sourceBlocked||this.sourceTotal===null}
|
|
59
|
+
@lr-page-change=${event=>{event.stopPropagation(),this.sourceBlocked||(this.sourcePage=event.detail.page-1)}}
|
|
60
|
+
@lr-before-page-change=${this.stopOwnedEvent} @lr-activate=${this.stopOwnedEvent} @focus=${this.stopOwnedEvent} @blur=${this.stopOwnedEvent}
|
|
61
|
+
></lr-pagination>
|
|
62
|
+
</div>`}render(){if((this.selectedMembership?.source!==this.selectedChunkIds||this.errorText||this.chunks.length<=1)&&(this.selectedMembership=void 0),this.sourceMode)return this.renderSource();const label=retrievalSemanticLabel(this,this.label==null?this.localize("chunkInspectorLabel"):this.label),groupRole=retrievalSemanticRole(this,"group");if(this.errorText)return html`<div part="base" tabindex="-1">
|
|
63
|
+
${this.renderInputLimit()}
|
|
45
64
|
<div part="error">${this.errorText}</div>
|
|
46
65
|
</div>`;const processed=this.processedChunks;if(processed.chunks.length<=1&&(this.selectedMembership=void 0),processed.chunks.length===0)return this.loading?html`<div part="base" tabindex="-1">
|
|
66
|
+
${this.renderInputLimit()}
|
|
47
67
|
<lr-spinner part="spinner"></lr-spinner>
|
|
48
68
|
</div>`:html`<div part="base" tabindex="-1">
|
|
69
|
+
${this.renderInputLimit()}
|
|
49
70
|
<lr-empty
|
|
50
71
|
part="empty"
|
|
51
72
|
heading=${this.localize("chunkInspectorEmpty")}
|
|
52
73
|
></lr-empty>
|
|
53
|
-
</div>`;const useVirtualList=processed.groups.length>0||processed.chunks.length>this.effectiveVirtualizeAt,ordinalById=new Map(processed.chunks.map((chunk,index)=>[chunk.id,index])),renderVirtualRow=item=>this.renderRow(item,ordinalById.get(item.id)??0,processed.chunks.length);return html`
|
|
74
|
+
</div>`;const useVirtualList=processed.groups.length>0||processed.chunks.length>this.effectiveVirtualizeAt;this.ordinalSource!==processed.chunks&&(this.ordinalSource=processed.chunks,this.ordinalById=new Map(processed.chunks.map((chunk,index)=>[chunk.id,index])));const ordinalById=this.ordinalById,renderVirtualRow=item=>this.renderRow(item,ordinalById.get(item.id)??0,processed.chunks.length);return html`
|
|
54
75
|
<div
|
|
55
76
|
part="base"
|
|
56
77
|
role=${groupRole??nothing}
|
|
57
78
|
tabindex="-1"
|
|
58
79
|
aria-label=${label??nothing}
|
|
59
80
|
>
|
|
81
|
+
${this.renderInputLimit()}
|
|
60
82
|
${useVirtualList?html`<lr-virtual-list
|
|
61
83
|
exportparts="row:row, group:group-header, select:select, row-body:row-body, row-body-selected:row-body-selected, metadata:metadata, metadata-entry:metadata-entry, metadata-term:metadata-term, metadata-value:metadata-value, chunk:chunk, chunk-current:chunk-current, chunk-score:chunk-score, chunk-score-current:chunk-score-current, chunk-score-bar:chunk-score-bar, chunk-score-fill:chunk-score-fill, chunk-score-fill-success:chunk-score-fill-success, chunk-score-fill-warning:chunk-score-fill-warning, chunk-score-fill-danger:chunk-score-fill-danger, chunk-open-button:chunk-open-button, chunk-title:chunk-title, chunk-text:chunk-text, chunk-text-clamped:chunk-text-clamped, chunk-toggle:chunk-toggle"
|
|
62
84
|
.items=${guard([processed.chunks],()=>processed.chunks)}
|
|
@@ -66,7 +88,7 @@ import{__decorate}from"tslib";import{collectionSupport,writeNormalizedOwnedColle
|
|
|
66
88
|
.activeItemId=${this.activeChunkId||""}
|
|
67
89
|
?loading=${this.loading}
|
|
68
90
|
?has-more=${this.hasMore}
|
|
69
|
-
@lr-load-more=${
|
|
91
|
+
@lr-load-more=${this.legacyLoadMoreHandler()}
|
|
70
92
|
@lr-virtual-scroll=${this.stopOwnedEvent}
|
|
71
93
|
@lr-visible-range-change=${this.stopOwnedEvent}
|
|
72
94
|
></lr-virtual-list>`:html`<div role="list">
|
|
@@ -76,4 +98,4 @@ import{__decorate}from"tslib";import{collectionSupport,writeNormalizedOwnedColle
|
|
|
76
98
|
</div>
|
|
77
99
|
${this.renderLoadMoreFooter()}`}
|
|
78
100
|
</div>
|
|
79
|
-
`}}__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"chunks",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"selectedChunkIds",void 0),__decorate([property({type:Boolean,attribute:"without-selection",reflect:!0})],LyraRetrievalResults.prototype,"withoutSelection",void 0),__decorate([property({type:Boolean,attribute:"without-dedupe",reflect:!0})],LyraRetrievalResults.prototype,"withoutDedupe",void 0),__decorate([property()],LyraRetrievalResults.prototype,"sort",void 0),__decorate([property()],LyraRetrievalResults.prototype,"grouping",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"groupBy",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"groupLabel",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"groupOrder",void 0),__decorate([property()],LyraRetrievalResults.prototype,"presentation",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"thresholds",void 0),__decorate([property({type:Number,attribute:"virtualize-at"})],LyraRetrievalResults.prototype,"virtualizeAt",void 0),__decorate([property({attribute:"active-chunk-id"})],LyraRetrievalResults.prototype,"activeChunkId",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraRetrievalResults.prototype,"loading",void 0),__decorate([property({type:Boolean,attribute:"has-more",reflect:!0})],LyraRetrievalResults.prototype,"hasMore",void 0),__decorate([property({attribute:"error-text"})],LyraRetrievalResults.prototype,"errorText",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraRetrievalResults.prototype,"announce",void 0),__decorate([property()],LyraRetrievalResults.prototype,"label",void 0),__decorate([state()],LyraRetrievalResults.prototype,"expandedChunkIds",void 0);export{LyraRetrievalResults};
|
|
101
|
+
`}}__decorate([state()],LyraRetrievalResults.prototype,"sourceStateVersion",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"dataSource",null),__decorate([property({type:Number,attribute:"source-page"})],LyraRetrievalResults.prototype,"sourcePage",void 0),__decorate([property({type:Number,attribute:"source-page-size"})],LyraRetrievalResults.prototype,"sourcePageSize",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"chunks",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"selectedChunkIds",void 0),__decorate([property({type:Boolean,attribute:"without-selection",reflect:!0})],LyraRetrievalResults.prototype,"withoutSelection",void 0),__decorate([property({type:Boolean,attribute:"without-dedupe",reflect:!0})],LyraRetrievalResults.prototype,"withoutDedupe",void 0),__decorate([property()],LyraRetrievalResults.prototype,"sort",void 0),__decorate([property()],LyraRetrievalResults.prototype,"grouping",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"groupBy",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"groupLabel",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"groupOrder",void 0),__decorate([property()],LyraRetrievalResults.prototype,"presentation",void 0),__decorate([property({attribute:!1})],LyraRetrievalResults.prototype,"thresholds",void 0),__decorate([property({type:Number,attribute:"virtualize-at"})],LyraRetrievalResults.prototype,"virtualizeAt",void 0),__decorate([property({attribute:"active-chunk-id"})],LyraRetrievalResults.prototype,"activeChunkId",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraRetrievalResults.prototype,"loading",void 0),__decorate([property({type:Boolean,attribute:"has-more",reflect:!0})],LyraRetrievalResults.prototype,"hasMore",void 0),__decorate([property({attribute:"error-text"})],LyraRetrievalResults.prototype,"errorText",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraRetrievalResults.prototype,"announce",void 0),__decorate([property()],LyraRetrievalResults.prototype,"label",void 0),__decorate([state()],LyraRetrievalResults.prototype,"expandedChunkIds",void 0);export{LyraRetrievalResults};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @deprecated Import @aceshooting/lyra-ui/components/lr-retrieval-results.js to register this component. */
|
|
2
|
-
export*from'./retrieval-results.class.js';import'../../layout/virtual-list/virtual-list.js';import'../chunk-inspector/chunk-inspector.js';import'../../forms/checkbox/checkbox.js';import'../../overlays/spinner/spinner.js';import'../../overlays/empty/empty.js';
|
|
2
|
+
export*from'./retrieval-results.class.js';import'../../layout/virtual-list/virtual-list.js';import'../../data/pagination/pagination.js';import'../chunk-inspector/chunk-inspector.js';import'../../forms/checkbox/checkbox.js';import'../../overlays/spinner/spinner.js';import'../../overlays/empty/empty.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./retrieval-results.class.js";import{LyraRetrievalResults}from"./retrieval-results.class.js";import{defineElement}from"../../../internal/prefix.js";import"../../layout/virtual-list/virtual-list.js";import"../chunk-inspector/chunk-inspector.js";import"../../forms/checkbox/checkbox.js";import"../../overlays/spinner/spinner.js";import"../../overlays/empty/empty.js";defineElement("retrieval-results",LyraRetrievalResults);
|
|
1
|
+
export*from"./retrieval-results.class.js";import{LyraRetrievalResults}from"./retrieval-results.class.js";import{defineElement}from"../../../internal/prefix.js";import"../../layout/virtual-list/virtual-list.js";import"../../data/pagination/pagination.js";import"../chunk-inspector/chunk-inspector.js";import"../../forms/checkbox/checkbox.js";import"../../overlays/spinner/spinner.js";import"../../overlays/empty/empty.js";defineElement("retrieval-results",LyraRetrievalResults);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; } [part='error'] { padding: var(--lr-space-m); color: var(--lr-color-danger); font-size: var(--lr-font-size-sm); } [part='row'] { display: flex; align-items: flex-start; gap: var(--lr-space-xs); padding-inline: var(--lr-space-s); padding-block: var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); } lr-virtual-list::part(row) { display: flex; align-items: flex-start; gap: var(--lr-space-xs); padding-inline: var(--lr-space-s); padding-block: var(--lr-space-s); } lr-virtual-list::part(group) { box-sizing: border-box; border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); } [part~='select'], lr-virtual-list::part(select) { flex: 0 0 auto; margin-block-start: var(--lr-space-2xs); } [part~='row-body'], lr-virtual-list::part(row-body) { flex: 1 1 auto; min-inline-size: 0; border-inline-start: var(--lr-space-2xs) solid transparent; padding-inline-start: var(--lr-space-xs); } [part~='row-body-selected'], lr-virtual-list::part(row-body-selected) { border-inline-start-color: var(--lr-retrieval-results-selected-border, var(--lr-color-brand)); } [part~='metadata'], lr-virtual-list::part(metadata) { display: flex; flex-wrap: wrap; gap: var(--lr-space-2xs) var(--lr-space-s); margin: var(--lr-space-2xs) 0 0; padding: 0; font-size: var(--lr-font-size-2xs); color: var(--lr-color-text-quiet); } [part~='metadata-entry'], lr-virtual-list::part(metadata-entry) { display: flex; gap: var(--lr-space-2xs); } [part~='metadata-term'], lr-virtual-list::part(metadata-term) { font-weight: var(--lr-font-weight-medium); } [part~='metadata-value'], lr-virtual-list::part(metadata-value) { margin: 0; overflow-wrap: anywhere; } [part='load-more-row'] { display: flex; justify-content: center; padding: var(--lr-space-s); } [part='load-more'] { box-sizing: border-box; ${iconHitTarget} border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: transparent; color: var(--lr-color-brand); font: inherit; font-size: var(--lr-font-size-sm); padding: var(--lr-space-2xs) var(--lr-space-m); cursor: pointer; transition: background-color var(--lr-transition-fast); } [part='load-more']:hover { background: var(--lr-color-brand-quiet); } [part='load-more']:active { background: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='load-more']:focus-visible { ${focusRing} } [part='empty'], [part='spinner'] { padding: var(--lr-space-l); } `;export{styles};
|
|
1
|
+
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; } [part='error'] { padding: var(--lr-space-m); color: var(--lr-color-danger); font-size: var(--lr-font-size-sm); } [part='row'] { display: flex; align-items: flex-start; gap: var(--lr-space-xs); padding-inline: var(--lr-space-s); padding-block: var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); } lr-virtual-list::part(row) { display: flex; align-items: flex-start; gap: var(--lr-space-xs); padding-inline: var(--lr-space-s); padding-block: var(--lr-space-s); } lr-virtual-list::part(group) { box-sizing: border-box; border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); } [part~='select'], lr-virtual-list::part(select) { flex: 0 0 auto; margin-block-start: var(--lr-space-2xs); } [part~='row-body'], lr-virtual-list::part(row-body) { flex: 1 1 auto; min-inline-size: 0; border-inline-start: var(--lr-space-2xs) solid transparent; padding-inline-start: var(--lr-space-xs); } [part~='row-body-selected'], lr-virtual-list::part(row-body-selected) { border-inline-start-color: var(--lr-retrieval-results-selected-border, var(--lr-color-brand)); } [part~='metadata'], lr-virtual-list::part(metadata) { display: flex; flex-wrap: wrap; gap: var(--lr-space-2xs) var(--lr-space-s); margin: var(--lr-space-2xs) 0 0; padding: 0; font-size: var(--lr-font-size-2xs); color: var(--lr-color-text-quiet); } [part~='metadata-entry'], lr-virtual-list::part(metadata-entry) { display: flex; gap: var(--lr-space-2xs); } [part~='metadata-term'], lr-virtual-list::part(metadata-term) { font-weight: var(--lr-font-weight-medium); } [part~='metadata-value'], lr-virtual-list::part(metadata-value) { margin: 0; overflow-wrap: anywhere; } [part='load-more-row'] { display: flex; justify-content: center; padding: var(--lr-space-s); } [part='load-more'] { box-sizing: border-box; ${iconHitTarget} border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: transparent; color: var(--lr-color-brand); font: inherit; font-size: var(--lr-font-size-sm); padding: var(--lr-space-2xs) var(--lr-space-m); cursor: pointer; transition: background-color var(--lr-transition-fast); } [part='load-more']:hover { background: var(--lr-color-brand-quiet); } [part='load-more']:active { background: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='load-more']:focus-visible { ${focusRing} } [part='empty'], [part='spinner'] { padding: var(--lr-space-l); } [part='limit'] { margin: 0; padding: var(--lr-space-s); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-sm); overflow-wrap: anywhere; } [part='source-status'], [part='source-selection-status'] { margin: 0; padding: var(--lr-space-s); overflow-wrap: anywhere; } [part='source-pagination'] { display: block; min-inline-size: 0; padding: var(--lr-space-s); } [part='source-retry'], [part='source-selection-retry'] { ${iconHitTarget} border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); padding: var(--lr-space-xs) var(--lr-space-s); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; cursor: pointer; transition: var(--lr-transition-interactive); } [part='source-retry']:hover, [part='source-selection-retry']:hover { background: color-mix(in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } [part='source-retry']:active, [part='source-selection-retry']:active { background: color-mix(in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part='source-retry']:focus-visible, [part='source-selection-retry']:focus-visible { ${focusRing} } `;export{styles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraClipboardWriteFailure,type LyraClipboardWriteSuccess}from'../../../internal/clipboard.js';import type{AnchorResultDetail,HighlightActivateDetail,LyraAnchor,LyraAnchorKind}from'../../viewers/document-viewer/anchors.js';import type{LyraSearchChangeDetail}from'../../../internal/text-viewer-target.js';import{type ShikiLanguageInput}from'../../conversation/code-block/
|
|
1
|
+
import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraClipboardWriteFailure,type LyraClipboardWriteSuccess}from'../../../internal/clipboard.js';import type{AnchorResultDetail,HighlightActivateDetail,LyraAnchor,LyraAnchorKind}from'../../viewers/document-viewer/anchors.js';import type{LyraSearchChangeDetail}from'../../../internal/text-viewer-target.js';import{type ShikiLanguageInput,type ShikiLanguageLoader}from'../../conversation/code-block/shiki-types.js';export interface LyraDiffViewEventMap{'lr-copy':CustomEvent<LyraClipboardWriteSuccess>;'lr-error':CustomEvent<null>;'lr-copy-error':CustomEvent<LyraClipboardWriteFailure>;
|
|
2
2
|
/** Fired whenever the search query, match count, or active match index changes, from
|
|
3
3
|
* `search()`/`searchNext()`/`searchPrevious()`/`clearSearch()`. */
|
|
4
4
|
'lr-search-change':CustomEvent<LyraSearchChangeDetail>;
|
|
@@ -54,7 +54,7 @@ export type LyraDiffViewLayout='unified'|'split';declare class LyraDiffViewBase
|
|
|
54
54
|
* line it first covers; emits `lr-highlight-activate`.
|
|
55
55
|
* @csspart copy-button - The copy affordance, only rendered while `copyable`; pinned to the top
|
|
56
56
|
* while the view scrolls.
|
|
57
|
-
* @csspart limit - The localized fallback
|
|
57
|
+
* @csspart limit - The localized render-limit fallback or syntax-highlighting limit notice.
|
|
58
58
|
* @csspart side - One column in `layout="split"` (`data-side="old"|"new"`).
|
|
59
59
|
* @cssprop [--lr-diff-view-max-height=none] - Cap on `[part="base"]`'s block size, past which the
|
|
60
60
|
* view scrolls internally. The `maxHeight` property sets this token inline on `[part="base"]`.
|
|
@@ -96,12 +96,17 @@ copyable:boolean;
|
|
|
96
96
|
* instead of growing the page. Invalid values are ignored. */
|
|
97
97
|
maxHeight:string;private _layout;get layout():LyraDiffViewLayout;set layout(next:LyraDiffViewLayout);
|
|
98
98
|
/** A shiki-recognized language id. Highlighting activates only when this has a matching entry in
|
|
99
|
-
* `languages` -- there is deliberately no default full-table
|
|
100
|
-
* this component never reaches shiki's
|
|
99
|
+
* `languages` or `languageLoaders` -- there is deliberately no default full-table
|
|
100
|
+
* `lr-code-block`-style fallback, so this component never reaches shiki's dynamic-import table. */
|
|
101
101
|
language:string;
|
|
102
|
-
/**
|
|
103
|
-
*
|
|
102
|
+
/** Resolved grammar definitions this instance can highlight. If either input exceeds 8,192
|
|
103
|
+
* UTF-16 code units, both sides retain their full
|
|
104
|
+
* plain source and a localized `limit` notice replaces syntax highlighting. */
|
|
104
105
|
languages?:Readonly<Record<string,ShikiLanguageInput>>;
|
|
106
|
+
/** Optional lazy grammar loaders. Concrete `languages` entries take priority on duplicate keys;
|
|
107
|
+
* only a requested loader runs. Unset preserves concrete-grammar highlighting.
|
|
108
|
+
* Assign a new map object after changing entries. */
|
|
109
|
+
languageLoaders?:Readonly<Record<string,ShikiLanguageLoader>>;
|
|
105
110
|
/** How many unchanged lines to keep visible immediately before/after each change. Default
|
|
106
111
|
* `undefined` renders every line unconditionally, exactly like before this property existed. Set
|
|
107
112
|
* to a finite number `>= 0` to collapse a longer run of unchanged lines behind a single fold
|
|
@@ -110,12 +115,15 @@ languages?:Readonly<Record<string,ShikiLanguageInput>>;
|
|
|
110
115
|
contextLines?:number;
|
|
111
116
|
/** Maximum lines accepted on either input side before rendering a bounded fallback. Defaults
|
|
112
117
|
* to `5000`. `Infinity` relaxes this line-count limit; aggregate text and comparison work
|
|
113
|
-
* remain bounded.
|
|
118
|
+
* remain bounded. All values also enforce a hard ceiling of 10,000 diff operations before
|
|
119
|
+
* rendering (at most 10,000 unified lines or 20,000 split cells, including empty cells).
|
|
120
|
+
* Above the ceiling a localized `limit` fallback replaces the diff. Rows use
|
|
121
|
+
* `content-visibility: auto` to defer offscreen paint. */
|
|
114
122
|
maxLines:number;
|
|
115
123
|
/** Anchor kinds this component resolves via `scrollToAnchor()`. Feature-detectable capability
|
|
116
124
|
* mirror -- the same pattern every other `DocumentAnchorTarget`-adopting viewer uses for this
|
|
117
125
|
* field. */
|
|
118
|
-
readonly anchorKinds:readonly LyraAnchorKind[];private copyStatus;private diffTooLarge;private copyAnnouncementSink?;private searchMatches;private searchMatchCountExact;private searchActiveIndex;private searchQuery;private lastSearchLocale;private pendingSearchResetEvent;private forcedVisibleOps;private readonly searchAnnouncements;private readonly searchAnnouncer;private highlightedOldLines;private highlightedNewLines;private highlightToken;private loadHighlighterCore;private copyTimer?;private copyGeneration;private oldTextSnapshot;private newTextSnapshot;private languageSnapshot;private languagesSnapshot?;private diffOps;private opIndexMap;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private hasSearchState;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private cancelCopyTimer;private resetCopyFeedback;private syncHighlight;private tokenizeLines;private computeFolds;private foldMarker;private revealOp;private lineElementForOpIndex;private scrollOpIndexIntoView;
|
|
126
|
+
readonly anchorKinds:readonly LyraAnchorKind[];private copyStatus;private diffTooLarge;private copyAnnouncementSink?;private searchMatches;private searchMatchCountExact;private searchActiveIndex;private searchQuery;private lastSearchLocale;private pendingSearchResetEvent;private forcedVisibleOps;private readonly searchAnnouncements;private readonly searchAnnouncer;private highlightedOldLines;private highlightedNewLines;private highlightToken;private loadHighlighterCore;private copyTimer?;private copyGeneration;private oldTextSnapshot;private newTextSnapshot;private languageSnapshot;private languagesSnapshot?;private diffOps;private opIndexMap;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private hasSearchState;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private cancelCopyTimer;private resetCopyFeedback;private get highlightLimited();private syncHighlight;private tokenizeLines;private computeFolds;private foldMarker;private revealOp;private lineElementForOpIndex;private scrollOpIndexIntoView;
|
|
119
127
|
/** Resolves a `line-range` anchor by scrolling the line at its 0-based `start` op index into
|
|
120
128
|
* view, first expanding any `contextLines` fold currently hiding it. `end` is not consulted
|
|
121
129
|
* here -- it only widens what a covering `highlights` entry paints; the scroll target is
|