@aceshooting/lyra-ui 9.1.1 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +785 -0
- package/custom-elements.json +1 -1
- package/design-tokens.json +13 -0
- package/dist/cli/migrate-wa.mjs +216 -1
- package/dist/cli/migration-contract.json +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.js +1 -1
- 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 +7 -5
- 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.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.styles.js +3 -5
- 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.styles.js +0 -46
- package/dist/components/agent-tools/eval-dataset/eval-dataset.styles.js +0 -7
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +2 -2
- 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 +0 -3
- 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 +0 -3
- 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.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.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.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.styles.js +7 -31
- package/dist/components/charts/chart/box-plot.class.d.ts +27 -0
- package/dist/components/charts/chart/box-plot.class.js +14 -4
- package/dist/components/charts/chart/box-plot.styles.js +28 -20
- 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 +120 -0
- package/dist/components/charts/chart/chart.class.js +16 -6
- package/dist/components/charts/chart/chart.styles.js +28 -27
- 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/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.styles.js +7 -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/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 +0 -23
- 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.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/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 +117 -1
- 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.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 +0 -105
- 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.d.ts +71 -3
- package/dist/components/forms/combobox/combobox.class.js +5 -3
- package/dist/components/forms/combobox/combobox.styles.js +31 -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 +47 -0
- package/dist/components/forms/date-picker/date-picker.class.js +36 -22
- package/dist/components/forms/date-picker/date-picker.styles.js +82 -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 +0 -37
- 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 +3 -11
- 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.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.styles.js +0 -63
- 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 +1 -1
- package/dist/components/media/attachment-chip/attachment-chip.styles.js +0 -31
- package/dist/components/media/attachment-trigger/attachment-trigger.class.js +3 -3
- 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.styles.js +3 -24
- package/dist/components/media/flag/flag.class.d.ts +23 -1
- 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 +0 -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 +178 -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 +0 -11
- 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 +32 -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.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 +28 -4
- 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 +1 -1
- package/dist/components/overlays/popup/popup.class.d.ts +1 -0
- package/dist/components/overlays/popup/popup.class.js +1 -1
- 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 +0 -3
- 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.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/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/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 +0 -16
- 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.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.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.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/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.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.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 +72 -40
- 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 +27 -4
- package/dist/internal/dev-mode-attribute-warning.js +1 -1
- 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 +20 -113
- package/dist/lyra.d.ts +9 -6
- package/dist/styles/reservations.css +82 -0
- package/dist/svelte.d.ts +72 -40
- 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 +72 -40
- 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 +7 -4
- package/llms/components/lr-av-player.md +3 -1
- package/llms/components/lr-avatar.md +6 -6
- package/llms/components/lr-bar-chart.md +8 -6
- package/llms/components/lr-box-plot.md +15 -4
- package/llms/components/lr-browser-frame.md +7 -3
- package/llms/components/lr-bubble-chart.md +8 -6
- package/llms/components/lr-calendar.md +9 -2
- package/llms/components/lr-card.md +24 -0
- package/llms/components/lr-chart.md +45 -11
- 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 +47 -8
- 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-date-input.md +22 -2
- package/llms/components/lr-date-picker.md +23 -3
- package/llms/components/lr-details.md +11 -2
- package/llms/components/lr-dialog.md +16 -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 +8 -6
- 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 +30 -8
- package/llms/components/lr-heatmap.md +46 -0
- package/llms/components/lr-histogram.md +7 -4
- 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 +8 -6
- package/llms/components/lr-lite-chart.md +16 -6
- package/llms/components/lr-map.md +91 -10
- 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 +46 -7
- package/llms/components/lr-pdf-viewer.md +62 -2
- package/llms/components/lr-pie-chart.md +8 -6
- package/llms/components/lr-polar-area-chart.md +8 -6
- package/llms/components/lr-popover.md +25 -1
- 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 +8 -6
- 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 +8 -6
- 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/peers.md +12 -2
- package/llms/shared.md +70 -2
- package/llms/tokens.md +15 -1
- package/llms-full.txt +1335 -306
- package/package.json +17 -5
- package/vscode-css-data.json +93 -2
- package/vscode-html-data.json +513 -59
- package/web-types.json +457 -72
|
@@ -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_popover,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,popover:LYRA_DEFAULT_popover,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);
|
|
@@ -5,13 +5,7 @@ import{css}from"lit";const styles=css`
|
|
|
5
5
|
min-inline-size: 0;
|
|
6
6
|
max-inline-size: 100%;
|
|
7
7
|
block-size: 100%;
|
|
8
|
-
/* Component-specific -- not a shared design token, so a consumer can
|
|
9
|
-
retheme it without a raw literal leaking into the public API (same
|
|
10
|
-
rationale as lr-app-rail's --lr-app-rail-overlay-color). */
|
|
11
8
|
--_lr-multi-split-overlay-color: var(--lr-color-overlay);
|
|
12
|
-
/* The divider owns a real target gutter instead of extending a pseudo
|
|
13
|
-
element over either neighboring panel. Only the centered line is
|
|
14
|
-
painted; the full track remains available for pointer/keyboard input. */
|
|
15
9
|
--_lr-multi-split-divider-target-size: max(
|
|
16
10
|
var(--lr-icon-button-size),
|
|
17
11
|
var(--lr-size-3px)
|
|
@@ -19,8 +13,6 @@ import{css}from"lit";const styles=css`
|
|
|
19
13
|
}
|
|
20
14
|
[part="base"] {
|
|
21
15
|
display: flex;
|
|
22
|
-
/* Anchor for the 'floating' collapse state's absolutely-positioned
|
|
23
|
-
overlay panel (set inline by multi-split.class.ts's updated()). */
|
|
24
16
|
position: relative;
|
|
25
17
|
inline-size: 100%;
|
|
26
18
|
min-inline-size: 0;
|
|
@@ -28,14 +20,9 @@ import{css}from"lit";const styles=css`
|
|
|
28
20
|
block-size: 100%;
|
|
29
21
|
}
|
|
30
22
|
::slotted(*) {
|
|
31
|
-
/* Honest no-JS/first-hydration fallback before child count and live sizes can be observed.
|
|
32
|
-
Browser reconciliation writes a more specific inline flex value once available. */
|
|
33
23
|
flex: 1 1 0;
|
|
34
24
|
min-inline-size: 0;
|
|
35
25
|
max-inline-size: 100%;
|
|
36
|
-
/* Direct panels own their overflow. The zero minimum lets a fixed-height
|
|
37
|
-
split shrink each flex item along the block axis instead of letting
|
|
38
|
-
long content expand the base and escape into following content. */
|
|
39
26
|
min-block-size: 0;
|
|
40
27
|
max-block-size: 100%;
|
|
41
28
|
overflow: auto;
|
|
@@ -63,7 +50,6 @@ import{css}from"lit";const styles=css`
|
|
|
63
50
|
cursor: col-resize;
|
|
64
51
|
touch-action: none;
|
|
65
52
|
}
|
|
66
|
-
/* Paint the narrow visual rule inside the allocated target track. */
|
|
67
53
|
[part="divider"]::before {
|
|
68
54
|
content: "";
|
|
69
55
|
position: absolute;
|
|
@@ -72,9 +58,6 @@ import{css}from"lit";const styles=css`
|
|
|
72
58
|
background: var(--lr-color-border);
|
|
73
59
|
pointer-events: none;
|
|
74
60
|
}
|
|
75
|
-
/* :where() zeroes the [orientation='vertical'] qualifier's specificity contribution -- otherwise
|
|
76
|
-
this (0,3,0) rule would beat a consumer's own ::part(divider) inline-size/cursor override
|
|
77
|
-
whenever orientation="vertical" is set. */
|
|
78
61
|
:host(:where([orientation="vertical"])) [part="divider"] {
|
|
79
62
|
inline-size: 100%;
|
|
80
63
|
min-inline-size: min(
|
|
@@ -96,20 +79,12 @@ import{css}from"lit";const styles=css`
|
|
|
96
79
|
inset-block: calc((100% - var(--lr-size-3px)) / 2);
|
|
97
80
|
inset-inline: 0;
|
|
98
81
|
}
|
|
99
|
-
/* orientationBreakpoint's live axis -- only present while that feature is opted into (see
|
|
100
|
-
multi-split.class.ts's updated()), so it can override the authored orientation rules above by source
|
|
101
|
-
order alone (equal specificity) whenever the effective axis diverges from it. */
|
|
102
82
|
:host([data-effective-orientation="vertical"]) [part="base"] {
|
|
103
83
|
flex-direction: column;
|
|
104
84
|
}
|
|
105
85
|
:host([data-effective-orientation="horizontal"]) [part="base"] {
|
|
106
86
|
flex-direction: row;
|
|
107
87
|
}
|
|
108
|
-
/* Same :where() treatment as [orientation='vertical'] above, applied to both effective-axis
|
|
109
|
-
variants -- these are the higher-specificity rules orientationBreakpoint's live axis relies on
|
|
110
|
-
to override the authored orientation by source order (see the comment above), so without
|
|
111
|
-
:where() they'd beat a consumer's ::part(divider) override even more readily than the
|
|
112
|
-
authored-orientation rules do. */
|
|
113
88
|
:host(:where([data-effective-orientation="vertical"])) [part="divider"] {
|
|
114
89
|
inline-size: 100%;
|
|
115
90
|
min-inline-size: min(
|
|
@@ -156,9 +131,6 @@ import{css}from"lit";const styles=css`
|
|
|
156
131
|
[part="divider"]:hover::before {
|
|
157
132
|
background: var(--lr-color-brand);
|
|
158
133
|
}
|
|
159
|
-
/* The drag itself. Pointer capture holds :active for the whole gesture, so the divider stays at
|
|
160
|
-
the deeper mix from mousedown until release -- and a divider adjacent to a collapsed pane
|
|
161
|
-
never reaches it, since [aria-disabled='true'] below takes its pointer events away. */
|
|
162
134
|
[part="divider"]:active::before {
|
|
163
135
|
background: color-mix(
|
|
164
136
|
in oklab,
|
|
@@ -170,55 +142,24 @@ import{css}from"lit";const styles=css`
|
|
|
170
142
|
outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);
|
|
171
143
|
outline-offset: var(--lr-focus-ring-offset);
|
|
172
144
|
}
|
|
173
|
-
/* The divider adjacent to a rail/floating-collapsed pane (see multi-split.class.ts's
|
|
174
|
-
isDividerDisabled()) — the collapsing panel's own live flex/order/inline-size
|
|
175
|
-
are set inline by updated() (see the floating rule below for why); this only
|
|
176
|
-
covers the divider's own drag/hover affordance and the floating panel's
|
|
177
|
-
elevation, which read more naturally as stylesheet rules than one-off inline
|
|
178
|
-
styles. */
|
|
179
145
|
[part="divider"][aria-disabled="true"] {
|
|
180
146
|
cursor: default;
|
|
181
147
|
pointer-events: none;
|
|
182
148
|
}
|
|
183
|
-
/* The 'floating' collapse state's overlay "card" look. inline-size (and
|
|
184
|
-
flex/order) stay inline, set by multi-split.class.ts's updated(): it's the
|
|
185
|
-
panel's own live, draggable sizes[i] percent -- the exact value it renders at
|
|
186
|
-
in the 'wide' state too, by design (see updated()'s comment), so there's no
|
|
187
|
-
visual size jump the moment it un-floats. position/inset-block/the
|
|
188
|
-
inset-inline-* edge below are a fixed, config-driven default -- always the
|
|
189
|
-
same literal values, never per-render computed data -- so they live here
|
|
190
|
-
instead, as ordinary stylesheet rules a consumer's own CSS can override at
|
|
191
|
-
normal specificity, no !important fight required. (Only inline-size is
|
|
192
|
-
genuinely live; a consumer wanting a different floating width should set
|
|
193
|
-
.sizes instead of overriding this rule -- overriding it here would fight
|
|
194
|
-
the live sync back on every drag/resize.) z-index is above [part="backdrop"]
|
|
195
|
-
(below), so the drawer renders on top of its own scrim. */
|
|
196
149
|
::slotted([data-collapse-state="floating"]) {
|
|
197
150
|
position: absolute;
|
|
198
151
|
inset-block: 0;
|
|
199
152
|
z-index: var(--lr-layer-content);
|
|
200
153
|
background: var(--lr-color-surface);
|
|
201
154
|
border-radius: var(--lr-radius);
|
|
202
|
-
/* Modal step: this is a drawer rendered above its own scrim (see [part='backdrop'] below), not
|
|
203
|
-
an anchored popup, so it takes the modal tier. */
|
|
204
155
|
box-shadow: var(--lr-shadow-l);
|
|
205
156
|
}
|
|
206
|
-
/* Which edge the floating drawer anchors to mirrors collapse ('start'/'end'
|
|
207
|
-
LOGICAL positions -- see the collapse property doc), already reflected onto
|
|
208
|
-
the host, so it needs no separate per-panel marker. Exactly one of these two
|
|
209
|
-
ever matches at a time (collapse is never both). */
|
|
210
157
|
:host([collapse="start"]) ::slotted([data-collapse-state="floating"]) {
|
|
211
158
|
inset-inline-start: 0;
|
|
212
159
|
}
|
|
213
160
|
:host([collapse="end"]) ::slotted([data-collapse-state="floating"]) {
|
|
214
161
|
inset-inline-end: 0;
|
|
215
162
|
}
|
|
216
|
-
/* The 'floating' drawer's scrim -- only rendered while collapseState is
|
|
217
|
-
'floating' and open (see multi-split.class.ts's render()). Scoped to [part="base"]
|
|
218
|
-
(position: absolute against its position: relative ancestor) rather than
|
|
219
|
-
a viewport-fixed overlay like lr-app-rail's mobile backdrop: the
|
|
220
|
-
floating panel itself is only ever positioned relative to this
|
|
221
|
-
component's own box, never the full page. */
|
|
222
163
|
[part="backdrop"] {
|
|
223
164
|
position: absolute;
|
|
224
165
|
inset: 0;
|
|
@@ -228,10 +169,6 @@ import{css}from"lit";const styles=css`
|
|
|
228
169
|
var(--_lr-multi-split-overlay-color)
|
|
229
170
|
);
|
|
230
171
|
}
|
|
231
|
-
/* Rail-clamped content can easily overflow the fixed rail-width — clip it
|
|
232
|
-
rather than letting it blow out the layout; the panel's own content is
|
|
233
|
-
expected to adapt to the narrower width itself (e.g. via a container
|
|
234
|
-
query), this is just a safety net. */
|
|
235
172
|
::slotted([data-collapse-state="rail"]) {
|
|
236
173
|
overflow: hidden;
|
|
237
174
|
}
|
|
@@ -118,6 +118,10 @@ export interface LyraPageEventMap {
|
|
|
118
118
|
* @since 8.0.0
|
|
119
119
|
*/
|
|
120
120
|
export declare class LyraPage extends LyraElement<LyraPageEventMap> {
|
|
121
|
+
/** `disable-sticky` is read only by `:host([disable-sticky~="..."])` rules in page.styles.ts,
|
|
122
|
+
* so it is deliberately not a reactive property. Declared here so authoring the documented
|
|
123
|
+
* attribute does not draw an "unknown attribute" dev warning. */
|
|
124
|
+
protected static readonly knownUnobservedAttributes: readonly string[];
|
|
121
125
|
static styles: import("lit").CSSResultGroup[];
|
|
122
126
|
/** Presentation derived from the Page's allocated inline size. It begins at `desktop` so server
|
|
123
127
|
* output is deterministic, then reflects the first live allocation measurement. */
|
|
@@ -14,7 +14,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
14
14
|
<line x1="4" y1="12" x2="20" y2="12"></line>
|
|
15
15
|
<line x1="4" y1="17" x2="20" y2="17"></line>
|
|
16
16
|
</svg>
|
|
17
|
-
`}class LyraPage extends LyraElement{constructor(){super(...arguments),this.view="desktop",this.navOpen=!1,this.mobileBreakpoint="768px",this.navigationPlacement="start",this.disableNavigationToggle=!1,this.accessibleLabel=null,this.mainId=nextId("page-main"),this.navigationId=nextId("page-navigation"),this.drawerId=nextId("page-drawer"),this.skipTargetId=nextId("page-skip-target"),this.skipLabelId=nextId("page-skip-label"),this.fragmentTargetId=this.getAttribute("id")||this.skipTargetId,this.fragmentTabIndex=this.getAttribute("tabindex")??"-1",this.customToggles=[],this.customToggleOwnership=new Map,this.onWindowResize=()=>this.measureAllocation(),this.resolveNavigationRestoreTarget=()=>{const owner=this.navigationTriggerOwner;if(owner?.isConnected){const accessible=resolveAccessibleTrigger(owner);if(isComposedFocusAvailable(accessible))return accessible}const builtIn=this.disableNavigationToggle?null:this.renderRoot.querySelector('[part~="navigation-toggle"]');return builtIn&&isComposedFocusAvailable(builtIn)?builtIn:this.mainElement&&isComposedFocusAvailable(this.mainElement)?this.mainElement:null},this.onDefaultToggleClick=event=>{this.rememberTriggerAndToggle(event.currentTarget)},this.onToggleSlotClick=event=>{const trigger=event.composedPath().find(candidate=>candidate?.nodeType===1&&candidate.getAttribute("slot")==="navigation-toggle");trigger&&this.customToggles.includes(trigger)&&!this.isUnavailableCustomToggle(trigger)&&this.rememberTriggerAndToggle(trigger)},this.onPageClick=event=>{const path=event.composedPath();if(path.some(candidate=>candidate?.nodeType===1&&candidate.getAttribute("slot")==="navigation-toggle"))return;const trigger=path.find(candidate=>candidate?.nodeType===1&&candidate.hasAttribute("data-toggle-nav"));trigger&&this.rememberTriggerAndToggle(trigger)},this.onBackdropClick=event=>{event.target===event.currentTarget&&this.overlayHandle?.dismissBackdrop()},this.onSkipClick=event=>{event.preventDefault(),this.mainElement?.focus(),this.mainElement?.scrollIntoView({block:"start"})}}static{this.defaultStrings={...super.defaultStrings,closeNavigation:LYRA_DEFAULT_closeNavigation,navigation:LYRA_DEFAULT_navigation,openNavigation:LYRA_DEFAULT_openNavigation,skipToContent:LYRA_DEFAULT_skipToContent}}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.measureAllocation(),this.observeAllocation(),this.hasUpdated&&this.view==="mobile"&&this.navOpen&&(this.overlayHandle?.isActive()?this.overlayHandle.resume():this.syncOverlay(),queueMicrotask(()=>this.overlayHandle?.focusInitial())),this.hasUpdated&&queueMicrotask(()=>this.isConnected&&this.syncCustomToggle())}disconnectedCallback(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeView?.removeEventListener("resize",this.onWindowResize),this.resizeView=void 0,this.overlayHandle?.suspend(),this.releaseCustomToggleA11y(),super.disconnectedCallback()}firstUpdated(changed){super.firstUpdated(changed),this.measureAllocation(),this.observeAllocation()}willUpdate(changed){super.willUpdate(changed),changed.has("fragmentTargetId")&&!this.fragmentTargetId&&(this.fragmentTargetId=this.skipTargetId),changed.has("fragmentTabIndex")&&this.fragmentTabIndex===null&&(this.fragmentTabIndex="-1")}updated(changed){super.updated(changed),changed.has("mobileBreakpoint")&&changed.get("mobileBreakpoint")!==void 0&&this.measureAllocation(),this.overlayHandle!==void 0&&(!this.isConnected||this.view!=="mobile"||!this.navOpen)?(this.syncOverlay(changed),this.syncCustomToggle()):(this.syncCustomToggle(),this.syncOverlay(changed))}observeAllocation(){if(!this.isConnected)return;this.resizeView?.removeEventListener("resize",this.onWindowResize),this.resizeView=void 0;const view=this.ownerDocument.defaultView,ResizeObserverConstructor=view?.ResizeObserver;if(ResizeObserverConstructor){this.resizeObserver??=new ResizeObserverConstructor(entries=>{const entry=entries.find(candidate=>candidate.target===this)??entries[0],inlineSize=entry?.contentBoxSize?.[0]?.inlineSize??entry?.contentRect.width;inlineSize!==void 0&&this.applyMeasuredInlineSize(inlineSize)}),this.resizeObserver.observe(this);return}view&&(this.resizeView=view,view.addEventListener("resize",this.onWindowResize))}measureAllocation(){const width=this.getBoundingClientRect().width;width>0&&this.applyMeasuredInlineSize(width)}applyMeasuredInlineSize(width){if(!Number.isFinite(width)||width<0)return;const resolved=resolveCssLength(this.mobileBreakpoint,{host:this}),fallback=resolveCssLength(DEFAULT_MOBILE_BREAKPOINT,{host:this})??768,breakpoint=Math.max(0,resolved!==void 0&&Number.isFinite(resolved)?resolved:fallback),next=width<=breakpoint?"mobile":"desktop";next!==this.view&&(this.view=next)}syncOverlay(changed){if(this.isConnected&&this.view==="mobile"&&this.navOpen){if(this.overlayHandle?.isActive()){this.overlayHandle.resume(),this.navigationTriggerOwner&&this.overlayHandle.updateRestoreFocusTo(this.resolveNavigationRestoreTarget);return}this.overlayHandle=activateOverlay({host:this,panel:()=>this.drawerElement??null,modalRoot:()=>this.drawerElement??null,onEscape:()=>this.hideNavigation(),onBackdrop:()=>this.hideNavigation(),...this.navigationTriggerOwner?{restoreFocusTo:this.resolveNavigationRestoreTarget}:{},lockScroll:!0,suspendWhenUnrendered:!0}),this.overlayHandle.focusInitial();return}if(this.overlayHandle){const restoreFocus=!!(changed?.has("navOpen")&&!this.navOpen);this.overlayHandle.deactivate({restoreFocus}),this.overlayHandle=void 0}this.navOpen||(this.navigationTriggerOwner=void 0)}syncCustomToggle(){const nextToggles=(this.shadowRoot?.querySelector('slot[name="navigation-toggle"]')?.assignedElements({flatten:!0})??[]).filter(candidate=>candidate.nodeType===1&&candidate.getRootNode()!==this.shadowRoot),previous=this.customToggle;this.customToggles=nextToggles,this.customToggle=nextToggles[0];for(const[host,ownership]of this.customToggleOwnership)nextToggles.includes(host)||(ownership.accessibleAria?.release(),ownership.hostAria.release(),this.customToggleOwnership.delete(host));const localizedLabel=this.localize(this.navOpen?"closeNavigation":"openNavigation"),drawer=this.drawerElement;for(const host of nextToggles){const accessible=resolveAccessibleTrigger(host);let ownership=this.customToggleOwnership.get(host);ownership?accessible!==ownership.accessible&&(ownership.accessibleAria?.release(),ownership.accessibleAria=void 0,ownership.accessible=accessible,ownership.accessibleAuthoredLabel=accessible.hasAttribute("aria-label")?accessible.getAttribute("aria-label")??"":null):(ownership={accessible,accessibleAuthoredLabel:accessible.hasAttribute("aria-label")?accessible.getAttribute("aria-label")??"":null,hostAria:acquireAriaOwnership(null,{}),hostAuthoredLabel:host.hasAttribute("aria-label")?host.getAttribute("aria-label")??"":null},this.customToggleOwnership.set(host,ownership)),ownership.hostAria.update(host,{attributes:{"aria-haspopup":"dialog","aria-expanded":this.navOpen?"true":"false","aria-label":ownership.hostAuthoredLabel??localizedLabel},controls:drawer?[drawer]:[]});const distinctAccessible=accessible===host?null:accessible,accessibleContribution={attributes:{"aria-haspopup":"dialog","aria-expanded":this.navOpen?"true":"false","aria-label":ownership.accessibleAuthoredLabel??ownership.hostAuthoredLabel??localizedLabel},controls:drawer?[drawer]:[]};ownership.accessibleAria?ownership.accessibleAria.update(distinctAccessible,accessibleContribution):ownership.accessibleAria=acquireAriaOwnership(distinctAccessible,accessibleContribution)}this.navOpen&&this.navigationTriggerOwner&&!nextToggles.includes(this.navigationTriggerOwner)?(this.navigationTriggerOwner=this.customToggle,this.overlayHandle?.updateRestoreFocusTo(this.resolveNavigationRestoreTarget)):this.navOpen&&previous&&this.navigationTriggerOwner===previous&&this.overlayHandle?.updateRestoreFocusTo(this.resolveNavigationRestoreTarget)}releaseCustomToggleA11y(){for(const ownership of this.customToggleOwnership.values())ownership.accessibleAria?.release(),ownership.hostAria.release();this.customToggleOwnership.clear(),this.customToggle=void 0,this.customToggles=[]}isUnavailableCustomToggle(trigger){const accessible=resolveAccessibleTrigger(trigger);return[trigger,accessible].some(candidate=>candidate.hasAttribute("hidden")||candidate.hasAttribute("inert")||candidate.matches(":disabled")||isAriaTrue(candidate.getAttribute("aria-hidden"))||isAriaTrue(candidate.getAttribute("aria-disabled")))}rememberTriggerAndToggle(trigger){this.syncCustomToggle(),this.navOpen||(this.navigationTriggerOwner=trigger),this.toggleNavigation()}requestNavOpen(next){this.navOpen!==next&&(this.emit("lr-nav-toggle",{open:next},{cancelable:!0}).defaultPrevented||(this.navOpen=next))}showNavigation(){this.requestNavOpen(!0)}hideNavigation(){this.requestNavOpen(!1)}toggleNavigation(){this.requestNavOpen(!this.navOpen)}visiblePixelsInViewport(element){if(!element)return 0;const rect=element.getBoundingClientRect();if(!Number.isFinite(rect.top)||!Number.isFinite(rect.bottom))return 0;const candidateHeight=element.ownerDocument.defaultView?.innerHeight??element.ownerDocument.documentElement.clientHeight;if(!Number.isFinite(candidateHeight)||candidateHeight<=0)return 0;const viewportHeight=finiteRange(candidateHeight,0,0),visible=Math.min(rect.bottom,viewportHeight)-Math.max(rect.top,0);return finiteRange(visible,0,0,viewportHeight)}render(){const mobile=this.view==="mobile",overlayOpen=mobile&&this.navOpen,navigationLabel=this.accessibleLabel??this.localize("navigation");return html`
|
|
17
|
+
`}class LyraPage extends LyraElement{constructor(){super(...arguments),this.view="desktop",this.navOpen=!1,this.mobileBreakpoint="768px",this.navigationPlacement="start",this.disableNavigationToggle=!1,this.accessibleLabel=null,this.mainId=nextId("page-main"),this.navigationId=nextId("page-navigation"),this.drawerId=nextId("page-drawer"),this.skipTargetId=nextId("page-skip-target"),this.skipLabelId=nextId("page-skip-label"),this.fragmentTargetId=this.getAttribute("id")||this.skipTargetId,this.fragmentTabIndex=this.getAttribute("tabindex")??"-1",this.customToggles=[],this.customToggleOwnership=new Map,this.onWindowResize=()=>this.measureAllocation(),this.resolveNavigationRestoreTarget=()=>{const owner=this.navigationTriggerOwner;if(owner?.isConnected){const accessible=resolveAccessibleTrigger(owner);if(isComposedFocusAvailable(accessible))return accessible}const builtIn=this.disableNavigationToggle?null:this.renderRoot.querySelector('[part~="navigation-toggle"]');return builtIn&&isComposedFocusAvailable(builtIn)?builtIn:this.mainElement&&isComposedFocusAvailable(this.mainElement)?this.mainElement:null},this.onDefaultToggleClick=event=>{this.rememberTriggerAndToggle(event.currentTarget)},this.onToggleSlotClick=event=>{const trigger=event.composedPath().find(candidate=>candidate?.nodeType===1&&candidate.getAttribute("slot")==="navigation-toggle");trigger&&this.customToggles.includes(trigger)&&!this.isUnavailableCustomToggle(trigger)&&this.rememberTriggerAndToggle(trigger)},this.onPageClick=event=>{const path=event.composedPath();if(path.some(candidate=>candidate?.nodeType===1&&candidate.getAttribute("slot")==="navigation-toggle"))return;const trigger=path.find(candidate=>candidate?.nodeType===1&&candidate.hasAttribute("data-toggle-nav"));trigger&&this.rememberTriggerAndToggle(trigger)},this.onBackdropClick=event=>{event.target===event.currentTarget&&this.overlayHandle?.dismissBackdrop()},this.onSkipClick=event=>{event.preventDefault(),this.mainElement?.focus(),this.mainElement?.scrollIntoView({block:"start"})}}static{this.defaultStrings={...super.defaultStrings,closeNavigation:LYRA_DEFAULT_closeNavigation,navigation:LYRA_DEFAULT_navigation,openNavigation:LYRA_DEFAULT_openNavigation,skipToContent:LYRA_DEFAULT_skipToContent}}static{this.knownUnobservedAttributes=["disable-sticky"]}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.measureAllocation(),this.observeAllocation(),this.hasUpdated&&this.view==="mobile"&&this.navOpen&&(this.overlayHandle?.isActive()?this.overlayHandle.resume():this.syncOverlay(),queueMicrotask(()=>this.overlayHandle?.focusInitial())),this.hasUpdated&&queueMicrotask(()=>this.isConnected&&this.syncCustomToggle())}disconnectedCallback(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeView?.removeEventListener("resize",this.onWindowResize),this.resizeView=void 0,this.overlayHandle?.suspend(),this.releaseCustomToggleA11y(),super.disconnectedCallback()}firstUpdated(changed){super.firstUpdated(changed),this.measureAllocation(),this.observeAllocation()}willUpdate(changed){super.willUpdate(changed),changed.has("fragmentTargetId")&&!this.fragmentTargetId&&(this.fragmentTargetId=this.skipTargetId),changed.has("fragmentTabIndex")&&this.fragmentTabIndex===null&&(this.fragmentTabIndex="-1")}updated(changed){super.updated(changed),changed.has("mobileBreakpoint")&&changed.get("mobileBreakpoint")!==void 0&&this.measureAllocation(),this.overlayHandle!==void 0&&(!this.isConnected||this.view!=="mobile"||!this.navOpen)?(this.syncOverlay(changed),this.syncCustomToggle()):(this.syncCustomToggle(),this.syncOverlay(changed))}observeAllocation(){if(!this.isConnected)return;this.resizeView?.removeEventListener("resize",this.onWindowResize),this.resizeView=void 0;const view=this.ownerDocument.defaultView,ResizeObserverConstructor=view?.ResizeObserver;if(ResizeObserverConstructor){this.resizeObserver??=new ResizeObserverConstructor(entries=>{const entry=entries.find(candidate=>candidate.target===this)??entries[0],inlineSize=entry?.contentBoxSize?.[0]?.inlineSize??entry?.contentRect.width;inlineSize!==void 0&&this.applyMeasuredInlineSize(inlineSize)}),this.resizeObserver.observe(this);return}view&&(this.resizeView=view,view.addEventListener("resize",this.onWindowResize))}measureAllocation(){const width=this.getBoundingClientRect().width;width>0&&this.applyMeasuredInlineSize(width)}applyMeasuredInlineSize(width){if(!Number.isFinite(width)||width<0)return;const resolved=resolveCssLength(this.mobileBreakpoint,{host:this}),fallback=resolveCssLength(DEFAULT_MOBILE_BREAKPOINT,{host:this})??768,breakpoint=Math.max(0,resolved!==void 0&&Number.isFinite(resolved)?resolved:fallback),next=width<=breakpoint?"mobile":"desktop";next!==this.view&&(this.view=next)}syncOverlay(changed){if(this.isConnected&&this.view==="mobile"&&this.navOpen){if(this.overlayHandle?.isActive()){this.overlayHandle.resume(),this.navigationTriggerOwner&&this.overlayHandle.updateRestoreFocusTo(this.resolveNavigationRestoreTarget);return}this.overlayHandle=activateOverlay({host:this,panel:()=>this.drawerElement??null,modalRoot:()=>this.drawerElement??null,onEscape:()=>this.hideNavigation(),onBackdrop:()=>this.hideNavigation(),...this.navigationTriggerOwner?{restoreFocusTo:this.resolveNavigationRestoreTarget}:{},lockScroll:!0,suspendWhenUnrendered:!0}),this.overlayHandle.focusInitial();return}if(this.overlayHandle){const restoreFocus=!!(changed?.has("navOpen")&&!this.navOpen);this.overlayHandle.deactivate({restoreFocus}),this.overlayHandle=void 0}this.navOpen||(this.navigationTriggerOwner=void 0)}syncCustomToggle(){const nextToggles=(this.shadowRoot?.querySelector('slot[name="navigation-toggle"]')?.assignedElements({flatten:!0})??[]).filter(candidate=>candidate.nodeType===1&&candidate.getRootNode()!==this.shadowRoot),previous=this.customToggle;this.customToggles=nextToggles,this.customToggle=nextToggles[0];for(const[host,ownership]of this.customToggleOwnership)nextToggles.includes(host)||(ownership.accessibleAria?.release(),ownership.hostAria.release(),this.customToggleOwnership.delete(host));const localizedLabel=this.localize(this.navOpen?"closeNavigation":"openNavigation"),drawer=this.drawerElement;for(const host of nextToggles){const accessible=resolveAccessibleTrigger(host);let ownership=this.customToggleOwnership.get(host);ownership?accessible!==ownership.accessible&&(ownership.accessibleAria?.release(),ownership.accessibleAria=void 0,ownership.accessible=accessible,ownership.accessibleAuthoredLabel=accessible.hasAttribute("aria-label")?accessible.getAttribute("aria-label")??"":null):(ownership={accessible,accessibleAuthoredLabel:accessible.hasAttribute("aria-label")?accessible.getAttribute("aria-label")??"":null,hostAria:acquireAriaOwnership(null,{}),hostAuthoredLabel:host.hasAttribute("aria-label")?host.getAttribute("aria-label")??"":null},this.customToggleOwnership.set(host,ownership)),ownership.hostAria.update(host,{attributes:{"aria-haspopup":"dialog","aria-expanded":this.navOpen?"true":"false","aria-label":ownership.hostAuthoredLabel??localizedLabel},controls:drawer?[drawer]:[]});const distinctAccessible=accessible===host?null:accessible,accessibleContribution={attributes:{"aria-haspopup":"dialog","aria-expanded":this.navOpen?"true":"false","aria-label":ownership.accessibleAuthoredLabel??ownership.hostAuthoredLabel??localizedLabel},controls:drawer?[drawer]:[]};ownership.accessibleAria?ownership.accessibleAria.update(distinctAccessible,accessibleContribution):ownership.accessibleAria=acquireAriaOwnership(distinctAccessible,accessibleContribution)}this.navOpen&&this.navigationTriggerOwner&&!nextToggles.includes(this.navigationTriggerOwner)?(this.navigationTriggerOwner=this.customToggle,this.overlayHandle?.updateRestoreFocusTo(this.resolveNavigationRestoreTarget)):this.navOpen&&previous&&this.navigationTriggerOwner===previous&&this.overlayHandle?.updateRestoreFocusTo(this.resolveNavigationRestoreTarget)}releaseCustomToggleA11y(){for(const ownership of this.customToggleOwnership.values())ownership.accessibleAria?.release(),ownership.hostAria.release();this.customToggleOwnership.clear(),this.customToggle=void 0,this.customToggles=[]}isUnavailableCustomToggle(trigger){const accessible=resolveAccessibleTrigger(trigger);return[trigger,accessible].some(candidate=>candidate.hasAttribute("hidden")||candidate.hasAttribute("inert")||candidate.matches(":disabled")||isAriaTrue(candidate.getAttribute("aria-hidden"))||isAriaTrue(candidate.getAttribute("aria-disabled")))}rememberTriggerAndToggle(trigger){this.syncCustomToggle(),this.navOpen||(this.navigationTriggerOwner=trigger),this.toggleNavigation()}requestNavOpen(next){this.navOpen!==next&&(this.emit("lr-nav-toggle",{open:next},{cancelable:!0}).defaultPrevented||(this.navOpen=next))}showNavigation(){this.requestNavOpen(!0)}hideNavigation(){this.requestNavOpen(!1)}toggleNavigation(){this.requestNavOpen(!this.navOpen)}visiblePixelsInViewport(element){if(!element)return 0;const rect=element.getBoundingClientRect();if(!Number.isFinite(rect.top)||!Number.isFinite(rect.bottom))return 0;const candidateHeight=element.ownerDocument.defaultView?.innerHeight??element.ownerDocument.documentElement.clientHeight;if(!Number.isFinite(candidateHeight)||candidateHeight<=0)return 0;const viewportHeight=finiteRange(candidateHeight,0,0),visible=Math.min(rect.bottom,viewportHeight)-Math.max(rect.top,0);return finiteRange(visible,0,0,viewportHeight)}render(){const mobile=this.view==="mobile",overlayOpen=mobile&&this.navOpen,navigationLabel=this.accessibleLabel??this.localize("navigation");return html`
|
|
18
18
|
<div part="base page" @click=${this.onPageClick}>
|
|
19
19
|
<a
|
|
20
20
|
part="skip-to-content"
|
|
@@ -26,8 +26,6 @@ import{css}from"lit";const styles=css`
|
|
|
26
26
|
cursor: pointer;
|
|
27
27
|
border-radius: var(--lr-radius);
|
|
28
28
|
}
|
|
29
|
-
/* chevronIcon() renders a right-pointing chevron with no baked-in rotation (see icons.ts) --
|
|
30
|
-
rotate the whole button, matching lr-tree-item's identical [part='toggle'] rotation approach. */
|
|
31
29
|
[part='move-up-button'] {
|
|
32
30
|
transform: rotate(-90deg);
|
|
33
31
|
}
|
|
@@ -45,8 +43,6 @@ import{css}from"lit";const styles=css`
|
|
|
45
43
|
var(--lr-color-brand)
|
|
46
44
|
);
|
|
47
45
|
}
|
|
48
|
-
/* Declared before the :disabled rule below, which restates background/color at equal
|
|
49
|
-
specificity, so a disabled arrow stays flat whatever the pointer does to it. */
|
|
50
46
|
[part='move-up-button']:active,
|
|
51
47
|
[part='move-down-button']:active {
|
|
52
48
|
background: var(
|