@aceshooting/lyra-ui 9.1.0 → 10.0.1
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 +843 -0
- package/README.md +7 -0
- package/custom-elements.json +1 -1
- package/dist/cli/migrate-wa.mjs +52 -0
- package/dist/cli/migration-contract.json +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.js +2 -2
- package/dist/components/agent-tools/activity-feed/activity-feed.styles.js +0 -16
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.styles.js +9 -7
- package/dist/components/agent-tools/agent-run/agent-run.class.js +2 -2
- package/dist/components/agent-tools/agent-run/agent-run.styles.js +0 -13
- package/dist/components/agent-tools/agent-trace/agent-trace.class.js +1 -1
- package/dist/components/agent-tools/agent-trace/agent-trace.styles.js +7 -4
- package/dist/components/agent-tools/approval-queue/approval-queue.styles.js +7 -5
- package/dist/components/agent-tools/artifact-panel/artifact-panel.styles.js +0 -3
- package/dist/components/agent-tools/browser-frame/browser-frame.class.js +1 -1
- package/dist/components/agent-tools/browser-frame/browser-frame.styles.js +3 -5
- package/dist/components/agent-tools/commit-card/commit-card.class.js +1 -1
- package/dist/components/agent-tools/commit-card/commit-card.styles.js +0 -10
- package/dist/components/agent-tools/compare-panel/compare-panel.styles.js +11 -6
- package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
- package/dist/components/agent-tools/confirm-bar/confirm-bar.styles.js +0 -46
- package/dist/components/agent-tools/context-inspector/context-inspector.class.js +1 -1
- package/dist/components/agent-tools/eval-dataset/eval-dataset.styles.js +0 -7
- package/dist/components/agent-tools/eval-result/eval-result.class.js +1 -1
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +2 -2
- package/dist/components/agent-tools/policy-summary/policy-summary.class.js +1 -1
- package/dist/components/agent-tools/prompt-studio/prompt-studio.styles.js +0 -15
- package/dist/components/agent-tools/result-card/result-card.styles.js +0 -7
- package/dist/components/agent-tools/result-card/result-field.styles.js +0 -5
- package/dist/components/agent-tools/schema-viewer/schema-viewer.styles.js +2 -5
- package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +1 -1
- package/dist/components/agent-tools/span-waterfall/span-waterfall.styles.js +0 -15
- package/dist/components/agent-tools/stack-trace/stack-trace.styles.js +0 -20
- package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +2 -2
- package/dist/components/agent-tools/subagent-panel/subagent-panel.styles.js +1 -4
- package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
- package/dist/components/agent-tools/task-list/task-list.styles.js +0 -15
- package/dist/components/agent-tools/terminal/terminal.class.d.ts +11 -6
- package/dist/components/agent-tools/terminal/terminal.class.js +4 -4
- package/dist/components/agent-tools/terminal/terminal.styles.js +0 -46
- package/dist/components/agent-tools/test-results/test-results.class.js +2 -2
- package/dist/components/agent-tools/test-results/test-results.styles.js +0 -5
- package/dist/components/agent-tools/thinking-panel/thinking-panel.class.js +1 -1
- package/dist/components/agent-tools/thinking-panel/thinking-panel.styles.js +0 -41
- package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.styles.js +0 -41
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +2 -2
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.styles.js +0 -30
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +6 -6
- package/dist/components/agent-tools/tool-param-form/tool-param-form.styles.js +0 -5
- package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.js +2 -2
- package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.styles.js +0 -20
- package/dist/components/agent-tools/tool-result-view/tool-result-view.styles.js +0 -4
- package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.styles.js +0 -21
- package/dist/components/agent-tools/trace-tree/trace-tree.class.js +2 -2
- package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +7 -31
- package/dist/components/charts/chart/bar-chart.class.js +1 -1
- package/dist/components/charts/chart/box-plot.styles.js +0 -20
- package/dist/components/charts/chart/bubble-chart.class.js +1 -1
- package/dist/components/charts/chart/chart-colors.d.ts +1 -1
- package/dist/components/charts/chart/chart-colors.js +1 -1
- package/dist/components/charts/chart/chart-core-loader.d.ts +1 -0
- package/dist/components/charts/chart/chart-core-loader.js +1 -1
- package/dist/components/charts/chart/chart-feature-loader.d.ts +35 -0
- package/dist/components/charts/chart/chart-feature-loader.js +1 -1
- package/dist/components/charts/chart/chart.class.d.ts +93 -0
- package/dist/components/charts/chart/chart.class.js +3 -3
- package/dist/components/charts/chart/chart.styles.js +0 -27
- package/dist/components/charts/chart/doughnut-chart.class.js +1 -1
- package/dist/components/charts/chart/histogram.class.js +1 -1
- package/dist/components/charts/chart/line-chart.class.js +1 -1
- package/dist/components/charts/chart/lite-chart.class.d.ts +20 -1
- package/dist/components/charts/chart/lite-chart.class.js +4 -4
- package/dist/components/charts/chart/lite-chart.styles.js +0 -27
- package/dist/components/charts/chart/pie-chart.class.js +1 -1
- package/dist/components/charts/chart/polar-area-chart.class.js +1 -1
- package/dist/components/charts/chart/radar-chart.class.js +1 -1
- package/dist/components/charts/chart/scatter-chart.class.js +1 -1
- package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +20 -0
- package/dist/components/conversation/agent-workspace/agent-workspace.class.js +3 -1
- package/dist/components/conversation/agent-workspace/agent-workspace.styles.js +3 -0
- package/dist/components/conversation/audio-visualizer/audio-visualizer.styles.js +0 -7
- package/dist/components/conversation/branch-picker/branch-picker.styles.js +0 -3
- package/dist/components/conversation/chat-composer/chat-composer.styles.js +0 -51
- package/dist/components/conversation/chat-message/chat-message.class.js +2 -2
- package/dist/components/conversation/chat-message/chat-message.styles.js +13 -35
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/chat-viewport/chat-viewport.styles.js +0 -33
- package/dist/components/conversation/checkpoint/checkpoint.class.js +1 -1
- package/dist/components/conversation/checkpoint/checkpoint.styles.js +0 -3
- package/dist/components/conversation/code-block/code-block-shared.d.ts +5 -2
- package/dist/components/conversation/code-block/code-block.class.js +1 -1
- package/dist/components/conversation/code-block/code-block.styles.js +4 -95
- package/dist/components/conversation/code-block/code-loader.d.ts +11 -0
- package/dist/components/conversation/code-block/code-loader.js +1 -1
- package/dist/components/conversation/code-block/shiki-types.d.ts +12 -0
- package/dist/components/conversation/code-block/shiki-types.js +1 -1
- package/dist/components/conversation/conversation-item/conversation-item.styles.js +8 -54
- package/dist/components/conversation/generation-metrics/generation-metrics.class.js +2 -2
- package/dist/components/conversation/generation-metrics/generation-metrics.styles.js +0 -17
- package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
- package/dist/components/conversation/markdown/markdown.styles.js +0 -41
- package/dist/components/conversation/message-actions/message-actions.styles.js +0 -3
- package/dist/components/conversation/message-feedback/message-feedback.styles.js +0 -35
- package/dist/components/conversation/message-parts/message-parts.class.d.ts +1 -1
- package/dist/components/conversation/message-parts/message-parts.styles.js +0 -5
- package/dist/components/conversation/model-select/model-select.class.js +3 -3
- package/dist/components/conversation/model-select/model-select.styles.js +12 -47
- package/dist/components/conversation/model-settings-panel/model-settings-panel.styles.js +0 -6
- package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +3 -0
- package/dist/components/conversation/prompt-input/prompt-input.styles.js +0 -10
- package/dist/components/conversation/push-to-talk/push-to-talk.styles.js +0 -8
- package/dist/components/conversation/realtime-session/realtime-session.styles.js +1 -1
- package/dist/components/conversation/selection-toolbar/selection-toolbar.styles.js +1 -11
- package/dist/components/conversation/stream-status/stream-status.styles.js +0 -16
- package/dist/components/conversation/streaming-text/streaming-text.styles.js +0 -15
- package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +0 -5
- package/dist/components/conversation/thread-list/thread-list.styles.js +5 -19
- package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +16 -4
- package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
- package/dist/components/conversation/transcript-feed/transcript-feed.styles.js +0 -1
- package/dist/components/conversation/typing-indicator/typing-indicator.styles.js +0 -23
- package/dist/components/conversation/usage-badge/usage-badge.class.js +1 -1
- package/dist/components/conversation/usage-badge/usage-badge.styles.js +0 -3
- package/dist/components/conversation/voice-picker/voice-picker.class.js +3 -3
- package/dist/components/conversation/voice-picker/voice-picker.styles.js +9 -29
- package/dist/components/conversation/widget-renderer/resolve.d.ts +2 -0
- package/dist/components/conversation/widget-renderer/resolve.js +1 -1
- package/dist/components/data/calendar/calendar.class.d.ts +15 -2
- package/dist/components/data/calendar/calendar.class.js +2 -2
- package/dist/components/data/calendar/calendar.styles.js +2 -28
- package/dist/components/data/condition-builder/condition-builder.class.d.ts +10 -6
- package/dist/components/data/condition-builder/condition-builder.class.js +2 -2
- package/dist/components/data/condition-builder/condition-builder.styles.js +0 -6
- package/dist/components/data/context-meter/context-meter.styles.js +0 -24
- package/dist/components/data/data-grid/data-grid.class.js +3 -3
- package/dist/components/data/data-grid/data-grid.styles.js +0 -22
- package/dist/components/data/document-library/document-library.class.js +2 -2
- package/dist/components/data/document-library/document-library.styles.js +0 -4
- package/dist/components/data/env-list/env-list.class.js +1 -1
- package/dist/components/data/env-list/env-list.styles.js +7 -4
- package/dist/components/data/file-tree/file-tree.class.d.ts +12 -0
- package/dist/components/data/file-tree/file-tree.class.js +1 -1
- package/dist/components/data/flow-canvas/flow-canvas.styles.js +12 -19
- package/dist/components/data/flow-controls/flow-controls.class.js +2 -2
- package/dist/components/data/flow-controls/flow-controls.styles.js +3 -36
- package/dist/components/data/flow-minimap/flow-minimap.class.js +1 -1
- package/dist/components/data/flow-minimap/flow-minimap.styles.js +0 -9
- package/dist/components/data/flow-node/flow-node.styles.js +0 -23
- package/dist/components/data/flow-run-status/flow-run-status.class.js +1 -1
- package/dist/components/data/flow-run-status/flow-run-status.styles.js +0 -7
- package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +0 -7
- package/dist/components/data/graph-query-builder/graph-query-builder.class.js +1 -1
- package/dist/components/data/graph-query-builder/graph-query-builder.styles.js +0 -10
- package/dist/components/data/heatmap/heatmap-scale.d.ts +20 -0
- package/dist/components/data/heatmap/heatmap-scale.js +1 -1
- package/dist/components/data/heatmap/heatmap.class.d.ts +85 -2
- package/dist/components/data/heatmap/heatmap.class.js +2 -2
- package/dist/components/data/heatmap/heatmap.styles.js +0 -54
- package/dist/components/data/pagination/pagination.class.js +1 -1
- package/dist/components/data/pagination/pagination.styles.js +23 -46
- package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +34 -1
- package/dist/components/data/sequence-strip/sequence-strip.class.js +5 -2
- package/dist/components/data/sequence-strip/sequence-strip.styles.js +14 -20
- package/dist/components/data/sparkline/sparkline.class.js +1 -1
- package/dist/components/data/stat/stat.styles.js +0 -67
- package/dist/components/data/table/table.class.d.ts +42 -3
- package/dist/components/data/table/table.class.js +4 -4
- package/dist/components/data/table/table.styles.js +20 -91
- package/dist/components/data/timeline/timeline-item.styles.js +0 -30
- package/dist/components/data/timeline/timeline.class.d.ts +89 -1
- package/dist/components/data/timeline/timeline.class.js +2 -2
- package/dist/components/data/timeline/timeline.styles.js +111 -31
- package/dist/components/data/tree/tree-item.styles.js +1 -28
- package/dist/components/data/tree/tree.class.js +2 -2
- package/dist/components/data/tree/tree.styles.js +0 -6
- package/dist/components/data/word-cloud/word-cloud.styles.js +0 -5
- package/dist/components/forms/button/button.class.js +1 -1
- package/dist/components/forms/button/button.styles.js +1 -106
- package/dist/components/forms/checkbox/checkbox.class.d.ts +3 -0
- package/dist/components/forms/checkbox/checkbox.class.js +1 -1
- package/dist/components/forms/checkbox/checkbox.styles.js +0 -39
- package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +21 -2
- package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
- package/dist/components/forms/checkbox-group/checkbox-group.styles.js +0 -18
- package/dist/components/forms/code-editor/code-editor.styles.js +0 -30
- package/dist/components/forms/color-picker/color-picker.class.js +2 -2
- package/dist/components/forms/color-picker/color-picker.styles.js +0 -69
- package/dist/components/forms/combobox/combobox.class.js +2 -2
- package/dist/components/forms/combobox/combobox.styles.js +22 -111
- package/dist/components/forms/combobox/option.styles.js +7 -1
- package/dist/components/forms/date-picker/date-input.class.js +1 -1
- package/dist/components/forms/date-picker/date-input.styles.js +12 -67
- package/dist/components/forms/date-picker/date-picker.class.d.ts +1 -0
- package/dist/components/forms/date-picker/date-picker.class.js +22 -20
- package/dist/components/forms/date-picker/date-picker.styles.js +36 -29
- package/dist/components/forms/emoji-picker/emoji-data-loader.d.ts +6 -3
- package/dist/components/forms/emoji-picker/emoji-data-loader.js +1 -1
- package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +8 -1
- package/dist/components/forms/emoji-picker/emoji-picker.class.js +1 -1
- package/dist/components/forms/emoji-picker/emoji-picker.styles.js +3 -41
- package/dist/components/forms/icon-button/icon-button.class.js +1 -1
- package/dist/components/forms/icon-button/icon-button.styles.js +0 -16
- package/dist/components/forms/input/input.styles.js +0 -54
- package/dist/components/forms/input/number-input.styles.d.ts +4 -5
- package/dist/components/forms/input/number-input.styles.js +0 -11
- package/dist/components/forms/input/time-input-shared.d.ts +11 -0
- package/dist/components/forms/input/time-input-shared.js +1 -1
- package/dist/components/forms/input/time-input.class.d.ts +11 -2
- package/dist/components/forms/input/time-input.class.js +1 -1
- package/dist/components/forms/input/time-input.styles.js +0 -6
- package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
- package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -26
- package/dist/components/forms/otp-input/otp-input.class.js +3 -3
- package/dist/components/forms/otp-input/otp-input.styles.js +0 -16
- package/dist/components/forms/phone-input/phone-input.class.d.ts +9 -1
- package/dist/components/forms/phone-input/phone-input.class.js +2 -2
- package/dist/components/forms/phone-input/phone-input.styles.js +0 -37
- package/dist/components/forms/radio/radio-button.styles.js +1 -30
- package/dist/components/forms/radio/radio-group.styles.js +0 -4
- package/dist/components/forms/radio/radio.styles.js +0 -44
- package/dist/components/forms/rubric-form/rubric-form.styles.js +0 -5
- package/dist/components/forms/select/select.class.js +1 -1
- package/dist/components/forms/select/select.styles.js +14 -114
- package/dist/components/forms/slider/slider.styles.js +0 -55
- package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +0 -11
- package/dist/components/forms/swatch-picker/swatch-picker.class.js +2 -2
- package/dist/components/forms/swatch-picker/swatch-picker.styles.js +0 -77
- package/dist/components/forms/switch/switch.class.d.ts +3 -0
- package/dist/components/forms/switch/switch.class.js +1 -1
- package/dist/components/forms/switch/switch.styles.js +3 -38
- package/dist/components/forms/textarea/textarea.styles.js +0 -28
- package/dist/components/forms/time-range/time-range.styles.js +12 -84
- package/dist/components/forms/token-input/token-input.class.d.ts +23 -9
- package/dist/components/forms/token-input/token-input.class.js +1 -1
- package/dist/components/forms/token-input/token-input.styles.js +1 -54
- package/dist/components/layout/app-rail/app-rail-item.class.js +2 -2
- package/dist/components/layout/app-rail/app-rail-item.styles.js +0 -13
- package/dist/components/layout/app-rail/app-rail.class.d.ts +5 -0
- package/dist/components/layout/app-rail/app-rail.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail.styles.js +0 -46
- package/dist/components/layout/button-group/button-group.styles.js +0 -6
- package/dist/components/layout/card/card.class.d.ts +12 -0
- package/dist/components/layout/card/card.styles.js +5 -13
- package/dist/components/layout/carousel/carousel.styles.js +0 -1
- package/dist/components/layout/command-palette/command-palette.class.d.ts +8 -0
- package/dist/components/layout/command-palette/command-palette.class.js +3 -1
- package/dist/components/layout/command-palette/command-palette.styles.js +1 -13
- package/dist/components/layout/control-group/control-group.styles.js +0 -7
- package/dist/components/layout/dashboard-grid/dashboard-grid.class.js +1 -1
- package/dist/components/layout/dashboard-grid/dashboard-grid.styles.js +6 -25
- package/dist/components/layout/details/accordion.class.d.ts +13 -0
- package/dist/components/layout/details/accordion.class.js +1 -1
- package/dist/components/layout/details/details.class.js +1 -1
- package/dist/components/layout/details/details.styles.js +0 -12
- package/dist/components/layout/dock-panel/dock-panel.styles.js +0 -45
- package/dist/components/layout/drilldown-panel/drilldown-panel.class.d.ts +2 -0
- package/dist/components/layout/drilldown-panel/drilldown-panel.class.js +2 -2
- package/dist/components/layout/drilldown-panel/drilldown-panel.styles.js +0 -4
- package/dist/components/layout/filter-bar/filter-bar.class.js +1 -1
- package/dist/components/layout/filter-bar/filter-bar.styles.js +0 -9
- package/dist/components/layout/menu/menu-item.class.d.ts +5 -0
- package/dist/components/layout/menu/menu-item.class.js +1 -1
- package/dist/components/layout/menu/menu-item.styles.js +0 -49
- package/dist/components/layout/menu/menu-label.styles.js +0 -2
- package/dist/components/layout/menu/menu.styles.js +0 -18
- package/dist/components/layout/multi-split/multi-split.class.js +1 -1
- package/dist/components/layout/multi-split/multi-split.styles.js +8 -51
- package/dist/components/layout/page/page.class.d.ts +4 -0
- package/dist/components/layout/page/page.class.js +1 -1
- package/dist/components/layout/reorder-list/reorder-item.styles.js +0 -4
- package/dist/components/layout/responsive-panel/responsive-panel.styles.js +0 -27
- package/dist/components/layout/scroller/scroller.styles.js +0 -20
- package/dist/components/layout/segmented/segmented.class.d.ts +7 -1
- package/dist/components/layout/segmented/segmented.class.js +1 -1
- package/dist/components/layout/segmented/segmented.styles.js +69 -37
- package/dist/components/layout/split-panel/split-panel.styles.js +1 -7
- package/dist/components/layout/stepper/stepper.class.d.ts +8 -1
- package/dist/components/layout/stepper/stepper.class.js +1 -1
- package/dist/components/layout/stepper/stepper.styles.js +140 -41
- package/dist/components/layout/tab-group/tab-group.class.d.ts +4 -1
- package/dist/components/layout/tab-group/tab-group.styles.js +9 -75
- package/dist/components/layout/tab-group/tab.styles.js +0 -2
- package/dist/components/layout/virtual-list/virtual-list.class.d.ts +4 -4
- package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.styles.js +0 -68
- package/dist/components/layout/widget/widget.class.d.ts +5 -1
- package/dist/components/layout/widget/widget.class.js +1 -1
- package/dist/components/layout/widget/widget.styles.js +97 -40
- package/dist/components/media/animated-image/animated-image.class.d.ts +3 -0
- package/dist/components/media/animated-image/animated-image.class.js +1 -1
- package/dist/components/media/animated-image/animated-image.styles.js +0 -28
- package/dist/components/media/attachment-chip/attachment-chip.class.d.ts +1 -1
- package/dist/components/media/attachment-chip/attachment-chip.class.js +2 -2
- package/dist/components/media/attachment-chip/attachment-chip.styles.js +0 -31
- package/dist/components/media/attachment-trigger/attachment-trigger.class.d.ts +1 -1
- package/dist/components/media/attachment-trigger/attachment-trigger.class.js +4 -4
- package/dist/components/media/attachment-trigger/attachment-trigger.styles.js +0 -40
- package/dist/components/media/av-player/av-player.class.d.ts +5 -6
- package/dist/components/media/av-player/av-player.class.js +1 -1
- package/dist/components/media/av-player/av-player.styles.js +0 -45
- package/dist/components/media/avatar/avatar.styles.js +3 -16
- package/dist/components/media/file-icon/file-icon.class.d.ts +1 -2
- package/dist/components/media/file-icon/file-icon.class.js +1 -1
- package/dist/components/media/file-input/file-input.class.d.ts +12 -0
- package/dist/components/media/file-input/file-input.class.js +1 -1
- package/dist/components/media/file-input/file-input.styles.js +3 -24
- package/dist/components/media/flag/flag.class.d.ts +20 -0
- package/dist/components/media/flag/flag.class.js +4 -2
- package/dist/components/media/flag/flag.styles.js +7 -1
- package/dist/components/media/flag/language-map.d.ts +10 -0
- package/dist/components/media/flag/language-map.js +1 -1
- package/dist/components/media/image-comparer/image-comparer.styles.js +4 -33
- package/dist/components/media/image-viewer/image-viewer.class.js +0 -2
- package/dist/components/media/image-viewer/image-viewer.styles.js +7 -27
- package/dist/components/media/lightbox/lightbox.class.js +0 -2
- package/dist/components/media/lightbox/lightbox.styles.js +2 -21
- package/dist/components/media/map/map-loader.d.ts +19 -1
- package/dist/components/media/map/map-loader.js +1 -1
- package/dist/components/media/map/map.class.d.ts +141 -1
- package/dist/components/media/map/map.class.js +15 -3
- package/dist/components/media/map/map.styles.js +20 -17
- package/dist/components/media/media-card/media-card.class.d.ts +14 -3
- package/dist/components/media/media-card/media-card.class.js +1 -1
- package/dist/components/media/media-card/media-card.styles.js +2 -28
- package/dist/components/media/pan-zoom/pan-zoom.styles.js +0 -3
- package/dist/components/media/qr-code/qr-code.class.d.ts +3 -2
- package/dist/components/media/qr-code/qr-code.class.js +2 -2
- package/dist/components/media/qr-code/qr-code.styles.js +0 -3
- package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +2 -0
- package/dist/components/media/sequence-playback/sequence-playback.class.js +2 -1
- package/dist/components/media/sequence-playback/sequence-playback.styles.js +0 -19
- package/dist/components/media/video/video.class.d.ts +23 -2
- package/dist/components/media/video/video.class.js +3 -3
- package/dist/components/media/video/video.styles.js +4 -2
- package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +3 -2
- package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
- package/dist/components/media/zoomable-frame/zoomable-frame.styles.js +0 -5
- package/dist/components/overlays/alert/alert.styles.js +4 -2
- package/dist/components/overlays/badge/badge.styles.js +4 -48
- package/dist/components/overlays/badge/tag.styles.js +0 -14
- package/dist/components/overlays/callout/callout.styles.js +2 -13
- package/dist/components/overlays/chip/chip-group.styles.js +0 -18
- package/dist/components/overlays/chip/chip.styles.js +6 -69
- package/dist/components/overlays/dialog/confirm.d.ts +1 -4
- package/dist/components/overlays/dialog/confirm.js +1 -1
- package/dist/components/overlays/dialog/dialog.class.d.ts +12 -9
- package/dist/components/overlays/dialog/dialog.class.js +1 -1
- package/dist/components/overlays/dialog/dialog.styles.js +0 -43
- package/dist/components/overlays/drawer/drawer.class.d.ts +2 -2
- package/dist/components/overlays/drawer/drawer.styles.js +0 -9
- package/dist/components/overlays/empty/empty.styles.js +0 -12
- package/dist/components/overlays/kbd/kbd.class.js +1 -1
- package/dist/components/overlays/kbd/kbd.styles.js +0 -8
- package/dist/components/overlays/overlay/dropdown.class.d.ts +1 -6
- package/dist/components/overlays/overlay/dropdown.class.js +2 -2
- package/dist/components/overlays/overlay/overlay.styles.js +0 -28
- package/dist/components/overlays/overlay/popover.class.d.ts +9 -1
- package/dist/components/overlays/overlay/popover.class.js +2 -2
- package/dist/components/overlays/overlay/tooltip.class.d.ts +10 -0
- package/dist/components/overlays/overlay/tooltip.class.js +2 -2
- package/dist/components/overlays/popup/popup.class.d.ts +1 -0
- package/dist/components/overlays/popup/popup.class.js +2 -2
- package/dist/components/overlays/popup/popup.styles.js +0 -15
- package/dist/components/overlays/progress/progress-ring.class.d.ts +9 -1
- package/dist/components/overlays/progress/progress-ring.class.js +3 -3
- package/dist/components/overlays/progress/progress.styles.js +0 -21
- package/dist/components/overlays/rating/rating.styles.js +0 -25
- package/dist/components/overlays/skeleton/skeleton.styles.js +0 -4
- package/dist/components/overlays/spinner/spinner.styles.js +2 -5
- package/dist/components/overlays/toast/toast-item.styles.js +3 -45
- package/dist/components/retrieval/chunk-inspector/chunk-inspector.styles.js +0 -35
- package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +2 -2
- package/dist/components/retrieval/citation-badge/citation-badge.class.js +3 -3
- package/dist/components/retrieval/citation-badge/citation-badge.styles.js +0 -20
- package/dist/components/retrieval/claim-evidence/claim-evidence.class.js +1 -1
- package/dist/components/retrieval/claim-evidence/claim-evidence.styles.js +0 -8
- package/dist/components/retrieval/community-card/community-card.class.d.ts +1 -0
- package/dist/components/retrieval/community-card/community-card.styles.js +0 -6
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +8 -12
- package/dist/components/retrieval/entity-card/entity-card.class.d.ts +4 -3
- package/dist/components/retrieval/entity-card/entity-card.class.js +1 -1
- package/dist/components/retrieval/entity-card/entity-card.styles.js +0 -12
- package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +10 -4
- package/dist/components/retrieval/entity-chip/entity-chip.class.js +3 -3
- package/dist/components/retrieval/entity-chip/entity-chip.styles.js +6 -9
- package/dist/components/retrieval/entity-dossier/entity-dossier.class.d.ts +19 -5
- package/dist/components/retrieval/entity-dossier/entity-dossier.class.js +1 -1
- package/dist/components/retrieval/graph/graph.class.d.ts +5 -0
- package/dist/components/retrieval/graph/graph.class.js +1 -1
- package/dist/components/retrieval/graph/graph.styles.js +0 -30
- package/dist/components/retrieval/graph-legend/graph-legend.styles.js +0 -3
- package/dist/components/retrieval/grounding-summary/grounding-summary.class.js +2 -2
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.styles.js +0 -25
- package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.d.ts +2 -0
- package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.styles.js +0 -7
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +20 -6
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +2 -2
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.styles.js +6 -11
- package/dist/components/retrieval/memory-panel/memory-panel.class.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map.class.d.ts +5 -3
- package/dist/components/retrieval/mind-map/mind-map.class.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map.styles.js +0 -2
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +3 -2
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +1 -1
- package/dist/components/retrieval/neighbor-list/neighbor-list.styles.js +0 -30
- package/dist/components/retrieval/node-palette/node-palette.styles.js +0 -11
- package/dist/components/retrieval/path-strip/path-strip.styles.js +0 -10
- package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +12 -3
- package/dist/components/retrieval/provenance-panel/provenance-panel.class.js +1 -1
- package/dist/components/retrieval/provenance-panel/provenance-panel.styles.js +0 -2
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +3 -2
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +2 -2
- package/dist/components/retrieval/retrieval-results/retrieval-results.styles.js +0 -28
- package/dist/components/retrieval/retrieval-search/retrieval-search.styles.js +0 -4
- package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +1 -1
- package/dist/components/retrieval/retrieval-trace/retrieval-trace.styles.js +0 -2
- package/dist/components/retrieval/source-card/source-card.styles.js +0 -13
- package/dist/components/retrieval/source-list/source-list.styles.js +0 -7
- package/dist/components/retrieval/source-picker/source-picker.class.js +1 -1
- package/dist/components/retrieval/source-picker/source-picker.styles.js +0 -7
- package/dist/components/utility/copy-button/copy-button.styles.js +0 -10
- package/dist/components/utility/diff-view/diff-view.styles.js +0 -14
- package/dist/components/utility/export-button/export-button.styles.js +0 -22
- package/dist/components/utility/icon/icon.styles.js +0 -6
- package/dist/components/utility/json-viewer/json-viewer.styles.js +2 -48
- package/dist/components/utility/known-date/known-date.class.d.ts +7 -3
- package/dist/components/utility/known-date/known-date.styles.js +10 -51
- package/dist/components/utility/live-region/live-region.styles.js +0 -4
- package/dist/components/utility/mention-popover/mention-popover.styles.js +0 -25
- package/dist/components/utility/poll-status/poll-status.styles.js +0 -4
- package/dist/components/utility/random-content/random-content.class.d.ts +22 -0
- package/dist/components/utility/random-content/random-content.class.js +3 -2
- package/dist/components/utility/random-content/random-content.styles.js +6 -13
- package/dist/components/utility/tour/tour.class.d.ts +4 -2
- package/dist/components/utility/tour/tour.class.js +3 -3
- package/dist/components/utility/tour/tour.styles.js +0 -13
- package/dist/components/utility/visually-hidden/visually-hidden.styles.js +0 -5
- package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
- package/dist/components/viewers/archive-viewer/archive-viewer.styles.d.ts +2 -2
- package/dist/components/viewers/archive-viewer/archive-viewer.styles.js +0 -10
- package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
- package/dist/components/viewers/csv-viewer/csv-viewer.class.js +1 -1
- package/dist/components/viewers/csv-viewer/csv-viewer.styles.js +0 -19
- package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +1 -1
- package/dist/components/viewers/dataset-viewer/dataset-viewer.styles.js +0 -15
- package/dist/components/viewers/document-compare/document-compare.class.js +1 -1
- package/dist/components/viewers/document-compare/document-compare.styles.js +0 -3
- package/dist/components/viewers/document-preview/document-preview.styles.js +0 -25
- package/dist/components/viewers/document-viewer/document-viewer.class.d.ts +2 -1
- package/dist/components/viewers/document-viewer/document-viewer.class.js +1 -1
- package/dist/components/viewers/document-viewer/document-viewer.styles.js +0 -5
- package/dist/components/viewers/docx-viewer/docx-viewer.styles.js +0 -17
- package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
- package/dist/components/viewers/ebook-viewer/ebook-viewer.styles.js +0 -4
- package/dist/components/viewers/email-viewer/email-viewer.styles.js +0 -7
- package/dist/components/viewers/geojson-view/geojson-view.styles.js +0 -5
- package/dist/components/viewers/highlight-layer/highlight-layer.styles.js +0 -3
- package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +1 -1
- package/dist/components/viewers/notebook-viewer/notebook-viewer.styles.js +0 -38
- package/dist/components/viewers/page-rail/page-rail.class.js +1 -1
- package/dist/components/viewers/page-rail/page-rail.styles.js +0 -13
- package/dist/components/viewers/pdf-viewer/pdf-loader.d.ts +13 -2
- package/dist/components/viewers/pdf-viewer/pdf-loader.js +1 -1
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +32 -2
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +4 -4
- package/dist/components/viewers/pdf-viewer/pdf-viewer.styles.js +1 -27
- package/dist/components/viewers/pptx-viewer/pptx-viewer.styles.js +0 -3
- package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +1 -1
- package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.styles.js +0 -14
- package/dist/components/viewers/svg-viewer/svg-viewer.styles.js +0 -7
- package/dist/components/viewers/xml-viewer/xml-viewer.styles.js +2 -24
- package/dist/custom-elements-jsx.d.ts +56 -37
- package/dist/events.d.ts +43 -33
- package/dist/internal/agent-status-variants.d.ts +18 -0
- package/dist/internal/agent-status-variants.js +1 -0
- package/dist/internal/announcer.d.ts +8 -3
- package/dist/internal/announcer.js +1 -1
- package/dist/internal/autoloader-manifest.js +1 -1
- package/dist/internal/canvas-color.d.ts +16 -0
- package/dist/internal/canvas-color.js +1 -1
- package/dist/internal/catalog-picker.d.ts +0 -1
- package/dist/internal/catalog-picker.js +1 -1
- package/dist/internal/default-strings.generated.d.ts +1 -0
- package/dist/internal/default-strings.generated.js +1 -1
- package/dist/internal/dev-mode-attribute-warning.d.ts +30 -0
- package/dist/internal/dev-mode-attribute-warning.js +1 -0
- package/dist/internal/localization-runtime.js +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/lyra-element.d.ts +13 -0
- package/dist/internal/lyra-element.js +1 -1
- package/dist/internal/media-controller.js +1 -1
- package/dist/internal/package-metadata.d.ts +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/scroll-overflow.d.ts +35 -13
- package/dist/internal/scroll-overflow.js +1 -1
- package/dist/internal/sizes.styles.js +0 -2
- package/dist/internal/specialist-tokens.styles.js +6 -11
- package/dist/internal/text-highlights.d.ts +4 -1
- package/dist/internal/text-highlights.js +1 -1
- package/dist/internal/tokens/palette.styles.js +0 -15
- package/dist/internal/tokens.styles.js +19 -113
- package/dist/lyra.d.ts +8 -5
- package/dist/styles/reservations.css +82 -0
- package/dist/svelte.d.ts +56 -37
- package/dist/translations/ar.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/pt-BR.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/zh-CN.js +1 -1
- package/dist/vue.d.ts +56 -37
- package/llms/components/lr-accordion-item.md +12 -3
- package/llms/components/lr-accordion.md +11 -2
- package/llms/components/lr-agent-eval-dashboard.md +1 -1
- package/llms/components/lr-agent-trace.md +3 -1
- package/llms/components/lr-agent-workspace.md +20 -0
- package/llms/components/lr-artifact-panel.md +10 -4
- package/llms/components/lr-attachment-chip.md +7 -4
- package/llms/components/lr-attachment-trigger.md +9 -6
- package/llms/components/lr-av-player.md +3 -1
- package/llms/components/lr-avatar.md +6 -6
- package/llms/components/lr-bar-chart.md +4 -3
- package/llms/components/lr-box-plot.md +1 -1
- package/llms/components/lr-browser-frame.md +7 -3
- package/llms/components/lr-bubble-chart.md +4 -3
- package/llms/components/lr-calendar.md +9 -2
- package/llms/components/lr-card.md +24 -0
- package/llms/components/lr-chart.md +32 -8
- package/llms/components/lr-chat-viewport.md +7 -2
- package/llms/components/lr-checkbox-group.md +13 -5
- package/llms/components/lr-checkbox.md +5 -2
- package/llms/components/lr-checkpoint.md +6 -2
- package/llms/components/lr-combobox.md +5 -2
- package/llms/components/lr-command-palette.md +4 -1
- package/llms/components/lr-confirm-bar.md +7 -3
- package/llms/components/lr-context-meter.md +12 -11
- package/llms/components/lr-conversation-item.md +7 -4
- package/llms/components/lr-details.md +11 -2
- package/llms/components/lr-dialog.md +15 -10
- package/llms/components/lr-dock-panel.md +7 -10
- package/llms/components/lr-document-preview.md +6 -1
- package/llms/components/lr-document-viewer.md +3 -2
- package/llms/components/lr-doughnut-chart.md +4 -3
- package/llms/components/lr-drawer.md +3 -3
- package/llms/components/lr-entity-card.md +3 -3
- package/llms/components/lr-entity-chip.md +1 -1
- package/llms/components/lr-entity-dossier.md +4 -1
- package/llms/components/lr-file-input.md +2 -2
- package/llms/components/lr-flag.md +20 -5
- package/llms/components/lr-heatmap.md +29 -1
- package/llms/components/lr-histogram.md +3 -1
- package/llms/components/lr-icon.md +1 -1
- package/llms/components/lr-json-schema-viewer.md +2 -1
- package/llms/components/lr-knowledge-graph-explorer.md +8 -3
- package/llms/components/lr-known-date.md +4 -2
- package/llms/components/lr-line-chart.md +4 -3
- package/llms/components/lr-lite-chart.md +16 -6
- package/llms/components/lr-map.md +72 -8
- package/llms/components/lr-markdown-core.md +3 -2
- package/llms/components/lr-media-card.md +28 -12
- package/llms/components/lr-message-parts.md +2 -1
- package/llms/components/lr-model-select.md +9 -10
- package/llms/components/lr-model-settings-panel.md +9 -9
- package/llms/components/lr-neighbor-list.md +1 -1
- package/llms/components/lr-notebook-viewer.md +6 -3
- package/llms/components/lr-option.md +5 -2
- package/llms/components/lr-pdf-viewer.md +62 -2
- package/llms/components/lr-pie-chart.md +4 -3
- package/llms/components/lr-polar-area-chart.md +4 -3
- package/llms/components/lr-popover.md +5 -0
- package/llms/components/lr-progress-ring.md +8 -1
- package/llms/components/lr-prompt-studio.md +1 -1
- package/llms/components/lr-provenance-panel.md +4 -2
- package/llms/components/lr-qr-code.md +1 -1
- package/llms/components/lr-radar-chart.md +4 -3
- package/llms/components/lr-rag-eval-dashboard.md +2 -2
- package/llms/components/lr-random-content.md +13 -0
- package/llms/components/lr-reorder-item.md +6 -1
- package/llms/components/lr-reorder-list.md +6 -1
- package/llms/components/lr-responsive-panel.md +11 -7
- package/llms/components/lr-scatter-chart.md +4 -3
- package/llms/components/lr-sequence-strip.md +16 -2
- package/llms/components/lr-slider.md +12 -5
- package/llms/components/lr-sparkline.md +1 -1
- package/llms/components/lr-suggestion-chips.md +7 -2
- package/llms/components/lr-swatch-picker.md +5 -5
- package/llms/components/lr-switch.md +5 -2
- package/llms/components/lr-table.md +30 -4
- package/llms/components/lr-terminal.md +3 -1
- package/llms/components/lr-thread-list.md +8 -8
- package/llms/components/lr-time-input.md +6 -1
- package/llms/components/lr-timeline-item.md +24 -0
- package/llms/components/lr-timeline.md +25 -1
- package/llms/components/lr-token-input.md +7 -2
- package/llms/components/lr-tool-approval-dialog.md +7 -8
- package/llms/components/lr-tool-call-chip.md +5 -1
- package/llms/components/lr-tool-param-form.md +14 -12
- package/llms/components/lr-tool-result-dialog.md +11 -9
- package/llms/components/lr-tool-result-view.md +7 -6
- package/llms/components/lr-tool-select-dialog.md +18 -16
- package/llms/components/lr-trace-tree.md +3 -1
- package/llms/components/lr-usage-badge.md +4 -1
- package/llms/components/lr-video-playlist.md +1 -1
- package/llms/components/lr-virtual-list.md +22 -14
- package/llms/components/lr-voice-picker.md +8 -5
- package/llms/components/lr-widget-renderer.md +3 -3
- package/llms/components/lr-widget.md +1 -1
- package/llms/components/lr-word-cloud.md +6 -2
- package/llms/index.md +1 -1
- package/llms/peers.md +13 -3
- package/llms/shared.md +83 -2
- package/llms-full.txt +1159 -288
- package/package.json +19 -7
- package/vscode-css-data.json +37 -2
- package/vscode-html-data.json +402 -45
- package/web-types.json +300 -56
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import{css}from"lit";const styles=css`
|
|
2
|
-
/* No :host position/inset is imposed here -- unlike an overlay component,
|
|
3
|
-
lr-dock-panel deliberately stays layout-agnostic (see the class doc):
|
|
4
|
-
drop it as an absolutely-positioned child of a position:relative parent,
|
|
5
|
-
or as a flex item alongside your existing content, and it only manages
|
|
6
|
-
its own size along the resize axis plus filling the cross axis. */
|
|
7
2
|
:host {
|
|
8
3
|
display: block;
|
|
9
4
|
box-sizing: border-box;
|
|
10
|
-
/* Themeable persistent-rail width/height while collapsed -- overridable
|
|
11
|
-
from outside since it's a plain custom property, not a JS prop (see
|
|
12
|
-
the class doc for why collapse hides content rather than zeroing the
|
|
13
|
-
box). Reuses the shared icon-button tap-target token so the collapse
|
|
14
|
-
toggle sitting on the rail stays comfortably tappable by default. */
|
|
15
5
|
--_lr-dock-panel-collapsed-size: var(--lr-icon-button-size);
|
|
16
6
|
position: relative;
|
|
17
7
|
}
|
|
@@ -23,14 +13,6 @@ import{css}from"lit";const styles=css`
|
|
|
23
13
|
:host([edge="bottom"]) {
|
|
24
14
|
inline-size: 100%;
|
|
25
15
|
}
|
|
26
|
-
/* The collapsed-rail floor only applies once actually collapsed -- scoped
|
|
27
|
-
here rather than to the bare [edge] selectors above, so it can never
|
|
28
|
-
override a smaller explicit min-extent (resolved in JS by
|
|
29
|
-
resolveBoundsPx()) while expanded. An unconditional floor here would
|
|
30
|
-
silently win over a min-extent below the rail token's width, since a CSS
|
|
31
|
-
min-inline-size/min-block-size always wins over an inline size style
|
|
32
|
-
regardless of what value applySize() computed and announced via
|
|
33
|
-
aria-valuenow. */
|
|
34
16
|
:host([edge="start"][collapsed]),
|
|
35
17
|
:host([edge="end"][collapsed]) {
|
|
36
18
|
min-inline-size: var(
|
|
@@ -64,35 +46,19 @@ import{css}from"lit";const styles=css`
|
|
|
64
46
|
display: none;
|
|
65
47
|
}
|
|
66
48
|
|
|
67
|
-
/* The draggable edge -- always the panel's *inner* boundary (opposite the
|
|
68
|
-
docked/pinned edge), positioned with logical insets so it mirrors
|
|
69
|
-
automatically under RTL for the start/end edges. */
|
|
70
49
|
[part="handle"] {
|
|
71
50
|
position: absolute;
|
|
72
51
|
background: var(--lr-color-border);
|
|
73
52
|
touch-action: none;
|
|
74
53
|
}
|
|
75
|
-
/* --lr-dock-panel-handle-hover-color/-active-color deliberately don't reuse the bare
|
|
76
|
-
--lr-color-brand token the collapse-toggle's own hover/active tokens fall back to below --
|
|
77
|
-
the handle's drag-affordance accent and the toggle's button hover/active feedback are
|
|
78
|
-
different visual purposes that happened to share a token by coincidence, not by design; each
|
|
79
|
-
now has its own scoped override while defaulting to the exact same rendered color. */
|
|
80
54
|
[part="handle"]:hover {
|
|
81
55
|
background: var(--lr-dock-panel-handle-hover-color, var(--lr-color-brand));
|
|
82
56
|
}
|
|
83
|
-
/* Split off from the :hover rule it used to share (rather than kept as one selector list) so the
|
|
84
|
-
pressed rule below can be that rule's exact twin: swapping :hover for :active in a list that
|
|
85
|
-
also carries :focus-visible would have repainted the focus state as pressed. */
|
|
86
57
|
[part="handle"]:focus-visible {
|
|
87
58
|
background: var(--lr-dock-panel-handle-hover-color, var(--lr-color-brand));
|
|
88
59
|
outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);
|
|
89
60
|
outline-offset: calc(-1 * var(--lr-focus-ring-width));
|
|
90
61
|
}
|
|
91
|
-
/* After :focus-visible, so a handle that was focused by keyboard still shows the deeper pressed
|
|
92
|
-
fill for the duration of a pointer drag (pointer capture holds :active throughout).
|
|
93
|
-
--lr-dock-panel-handle-active-color's own fallback still derives from the hover token via
|
|
94
|
-
color-mix() -- overriding just the hover token keeps retinting the pressed state too, same as
|
|
95
|
-
before this token existed, while an explicit active override can still opt out of that. */
|
|
96
62
|
[part="handle"]:active {
|
|
97
63
|
background: var(
|
|
98
64
|
--lr-dock-panel-handle-active-color,
|
|
@@ -103,9 +69,6 @@ import{css}from"lit";const styles=css`
|
|
|
103
69
|
)
|
|
104
70
|
);
|
|
105
71
|
}
|
|
106
|
-
/* Transparent hit-slop, widening the draggable/tappable box along the
|
|
107
|
-
resize axis only, without changing the handle's visible 3px thickness --
|
|
108
|
-
same technique as lr-multi-split's divider. */
|
|
109
72
|
[part="handle"]::before {
|
|
110
73
|
content: "";
|
|
111
74
|
position: absolute;
|
|
@@ -158,10 +121,6 @@ import{css}from"lit";const styles=css`
|
|
|
158
121
|
color var(--lr-transition-fast);
|
|
159
122
|
z-index: var(--lr-layer-content);
|
|
160
123
|
}
|
|
161
|
-
/* :active reuses the same two scoped tokens :hover sets (mixed for the background, verbatim
|
|
162
|
-
for the color) rather than a separate pair of active-only tokens -- mirrors this file's own
|
|
163
|
-
[part="handle"] precedent above, where :active has always derived straight from whatever
|
|
164
|
-
color :hover uses instead of carrying an independent token. */
|
|
165
124
|
[part="collapse-toggle"]:hover {
|
|
166
125
|
background: var(
|
|
167
126
|
--lr-dock-panel-collapse-toggle-hover-bg,
|
|
@@ -211,10 +170,6 @@ import{css}from"lit";const styles=css`
|
|
|
211
170
|
inset-inline-start: 50%;
|
|
212
171
|
transform: translateX(-50%);
|
|
213
172
|
}
|
|
214
|
-
/* For the top/bottom edges the toggle centers on inset-inline-start: 50%, which anchors to
|
|
215
|
-
the physical right edge under RTL -- the fixed translateX(-50%) must flip sign there or
|
|
216
|
-
the toggle sits a full box-width off center. The start/end edges center along the block
|
|
217
|
-
axis (translateY), which no text direction affects. */
|
|
218
173
|
:host(:dir(rtl)[edge="top"]) [part="collapse-toggle"],
|
|
219
174
|
:host(:dir(rtl)[edge="bottom"]) [part="collapse-toggle"] {
|
|
220
175
|
transform: translateX(50%);
|
|
@@ -209,6 +209,8 @@ export declare class LyraDrilldownPanel extends LyraElement<LyraDrilldownPanelEv
|
|
|
209
209
|
private onDocumentDownload;
|
|
210
210
|
private onDocumentRenderError;
|
|
211
211
|
private onDocumentHighlightActivate;
|
|
212
|
+
/** Bound to `lr-entity-select` on every nested `lr-entity-card`, translated into exactly one
|
|
213
|
+
* `lr-drilldown-entity-activate`. */
|
|
212
214
|
private onEntityActivate;
|
|
213
215
|
private renderEvidence;
|
|
214
216
|
private renderDocuments;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./drilldown-panel.styles.js";import"../breadcrumb/breadcrumb.class.js";import"../breadcrumb/breadcrumb-item.class.js";import"../tab-group/tab-group.class.js";import"../tab-group/tab.class.js";import"../tab-group/tab-panel.class.js";import"../../viewers/document-preview/document-preview.class.js";import"../../retrieval/entity-card/entity-card.class.js";import"../../retrieval/source-card/source-card.class.js";import"../../forms/button/button.class.js";import"../../overlays/empty/empty.class.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_drilldownDocuments,LYRA_DEFAULT_drilldownEmpty,LYRA_DEFAULT_drilldownRuns,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_items,LYRA_DEFAULT_next,LYRA_DEFAULT_noData,LYRA_DEFAULT_paginationLabel,LYRA_DEFAULT_paginationSummary,LYRA_DEFAULT_previous,LYRA_DEFAULT_provenanceEntities,LYRA_DEFAULT_sourceListDefaultLabel}from"../../../internal/default-strings.generated.js";const MAX_PATH_NODES=256,MAX_CATEGORY_ITEMS=1e3,MAX_NODE_TYPES=256,MAX_ENTITY_PROPERTIES=128,MAX_ID_LENGTH=256,MAX_LABEL_LENGTH=4096,MAX_TEXT_LENGTH=65536,MAX_URL_LENGTH=8192,ACTIVE_PAGE_SIZE=8,EMPTY_PATH=Object.freeze([]),EMPTY_TYPES=Object.freeze([]);function isPlainRecord(value){if(typeof value!="object"||value===null||Array.isArray(value))return!1;try{const prototype=Object.getPrototypeOf(value);return prototype===null||Object.getPrototypeOf(prototype)===null}catch{return!1}}function ownDataValue(record,key){try{const descriptor=Object.getOwnPropertyDescriptor(record,key);return descriptor&&"value"in descriptor?descriptor.value:void 0}catch{return}}function safeArrayLength(value){if(!Array.isArray(value))return 0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length"),length=descriptor&&"value"in descriptor?descriptor.value:0;return typeof length=="number"&&Number.isFinite(length)?Math.max(0,Math.floor(length)):0}catch{return 0}}function arrayItem(value,index){try{const descriptor=Object.getOwnPropertyDescriptor(value,String(index));return descriptor&&"value"in descriptor?descriptor.value:void 0}catch{return}}function boundedString(value,maxLength){return typeof value=="string"&&value.length<=maxLength?value:void 0}function domainId(value){const id=boundedString(value,MAX_ID_LENGTH);return id&&id===id.trim()?id:void 0}function optionalString(record,key,maxLength=MAX_TEXT_LENGTH){return boundedString(ownDataValue(record,key),maxLength)}function normalizeUniqueCollection(value,limit,normalize,startIndex=0){const sourceCount=safeArrayLength(value);if(!Array.isArray(value)||sourceCount===0)return{items:Object.freeze([]),sourceCount};const items=[],seen=new Set,end=Math.min(sourceCount,startIndex+limit);for(let index=startIndex;index<end;index+=1){const normalized=normalize(arrayItem(value,index));!normalized||seen.has(normalized[0])||(seen.add(normalized[0]),items.push(normalized[1]))}return{items:Object.freeze(items),sourceCount}}function normalizeEvidence(candidate){if(!isPlainRecord(candidate))return;const evidenceId=domainId(ownDataValue(candidate,"evidenceId")),title=boundedString(ownDataValue(candidate,"title"),MAX_LABEL_LENGTH);if(!evidenceId||title===void 0)return;const rawPage=ownDataValue(candidate,"page"),page=typeof rawPage=="number"&&Number.isFinite(rawPage)?rawPage:boundedString(rawPage,MAX_LABEL_LENGTH),item=Object.freeze({evidenceId,title,...page!==void 0?{page}:{},...optionalString(candidate,"href",MAX_URL_LENGTH)!==void 0?{href:optionalString(candidate,"href",MAX_URL_LENGTH)}:{},...optionalString(candidate,"excerpt")!==void 0?{excerpt:optionalString(candidate,"excerpt")}:{},...optionalString(candidate,"full")!==void 0?{full:optionalString(candidate,"full")}:{}});return[evidenceId,item]}function normalizeDocument(candidate){if(!isPlainRecord(candidate))return;const documentId=domainId(ownDataValue(candidate,"documentId")),name=boundedString(ownDataValue(candidate,"name"),MAX_LABEL_LENGTH);if(!documentId||name===void 0)return;const document=Object.freeze({documentId,name,...optionalString(candidate,"mimeType",MAX_LABEL_LENGTH)!==void 0?{mimeType:optionalString(candidate,"mimeType",MAX_LABEL_LENGTH)}:{},...optionalString(candidate,"uri",MAX_URL_LENGTH)!==void 0?{uri:optionalString(candidate,"uri",MAX_URL_LENGTH)}:{},...optionalString(candidate,"version",MAX_LABEL_LENGTH)!==void 0?{version:optionalString(candidate,"version",MAX_LABEL_LENGTH)}:{}});return[documentId,document]}function normalizeProperties(value){if(!isPlainRecord(value))return;let keys;try{keys=Object.getOwnPropertyNames(value).slice(0,MAX_ENTITY_PROPERTIES)}catch{return}const properties={};for(const key of keys){if(!key||key.length>MAX_ID_LENGTH)continue;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,key)}catch{continue}if(!descriptor||!descriptor.enumerable||!("value"in descriptor))continue;const entry=descriptor.value;if(typeof entry=="number"&&Number.isFinite(entry))properties[key]=entry;else{const text=boundedString(entry,MAX_TEXT_LENGTH);text!==void 0&&(properties[key]=text)}}return Object.keys(properties).length>0?Object.freeze(properties):void 0}function normalizeEntity(candidate){if(!isPlainRecord(candidate))return;const entityId=domainId(ownDataValue(candidate,"entityId")),label=boundedString(ownDataValue(candidate,"label"),MAX_LABEL_LENGTH);if(!entityId||label===void 0)return;const rawDegree=ownDataValue(candidate,"degree"),degree=typeof rawDegree=="number"&&Number.isFinite(rawDegree)?Math.max(0,Math.floor(rawDegree)):void 0,properties=normalizeProperties(ownDataValue(candidate,"properties")),entity=Object.freeze({entityId,label,...optionalString(candidate,"type",MAX_ID_LENGTH)!==void 0?{type:optionalString(candidate,"type",MAX_ID_LENGTH)}:{},...optionalString(candidate,"description")!==void 0?{description:optionalString(candidate,"description")}:{},...properties?{properties}:{},...degree!==void 0?{degree}:{},...optionalString(candidate,"communityId",MAX_ID_LENGTH)!==void 0?{communityId:optionalString(candidate,"communityId",MAX_ID_LENGTH)}:{}});return[entityId,entity]}function normalizeNode(candidate){if(!isPlainRecord(candidate))return;const nodeId=domainId(ownDataValue(candidate,"nodeId")),label=boundedString(ownDataValue(candidate,"label"),MAX_LABEL_LENGTH);if(!nodeId||label===void 0)return;const evidence=normalizeUniqueCollection(ownDataValue(candidate,"evidence"),MAX_CATEGORY_ITEMS,normalizeEvidence),documents=normalizeUniqueCollection(ownDataValue(candidate,"documents"),MAX_CATEGORY_ITEMS,normalizeDocument),entities=normalizeUniqueCollection(ownDataValue(candidate,"entities"),MAX_CATEGORY_ITEMS,normalizeEntity);return{node:Object.freeze({nodeId,label,...evidence.items.length>0?{evidence:evidence.items}:{},...documents.items.length>0?{documents:documents.items}:{},...entities.items.length>0?{entities:entities.items}:{}}),sourceCounts:Object.freeze({evidence:evidence.sourceCount,documents:documents.sourceCount,entities:entities.sourceCount})}}function normalizePath(value){const sourceCount=safeArrayLength(value);if(!Array.isArray(value)||sourceCount===0)return{path:EMPTY_PATH,sourceCount,categorySourceCounts:new Map};const startIndex=Math.max(0,sourceCount-MAX_PATH_NODES),path=[],seen=new Set,categorySourceCounts=new Map;for(let index=startIndex;index<sourceCount;index+=1){const normalized=normalizeNode(arrayItem(value,index));!normalized||seen.has(normalized.node.nodeId)||(seen.add(normalized.node.nodeId),path.push(normalized.node),categorySourceCounts.set(normalized.node.nodeId,normalized.sourceCounts))}return{path:Object.freeze(path),sourceCount,categorySourceCounts}}function normalizeNodeType(candidate){if(!isPlainRecord(candidate))return;const id=domainId(ownDataValue(candidate,"id")),label=boundedString(ownDataValue(candidate,"label"),MAX_LABEL_LENGTH);if(!id||label===void 0)return;const rawShape=ownDataValue(candidate,"shape"),shape=rawShape==="circle"||rawShape==="square"||rawShape==="diamond"?rawShape:void 0,color=optionalString(candidate,"color",MAX_LABEL_LENGTH);return[id,Object.freeze({id,label,...color!==void 0?{color}:{},...shape!==void 0?{shape}:{}})]}function normalizeTypes(value){return normalizeUniqueCollection(value,MAX_NODE_TYPES,normalizeNodeType).items}function normalizeCategory(value){return value==="evidence"||value==="documents"||value==="entities"||value==="runs"?value:""}class LyraDrilldownPanel extends LyraElement{constructor(){super(...arguments),this.effectivePath=EMPTY_PATH,this.pathSourceCount=0,this.pathRevision=0,this.categorySourceCounts=new Map,this.effectiveTypes=EMPTY_TYPES,this.activeCategoryValue="",this.communityLabel="",this.showFocusButton=!0,this.accessibleLabel=null,this.hasRunsSlot=!1,this.categoryPage=0,this.pageContext="",this.mutationObserverGeneration=0,this.announcementsArmed=!1,this.announcedLimits=new Map,this.syncRunsSlot=()=>{this.hasRunsSlot=Array.from(this.children).some(element=>element.getAttribute("slot")==="runs")},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onCategoryShow=event=>{event.stopPropagation();const node=this.currentNode;if(!node)return;const categories=this.categoriesFor(node),previousCategory=this.resolvedCategory(categories),category=normalizeCategory(event.detail.name),tabGroup=event.currentTarget;if(!previousCategory||!category||!categories.some(candidate=>candidate.key===category)){tabGroup.active=previousCategory??"";return}category!==previousCategory&&this.emit("lr-drilldown-category-change",Object.freeze({nodeId:node.nodeId,category,previousCategory})),tabGroup.active=this.resolvedCategory(categories)??""}}static{this.defaultStrings={...super.defaultStrings,drilldownDocuments:LYRA_DEFAULT_drilldownDocuments,drilldownEmpty:LYRA_DEFAULT_drilldownEmpty,drilldownRuns:LYRA_DEFAULT_drilldownRuns,fieldRequired:LYRA_DEFAULT_fieldRequired,items:LYRA_DEFAULT_items,next:LYRA_DEFAULT_next,noData:LYRA_DEFAULT_noData,paginationLabel:LYRA_DEFAULT_paginationLabel,paginationSummary:LYRA_DEFAULT_paginationSummary,previous:LYRA_DEFAULT_previous,provenanceEntities:LYRA_DEFAULT_provenanceEntities,sourceListDefaultLabel:LYRA_DEFAULT_sourceListDefaultLabel}}static{this.styles=[LyraElement.styles,styles]}get path(){return this.effectivePath}set path(value){const previous=this.effectivePath,normalized=normalizePath(value);this.effectivePath=normalized.path,this.pathSourceCount=normalized.sourceCount,this.categorySourceCounts=normalized.categorySourceCounts,this.pathRevision+=1,this.requestUpdate("path",previous)}get types(){return this.effectiveTypes}set types(value){const previous=this.effectiveTypes;this.effectiveTypes=normalizeTypes(value),this.requestUpdate("types",previous)}get activeCategory(){return this.activeCategoryValue}set activeCategory(value){const previous=this.activeCategoryValue;this.activeCategoryValue=normalizeCategory(value),this.requestUpdate("activeCategory",previous)}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink(),this.syncRunsSlot(),this.armMutationObserver()}armMutationObserver(){const ownerDocument=this.ownerDocument;if(!this.isConnected||this.mutationObserver&&this.mutationObserverDocument===ownerDocument)return;this.resetMutationObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor)return;const generation=this.mutationObserverGeneration,observer=new MutationObserverCtor(()=>{this.mutationObserver!==observer||this.mutationObserverDocument!==ownerDocument||this.mutationObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.syncRunsSlot()});this.mutationObserver=observer,this.mutationObserverDocument=ownerDocument,observer.observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0})}disconnectedCallback(){this.resetMutationObserver(),this.releaseAnnouncementSink(),this.announcementsArmed=!1,this.announcedLimits.clear(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetMutationObserver(),this.syncAnnouncementSink(),this.armMutationObserver()}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}resetMutationObserver(){this.mutationObserverGeneration+=1,this.mutationObserver?.disconnect(),this.mutationObserver=void 0,this.mutationObserverDocument=void 0}get currentNode(){return this.effectivePath[this.effectivePath.length-1]}categoriesFor(node){const categories=[];return(node.evidence?.length??0)>0&&categories.push({key:"evidence",label:this.localize("sourceListDefaultLabel")}),(node.documents?.length??0)>0&&categories.push({key:"documents",label:this.localize("drilldownDocuments")}),(node.entities?.length??0)>0&&categories.push({key:"entities",label:this.localize("provenanceEntities")}),this.hasRunsSlot&&categories.push({key:"runs",label:this.localize("drilldownRuns")}),categories}resolvedCategory(categories){return categories.find(category=>category.key===this.activeCategoryValue)?.key??categories[0]?.key}willUpdate(changed){super.willUpdate(changed);const node=this.currentNode,categories=node?this.categoriesFor(node):[],active=this.resolvedCategory(categories)??"",context=`${this.pathRevision}:${node?.nodeId??""}:${active}`;context!==this.pageContext&&(this.pageContext=context,this.categoryPage=0)}updated(changed){super.updated(changed);const nextLimits=new Map(this.currentLimitAnnouncements());if(this.announcementsArmed)for(const[key,text]of nextLimits)this.announcedLimits.get(key)!==text&&this.announcementSink?.announce(text);this.announcedLimits=nextLimits,this.announcementsArmed=!0}navigateTo(node,index){this.emit("lr-drilldown-navigate",Object.freeze({nodeId:node.nodeId,index}))}onEvidenceExpand(nodeId,evidenceId,event){event.stopPropagation(),this.emit("lr-drilldown-evidence-expand",Object.freeze({nodeId,evidenceId,expanded:event.detail.expanded}))}onEvidenceOpen(nodeId,item,event){event.stopPropagation(),this.emit("lr-drilldown-evidence-open",Object.freeze({nodeId,evidenceId:item.evidenceId,...item.href!==void 0?{href:item.href}:{}}))}onDocumentDownload(nodeId,document,event){event.stopPropagation(),this.emit("lr-drilldown-document-download",Object.freeze({nodeId,documentId:document.documentId,src:event.detail.src,filename:event.detail.filename}))}onDocumentRenderError(nodeId,documentId,event){event.stopPropagation(),this.emit("lr-drilldown-document-render-error",Object.freeze({nodeId,documentId,error:event.detail.error}))}onDocumentHighlightActivate(nodeId,documentId,event){event.stopPropagation(),this.emit("lr-drilldown-document-highlight-activate",Object.freeze({nodeId,documentId,highlightId:event.detail.highlightId}))}onEntityActivate(nodeId,entityId,event){event.stopPropagation(),this.emit("lr-drilldown-entity-activate",Object.freeze({nodeId,entityId}))}renderEvidence(nodeId,items){return html`${repeat(items,item=>item.evidenceId,item=>html`
|
|
1
|
+
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./drilldown-panel.styles.js";import"../breadcrumb/breadcrumb.class.js";import"../breadcrumb/breadcrumb-item.class.js";import"../tab-group/tab-group.class.js";import"../tab-group/tab.class.js";import"../tab-group/tab-panel.class.js";import"../../viewers/document-preview/document-preview.class.js";import"../../retrieval/entity-card/entity-card.class.js";import"../../retrieval/source-card/source-card.class.js";import"../../forms/button/button.class.js";import"../../overlays/empty/empty.class.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_drilldownDocuments,LYRA_DEFAULT_drilldownEmpty,LYRA_DEFAULT_drilldownRuns,LYRA_DEFAULT_items,LYRA_DEFAULT_next,LYRA_DEFAULT_noData,LYRA_DEFAULT_paginationLabel,LYRA_DEFAULT_paginationSummary,LYRA_DEFAULT_previous,LYRA_DEFAULT_provenanceEntities,LYRA_DEFAULT_sourceListDefaultLabel}from"../../../internal/default-strings.generated.js";const MAX_PATH_NODES=256,MAX_CATEGORY_ITEMS=1e3,MAX_NODE_TYPES=256,MAX_ENTITY_PROPERTIES=128,MAX_ID_LENGTH=256,MAX_LABEL_LENGTH=4096,MAX_TEXT_LENGTH=65536,MAX_URL_LENGTH=8192,ACTIVE_PAGE_SIZE=8,EMPTY_PATH=Object.freeze([]),EMPTY_TYPES=Object.freeze([]);function isPlainRecord(value){if(typeof value!="object"||value===null||Array.isArray(value))return!1;try{const prototype=Object.getPrototypeOf(value);return prototype===null||Object.getPrototypeOf(prototype)===null}catch{return!1}}function ownDataValue(record,key){try{const descriptor=Object.getOwnPropertyDescriptor(record,key);return descriptor&&"value"in descriptor?descriptor.value:void 0}catch{return}}function safeArrayLength(value){if(!Array.isArray(value))return 0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length"),length=descriptor&&"value"in descriptor?descriptor.value:0;return typeof length=="number"&&Number.isFinite(length)?Math.max(0,Math.floor(length)):0}catch{return 0}}function arrayItem(value,index){try{const descriptor=Object.getOwnPropertyDescriptor(value,String(index));return descriptor&&"value"in descriptor?descriptor.value:void 0}catch{return}}function boundedString(value,maxLength){return typeof value=="string"&&value.length<=maxLength?value:void 0}function domainId(value){const id=boundedString(value,MAX_ID_LENGTH);return id&&id===id.trim()?id:void 0}function optionalString(record,key,maxLength=MAX_TEXT_LENGTH){return boundedString(ownDataValue(record,key),maxLength)}function normalizeUniqueCollection(value,limit,normalize,startIndex=0){const sourceCount=safeArrayLength(value);if(!Array.isArray(value)||sourceCount===0)return{items:Object.freeze([]),sourceCount};const items=[],seen=new Set,end=Math.min(sourceCount,startIndex+limit);for(let index=startIndex;index<end;index+=1){const normalized=normalize(arrayItem(value,index));!normalized||seen.has(normalized[0])||(seen.add(normalized[0]),items.push(normalized[1]))}return{items:Object.freeze(items),sourceCount}}function normalizeEvidence(candidate){if(!isPlainRecord(candidate))return;const evidenceId=domainId(ownDataValue(candidate,"evidenceId")),title=boundedString(ownDataValue(candidate,"title"),MAX_LABEL_LENGTH);if(!evidenceId||title===void 0)return;const rawPage=ownDataValue(candidate,"page"),page=typeof rawPage=="number"&&Number.isFinite(rawPage)?rawPage:boundedString(rawPage,MAX_LABEL_LENGTH),item=Object.freeze({evidenceId,title,...page!==void 0?{page}:{},...optionalString(candidate,"href",MAX_URL_LENGTH)!==void 0?{href:optionalString(candidate,"href",MAX_URL_LENGTH)}:{},...optionalString(candidate,"excerpt")!==void 0?{excerpt:optionalString(candidate,"excerpt")}:{},...optionalString(candidate,"full")!==void 0?{full:optionalString(candidate,"full")}:{}});return[evidenceId,item]}function normalizeDocument(candidate){if(!isPlainRecord(candidate))return;const documentId=domainId(ownDataValue(candidate,"documentId")),name=boundedString(ownDataValue(candidate,"name"),MAX_LABEL_LENGTH);if(!documentId||name===void 0)return;const document=Object.freeze({documentId,name,...optionalString(candidate,"mimeType",MAX_LABEL_LENGTH)!==void 0?{mimeType:optionalString(candidate,"mimeType",MAX_LABEL_LENGTH)}:{},...optionalString(candidate,"uri",MAX_URL_LENGTH)!==void 0?{uri:optionalString(candidate,"uri",MAX_URL_LENGTH)}:{},...optionalString(candidate,"version",MAX_LABEL_LENGTH)!==void 0?{version:optionalString(candidate,"version",MAX_LABEL_LENGTH)}:{}});return[documentId,document]}function normalizeProperties(value){if(!isPlainRecord(value))return;let keys;try{keys=Object.getOwnPropertyNames(value).slice(0,MAX_ENTITY_PROPERTIES)}catch{return}const properties={};for(const key of keys){if(!key||key.length>MAX_ID_LENGTH)continue;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,key)}catch{continue}if(!descriptor||!descriptor.enumerable||!("value"in descriptor))continue;const entry=descriptor.value;if(typeof entry=="number"&&Number.isFinite(entry))properties[key]=entry;else{const text=boundedString(entry,MAX_TEXT_LENGTH);text!==void 0&&(properties[key]=text)}}return Object.keys(properties).length>0?Object.freeze(properties):void 0}function normalizeEntity(candidate){if(!isPlainRecord(candidate))return;const entityId=domainId(ownDataValue(candidate,"entityId")),label=boundedString(ownDataValue(candidate,"label"),MAX_LABEL_LENGTH);if(!entityId||label===void 0)return;const rawDegree=ownDataValue(candidate,"degree"),degree=typeof rawDegree=="number"&&Number.isFinite(rawDegree)?Math.max(0,Math.floor(rawDegree)):void 0,properties=normalizeProperties(ownDataValue(candidate,"properties")),entity=Object.freeze({entityId,label,...optionalString(candidate,"type",MAX_ID_LENGTH)!==void 0?{type:optionalString(candidate,"type",MAX_ID_LENGTH)}:{},...optionalString(candidate,"description")!==void 0?{description:optionalString(candidate,"description")}:{},...properties?{properties}:{},...degree!==void 0?{degree}:{},...optionalString(candidate,"communityId",MAX_ID_LENGTH)!==void 0?{communityId:optionalString(candidate,"communityId",MAX_ID_LENGTH)}:{}});return[entityId,entity]}function normalizeNode(candidate){if(!isPlainRecord(candidate))return;const nodeId=domainId(ownDataValue(candidate,"nodeId")),label=boundedString(ownDataValue(candidate,"label"),MAX_LABEL_LENGTH);if(!nodeId||label===void 0)return;const evidence=normalizeUniqueCollection(ownDataValue(candidate,"evidence"),MAX_CATEGORY_ITEMS,normalizeEvidence),documents=normalizeUniqueCollection(ownDataValue(candidate,"documents"),MAX_CATEGORY_ITEMS,normalizeDocument),entities=normalizeUniqueCollection(ownDataValue(candidate,"entities"),MAX_CATEGORY_ITEMS,normalizeEntity);return{node:Object.freeze({nodeId,label,...evidence.items.length>0?{evidence:evidence.items}:{},...documents.items.length>0?{documents:documents.items}:{},...entities.items.length>0?{entities:entities.items}:{}}),sourceCounts:Object.freeze({evidence:evidence.sourceCount,documents:documents.sourceCount,entities:entities.sourceCount})}}function normalizePath(value){const sourceCount=safeArrayLength(value);if(!Array.isArray(value)||sourceCount===0)return{path:EMPTY_PATH,sourceCount,categorySourceCounts:new Map};const startIndex=Math.max(0,sourceCount-MAX_PATH_NODES),path=[],seen=new Set,categorySourceCounts=new Map;for(let index=startIndex;index<sourceCount;index+=1){const normalized=normalizeNode(arrayItem(value,index));!normalized||seen.has(normalized.node.nodeId)||(seen.add(normalized.node.nodeId),path.push(normalized.node),categorySourceCounts.set(normalized.node.nodeId,normalized.sourceCounts))}return{path:Object.freeze(path),sourceCount,categorySourceCounts}}function normalizeNodeType(candidate){if(!isPlainRecord(candidate))return;const id=domainId(ownDataValue(candidate,"id")),label=boundedString(ownDataValue(candidate,"label"),MAX_LABEL_LENGTH);if(!id||label===void 0)return;const rawShape=ownDataValue(candidate,"shape"),shape=rawShape==="circle"||rawShape==="square"||rawShape==="diamond"?rawShape:void 0,color=optionalString(candidate,"color",MAX_LABEL_LENGTH);return[id,Object.freeze({id,label,...color!==void 0?{color}:{},...shape!==void 0?{shape}:{}})]}function normalizeTypes(value){return normalizeUniqueCollection(value,MAX_NODE_TYPES,normalizeNodeType).items}function normalizeCategory(value){return value==="evidence"||value==="documents"||value==="entities"||value==="runs"?value:""}class LyraDrilldownPanel extends LyraElement{constructor(){super(...arguments),this.effectivePath=EMPTY_PATH,this.pathSourceCount=0,this.pathRevision=0,this.categorySourceCounts=new Map,this.effectiveTypes=EMPTY_TYPES,this.activeCategoryValue="",this.communityLabel="",this.showFocusButton=!0,this.accessibleLabel=null,this.hasRunsSlot=!1,this.categoryPage=0,this.pageContext="",this.mutationObserverGeneration=0,this.announcementsArmed=!1,this.announcedLimits=new Map,this.syncRunsSlot=()=>{this.hasRunsSlot=Array.from(this.children).some(element=>element.getAttribute("slot")==="runs")},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onCategoryShow=event=>{event.stopPropagation();const node=this.currentNode;if(!node)return;const categories=this.categoriesFor(node),previousCategory=this.resolvedCategory(categories),category=normalizeCategory(event.detail.name),tabGroup=event.currentTarget;if(!previousCategory||!category||!categories.some(candidate=>candidate.key===category)){tabGroup.active=previousCategory??"";return}category!==previousCategory&&this.emit("lr-drilldown-category-change",Object.freeze({nodeId:node.nodeId,category,previousCategory})),tabGroup.active=this.resolvedCategory(categories)??""}}static{this.defaultStrings={...super.defaultStrings,drilldownDocuments:LYRA_DEFAULT_drilldownDocuments,drilldownEmpty:LYRA_DEFAULT_drilldownEmpty,drilldownRuns:LYRA_DEFAULT_drilldownRuns,items:LYRA_DEFAULT_items,next:LYRA_DEFAULT_next,noData:LYRA_DEFAULT_noData,paginationLabel:LYRA_DEFAULT_paginationLabel,paginationSummary:LYRA_DEFAULT_paginationSummary,previous:LYRA_DEFAULT_previous,provenanceEntities:LYRA_DEFAULT_provenanceEntities,sourceListDefaultLabel:LYRA_DEFAULT_sourceListDefaultLabel}}static{this.styles=[LyraElement.styles,styles]}get path(){return this.effectivePath}set path(value){const previous=this.effectivePath,normalized=normalizePath(value);this.effectivePath=normalized.path,this.pathSourceCount=normalized.sourceCount,this.categorySourceCounts=normalized.categorySourceCounts,this.pathRevision+=1,this.requestUpdate("path",previous)}get types(){return this.effectiveTypes}set types(value){const previous=this.effectiveTypes;this.effectiveTypes=normalizeTypes(value),this.requestUpdate("types",previous)}get activeCategory(){return this.activeCategoryValue}set activeCategory(value){const previous=this.activeCategoryValue;this.activeCategoryValue=normalizeCategory(value),this.requestUpdate("activeCategory",previous)}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink(),this.syncRunsSlot(),this.armMutationObserver()}armMutationObserver(){const ownerDocument=this.ownerDocument;if(!this.isConnected||this.mutationObserver&&this.mutationObserverDocument===ownerDocument)return;this.resetMutationObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor)return;const generation=this.mutationObserverGeneration,observer=new MutationObserverCtor(()=>{this.mutationObserver!==observer||this.mutationObserverDocument!==ownerDocument||this.mutationObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.syncRunsSlot()});this.mutationObserver=observer,this.mutationObserverDocument=ownerDocument,observer.observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"],subtree:!0})}disconnectedCallback(){this.resetMutationObserver(),this.releaseAnnouncementSink(),this.announcementsArmed=!1,this.announcedLimits.clear(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetMutationObserver(),this.syncAnnouncementSink(),this.armMutationObserver()}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}resetMutationObserver(){this.mutationObserverGeneration+=1,this.mutationObserver?.disconnect(),this.mutationObserver=void 0,this.mutationObserverDocument=void 0}get currentNode(){return this.effectivePath[this.effectivePath.length-1]}categoriesFor(node){const categories=[];return(node.evidence?.length??0)>0&&categories.push({key:"evidence",label:this.localize("sourceListDefaultLabel")}),(node.documents?.length??0)>0&&categories.push({key:"documents",label:this.localize("drilldownDocuments")}),(node.entities?.length??0)>0&&categories.push({key:"entities",label:this.localize("provenanceEntities")}),this.hasRunsSlot&&categories.push({key:"runs",label:this.localize("drilldownRuns")}),categories}resolvedCategory(categories){return categories.find(category=>category.key===this.activeCategoryValue)?.key??categories[0]?.key}willUpdate(changed){super.willUpdate(changed);const node=this.currentNode,categories=node?this.categoriesFor(node):[],active=this.resolvedCategory(categories)??"",context=`${this.pathRevision}:${node?.nodeId??""}:${active}`;context!==this.pageContext&&(this.pageContext=context,this.categoryPage=0)}updated(changed){super.updated(changed);const nextLimits=new Map(this.currentLimitAnnouncements());if(this.announcementsArmed)for(const[key,text]of nextLimits)this.announcedLimits.get(key)!==text&&this.announcementSink?.announce(text);this.announcedLimits=nextLimits,this.announcementsArmed=!0}navigateTo(node,index){this.emit("lr-drilldown-navigate",Object.freeze({nodeId:node.nodeId,index}))}onEvidenceExpand(nodeId,evidenceId,event){event.stopPropagation(),this.emit("lr-drilldown-evidence-expand",Object.freeze({nodeId,evidenceId,expanded:event.detail.expanded}))}onEvidenceOpen(nodeId,item,event){event.stopPropagation(),this.emit("lr-drilldown-evidence-open",Object.freeze({nodeId,evidenceId:item.evidenceId,...item.href!==void 0?{href:item.href}:{}}))}onDocumentDownload(nodeId,document,event){event.stopPropagation(),this.emit("lr-drilldown-document-download",Object.freeze({nodeId,documentId:document.documentId,src:event.detail.src,filename:event.detail.filename}))}onDocumentRenderError(nodeId,documentId,event){event.stopPropagation(),this.emit("lr-drilldown-document-render-error",Object.freeze({nodeId,documentId,error:event.detail.error}))}onDocumentHighlightActivate(nodeId,documentId,event){event.stopPropagation(),this.emit("lr-drilldown-document-highlight-activate",Object.freeze({nodeId,documentId,highlightId:event.detail.highlightId}))}onEntityActivate(nodeId,entityId,event){event.stopPropagation(),this.emit("lr-drilldown-entity-activate",Object.freeze({nodeId,entityId}))}renderEvidence(nodeId,items){return html`${repeat(items,item=>item.evidenceId,item=>html`
|
|
2
2
|
<lr-source-card
|
|
3
3
|
part="evidence-item"
|
|
4
4
|
source-id=${item.evidenceId}
|
|
@@ -28,7 +28,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
28
28
|
.types=${this.effectiveTypes}
|
|
29
29
|
.communityLabel=${this.communityLabel}
|
|
30
30
|
.showFocusButton=${this.showFocusButton}
|
|
31
|
-
@lr-entity-
|
|
31
|
+
@lr-entity-select=${event=>this.onEntityActivate(nodeId,entity.entityId,event)}
|
|
32
32
|
></lr-entity-card>
|
|
33
33
|
`)}`}formatCount(value){return getNumberFormat(this.effectiveLocale).format(value)}rangeSummary(start,end,total,itemLabel){return this.localize("paginationSummary",void 0,{start:this.formatCount(start),end:this.formatCount(end),total:this.formatCount(total),itemLabel})}changePage(delta,total){const lastPage=Math.max(0,Math.ceil(total/ACTIVE_PAGE_SIZE)-1);this.categoryPage=Math.min(lastPage,Math.max(0,this.categoryPage+delta))}currentLimitAnnouncements(){const announcements=[];this.pathSourceCount>MAX_PATH_NODES&&announcements.push(["path",this.pathLimitSummary()]);const node=this.currentNode;if(!node)return announcements;const categories=this.categoriesFor(node),category=categories.find(candidate=>candidate.key===this.resolvedCategory(categories));if(!category||category.key==="runs")return announcements;const items=node[category.key]??[],sourceCount=this.categorySourceCounts.get(node.nodeId)?.[category.key]??items.length;return sourceCount>MAX_CATEGORY_ITEMS&&announcements.push([`${node.nodeId}:${category.key}`,this.rangeSummary(1,items.length,sourceCount,category.label)]),announcements}pathLimitSummary(){return this.rangeSummary(this.pathSourceCount-MAX_PATH_NODES+1,this.pathSourceCount,this.pathSourceCount,this.localize("items"))}renderPage(node,category,label,items,renderItems){const lastPage=Math.max(0,Math.ceil(items.length/ACTIVE_PAGE_SIZE)-1),page=Math.min(this.categoryPage,lastPage),startIndex=page*ACTIVE_PAGE_SIZE,visible=items.slice(startIndex,startIndex+ACTIVE_PAGE_SIZE),sourceCount=this.categorySourceCounts.get(node.nodeId)?.[category]??items.length,hasPages=items.length>ACTIVE_PAGE_SIZE,wasLimited=sourceCount>MAX_CATEGORY_ITEMS;return html`
|
|
34
34
|
${renderItems(visible)}
|
|
@@ -34,10 +34,6 @@ import{css}from"lit";const styles=css`
|
|
|
34
34
|
:where(lr-breadcrumb-item:not([current]))::part(base):hover {
|
|
35
35
|
text-decoration: underline;
|
|
36
36
|
}
|
|
37
|
-
/* The button is chromeless (border: none; background: none), so there is no fill to deepen --
|
|
38
|
-
the pressed state paints one. Mixing from transparent yields --lr-color-mix-partner at
|
|
39
|
-
--lr-color-mix-active alpha, tinting whatever surface the trail sits on instead of assuming
|
|
40
|
-
one. */
|
|
41
37
|
:where(lr-breadcrumb-item:not([current]))::part(base):active {
|
|
42
38
|
text-decoration: underline;
|
|
43
39
|
background: color-mix(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{collectFocusableElements,deepActiveElement}from"../../../internal/overlay-manager.js";import{getDateTimeFormat,getListFormat}from"../../../internal/intl-cache.js";import{styles}from"./filter-bar.styles.js";import"../../forms/select/select.class.js";import"../../forms/combobox/combobox.class.js";import"../../forms/combobox/option.class.js";import"../../forms/date-picker/date-input.class.js";import"../../forms/input/input.class.js";import"../../overlays/chip/chip.class.js";import"../../overlays/chip/chip-group.class.js";import"../../forms/button/button.class.js";import"../../overlays/spinner/spinner.class.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_filterBarActiveFilters,LYRA_DEFAULT_filterBarReset,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const MAX_FILTER_COLLECTION_ENTRIES=1e4,MAX_FILTER_COLLECTION_NODES=5e4,MAX_FILTER_COLLECTION_DEPTH=16,OMIT_FILTER_VALUE=Symbol("omit-filter-value"),EMPTY_FILTERS=Object.freeze([]),EMPTY_VALUE=Object.freeze({});function isPlainFilterRecord(value){try{const prototype=Object.getPrototypeOf(value);return prototype===null||Object.getPrototypeOf(prototype)===null}catch{return!1}}function snapshotFilterEntry(value,budget,depth){if(value===null||typeof value!="object"&&typeof value!="function"||typeof value=="function")return value;if(depth>MAX_FILTER_COLLECTION_DEPTH||budget.remaining<=0)return OMIT_FILTER_VALUE;const existing=budget.seen.get(value);if(existing!==void 0)return existing;let isArray=!1;try{isArray=Array.isArray(value)}catch{return OMIT_FILTER_VALUE}if(isArray){const output2=[];budget.seen.set(value,output2);let length=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0&&(length=Math.min(descriptor.value,MAX_FILTER_COLLECTION_ENTRIES))}catch{return Object.freeze(output2)}for(let index=0;index<length&&budget.remaining>0;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}if(!descriptor||!("value"in descriptor))continue;budget.remaining-=1;const entry=snapshotFilterEntry(descriptor.value,budget,depth+1);entry!==OMIT_FILTER_VALUE&&output2.push(entry)}return Object.freeze(output2)}if(!isPlainFilterRecord(value))return value;const output={};budget.seen.set(value,output);let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(value)}catch{return OMIT_FILTER_VALUE}let retained=0;for(const key of Reflect.ownKeys(descriptors)){if(retained>=MAX_FILTER_COLLECTION_ENTRIES||budget.remaining<=0)break;const descriptor=descriptors[key];if(!descriptor?.enumerable||!("value"in descriptor))continue;retained+=1,budget.remaining-=1;const entry=key==="icon"?descriptor.value:snapshotFilterEntry(descriptor.value,budget,depth+1);entry!==OMIT_FILTER_VALUE&&Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}function snapshotFilterDefinitions(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return EMPTY_FILTERS}if(!isArray)return EMPTY_FILTERS;const snapshot=snapshotFilterEntry(value,{remaining:MAX_FILTER_COLLECTION_NODES,seen:new WeakMap},0);return Array.isArray(snapshot)?snapshot:EMPTY_FILTERS}function snapshotFilterFieldValue(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return}if(!isArray)return typeof value=="string"||typeof value=="boolean"||value===void 0?value:void 0;const output=[];let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0&&(sourceLength=descriptor.value)}catch{return Object.freeze(output)}const length=Math.min(sourceLength,MAX_FILTER_COLLECTION_ENTRIES);for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}descriptor&&"value"in descriptor&&typeof descriptor.value=="string"&&output.push(descriptor.value)}return Object.freeze(output)}const SELECT_EXPORT_PARTS=["form-control-label: filter-control-label","trigger: filter-control-field","display-input: filter-control-input","start: filter-control-start","end: filter-control-end","listbox: filter-control-listbox","option: filter-control-option","clear-button: filter-control-clear-button","expand-icon: filter-control-expand-icon","error: filter-control-error","hint: filter-control-hint"].join(", "),COMBOBOX_EXPORT_PARTS=["form-control-label: filter-control-label","combobox: filter-control-field","combobox-input: filter-control-input","start: filter-control-start","end: filter-control-end","listbox: filter-control-listbox","option: filter-control-option","clear-button: filter-control-clear-button","expand-icon: filter-control-expand-icon","error: filter-control-error","hint: filter-control-hint"].join(", "),INPUT_EXPORT_PARTS=["form-control-label: filter-control-label","input-wrapper: filter-control-field","input: filter-control-input","start: filter-control-start","end: filter-control-end","clear-button: filter-control-clear-button","error: filter-control-error","hint: filter-control-hint"].join(", "),DATE_INPUT_EXPORT_PARTS=["form-control-label: filter-control-label","input-wrapper: filter-control-field","input: filter-control-input","start: filter-control-start","end: filter-control-end","clear-button: filter-control-clear-button","expand-button: filter-control-expand-button","expand-icon: filter-control-expand-icon","popup: filter-control-popup","error: filter-control-error","hint: filter-control-hint"].join(", ");function isBuiltInSet(value){return value==null?!1:typeof value=="boolean"?value:Array.isArray(value)?value.length>0:value!==""}function cloneFilterValue(value){const clone={};let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(value??{})}catch{return EMPTY_VALUE}let retained=0;for(const key of Reflect.ownKeys(descriptors)){if(retained>=MAX_FILTER_COLLECTION_ENTRIES)break;const descriptor=descriptors[key];if(typeof key!="string"||!descriptor?.enumerable||!("value"in descriptor))continue;retained+=1;const fieldValue=snapshotFilterFieldValue(descriptor.value);fieldValue!==void 0&&(clone[key]=fieldValue)}return Object.freeze(clone)}class LyraFilterBar extends LyraElement{constructor(){super(...arguments),this.label="",this.disabled=!1,this.loading=!1,this.touchedFilters=new Set,this._filters=EMPTY_FILTERS,this._value=EMPTY_VALUE,this.debounceTimers=new Map,this.pendingText=new Map,this.chipFocusGeneration=0,this.schemaGeneration=0,this.onControlChange=(id,e)=>{this.setFilterValue(id,e.target.value)},this.stopControlAlias=event=>{event.stopPropagation()},this.onCustomControlChange=(def,generation,e)=>{e.stopPropagation(),this.setCustomContextValue(def,generation,def.custom.adapter.valueFromEvent(e))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,filterBarActiveFilters:LYRA_DEFAULT_filterBarActiveFilters,filterBarReset:LYRA_DEFAULT_filterBarReset,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,progress:LYRA_DEFAULT_progress,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-validity-change"])}static{this.properties={filters:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0}}}get filters(){return this._filters}set filters(next){const old=this._filters;this.cancelDebounce(),this.renewSchemaContext();const seen=new Set;this._filters=Object.freeze(snapshotFilterDefinitions(next).filter(definition=>{try{return!(!definition||typeof definition.filterId!="string"||definition.filterId.length===0||definition.filterId!==definition.filterId.trim()||seen.has(definition.filterId)||(seen.add(definition.filterId),(definition.type==="select"||definition.type==="combobox")&&!Array.isArray(definition.options))||definition.type==="custom"&&!definition.custom?.adapter)}catch{return!1}}));const ids=new Set(this._filters.map(definition=>definition.filterId));this.touchedFilters=new Set([...this.touchedFilters].filter(id=>ids.has(id)));const oldValue=this._value;this._value=this.normalizeValue(this._value),this.requestUpdate("filters",old),this._value!==oldValue&&this.requestUpdate("value",oldValue)}get value(){return cloneFilterValue(this._value)}set value(next){const old=this._value;this._value=this.normalizeValue(next),this.requestUpdate("value",old)}renewSchemaContext(){this.schemaAbortController?.abort();const AbortControllerCtor=this.ownerDocument.defaultView?.AbortController??AbortController;this.schemaAbortController=new AbortControllerCtor,this.schemaGeneration+=1}get schemaSignal(){return this.schemaAbortController||this.renewSchemaContext(),this.schemaAbortController.signal}isEmpty(def,value){if(def.type!=="custom")return!isBuiltInSet(value);const{adapter}=def.custom;if(adapter.isEmpty)return adapter.isEmpty(value);const clear=adapter.clearValue;return Array.isArray(value)&&Array.isArray(clear)?value.length===clear.length&&value.every((entry,index)=>entry===clear[index]):Object.is(value,clear)}valueFor(def){return Object.prototype.hasOwnProperty.call(this._value,def.filterId)?this._value[def.filterId]:def.type==="custom"?def.custom.adapter.clearValue:void 0}normalizeValue(value){const normalized={};for(const def of this._filters){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value??{},def.filterId)}catch{continue}if(!descriptor||!("value"in descriptor))continue;const fieldValue=snapshotFilterFieldValue(descriptor.value);this.isEmpty(def,fieldValue)||(normalized[def.filterId]=fieldValue)}return Object.freeze(normalized)}get hasActiveFilters(){return this._filters.some(def=>!this.isEmpty(def,this.valueFor(def)))}get invalidFilterIds(){return Object.freeze(this._filters.filter(def=>def.required&&this.isEmpty(def,this.valueFor(def))).map(def=>def.filterId))}checkValidity(){return this.invalidFilterIds.length===0}reportValidity(){const invalid=this.invalidFilterIds;return invalid.length&&(this.touchedFilters=new Set([...this.touchedFilters,...invalid])),invalid.length===0}reset(){this.disabled||(this.cancelDebounce(),this.touchedFilters=new Set,this.value=this.resetValue,this.emit("lr-input",Object.freeze({value:this.value,filterId:void 0})),this.emit("lr-reset",Object.freeze({value:this.value})))}get resetValue(){const out={};for(const def of this._filters)def.defaultValue!==void 0&&!this.isEmpty(def,def.defaultValue)&&(out[def.filterId]=Array.isArray(def.defaultValue)?Object.freeze([...def.defaultValue]):def.defaultValue);return Object.freeze(out)}setFilterValue(id,value){const definition=this._filters.find(candidate=>candidate.filterId===id);if(this.disabled||!definition)return;const next={...this._value};this.isEmpty(definition,value)?delete next[id]:next[id]=value,this.value=next,this.emit("lr-input",Object.freeze({value:this.value,filterId:id}))}setCustomContextValue(definition,generation,value){generation!==this.schemaGeneration||this.schemaSignal.aborted||!this.isConnected||!this._filters.includes(definition)||this.setFilterValue(definition.filterId,value)}markTouched(id){this.disabled||this.touchedFilters.has(id)||(this.touchedFilters=new Set(this.touchedFilters).add(id))}onTextInput(def,e){if(this.disabled)return;const next=e.target.value??"",delay=def.debounce;if(typeof delay!="number"||!Number.isFinite(delay)||delay<=0){this.cancelDebounce(def.filterId),this.setFilterValue(def.filterId,next);return}this.pendingText.set(def.filterId,next);const existing=this.debounceTimers.get(def.filterId);existing!==void 0&&clearTimeout(existing),this.debounceTimers.set(def.filterId,setTimeout(()=>this.flushDebounce(def.filterId),delay))}flushDebounce(id){const timer=this.debounceTimers.get(id);if(timer===void 0)return;clearTimeout(timer),this.debounceTimers.delete(id);const pending=this.pendingText.get(id);this.pendingText.delete(id),pending!==void 0&&this.setFilterValue(id,pending)}cancelDebounce(id){for(const[key,timer]of this.debounceTimers)id!==void 0&&key!==id||(clearTimeout(timer),this.debounceTimers.delete(key),this.pendingText.delete(key))}onTextFocusout(id){this.flushDebounce(id),this.markTouched(id)}repairFocusAfterChipRemoval(index,filterId,shouldRepairFocus){const generation=++this.chipFocusGeneration;shouldRepairFocus&&this.updateComplete.then(()=>{if(!this.isConnected||this.disabled||generation!==this.chipFocusGeneration||deepActiveElement(this.ownerDocument)!==this.ownerDocument.body)return;const chips=this.renderRoot.querySelectorAll('[part="chip"]'),chip=chips[Math.min(index,chips.length-1)],target=chip?collectFocusableElements(chip)[0]:void 0;if(target){target.focus();return}for(const control of this.renderRoot.querySelectorAll("[data-filter-id]"))if(control.dataset.filterId===filterId){collectFocusableElements(control)[0]?.focus();return}})}clearFilter(id,shouldRepairFocus=!1){if(this.disabled)return;this.cancelDebounce(id);const index=this.activeEntries.findIndex(entry=>entry.def.filterId===id),def=this._filters.find(f=>f.filterId===id);if(!def)return;const clearValue=def.type==="custom"?def.custom.adapter.clearValue:def.type==="combobox"&&def.multiple?[]:"";this.setFilterValue(id,clearValue),this.repairFocusAfterChipRemoval(Math.max(0,index),id,shouldRepairFocus)}displayValueFor(def,value){if(def.type==="custom"){const formatted=def.custom?.adapter.formatValue?.(value);return formatted!==void 0?formatted:Array.isArray(value)?getListFormat(this.effectiveLocale,{style:"long",type:"conjunction"}).format(value):value===void 0?"":String(value)}if(def.type==="select"||def.type==="combobox"){const labels=(Array.isArray(value)?value.filter(entry=>typeof entry=="string"):typeof value=="string"?[value]:[]).map(v=>def.options?.find(o=>o.value===v)?.label??v);return labels.length>1?getListFormat(this.effectiveLocale,{style:"long",type:"conjunction"}).format(labels):labels[0]??""}if(def.type==="text")return typeof value=="string"?value:"";if(typeof value!="string")return"";const formatter=getDateTimeFormat(this.effectiveLocale,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}),parseIso=input=>{const match=/^(\d{4})-(\d{2})-(\d{2})$/.exec(input);if(!match)return;const year=Number(match[1]),month=Number(match[2]),day=Number(match[3]),date=new Date(0);return date.setUTCHours(0,0,0,0),date.setUTCFullYear(year,month-1,day),date.getUTCFullYear()===year&&date.getUTCMonth()===month-1&&date.getUTCDate()===day?date:void 0},segments=value.split("/");if(def.type==="date"&&segments.length!==1||def.type==="date-range"&&segments.length!==2)return value;const[startText,endText]=segments,start=parseIso(startText??""),end=endText===void 0?void 0:parseIso(endText);return!start||endText!==void 0&&(!end||end.getTime()<start.getTime())?value:end?formatter.formatRange(start,end):formatter.format(start)}get activeEntries(){return this._filters.filter(def=>!this.isEmpty(def,this.valueFor(def))).map(def=>({def,display:this.displayValueFor(def,this.valueFor(def))}))}disconnectedCallback(){super.disconnectedCallback(),this.cancelDebounce(),this.schemaAbortController?.abort(),this.schemaAbortController=void 0,this.schemaGeneration+=1}connectedCallback(){super.connectedCallback(),(!this.schemaAbortController||this.schemaAbortController.signal.aborted)&&(this.renewSchemaContext(),this.hasUpdated&&this.requestUpdate()),this.hasUpdated&&queueMicrotask(()=>{this.isConnected&&this.syncTextControls()})}syncTextControls(){if(!this._filters.some(def=>def.type==="text"))return;const fields=new Map;for(const node of this.renderRoot.querySelectorAll("lr-input[data-filter-id]")){const element=node,id=element.dataset.filterId;id!==void 0&&fields.set(id,element)}for(const def of this._filters){if(def.type!=="text"||this.debounceTimers.has(def.filterId))continue;const field=fields.get(def.filterId);if(!field)continue;const raw=this._value[def.filterId],next=typeof raw=="string"?raw:"";field.value!==next&&(field.value=next)}}willUpdate(changed){super.willUpdate(changed),changed.has("disabled")&&this.disabled&&this.cancelDebounce()}updated(changed){if(super.updated(changed),this.syncTextControls(),changed.has("value")||changed.has("filters")){const invalidFilterIds=this.invalidFilterIds,valid=invalidFilterIds.length===0,key=JSON.stringify({valid,invalidFilterIds});key!==this.lastValidityKey&&(this.lastValidityKey=key,this.emit("lr-validity-change",Object.freeze({valid,invalidFilterIds:Object.freeze([...invalidFilterIds])})))}}renderOption(option){return html`<lr-option value=${option.value}
|
|
1
|
+
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{collectFocusableElements,deepActiveElement}from"../../../internal/overlay-manager.js";import{getDateTimeFormat,getListFormat}from"../../../internal/intl-cache.js";import{styles}from"./filter-bar.styles.js";import"../../forms/select/select.class.js";import"../../forms/combobox/combobox.class.js";import"../../forms/combobox/option.class.js";import"../../forms/date-picker/date-input.class.js";import"../../forms/input/input.class.js";import"../../overlays/chip/chip.class.js";import"../../overlays/chip/chip-group.class.js";import"../../forms/button/button.class.js";import"../../overlays/spinner/spinner.class.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_filterBarActiveFilters,LYRA_DEFAULT_filterBarReset}from"../../../internal/default-strings.generated.js";const MAX_FILTER_COLLECTION_ENTRIES=1e4,MAX_FILTER_COLLECTION_NODES=5e4,MAX_FILTER_COLLECTION_DEPTH=16,OMIT_FILTER_VALUE=Symbol("omit-filter-value"),EMPTY_FILTERS=Object.freeze([]),EMPTY_VALUE=Object.freeze({});function isPlainFilterRecord(value){try{const prototype=Object.getPrototypeOf(value);return prototype===null||Object.getPrototypeOf(prototype)===null}catch{return!1}}function snapshotFilterEntry(value,budget,depth){if(value===null||typeof value!="object"&&typeof value!="function"||typeof value=="function")return value;if(depth>MAX_FILTER_COLLECTION_DEPTH||budget.remaining<=0)return OMIT_FILTER_VALUE;const existing=budget.seen.get(value);if(existing!==void 0)return existing;let isArray=!1;try{isArray=Array.isArray(value)}catch{return OMIT_FILTER_VALUE}if(isArray){const output2=[];budget.seen.set(value,output2);let length=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0&&(length=Math.min(descriptor.value,MAX_FILTER_COLLECTION_ENTRIES))}catch{return Object.freeze(output2)}for(let index=0;index<length&&budget.remaining>0;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}if(!descriptor||!("value"in descriptor))continue;budget.remaining-=1;const entry=snapshotFilterEntry(descriptor.value,budget,depth+1);entry!==OMIT_FILTER_VALUE&&output2.push(entry)}return Object.freeze(output2)}if(!isPlainFilterRecord(value))return value;const output={};budget.seen.set(value,output);let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(value)}catch{return OMIT_FILTER_VALUE}let retained=0;for(const key of Reflect.ownKeys(descriptors)){if(retained>=MAX_FILTER_COLLECTION_ENTRIES||budget.remaining<=0)break;const descriptor=descriptors[key];if(!descriptor?.enumerable||!("value"in descriptor))continue;retained+=1,budget.remaining-=1;const entry=key==="icon"?descriptor.value:snapshotFilterEntry(descriptor.value,budget,depth+1);entry!==OMIT_FILTER_VALUE&&Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}function snapshotFilterDefinitions(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return EMPTY_FILTERS}if(!isArray)return EMPTY_FILTERS;const snapshot=snapshotFilterEntry(value,{remaining:MAX_FILTER_COLLECTION_NODES,seen:new WeakMap},0);return Array.isArray(snapshot)?snapshot:EMPTY_FILTERS}function snapshotFilterFieldValue(value){let isArray=!1;try{isArray=Array.isArray(value)}catch{return}if(!isArray)return typeof value=="string"||typeof value=="boolean"||value===void 0?value:void 0;const output=[];let sourceLength=0;try{const descriptor=Object.getOwnPropertyDescriptor(value,"length");descriptor&&"value"in descriptor&&typeof descriptor.value=="number"&&Number.isSafeInteger(descriptor.value)&&descriptor.value>=0&&(sourceLength=descriptor.value)}catch{return Object.freeze(output)}const length=Math.min(sourceLength,MAX_FILTER_COLLECTION_ENTRIES);for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}descriptor&&"value"in descriptor&&typeof descriptor.value=="string"&&output.push(descriptor.value)}return Object.freeze(output)}const SELECT_EXPORT_PARTS=["form-control-label: filter-control-label","trigger: filter-control-field","display-input: filter-control-input","start: filter-control-start","end: filter-control-end","listbox: filter-control-listbox","option: filter-control-option","clear-button: filter-control-clear-button","expand-icon: filter-control-expand-icon","error: filter-control-error","hint: filter-control-hint"].join(", "),COMBOBOX_EXPORT_PARTS=["form-control-label: filter-control-label","combobox: filter-control-field","combobox-input: filter-control-input","start: filter-control-start","end: filter-control-end","listbox: filter-control-listbox","option: filter-control-option","clear-button: filter-control-clear-button","expand-icon: filter-control-expand-icon","error: filter-control-error","hint: filter-control-hint"].join(", "),INPUT_EXPORT_PARTS=["form-control-label: filter-control-label","input-wrapper: filter-control-field","input: filter-control-input","start: filter-control-start","end: filter-control-end","clear-button: filter-control-clear-button","error: filter-control-error","hint: filter-control-hint"].join(", "),DATE_INPUT_EXPORT_PARTS=["form-control-label: filter-control-label","input-wrapper: filter-control-field","input: filter-control-input","start: filter-control-start","end: filter-control-end","clear-button: filter-control-clear-button","expand-button: filter-control-expand-button","expand-icon: filter-control-expand-icon","popup: filter-control-popup","error: filter-control-error","hint: filter-control-hint"].join(", ");function isBuiltInSet(value){return value==null?!1:typeof value=="boolean"?value:Array.isArray(value)?value.length>0:value!==""}function cloneFilterValue(value){const clone={};let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(value??{})}catch{return EMPTY_VALUE}let retained=0;for(const key of Reflect.ownKeys(descriptors)){if(retained>=MAX_FILTER_COLLECTION_ENTRIES)break;const descriptor=descriptors[key];if(typeof key!="string"||!descriptor?.enumerable||!("value"in descriptor))continue;retained+=1;const fieldValue=snapshotFilterFieldValue(descriptor.value);fieldValue!==void 0&&(clone[key]=fieldValue)}return Object.freeze(clone)}class LyraFilterBar extends LyraElement{constructor(){super(...arguments),this.label="",this.disabled=!1,this.loading=!1,this.touchedFilters=new Set,this._filters=EMPTY_FILTERS,this._value=EMPTY_VALUE,this.debounceTimers=new Map,this.pendingText=new Map,this.chipFocusGeneration=0,this.schemaGeneration=0,this.onControlChange=(id,e)=>{this.setFilterValue(id,e.target.value)},this.stopControlAlias=event=>{event.stopPropagation()},this.onCustomControlChange=(def,generation,e)=>{e.stopPropagation(),this.setCustomContextValue(def,generation,def.custom.adapter.valueFromEvent(e))}}static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,filterBarActiveFilters:LYRA_DEFAULT_filterBarActiveFilters,filterBarReset:LYRA_DEFAULT_filterBarReset}}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-validity-change"])}static{this.properties={filters:{attribute:!1,noAccessor:!0},value:{attribute:!1,noAccessor:!0}}}get filters(){return this._filters}set filters(next){const old=this._filters;this.cancelDebounce(),this.renewSchemaContext();const seen=new Set;this._filters=Object.freeze(snapshotFilterDefinitions(next).filter(definition=>{try{return!(!definition||typeof definition.filterId!="string"||definition.filterId.length===0||definition.filterId!==definition.filterId.trim()||seen.has(definition.filterId)||(seen.add(definition.filterId),(definition.type==="select"||definition.type==="combobox")&&!Array.isArray(definition.options))||definition.type==="custom"&&!definition.custom?.adapter)}catch{return!1}}));const ids=new Set(this._filters.map(definition=>definition.filterId));this.touchedFilters=new Set([...this.touchedFilters].filter(id=>ids.has(id)));const oldValue=this._value;this._value=this.normalizeValue(this._value),this.requestUpdate("filters",old),this._value!==oldValue&&this.requestUpdate("value",oldValue)}get value(){return cloneFilterValue(this._value)}set value(next){const old=this._value;this._value=this.normalizeValue(next),this.requestUpdate("value",old)}renewSchemaContext(){this.schemaAbortController?.abort();const AbortControllerCtor=this.ownerDocument.defaultView?.AbortController??AbortController;this.schemaAbortController=new AbortControllerCtor,this.schemaGeneration+=1}get schemaSignal(){return this.schemaAbortController||this.renewSchemaContext(),this.schemaAbortController.signal}isEmpty(def,value){if(def.type!=="custom")return!isBuiltInSet(value);const{adapter}=def.custom;if(adapter.isEmpty)return adapter.isEmpty(value);const clear=adapter.clearValue;return Array.isArray(value)&&Array.isArray(clear)?value.length===clear.length&&value.every((entry,index)=>entry===clear[index]):Object.is(value,clear)}valueFor(def){return Object.prototype.hasOwnProperty.call(this._value,def.filterId)?this._value[def.filterId]:def.type==="custom"?def.custom.adapter.clearValue:void 0}normalizeValue(value){const normalized={};for(const def of this._filters){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value??{},def.filterId)}catch{continue}if(!descriptor||!("value"in descriptor))continue;const fieldValue=snapshotFilterFieldValue(descriptor.value);this.isEmpty(def,fieldValue)||(normalized[def.filterId]=fieldValue)}return Object.freeze(normalized)}get hasActiveFilters(){return this._filters.some(def=>!this.isEmpty(def,this.valueFor(def)))}get invalidFilterIds(){return Object.freeze(this._filters.filter(def=>def.required&&this.isEmpty(def,this.valueFor(def))).map(def=>def.filterId))}checkValidity(){return this.invalidFilterIds.length===0}reportValidity(){const invalid=this.invalidFilterIds;return invalid.length&&(this.touchedFilters=new Set([...this.touchedFilters,...invalid])),invalid.length===0}reset(){this.disabled||(this.cancelDebounce(),this.touchedFilters=new Set,this.value=this.resetValue,this.emit("lr-input",Object.freeze({value:this.value,filterId:void 0})),this.emit("lr-reset",Object.freeze({value:this.value})))}get resetValue(){const out={};for(const def of this._filters)def.defaultValue!==void 0&&!this.isEmpty(def,def.defaultValue)&&(out[def.filterId]=Array.isArray(def.defaultValue)?Object.freeze([...def.defaultValue]):def.defaultValue);return Object.freeze(out)}setFilterValue(id,value){const definition=this._filters.find(candidate=>candidate.filterId===id);if(this.disabled||!definition)return;const next={...this._value};this.isEmpty(definition,value)?delete next[id]:next[id]=value,this.value=next,this.emit("lr-input",Object.freeze({value:this.value,filterId:id}))}setCustomContextValue(definition,generation,value){generation!==this.schemaGeneration||this.schemaSignal.aborted||!this.isConnected||!this._filters.includes(definition)||this.setFilterValue(definition.filterId,value)}markTouched(id){this.disabled||this.touchedFilters.has(id)||(this.touchedFilters=new Set(this.touchedFilters).add(id))}onTextInput(def,e){if(this.disabled)return;const next=e.target.value??"",delay=def.debounce;if(typeof delay!="number"||!Number.isFinite(delay)||delay<=0){this.cancelDebounce(def.filterId),this.setFilterValue(def.filterId,next);return}this.pendingText.set(def.filterId,next);const existing=this.debounceTimers.get(def.filterId);existing!==void 0&&clearTimeout(existing),this.debounceTimers.set(def.filterId,setTimeout(()=>this.flushDebounce(def.filterId),delay))}flushDebounce(id){const timer=this.debounceTimers.get(id);if(timer===void 0)return;clearTimeout(timer),this.debounceTimers.delete(id);const pending=this.pendingText.get(id);this.pendingText.delete(id),pending!==void 0&&this.setFilterValue(id,pending)}cancelDebounce(id){for(const[key,timer]of this.debounceTimers)id!==void 0&&key!==id||(clearTimeout(timer),this.debounceTimers.delete(key),this.pendingText.delete(key))}onTextFocusout(id){this.flushDebounce(id),this.markTouched(id)}repairFocusAfterChipRemoval(index,filterId,shouldRepairFocus){const generation=++this.chipFocusGeneration;shouldRepairFocus&&this.updateComplete.then(()=>{if(!this.isConnected||this.disabled||generation!==this.chipFocusGeneration||deepActiveElement(this.ownerDocument)!==this.ownerDocument.body)return;const chips=this.renderRoot.querySelectorAll('[part="chip"]'),chip=chips[Math.min(index,chips.length-1)],target=chip?collectFocusableElements(chip)[0]:void 0;if(target){target.focus();return}for(const control of this.renderRoot.querySelectorAll("[data-filter-id]"))if(control.dataset.filterId===filterId){collectFocusableElements(control)[0]?.focus();return}})}clearFilter(id,shouldRepairFocus=!1){if(this.disabled)return;this.cancelDebounce(id);const index=this.activeEntries.findIndex(entry=>entry.def.filterId===id),def=this._filters.find(f=>f.filterId===id);if(!def)return;const clearValue=def.type==="custom"?def.custom.adapter.clearValue:def.type==="combobox"&&def.multiple?[]:"";this.setFilterValue(id,clearValue),this.repairFocusAfterChipRemoval(Math.max(0,index),id,shouldRepairFocus)}displayValueFor(def,value){if(def.type==="custom"){const formatted=def.custom?.adapter.formatValue?.(value);return formatted!==void 0?formatted:Array.isArray(value)?getListFormat(this.effectiveLocale,{style:"long",type:"conjunction"}).format(value):value===void 0?"":String(value)}if(def.type==="select"||def.type==="combobox"){const labels=(Array.isArray(value)?value.filter(entry=>typeof entry=="string"):typeof value=="string"?[value]:[]).map(v=>def.options?.find(o=>o.value===v)?.label??v);return labels.length>1?getListFormat(this.effectiveLocale,{style:"long",type:"conjunction"}).format(labels):labels[0]??""}if(def.type==="text")return typeof value=="string"?value:"";if(typeof value!="string")return"";const formatter=getDateTimeFormat(this.effectiveLocale,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}),parseIso=input=>{const match=/^(\d{4})-(\d{2})-(\d{2})$/.exec(input);if(!match)return;const year=Number(match[1]),month=Number(match[2]),day=Number(match[3]),date=new Date(0);return date.setUTCHours(0,0,0,0),date.setUTCFullYear(year,month-1,day),date.getUTCFullYear()===year&&date.getUTCMonth()===month-1&&date.getUTCDate()===day?date:void 0},segments=value.split("/");if(def.type==="date"&&segments.length!==1||def.type==="date-range"&&segments.length!==2)return value;const[startText,endText]=segments,start=parseIso(startText??""),end=endText===void 0?void 0:parseIso(endText);return!start||endText!==void 0&&(!end||end.getTime()<start.getTime())?value:end?formatter.formatRange(start,end):formatter.format(start)}get activeEntries(){return this._filters.filter(def=>!this.isEmpty(def,this.valueFor(def))).map(def=>({def,display:this.displayValueFor(def,this.valueFor(def))}))}disconnectedCallback(){super.disconnectedCallback(),this.cancelDebounce(),this.schemaAbortController?.abort(),this.schemaAbortController=void 0,this.schemaGeneration+=1}connectedCallback(){super.connectedCallback(),(!this.schemaAbortController||this.schemaAbortController.signal.aborted)&&(this.renewSchemaContext(),this.hasUpdated&&this.requestUpdate()),this.hasUpdated&&queueMicrotask(()=>{this.isConnected&&this.syncTextControls()})}syncTextControls(){if(!this._filters.some(def=>def.type==="text"))return;const fields=new Map;for(const node of this.renderRoot.querySelectorAll("lr-input[data-filter-id]")){const element=node,id=element.dataset.filterId;id!==void 0&&fields.set(id,element)}for(const def of this._filters){if(def.type!=="text"||this.debounceTimers.has(def.filterId))continue;const field=fields.get(def.filterId);if(!field)continue;const raw=this._value[def.filterId],next=typeof raw=="string"?raw:"";field.value!==next&&(field.value=next)}}willUpdate(changed){super.willUpdate(changed),changed.has("disabled")&&this.disabled&&this.cancelDebounce()}updated(changed){if(super.updated(changed),this.syncTextControls(),changed.has("value")||changed.has("filters")){const invalidFilterIds=this.invalidFilterIds,valid=invalidFilterIds.length===0,key=JSON.stringify({valid,invalidFilterIds});key!==this.lastValidityKey&&(this.lastValidityKey=key,this.emit("lr-validity-change",Object.freeze({valid,invalidFilterIds:Object.freeze([...invalidFilterIds])})))}}renderOption(option){return html`<lr-option value=${option.value}
|
|
2
2
|
>${option.icon===void 0||option.icon===null?nothing:html`<span slot="start" aria-hidden="true" inert>${option.icon}</span>`}${option.label}</lr-option
|
|
3
3
|
>`}renderControl(def){const value=this.valueFor(def),missing=!!def.required&&this.isEmpty(def,value),errorText=this.touchedFilters.has(def.filterId)&&missing?this.localize("fieldRequired"):"",onChange=e=>this.onControlChange(def.filterId,e),onFocusout=()=>this.markTouched(def.filterId);if(def.type==="custom"){const custom=def.custom,generation=this.schemaGeneration,signal=this.schemaSignal,onCustomValueChange=e=>this.onCustomControlChange(def,generation,e),context={filterId:def.filterId,label:def.label,definition:def,value,disabled:this.disabled,required:!!def.required,errorText,signal,generation,setValue:next=>this.setCustomContextValue(def,generation,next),onValueChange:onCustomValueChange,onInput:onCustomValueChange,onChange:onCustomValueChange,onFocusout:()=>{generation===this.schemaGeneration&&!signal.aborted&&this._filters.includes(def)&&onFocusout()}};return html`<div
|
|
4
4
|
part="filter-control"
|
|
@@ -14,10 +14,6 @@ import{css}from"lit";const styles=css`
|
|
|
14
14
|
[part='controls'] {
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-wrap: wrap;
|
|
17
|
-
/* end (not center/stretch): every composed control (lr-select/lr-combobox/lr-date-input/
|
|
18
|
-
lr-input) renders its own label above its own field, so aligning to the field row's own
|
|
19
|
-
baseline keeps the reset button (no label above it) sitting flush with the fields beside
|
|
20
|
-
it. */
|
|
21
17
|
align-items: flex-end;
|
|
22
18
|
gap: var(--lr-space-s);
|
|
23
19
|
min-inline-size: 0;
|
|
@@ -64,11 +60,6 @@ import{css}from"lit";const styles=css`
|
|
|
64
60
|
min-inline-size: 0;
|
|
65
61
|
max-inline-size: 100%;
|
|
66
62
|
}
|
|
67
|
-
/* lr-chip has no disabled property of its own to bind ?disabled to (unlike every other
|
|
68
|
-
composed control in this component) -- the chip itself is un-rendered as \`removable\` while
|
|
69
|
-
the filter bar is disabled (see render()), so there is no clickable remove affordance left to
|
|
70
|
-
gate; this only supplies the same dimmed visual treatment every other disabled sub-control
|
|
71
|
-
gets. Shared library-wide disabled-state token -- see lr-checkbox/lr-select/lr-menu-item. */
|
|
72
63
|
:host([disabled]) [part='chip'] {
|
|
73
64
|
opacity: var(--lr-opacity-disabled);
|
|
74
65
|
}
|
|
@@ -144,6 +144,11 @@ export interface LyraMenuItemEventMap {
|
|
|
144
144
|
* @since 4.0.0
|
|
145
145
|
*/
|
|
146
146
|
export declare class LyraMenuItem extends LyraElement<LyraMenuItemEventMap> {
|
|
147
|
+
/** Reflected from `submenuExpanded` as a styling hook. The parent `<lr-menu>` owns submenu
|
|
148
|
+
* state through `openSubmenu()`/`closeSubmenu()`, so this is output rather than input and is
|
|
149
|
+
* not observed. `<lr-dropdown-item>` inherits this and adds the `submenuopen` spelling to its
|
|
150
|
+
* own `observedAttributes`, where it genuinely is settable. */
|
|
151
|
+
protected static readonly knownUnobservedAttributes: readonly string[];
|
|
147
152
|
static styles: import("lit").CSSResultGroup[];
|
|
148
153
|
/** An id/value available on the item carried by the parent `<lr-menu>`'s `lr-select` detail. */
|
|
149
154
|
value: string;
|
|
@@ -12,7 +12,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
12
12
|
aria-hidden="true"
|
|
13
13
|
focusable="false"
|
|
14
14
|
><polyline points="5 12.5 10 17.5 19 6.5"></polyline></svg>
|
|
15
|
-
`}class LyraMenuItem extends LyraElement{constructor(){super(...arguments),this.value="",this.size="m",this.disabled=!1,this.variant="default",this.type="normal",this.checked=!1,this.loading=!1,this.hasIconSlot=!1,this.hasDetailsSlot=!1,this.hasSuffixSlot=!1,this.submenuAssigned=!1,this.submenuExpanded=!1,this.slottedLabel="",this.submenuPanel=null,this.submenuPanelAttached=!1,this.submenuPanelGeneration=0,this.labelObservationGeneration=0,this.announcedNativeState="",this.owningMenu=null,this.ownsAriaLabel=!1,this.ownedAriaLabelValue=null,this.ownsPanelAriaLabel=!1,this.ownedPanelAriaLabelValue=null,this.onNativeStateMutation=()=>{const signature=this.nativeStateSignature();signature!==this.announcedNativeState&&(this.announcedNativeState=signature,this.emitStateChange())},this.onIconSlotChange=()=>{this.hasIconSlot=[...this.renderRoot.querySelectorAll('slot[name="icon"], slot[name="prefix"]')].some(slot=>slot.assignedElements({flatten:!0}).length>0)},this.onDetailsSlotChange=e=>{this.hasDetailsSlot=e.target.assignedNodes({flatten:!0}).some(node=>(node.textContent??"").trim()!=="")},this.onSuffixSlotChange=e=>{this.hasSuffixSlot=e.target.assignedElements({flatten:!0}).length>0},this.onLabelSlotChange=event=>{this.observeLabelContent(),this.syncSlottedLabel(event.target)},this.onForwardedLabelSlotChange=event=>{const slot=event.target;this.labelForwardingSlots().includes(slot)&&(this.observeLabelContent(),this.syncSlottedLabel())},this.onSubmenuSlotChange=e=>{this.syncSubmenuSlot(e.target)},this.onPanelStateChange=open=>{this.submenuExpanded=open}}static{this.styles=[LyraElement.styles,sizes,styles]}get hasSubmenu(){return this.submenuAssigned}get submenuOpen(){return this.submenuExpanded}[menuItemOwner](owner,expectedOwner){owner===null&&expectedOwner&&this.owningMenu!==expectedOwner||(this.owningMenu=owner)}set submenuOpen(next){!!next!==this.submenuExpanded&&(next?this.openSubmenu("none"):this.closeSubmenu())}get interactionDisabled(){return this.disabled||this.loading}connectedCallback(){super.connectedCallback();const initialLabel=this.readSlottedLabel(null);initialLabel!==this.slottedLabel&&(this.slottedLabel=initialLabel),this.tabIndex!==0&&(this.tabIndex=-1),this.announcedNativeState=this.nativeStateSignature();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.nativeStateObserver=new MutationObserverCtor(this.onNativeStateMutation),this.nativeStateObserver.observe(this,{attributes:!0,attributeFilter:["hidden","inert","aria-hidden"]}),this.labelObserver=new MutationObserverCtor(()=>{this.observeLabelContent(),this.syncSlottedLabel()}),this.observeLabelContent()),this.addEventListener("slotchange",this.onForwardedLabelSlotChange);const labelGeneration=++this.labelObservationGeneration;this.updateComplete.then(()=>{if(!this.isConnected||labelGeneration!==this.labelObservationGeneration)return;this.observeLabelContent(),this.syncSlottedLabel();const submenuSlot=this.renderRoot.querySelector('slot[name="submenu"]');submenuSlot&&this.syncSubmenuSlot(submenuSlot)})}disconnectedCallback(){super.disconnectedCallback(),this.submenuPanelGeneration+=1,this.submenuExpanded=!1,this.nativeStateObserver?.disconnect(),this.nativeStateObserver=void 0,this.labelObservationGeneration+=1,this.removeEventListener("slotchange",this.onForwardedLabelSlotChange),this.labelObserver?.disconnect(),this.labelObserver=void 0,this.submenuPanel&&this.submenuPanelAttached&&(this.submenuPanel[submenuPanelController].detach(this),this.submenuPanelAttached=!1)}nativeStateSignature(){return`${this.hidden}|${this.inert}|${this.getAttribute("aria-hidden")}`}emitStateChange(){this.emit("lr-menu-item-state-change",{disabled:this.interactionDisabled,hidden:!!this.hidden,inert:this.inert})}willUpdate(changed){super.willUpdate(changed);const isCheckbox=this.type==="checkbox"&&!this.submenuAssigned;this.setAttribute("role",isCheckbox?"menuitemcheckbox":"menuitem"),isCheckbox?this.setAttribute("aria-checked",this.checked?"true":"false"):this.removeAttribute("aria-checked"),this.submenuAssigned?(this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",this.submenuExpanded?"true":"false")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded")),this.applyComputedName(),this.toggleAttribute("submenu-open",this.submenuExpanded),this.setAttribute("aria-disabled",String(this.interactionDisabled)),this.interactionDisabled&&(changed.has("disabled")||changed.has("loading"))&&(this.tabIndex=-1,this.ownerDocument?.activeElement===this&&this.blur()),(changed.has("disabled")||changed.has("loading"))&&this.emitStateChange()}click(){this.interactionDisabled||this.renderRoot.querySelector('[part~="base"]')?.click()}select(){if(!this.interactionDisabled){if(this.submenuPanel){this.openSubmenu("none");return}if(this.type==="checkbox"){const checked=!this.checked;this.emit("lr-menu-item-change",{value:this.value,checked},{cancelable:!0}).defaultPrevented||(this.checked=checked)}this.owningMenu?.activate(this)}}async openSubmenu(focus="first"){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||this.interactionDisabled||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],shown=controller.show(focus);this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await shown,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}async closeSubmenu(){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],hidden=controller.hide();this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await hidden,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}defaultLabelSlot(){return this.renderRoot?.querySelector("slot:not([name])")??null}isDefaultLabelBranch(node){let top=node;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top.parentNode!==this?!1:top.nodeType!==1||(top.getAttribute("slot")??"")===""}labelForwardingSlots(){return Array.from(this.querySelectorAll("slot")).filter(slot=>this.isDefaultLabelBranch(slot))}composedParentForNode(node){const assignedSlot=node.assignedSlot;if(assignedSlot)return assignedSlot;if(node.parentElement)return node.parentElement;const root=node.getRootNode();return"host"in root&&root.host.nodeType===1?root.host:null}isLabelSubtreeExcluded(element){return!(element.getRootNode()===this.renderRoot&&element.matches('[part~="label"][aria-hidden="true"][inert]:not([hidden])'))&&isAccessibilitySubtreeExcluded(element)}readSlottedLabel(slot=this.defaultLabelSlot()){const nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(this.childNodes).filter(node=>this.isDefaultLabelBranch(node));return composedAccessibilityText(nodes,{ancestorBoundary:this,isSubtreeExcluded:element=>this.isLabelSubtreeExcluded(element)}).replace(/\s+/g," ").trim()}observeLabelAncestors(node,options){const observer=this.labelObserver;if(!observer)return;let current=this.composedParentForNode(node);for(;current;)current!==this&&!this.contains(current)&&observer.observe(current,options),current=composedParentElement(current)}observeLabelContent(){const observer=this.labelObserver;if(!observer)return;observer.disconnect();const options={attributes:!0,attributeFilter:["aria-hidden","aria-label","aria-labelledby","alt","class","hidden","inert","id","label","open","slot","style"],characterData:!0,childList:!0,subtree:!0};observer.observe(this,options);const slot=this.defaultLabelSlot();for(const assigned of slot?.assignedNodes({flatten:!0})??[])this.contains(assigned)||observer.observe(assigned,options),this.observeLabelAncestors(assigned,{attributes:!0,attributeFilter:options.attributeFilter})}syncSlottedLabel(slot=this.defaultLabelSlot()){const next=this.readSlottedLabel(slot);next!==this.slottedLabel&&(this.slottedLabel=next),this.applyComputedName(),this.applyPanelName()}syncSubmenuSlot(submenuSlot){if(!submenuSlot.isConnected||submenuSlot.getRootNode()!==this.renderRoot)return;const assigned=submenuSlot.assignedElements({flatten:!0}),authoredPanel=assigned.find(element=>element.localName===tag("menu")),hasDirectItems=assigned.some(element=>element.localName===tag("menu-item")||element.localName===tag("dropdown-item")),kind=authoredPanel?"panel":hasDirectItems?"items":void 0;if(this.submenuKind=kind,this.submenuAssigned=kind!==void 0,kind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");generated&&this.connectSubmenuPanel(generated);return}this.connectSubmenuPanel(authoredPanel??null)}connectSubmenuPanel(next){const samePanel=next===this.submenuPanel;if(samePanel&&(next===null||this.submenuPanelAttached))return;const previous=this.submenuPanel;if(++this.submenuPanelGeneration,previous&&this.submenuPanelAttached&&previous[submenuPanelController].detach(this),this.submenuPanelAttached=!1,samePanel||(this.submenuPanel=next,this.ownsPanelAriaLabel=!1,this.ownedPanelAriaLabelValue=null),!this.submenuPanel){this.submenuExpanded=!1;return}const controller=this.submenuPanel[submenuPanelController];controller.attach(this,this.onPanelStateChange),this.submenuPanelAttached=!0,this.submenuExpanded=controller.open,this.applyPanelName()}isCurrentSubmenuPanel(panel,generation){return this.isConnected&&this.submenuPanel===panel&&this.submenuPanelGeneration===generation}updated(changed){if(super.updated(changed),changed.has("submenuKind")&&this.submenuKind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");this.connectSubmenuPanel(generated)}}applyComputedName(){if(this.ownsAriaLabel&&this.getAttribute("aria-label")!==this.ownedAriaLabelValue&&(this.ownsAriaLabel=!1,this.ownedAriaLabelValue=null),this.hasAttribute("aria-labelledby")){this.ownsAriaLabel&&this.removeAttribute("aria-label"),this.ownsAriaLabel=!1,this.ownedAriaLabelValue=null;return}this.hasAttribute("aria-label")&&!this.ownsAriaLabel||(this.ownsAriaLabel=!0,this.ownedAriaLabelValue=this.slottedLabel,this.getAttribute("aria-label")!==this.slottedLabel&&this.setAttribute("aria-label",this.slottedLabel))}applyPanelName(){const panel=this.submenuPanel;if(panel){if(this.ownsPanelAriaLabel&&panel.getAttribute("aria-label")!==this.ownedPanelAriaLabelValue&&(this.ownsPanelAriaLabel=!1,this.ownedPanelAriaLabelValue=null),panel.hasAttribute("label")){this.ownsPanelAriaLabel&&(panel.removeAttribute("aria-label"),this.ownsPanelAriaLabel=!1,this.ownedPanelAriaLabelValue=null);return}panel.hasAttribute("aria-label")&&!this.ownsPanelAriaLabel||(this.ownsPanelAriaLabel=!0,this.ownedPanelAriaLabelValue=this.slottedLabel,panel.getAttribute("aria-label")!==this.slottedLabel&&panel.setAttribute("aria-label",this.slottedLabel))}}getTextLabel(){return this.readSlottedLabel()}render(){return html`
|
|
15
|
+
`}class LyraMenuItem extends LyraElement{constructor(){super(...arguments),this.value="",this.size="m",this.disabled=!1,this.variant="default",this.type="normal",this.checked=!1,this.loading=!1,this.hasIconSlot=!1,this.hasDetailsSlot=!1,this.hasSuffixSlot=!1,this.submenuAssigned=!1,this.submenuExpanded=!1,this.slottedLabel="",this.submenuPanel=null,this.submenuPanelAttached=!1,this.submenuPanelGeneration=0,this.labelObservationGeneration=0,this.announcedNativeState="",this.owningMenu=null,this.ownsAriaLabel=!1,this.ownedAriaLabelValue=null,this.ownsPanelAriaLabel=!1,this.ownedPanelAriaLabelValue=null,this.onNativeStateMutation=()=>{const signature=this.nativeStateSignature();signature!==this.announcedNativeState&&(this.announcedNativeState=signature,this.emitStateChange())},this.onIconSlotChange=()=>{this.hasIconSlot=[...this.renderRoot.querySelectorAll('slot[name="icon"], slot[name="prefix"]')].some(slot=>slot.assignedElements({flatten:!0}).length>0)},this.onDetailsSlotChange=e=>{this.hasDetailsSlot=e.target.assignedNodes({flatten:!0}).some(node=>(node.textContent??"").trim()!=="")},this.onSuffixSlotChange=e=>{this.hasSuffixSlot=e.target.assignedElements({flatten:!0}).length>0},this.onLabelSlotChange=event=>{this.observeLabelContent(),this.syncSlottedLabel(event.target)},this.onForwardedLabelSlotChange=event=>{const slot=event.target;this.labelForwardingSlots().includes(slot)&&(this.observeLabelContent(),this.syncSlottedLabel())},this.onSubmenuSlotChange=e=>{this.syncSubmenuSlot(e.target)},this.onPanelStateChange=open=>{this.submenuExpanded=open}}static{this.knownUnobservedAttributes=["submenu-open"]}static{this.styles=[LyraElement.styles,sizes,styles]}get hasSubmenu(){return this.submenuAssigned}get submenuOpen(){return this.submenuExpanded}[menuItemOwner](owner,expectedOwner){owner===null&&expectedOwner&&this.owningMenu!==expectedOwner||(this.owningMenu=owner)}set submenuOpen(next){!!next!==this.submenuExpanded&&(next?this.openSubmenu("none"):this.closeSubmenu())}get interactionDisabled(){return this.disabled||this.loading}connectedCallback(){super.connectedCallback();const initialLabel=this.readSlottedLabel(null);initialLabel!==this.slottedLabel&&(this.slottedLabel=initialLabel),this.tabIndex!==0&&(this.tabIndex=-1),this.announcedNativeState=this.nativeStateSignature();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.nativeStateObserver=new MutationObserverCtor(this.onNativeStateMutation),this.nativeStateObserver.observe(this,{attributes:!0,attributeFilter:["hidden","inert","aria-hidden"]}),this.labelObserver=new MutationObserverCtor(()=>{this.observeLabelContent(),this.syncSlottedLabel()}),this.observeLabelContent()),this.addEventListener("slotchange",this.onForwardedLabelSlotChange);const labelGeneration=++this.labelObservationGeneration;this.updateComplete.then(()=>{if(!this.isConnected||labelGeneration!==this.labelObservationGeneration)return;this.observeLabelContent(),this.syncSlottedLabel();const submenuSlot=this.renderRoot.querySelector('slot[name="submenu"]');submenuSlot&&this.syncSubmenuSlot(submenuSlot)})}disconnectedCallback(){super.disconnectedCallback(),this.submenuPanelGeneration+=1,this.submenuExpanded=!1,this.nativeStateObserver?.disconnect(),this.nativeStateObserver=void 0,this.labelObservationGeneration+=1,this.removeEventListener("slotchange",this.onForwardedLabelSlotChange),this.labelObserver?.disconnect(),this.labelObserver=void 0,this.submenuPanel&&this.submenuPanelAttached&&(this.submenuPanel[submenuPanelController].detach(this),this.submenuPanelAttached=!1)}nativeStateSignature(){return`${this.hidden}|${this.inert}|${this.getAttribute("aria-hidden")}`}emitStateChange(){this.emit("lr-menu-item-state-change",{disabled:this.interactionDisabled,hidden:!!this.hidden,inert:this.inert})}willUpdate(changed){super.willUpdate(changed);const isCheckbox=this.type==="checkbox"&&!this.submenuAssigned;this.setAttribute("role",isCheckbox?"menuitemcheckbox":"menuitem"),isCheckbox?this.setAttribute("aria-checked",this.checked?"true":"false"):this.removeAttribute("aria-checked"),this.submenuAssigned?(this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",this.submenuExpanded?"true":"false")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded")),this.applyComputedName(),this.toggleAttribute("submenu-open",this.submenuExpanded),this.setAttribute("aria-disabled",String(this.interactionDisabled)),this.interactionDisabled&&(changed.has("disabled")||changed.has("loading"))&&(this.tabIndex=-1,this.ownerDocument?.activeElement===this&&this.blur()),(changed.has("disabled")||changed.has("loading"))&&this.emitStateChange()}click(){this.interactionDisabled||this.renderRoot.querySelector('[part~="base"]')?.click()}select(){if(!this.interactionDisabled){if(this.submenuPanel){this.openSubmenu("none");return}if(this.type==="checkbox"){const checked=!this.checked;this.emit("lr-menu-item-change",{value:this.value,checked},{cancelable:!0}).defaultPrevented||(this.checked=checked)}this.owningMenu?.activate(this)}}async openSubmenu(focus="first"){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||this.interactionDisabled||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],shown=controller.show(focus);this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await shown,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}async closeSubmenu(){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],hidden=controller.hide();this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await hidden,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}defaultLabelSlot(){return this.renderRoot?.querySelector("slot:not([name])")??null}isDefaultLabelBranch(node){let top=node;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top.parentNode!==this?!1:top.nodeType!==1||(top.getAttribute("slot")??"")===""}labelForwardingSlots(){return Array.from(this.querySelectorAll("slot")).filter(slot=>this.isDefaultLabelBranch(slot))}composedParentForNode(node){const assignedSlot=node.assignedSlot;if(assignedSlot)return assignedSlot;if(node.parentElement)return node.parentElement;const root=node.getRootNode();return"host"in root&&root.host.nodeType===1?root.host:null}isLabelSubtreeExcluded(element){return!(element.getRootNode()===this.renderRoot&&element.matches('[part~="label"][aria-hidden="true"][inert]:not([hidden])'))&&isAccessibilitySubtreeExcluded(element)}readSlottedLabel(slot=this.defaultLabelSlot()){const nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(this.childNodes).filter(node=>this.isDefaultLabelBranch(node));return composedAccessibilityText(nodes,{ancestorBoundary:this,isSubtreeExcluded:element=>this.isLabelSubtreeExcluded(element)}).replace(/\s+/g," ").trim()}observeLabelAncestors(node,options){const observer=this.labelObserver;if(!observer)return;let current=this.composedParentForNode(node);for(;current;)current!==this&&!this.contains(current)&&observer.observe(current,options),current=composedParentElement(current)}observeLabelContent(){const observer=this.labelObserver;if(!observer)return;observer.disconnect();const options={attributes:!0,attributeFilter:["aria-hidden","aria-label","aria-labelledby","alt","class","hidden","inert","id","label","open","slot","style"],characterData:!0,childList:!0,subtree:!0};observer.observe(this,options);const slot=this.defaultLabelSlot();for(const assigned of slot?.assignedNodes({flatten:!0})??[])this.contains(assigned)||observer.observe(assigned,options),this.observeLabelAncestors(assigned,{attributes:!0,attributeFilter:options.attributeFilter})}syncSlottedLabel(slot=this.defaultLabelSlot()){const next=this.readSlottedLabel(slot);next!==this.slottedLabel&&(this.slottedLabel=next),this.applyComputedName(),this.applyPanelName()}syncSubmenuSlot(submenuSlot){if(!submenuSlot.isConnected||submenuSlot.getRootNode()!==this.renderRoot)return;const assigned=submenuSlot.assignedElements({flatten:!0}),authoredPanel=assigned.find(element=>element.localName===tag("menu")),hasDirectItems=assigned.some(element=>element.localName===tag("menu-item")||element.localName===tag("dropdown-item")),kind=authoredPanel?"panel":hasDirectItems?"items":void 0;if(this.submenuKind=kind,this.submenuAssigned=kind!==void 0,kind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");generated&&this.connectSubmenuPanel(generated);return}this.connectSubmenuPanel(authoredPanel??null)}connectSubmenuPanel(next){const samePanel=next===this.submenuPanel;if(samePanel&&(next===null||this.submenuPanelAttached))return;const previous=this.submenuPanel;if(++this.submenuPanelGeneration,previous&&this.submenuPanelAttached&&previous[submenuPanelController].detach(this),this.submenuPanelAttached=!1,samePanel||(this.submenuPanel=next,this.ownsPanelAriaLabel=!1,this.ownedPanelAriaLabelValue=null),!this.submenuPanel){this.submenuExpanded=!1;return}const controller=this.submenuPanel[submenuPanelController];controller.attach(this,this.onPanelStateChange),this.submenuPanelAttached=!0,this.submenuExpanded=controller.open,this.applyPanelName()}isCurrentSubmenuPanel(panel,generation){return this.isConnected&&this.submenuPanel===panel&&this.submenuPanelGeneration===generation}updated(changed){if(super.updated(changed),changed.has("submenuKind")&&this.submenuKind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");this.connectSubmenuPanel(generated)}}applyComputedName(){if(this.ownsAriaLabel&&this.getAttribute("aria-label")!==this.ownedAriaLabelValue&&(this.ownsAriaLabel=!1,this.ownedAriaLabelValue=null),this.hasAttribute("aria-labelledby")){this.ownsAriaLabel&&this.removeAttribute("aria-label"),this.ownsAriaLabel=!1,this.ownedAriaLabelValue=null;return}this.hasAttribute("aria-label")&&!this.ownsAriaLabel||(this.ownsAriaLabel=!0,this.ownedAriaLabelValue=this.slottedLabel,this.getAttribute("aria-label")!==this.slottedLabel&&this.setAttribute("aria-label",this.slottedLabel))}applyPanelName(){const panel=this.submenuPanel;if(panel){if(this.ownsPanelAriaLabel&&panel.getAttribute("aria-label")!==this.ownedPanelAriaLabelValue&&(this.ownsPanelAriaLabel=!1,this.ownedPanelAriaLabelValue=null),panel.hasAttribute("label")){this.ownsPanelAriaLabel&&(panel.removeAttribute("aria-label"),this.ownsPanelAriaLabel=!1,this.ownedPanelAriaLabelValue=null);return}panel.hasAttribute("aria-label")&&!this.ownsPanelAriaLabel||(this.ownsPanelAriaLabel=!0,this.ownedPanelAriaLabelValue=this.slottedLabel,panel.getAttribute("aria-label")!==this.slottedLabel&&panel.setAttribute("aria-label",this.slottedLabel))}}getTextLabel(){return this.readSlottedLabel()}render(){return html`
|
|
16
16
|
<span part="base" @click=${()=>this.select()}>
|
|
17
17
|
<span part="icon" aria-hidden="true" inert ?hidden=${!this.hasIconSlot}>
|
|
18
18
|
<slot name="icon" @slotchange=${this.onIconSlotChange}></slot>
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
import{css}from"lit";const styles=css`
|
|
2
|
-
/* These row-chrome hooks use inline var() fallbacks rather than :host declarations, so an
|
|
3
|
-
application can set them once on a menu or another ancestor and each item inherits the value.
|
|
4
|
-
Unset, they resolve to the exact spacing and size-ladder radius this row used before. */
|
|
5
2
|
:host {
|
|
6
3
|
display: block;
|
|
7
|
-
/* place() gives every floating panel a 4px main-axis gap. Shoelace's public
|
|
8
|
-
--submenu-offset is the *final* signed distance instead: its -2px default
|
|
9
|
-
overlaps the parent menu by 2px. Keep that exact compatibility default,
|
|
10
|
-
but resolve both literals through design tokens before the class forwards
|
|
11
|
-
this internal translation to the nested menu's popup. */
|
|
12
4
|
--_lr-menu-item-submenu-translation: calc(
|
|
13
5
|
var(--submenu-offset, calc(-1 * var(--lr-size-2px))) - var(--lr-size-4px)
|
|
14
6
|
);
|
|
15
|
-
/* The host itself is the focusable role="menuitem" target (see the class
|
|
16
|
-
doc) -- the ring paints on [part='base'] instead of the host's own
|
|
17
|
-
box, matching lr-tree-item's identical :host(:focus-visible)
|
|
18
|
-
delegation, so it always hugs the visible row rather than any
|
|
19
|
-
host-level margin/inline layout quirks. */
|
|
20
7
|
outline: none;
|
|
21
8
|
border-radius: var(--lr-menu-item-radius, var(--lr-form-control-radius));
|
|
22
9
|
}
|
|
@@ -28,13 +15,7 @@ import{css}from"lit";const styles=css`
|
|
|
28
15
|
box-sizing: border-box;
|
|
29
16
|
display: flex;
|
|
30
17
|
align-items: center;
|
|
31
|
-
/* Deliberately NOT --lr-form-control-gap: that knob is the 2px rhythm between an input's own
|
|
32
|
-
inline affordances, and at this size it collides the leading icon with the label of a menu
|
|
33
|
-
row. The icon/label/chevron rhythm is constant across tiers here; only the box scales. */
|
|
34
18
|
gap: var(--lr-menu-item-gap, var(--lr-space-xs));
|
|
35
|
-
/* max() rather than the bare ladder value: the ladder's bottom two tiers resolve to 20px/24px,
|
|
36
|
-
and a menu row is a pointer target, so it floors at the WCAG 2.2 SC 2.5.8 minimum. Above
|
|
37
|
-
that floor the row tracks the same heights every other control in a toolbar row uses. */
|
|
38
19
|
min-block-size: max(var(--lr-form-control-height), var(--lr-size-24px));
|
|
39
20
|
padding-block: var(--lr-form-control-padding-block);
|
|
40
21
|
padding-inline: var(--lr-form-control-padding-inline);
|
|
@@ -48,8 +29,6 @@ import{css}from"lit";const styles=css`
|
|
|
48
29
|
[part='base']:hover {
|
|
49
30
|
background: var(--lr-color-brand-quiet);
|
|
50
31
|
}
|
|
51
|
-
/* The same fill hover uses, mixed further toward --lr-color-mix-partner (the text colour), so a
|
|
52
|
-
row that is being pressed is always a visible step past the row the pointer merely rests on. */
|
|
53
32
|
[part='base']:active {
|
|
54
33
|
background: color-mix(
|
|
55
34
|
in oklab,
|
|
@@ -59,7 +38,6 @@ import{css}from"lit";const styles=css`
|
|
|
59
38
|
}
|
|
60
39
|
:host([disabled]) [part='base'],
|
|
61
40
|
:host([loading]) [part='base'] {
|
|
62
|
-
/* Shared library-wide disabled-state token -- see lr-checkbox/lr-select. */
|
|
63
41
|
opacity: var(--lr-opacity-disabled);
|
|
64
42
|
cursor: not-allowed;
|
|
65
43
|
}
|
|
@@ -67,9 +45,6 @@ import{css}from"lit";const styles=css`
|
|
|
67
45
|
:host([loading]) [part='base']:hover {
|
|
68
46
|
background: none;
|
|
69
47
|
}
|
|
70
|
-
/* Suppression, not a treatment: the host is the role="menuitem" target and stays in the DOM as a
|
|
71
|
-
pressable box while disabled, so without this the pressed mix above would still paint under a
|
|
72
|
-
pointer that a disabled row must not respond to. */
|
|
73
48
|
:host([disabled]) [part='base']:active,
|
|
74
49
|
:host([loading]) [part='base']:active {
|
|
75
50
|
background: none;
|
|
@@ -83,8 +58,6 @@ import{css}from"lit";const styles=css`
|
|
|
83
58
|
var(--lr-color-danger-quiet)
|
|
84
59
|
);
|
|
85
60
|
}
|
|
86
|
-
/* Same step past hover as the ordinary row above, taken on the danger fill this variant hovers
|
|
87
|
-
with. Disabled/loading rows never regain enabled paint through this later danger rule. */
|
|
88
61
|
:host([variant='danger']:not([disabled]):not([loading]))
|
|
89
62
|
[part='base']:active {
|
|
90
63
|
background: var(
|
|
@@ -103,11 +76,6 @@ import{css}from"lit";const styles=css`
|
|
|
103
76
|
justify-content: center;
|
|
104
77
|
line-height: var(--lr-line-height-none);
|
|
105
78
|
}
|
|
106
|
-
/* [part='icon'][hidden] rather than a bare :empty selector -- the part
|
|
107
|
-
always contains a literal <slot> child element regardless of assigned
|
|
108
|
-
content, so :empty never matches (same fix as lr-select's
|
|
109
|
-
[part='hint']/[part='error']). Real emptiness is tracked in JS
|
|
110
|
-
(hasIconSlot) and reflected via the hidden attribute instead. */
|
|
111
79
|
[part~='icon'][hidden] {
|
|
112
80
|
display: none;
|
|
113
81
|
}
|
|
@@ -128,12 +96,6 @@ import{css}from"lit";const styles=css`
|
|
|
128
96
|
white-space: nowrap;
|
|
129
97
|
color: var(--lr-color-text-quiet);
|
|
130
98
|
font-size: var(--lr-font-size-sm);
|
|
131
|
-
/* Resolve each slotted fragment from its own first strong character (e.g. a keyboard-
|
|
132
|
-
shortcut hint like '⌘D', whose leading glyph is bidi-neutral) instead of inheriting the
|
|
133
|
-
row's ambient direction. Only the *position* of these trailing parts should mirror under
|
|
134
|
-
RTL -- the flex row above already handles that -- their own internal glyph order must stay
|
|
135
|
-
fixed, matching how the OS itself displays the shortcut. Same mechanism as
|
|
136
|
-
toast-item.styles.ts's/alert.styles.ts's identical [part="content"]/[part="message"] rules. */
|
|
137
99
|
unicode-bidi: plaintext;
|
|
138
100
|
}
|
|
139
101
|
[part='details'] ::slotted(*),
|
|
@@ -158,16 +120,10 @@ import{css}from"lit";const styles=css`
|
|
|
158
120
|
transform: rotate(360deg);
|
|
159
121
|
}
|
|
160
122
|
}
|
|
161
|
-
/* Only ever present in the DOM at all for a checked type="checkbox" item
|
|
162
|
-
(see menu-item.ts's render()) -- no [hidden]-toggling needed, unlike
|
|
163
|
-
[part='icon'] above, since there's no always-present <slot> child here
|
|
164
|
-
to keep visually empty in between. */
|
|
165
123
|
[part='checkmark'] {
|
|
166
124
|
flex: 0 0 auto;
|
|
167
125
|
color: var(--lr-color-brand);
|
|
168
126
|
}
|
|
169
|
-
/* Only in the DOM at all for a submenu parent (see menu-item.ts's render()),
|
|
170
|
-
so it needs no [hidden] bookkeeping either. */
|
|
171
127
|
[part='submenu-icon'] {
|
|
172
128
|
display: inline-flex;
|
|
173
129
|
flex: 0 0 auto;
|
|
@@ -178,15 +134,10 @@ import{css}from"lit";const styles=css`
|
|
|
178
134
|
font-size: var(--lr-font-size-sm);
|
|
179
135
|
line-height: var(--lr-line-height-none);
|
|
180
136
|
}
|
|
181
|
-
/* The chevron points at the submenu, which opens on the inline-end side --
|
|
182
|
-
mirrored through this wrapping part rather than by swapping the glyph, so
|
|
183
|
-
the shared icon set stays direction-free. */
|
|
184
137
|
:host(:dir(rtl)) [part='submenu-icon'] {
|
|
185
138
|
transform: scaleX(-1);
|
|
186
139
|
}
|
|
187
140
|
:host(:dir(rtl)) {
|
|
188
|
-
/* A positive distance moves away from the parent and a negative distance
|
|
189
|
-
overlaps it, regardless of which inline edge owns the submenu. */
|
|
190
141
|
--_lr-menu-item-submenu-translation: calc(
|
|
191
142
|
var(--lr-size-4px) - var(--submenu-offset, calc(-1 * var(--lr-size-2px)))
|
|
192
143
|
);
|
|
@@ -8,8 +8,6 @@ import{css}from"lit";const styles=css`
|
|
|
8
8
|
font-weight: var(--lr-font-weight-semibold);
|
|
9
9
|
line-height: var(--lr-line-height-snug);
|
|
10
10
|
color: var(--lr-color-text-quiet);
|
|
11
|
-
/* A group heading is not an action: no pointer cursor, no hover/active feedback, and it is
|
|
12
|
-
skipped by <lr-menu>'s roving tabindex because it is not a LyraMenuItem. */
|
|
13
11
|
cursor: default;
|
|
14
12
|
user-select: none;
|
|
15
13
|
}
|
|
@@ -13,7 +13,6 @@ import{css}from"lit";const styles=css`
|
|
|
13
13
|
border: var(--lr-border-width-thin) solid var(--lr-color-border);
|
|
14
14
|
border-radius: var(--lr-radius);
|
|
15
15
|
}
|
|
16
|
-
/* A dropdown supplies the visible surface; a submenu supplies the private surface below. */
|
|
17
16
|
:host([data-contained]),
|
|
18
17
|
:host([data-submenu]) {
|
|
19
18
|
display: contents;
|
|
@@ -61,15 +60,6 @@ import{css}from"lit";const styles=css`
|
|
|
61
60
|
transition: none !important;
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
|
-
/* Composed content that is deliberately NOT a menu item, rendered outside
|
|
65
|
-
the role="menu" list (arbitrary content inside role="menu" is an
|
|
66
|
-
aria-required-children violation). Both wrappers collapse to no box at
|
|
67
|
-
all while their slot is unfilled, which is what keeps a menu that uses
|
|
68
|
-
neither slot rendering exactly as it did before they existed.
|
|
69
|
-
An :empty selector cannot drive that: Chromium's :empty does not ignore
|
|
70
|
-
the whitespace-only text nodes Lit leaves inside a part, so the rule
|
|
71
|
-
would silently never match -- the host attributes below are set from the
|
|
72
|
-
slots' own slotchange instead. */
|
|
73
63
|
[part='header'],
|
|
74
64
|
[part='footer'] {
|
|
75
65
|
flex: 0 0 auto;
|
|
@@ -79,8 +69,6 @@ import{css}from"lit";const styles=css`
|
|
|
79
69
|
:host(:not([data-has-footer])) [part='footer'] {
|
|
80
70
|
display: none;
|
|
81
71
|
}
|
|
82
|
-
/* The divider only earns its keep when there are items on the other side of
|
|
83
|
-
it -- a header above an empty list would otherwise draw a stray rule. */
|
|
84
72
|
:host(:not([data-list-empty])) [part='header'] {
|
|
85
73
|
border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border);
|
|
86
74
|
}
|
|
@@ -90,9 +78,6 @@ import{css}from"lit";const styles=css`
|
|
|
90
78
|
[part='list'] {
|
|
91
79
|
display: flex;
|
|
92
80
|
flex-direction: column;
|
|
93
|
-
/* The list, not a filled header/footer, is what scrolls when the popup
|
|
94
|
-
runs out of room -- min-block-size:0 is what lets it shrink below its
|
|
95
|
-
content height inside the popup's own column. */
|
|
96
81
|
flex: 0 1 auto;
|
|
97
82
|
min-block-size: 0;
|
|
98
83
|
max-block-size: min(
|
|
@@ -104,9 +89,6 @@ import{css}from"lit";const styles=css`
|
|
|
104
89
|
padding: var(--lr-space-xs);
|
|
105
90
|
outline: none;
|
|
106
91
|
}
|
|
107
|
-
/* A plain <hr> divider between item groups -- native <hr> already carries
|
|
108
|
-
an implicit ARIA role of "separator", exactly what role="menu" expects
|
|
109
|
-
between groups of menuitem children, so no role attribute needs adding. */
|
|
110
92
|
::slotted(hr) {
|
|
111
93
|
border: none;
|
|
112
94
|
border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border);
|