@aceshooting/lyra-ui 16.0.0 → 18.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 +758 -0
- package/README.md +2 -2
- package/custom-elements.json +1 -1
- package/dist/cli/migration-contract.json +1 -1
- package/dist/components/agent-tools/browser-frame/browser-frame.class.d.ts +3 -3
- package/dist/components/agent-tools/browser-frame/browser-frame.class.js +2 -2
- package/dist/components/agent-tools/compare-panel/compare-panel.class.d.ts +2 -2
- package/dist/components/agent-tools/compare-panel/compare-panel.class.js +3 -3
- package/dist/components/agent-tools/confirm-bar/confirm-bar.class.d.ts +37 -13
- package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
- package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +4 -0
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +2 -2
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.d.ts +3 -3
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +1 -1
- package/dist/components/charts/chart/chart.class.d.ts +117 -17
- package/dist/components/charts/chart/chart.class.js +3 -3
- package/dist/components/charts/chart/histogram-bin.d.ts +5 -1
- package/dist/components/charts/chart/histogram-bin.js +1 -1
- package/dist/components/charts/chart/lite-chart.class.d.ts +9 -0
- package/dist/components/conversation/code-block/code-block.styles.js +1 -1
- package/dist/components/conversation/message-actions/message-actions.styles.js +1 -1
- package/dist/components/conversation/model-select/model-select.class.d.ts +13 -4
- package/dist/components/conversation/model-select/model-select.class.js +2 -1
- package/dist/components/conversation/model-select/model-select.styles.js +1 -1
- package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +40 -2
- package/dist/components/conversation/streaming-text/streaming-text-base.class.js +2 -2
- package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +27 -3
- package/dist/components/conversation/streaming-text/streaming-text-core.class.js +11 -0
- package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +31 -3
- package/dist/components/conversation/streaming-text/streaming-text.class.js +11 -0
- package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +30 -2
- package/dist/components/conversation/suggestion-chips/suggestion-chips.class.js +4 -3
- package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
- package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
- package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
- package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.js +1 -1
- package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +4 -0
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +16 -4
- package/dist/components/conversation/voice-picker/voice-picker.class.js +2 -1
- package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
- package/dist/components/data/context-meter/context-meter.class.d.ts +23 -4
- package/dist/components/data/context-meter/context-meter.class.js +10 -7
- package/dist/components/data/context-meter/context-meter.styles.js +1 -1
- package/dist/components/data/data-grid/data-grid.class.d.ts +5 -2
- package/dist/components/data/data-grid/data-grid.class.js +1 -1
- package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +32 -5
- package/dist/components/data/flow-canvas/flow-canvas.class.js +3 -1
- package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
- package/dist/components/data/flow-canvas/flow-model.js +1 -1
- package/dist/components/data/flow-canvas/flow-types.d.ts +10 -1
- package/dist/components/data/gauge/gauge.class.d.ts +15 -2
- package/dist/components/data/gauge/gauge.class.js +20 -20
- package/dist/components/data/gauge/gauge.styles.js +1 -1
- package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +14 -5
- package/dist/components/data/graph-query-builder/graph-query-builder.class.js +2 -2
- package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +28 -2
- package/dist/components/data/sequence-strip/sequence-strip.class.js +3 -2
- package/dist/components/data/sequence-strip/sequence-strip.styles.js +1 -1
- package/dist/components/data/table/table.class.d.ts +155 -30
- package/dist/components/data/table/table.class.js +6 -4
- package/dist/components/data/table/table.styles.js +1 -1
- package/dist/components/data/timeline/timeline-item.class.d.ts +9 -1
- package/dist/components/data/timeline/timeline-item.class.js +2 -2
- package/dist/components/data/word-cloud/word-cloud.class.js +1 -1
- package/dist/components/data/word-cloud/word-cloud.styles.js +1 -1
- package/dist/components/forms/button/button.class.d.ts +30 -1
- package/dist/components/forms/button/button.class.js +2 -2
- package/dist/components/forms/checkbox/checkbox.class.d.ts +8 -6
- package/dist/components/forms/checkbox/checkbox.class.js +2 -2
- package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +7 -5
- package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
- package/dist/components/forms/color-picker/color-picker.class.d.ts +16 -2
- package/dist/components/forms/color-picker/color-picker.class.js +2 -2
- package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
- package/dist/components/forms/combobox/combobox.class.d.ts +52 -7
- package/dist/components/forms/combobox/combobox.class.js +2 -2
- package/dist/components/forms/combobox/combobox.styles.js +1 -1
- package/dist/components/forms/date-picker/date-input.class.d.ts +4 -0
- package/dist/components/forms/date-picker/date-input.class.js +1 -1
- package/dist/components/forms/icon-button/icon-button.class.d.ts +20 -3
- package/dist/components/forms/icon-button/icon-button.class.js +1 -1
- package/dist/components/forms/icon-button/icon-button.styles.js +1 -1
- package/dist/components/forms/input/input.class.d.ts +5 -2
- package/dist/components/forms/input/input.class.js +1 -1
- package/dist/components/forms/input/time-input.class.d.ts +4 -0
- package/dist/components/forms/input/time-input.class.js +1 -1
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +11 -5
- package/dist/components/forms/locale-picker/locale-picker.class.js +1 -1
- package/dist/components/forms/otp-input/otp-input.class.d.ts +7 -2
- package/dist/components/forms/otp-input/otp-input.class.js +2 -2
- package/dist/components/forms/radio/radio-button.class.d.ts +2 -1
- package/dist/components/forms/radio/radio-group.class.d.ts +9 -4
- package/dist/components/forms/radio/radio-group.class.js +1 -1
- package/dist/components/forms/radio/radio.class.d.ts +13 -7
- package/dist/components/forms/radio/radio.class.js +1 -1
- package/dist/components/forms/rubric-form/rubric-form.class.d.ts +16 -6
- package/dist/components/forms/rubric-form/rubric-form.class.js +2 -2
- package/dist/components/forms/select/select.class.d.ts +50 -13
- package/dist/components/forms/select/select.class.js +2 -2
- package/dist/components/forms/slider/slider.class.d.ts +4 -2
- package/dist/components/forms/slider/slider.class.js +1 -1
- package/dist/components/forms/switch/switch.class.d.ts +8 -6
- package/dist/components/forms/switch/switch.class.js +1 -1
- package/dist/components/forms/textarea/textarea.class.d.ts +5 -3
- package/dist/components/forms/textarea/textarea.class.js +1 -1
- package/dist/components/forms/time-range/time-range.class.d.ts +12 -7
- package/dist/components/forms/time-range/time-range.class.js +1 -1
- package/dist/components/forms/time-range/time-range.styles.js +1 -1
- package/dist/components/forms/token-input/token-input.class.d.ts +6 -4
- package/dist/components/forms/token-input/token-input.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail-item.class.d.ts +109 -4
- package/dist/components/layout/app-rail/app-rail-item.class.js +34 -29
- package/dist/components/layout/app-rail/app-rail-item.styles.js +1 -1
- package/dist/components/layout/app-rail/app-rail.class.d.ts +25 -3
- package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
- package/dist/components/layout/app-rail-group/app-rail-group.class.d.ts +2 -2
- package/dist/components/layout/app-rail-group/app-rail-group.class.js +2 -2
- package/dist/components/layout/carousel/carousel.class.d.ts +1 -1
- package/dist/components/layout/carousel/carousel.class.js +1 -1
- package/dist/components/layout/details/accordion.class.d.ts +2 -2
- package/dist/components/layout/details/accordion.class.js +2 -2
- package/dist/components/layout/filter-bar/filter-bar-register.d.ts +1 -0
- package/dist/components/layout/filter-bar/filter-bar-register.js +1 -0
- package/dist/components/layout/filter-bar/filter-bar.class.d.ts +153 -16
- package/dist/components/layout/filter-bar/filter-bar.class.js +8 -5
- package/dist/components/layout/menu/menu-item.class.d.ts +3 -3
- package/dist/components/layout/menu/menu-item.class.js +3 -3
- package/dist/components/layout/menu/menu.class.d.ts +5 -1
- package/dist/components/layout/menu/menu.class.js +2 -2
- package/dist/components/layout/reorder-list/reorder-item.styles.js +1 -1
- package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.class.d.ts +107 -2
- package/dist/components/layout/virtual-list/virtual-list.class.js +12 -7
- package/dist/components/media/attachment-trigger/attachment-trigger.styles.js +1 -1
- package/dist/components/media/avatar-group/avatar-group.class.d.ts +12 -1
- package/dist/components/media/avatar-group/avatar-group.class.js +2 -2
- package/dist/components/media/drop-zone/drop-zone.class.d.ts +32 -11
- package/dist/components/media/drop-zone/drop-zone.class.js +2 -2
- package/dist/components/media/file-input/file-input.class.d.ts +40 -19
- package/dist/components/media/file-input/file-input.class.js +2 -2
- package/dist/components/media/map/map.class.d.ts +138 -12
- package/dist/components/media/map/map.class.js +25 -20
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/overlays/callout/callout.styles.js +1 -1
- package/dist/components/overlays/dialog/dialog.styles.js +1 -1
- package/dist/components/overlays/overlay/dropdown.class.d.ts +13 -3
- package/dist/components/overlays/overlay/dropdown.class.js +2 -2
- package/dist/components/overlays/overlay/popover.class.d.ts +12 -3
- package/dist/components/overlays/overlay/popover.class.js +2 -2
- package/dist/components/overlays/rating/rating.class.d.ts +9 -7
- package/dist/components/overlays/rating/rating.class.js +1 -1
- package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +5 -1
- package/dist/components/retrieval/citation-badge/citation-badge.class.js +1 -1
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
- package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +5 -1
- package/dist/components/retrieval/entity-chip/entity-chip.class.js +1 -1
- package/dist/components/retrieval/graph-legend/graph-legend.styles.js +1 -1
- package/dist/components/retrieval/retrieval-value-format.js +1 -1
- package/dist/components/retrieval/source-list/source-list.styles.js +1 -1
- package/dist/components/utility/copy-button/copy-button.class.d.ts +23 -11
- package/dist/components/utility/copy-button/copy-button.class.js +2 -2
- package/dist/components/utility/copy-button/copy-button.styles.js +1 -1
- package/dist/components/utility/diff-view/diff-view.styles.js +1 -1
- package/dist/components/utility/export-button/export-button.class.d.ts +4 -0
- package/dist/components/utility/export-button/export-button.class.js +1 -1
- package/dist/components/utility/json-viewer/json-viewer.styles.js +1 -1
- package/dist/components/utility/known-date/known-date.class.js +1 -1
- package/dist/components/utility/mention-popover/mention-popover.class.d.ts +38 -3
- package/dist/components/utility/mention-popover/mention-popover.class.js +2 -1
- package/dist/components/utility/mention-popover/mention-popover.styles.js +1 -1
- package/dist/components/utility/poll-status/poll-status.styles.js +1 -1
- package/dist/components/utility/tour/tour.class.d.ts +4 -0
- package/dist/components/utility/tour/tour.class.js +1 -1
- package/dist/components/utility/tour/tour.styles.js +1 -1
- package/dist/components/viewers/document-preview/document-preview.class.js +2 -2
- package/dist/components/viewers/docx-viewer/docx-viewer.class.js +2 -2
- package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +2 -2
- package/dist/components/viewers/highlight-layer/highlight-layer.class.js +2 -2
- package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
- package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +2 -2
- package/dist/components/viewers/xml-viewer/xml-viewer.class.js +2 -2
- package/dist/custom-elements-jsx.d.ts +2 -2
- package/dist/events.d.ts +20 -13
- package/dist/internal/aggregate-file-limits.d.ts +33 -0
- package/dist/internal/aggregate-file-limits.js +1 -0
- package/dist/internal/catalog-picker.d.ts +15 -2
- package/dist/internal/catalog-picker.js +1 -1
- package/dist/internal/debounce-controller.d.ts +14 -0
- package/dist/internal/debounce-controller.js +1 -1
- package/dist/internal/default-strings.generated.d.ts +1 -1
- package/dist/internal/default-strings.generated.js +2 -2
- package/dist/internal/focus-navigation.d.ts +45 -0
- package/dist/internal/focus-navigation.js +1 -1
- package/dist/internal/form-associated.js +1 -1
- package/dist/internal/initial-slot-collection.d.ts +30 -0
- package/dist/internal/initial-slot-collection.js +1 -0
- package/dist/internal/intl-cache.js +1 -1
- package/dist/internal/invalid-event-alias.d.ts +46 -0
- package/dist/internal/invalid-event-alias.js +1 -1
- package/dist/internal/localization-runtime.d.ts +24 -0
- package/dist/internal/localization-runtime.js +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/package-metadata.d.ts +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/positioning-strategy.d.ts +3 -1
- package/dist/internal/state-part.d.ts +49 -0
- package/dist/internal/state-part.js +1 -0
- package/dist/internal/variants.styles.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/dist/lyra.js +1 -1
- package/dist/svelte.d.ts +2 -2
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/lyra-tag-event-map.d.ts +2 -2
- package/dist/testing/lyra-tag-event-map.js +1 -1
- package/dist/testing/wait-for-mount.d.ts +46 -0
- package/dist/testing/wait-for-mount.js +1 -0
- package/dist/theme/theme-bootstrap.js +1 -1
- package/dist/theme/theme.d.ts +11 -2
- package/dist/theme/theme.js +1 -1
- package/dist/translations/ar/layout.js +1 -1
- package/dist/translations/ar/retrieval.js +1 -1
- package/dist/translations/ar/shared.js +1 -1
- package/dist/translations/de/layout.js +1 -1
- package/dist/translations/de/retrieval.js +1 -1
- package/dist/translations/de/shared.js +1 -1
- package/dist/translations/es/layout.js +1 -1
- package/dist/translations/es/retrieval.js +1 -1
- package/dist/translations/es/shared.js +1 -1
- package/dist/translations/fa/layout.js +1 -1
- package/dist/translations/fa/retrieval.js +1 -1
- package/dist/translations/fa/shared.js +1 -1
- package/dist/translations/fr/layout.js +1 -1
- package/dist/translations/fr/retrieval.js +1 -1
- package/dist/translations/fr/shared.js +1 -1
- package/dist/translations/he/layout.js +1 -1
- package/dist/translations/he/retrieval.js +1 -1
- package/dist/translations/he/shared.js +1 -1
- package/dist/translations/it/layout.js +1 -1
- package/dist/translations/it/retrieval.js +1 -1
- package/dist/translations/it/shared.js +1 -1
- package/dist/translations/ja/layout.js +1 -1
- package/dist/translations/ja/retrieval.js +1 -1
- package/dist/translations/ja/shared.js +1 -1
- package/dist/translations/pt-BR/layout.js +1 -1
- package/dist/translations/pt-BR/retrieval.js +1 -1
- package/dist/translations/pt-BR/shared.js +1 -1
- package/dist/translations/ro/agent-tools.d.ts +1 -0
- package/dist/translations/ro/agent-tools.js +1 -0
- package/dist/translations/ro/charts.d.ts +1 -0
- package/dist/translations/ro/charts.js +1 -0
- package/dist/translations/ro/conversation.d.ts +1 -0
- package/dist/translations/ro/conversation.js +1 -0
- package/dist/translations/ro/data.d.ts +1 -0
- package/dist/translations/ro/data.js +1 -0
- package/dist/translations/ro/forms.d.ts +1 -0
- package/dist/translations/ro/forms.js +1 -0
- package/dist/translations/ro/layout.d.ts +1 -0
- package/dist/translations/ro/layout.js +1 -0
- package/dist/translations/ro/media.d.ts +1 -0
- package/dist/translations/ro/media.js +1 -0
- package/dist/translations/ro/overlays.d.ts +1 -0
- package/dist/translations/ro/overlays.js +1 -0
- package/dist/translations/ro/retrieval.d.ts +1 -0
- package/dist/translations/ro/retrieval.js +1 -0
- package/dist/translations/ro/shared.d.ts +1 -0
- package/dist/translations/ro/shared.js +1 -0
- package/dist/translations/ro/utility.d.ts +1 -0
- package/dist/translations/ro/utility.js +1 -0
- package/dist/translations/ro/viewers.d.ts +1 -0
- package/dist/translations/ro/viewers.js +5 -0
- package/dist/translations/ro.d.ts +1 -0
- package/dist/translations/ro.js +1 -0
- package/dist/translations/ru/layout.js +1 -1
- package/dist/translations/ru/retrieval.js +1 -1
- package/dist/translations/ru/shared.js +1 -1
- package/dist/translations/zh-CN/layout.js +1 -1
- package/dist/translations/zh-CN/retrieval.js +1 -1
- package/dist/translations/zh-CN/shared.js +1 -1
- package/dist/utilities/format.d.ts +17 -0
- package/dist/utilities/format.js +1 -1
- package/dist/vue.d.ts +2 -2
- package/llms/components/lr-app-rail-group.md +87 -10
- package/llms/components/lr-app-rail-item.md +88 -11
- package/llms/components/lr-app-rail.md +88 -11
- package/llms/components/lr-attachment-trigger.md +21 -0
- package/llms/components/lr-bar-chart.md +3 -2
- package/llms/components/lr-bubble-chart.md +3 -2
- package/llms/components/lr-button.md +5 -4
- package/llms/components/lr-callout.md +10 -0
- package/llms/components/lr-card.md +2 -1
- package/llms/components/lr-chart.md +43 -12
- package/llms/components/lr-citation-badge.md +7 -1
- package/llms/components/lr-code-block.md +21 -0
- package/llms/components/lr-color-picker.md +12 -7
- package/llms/components/lr-combobox.md +20 -1
- package/llms/components/lr-confirm-bar.md +36 -7
- package/llms/components/lr-context-meter.md +17 -4
- package/llms/components/lr-date-input.md +7 -1
- package/llms/components/lr-date-picker.md +6 -0
- package/llms/components/lr-dialog.md +21 -0
- package/llms/components/lr-doughnut-chart.md +3 -2
- package/llms/components/lr-drawer.md +10 -0
- package/llms/components/lr-drop-zone.md +16 -7
- package/llms/components/lr-dropdown-item.md +7 -0
- package/llms/components/lr-entity-chip.md +7 -1
- package/llms/components/lr-export-button.md +7 -1
- package/llms/components/lr-file-input.md +21 -10
- package/llms/components/lr-filter-bar.md +177 -18
- package/llms/components/lr-flow-canvas.md +16 -9
- package/llms/components/lr-gauge.md +22 -2
- package/llms/components/lr-histogram.md +7 -2
- package/llms/components/lr-icon-button.md +17 -8
- package/llms/components/lr-input.md +3 -1
- package/llms/components/lr-line-chart.md +3 -2
- package/llms/components/lr-lite-chart.md +13 -0
- package/llms/components/lr-locale-picker.md +7 -1
- package/llms/components/lr-map.md +63 -6
- package/llms/components/lr-mention-popover.md +16 -3
- package/llms/components/lr-menu-item.md +7 -0
- package/llms/components/lr-menu.md +8 -1
- package/llms/components/lr-message-actions.md +10 -0
- package/llms/components/lr-model-select.md +8 -3
- package/llms/components/lr-native-time-input.md +8 -1
- package/llms/components/lr-number-input.md +8 -1
- package/llms/components/lr-option.md +19 -0
- package/llms/components/lr-otp-input.md +6 -0
- package/llms/components/lr-pie-chart.md +3 -2
- package/llms/components/lr-polar-area-chart.md +3 -2
- package/llms/components/lr-prompt-input.md +2 -2
- package/llms/components/lr-radar-chart.md +3 -2
- package/llms/components/lr-reorder-item.md +12 -0
- package/llms/components/lr-reorder-list.md +12 -0
- package/llms/components/lr-scatter-chart.md +3 -2
- package/llms/components/lr-select.md +19 -2
- package/llms/components/lr-sequence-strip.md +10 -4
- package/llms/components/lr-streaming-text-core.md +28 -11
- package/llms/components/lr-streaming-text.md +41 -6
- package/llms/components/lr-suggestion-chips.md +8 -4
- package/llms/components/lr-table.md +47 -10
- package/llms/components/lr-textarea.md +1 -1
- package/llms/components/lr-time-input.md +7 -1
- package/llms/components/lr-tool-call-chip.md +7 -1
- package/llms/components/lr-tour.md +7 -1
- package/llms/components/lr-usage-badge.md +7 -1
- package/llms/components/lr-virtual-list.md +53 -0
- package/llms/components/lr-voice-picker.md +7 -3
- package/llms/shared.md +175 -19
- package/llms/tokens.md +17 -1
- package/llms-full.txt +1214 -169
- package/package.json +43 -3
- package/registrations.json +1 -1
- package/vscode-css-data.json +1 -1
- package/vscode-html-data.json +1 -1
- package/web-types.json +1 -1
|
@@ -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,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{activeElementIn}from"../../../internal/active-element.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{captureComposedFocusRepair,applyComposedFocusRepair}from"../../../internal/focus-navigation.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{nextId}from"../../../internal/a11y.js";import{closeIcon}from"../../../internal/icons.js";import{autocorrectConverter,normalizeAutocorrect,spellcheckConverter}from"../../../internal/converters.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./token-input.styles.js";import{attachInternalsSafely,createStringArrayFormDataState,getFormOwner,installCustomErrorProperty,isBarredFromValidation,readStringArrayFormDataState,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_tokenInputEditWithContext,LYRA_DEFAULT_tokenInputRequired}from"../../../internal/default-strings.generated.js";const delimiterConverter={fromAttribute:value=>value===null?",":value===""||value==="none"?null:value};function normalizeStringArray(value){if(!Array.isArray(value))return Object.freeze([]);try{const normalized=[];for(const entry of value)typeof entry=="string"&&normalized.push(entry);return Object.freeze(normalized)}catch{return Object.freeze([])}}const stringArrayConverter={fromAttribute:value=>{if(value===null)return null;try{const parsed=JSON.parse(value);return normalizeStringArray(parsed)}catch{return[]}},toAttribute:value=>value==null?null:JSON.stringify(value)};class LyraTokenInput extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,removeWithContext:LYRA_DEFAULT_removeWithContext,tokenInputEditWithContext:LYRA_DEFAULT_tokenInputEditWithContext,tokenInputRequired:LYRA_DEFAULT_tokenInputRequired}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,converter:stringArrayConverter,noAccessor:!0}}}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get editable(){return this._editable}set editable(next){const old=this._editable;this._editable=!!next,this._editable||this.discardTransientState(!1),this.requestUpdate("editable",old)}syncExternalDescription(){const target=this.isConnected?this.inputEl:void 0;if(!target){this.releaseExternalDescription();return}this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby")}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0);const normalized=normalizeStringArray(next);this.captureTokenFocusRepair(normalized),this.editingIndex>=0&&normalized!==old&&(this.editingIndex=-1,this.editDraft="",this.focusEditorPending=!1),this._value=normalized,this.requestUpdate("value",old),this.internals&&this.syncValidity()}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=normalizeStringArray(next),this.reflectingDefaultValue=!0;try{next==null?this.removeAttribute("value"):this.setAttribute("value",JSON.stringify(this._defaultValue))}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.syncValidity(),this.requestUpdate("name",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.syncValidity(),this.requestUpdate("required",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled,wasEffectivelyDisabled=this.effectiveDisabled;this._disabled=!!next,!wasEffectivelyDisabled&&this.effectiveDisabled&&this.retireDisabledInteraction(),this.toggleAttribute("disabled",this._disabled),this.syncValidity(),this.requestUpdate("disabled",old)}constructor(){super(),this.label="",this.hint="",this.errorText="",this.placeholder="",this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.accessibleLabel="",this.size="m",this.pill=!1,this.allowDuplicates=!1,this._editable=!1,this.delimiter=",",this.draft="",this.touched=!1,this.editingIndex=-1,this.editDraft="",this.rovingIndex=0,this.focusEditorPending=!1,this.focusTokenPending=-1,this.editorBlurRelayed=!1,this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.hasStartSlot=!1,this.hasEndSlot=!1,this.labelId=nextId("token-input-label"),this.hintId=nextId("token-input-hint"),this.errorId=nextId("token-input-error"),this._value=Object.freeze([]),this._defaultValue=Object.freeze([]),this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this._fieldsetDisabled=!1,this._name="",this._required=!1,this._disabled=!1,this.onEditInput=event=>{event.stopPropagation(),!this.liveDisabled&&(this.editDraft=event.target.value)},this.onEditFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}this.editorBlurRelayed=!1,relayNativeEvent(this,event)},this.onEditKeyDown=event=>{event.isComposing||event.keyCode===229||(event.key==="Enter"?(event.preventDefault(),this.commitEdit(!0)):event.key==="Escape"&&(event.preventDefault(),event.stopPropagation(),this.cancelEdit()))},this.onEditBlur=event=>{if(this.editorBlurRelayed){event.stopPropagation();return}this.editorBlurRelayed=!0,event.stopPropagation(),queueMicrotask(()=>{!this.isConnected||!this.editable||this.liveDisabled?this.discardTransientState(!1):this.commitEdit(!1),relayNativeEvent(this,event)})},this.onInput=event=>{event.stopPropagation(),!this.liveDisabled&&(this.draft=event.target.value)},this.onKeyDown=event=>{event.isComposing||event.keyCode===229||this.liveDisabled||(event.key==="Enter"||this.delimiter!==null&&event.key===this.delimiter?this.draft.trim()?(event.preventDefault(),this.addDraft()):event.key==="Enter"&&submitOnEnter(this,event):event.key==="Tab"?this.draft.trim()&&this.addDraft():event.key==="Backspace"&&!this.draft&&this.value.length&&this.editingIndex<0&&this.removeToken(this.value.length-1))},this.onBlur=event=>{this.liveDisabled||(this.draft.trim()&&this.addDraft(),this.touched=!0),this.syncValidity(),relayNativeEvent(this,event)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onLabelSlotChange=e=>{this.hasLabelSlot=e.target.assignedElements({flatten:!0}).length>0},this.onHintSlotChange=e=>{this.hasHintSlot=e.target.assignedElements({flatten:!0}).length>0},this.onErrorSlotChange=e=>{this.hasErrorSlot=e.target.assignedElements({flatten:!0}).length>0},this.onStartSlotChange=e=>{this.hasStartSlot=e.target.assignedElements({flatten:!0}).length>0},this.onEndSlotChange=e=>{this.hasEndSlot=e.target.assignedElements({flatten:!0}).length>0},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.syncValidity()}disconnectedCallback(){this.releaseExternalDescription(),this.tokenFocusRepairPending=void 0,this.discardTransientState(!0),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.isConnected&&this.hasUpdated&&this.syncExternalDescription()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formDisabledCallback(disabled){const wasEffectivelyDisabled=this.effectiveDisabled;this._fieldsetDisabled=disabled,!wasEffectivelyDisabled&&this.effectiveDisabled&&this.retireDisabledInteraction(),this.syncValidity(),this.requestUpdate()}[VALIDITY_ANCHOR](){return this.inputEl??this.renderRoot?.querySelector('[part="input-wrapper"]')??null}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.touched=!0,this.syncValidity(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidity()}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}focus(options){this.liveDisabled||this.inputEl?.focus(options)}blur(){const active=activeElementIn(this.shadowRoot);active&&typeof active.blur=="function"&&active.blur()}click(){this.liveDisabled||this.inputEl?.focus()}select(){this.inputEl?.select()}get selectionStart(){return this.inputEl?.selectionStart??null}set selectionStart(value){this.inputEl&&(this.inputEl.selectionStart=value??0)}get selectionEnd(){return this.inputEl?.selectionEnd??null}set selectionEnd(value){this.inputEl&&(this.inputEl.selectionEnd=value??0)}get selectionDirection(){return this.inputEl?.selectionDirection??null}set selectionDirection(value){this.inputEl&&(this.inputEl.selectionDirection=value??"none")}setSelectionRange(selectionStart,selectionEnd,selectionDirection="none"){this.inputEl?.setSelectionRange(selectionStart,selectionEnd,selectionDirection??"none")}setRangeText(replacement,start,end,selectMode="preserve"){const input=this.inputEl;input&&(start===void 0||end===void 0?input.setRangeText(replacement):input.setRangeText(replacement,start,end,selectMode),this.draft=input.value)}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.hasLabelSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="label"),this.hasHintSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="hint"),this.hasErrorSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="error"),this.hasStartSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="start"),this.hasEndSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="end"))}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncValidity(){const barred=this.barredFromValidation,missing=!barred&&this.required&&this.value.length===0;this.validityController.setValidity(missing?{valueMissing:!0}:{},missing?this.localize("tokenInputRequired"):""),this.toggleAttribute("data-invalid",!barred&&this.touched&&!this.internals.validity.valid),syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred});const data=new FormData;this.name&&this.value.forEach(token=>data.append(this.name,token)),this.internals.setFormValue(this.name?data:null,createStringArrayFormDataState(this.name,this.value))}updateValue(next){this.value=next,this.syncValidity(),dispatchNativeInputEvent(this),this.emit("lr-input",Object.freeze({value:Object.freeze([...this.value])})),dispatchNativeEvent(this,"change"),this.emit("lr-change",Object.freeze({value:Object.freeze([...this.value])}))}addDraft(){if(this.liveDisabled)return;const candidates=(this.delimiter?this.draft.split(this.delimiter):[this.draft]).map(token=>token.trim()).filter(Boolean),next=[...this.value],seen=this.allowDuplicates?null:new Set(next),added=[];for(const token of candidates)seen?.has(token)||(seen?.add(token),next.push(token),added.push(token));if(added.length===0){this.draft="";return}this.emit("lr-add",Object.freeze({value:added[added.length-1],values:Object.freeze([...added])}),{cancelable:!0}).defaultPrevented||(this.updateValue(next),this.draft="")}discardTransientState(clearDraft){this.editingIndex=-1,this.editDraft="",this.focusEditorPending=!1,this.focusTokenPending=-1,clearDraft&&(this.draft="",this.inputEl&&(this.inputEl.value=""))}retireDisabledInteraction(){this.tokenFocusRepairPending=void 0,this.discardTransientState(!0);const active=activeElementIn(this.shadowRoot);active&&typeof active.blur=="function"&&active.blur()}captureTokenFocusRepair(next){this.tokenFocusRepairPending=void 0;const tokens=[...this.renderRoot?.querySelectorAll('[part~="token"]')??[]];if(next.length>=tokens.length)return;const active=activeElementIn(this.shadowRoot),token=typeof active?.closest=="function"?active.closest('[part~="token"]'):null;if(!active||!token)return;const index=tokens.indexOf(token);if(index<0)return;const repair=captureComposedFocusRepair(this,active);if(!repair)return;const targetIndex=Math.min(index,Math.max(0,next.length-1));this.rovingIndex=targetIndex,this.tokenFocusRepairPending={index:targetIndex,surface:active.matches('[part~="remove"]')?"remove":"label",repair}}removeToken(index){if(this.liveDisabled)return;const removed=this.value[index];removed===void 0||this.emit("lr-remove",{value:removed,index},{cancelable:!0}).defaultPrevented||(this.editingIndex>=0&&(this.editingIndex=-1,this.editDraft=""),this.updateValue(this.value.filter((_token,i)=>i!==index)))}get activeTokenIndex(){return this.value.length?Math.min(Math.max(this.rovingIndex,0),this.value.length-1):-1}startEdit(index){this.liveDisabled||!this.editable||index<0||index>=this.value.length||(this.editingIndex=index,this.editDraft=this.value[index],this.rovingIndex=index,this.editorBlurRelayed=!1,this.focusEditorPending=!0)}cancelEdit(){this.editingIndex<0||(this.focusTokenPending=this.editingIndex,this.editingIndex=-1,this.editDraft="")}commitEdit(restoreFocus){if(this.liveDisabled){this.discardTransientState(!1);return}const index=this.editingIndex;if(index<0)return;const previousValue=this.value[index],next=this.editDraft.trim();if(previousValue===void 0||!next||next===previousValue||!this.allowDuplicates&&this.value.some((token,i)=>i!==index&&token===next)){restoreFocus&&(this.focusTokenPending=index),this.editingIndex=-1,this.editDraft="";return}this.emit("lr-token-edit",{value:next,previousValue,index},{cancelable:!0}).defaultPrevented||(restoreFocus&&(this.focusTokenPending=index),this.editingIndex=-1,this.editDraft="",this.updateValue(this.value.map((token,i)=>i===index?next:token)))}moveRovingFocus(index){if(!this.value.length)return;const clamped=Math.min(Math.max(index,0),this.value.length-1);this.rovingIndex=clamped,this.focusTokenPending=clamped}onTokenKeyDown(event,index){if(this.liveDisabled)return;const rtl=this.effectiveDirection==="rtl",forward=rtl?"ArrowLeft":"ArrowRight",backward=rtl?"ArrowRight":"ArrowLeft";event.key==="Enter"||event.key===" "||event.key==="F2"?(event.preventDefault(),this.startEdit(index)):event.key===forward?(event.preventDefault(),this.moveRovingFocus(index+1)):event.key===backward?(event.preventDefault(),this.moveRovingFocus(index-1)):event.key==="Home"?(event.preventDefault(),this.moveRovingFocus(0)):event.key==="End"&&(event.preventDefault(),this.moveRovingFocus(this.value.length-1))}stopInternalChange(event){event.stopPropagation()}formResetCallback(){this.restoreLiveValueFromDefault(),this.discardTransientState(!0),this.rovingIndex=0,this.touched=!1,this.syncValidity()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=[...this._defaultValue]}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state2,_mode){this.value=readStringArrayFormDataState(state2),this.discardTransientState(!0),this.rovingIndex=0,this.touched=!1,this.syncValidity()}updated(changed){if(super.updated(changed),this.syncExternalDescription(),this.focusEditorPending){this.focusEditorPending=!1;const editor=this.renderRoot?.querySelector('[part="token-editor"]');editor?.focus(),editor?.select()}if(this.focusTokenPending>=0){const index=this.focusTokenPending;this.focusTokenPending=-1;const label=this.renderRoot?.querySelectorAll('[part="token-label"]')?.[index];label?.focus(),label?.scrollIntoView({block:"nearest",inline:"nearest"})}const pending=this.tokenFocusRepairPending;if(this.tokenFocusRepairPending=void 0,pending){const token=[...this.renderRoot.querySelectorAll('[part~="token"]')][pending.index],target=(pending.surface==="remove"?token?.querySelector('[part~="remove"]'):token?.querySelector('[part~="token-label"]'))??token?.querySelector('[part~="remove"]')??this.inputEl??null;applyComposedFocusRepair(pending.repair,target)&&target?.scrollIntoView({block:"nearest",inline:"nearest"})}}renderRemoveButton(token,index){return html`<button
|
|
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,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{activeElementIn}from"../../../internal/active-element.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{captureComposedFocusRepair,applyComposedFocusRepair}from"../../../internal/focus-navigation.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{nextId}from"../../../internal/a11y.js";import{closeIcon}from"../../../internal/icons.js";import{autocorrectConverter,normalizeAutocorrect,spellcheckConverter}from"../../../internal/converters.js";import{submitOnEnter}from"../../../internal/submit-on-enter.js";import{dispatchNativeEvent,dispatchNativeInputEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{sizes}from"../../../internal/sizes.styles.js";import{styles}from"./token-input.styles.js";import{attachInternalsSafely,createStringArrayFormDataState,getFormOwner,installCustomErrorProperty,isBarredFromValidation,readStringArrayFormDataState,setFormOwner}from"../../../internal/form-associated.js";import{installInteractionOnInvalid,installInvalidEventAlias,withStaticValidityCheck}from"../../../internal/invalid-event-alias.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_tokenInputEditWithContext,LYRA_DEFAULT_tokenInputRequired}from"../../../internal/default-strings.generated.js";const delimiterConverter={fromAttribute:value=>value===null?",":value===""||value==="none"?null:value};function normalizeStringArray(value){if(!Array.isArray(value))return Object.freeze([]);try{const normalized=[];for(const entry of value)typeof entry=="string"&&normalized.push(entry);return Object.freeze(normalized)}catch{return Object.freeze([])}}const stringArrayConverter={fromAttribute:value=>{if(value===null)return null;try{const parsed=JSON.parse(value);return normalizeStringArray(parsed)}catch{return[]}},toAttribute:value=>value==null?null:JSON.stringify(value)};class LyraTokenInput extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,removeWithContext:LYRA_DEFAULT_removeWithContext,tokenInputEditWithContext:LYRA_DEFAULT_tokenInputEditWithContext,tokenInputRequired:LYRA_DEFAULT_tokenInputRequired}}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,converter:stringArrayConverter,noAccessor:!0}}}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}get editable(){return this._editable}set editable(next){const old=this._editable;this._editable=!!next,this._editable||this.discardTransientState(!1),this.requestUpdate("editable",old)}syncExternalDescription(){const target=this.isConnected?this.inputEl:void 0;if(!target){this.releaseExternalDescription();return}this.externalDescriptionLease?this.externalDescriptionLease.update(target):this.externalDescriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby")}releaseExternalDescription(){this.externalDescriptionLease?.release(),this.externalDescriptionLease=void 0}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0);const normalized=normalizeStringArray(next);this.captureTokenFocusRepair(normalized),this.editingIndex>=0&&normalized!==old&&(this.editingIndex=-1,this.editDraft="",this.focusEditorPending=!1),this._value=normalized,this.requestUpdate("value",old),this.internals&&this.syncValidity()}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=normalizeStringArray(next),this.reflectingDefaultValue=!0;try{next==null?this.removeAttribute("value"):this.setAttribute("value",JSON.stringify(this._defaultValue))}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.syncValidity(),this.requestUpdate("name",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.syncValidity(),this.requestUpdate("required",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled,wasEffectivelyDisabled=this.effectiveDisabled;this._disabled=!!next,!wasEffectivelyDisabled&&this.effectiveDisabled&&this.retireDisabledInteraction(),this.toggleAttribute("disabled",this._disabled),this.syncValidity(),this.requestUpdate("disabled",old)}constructor(){super(),this.label="",this.hint="",this.errorText="",this.placeholder="",this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.accessibleLabel="",this.size="m",this.pill=!1,this.allowDuplicates=!1,this._editable=!1,this.delimiter=",",this.draft="",this.touched=!1,this.editingIndex=-1,this.editDraft="",this.rovingIndex=0,this.focusEditorPending=!1,this.focusTokenPending=-1,this.editorBlurRelayed=!1,this.hasLabelSlot=!1,this.hasHintSlot=!1,this.hasErrorSlot=!1,this.hasStartSlot=!1,this.hasEndSlot=!1,this.labelId=nextId("token-input-label"),this.hintId=nextId("token-input-hint"),this.errorId=nextId("token-input-error"),this._value=Object.freeze([]),this._defaultValue=Object.freeze([]),this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this._fieldsetDisabled=!1,this._name="",this._required=!1,this._disabled=!1,this.markInteracted=()=>{this.touched||(this.touched=!0,this.syncValidity())},this.onEditInput=event=>{event.stopPropagation(),!this.liveDisabled&&(this.editDraft=event.target.value)},this.onEditFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}this.editorBlurRelayed=!1,relayNativeEvent(this,event)},this.onEditKeyDown=event=>{event.isComposing||event.keyCode===229||(event.key==="Enter"?(event.preventDefault(),this.commitEdit(!0)):event.key==="Escape"&&(event.preventDefault(),event.stopPropagation(),this.cancelEdit()))},this.onEditBlur=event=>{if(this.editorBlurRelayed){event.stopPropagation();return}this.editorBlurRelayed=!0,event.stopPropagation(),queueMicrotask(()=>{!this.isConnected||!this.editable||this.liveDisabled?this.discardTransientState(!1):this.commitEdit(!1),relayNativeEvent(this,event)})},this.onInput=event=>{event.stopPropagation(),!this.liveDisabled&&(this.draft=event.target.value)},this.onKeyDown=event=>{event.isComposing||event.keyCode===229||this.liveDisabled||(event.key==="Enter"||this.delimiter!==null&&event.key===this.delimiter?this.draft.trim()?(event.preventDefault(),this.addDraft()):event.key==="Enter"&&submitOnEnter(this,event):event.key==="Tab"?this.draft.trim()&&this.addDraft():event.key==="Backspace"&&!this.draft&&this.value.length&&this.editingIndex<0&&this.removeToken(this.value.length-1))},this.onBlur=event=>{this.liveDisabled||(this.draft.trim()&&this.addDraft(),this.touched=!0),this.syncValidity(),relayNativeEvent(this,event)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onLabelSlotChange=e=>{this.hasLabelSlot=e.target.assignedElements({flatten:!0}).length>0},this.onHintSlotChange=e=>{this.hasHintSlot=e.target.assignedElements({flatten:!0}).length>0},this.onErrorSlotChange=e=>{this.hasErrorSlot=e.target.assignedElements({flatten:!0}).length>0},this.onStartSlotChange=e=>{this.hasStartSlot=e.target.assignedElements({flatten:!0}).length>0},this.onEndSlotChange=e=>{this.hasEndSlot=e.target.assignedElements({flatten:!0}).length>0},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),installInteractionOnInvalid(this,this.markInteracted)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.syncExternalDescription(),this.syncValidity()}disconnectedCallback(){this.releaseExternalDescription(),this.tokenFocusRepairPending=void 0,this.discardTransientState(!0),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseExternalDescription(),this.isConnected&&this.hasUpdated&&this.syncExternalDescription()}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}formDisabledCallback(disabled){const wasEffectivelyDisabled=this.effectiveDisabled;this._fieldsetDisabled=disabled,!wasEffectivelyDisabled&&this.effectiveDisabled&&this.retireDisabledInteraction(),this.syncValidity(),this.requestUpdate()}[VALIDITY_ANCHOR](){return this.inputEl??this.renderRoot?.querySelector('[part="input-wrapper"]')??null}checkValidity(){return withStaticValidityCheck(this,()=>this.internals.checkValidity())}reportValidity(){return this.touched=!0,this.syncValidity(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidity()}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}focus(options){this.liveDisabled||this.inputEl?.focus(options)}blur(){const active=activeElementIn(this.shadowRoot);active&&typeof active.blur=="function"&&active.blur()}click(){this.liveDisabled||this.inputEl?.focus()}select(){this.inputEl?.select()}get selectionStart(){return this.inputEl?.selectionStart??null}set selectionStart(value){this.inputEl&&(this.inputEl.selectionStart=value??0)}get selectionEnd(){return this.inputEl?.selectionEnd??null}set selectionEnd(value){this.inputEl&&(this.inputEl.selectionEnd=value??0)}get selectionDirection(){return this.inputEl?.selectionDirection??null}set selectionDirection(value){this.inputEl&&(this.inputEl.selectionDirection=value??"none")}setSelectionRange(selectionStart,selectionEnd,selectionDirection="none"){this.inputEl?.setSelectionRange(selectionStart,selectionEnd,selectionDirection??"none")}setRangeText(replacement,start,end,selectMode="preserve"){const input=this.inputEl;input&&(start===void 0||end===void 0?input.setRangeText(replacement):input.setRangeText(replacement,start,end,selectMode),this.draft=input.value)}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.hasLabelSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="label"),this.hasHintSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="hint"),this.hasErrorSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="error"),this.hasStartSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="start"),this.hasEndSlot=Array.from(this.children??[]).some(el=>el.getAttribute("slot")==="end"))}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}syncValidity(){const barred=this.barredFromValidation,missing=!barred&&this.required&&this.value.length===0;this.validityController.setValidity(missing?{valueMissing:!0}:{},missing?this.localize("tokenInputRequired"):""),this.toggleAttribute("data-invalid",!barred&&this.touched&&!this.internals.validity.valid),syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred});const data=new FormData;this.name&&this.value.forEach(token=>data.append(this.name,token)),this.internals.setFormValue(this.name?data:null,createStringArrayFormDataState(this.name,this.value))}updateValue(next){this.value=next,this.syncValidity(),dispatchNativeInputEvent(this),this.emit("lr-input",Object.freeze({value:Object.freeze([...this.value])})),dispatchNativeEvent(this,"change"),this.emit("lr-change",Object.freeze({value:Object.freeze([...this.value])}))}addDraft(){if(this.liveDisabled)return;const candidates=(this.delimiter?this.draft.split(this.delimiter):[this.draft]).map(token=>token.trim()).filter(Boolean),next=[...this.value],seen=this.allowDuplicates?null:new Set(next),added=[];for(const token of candidates)seen?.has(token)||(seen?.add(token),next.push(token),added.push(token));if(added.length===0){this.draft="";return}this.emit("lr-add",Object.freeze({value:added[added.length-1],values:Object.freeze([...added])}),{cancelable:!0}).defaultPrevented||(this.updateValue(next),this.draft="")}discardTransientState(clearDraft){this.editingIndex=-1,this.editDraft="",this.focusEditorPending=!1,this.focusTokenPending=-1,clearDraft&&(this.draft="",this.inputEl&&(this.inputEl.value=""))}retireDisabledInteraction(){this.tokenFocusRepairPending=void 0,this.discardTransientState(!0);const active=activeElementIn(this.shadowRoot);active&&typeof active.blur=="function"&&active.blur()}captureTokenFocusRepair(next){this.tokenFocusRepairPending=void 0;const tokens=[...this.renderRoot?.querySelectorAll('[part~="token"]')??[]];if(next.length>=tokens.length)return;const active=activeElementIn(this.shadowRoot),token=typeof active?.closest=="function"?active.closest('[part~="token"]'):null;if(!active||!token)return;const index=tokens.indexOf(token);if(index<0)return;const repair=captureComposedFocusRepair(this,active);if(!repair)return;const targetIndex=Math.min(index,Math.max(0,next.length-1));this.rovingIndex=targetIndex,this.tokenFocusRepairPending={index:targetIndex,surface:active.matches('[part~="remove"]')?"remove":"label",repair}}removeToken(index){if(this.liveDisabled)return;const removed=this.value[index];removed===void 0||this.emit("lr-remove",{value:removed,index},{cancelable:!0}).defaultPrevented||(this.editingIndex>=0&&(this.editingIndex=-1,this.editDraft=""),this.updateValue(this.value.filter((_token,i)=>i!==index)))}get activeTokenIndex(){return this.value.length?Math.min(Math.max(this.rovingIndex,0),this.value.length-1):-1}startEdit(index){this.liveDisabled||!this.editable||index<0||index>=this.value.length||(this.editingIndex=index,this.editDraft=this.value[index],this.rovingIndex=index,this.editorBlurRelayed=!1,this.focusEditorPending=!0)}cancelEdit(){this.editingIndex<0||(this.focusTokenPending=this.editingIndex,this.editingIndex=-1,this.editDraft="")}commitEdit(restoreFocus){if(this.liveDisabled){this.discardTransientState(!1);return}const index=this.editingIndex;if(index<0)return;const previousValue=this.value[index],next=this.editDraft.trim();if(previousValue===void 0||!next||next===previousValue||!this.allowDuplicates&&this.value.some((token,i)=>i!==index&&token===next)){restoreFocus&&(this.focusTokenPending=index),this.editingIndex=-1,this.editDraft="";return}this.emit("lr-token-edit",{value:next,previousValue,index},{cancelable:!0}).defaultPrevented||(restoreFocus&&(this.focusTokenPending=index),this.editingIndex=-1,this.editDraft="",this.updateValue(this.value.map((token,i)=>i===index?next:token)))}moveRovingFocus(index){if(!this.value.length)return;const clamped=Math.min(Math.max(index,0),this.value.length-1);this.rovingIndex=clamped,this.focusTokenPending=clamped}onTokenKeyDown(event,index){if(this.liveDisabled)return;const rtl=this.effectiveDirection==="rtl",forward=rtl?"ArrowLeft":"ArrowRight",backward=rtl?"ArrowRight":"ArrowLeft";event.key==="Enter"||event.key===" "||event.key==="F2"?(event.preventDefault(),this.startEdit(index)):event.key===forward?(event.preventDefault(),this.moveRovingFocus(index+1)):event.key===backward?(event.preventDefault(),this.moveRovingFocus(index-1)):event.key==="Home"?(event.preventDefault(),this.moveRovingFocus(0)):event.key==="End"&&(event.preventDefault(),this.moveRovingFocus(this.value.length-1))}stopInternalChange(event){event.stopPropagation()}formResetCallback(){this.restoreLiveValueFromDefault(),this.discardTransientState(!0),this.rovingIndex=0,this.touched=!1,this.syncValidity()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=[...this._defaultValue]}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state2,_mode){this.value=readStringArrayFormDataState(state2),this.discardTransientState(!0),this.rovingIndex=0,this.touched=!1,this.syncValidity()}updated(changed){if(super.updated(changed),this.syncExternalDescription(),this.focusEditorPending){this.focusEditorPending=!1;const editor=this.renderRoot?.querySelector('[part="token-editor"]');editor?.focus(),editor?.select()}if(this.focusTokenPending>=0){const index=this.focusTokenPending;this.focusTokenPending=-1;const label=this.renderRoot?.querySelectorAll('[part="token-label"]')?.[index];label?.focus(),label?.scrollIntoView({block:"nearest",inline:"nearest"})}const pending=this.tokenFocusRepairPending;if(this.tokenFocusRepairPending=void 0,pending){const token=[...this.renderRoot.querySelectorAll('[part~="token"]')][pending.index],target=(pending.surface==="remove"?token?.querySelector('[part~="remove"]'):token?.querySelector('[part~="token-label"]'))??token?.querySelector('[part~="remove"]')??this.inputEl??null;applyComposedFocusRepair(pending.repair,target)&&target?.scrollIntoView({block:"nearest",inline:"nearest"})}}renderRemoveButton(token,index){return html`<button
|
|
2
2
|
part="remove"
|
|
3
3
|
type="button"
|
|
4
4
|
aria-label=${this.localize("removeWithContext",void 0,{label:token})}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';
|
|
1
|
+
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';export interface LyraAppRailItemToggleDetail{open:boolean;}export interface LyraAppRailItemEventMap{'lr-toggle-request':CustomEvent<LyraAppRailItemToggleDetail>;'lr-toggle':CustomEvent<LyraAppRailItemToggleDetail>;}
|
|
2
2
|
/**
|
|
3
3
|
* `<lr-app-rail-item>` — an explicit icon/label navigation item for
|
|
4
4
|
* `<lr-app-rail>`. The rail sets its `icon-only` attribute as the viewport
|
|
@@ -13,6 +13,30 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
|
|
|
13
13
|
* to the stable owning rail surface when there is no return target; a newer external focus move
|
|
14
14
|
* always wins.
|
|
15
15
|
*
|
|
16
|
+
* An item may own its own expandable child list -- the treeitem-with-link pattern used by
|
|
17
|
+
* repository trees, Notion-style page trees and IDE explorers, where the row itself is a
|
|
18
|
+
* destination and a SEPARATE disclosure expands that one item's own nested rows beneath it.
|
|
19
|
+
* `<lr-app-rail-group>` cannot express this: its collapsible heading IS the toggle, so nesting a
|
|
20
|
+
* navigable link inside it would put an interactive element inside a button. Slotting one or more
|
|
21
|
+
* `<lr-app-rail-item>`s into `children` instead renders a built-in disclosure -- a SIBLING of
|
|
22
|
+
* `[part="base"]`, never nested inside it, so the link keeps navigating on its own and the
|
|
23
|
+
* disclosure keeps toggling on its own; clicking one never triggers the other. The disclosure
|
|
24
|
+
* carries `aria-expanded`/`aria-controls` and a localized accessible name interpolating this
|
|
25
|
+
* item's own label, mirroring `<lr-app-rail-group>`'s collapsible contract for event name, detail
|
|
26
|
+
* shape and cancelable request/commit semantics exactly (see `lr-toggle-request`/`lr-toggle`
|
|
27
|
+
* below). An item with nothing slotted into `children` renders no disclosure and no extra
|
|
28
|
+
* wrapper -- byte-identical to an item with no children slot at all.
|
|
29
|
+
*
|
|
30
|
+
* `icon-only` forwards onto every `<lr-app-rail-item>` this item DIRECTLY owns through `children`,
|
|
31
|
+
* exactly how `<lr-app-rail-group>` forwards onto the items and nested groups it owns -- so a
|
|
32
|
+
* nested item's own icon/label presentation tracks the rail's presentation without the rail
|
|
33
|
+
* reaching through two hosts. The disclosure itself never changes shape between presentations: it
|
|
34
|
+
* is always a fixed icon-button-sized square beside `[part="base"]`, the same footprint `end` and
|
|
35
|
+
* icon-only `[part="base"]` already use, so it needs no icon-only-specific styling of its own.
|
|
36
|
+
* There is no ancestor-current treatment: `<lr-app-rail-group>` has no equivalent concept for a
|
|
37
|
+
* group containing the current item, so none is invented here either -- a current descendant
|
|
38
|
+
* stays perceivable only through its own `current` property, exactly as an unnested item would.
|
|
39
|
+
*
|
|
16
40
|
* @customElement lr-app-rail-item
|
|
17
41
|
* @slot - The visible navigation label.
|
|
18
42
|
* @slot icon - The leading decorative icon. Its flattened subtree is inert and hidden from
|
|
@@ -26,6 +50,19 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
|
|
|
26
50
|
* `header-actions`), so a slotted control keeps its own click, keyboard activation and focus
|
|
27
51
|
* order instead of being swallowed by the item's own activation target. Unlike `meta` it stays
|
|
28
52
|
* visible in `icon-only` mode, where it shares the narrow rail's width with the icon.
|
|
53
|
+
* @slot children - Nested `<lr-app-rail-item>`s disclosed beneath this item. Rendering anything
|
|
54
|
+
* into this slot grows a built-in disclosure button (`[part="toggle"]`) as a sibling of
|
|
55
|
+
* `[part="base"]`; leaving it empty renders neither the disclosure nor `[part="children"]`.
|
|
56
|
+
* @event lr-toggle-request - Cancelable proposal emitted before `expanded` changes from the
|
|
57
|
+
* built-in disclosure. Call `preventDefault()` to keep the current state, or assign `expanded`
|
|
58
|
+
* from the listener to resolve it yourself -- a write during the dispatch suppresses the default
|
|
59
|
+
* commit even when it assigns the value the property already held. Not emitted for a direct
|
|
60
|
+
* `expanded` write. `detail: LyraAppRailItemToggleDetail` (`{ open: boolean }` -- the field is
|
|
61
|
+
* named `open`, matching `<lr-app-rail-group>`'s identical event name and detail shape exactly,
|
|
62
|
+
* so a listener bound to both components' `lr-toggle-request` need not branch on which fired).
|
|
63
|
+
* @event lr-toggle - The item finished expanding or collapsing its `children`. Non-cancelable,
|
|
64
|
+
* emitted after `expanded` is written, and never emitted for a vetoed or listener-resolved
|
|
65
|
+
* request. `detail: LyraAppRailItemToggleDetail`.
|
|
29
66
|
* @csspart base - The link or button receiving focus and activation.
|
|
30
67
|
* @csspart icon - The icon wrapper.
|
|
31
68
|
* @csspart label - The label wrapper; visually clipped in icon-only mode.
|
|
@@ -36,6 +73,17 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
|
|
|
36
73
|
* an item without secondary text renders exactly as before the slot existed.
|
|
37
74
|
* @csspart end - The wrapper around the `end` slot, following `[part="meta"]`. Hidden while empty
|
|
38
75
|
* for the same reason.
|
|
76
|
+
* @csspart toggle - The disclosure control, rendered only while something is slotted into
|
|
77
|
+
* `children`. A sibling of `[part="base"]`, never nested inside it, so activating one never
|
|
78
|
+
* triggers the other. Carries `aria-expanded` in both states and `aria-controls` pointing at
|
|
79
|
+
* `[part="children"]`'s id; its accessible name is a localized `this.localize()` template
|
|
80
|
+
* interpolating this item's own label, with no literal fallback.
|
|
81
|
+
* @csspart toggle-icon - The wrapper around the disclosure chevron. Direction-aware through this
|
|
82
|
+
* wrapper's own `transform`, never a second mirrored glyph -- mirrors
|
|
83
|
+
* `<lr-app-rail-group>`'s `[part="toggle-icon"]`.
|
|
84
|
+
* @csspart children - The wrapper around the `children` slot. Rendered only while something is
|
|
85
|
+
* slotted into `children`; hidden (but present, so `aria-controls` keeps resolving) while
|
|
86
|
+
* `expanded` is `false`.
|
|
39
87
|
* @csspart tooltip - The hover/focus label flyout, only rendered while `tooltip` is set, the item
|
|
40
88
|
* is `icon-only`, and it is hovered or focused.
|
|
41
89
|
* @cssprop [--lr-app-rail-item-current-bg=var(--lr-color-brand-quiet)] - Background of the
|
|
@@ -55,6 +103,17 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
|
|
|
55
103
|
* `[part="current-indicator"]` while current.
|
|
56
104
|
* @cssprop [--lr-app-rail-item-current-indicator-inset-inline=0 auto] - Logical inline-start and
|
|
57
105
|
* inline-end insets for `[part="current-indicator"]`; set `auto 0` to place it at inline-end.
|
|
106
|
+
* @cssprop [--lr-app-rail-item-current-indicator-display] - `[part="current-indicator"]`'s
|
|
107
|
+
* `display` while `icon-only`. Unset (the default), the indicator is suppressed there -- a
|
|
108
|
+
* full-height edge bar on the square icon-only tile reads as a rendering glitch. Set to `block`
|
|
109
|
+
* (or any non-`none` display) to restore it. Full presentation is unaffected either way; its own
|
|
110
|
+
* `[part="current-indicator"]` rule declares no `display` at all.
|
|
111
|
+
* @cssprop [--lr-app-rail-item-current-ring] - `box-shadow` on `[part="base"]` while
|
|
112
|
+
* `current`/`aria-current="page"`. Unset, icon-only gets an inset ring by default -- the
|
|
113
|
+
* non-color-only signal that replaces the indicator bar suppressed there (WCAG 1.4.1); full
|
|
114
|
+
* presentation, which already conveys current state through the indicator bar and
|
|
115
|
+
* `--lr-app-rail-item-current-font-weight`, stays ring-free (`none`) by default. Setting this
|
|
116
|
+
* token explicitly applies the same value in both presentations.
|
|
58
117
|
* @cssprop [--lr-app-rail-item-hover-bg=var(--lr-color-brand-quiet)] - Hover background.
|
|
59
118
|
* @cssprop [--lr-app-rail-item-hover-color=var(--lr-color-brand)] - Hover text/icon color.
|
|
60
119
|
* @cssprop --lr-app-rail-item-active-bg - Pressed background; defaults to the former brand-quiet
|
|
@@ -73,12 +132,25 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
|
|
|
73
132
|
* font size.
|
|
74
133
|
* @cssprop [--lr-app-rail-item-icon-size=var(--lr-icon-button-size)] - `[part="icon"]`'s inline
|
|
75
134
|
* size. Not floor-clamped -- the icon is decorative, not itself a pointer target.
|
|
135
|
+
* @cssprop [--lr-app-rail-item-icon-only-size] - When set, sizes `[part="base"]`'s icon-only
|
|
136
|
+
* square (`inline-size` and `block-size` alike) directly, independent of the row's own
|
|
137
|
+
* `--lr-app-rail-item-min-block-size`. Unset (the default), the square is still derived via
|
|
138
|
+
* `aspect-ratio: 1` against the row's block size, exactly as before. Still floor-clamped to
|
|
139
|
+
* `--lr-icon-button-size` by `[part="base"]`'s shared `min-block-size` rule.
|
|
76
140
|
* @cssprop [--lr-app-rail-item-font-size=inherit] - `[part="base"]`'s font size, set after the
|
|
77
141
|
* `font` shorthand so it alone can be retuned while family/weight/line-height stay inherited.
|
|
142
|
+
* @cssprop --lr-positioning-strategy - Cascading `absolute`/`fixed` override for the icon-only
|
|
143
|
+
* flyout tooltip's `fixed` default, read from computed style when it is (re)positioned. Set it
|
|
144
|
+
* once on `:root`, a theme, or one clipping ancestor to change every unset rail item beneath it;
|
|
145
|
+
* an unrecognized value falls back to `fixed`.
|
|
146
|
+
* @cssprop [--lr-app-rail-item-indent=var(--lr-space-l)] - `[part="children"]`'s
|
|
147
|
+
* `padding-inline-start`. Applied once per nesting level -- a doubly-nested `children` list
|
|
148
|
+
* compounds two insets automatically, since each level's own `[part="children"]` applies the
|
|
149
|
+
* token again. Logical, so it mirrors under `dir="rtl"` with no separate rule.
|
|
78
150
|
* @status stable
|
|
79
151
|
* @since 4.0.0
|
|
80
152
|
*/
|
|
81
|
-
export declare class LyraAppRailItem extends LyraElement{static styles:import("lit").CSSResultGroup[];static get observedAttributes():string[];
|
|
153
|
+
export declare class LyraAppRailItem extends LyraElement<LyraAppRailItemEventMap>{static styles:import("lit").CSSResultGroup[];static get observedAttributes():string[];
|
|
82
154
|
/** Optional destination. Without `href`, the item renders as a button. */
|
|
83
155
|
href:string;
|
|
84
156
|
/** Optional link target. */
|
|
@@ -95,10 +167,43 @@ current:boolean;
|
|
|
95
167
|
* documented property instead of an unverified cross-browser `::part()` + `::after` + `attr()`
|
|
96
168
|
* composition. No effect outside icon-only mode, since the label is already visible there.
|
|
97
169
|
* `false` (the default) reproduces today's exact output. */
|
|
98
|
-
tooltip:boolean;
|
|
170
|
+
tooltip:boolean;
|
|
171
|
+
/** Whether this item's `children` are shown. `false` by default -- a nested list expanding
|
|
172
|
+
* itself on first paint would be a surprising default, and it reproduces exactly what an item
|
|
173
|
+
* with no `expanded` property rendered before this feature existed. Mirrors
|
|
174
|
+
* `<lr-app-rail-group>`'s `open` accessor: every write, including one that assigns the value
|
|
175
|
+
* already held, marks the veto guard so a synchronous `lr-toggle-request` listener resolving
|
|
176
|
+
* this itself is observed correctly (see {@link VetoWriteGuard}). */
|
|
177
|
+
get expanded():boolean;set expanded(next:boolean);private _expanded;private readonly toggleGuard;private showTooltip;
|
|
99
178
|
/** `:empty` cannot see slotted light-DOM content (the wrapper always holds a `<slot>` element),
|
|
100
179
|
* so emptiness is tracked from `slotchange` the same way `<lr-details>` tracks its own
|
|
101
180
|
* `header-actions` wrapper. */
|
|
102
|
-
private hasEndSlot;private hasMetaSlot;private
|
|
181
|
+
private hasEndSlot;private hasMetaSlot;private metaSlot?;private endSlot?;private stopPositioning?;private labelObserver?;private childrenObserver?;private semanticFocusRepair?;private focusReturnTarget?;private readonly childrenId;
|
|
182
|
+
/** Reads the light-DOM `slot` attribute directly rather than a live `assignedNodes()` snapshot
|
|
183
|
+
* -- the same WebKit-safe pattern `<lr-app-rail>`'s own `onHeaderSlotChange`/`onFooterSlotChange`
|
|
184
|
+
* use -- so the very first render (before any mutation has ever fired) already renders the
|
|
185
|
+
* disclosure and `[part="children"]` when the item was authored with children in markup,
|
|
186
|
+
* with no flash of the childless state. Only ELEMENT children can carry a `slot` attribute, so
|
|
187
|
+
* reading `this.children` (not `this.childNodes`) already excludes stray text nodes. */
|
|
188
|
+
private get hasChildrenSlotted();connectedCallback():void;private armLabelObserver;
|
|
189
|
+
/** Watches the light DOM for a `children`-slotted node being added, removed, or re-slotted, so
|
|
190
|
+
* `hasChildrenSlotted` (read fresh from `render()`, never cached) triggers a re-render at the
|
|
191
|
+
* moment the disclosure/`[part="children"]` should appear or disappear -- including the very
|
|
192
|
+
* first time a consumer appends a nested item after construction. `childList` catches
|
|
193
|
+
* add/remove; the `subtree`-scoped `slot`-only `attributes` filter catches an existing child
|
|
194
|
+
* being re-slotted into or out of `children`, mirroring what a real `slotchange` listener would
|
|
195
|
+
* see for an always-rendered slot (this slot is instead rendered on demand, so there is no
|
|
196
|
+
* `<slot>` element to listen on while it does not exist). Also re-syncs this item's own
|
|
197
|
+
* `icon-only` forwarding onto whatever it owns, since either kind of mutation can change which
|
|
198
|
+
* nodes this item owns. */
|
|
199
|
+
private armChildrenObserver;
|
|
200
|
+
/** Mirrors this item's own `icon-only` state onto every `<lr-app-rail-item>` it DIRECTLY owns
|
|
201
|
+
* through `children` -- exactly how `<lr-app-rail-group>`'s `syncOwnedItems()` forwards onto the
|
|
202
|
+
* items and nested groups it owns. One owner per node: ownership is resolved from the node's
|
|
203
|
+
* PARENT, never the node itself, so a grandchild's own next sync does not immediately undo a
|
|
204
|
+
* grandparent's write, and a nested item's own `attributeChangedCallback` cascades the same
|
|
205
|
+
* forwarding one level further down in turn. Gated on `isConnected` so a detached item stops
|
|
206
|
+
* claiming ownership of nodes appended to it afterwards. */
|
|
207
|
+
private syncOwnedChildren;private onToggleClick;private get labelText();private get tooltipText();private onFocusShow;private onBlurHide;private onEndSlotChange;private applyEndSlotPresence;private onMetaSlotChange;private applyMetaSlotPresence;attributeChangedCallback(name:string,oldValue:string|null,newValue:string|null):void;protected firstUpdated(changed:PropertyValues):void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;disconnectedCallback():void;private focusFallback;
|
|
103
208
|
/** Activates the internal link or button. Disabled items remain inert. */
|
|
104
209
|
click():void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-app-rail-item':LyraAppRailItem;}}
|
|
@@ -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{activeElementIn}from"../../../internal/active-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{applyComposedFocusRepair,captureComposedFocusRepair,isComposedFocusAvailable}from"../../../internal/focus-navigation.js";import{LyraElement}from"../../../internal/lyra-element.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{safeLinkHref}from"../../../internal/safe-url.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{styles}from"./app-rail-item.styles.js";class LyraAppRailItem extends LyraElement{constructor(){super(...arguments),this.href="",this.target="",this.disabled=!1,this.current=!1,this.tooltip=!1,this.showTooltip=!1,this.hasEndSlot=!1,this.hasMetaSlot=!1,this.onFocusShow=event=>{if(this.tooltip&&this.hasAttribute("icon-only")&&(this.showTooltip=!0),event.type!=="focus")return;const related=event.relatedTarget;related&&related.nodeType===1&&isComposedFocusAvailable(related)&&(this.focusReturnTarget=related)},this.onBlurHide=()=>{this.showTooltip=!1},this.onEndSlotChange=event=>{this.
|
|
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,query,state}from"lit/decorators.js";import{activeElementIn}from"../../../internal/active-element.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{applyComposedFocusRepair,captureComposedFocusRepair,isComposedFocusAvailable}from"../../../internal/focus-navigation.js";import{chevronIcon}from"../../../internal/icons.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{LyraElement}from"../../../internal/lyra-element.js";import{renderInertPresentation}from"../../../internal/inert-presentation.js";import{tag}from"../../../internal/prefix.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{safeLinkHref}from"../../../internal/safe-url.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{styles}from"./app-rail-item.styles.js";import{LYRA_DEFAULT_appRailItemCollapse,LYRA_DEFAULT_appRailItemExpand}from"../../../internal/default-strings.generated.js";class LyraAppRailItem extends LyraElement{constructor(){super(...arguments),this.href="",this.target="",this.disabled=!1,this.current=!1,this.tooltip=!1,this._expanded=!1,this.toggleGuard=new VetoWriteGuard,this.showTooltip=!1,this.hasEndSlot=!1,this.hasMetaSlot=!1,this.childrenId=nextId("app-rail-item-children"),this.onToggleClick=event=>{event.stopPropagation();const next=!this._expanded;requestThenCommit({requestDetail:{open:next},emitRequest:(detail,init)=>this.emit("lr-toggle-request",detail,init),guard:this.toggleGuard,commit:()=>{this.expanded=next,this.emit("lr-toggle",{open:next})}})},this.onFocusShow=event=>{if(this.tooltip&&this.hasAttribute("icon-only")&&(this.showTooltip=!0),event.type!=="focus")return;const related=event.relatedTarget;related&&related.nodeType===1&&isComposedFocusAvailable(related)&&(this.focusReturnTarget=related)},this.onBlurHide=()=>{this.showTooltip=!1},this.onEndSlotChange=event=>{this.applyEndSlotPresence(event.target)},this.onMetaSlotChange=event=>{this.applyMetaSlotPresence(event.target)}}static{this.defaultStrings={...super.defaultStrings,appRailItemCollapse:LYRA_DEFAULT_appRailItemCollapse,appRailItemExpand:LYRA_DEFAULT_appRailItemExpand}}static{this.styles=[LyraElement.styles,styles]}static get observedAttributes(){return[...super.observedAttributes,"icon-only"]}get expanded(){return this._expanded}set expanded(next){const old=this._expanded;this._expanded=next,markVetoGuardWrite(this.toggleGuard),this.requestUpdate("expanded",old)}get hasChildrenSlotted(){return Array.from(this.children).some(el=>el.getAttribute("slot")==="children")}connectedCallback(){super.connectedCallback(),this.armLabelObserver(),this.armChildrenObserver(),this.syncOwnedChildren()}armLabelObserver(){this.labelObserver?.disconnect();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.labelObserver=new MutationObserverCtor(()=>{this.showTooltip&&this.requestUpdate()}),this.labelObserver.observe(this,{childList:!0,characterData:!0,subtree:!0}))}armChildrenObserver(){this.childrenObserver?.disconnect();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.childrenObserver=new MutationObserverCtor(()=>{this.syncOwnedChildren(),this.requestUpdate()}),this.childrenObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}))}syncOwnedChildren(){if(!this.isConnected)return;const iconOnly=this.hasAttribute("icon-only"),itemTag=tag("app-rail-item");for(const node of this.querySelectorAll(itemTag))(node.parentElement?.closest(itemTag)??null)===this&&node.toggleAttribute("icon-only",iconOnly)}get labelText(){return Array.from(this.childNodes).filter(node=>{if(node.nodeType===3)return!0;if(node.nodeType!==1)return!1;const slot=node.getAttribute("slot");return slot!=="icon"&&slot!=="children"}).map(n=>n.textContent??"").join("").trim()}get tooltipText(){return hostAriaLabel(this)??(this.labelText||"")}applyEndSlotPresence(slot){this.hasEndSlot=slot.assignedNodes({flatten:!0}).some(node=>node.nodeType!==3||(node.textContent??"").trim()!=="")}applyMetaSlotPresence(slot){this.hasMetaSlot=slot.assignedNodes({flatten:!0}).some(node=>node.nodeType!==3||(node.textContent??"").trim()!=="")}attributeChangedCallback(name,oldValue,newValue){super.attributeChangedCallback(name,oldValue,newValue),!(name!=="icon-only"||oldValue===newValue)&&(newValue===null&&(this.showTooltip=!1),this.syncOwnedChildren(),this.requestUpdate())}firstUpdated(changed){super.firstUpdated(changed);const metaSlot=this.metaSlot,endSlot=this.endSlot;queueMicrotask(()=>{collectInitialSlotAssignment(metaSlot,s=>this.applyMetaSlotPresence(s)),collectInitialSlotAssignment(endSlot,s=>this.applyEndSlotPresence(s))})}willUpdate(changed){if(super.willUpdate(changed),changed.has("tooltip")&&!this.tooltip&&(this.showTooltip=!1),changed.has("href")||changed.has("disabled")){const previous=this.renderRoot?.querySelector('[part="base"]')??null,nextIsLink=!!safeLinkHref(this.href)&&!this.disabled,ownerReplaced=previous!==null&&previous.localName==="a"!==nextIsLink;this.semanticFocusRepair=ownerReplaced&&activeElementIn(this.shadowRoot)===previous?captureComposedFocusRepair(this,this.focusFallback()??previous)??void 0:void 0}}updated(changed){super.updated(changed);const focusRepair=this.semanticFocusRepair;this.semanticFocusRepair=void 0,focusRepair&&this.scheduleAfterUpdate(()=>{const replacement=this.renderRoot.querySelector('[part="base"]'),target=replacement&&isComposedFocusAvailable(replacement)?replacement:this.focusFallback();applyComposedFocusRepair(focusRepair,target)},"app-rail-item-owner-focus");const popup=this.renderRoot.querySelector('[part="tooltip"]');if(!popup){this.stopPositioning?.(),this.stopPositioning=void 0;return}if(changed.has("showTooltip")||!this.stopPositioning){this.stopPositioning?.();const anchor=this.renderRoot.querySelector('[part="base"]');this.stopPositioning=place(anchor,popup,{placement:rtlAwarePlacement("right",this),strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")})}}disconnectedCallback(){super.disconnectedCallback(),this.semanticFocusRepair=void 0,this.focusReturnTarget=void 0,this.labelObserver?.disconnect(),this.labelObserver=void 0,this.childrenObserver?.disconnect(),this.childrenObserver=void 0,this.stopPositioning?.(),this.stopPositioning=void 0,this.showTooltip=!1}focusFallback(){if(this.focusReturnTarget&&isComposedFocusAvailable(this.focusReturnTarget))return this.focusReturnTarget;const owner=this.closest("lr-app-rail")?.shadowRoot?.querySelector('[part~="base"], [part~="panel"]')??null;return owner&&isComposedFocusAvailable(owner)?owner:null}click(){this.disabled||this.renderRoot.querySelector('[part~="base"]')?.click()}render(){const label=hostAriaLabel(this),href=safeLinkHref(this.href),content=html`
|
|
2
2
|
${this.current?html`<span part="current-indicator" aria-hidden="true"></span>`:nothing}
|
|
3
3
|
${renderInertPresentation(html`<slot name="icon"></slot>`,{part:"icon"})}
|
|
4
4
|
<span part="label"><slot></slot></span>
|
|
@@ -6,31 +6,36 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
6
6
|
><slot name="meta" @slotchange=${this.onMetaSlotChange}></slot></span
|
|
7
7
|
><span part="end" ?hidden=${!this.hasEndSlot}
|
|
8
8
|
><slot name="end" @slotchange=${this.onEndSlotChange}></slot></span
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
9
|
+
>`,hasChildren=this.hasChildrenSlotted,toggle=hasChildren?html`<button
|
|
10
|
+
part="toggle"
|
|
11
|
+
type="button"
|
|
12
|
+
aria-expanded=${this._expanded?"true":"false"}
|
|
13
|
+
aria-controls=${this.childrenId}
|
|
14
|
+
aria-label=${this.localize(this._expanded?"appRailItemCollapse":"appRailItemExpand",void 0,{label:this.tooltipText})}
|
|
15
|
+
@click=${this.onToggleClick}
|
|
16
|
+
><span part="toggle-icon" aria-hidden="true">${chevronIcon()}</span></button>`:nothing,childrenList=hasChildren?html`<span part="children" id=${this.childrenId} ?hidden=${!this._expanded}
|
|
17
|
+
><slot name="children"></slot
|
|
18
|
+
></span>`:nothing,row=href&&!this.disabled?html`<a
|
|
19
|
+
part="base"
|
|
20
|
+
href=${href}
|
|
21
|
+
target=${this.target||nothing}
|
|
22
|
+
rel=${this.target?"noopener noreferrer":nothing}
|
|
23
|
+
aria-label=${label??nothing}
|
|
24
|
+
aria-disabled="false"
|
|
25
|
+
aria-current=${this.current?"page":"false"}
|
|
26
|
+
@mouseenter=${this.onFocusShow}
|
|
27
|
+
@mouseleave=${this.onBlurHide}
|
|
28
|
+
@focus=${this.onFocusShow}
|
|
29
|
+
@blur=${this.onBlurHide}
|
|
30
|
+
>${content}</a>${adornments}${toggle}${tooltip}`:html`<button
|
|
31
|
+
part="base"
|
|
32
|
+
type="button"
|
|
33
|
+
?disabled=${this.disabled}
|
|
34
|
+
aria-disabled=${this.disabled?"true":"false"}
|
|
35
|
+
aria-label=${label??nothing}
|
|
36
|
+
aria-current=${this.current?"page":"false"}
|
|
37
|
+
@mouseenter=${this.onFocusShow}
|
|
38
|
+
@mouseleave=${this.onBlurHide}
|
|
39
|
+
@focus=${this.onFocusShow}
|
|
40
|
+
@blur=${this.onBlurHide}
|
|
41
|
+
>${content}</button>${adornments}${toggle}${tooltip}`;return html`<div class="row">${row}</div>${childrenList}`}}__decorate([property()],LyraAppRailItem.prototype,"href",void 0),__decorate([property()],LyraAppRailItem.prototype,"target",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraAppRailItem.prototype,"disabled",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraAppRailItem.prototype,"current",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraAppRailItem.prototype,"tooltip",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraAppRailItem.prototype,"expanded",null),__decorate([state()],LyraAppRailItem.prototype,"showTooltip",void 0),__decorate([state()],LyraAppRailItem.prototype,"hasEndSlot",void 0),__decorate([state()],LyraAppRailItem.prototype,"hasMetaSlot",void 0),__decorate([query('slot[name="meta"]')],LyraAppRailItem.prototype,"metaSlot",void 0),__decorate([query('slot[name="end"]')],LyraAppRailItem.prototype,"endSlot",void 0);export{LyraAppRailItem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from"lit";const styles=css`:host{align-items:center;gap:var(--lr-app-rail-item-gap,var(--lr-space-s));inline-size:100%;display:flex}[part=base]{justify-content:flex-start;align-items:center;gap:var(--lr-app-rail-item-gap,var(--lr-space-s));inline-size:100%;min-inline-size:0;min-block-size:max(var(--lr-icon-button-size), var(--lr-app-rail-item-min-block-size,var(--lr-icon-button-size)));padding:var(--lr-app-rail-item-padding,var(--lr-space-s));border-radius:var(--lr-radius);color:var(--lr-color-text);font:inherit;font-size:var(--lr-app-rail-item-font-size,inherit);text-align:start;cursor:pointer;transition:background-color var(--lr-transition-fast), color var(--lr-transition-fast);background:0 0;border:0;flex:auto;text-decoration:none;display:flex;position:relative}[part=base]:not([aria-disabled=true]):hover{background:var(--lr-app-rail-item-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-app-rail-item-hover-color,var(--lr-color-brand))}[part=base]:not([aria-disabled=true]):active{background:var(--lr-app-rail-item-active-bg,color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)));color:var(--lr-app-rail-item-active-color,var(--lr-color-brand))}[part=base]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=base][aria-disabled=true]{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part=base][aria-current=page]{background:var(--lr-app-rail-item-current-bg,var(--lr-color-brand-quiet));color:var(--lr-app-rail-item-current-color,var(--lr-color-brand));font-weight:var(--lr-app-rail-item-current-font-weight,var(--lr-font-weight-semibold))}[part=current-indicator]{inset-block:0;inset-inline:var(--lr-app-rail-item-current-indicator-inset-inline,0 auto);inline-size:var(--lr-app-rail-item-current-indicator-width,var(--lr-size-2px));box-sizing:border-box;border-radius:var(--lr-radius-xs);background:var(--lr-app-rail-item-current-indicator-color,var(--lr-color-brand));pointer-events:none;z-index:var(--lr-layer-content);position:absolute}[part=icon]{inline-size:var(--lr-app-rail-item-icon-size,var(--lr-icon-button-size));min-inline-size:var(--lr-app-rail-item-icon-size,var(--lr-icon-button-size));flex:none;justify-content:center;align-items:center;display:inline-flex}[part=meta],[part=end]{flex:none;align-items:center;display:inline-flex}[part=meta][hidden],[part=end][hidden]{display:none}[part=meta]{color:var(--lr-app-rail-item-meta-color,var(--lr-color-text-quiet));font-size:var(--lr-app-rail-item-meta-font-size,var(--lr-font-size-sm))}[part=label]{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;overflow:hidden}:host([icon-only]) [part=label]{inline-size:var(--lr-size-1px);block-size:var(--lr-size-1px);margin:var(--lr-size-neg-1px);clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;padding:0;position:absolute;overflow:hidden}:host([icon-only]) [part=base]{aspect-ratio:1;flex:none;justify-content:center;
|
|
1
|
+
import{css}from"lit";const styles=css`:host{gap:var(--lr-app-rail-item-gap,var(--lr-space-s));flex-direction:column;inline-size:100%;display:flex}.row{align-items:center;gap:var(--lr-app-rail-item-gap,var(--lr-space-s));inline-size:100%;display:flex}[part=base]{justify-content:flex-start;align-items:center;gap:var(--lr-app-rail-item-gap,var(--lr-space-s));inline-size:100%;min-inline-size:0;min-block-size:max(var(--lr-icon-button-size), var(--lr-app-rail-item-min-block-size,var(--lr-icon-button-size)));padding:var(--lr-app-rail-item-padding,var(--lr-space-s));border-radius:var(--lr-radius);color:var(--lr-color-text);font:inherit;font-size:var(--lr-app-rail-item-font-size,inherit);text-align:start;cursor:pointer;transition:background-color var(--lr-transition-fast), color var(--lr-transition-fast);background:0 0;border:0;flex:auto;text-decoration:none;display:flex;position:relative}[part=base]:not([aria-disabled=true]):hover{background:var(--lr-app-rail-item-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-app-rail-item-hover-color,var(--lr-color-brand))}[part=base]:not([aria-disabled=true]):active{background:var(--lr-app-rail-item-active-bg,color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)));color:var(--lr-app-rail-item-active-color,var(--lr-color-brand))}[part=base]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=base][aria-disabled=true]{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part=base][aria-current=page]{background:var(--lr-app-rail-item-current-bg,var(--lr-color-brand-quiet));color:var(--lr-app-rail-item-current-color,var(--lr-color-brand));font-weight:var(--lr-app-rail-item-current-font-weight,var(--lr-font-weight-semibold));box-shadow:var(--lr-app-rail-item-current-ring,none)}[part=current-indicator]{inset-block:0;inset-inline:var(--lr-app-rail-item-current-indicator-inset-inline,0 auto);inline-size:var(--lr-app-rail-item-current-indicator-width,var(--lr-size-2px));box-sizing:border-box;border-radius:var(--lr-radius-xs);background:var(--lr-app-rail-item-current-indicator-color,var(--lr-color-brand));pointer-events:none;z-index:var(--lr-layer-content);position:absolute}[part=icon]{inline-size:var(--lr-app-rail-item-icon-size,var(--lr-icon-button-size));min-inline-size:var(--lr-app-rail-item-icon-size,var(--lr-icon-button-size));flex:none;justify-content:center;align-items:center;display:inline-flex}[part=meta],[part=end]{flex:none;align-items:center;display:inline-flex}[part=meta][hidden],[part=end][hidden]{display:none}[part=meta]{color:var(--lr-app-rail-item-meta-color,var(--lr-color-text-quiet));font-size:var(--lr-app-rail-item-meta-font-size,var(--lr-font-size-sm))}[part=label]{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;overflow:hidden}:host([icon-only]) [part=label]{inline-size:var(--lr-size-1px);block-size:var(--lr-size-1px);margin:var(--lr-size-neg-1px);clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;padding:0;position:absolute;overflow:hidden}:host([icon-only]) [part=base]{inline-size:var(--lr-app-rail-item-icon-only-size,auto);block-size:var(--lr-app-rail-item-icon-only-size,auto);min-block-size:var(--lr-app-rail-item-icon-only-size,max(var(--lr-icon-button-size), var(--lr-app-rail-item-min-block-size,var(--lr-icon-button-size))));aspect-ratio:1;flex:none;justify-content:center;padding-inline:0}:host([icon-only]) .row{justify-content:center}:host([icon-only]) [part=current-indicator]{display:var(--lr-app-rail-item-current-indicator-display,none)}:host([icon-only]) [part=base][aria-current=page]{box-shadow:var(--lr-app-rail-item-current-ring,inset 0 0 0 var(--lr-border-width-thin) var(--lr-app-rail-item-current-indicator-color,var(--lr-color-brand)))}:host([icon-only]) [part=meta]{inline-size:var(--lr-size-1px);block-size:var(--lr-size-1px);clip-path:inset(50%);white-space:nowrap;border:0;padding:0;overflow:hidden}[part=toggle]{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);aspect-ratio:1;border-radius:var(--lr-radius);color:inherit;font:inherit;cursor:pointer;transition:background-color var(--lr-transition-fast), color var(--lr-transition-fast);background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:flex}[part=toggle]:hover{background:var(--lr-app-rail-item-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-app-rail-item-hover-color,var(--lr-color-brand))}[part=toggle]:active{background:var(--lr-app-rail-item-active-bg,color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)));color:var(--lr-app-rail-item-active-color,var(--lr-color-brand))}[part=toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=toggle-icon]{transition:transform var(--lr-transition-fast);flex:none;display:inline-flex;transform:rotate(90deg)}[part=toggle]:where([aria-expanded=false]) [part=toggle-icon]{transform:none}:host(:dir(rtl)) [part=toggle]:where([aria-expanded=false]) [part=toggle-icon]{transform:rotate(180deg)}[part=children]{gap:var(--lr-app-rail-item-gap,var(--lr-space-s));flex-direction:column;inline-size:100%;padding-inline-start:var(--lr-app-rail-item-indent,var(--lr-space-l));display:flex}[part=children][hidden]{display:none}@media (prefers-reduced-motion:reduce){[part=toggle],[part=toggle-icon]{transition:none!important}}[part=tooltip]{z-index:var(--lr-layer-dropdown);padding:var(--lr-size-0-25rem) var(--lr-space-s);border-radius:var(--lr-radius);background:var(--lr-color-text);color:var(--lr-color-surface);font-size:var(--lr-font-size-sm);box-sizing:border-box;max-inline-size:var(--lr-positioner-available-inline-size,calc(100vw - 2 * var(--lr-space-s)));overflow-wrap:anywhere;white-space:normal;pointer-events:none;position:fixed}`;export{styles};
|
|
@@ -140,9 +140,27 @@ export declare function computeAppRailMode(iconOnlyMatches:boolean,mobileMatches
|
|
|
140
140
|
* @cssprop [--lr-app-rail-panel-inset-block-start=0] - Block-start (top) inset shared by
|
|
141
141
|
* `[part="panel"]` and `[part="backdrop"]` -- raise it to leave room for a fixed app bar/status
|
|
142
142
|
* area above the drawer instead of the panel/scrim starting flush with the viewport top.
|
|
143
|
-
* @cssprop [--lr-app-rail-panel-radius=0] -
|
|
144
|
-
* reproduces today's flush-edged drawer; pairs naturally with a nonzero
|
|
145
|
-
* `--lr-app-rail-panel-inset-block-start`, which exposes the panel's top corners.
|
|
143
|
+
* @cssprop [--lr-app-rail-panel-radius=0] - Uniform corner radius of `[part="panel"]`. `0` (the
|
|
144
|
+
* default) reproduces today's flush-edged drawer; pairs naturally with a nonzero
|
|
145
|
+
* `--lr-app-rail-panel-inset-block-start`, which exposes the panel's top corners. Each per-corner
|
|
146
|
+
* token below defaults to this one, so setting only this token still rounds all four corners
|
|
147
|
+
* uniformly, exactly as before the per-corner tokens existed.
|
|
148
|
+
* @cssprop [--lr-app-rail-panel-radius-start-start=var(--lr-app-rail-panel-radius)] - Logical
|
|
149
|
+
* `border-start-start-radius` of `[part="panel"]` -- the corner at the drawer's own flush
|
|
150
|
+
* inline-start edge, block-start side.
|
|
151
|
+
* @cssprop [--lr-app-rail-panel-radius-start-end=var(--lr-app-rail-panel-radius)] - Logical
|
|
152
|
+
* `border-start-end-radius` of `[part="panel"]` -- the corner away from the flush inline-start
|
|
153
|
+
* edge, block-start side. One of the two corners a flush-against-one-edge drawer typically
|
|
154
|
+
* rounds.
|
|
155
|
+
* @cssprop [--lr-app-rail-panel-radius-end-start=var(--lr-app-rail-panel-radius)] - Logical
|
|
156
|
+
* `border-end-start-radius` of `[part="panel"]` -- the corner at the drawer's own flush
|
|
157
|
+
* inline-start edge, block-end side.
|
|
158
|
+
* @cssprop [--lr-app-rail-panel-radius-end-end=var(--lr-app-rail-panel-radius)] - Logical
|
|
159
|
+
* `border-end-end-radius` of `[part="panel"]` -- the corner away from the flush inline-start
|
|
160
|
+
* edge, block-end side. The other corner a flush-against-one-edge drawer typically rounds. All
|
|
161
|
+
* four per-corner tokens are logical, so which physical corner each one paints swaps under
|
|
162
|
+
* `dir="rtl"` with no second consumer rule -- the panel's own flush edge stays its logical
|
|
163
|
+
* inline-start regardless of direction.
|
|
146
164
|
* @cssprop [--lr-app-rail-panel-overflow-block=auto] - `[part="panel"]`'s logical
|
|
147
165
|
* `overflow-block`, paired with `--lr-app-rail-panel-overflow-inline` below.
|
|
148
166
|
* @cssprop [--lr-app-rail-panel-overflow-inline=clip] - `[part="panel"]`'s logical
|
|
@@ -163,6 +181,10 @@ export declare function computeAppRailMode(iconOnlyMatches:boolean,mobileMatches
|
|
|
163
181
|
* is deliberately themed as a modal surface, not the docked rail chrome.
|
|
164
182
|
* @cssprop [--lr-app-rail-header-padding=var(--lr-space-m)] - `[part="header"]`'s padding.
|
|
165
183
|
* @cssprop [--lr-app-rail-footer-padding=var(--lr-space-m)] - `[part="footer"]`'s padding.
|
|
184
|
+
* @cssprop [--lr-app-rail-nav-padding=var(--lr-space-s)] - `[part="nav"]`'s padding, unset
|
|
185
|
+
* reproducing the value this rule hard-coded before the token existed.
|
|
186
|
+
* @cssprop [--lr-app-rail-nav-gap=var(--lr-space-xs)] - Gap between slotted items inside
|
|
187
|
+
* `[part="nav"]`, unset reproducing the value this rule hard-coded before the token existed.
|
|
166
188
|
* @cssprop [--lr-app-rail-header-min-block-size=auto] - `[part="header"]`'s minimum block size.
|
|
167
189
|
* `auto` (the default) is the property's own initial value, so unset reproduces today's exact
|
|
168
190
|
* height; set it to reserve room for header content that mounts or resizes asynchronously.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from"lit";const styles=css`:host{--_lr-app-rail-width:var(--lr-size-15rem);--_lr-app-rail-icon-width:var(--lr-size-4rem);--_lr-app-rail-mobile-width:var(--lr-size-18rem);--_lr-app-rail-overlay-color:var(--lr-color-overlay);display:block;position:relative}[part=toggle]{font:inherit;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);color:var(--lr-color-text);cursor:pointer;justify-content:center;align-items:center;display:none}:host([mode=mobile]) [part=toggle]{display:inline-flex}:host([hide-toggle][mode=mobile]) [part=toggle]{display:none}:host([mode=mobile][open]) [part=toggle]{z-index:calc(var(--lr-overlay-stack-index,var(--lr-layer-modal)) + 2);position:relative}[part=panel]>[part=toggle]{flex:none;align-self:flex-end;margin-block-start:var(--lr-space-s);margin-inline-end:var(--lr-space-s)}:host([hide-toggle][mode=mobile]) [part=panel]>[part=toggle]{display:inline-flex}[part=toggle]:hover{background:var(--lr-app-rail-toggle-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-app-rail-toggle-hover-color,var(--lr-color-brand))}[part=toggle]:active{background:var(--lr-app-rail-toggle-active-bg,color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)));color:var(--lr-app-rail-toggle-active-color,var(--lr-color-brand))}[part=toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=backdrop]{z-index:var(--lr-overlay-stack-index,var(--lr-layer-modal));background:var(--lr-app-rail-overlay-color,var(--_lr-app-rail-overlay-color));position:fixed;inset-block-start:var(--lr-app-rail-panel-inset-block-start,0);inset-block-end:0;inset-inline:0}[part=base]{inline-size:var(--lr-app-rail-width,var(--_lr-app-rail-width));border-inline-end:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-app-rail-background,var(--lr-color-surface));block-size:100%;transition:inline-size var(--lr-transition-base);flex-direction:column;padding-block-end:var(--lr-safe-area-bottom);display:flex;position:relative;overflow:clip auto}:host([mode=icon-only]) [part=base]{inline-size:var(--lr-app-rail-icon-width,var(--_lr-app-rail-icon-width))}:host([dragging]) [part=base]{transition:none}[part=resizer]{inline-size:var(--lr-icon-button-size);min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);cursor:col-resize;touch-action:none;background:0 0;justify-content:center;align-items:stretch;display:flex;position:absolute;inset-block:0;inset-inline-end:calc(var(--lr-icon-button-size) * -.5)}[part=resizer-track]{inline-size:var(--lr-size-3px);transition:background-color var(--lr-transition-fast);background:0 0}[part=resizer]:hover [part=resizer-track]{background:var(--lr-app-rail-resizer-hover-bg,var(--lr-color-brand))}[part=resizer]:active [part=resizer-track]{background:var(--lr-app-rail-resizer-active-bg,color-mix(in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-active)))}[part=resizer]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=panel]{z-index:calc(var(--lr-overlay-stack-index,var(--lr-layer-modal)) + 1);inline-size:min(var(--lr-app-rail-mobile-width,var(--_lr-app-rail-mobile-width)), 85vw);
|
|
1
|
+
import{css}from"lit";const styles=css`:host{--_lr-app-rail-width:var(--lr-size-15rem);--_lr-app-rail-icon-width:var(--lr-size-4rem);--_lr-app-rail-mobile-width:var(--lr-size-18rem);--_lr-app-rail-overlay-color:var(--lr-color-overlay);display:block;position:relative}[part=toggle]{font:inherit;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);color:var(--lr-color-text);cursor:pointer;justify-content:center;align-items:center;display:none}:host([mode=mobile]) [part=toggle]{display:inline-flex}:host([hide-toggle][mode=mobile]) [part=toggle]{display:none}:host([mode=mobile][open]) [part=toggle]{z-index:calc(var(--lr-overlay-stack-index,var(--lr-layer-modal)) + 2);position:relative}[part=panel]>[part=toggle]{flex:none;align-self:flex-end;margin-block-start:var(--lr-space-s);margin-inline-end:var(--lr-space-s)}:host([hide-toggle][mode=mobile]) [part=panel]>[part=toggle]{display:inline-flex}[part=toggle]:hover{background:var(--lr-app-rail-toggle-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-app-rail-toggle-hover-color,var(--lr-color-brand))}[part=toggle]:active{background:var(--lr-app-rail-toggle-active-bg,color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)));color:var(--lr-app-rail-toggle-active-color,var(--lr-color-brand))}[part=toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=backdrop]{z-index:var(--lr-overlay-stack-index,var(--lr-layer-modal));background:var(--lr-app-rail-overlay-color,var(--_lr-app-rail-overlay-color));position:fixed;inset-block-start:var(--lr-app-rail-panel-inset-block-start,0);inset-block-end:0;inset-inline:0}[part=base]{inline-size:var(--lr-app-rail-width,var(--_lr-app-rail-width));border-inline-end:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-app-rail-background,var(--lr-color-surface));block-size:100%;transition:inline-size var(--lr-transition-base);flex-direction:column;padding-block-end:var(--lr-safe-area-bottom);display:flex;position:relative;overflow:clip auto}:host([mode=icon-only]) [part=base]{inline-size:var(--lr-app-rail-icon-width,var(--_lr-app-rail-icon-width))}:host([dragging]) [part=base]{transition:none}[part=resizer]{inline-size:var(--lr-icon-button-size);min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);cursor:col-resize;touch-action:none;background:0 0;justify-content:center;align-items:stretch;display:flex;position:absolute;inset-block:0;inset-inline-end:calc(var(--lr-icon-button-size) * -.5)}[part=resizer-track]{inline-size:var(--lr-size-3px);transition:background-color var(--lr-transition-fast);background:0 0}[part=resizer]:hover [part=resizer-track]{background:var(--lr-app-rail-resizer-hover-bg,var(--lr-color-brand))}[part=resizer]:active [part=resizer-track]{background:var(--lr-app-rail-resizer-active-bg,color-mix(in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-active)))}[part=resizer]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=panel]{z-index:calc(var(--lr-overlay-stack-index,var(--lr-layer-modal)) + 1);inline-size:min(var(--lr-app-rail-mobile-width,var(--_lr-app-rail-mobile-width)), 85vw);background:var(--lr-app-rail-panel-background,var(--lr-color-surface-overlay));box-shadow:var(--lr-shadow-l);overflow-block:var(--lr-app-rail-panel-overflow-block,auto);overflow-inline:var(--lr-app-rail-panel-overflow-inline,clip);transition:transform var(--lr-transition-base);border-start-start-radius:var(--lr-app-rail-panel-radius-start-start,var(--lr-app-rail-panel-radius,0));border-start-end-radius:var(--lr-app-rail-panel-radius-start-end,var(--lr-app-rail-panel-radius,0));border-end-end-radius:var(--lr-app-rail-panel-radius-end-end,var(--lr-app-rail-panel-radius,0));border-end-start-radius:var(--lr-app-rail-panel-radius-end-start,var(--lr-app-rail-panel-radius,0));flex-direction:column;padding-block-end:var(--lr-safe-area-bottom);display:flex;position:fixed;inset-block-start:var(--lr-app-rail-panel-inset-block-start,0);inset-block-end:0;inset-inline-start:0;transform:translate(-100%)}:host(:dir(rtl)) [part=panel]{transform:translate(100%)}:host([mode=mobile][open]) [part=panel]{transform:none}[part=header]{padding:var(--lr-app-rail-header-padding,var(--lr-space-m));min-block-size:var(--lr-app-rail-header-min-block-size,auto);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border)}[part=header][hidden]{display:none}:host([collapsible]:not([mode=mobile])) [part=header]{align-items:center;gap:var(--lr-space-s);display:flex}:host([collapsible][mode=icon-only]) [part=header]{justify-content:center}[part=collapse-toggle]{font:inherit;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);border-radius:var(--lr-radius);color:var(--lr-color-text);cursor:pointer;transition:var(--lr-transition-interactive);background:0 0;border:0;flex:none;justify-content:center;align-items:center;margin-inline-start:auto;padding:0;display:inline-flex}:host([collapsible][mode=icon-only]) [part=collapse-toggle]{margin-inline-start:0}[part=collapse-toggle]:hover{background:var(--lr-app-rail-collapse-toggle-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-app-rail-collapse-toggle-hover-color,var(--lr-color-brand))}[part=collapse-toggle]:active{background:var(--lr-app-rail-collapse-toggle-active-bg,color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active)));color:var(--lr-app-rail-collapse-toggle-active-color,var(--lr-color-brand))}[part=collapse-toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=collapse-icon]{display:inline-flex;transform:rotate(180deg)}[part=collapse-toggle]:where([aria-expanded=false]) [part=collapse-icon],:host(:dir(rtl)) [part=collapse-icon]{transform:none}:host(:dir(rtl)) [part=collapse-toggle]:where([aria-expanded=false]) [part=collapse-icon]{transform:rotate(180deg)}[part=footer]{padding:var(--lr-app-rail-footer-padding,var(--lr-space-m));border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border)}[part=footer][hidden]{display:none}[part=nav]{padding:var(--lr-app-rail-nav-padding,var(--lr-space-s));gap:var(--lr-app-rail-nav-gap,var(--lr-space-xs));flex-direction:column;flex:auto;display:flex;overflow:clip auto}:host([mode=icon-only]) [part=nav]{align-items:center}:host([mode=icon-only]) ::slotted(lr-app-rail-item){max-inline-size:var(--lr-app-rail-icon-width,var(--_lr-app-rail-icon-width))}@media (prefers-reduced-motion:reduce){[part=base],[part=panel],[part=collapse-toggle],[part=resizer-track]{transition:none!important}}`;export{styles};
|
|
@@ -98,7 +98,7 @@ collapsible:boolean;
|
|
|
98
98
|
* `trueDefaultBooleanConverter`: Lit's presence-based boolean converter cannot parse
|
|
99
99
|
* `open="false"`, so without it the property would be unsettable from markup.
|
|
100
100
|
* @default true */
|
|
101
|
-
get open():boolean;set open(next:boolean);private _open;private readonly toggleGuard;private hasHeadingSlot;private hasHeaderActionsSlot;private readonly headingId;private readonly contentId;private get safeHeadingLevel();connectedCallback():void;attributeChangedCallback(name:string,oldValue:string|null,newValue:string|null):void;protected updated(changed:PropertyValues):void;
|
|
101
|
+
get open():boolean;set open(next:boolean);private _open;private readonly toggleGuard;private hasHeadingSlot;private hasHeaderActionsSlot;private headingSlot?;private headerActionsSlot?;private readonly headingId;private readonly contentId;private get safeHeadingLevel();connectedCallback():void;attributeChangedCallback(name:string,oldValue:string|null,newValue:string|null):void;protected updated(changed:PropertyValues):void;protected firstUpdated(changed:PropertyValues):void;
|
|
102
102
|
/** Mirrors this group's `icon-only` state onto every `<lr-app-rail-item>` and nested
|
|
103
103
|
* `<lr-app-rail-group>` it DIRECTLY owns. The rail cannot reach these itself:
|
|
104
104
|
* `assignedElements({ flatten: true })` expands nested `<slot>` elements, not element children,
|
|
@@ -125,4 +125,4 @@ private syncOwnedItems;
|
|
|
125
125
|
* ran again). Gate on the UNFLATTENED list first -- it never contains fallback -- and flatten
|
|
126
126
|
* only once something really is assigned, which still resolves a consumer's forwarding
|
|
127
127
|
* `<slot>` down to its own (possibly empty) content. */
|
|
128
|
-
private onHeadingSlotChange;private onHeaderActionsSlotChange;private onContentSlotChange;private onToggleClick;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-app-rail-group':LyraAppRailGroup;}}
|
|
128
|
+
private onHeadingSlotChange;private applyHeadingSlotPresence;private onHeaderActionsSlotChange;private applyHeaderActionsSlotPresence;private onContentSlotChange;private onToggleClick;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-app-rail-group':LyraAppRailGroup;}}
|
|
@@ -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{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteRange}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{styles}from"./app-rail-group.styles.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_expand}from"../../../internal/default-strings.generated.js";class LyraAppRailGroup extends LyraElement{constructor(){super(...arguments),this.heading="",this.headingLevel=3,this.collapsible=!1,this._open=!0,this.toggleGuard=new VetoWriteGuard,this.hasHeadingSlot=!1,this.hasHeaderActionsSlot=!1,this.headingId=nextId("app-rail-group-heading"),this.contentId=nextId("app-rail-group-content"),this.onHeadingSlotChange=event=>{
|
|
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,query,state}from"lit/decorators.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteRange}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{styles}from"./app-rail-group.styles.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_expand}from"../../../internal/default-strings.generated.js";class LyraAppRailGroup extends LyraElement{constructor(){super(...arguments),this.heading="",this.headingLevel=3,this.collapsible=!1,this._open=!0,this.toggleGuard=new VetoWriteGuard,this.hasHeadingSlot=!1,this.hasHeaderActionsSlot=!1,this.headingId=nextId("app-rail-group-heading"),this.contentId=nextId("app-rail-group-content"),this.onHeadingSlotChange=event=>{this.applyHeadingSlotPresence(event.target)},this.onHeaderActionsSlotChange=event=>{this.applyHeaderActionsSlotPresence(event.target)},this.onContentSlotChange=()=>{this.syncOwnedItems()},this.onToggleClick=()=>{const next=!this._open;requestThenCommit({requestDetail:{open:next},emitRequest:(detail,init)=>this.emit("lr-toggle-request",detail,init),guard:this.toggleGuard,commit:()=>{this.open=next,this.emit("lr-toggle",{open:next})}})}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,expand:LYRA_DEFAULT_expand}}static{this.styles=[LyraElement.styles,styles]}static get observedAttributes(){return[...super.observedAttributes,"icon-only"]}get open(){return this._open}set open(next){const old=this._open;this._open=next,markVetoGuardWrite(this.toggleGuard),this.requestUpdate("open",old)}get safeHeadingLevel(){return Math.round(finiteRange(this.headingLevel,3,1,6))}connectedCallback(){super.connectedCallback(),this.syncOwnedItems()}attributeChangedCallback(name,oldValue,newValue){super.attributeChangedCallback(name,oldValue,newValue),!(name!=="icon-only"||oldValue===newValue)&&(this.syncOwnedItems(),this.requestUpdate())}updated(changed){super.updated(changed),this.syncOwnedItems()}firstUpdated(changed){super.firstUpdated(changed);const headingSlot=this.headingSlot,headerActionsSlot=this.headerActionsSlot;queueMicrotask(()=>{collectInitialSlotAssignment(headingSlot,s=>this.applyHeadingSlotPresence(s)),collectInitialSlotAssignment(headerActionsSlot,s=>this.applyHeaderActionsSlotPresence(s))})}syncOwnedItems(){if(!this.isConnected)return;const iconOnly=this.hasAttribute("icon-only"),groupTag=tag("app-rail-group");for(const node of this.querySelectorAll(`${tag("app-rail-item")}, ${groupTag}`))(node.parentElement?.closest(groupTag)??null)===this&&node.toggleAttribute("icon-only",iconOnly)}applyHeadingSlotPresence(slot){this.hasHeadingSlot=slot.assignedNodes().length>0&&slot.assignedNodes({flatten:!0}).length>0}applyHeaderActionsSlotPresence(slot){this.hasHeaderActionsSlot=slot.assignedNodes({flatten:!0}).some(node=>node.nodeType!==3||(node.textContent??"").trim()!=="")}render(){const named=this.hasHeadingSlot||this.heading.trim()!=="",headingContent=html`<span part="heading-text"
|
|
2
2
|
><slot name="heading" @slotchange=${this.onHeadingSlotChange}
|
|
3
3
|
>${this.hasHeadingSlot?nothing:this.heading}</slot
|
|
4
4
|
></span
|
|
@@ -33,4 +33,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
33
33
|
<slot @slotchange=${this.onContentSlotChange}></slot>
|
|
34
34
|
</div>
|
|
35
35
|
</div>
|
|
36
|
-
`}}__decorate([property()],LyraAppRailGroup.prototype,"heading",void 0),__decorate([property({type:Number,attribute:"heading-level"})],LyraAppRailGroup.prototype,"headingLevel",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraAppRailGroup.prototype,"collapsible",void 0),__decorate([property({type:Boolean,reflect:!0,converter:trueDefaultBooleanConverter})],LyraAppRailGroup.prototype,"open",null),__decorate([state()],LyraAppRailGroup.prototype,"hasHeadingSlot",void 0),__decorate([state()],LyraAppRailGroup.prototype,"hasHeaderActionsSlot",void 0);export{LyraAppRailGroup};
|
|
36
|
+
`}}__decorate([property()],LyraAppRailGroup.prototype,"heading",void 0),__decorate([property({type:Number,attribute:"heading-level"})],LyraAppRailGroup.prototype,"headingLevel",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraAppRailGroup.prototype,"collapsible",void 0),__decorate([property({type:Boolean,reflect:!0,converter:trueDefaultBooleanConverter})],LyraAppRailGroup.prototype,"open",null),__decorate([state()],LyraAppRailGroup.prototype,"hasHeadingSlot",void 0),__decorate([state()],LyraAppRailGroup.prototype,"hasHeaderActionsSlot",void 0),__decorate([query('slot[name="heading"]')],LyraAppRailGroup.prototype,"headingSlot",void 0),__decorate([query('slot[name="header-actions"]')],LyraAppRailGroup.prototype,"headerActionsSlot",void 0);export{LyraAppRailGroup};
|
|
@@ -95,7 +95,7 @@ accessibleLabel?:string;private hostAccessibleLabel;private slideSlot?;private v
|
|
|
95
95
|
* to rest on is published once the stream goes quiet. Scheduled on -- and cancelled through --
|
|
96
96
|
* the realm this carousel lives in at the time, so one adopted into another document neither
|
|
97
97
|
* leaves a task behind on the old realm nor loses the ability to cancel the new one. */
|
|
98
|
-
private readonly scrollSettle;private adoptingScrolledSlide;private hasAlignedOnce;private alignIndex?;private alignTarget?;private requestedBehavior?;private loopSide?;private loopClonesDirty;private pointerInteracting;private focusInteracting;private dragPointerId?;private dragStartCoordinate;private dragStartScroll;private dragMoved;private suppressClick;private clickTimer?;private clickTimerWindow?;private announcementSink?;private announcementsArmed;private changeOrigin;private manualPending;private observer?;private observerDocument?;private observerGeneration;private lastFocusedSlide?;constructor();attributeChangedCallback(name:string,oldValue:string|null,newValue:string|null):void;connectedCallback():void;disconnectedCallback():void;private armSlideContentObserver;private resetSlideContentObserver;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private setCurrentSlideState;private setPaginationState;private onMotionPreferenceChange;private onVisibilityChange;private queueOwnerMicrotask;private effectiveOrientation;private slideElements;private pageSize;private moveSize;private maxStartIndex;private normalizedIndex;private pageTargets;private visibleIndices;private announceActivePage;private restoreAttribute;private snapshotSlide;private adoptChanges;private restoreSlide;private restoreSlides;private syncSlides;
|
|
98
|
+
private readonly scrollSettle;private adoptingScrolledSlide;private hasAlignedOnce;private alignIndex?;private alignTarget?;private requestedBehavior?;private loopSide?;private loopClonesDirty;private pointerInteracting;private focusInteracting;private dragPointerId?;private dragStartCoordinate;private dragStartScroll;private dragMoved;private suppressClick;private clickTimer?;private clickTimerWindow?;private announcementSink?;private announcementsArmed;private changeOrigin;private manualPending;private observer?;private observerDocument?;private observerGeneration;private lastFocusedSlide?;constructor();attributeChangedCallback(name:string,oldValue:string|null,newValue:string|null):void;connectedCallback():void;disconnectedCallback():void;private armSlideContentObserver;private resetSlideContentObserver;protected willUpdate(changed:PropertyValues):void;protected firstUpdated(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private setCurrentSlideState;private setPaginationState;private onMotionPreferenceChange;private onVisibilityChange;private queueOwnerMicrotask;private effectiveOrientation;private slideElements;private pageSize;private moveSize;private maxStartIndex;private normalizedIndex;private pageTargets;private visibleIndices;private announceActivePage;private restoreAttribute;private snapshotSlide;private adoptChanges;private restoreSlide;private restoreSlides;private syncSlides;
|
|
99
99
|
/** Moves focus while the outgoing slide is still operable. Setting `inert` first lets the
|
|
100
100
|
* platform strand focus on the document body, outside this carousel's keyboard handler. The
|
|
101
101
|
* remembered-slide branch covers direct light-DOM removal, where slotchange necessarily runs
|