@aceshooting/lyra-ui 30.9.0 → 31.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 +236 -339
- package/dist/ai/adapters/ag-ui.js +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.js +1 -1
- package/dist/components/agent-tools/compare-panel/compare-panel.class.js +1 -1
- package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +1 -1
- package/dist/components/agent-tools/thinking-panel/thinking-panel.class.js +1 -1
- package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.js +1 -1
- package/dist/components/charts/chart/box-plot.class.js +2 -2
- package/dist/components/charts/chart/chart-sync.js +1 -1
- package/dist/components/charts/chart/chart.class.d.ts +1 -1
- package/dist/components/charts/chart/chart.class.js +4 -4
- package/dist/components/charts/chart/lite-chart-axis-layout.js +1 -1
- package/dist/components/charts/chart/lite-chart.class.js +1 -1
- package/dist/components/conversation/chat-composer/chat-composer.class.d.ts +9 -4
- package/dist/components/conversation/chat-composer/chat-composer.class.js +1 -1
- package/dist/components/conversation/chat-composer/chat-composer.styles.js +1 -1
- package/dist/components/conversation/chat-message/chat-message.class.d.ts +27 -3
- package/dist/components/conversation/chat-message/chat-message.class.js +14 -12
- package/dist/components/conversation/chat-message/chat-message.styles.js +1 -1
- package/dist/components/conversation/chat-viewport/chat-viewport.class.d.ts +29 -2
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +2 -2
- package/dist/components/conversation/chat-viewport/chat-viewport.styles.js +1 -1
- package/dist/components/conversation/code-block/code-block-shared.js +1 -1
- package/dist/components/conversation/markdown/markdown-base.class.d.ts +1 -1
- package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-code-header.js +1 -1
- package/dist/components/conversation/markdown/markdown-core.class.d.ts +10 -0
- package/dist/components/conversation/markdown/markdown-core.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-shared.d.ts +7 -2
- package/dist/components/conversation/markdown/markdown-shared.js +3 -3
- package/dist/components/conversation/markdown/markdown.class.d.ts +10 -0
- package/dist/components/conversation/markdown/markdown.class.js +1 -1
- package/dist/components/conversation/message-feedback/message-feedback.class.js +2 -2
- package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
- package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +2 -1
- package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +4 -0
- package/dist/components/conversation/streaming-text/streaming-text-base.class.js +1 -1
- package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +1 -1
- package/dist/components/conversation/streaming-text/streaming-text-core.class.js +1 -0
- package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +1 -1
- package/dist/components/conversation/streaming-text/streaming-text.class.js +1 -0
- package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +17 -3
- package/dist/components/conversation/suggestion-chips/suggestion-chips.class.js +3 -3
- package/dist/components/conversation/suggestion-chips/suggestion-chips.d.ts +1 -1
- package/dist/components/conversation/suggestion-chips/suggestion-chips.js +1 -1
- package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
- package/dist/components/conversation/thread-list/thread-list.class.js +2 -2
- package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
- package/dist/components/data/data-grid/data-grid.class.d.ts +10 -10
- package/dist/components/data/data-grid/data-grid.class.js +1 -1
- package/dist/components/data/file-tree/file-tree.class.js +1 -1
- package/dist/components/data/flow-canvas/flow-canvas.class.js +1 -1
- package/dist/components/data/heatmap/heatmap.class.d.ts +1 -1
- package/dist/components/data/heatmap/heatmap.class.js +1 -1
- package/dist/components/data/pagination/pagination.class.js +1 -1
- package/dist/components/data/table/table.class.d.ts +31 -2
- package/dist/components/data/table/table.class.js +3 -3
- package/dist/components/data/table/table.styles.js +1 -1
- package/dist/components/data/timeline/timeline-cluster.js +1 -1
- package/dist/components/data/timeline/timeline-item.class.d.ts +10 -3
- package/dist/components/data/timeline/timeline-item.class.js +16 -12
- package/dist/components/data/timeline/timeline-item.styles.js +1 -1
- package/dist/components/data/timeline/timeline.class.d.ts +14 -2
- package/dist/components/data/timeline/timeline.class.js +9 -5
- package/dist/components/data/tree/tree-item.class.js +1 -1
- package/dist/components/data/tree/tree.class.d.ts +2 -0
- package/dist/components/data/tree/tree.class.js +1 -1
- package/dist/components/forms/button/button.class.d.ts +8 -6
- package/dist/components/forms/button/button.class.js +2 -2
- package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
- package/dist/components/forms/color-picker/color-core.js +1 -1
- package/dist/components/forms/date-picker/date-input.class.d.ts +1 -1
- package/dist/components/forms/date-picker/date-input.class.js +1 -1
- package/dist/components/forms/icon-button/icon-button.class.d.ts +4 -2
- package/dist/components/forms/icon-button/icon-button.class.js +2 -2
- package/dist/components/forms/input/input-shared.js +2 -2
- package/dist/components/forms/input/number-input-locale.js +1 -0
- package/dist/components/forms/input/number-input.class.d.ts +19 -2
- package/dist/components/forms/input/number-input.class.js +2 -2
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +3 -3
- package/dist/components/forms/locale-picker/locale-picker.class.js +1 -1
- package/dist/components/layout/app-rail-group/app-rail-group.class.js +1 -1
- package/dist/components/layout/details/accordion-item.class.js +1 -1
- package/dist/components/layout/menu/menu.class.js +1 -1
- package/dist/components/layout/multi-split/multi-split.class.js +1 -1
- package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.js +1 -1
- package/dist/components/layout/tab-group/tab-group.class.d.ts +8 -1
- package/dist/components/layout/tab-group/tab-group.class.js +1 -1
- package/dist/components/layout/tab-group/tab.class.d.ts +7 -1
- package/dist/components/layout/tab-group/tab.class.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.class.d.ts +2 -2
- package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
- package/dist/components/media/animated-image/animated-image.class.js +1 -1
- package/dist/components/media/attachment-chip/attachment-chip.class.d.ts +21 -14
- package/dist/components/media/attachment-chip/attachment-chip.class.js +1 -1
- package/dist/components/media/attachment-trigger/attachment-trigger.class.d.ts +36 -12
- package/dist/components/media/attachment-trigger/attachment-trigger.class.js +3 -3
- package/dist/components/media/drop-zone/drop-zone.class.d.ts +23 -5
- package/dist/components/media/drop-zone/drop-zone.class.js +2 -2
- package/dist/components/media/drop-zone/drop-zone.styles.js +1 -1
- package/dist/components/media/file-icon/file-icon.class.js +1 -1
- package/dist/components/media/flag/flag-url-resolver.js +1 -1
- package/dist/components/media/image-viewer/image-viewer.class.d.ts +2 -2
- package/dist/components/media/image-viewer/image-viewer.class.js +1 -1
- package/dist/components/media/map/map-owned-features.js +1 -1
- package/dist/components/media/map/map-scene-elevated-lines.js +2 -2
- package/dist/components/media/map/map-scene-render-controller.js +1 -1
- package/dist/components/media/map/map.class.d.ts +5 -5
- package/dist/components/media/map/map.class.js +3 -3
- package/dist/components/media/pan-zoom/pan-zoom.class.js +1 -1
- package/dist/components/media/video/video.class.d.ts +3 -3
- package/dist/components/media/video/video.class.js +3 -1
- package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
- package/dist/components/overlays/chip/chip.class.js +1 -1
- package/dist/components/overlays/overlay/dropdown.class.js +1 -1
- package/dist/components/overlays/overlay/tooltip.class.d.ts +5 -1
- package/dist/components/overlays/overlay/tooltip.class.js +3 -3
- package/dist/components/retrieval/embedding-explorer/embedding-explorer-engine.js +1 -1
- package/dist/components/retrieval/graph/graph-node-renderer.js +1 -1
- package/dist/components/retrieval/graph/graph-spatial-controller.js +1 -1
- package/dist/components/retrieval/graph/graph.class.d.ts +1 -1
- package/dist/components/retrieval/graph/graph.class.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map.class.js +1 -1
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +1 -1
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +3 -3
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +1 -1
- package/dist/components/utility/json-viewer/json-viewer.class.d.ts +16 -1
- package/dist/components/utility/json-viewer/json-viewer.class.js +4 -4
- 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.js +1 -1
- package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
- package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
- package/dist/components/viewers/csv-viewer/csv-viewer.class.js +1 -1
- package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +1 -1
- package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
- package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
- package/dist/components/viewers/include/include.class.js +1 -1
- package/dist/components/viewers/model-viewer/model-viewer.class.js +1 -1
- package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +1 -1
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +2 -2
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
- package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +1 -1
- package/dist/components/viewers/table-viewer-shared.js +4 -4
- package/dist/framework-types.d.ts +1 -1
- package/dist/internal/anchored-overlay-runtime.js +1 -1
- package/dist/internal/catalog-picker.js +1 -1
- package/dist/internal/document-tokens.js +2 -2
- package/dist/internal/drop-session-controller.js +1 -1
- package/dist/internal/engine-3d.js +1 -1
- package/dist/internal/icon-only-content.js +1 -1
- package/dist/internal/layered-layout.js +1 -1
- package/dist/internal/map-custom-layer-controller.js +1 -1
- package/dist/internal/media-panorama.js +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/safe-url.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/internal/scroll-overflow.js +1 -1
- package/dist/internal/source-window-controller.js +1 -1
- package/dist/internal/text-quote.js +1 -1
- package/dist/internal/viewer-search.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/dist/sequence-time-binding.js +1 -1
- package/dist/simulation-clock.js +1 -1
- package/dist/styles/reservations.css +1 -1
- package/dist/styles/reservations.styles.js +1 -1
- package/dist/testing/happy-dom-shims.js +1 -1
- package/dist/theme/theme.js +1 -1
- package/llms/components/lr-attachment-chip.md +27 -12
- package/llms/components/lr-attachment-trigger.md +27 -7
- package/llms/components/lr-button.md +6 -4
- package/llms/components/lr-chat-composer.md +13 -7
- package/llms/components/lr-chat-message.md +44 -3
- package/llms/components/lr-chat-viewport.md +39 -2
- package/llms/components/lr-data-grid.md +2 -0
- package/llms/components/lr-dialog.md +10 -0
- package/llms/components/lr-drop-zone.md +26 -2
- package/llms/components/lr-icon-button.md +2 -1
- package/llms/components/lr-json-viewer.md +17 -0
- package/llms/components/lr-locale-picker.md +5 -0
- package/llms/components/lr-markdown-core.md +2 -1
- package/llms/components/lr-markdown.md +20 -4
- package/llms/components/lr-menu.md +3 -1
- package/llms/components/lr-number-input.md +28 -1
- package/llms/components/lr-prompt-input.md +1 -1
- package/llms/components/lr-streaming-text-core.md +3 -2
- package/llms/components/lr-streaming-text.md +4 -1
- package/llms/components/lr-suggestion-chips.md +28 -5
- package/llms/components/lr-tab-group.md +13 -1
- package/llms/components/lr-tab.md +5 -0
- package/llms/components/lr-table.md +25 -4
- package/llms/components/lr-timeline-item.md +1 -1
- package/llms/components/lr-timeline.md +38 -4
- package/llms/components/lr-tooltip.md +3 -1
- package/llms/components/lr-tree.md +4 -0
- package/llms/components/lr-virtual-list.md +1 -0
- package/llms/peers.md +2 -2
- package/llms/shared/forms-and-accessibility.md +21 -4
- package/llms/shared.md +21 -4
- package/package.json +21 -20
- package/registrations.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{resolveIdReferencesIn}from"../../../internal/aria-reflection.js";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{ModalSurfaceController}from"../../../internal/modal-surface-controller.js";import{leaseInlineStyleProperty}from"../../../internal/style-property-lease.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{activateOverlay,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{isRtl}from"../../../internal/rtl.js";import{repairComposedFocus}from"../../../internal/focus-navigation.js";import{cancelDeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{nextId}from"../../../internal/a11y.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{finiteRange}from"../../../internal/numbers.js";import{SeparatorDragController,separatorArrowDirection,separatorCoordinate,separatorDelta}from"../../../internal/separator-drag.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{CollapseBreakpointController,OrientationBreakpointController}from"../../../internal/orientation-breakpoint.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{resolveCssLength}from"../../../internal/css-length.js";import{styles}from"./multi-split.styles.js";import{LYRA_DEFAULT_resizeDivider,LYRA_DEFAULT_resizeValuePercent}from"../../../internal/default-strings/layout.generated.js";const KEYBOARD_STEP=2;function isPersistedPanelLayout(value){if(typeof value!="object"||value===null)return!1;const candidate=value;if(candidate.version!==1&&candidate.version!==2||!Array.isArray(candidate.panels))return!1;const version=candidate.version;return candidate.panels.every(panel=>{if(typeof panel!="object"||panel===null)return!1;const record=panel;return version===2&&(record.collapsed!==void 0&&typeof record.collapsed!="boolean"||record.expandedSize!==void 0&&!(typeof record.expandedSize=="number"&&Number.isFinite(record.expandedSize)&&record.expandedSize>0))?!1:typeof record.panelId=="string"&&record.panelId!==""&&record.panelId.trim()===record.panelId&&typeof record.size=="number"&&Number.isFinite(record.size)&&record.size>=0})}const NO_COLLAPSED_PANELS=new Set,NO_MIN_PX=0,NO_MAX_PX=1e6,OWNED_PANEL_STYLE_PROPERTIES=["flex","order","inline-size","--_lr-multi-split-panel-min"],OWNED_PANEL_ATTRIBUTES=["data-collapse-state","data-panel-collapsed"];class LyraMultiSplit extends LyraElement{constructor(){super(...arguments),this.toggleProposalDepth=0,this.toggleProposalMutationVersion=0,this.forcedCloseVersion=0,this.sizes=[],this.defaultSizes=[],this.min=10,this.orientation="horizontal",this.orientationBreakpointBasis="container",this.narrowOrientation="vertical",this.panelConstraints=[],this.collapse="none",this.railWidth="3.5rem",this.railBreakpoint=640,this.floatBreakpoint=400,this.collapseBreakpointBasis="container",this.releasePinOnBreakpoint=!1,this.open=!1,this.trigger=null,this.for="",this.collapsedPanels=[],this.panelCount=0,this.sizesReconciledForMembership=!1,this.appliedCollapsed=[],this.expandedSizes=new Map,this._collapseState="wide",this._forced=!1,this.overlayActive=!1,this.justOpened=!1,this.nativeModal=new NativeModalCarrier(this,{onCancel:()=>{this.overlayHandle?.isTopmost()&&this.setOpen(!1)},onUnexpectedClose:()=>{this.overlayHandle?.isTopmost()&&this.setOpen(!1),this.overlayActive&&this.modalSurface.show()}}),this.modalSurface=new ModalSurfaceController(this,this.nativeModal,()=>this.baseEl??null),this.floatingGeometry=new Map,this.openingBlockSize=0,this.syncNativeModalGeometry=()=>{if(!this.overlayActive||!this.isConnected)return;const allocation=this.shadowRoot?.querySelector(".allocation"),reservation=this.shadowRoot?.querySelector(".allocation-reservation"),frame=this.nativeModal.requested?this.shadowRoot?.querySelector("[data-native-modal-carrier]"):this.baseEl;if(!allocation||!reservation||!frame)return;if(!this.nativeModalView){this.nativeModalView=this.ownerDocument.defaultView??void 0,this.nativeModalView?.addEventListener("scroll",this.syncNativeModalGeometry,!0),this.nativeModalView?.addEventListener("resize",this.syncNativeModalGeometry);const Observer=this.nativeModalView?.ResizeObserver;if(Observer){const observer=new Observer(this.syncNativeModalGeometry);this.nativeModalResizeObserver=observer,observer.observe(allocation)}}if(this.floatingFrame!==frame){for(const lease of this.floatingGeometry.values())lease.release();this.floatingGeometry.clear(),this.floatingFrame=frame}const set=(property2,value)=>{const lease=this.floatingGeometry.get(property2);lease?(frame.style.getPropertyValue(property2)!==value||frame.style.getPropertyPriority(property2))&&lease.set(value):this.floatingGeometry.set(property2,leaseInlineStyleProperty(frame,property2,value))};if(reservation.hidden){const height=this.baseEl?.getBoundingClientRect().height??0;this.openingBlockSize=height||this.openingBlockSize||allocation.getBoundingClientRect().height,set("position","fixed"),reservation.style.blockSize=`${this.openingBlockSize}px`,reservation.hidden=!1}const rect=allocation.getBoundingClientRect();for(const[property2,value]of Object.entries({position:"fixed",top:`${rect.top}px`,left:`${rect.left}px`,right:"auto",bottom:"auto",width:`${rect.width}px`,height:`${rect.height}px`,padding:"0","box-sizing":"border-box","max-inline-size":"none"}))set(property2,value)},this.overlayReturnTarget=null,this.overlayOpener=null,this.floatingDialogPanel=null,this.floatingDialogPreviousRole=null,this.floatingDialogPreviousAriaModal=null,this.drags=new Map,this.dragController=new SeparatorDragController(this,event=>this.onPointerMove(event),event=>this.onPointerUp(event)),this.ownedPanels=[],this.panelOwnership=new Map,this.constraintIssueKey="",this.constraintConfigVersion=0,this.renderConstraintBounds=[],this.initializedSizes=!1,this.measuredInlineSize=Number.POSITIVE_INFINITY,this._effectiveOrientation="horizontal",this.collapseObserverGeneration=0,this.gutterObservedDividers=[],this.gutterObservedContainerSize=0,this.orientationBreakpoints=new OrientationBreakpointController(this,()=>this.updateEffectiveOrientation(this.measuredInlineSize,!0)),this.collapseBreakpoints=new CollapseBreakpointController(this,()=>this.updateCollapseState(this.measuredInlineSize,!0)),this.onSlotChange=()=>{this.updateBrowserDerivedState(()=>this.syncPanelMembership())},this.onBackdropClick=()=>{this.overlayHandle?.dismissBackdrop()},this.onModalLayerClick=event=>{event.target===this.baseEl&&this.overlayHandle?.dismissBackdrop()},this.onPointerDown=(e,index)=>{if(e.button!==0||this.isDividerDisabled(index))return;const divider=e.currentTarget;this.dragController.start(e,divider)&&this.drags.set(e.pointerId,{index,startPos:separatorCoordinate(e,this.effectiveOrientation==="vertical"?"block":"inline"),base:this.baseEl,rtl:this.effectiveOrientation==="horizontal"&&isRtl(this),appliedDelta:0,acceptedResize:!1})},this.onPointerMove=e=>{const drag=this.drags.get(e.pointerId);if(!drag)return;if(this.isDividerDisabled(drag.index)){this.endDragGestures();return}if(this.effectiveOrientation==="horizontal"&&isRtl(this)!==drag.rtl){this.endDragGestures();return}const total=this.effectiveOrientation==="vertical"?drag.base.clientHeight:drag.base.clientWidth;if(!Number.isFinite(total)||total<=0){this.endDragGestures();return}const incremental=separatorDelta(drag.startPos,e,this.effectiveOrientation==="vertical"?"block":"inline",drag.rtl)/total*100-drag.appliedDelta,pair=this.dividerPair(drag.index);if(!pair)return;const[leading,trailing]=pair,priorValue=this.sizes[leading];if(priorValue===void 0)return;const paired=this.clampPair(this.sizes,leading,trailing,incremental,total),pairedA=paired[leading],pairedB=paired[trailing];if(pairedA===void 0||pairedB===void 0)return;const next=[...this.sizes];next[leading]=pairedA,next[trailing]=pairedB,this.requestResize(next,!1)&&(drag.appliedDelta+=pairedA-priorValue,drag.acceptedResize=!0)},this.onPointerUp=e=>{const drag=this.drags.get(e.pointerId);drag&&(this.drags.delete(e.pointerId),e.type==="pointerup"&&drag.acceptedResize&&this.settle(),this.dragController.end(e.pointerId))},this.onDividerKeyDown=(e,index)=>{if(this.isDividerDisabled(index)||e.altKey||e.ctrlKey||e.metaKey||e.isComposing)return;const direction=separatorArrowDirection(e,this.effectiveOrientation==="vertical"?"block":"inline",this.effectiveOrientation==="horizontal"&&isRtl(this));if(e.key==="Home"||e.key==="End"){const{min,max}=this.dividerValueRange(index),current=this.sizes[this.dividerPair(index)?.[0]??index];if(current!==void 0){const target=e.key==="Home"?min:max;this.applyDelta(index,target-current,!0)&&e.preventDefault()}}else direction===1?this.applyDelta(index,KEYBOARD_STEP,!0)&&e.preventDefault():direction===-1&&this.applyDelta(index,-KEYBOARD_STEP,!0)&&e.preventDefault()}}static{this.defaultStrings={...super.defaultStrings,resizeDivider:LYRA_DEFAULT_resizeDivider,resizeValuePercent:LYRA_DEFAULT_resizeValuePercent}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["sizes","defaultSizes","panelConstraints","collapsedPanels"])}static{this.styles=[LyraElement.styles,nativeModalCarrierStyles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-resize-request","lr-resize","lr-resize-change","lr-multi-split-panel-collapse-change"])}static{this.properties={collapseState:{reflect:!0,attribute:"collapse-state",noAccessor:!0}}}stopNativeModalGeometry(){this.nativeModalView?.removeEventListener("scroll",this.syncNativeModalGeometry,!0),this.nativeModalView?.removeEventListener("resize",this.syncNativeModalGeometry),this.nativeModalView=void 0,this.nativeModalResizeObserver?.disconnect(),this.nativeModalResizeObserver=void 0;for(const lease of this.floatingGeometry.values())lease.release();this.floatingGeometry.clear(),this.floatingFrame=void 0,this.openingBlockSize=0;const reservation=this.shadowRoot?.querySelector(".allocation-reservation");reservation&&(reservation.hidden=!0,reservation.style.removeProperty("block-size"))}nativeModalLabel(){const panel=this.floatingPanelEl;return panel?panel.hasAttribute("aria-label")?panel.getAttribute("aria-label"):resolveIdReferencesIn(panel.getRootNode(),panel.getAttribute("aria-labelledby")).map(element=>element.textContent?.trim()).filter(Boolean).join(" ")||this.getAttribute("aria-label"):this.getAttribute("aria-label")}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.responsiveObservationEnabled&&this.seedInlineSize(),this.seedFirstRenderState(()=>this.syncPanelMembership(!1)),this.hasUpdated&&this.syncPanelMembership(!1),this.initializedSizes&&this.ensureSizes(),this.responsiveObservationEnabled&&this.armCollapseObserver(),this.hasUpdated&&this.overlayActive&&(this.overlayHandle?.isActive()?this.overlayHandle.resume():this.activateFloatingOverlay(),queueMicrotask(()=>{!this.isConnected||!this.overlayActive||(this.syncNativeModalGeometry(),this.modalSurface.show(),this.overlayHandle?.focusInitial())})),this.hasUpdated&&this.syncExternalTriggerA11y()}seedInlineSize(){const hostWidth=this.getBoundingClientRect().width;hostWidth>0&&(this.measuredInlineSize=hostWidth)}disconnectedCallback(){this.modalSurface.disconnect(),this.stopNativeModalGeometry(),super.disconnectedCallback(),this.endDragGestures(),this.resetCollapseObserver(),this.resetGutterObserver(),this.overlayHandle?.suspend(),cancelDeferredFocusReturn(this),this.releaseExternalTriggerA11y(),this.releaseOwnedPanels()}adoptedCallback(){super.adoptedCallback(),cancelDeferredFocusReturn(this),this.releaseExternalTriggerA11y(),this.endDragGestures(),this.resetCollapseObserver(),this.resetGutterObserver(),this.releaseOwnedPanels()}firstUpdated(changed){super.firstUpdated(changed),this.responsiveObservationEnabled&&this.armCollapseObserver()}willUpdate(changed){if(super.willUpdate(changed),!this.ownerDocument&&this.panelCount===0&&(this.panelCount=Math.max(this.sizes.length,this.defaultSizes.length,this.panelConstraints.length)),!this.initializedSizes)this.initializeSizes(),this.initializedSizes=!0;else if(changed.has("sizes")){const previous=changed.get("sizes");this.sizesReconciledForMembership?this.sizesReconciledForMembership=!1:!this.validLiveSizes(this.sizes)&&!this.acceptFoldedSizes(previous)&&(Array.isArray(previous)&&this.validLiveSizes(previous)?this.sizes=[...previous]:(this.sizes=[],this.ensureSizes()))}else this.sizes.length===0&&this.ensureSizes();if(this.syncCollapsedLayout(),(changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.orientationBreakpoints.configure(this.orientationBreakpoint,this.orientationBreakpointBasis),!this.hasUpdated&&this.isConnected&&this.responsiveObservationEnabled&&this.seedInlineSize(),(changed.has("orientation")||changed.has("narrowOrientation")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.updateEffectiveOrientation(this.measuredInlineSize,this.hasUpdated&&this.orientationBreakpointBasis==="viewport"),changed.has("collapse")||changed.has("railBreakpoint")||changed.has("floatBreakpoint")||changed.has("collapseBreakpointBasis")){const previousEffective=changed.has("collapse")?this.effectiveCollapseStateFor(changed.get("collapse")??"none"):this.collapseState;changed.has("collapse")&&previousEffective!=="wide"&&this.endDragGestures(),this.collapseBreakpoints.configure(this.railBreakpoint,this.floatBreakpoint,this.collapseBreakpointBasis),this.collapsingIndex!==-1&&!this._forced&&(this._collapseState=this.collapseBreakpoints.classify(this.measuredInlineSize)),this.applyEffectiveCollapseTransition(previousEffective,this.collapseState,this.hasUpdated)}if(changed.has("open")||changed.has("collapseState")||changed.has("collapse")||changed.has("panelCount")){const next=this.collapseState==="floating"&&this.open;next!==this.overlayActive&&(this.overlayActive=next,next?(this.justOpened=!0,this.activateFloatingOverlay()):this.deactivateFloatingOverlay())}this.renderConstraintBounds=this.resolveConstraintBounds(this.getContainerSize()).bounds}get collapseState(){return this.effectiveCollapseStateFor(this.collapse)}set collapseState(next){if(next==="auto"){this.releaseCollapsePin(),this.updateCollapseState(this.currentMeasuredWidth());return}this._forced=!0,this.pinnedBand=this.collapseBreakpoints.classify(this.pinMeasurementWidth()),this.setRequestedCollapseState(next)}expandPane(){this.applyPaneIntent(!0)}collapsePane(){this.applyPaneIntent(!1)}togglePane(){this.applyPaneIntent(!this.paneExpanded)}collapsePanel(panel){return this.setPanelCollapsed(panel,!0)}expandPanel(panel){return this.setPanelCollapsed(panel,!1)}togglePanel(panel){const panelId=this.panelIdOf(panel);return panelId===null?!1:(this.syncCollapsedLayout(),this.setPanelCollapsed(panelId,!this.appliedCollapsed.includes(panelId)))}panelIdOf(panel){return typeof panel=="string"?panel:this.ownedPanels.includes(panel)?panel.getAttribute("panel-id"):null}setPanelCollapsed(panel,collapsed){const panelId=this.panelIdOf(panel),ids=this.panelIdsFor(this.ownedPanels);if(panelId===null||!ids||ids.length<2||!ids.includes(panelId))return!1;const requested=this.collapsedPanels.filter(id=>typeof id=="string"),next=collapsed?[...requested.filter(id=>id!==panelId),panelId]:requested.filter(id=>id!==panelId);return this.initializedSizes?(this.syncCollapsedLayout(),this.appliedCollapsed.includes(panelId)===collapsed||collapsed&&!this.targetCollapsedIds(ids,next).includes(panelId)?!1:(this.collapsedPanels=next,this.syncCollapsedLayout(),this.persist(),this.decorateOwnedPanels(),this.emit("lr-multi-split-panel-collapse-change",{panelId,collapsed,collapsedPanels:[...this.appliedCollapsed],sizes:[...this.sizes]}),!0)):requested.includes(panelId)===collapsed?!1:(this.collapsedPanels=next,!0)}targetCollapsedIds(ids,requested=this.collapsedPanels){if(requested.length===0||!ids||ids.length<2)return[];const names=new Set(requested),target=ids.filter(id=>names.has(id));return target.length===ids.length&&target.pop(),target}indexesOf(ids,collapsed){if(collapsed.length===0)return NO_COLLAPSED_PANELS;const names=new Set(collapsed),indexes=new Set;return ids.forEach((id,index)=>{names.has(id)&&indexes.add(index)}),indexes}collapsedIndexes(){return this.appliedCollapsed.length===0?NO_COLLAPSED_PANELS:this.indexesOf(this.ownedPanels.map(panel=>panel.getAttribute("panel-id")??""),this.appliedCollapsed)}syncCollapsedLayout(){if(this.collapsedPanels.length===0&&this.appliedCollapsed.length===0)return;const ids=this.panelIdsFor(this.ownedPanels);if(!ids){this.appliedCollapsed.length>0&&(this.appliedCollapsed=[],this.expandedSizes.clear(),this.endDragGestures(),this.sizes=[],this.ensureSizes());return}const present=new Set(ids),applied=this.appliedCollapsed.filter(id=>present.has(id));for(const id of[...this.expandedSizes.keys()])present.has(id)||this.expandedSizes.delete(id);const target=this.targetCollapsedIds(ids);if(applied.length===target.length&&applied.every((id,index)=>id===target[index])&&this.validLiveSizes(this.sizes,this.indexesOf(ids,applied))){this.appliedCollapsed=applied;return}this.endDragGestures(),this.sizes=this.foldSizes(ids,applied,target),this.appliedCollapsed=target}foldSizes(ids,from,to){const next=ids.map((_,index)=>this.sizes[index]??0),closed=new Set(this.indexesOf(ids,from)),toIndexes=this.indexesOf(ids,to),bounds=this.resolveConstraintBounds(this.getContainerSize(),toIndexes).bounds,floor=this.normalizedDefaultMin(),openIndexes=()=>ids.map((_,index)=>index).filter(index=>!closed.has(index));for(const index of toIndexes){if(closed.has(index))continue;const freed=next[index];this.expandedSizes.set(ids[index],freed),next[index]=0,closed.add(index),this.distributeShare(next,freed,openIndexes(),bounds)}for(const index of[...closed]){if(toIndexes.has(index))continue;closed.delete(index);const id=ids[index],bound=bounds[index]??{min:floor,max:1/0},remembered=this.expandedSizes.get(id)??100/ids.length;this.expandedSizes.delete(id);const wanted=Math.min(Math.max(remembered,bound.min,floor),bound.max),donors=openIndexes().filter(open=>open!==index),slack=donors.map(donor=>Math.max(0,next[donor]-Math.max(bounds[donor]?.min??floor,floor))),slackTotal=slack.reduce((total,value)=>total+value,0),taken=Math.min(wanted,slackTotal);donors.forEach((donor,position)=>{next[donor]=next[donor]-(slackTotal>0?taken*slack[position]/slackTotal:0)}),next[index]=next[index]+taken}if(this.validLiveSizes(next,toIndexes))return next;const openCount=ids.length-toIndexes.size;return ids.map((_,index)=>toIndexes.has(index)?0:100/openCount)}distributeShare(sizes,amount,indexes,bounds){let remaining=amount,pool=indexes.filter(index=>sizes[index]<(bounds[index]?.max??1/0)-1e-9);for(;remaining>1e-9&&pool.length>0;){const weightTotal=pool.reduce((total2,index)=>total2+sizes[index],0),capped=new Set;let given=0;for(const index of pool){const share=weightTotal>0?remaining*sizes[index]/weightTotal:remaining/pool.length,room=(bounds[index]?.max??1/0)-sizes[index],portion=Math.min(share,room);sizes[index]=sizes[index]+portion,given+=portion,portion>=room-1e-9&&capped.add(index)}remaining-=given,pool=pool.filter(index=>!capped.has(index))}if(remaining<=1e-9||indexes.length===0)return;const total=indexes.reduce((sum,index)=>sum+sizes[index],0);for(const index of indexes)sizes[index]=sizes[index]+(total>0?remaining*sizes[index]/total:remaining/indexes.length)}dividerPair(index){const collapsed=this.collapsedIndexes();if(collapsed.size===0)return[index,index+1];const held=this.collapseActive?this.collapsingIndex:-1,closed=panel=>collapsed.has(panel)||panel===held;let leading=index;for(;leading>=0&&closed(leading);)leading--;let trailing=index+1;for(;trailing<this.panelCount&&closed(trailing);)trailing++;return leading>=0&&trailing<this.panelCount?[leading,trailing]:null}get paneExpanded(){const state=this.collapseState;return state==="floating"?this.open:state==="wide"}applyPaneIntent(expanded){if(this.collapsingIndex===-1)return;const band=this.collapseBreakpoints.classify(this.pinMeasurementWidth());if(band==="floating"){this.collapseState!=="floating"&&(this.releaseCollapsePin(),this.setRequestedCollapseState("floating")),this.open=expanded;return}const target=expanded?"wide":"rail";if(this.collapseState!==target){if(target===band){this.releaseCollapsePin(),this.setRequestedCollapseState(target);return}this.collapseState=target}}releaseCollapsePin(){this._forced=!1,this.pinnedBand=void 0}pinMeasurementWidth(){const live=this.currentMeasuredWidth();return live>0?live:this.measuredInlineSize}get effectiveOrientation(){return this._effectiveOrientation}get responsiveObservationEnabled(){return this.collapse!=="none"||this.orientationBreakpoints.containerObservationEnabled}updateEffectiveOrientation(width,shouldEmit){const next=this.orientationBreakpoints.isBelow(width)?this.narrowOrientation:this.orientation;next!==this._effectiveOrientation&&(this.endDragGestures(),this._effectiveOrientation=next,this.requestUpdate(),shouldEmit&&this.emit("lr-multi-split-orientation-change",{orientation:next}),this._forced&&this.releasePinOnBreakpoint&&(this.releaseCollapsePin(),this.updateCollapseState(width,this.hasUpdated)))}currentMeasuredWidth(){return this.baseEl?.clientWidth??0}effectiveCollapseStateFor(collapse){return collapse!=="none"&&this.panelCount>=2?this._collapseState:"wide"}applyEffectiveCollapseTransition(previous,next,shouldEmit=!0){if(previous===next)return;this.endDragGestures(),this.requestUpdate("collapseState",previous);const forceClose=previous==="floating"&&next!=="floating"&&this.open,forcedCloseVersion=this.forcedCloseVersion;shouldEmit&&(this.relocateFocusOutOfCollapsingPanel(next),this.decorateOwnedPanels(),this.emit("lr-multi-split-collapse-change",{state:next})),forceClose&&this.forcedCloseVersion===forcedCloseVersion&&this.collapseState!=="floating"&&this.setOpen(!1,{force:!0})}relocateFocusOutOfCollapsingPanel(next){if(next==="wide"||next==="floating"&&this.open)return;const index=this.collapsingIndex;if(index===-1)return;const panel=this.ownedPanels[index];panel&&repairComposedFocus(panel,()=>this.collapseFocusFallbacks(panel))}collapseFocusFallbacks(collapsing){const dividers=[...this.renderRoot.querySelectorAll('[part="divider"]')];return[...new Set([...this.ownedPanels.filter(panel=>panel!==collapsing),...dividers.filter((_,index)=>!this.isDividerDisabled(index)),...dividers])]}setOpen(next,options){if(options?.force){this.open=next,this.forcedCloseVersion+=1,this.emit("lr-toggle",{expanded:next});return}if(this.open===next)return;const collapseState=this.collapseState,open=this.open,mutationVersion=this.toggleProposalMutationVersion;this.toggleProposalDepth+=1;try{if(this.emit("lr-toggle-request",{expanded:next},{cancelable:!0}).defaultPrevented||this.toggleProposalMutationVersion!==mutationVersion||this.collapseState!==collapseState||this.open!==open)return}finally{this.toggleProposalDepth-=1}this.open=next,this.emit("lr-toggle",{expanded:next})}requestUpdate(name,oldValue,options){this.toggleProposalDepth>0&&(name==="open"&&oldValue!==this.open||name==="collapse"&&oldValue!==this.collapse||name==="collapseState"&&oldValue!==this.collapseState)&&(this.toggleProposalMutationVersion+=1),super.requestUpdate(name,oldValue,options)}setRequestedCollapseState(next,shouldEmit=!0){const previousEffective=this.collapseState;if(next===this._collapseState)return;this._collapseState=next;const nextEffective=this.collapseState;this.applyEffectiveCollapseTransition(previousEffective,nextEffective,shouldEmit),previousEffective===nextEffective&&next!==nextEffective&&this.requestUpdate("collapseState",next)}get storageFullKey(){return this.storageKey?`lr-multi-split:${this.storageKey}:panels`:void 0}panelIdsFor(panels){const ids=[],seen=new Set;for(const panel of panels){const panelId=panel.getAttribute("panel-id")??"";if(!panelId||panelId.trim()!==panelId||seen.has(panelId))return null;seen.add(panelId),ids.push(panelId)}return ids}reconcileIdentitySizes(previousIds,previousValues,nextIds){if(previousIds.length!==previousValues.length||nextIds.length===0)return null;const previousSizes=new Map;previousIds.forEach((panelId,index)=>{previousSizes.set(panelId,previousValues[index])});const retainedTotal=nextIds.reduce((total,panelId)=>total+(previousSizes.get(panelId)??0),0),missingCount=nextIds.filter(panelId=>!previousSizes.has(panelId)).length;if(!(retainedTotal>0)){const equal=100/nextIds.length;return nextIds.map(()=>equal)}const newShare=100/nextIds.length,retainedScale=(100-newShare*missingCount)/retainedTotal;return nextIds.map(panelId=>{const previous=previousSizes.get(panelId);return previous===void 0?newShare:previous*retainedScale})}reconcileSizesByPanelId(previousPanels,nextPanels){if(previousPanels.length!==this.sizes.length||nextPanels.length===0)return null;const previousIds=this.panelIdsFor(previousPanels),nextIds=this.panelIdsFor(nextPanels);return!previousIds||!nextIds?null:this.reconcileIdentitySizes(previousIds,this.sizes,nextIds)}validInitialSizes(value,collapsed=this.collapsedIndexes()){return!Array.isArray(value)||value.length!==this.panelCount||!value.every((size,index)=>collapsed.has(index)?size===0:Number.isFinite(size)&&size>=this.safeMin)?!1:Math.abs(value.reduce((sum,size)=>sum+size,0)-100)<.01}validLiveSizes(value,collapsed=this.collapsedIndexes()){if(!Array.isArray(value)||value.length!==this.panelCount)return!1;const floor=this.normalizedDefaultMin();return value.every((size,index)=>collapsed.has(index)?size===0:Number.isFinite(size)&&size>=floor)?Math.abs(value.reduce((sum,size)=>sum+size,0)-100)<.01:!1}resolveDefaultSizes(){if(this.defaultSizes.length===0)return null;if(!this.defaultSizes.some(entry=>typeof entry=="string")){const numbers=this.defaultSizes;return this.validInitialSizes(numbers)?[...numbers]:null}const containerSize=this.currentMeasuredWidth()||this.getBoundingClientRect().width;if(!(containerSize>0))return null;const resolvedPx=[];for(const entry of this.defaultSizes){if(typeof entry=="number"){if(!Number.isFinite(entry))return null;resolvedPx.push(entry/100*containerSize);continue}const px=resolveCssLength(entry,{host:this,percentBase:containerSize,viewportBasis:this.ownerDocument.defaultView??void 0});if(px==null||!(px>=0))return null;resolvedPx.push(px)}const sum=resolvedPx.reduce((total,size)=>total+size,0);if(!(sum>0))return null;const normalized=resolvedPx.map(size=>size/sum*100);return this.validInitialSizes(normalized)?normalized:null}acceptFoldedSizes(previous){const ids=this.panelIdsFor(this.ownedPanels),target=this.targetCollapsedIds(ids);return!ids||target.length===0||!this.validLiveSizes(this.sizes,this.indexesOf(ids,target))?!1:(ids.forEach((panelId,index)=>{if(!target.includes(panelId)||this.appliedCollapsed.includes(panelId))return;const share=Array.isArray(previous)?previous[index]:void 0;typeof share=="number"&&share>0&&this.expandedSizes.set(panelId,share)}),this.appliedCollapsed=target,!0)}initializeSizes(){if(this.validInitialSizes(this.sizes))return;const panelIds=this.panelIdsFor(this.ownedPanels),target=this.targetCollapsedIds(panelIds);if(panelIds&&target.length>0&&this.validInitialSizes(this.sizes,this.indexesOf(panelIds,target))){this.appliedCollapsed=target;return}if(this.loadPersisted())return;const resolved=this.resolveDefaultSizes();if(resolved){this.sizes=resolved;return}this.sizes=[],this.ensureSizes()}loadPersisted(){const panelIds=this.panelIdsFor(this.ownedPanels);if(!panelIds)return!1;const parsed=readPersistedState(this.storageFullKey,isPersistedPanelLayout);if(!parsed||parsed.panels.length===0)return!1;const persistedIds=[],persistedSizes=[],persistedCollapsed=new Map,seen=new Set;for(const panel of parsed.panels){if(seen.has(panel.panelId))return!1;seen.add(panel.panelId),persistedIds.push(panel.panelId),persistedSizes.push(panel.size),parsed.version===2&&panel.collapsed===!0&&persistedCollapsed.set(panel.panelId,panel.expandedSize)}if(Math.abs(persistedSizes.reduce((sum,size)=>sum+size,0)-100)>=.01)return!1;const normalized=this.reconcileIdentitySizes(persistedIds,persistedSizes,panelIds);if(!normalized)return!1;const restoredCollapsed=panelIds.filter(panelId=>persistedCollapsed.has(panelId));if(!this.validInitialSizes(normalized,this.indexesOf(panelIds,restoredCollapsed)))return!1;this.sizes=normalized,this.appliedCollapsed=restoredCollapsed;for(const panelId of restoredCollapsed){const expandedSize=persistedCollapsed.get(panelId);expandedSize!==void 0&&this.expandedSizes.set(panelId,expandedSize)}return restoredCollapsed.length>0&&this.collapsedPanels.length===0&&(this.collapsedPanels=restoredCollapsed),!0}persist(){const panelIds=this.panelIdsFor(this.ownedPanels);if(!panelIds||panelIds.length!==this.sizes.length)return;const collapsed=new Set(this.appliedCollapsed),layout={version:collapsed.size>0?2:1,panels:panelIds.map((panelId,index)=>{const size=this.sizes[index];if(!collapsed.has(panelId))return{panelId,size};const expandedSize=this.expandedSizes.get(panelId);return expandedSize===void 0?{panelId,size,collapsed:!0}:{panelId,size,collapsed:!0,expandedSize}})};writePersistedState(this.storageFullKey,layout)}ensureSizes(){if(this.panelCount===this.sizes.length)return;if(this.panelCount<=0){this.sizes=[];return}if(this.sizes.length===0){const equal=100/this.panelCount;this.sizes=Array.from({length:this.panelCount},()=>equal);return}const diff=this.panelCount-this.sizes.length;if(diff>0){const newShare=100/this.panelCount,scale=(100-newShare*diff)/100;this.sizes=[...this.sizes.map(s=>s*scale),...Array.from({length:diff},()=>newShare)]}else{const kept=this.sizes.slice(0,this.panelCount),removedTotal=this.sizes.slice(this.panelCount).reduce((sum,s)=>sum+s,0),keptTotal=kept.reduce((sum,s)=>sum+s,0)||1;this.sizes=kept.map(s=>s+s/keptTotal*removedTotal)}}readPanelStyle(panel,property2){return{value:panel.style.getPropertyValue(property2),priority:panel.style.getPropertyPriority(property2)}}samePanelStyle(left,right){return left.value===right.value&&left.priority===right.priority}snapshotPanelOwnership(panel){const styles2=new Map;for(const property2 of OWNED_PANEL_STYLE_PROPERTIES)styles2.set(property2,this.readPanelStyle(panel,property2));const attributes=new Map;for(const name of OWNED_PANEL_ATTRIBUTES)attributes.set(name,panel.getAttribute(name));return{styles:styles2,appliedStyles:new Map,hidden:panel.hidden,attributes,appliedAttributes:new Map}}adoptPanelOwnership(panel,snapshot){for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const current=this.readPanelStyle(panel,property2),applied=snapshot.appliedStyles.get(property2);(applied&&!this.samePanelStyle(current,applied)||!applied&&!this.samePanelStyle(current,snapshot.styles.get(property2)))&&snapshot.styles.set(property2,current)}(snapshot.appliedHidden!==void 0&&panel.hidden!==snapshot.appliedHidden||snapshot.appliedHidden===void 0&&panel.hidden!==snapshot.hidden)&&(snapshot.hidden=panel.hidden);for(const name of OWNED_PANEL_ATTRIBUTES){const current=panel.getAttribute(name),expected=snapshot.appliedAttributes.has(name)?snapshot.appliedAttributes.get(name):snapshot.attributes.get(name);current!==expected&&snapshot.attributes.set(name,current)}}applyOwnedPanelStyle(panel,snapshot,property2,value){value.value===""?panel.style.removeProperty(property2):panel.style.setProperty(property2,value.value,value.priority),snapshot.appliedStyles.set(property2,this.readPanelStyle(panel,property2))}applyOwnedPanelStyleValue(panel,snapshot,property2,value){this.applyOwnedPanelStyle(panel,snapshot,property2,{value,priority:""})}applyOwnedPanelHidden(panel,snapshot,hidden){panel.hidden=hidden,snapshot.appliedHidden=panel.hidden}applyOwnedPanelAttribute(panel,snapshot,name,value){value===null?panel.removeAttribute(name):panel.setAttribute(name,value),snapshot.appliedAttributes.set(name,panel.getAttribute(name))}restorePanelOwnership(panel,snapshot){this.adoptPanelOwnership(panel,snapshot);for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const value=snapshot.styles.get(property2);value.value===""?panel.style.removeProperty(property2):panel.style.setProperty(property2,value.value,value.priority)}panel.hidden=snapshot.hidden;for(const name of OWNED_PANEL_ATTRIBUTES){const value=snapshot.attributes.get(name)??null;value===null?panel.removeAttribute(name):panel.setAttribute(name,value)}}panelProjectionDiverged(panel,snapshot){for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const current=this.readPanelStyle(panel,property2),expected=snapshot.appliedStyles.get(property2)??snapshot.styles.get(property2);if(!this.samePanelStyle(current,expected))return!0}return panel.hidden!==(snapshot.appliedHidden??snapshot.hidden)?!0:OWNED_PANEL_ATTRIBUTES.some(name=>{const expected=snapshot.appliedAttributes.has(name)?snapshot.appliedAttributes.get(name):snapshot.attributes.get(name);return panel.getAttribute(name)!==expected})}resetPanelOwnershipObserver(){this.panelOwnershipObserver?.disconnect(),this.panelOwnershipObserver=void 0}observeOwnedPanels(){this.resetPanelOwnershipObserver();const MutationObserverConstructor=this.ownerDocument.defaultView?.MutationObserver;if(!MutationObserverConstructor||!this.isConnected||this.ownedPanels.length===0)return;const observer=new MutationObserverConstructor(records=>{records.some(record=>{const panel=record.target,snapshot=this.panelOwnership.get(panel);return snapshot?this.panelProjectionDiverged(panel,snapshot):!1})&&this.requestUpdate()});this.panelOwnershipObserver=observer;for(const panel of this.ownedPanels)observer.observe(panel,{attributes:!0,attributeFilter:["style","hidden",...OWNED_PANEL_ATTRIBUTES]})}samePanelSequence(next){return next.length===this.ownedPanels.length&&next.every((panel,index)=>panel===this.ownedPanels[index])}syncPanelMembership(reconcileSizes=!0){const next=[...this.children].filter(child=>child!==this.nativeModal.helperMount);if(this.samePanelSequence(next))return;const previousPanels=this.ownedPanels,identitySizes=reconcileSizes?this.reconcileSizesByPanelId(previousPanels,next):null,previousEffective=this.collapseState,nextSet=new Set(next);for(const panel of this.ownedPanels){if(nextSet.has(panel))continue;const snapshot=this.panelOwnership.get(panel);snapshot&&this.restorePanelOwnership(panel,snapshot),this.panelOwnership.delete(panel)}for(const panel of next)this.panelOwnership.has(panel)||this.panelOwnership.set(panel,this.snapshotPanelOwnership(panel));const countChanged=next.length!==this.panelCount;this.ownedPanels=next,this.panelCount=next.length,this.collapsingIndex!==-1&&!this._forced&&(this._collapseState=this.collapseBreakpoints.classify(this.currentMeasuredWidth())),this.applyEffectiveCollapseTransition(previousEffective,this.collapseState,this.hasUpdated),identitySizes?(this.sizesReconciledForMembership=!0,this.sizes=identitySizes):countChanged&&reconcileSizes&&(this.sizesReconciledForMembership=!0,this.ensureSizes()),this.observeOwnedPanels(),this.hasUpdated&&this.requestUpdate()}releaseOwnedPanels(){this.resetPanelOwnershipObserver();for(const panel of this.ownedPanels){const snapshot=this.panelOwnership.get(panel);snapshot&&this.restorePanelOwnership(panel,snapshot)}this.ownedPanels=[],this.panelOwnership.clear()}getContainerSize(){return this.baseEl?this.effectiveOrientation==="vertical"?this.baseEl.clientHeight:this.baseEl.clientWidth:0}resetGutterObserver(){this.gutterObserverFrame!==void 0&&(this.gutterObserverDocument?.defaultView?.cancelAnimationFrame(this.gutterObserverFrame),this.gutterObserverFrame=void 0),this.gutterResizeObserver?.disconnect(),this.gutterResizeObserver=void 0,this.gutterObserverDocument=void 0,this.gutterObservedDividers=[],this.baseEl?.style.removeProperty("--_lr-multi-split-gutters")}updateGutterBudget(){const view=this.ownerDocument.defaultView,base=this.baseEl;if(!view||!base)return;const vertical=this.effectiveOrientation==="vertical",value=`${this.gutterObservedDividers.reduce((total,divider)=>{const style=view.getComputedStyle(divider),properties=vertical?["height","padding-top","padding-bottom","border-top-width","border-bottom-width"]:["width","padding-left","padding-right","border-left-width","border-right-width"],boxProperties=style.boxSizing==="border-box"?properties.slice(0,1):properties;return total+boxProperties.reduce((size,property2)=>size+finiteRange(parseFloat(style.getPropertyValue(property2)),0,0),0)},0)}px`;base.style.getPropertyValue("--_lr-multi-split-gutters")!==value&&base.style.setProperty("--_lr-multi-split-gutters",value)}syncGutterObserver(enabled){const base=this.baseEl;if(!enabled||!this.isConnected||!base){this.resetGutterObserver();return}const ownerDocument=this.ownerDocument,dividers=[...base.querySelectorAll('[part="divider"]')];if(this.gutterResizeObserver&&this.gutterObserverDocument===ownerDocument&÷rs.length===this.gutterObservedDividers.length&÷rs.every((divider,index)=>divider===this.gutterObservedDividers[index])){this.updateGutterBudget();return}this.resetGutterObserver(),this.gutterObservedDividers=dividers,this.gutterObserverDocument=ownerDocument,this.gutterObservedContainerSize=this.getContainerSize(),this.updateGutterBudget();const ownerWindow=ownerDocument.defaultView,ResizeObserverConstructor=ownerWindow?.ResizeObserver;if(!ownerWindow||!ResizeObserverConstructor)return;const observer=new ResizeObserverConstructor(()=>{if(this.gutterResizeObserver!==observer||!this.isConnected||this.ownerDocument!==ownerDocument)return;this.updateGutterBudget();const size=this.getContainerSize();size!==this.gutterObservedContainerSize&&(this.gutterObservedContainerSize=size,this.requestUpdate())});this.gutterResizeObserver=observer;const frame=ownerWindow.requestAnimationFrame(()=>{if(!(this.gutterObserverFrame!==frame||this.gutterResizeObserver!==observer||!this.isConnected||this.ownerDocument!==ownerDocument||this.baseEl!==base)){this.gutterObserverFrame=void 0,observer.observe(base,{box:"border-box"});for(const divider of dividers)observer.observe(divider,{box:"border-box"})}});this.gutterObserverFrame=frame}get collapsingIndex(){return this.collapse==="none"||this.panelCount<2?-1:this.collapse==="start"?0:this.panelCount-1}get collapseActive(){return this.collapsingIndex!==-1&&this.collapseState!=="wide"}isDividerDisabled(index){if(this.collapseActive){const adjacent=this.collapsingIndex===0?0:this.panelCount-2;if(index===adjacent)return!0}return this.dividerPair(index)===null}updateCollapseState(width,shouldEmit=!0){if(this.collapse==="none")return;const classified=this.collapseBreakpoints.classify(width);if(this._forced){if(!this.releasePinOnBreakpoint||classified===this.pinnedBand)return;this.releaseCollapsePin()}this.setRequestedCollapseState(classified,shouldEmit)}armCollapseObserver(){const observedElement=this.baseEl;if(!this.isConnected||!observedElement)return;const ownerDocument=this.ownerDocument;if(this.collapseResizeObserver&&this.collapseObservedElement===observedElement&&this.collapseObserverOwnerDocument===ownerDocument)return;this.resetCollapseObserver();const ResizeObserverConstructor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverConstructor)return;const generation=this.collapseObserverGeneration,observer=new ResizeObserverConstructor(entries=>{if(this.collapseResizeObserver!==observer||this.collapseObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.baseEl!==observedElement)return;const box=entries[0]?.contentBoxSize?.[0],width=box?box.inlineSize:observedElement.getBoundingClientRect().width;this.measuredInlineSize=width,this.updateCollapseState(width),this.updateEffectiveOrientation(width,!0)});this.collapseResizeObserver=observer,this.collapseObservedElement=observedElement,this.collapseObserverOwnerDocument=ownerDocument,observer.observe(observedElement)}resetCollapseObserver(){this.collapseObserverGeneration+=1,this.collapseResizeObserver?.disconnect(),this.collapseResizeObserver=void 0,this.collapseObservedElement=void 0,this.collapseObserverOwnerDocument=void 0}syncCollapseObserver(){if(!this.responsiveObservationEnabled){this.resetCollapseObserver();return}this.armCollapseObserver()}get safeMin(){return finiteRange(this.min,10,0)}normalizedDefaultMin(){if(this.panelCount<=0)return 0;const requested=this.safeMin,available=Math.max(0,100-KEYBOARD_STEP);return Math.min(requested,available/this.panelCount)}resolveConstraintBounds(containerSize,collapsed=this.collapsedIndexes()){const fallbackMin=this.normalizedDefaultMin(),fallback=Array.from({length:this.panelCount},(_,index)=>collapsed.has(index)?{min:0,max:0}:{min:fallbackMin,max:1/0});if(this.panelCount<=0)return{bounds:[],usePanelConstraints:!0};const bounds=[];let minimumTotal=0,maximumTotal=0,hasUnboundedMaximum=!1,issueReason;for(let index=0;index<this.panelCount;index++){if(collapsed.has(index)){bounds.push({min:0,max:0});continue}const constraint=this.panelConstraints[index];let min=this.safeMin,max=1/0,minSet=!1,maxSet=!1;constraint&&(constraint.minPx!=null&&Number.isFinite(constraint.minPx)&&constraint.minPx>=0&&containerSize>0&&(min=constraint.minPx/containerSize*100,minSet=!0),constraint.minPercent!=null&&Number.isFinite(constraint.minPercent)&&constraint.minPercent>=0&&(min=minSet?Math.max(min,constraint.minPercent):constraint.minPercent,minSet=!0),constraint.maxPx!=null&&Number.isFinite(constraint.maxPx)&&constraint.maxPx>=0&&containerSize>0&&(max=constraint.maxPx/containerSize*100,maxSet=!0),constraint.maxPercent!=null&&Number.isFinite(constraint.maxPercent)&&constraint.maxPercent>=0&&(max=maxSet?Math.min(max,constraint.maxPercent):constraint.maxPercent,maxSet=!0),(constraint.minPx!=null&&(!Number.isFinite(constraint.minPx)||constraint.minPx<0)||constraint.maxPx!=null&&(!Number.isFinite(constraint.maxPx)||constraint.maxPx<0)||constraint.minPercent!=null&&(!Number.isFinite(constraint.minPercent)||constraint.minPercent<0)||constraint.maxPercent!=null&&(!Number.isFinite(constraint.maxPercent)||constraint.maxPercent<0))&&(issueReason??="minimum-exceeds-maximum")),min>max&&(issueReason??="minimum-exceeds-maximum"),bounds.push({min,max}),minimumTotal+=min,Number.isFinite(max)?maximumTotal+=max:hasUnboundedMaximum=!0}return issueReason==null&&minimumTotal>100+1e-9&&(issueReason="minimum-total"),issueReason==null&&!hasUnboundedMaximum&&maximumTotal<100-1e-9&&(issueReason="maximum-total"),issueReason==null?{bounds,usePanelConstraints:!0}:{bounds:fallback,usePanelConstraints:!1,issue:{reason:issueReason,panelCount:this.panelCount,minimumTotal,maximumTotal:hasUnboundedMaximum?null:maximumTotal,containerSize}}}hasClampConstraint(constraint){return!!constraint&&(constraint.minPx!=null||constraint.maxPx!=null||constraint.minPercent!=null||constraint.maxPercent!=null)}minSideExpr(constraint){const terms=[];return constraint?.minPx!=null&&Number.isFinite(constraint.minPx)&&constraint.minPx>=0&&terms.push(`${constraint.minPx}px`),constraint?.minPercent!=null&&Number.isFinite(constraint.minPercent)&&constraint.minPercent>=0&&terms.push(`${constraint.minPercent}%`),terms.length===0?`${NO_MIN_PX}px`:terms.length===1?terms[0]:`max(${this.safeMin}%, ${terms.join(", ")})`}maxSideExpr(constraint){const terms=[];return constraint?.maxPx!=null&&Number.isFinite(constraint.maxPx)&&constraint.maxPx>=0&&terms.push(`${constraint.maxPx}px`),constraint?.maxPercent!=null&&Number.isFinite(constraint.maxPercent)&&constraint.maxPercent>=0&&terms.push(`${constraint.maxPercent}%`),terms.length===0?`${NO_MAX_PX}px`:terms.length===1?terms[0]:`min(${terms.join(", ")})`}clampPair(sizes,i,j,delta,containerSize=0){const next=[...sizes],currentA=next[i],currentB=next[j];if(currentA===void 0||currentB===void 0)return next;const pairTotal=currentA+currentB,bounds=this.resolveConstraintBounds(containerSize).bounds,a=bounds[i]??{min:0,max:1/0},b=bounds[j]??{min:0,max:1/0},loRaw=Math.max(a.min,pairTotal-b.max),hiRaw=Math.min(a.max,pairTotal-b.min),lo=Math.min(loRaw,pairTotal),hi=Math.max(hiRaw,lo),clampedA=Math.min(Math.max(currentA+delta,lo),hi);return next[i]=clampedA,next[j]=pairTotal-clampedA,next}requestResize(next,commit){return next.length===this.sizes.length&&next.every((size,index)=>Math.abs(size-this.sizes[index])<=1e-9)||this.emit("lr-resize-request",{sizes:[...next]},{cancelable:!0}).defaultPrevented?!1:(this.sizes=next,this.emit("lr-resize",{sizes:[...this.sizes]}),commit&&this.settle(),!0)}settle(){this.persist(),this.emit("lr-resize-change",{sizes:[...this.sizes]})}applyDelta(index,delta,commit){const pair=this.dividerPair(index);if(!pair)return!1;const next=this.clampPair(this.sizes,pair[0],pair[1],delta,this.getContainerSize());return next.length!==this.sizes.length||next.some((size,currentIndex)=>Math.abs(size-this.sizes[currentIndex])>1e-9)?(this.requestResize(next,commit),!0):!1}get floatingPanelEl(){const index=this.collapsingIndex;return index===-1?null:this.ownedPanels[index]??null}activateFloatingOverlay(){this.openingBlockSize=this.baseEl?.getBoundingClientRect().height??0,this.modalSurface.prepare();const opener=deepActiveElement(this.ownerDocument);this.overlayOpener=isHtmlElement(opener)?opener:null;const trigger=this.resolveExternalTrigger();this.overlayReturnTarget=trigger??this.overlayOpener;const panel=this.floatingPanelEl;panel&&(this.floatingDialogPanel=panel,this.floatingDialogPreviousRole=panel.getAttribute("role"),this.floatingDialogPreviousAriaModal=panel.getAttribute("aria-modal"),this.nativeModal.requested||(panel.setAttribute("role","dialog"),panel.setAttribute("aria-modal","true"))),this.overlayHandle=activateOverlay({host:this,panel:()=>this.floatingPanelEl,modalRoot:()=>this.floatingPanelEl,auxiliaryRoots:()=>{const root=this.nativeModal.helperMount;return root?[root]:[]},restoreFocusTo:trigger??void 0,onEscape:()=>this.setOpen(!1),onBackdrop:()=>this.setOpen(!1),lockScroll:!0,suspendWhenUnrendered:!0,deferredReturn:()=>{if(!(this.resolveExternalTrigger()||this.trigger||this.for))return;const panel2=this.floatingDialogPanel;return{candidates:()=>[this.resolveExternalTrigger(),this.overlayReturnTarget,this.overlayOpener],stranded:active=>panel2!==null&&composedContains(panel2,active),isCurrent:()=>!this.overlayActive}}})}deactivateFloatingOverlay(){this.modalSurface.hide(),this.stopNativeModalGeometry(),this.nativeModal.prepare(!1);const trigger=this.resolveExternalTrigger(),panel=this.floatingDialogPanel;trigger&&this.overlayHandle?.updateRestoreFocusTo(trigger),this.overlayHandle?.deactivate(),this.overlayHandle=void 0,this.floatingDialogPanel=null,panel&&(this.floatingDialogPreviousRole===null?panel.removeAttribute("role"):panel.setAttribute("role",this.floatingDialogPreviousRole),this.floatingDialogPreviousAriaModal===null?panel.removeAttribute("aria-modal"):panel.setAttribute("aria-modal",this.floatingDialogPreviousAriaModal))}endDragGestures(){this.drags.clear(),this.dragController.cancelAll()}dividerName(index){let label;try{label=this.dividerLabel?.(index,this.panelCount)}catch{}if(typeof label=="string"&&label.trim())return label;const[leading,trailing]=this.dividerPair(index)??[index,index+1];return this.localize("resizeDivider",void 0,{a:getNumberFormat(this.effectiveLocale).format(leading+1),b:getNumberFormat(this.effectiveLocale).format(trailing+1)})}dividerValueRange(index,bounds=this.resolveConstraintBounds(this.getContainerSize()).bounds){const[leadingIndex,trailingIndex]=this.dividerPair(index)??[index,index+1],pairTotal=(this.sizes[leadingIndex]??0)+(this.sizes[trailingIndex]??0),leading=bounds[leadingIndex],trailing=bounds[trailingIndex],min=Math.max(leading.min,pairTotal-trailing.max);return{min,max:Math.max(min,Math.min(leading.max,pairTotal-trailing.min))}}updated(changed){super.updated(changed),this.overlayActive&&(this.syncNativeModalGeometry(),this.modalSurface.show()),(changed.has("collapse")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.syncCollapseObserver(),this.orientationBreakpoints.active?this.setAttribute("data-effective-orientation",this._effectiveOrientation):this.removeAttribute("data-effective-orientation"),(changed.has("panelConstraints")||changed.has("min"))&&(this.constraintConfigVersion+=1);const constraintResolution=this.resolveConstraintBounds(this.getContainerSize()),issue=constraintResolution.issue,issueKey=issue?`${issue.reason}:${issue.panelCount}:${this.constraintConfigVersion}`:"";issueKey!==this.constraintIssueKey&&(this.constraintIssueKey=issueKey,issue&&this.emit("lr-multi-split-constraints-invalid",issue));const collapsingIndex=this.collapseActive?this.collapsingIndex:-1;this.syncGutterObserver(collapsingIndex===-1&&this.panelConstraints.some(constraint=>finiteRange(constraint?.minPx??0,0,0)>0)),this.decorateOwnedPanels(constraintResolution),this.syncExternalTriggerA11y(),this.justOpened&&(this.justOpened=!1,this.overlayHandle?.focusInitial())}resolveExternalTrigger(){if(this.trigger)return this.trigger;if(!this.for)return null;const found=this.getRootNode().getElementById?.(this.for);return isHtmlElement(found)?found:null}syncExternalTriggerA11y(){const panel=this.ownedPanels[this.collapsingIndex],trigger=panel&&this.panelCount>1?this.resolveExternalTrigger():null;if(!this.isConnected||!panel||!trigger){this.releaseExternalTriggerA11y();return}this.triggerPanel!==panel&&(this.releaseExternalTriggerA11y(),this.triggerPanel=panel),panel.id||(this.generatedTriggerPanelId=nextId("multi-split-panel"),panel.id=this.generatedTriggerPanelId);const contribution={attributes:{"aria-expanded":this.paneExpanded?"true":"false"},controls:[panel]};this.triggerAria?this.triggerAria.update(trigger,contribution):this.triggerAria=acquireAriaOwnership(trigger,contribution)}releaseExternalTriggerA11y(){this.triggerAria?.release(),this.triggerAria=void 0,this.triggerPanel&&this.generatedTriggerPanelId&&this.triggerPanel.id===this.generatedTriggerPanelId&&this.triggerPanel.removeAttribute("id"),this.triggerPanel=void 0,this.generatedTriggerPanelId=void 0}decorateOwnedPanels(constraintResolution=this.resolveConstraintBounds(this.getContainerSize())){const panels=this.ownedPanels;for(const panel of panels){const snapshot=this.panelOwnership.get(panel);snapshot&&this.adoptPanelOwnership(panel,snapshot)}const collapsingIndex=this.collapseActive?this.collapsingIndex:-1,collapsed=this.collapsedIndexes(),pixelMinimumTotal=constraintResolution.usePanelConstraints?this.panelConstraints.slice(0,this.panelCount).reduce((total,constraint,index)=>collapsed.has(index)?total:total+finiteRange(constraint?.minPx??0,0,0),0):0,redistributedShare=new Array(panels.length).fill(0);if(collapsingIndex===-1){let freedPercent=0;const growableIndexes=[];let growableTotal=0;for(let i=0;i<panels.length;i++){if(collapsed.has(i))continue;const percent=this.sizes[i]??0,constraint=constraintResolution.usePanelConstraints?this.panelConstraints[i]:void 0;if(this.hasClampConstraint(constraint)){const bounds=constraintResolution.bounds[i],clamped=bounds?Math.min(Math.max(percent,bounds.min),bounds.max):percent;clamped<percent&&(freedPercent+=percent-clamped)}else growableIndexes.push(i),growableTotal+=percent}if(freedPercent>0&&growableTotal>0)for(const i of growableIndexes)redistributedShare[i]=freedPercent*((this.sizes[i]??0)/growableTotal)}panels.forEach((panel,i)=>{const snapshot=this.panelOwnership.get(panel);if(!snapshot)return;const percent=this.sizes[i]??0,constraint=constraintResolution.usePanelConstraints?this.panelConstraints[i]:void 0,pixelMinimum=finiteRange(constraint?.minPx??0,0,0);if(collapsingIndex===-1&&!collapsed.has(i)&&pixelMinimum>0&&pixelMinimumTotal>0?this.applyOwnedPanelStyleValue(panel,snapshot,"--_lr-multi-split-panel-min",`min(${pixelMinimum}px, max(0px, calc((100% - var(--_lr-multi-split-gutters, 0px)) * ${pixelMinimum/pixelMinimumTotal})))`):this.applyOwnedPanelStyle(panel,snapshot,"--_lr-multi-split-panel-min",snapshot.styles.get("--_lr-multi-split-panel-min")),this.applyOwnedPanelStyle(panel,snapshot,"inline-size",snapshot.styles.get("inline-size")),this.applyOwnedPanelHidden(panel,snapshot,snapshot.hidden),collapsingIndex===i&&this.collapseState==="rail")this.applyOwnedPanelStyleValue(panel,snapshot,"flex",`0 0 ${this.railWidth}`);else if(collapsingIndex===i&&this.collapseState==="floating"&&!this.open)this.applyOwnedPanelStyleValue(panel,snapshot,"flex","none"),this.applyOwnedPanelHidden(panel,snapshot,!0);else if(collapsingIndex===i&&this.collapseState==="floating")this.applyOwnedPanelStyleValue(panel,snapshot,"inline-size",`var(--lr-multi-split-floating-panel-inline-size, ${collapsed.has(i)?this.expandedSizes.get(panel.getAttribute("panel-id")??"")??percent:percent}%)`);else if(collapsed.has(i))this.applyOwnedPanelStyleValue(panel,snapshot,"flex","0 0 var(--_lr-multi-split-collapsed-panel-size)");else if(collapsingIndex!==-1&&i!==collapsingIndex)this.applyOwnedPanelStyleValue(panel,snapshot,"flex",this.hasClampConstraint(constraint)?`0 1 clamp(${this.minSideExpr(constraint)}, ${percent}%, ${this.maxSideExpr(constraint)})`:`${percent} 1 0%`);else{const adjustedPercent=percent+(redistributedShare[i]??0);this.applyOwnedPanelStyleValue(panel,snapshot,"flex",this.hasClampConstraint(constraint)?`0 1 clamp(${this.minSideExpr(constraint)}, ${percent}%, ${this.maxSideExpr(constraint)})`:`0 1 ${adjustedPercent}%`)}this.applyOwnedPanelStyleValue(panel,snapshot,"order",String(i*2)),this.applyOwnedPanelAttribute(panel,snapshot,"data-collapse-state",collapsingIndex===i?this.collapseState:null),this.applyOwnedPanelAttribute(panel,snapshot,"data-panel-collapsed",collapsed.has(i)?"":null)}),collapsingIndex!==-1?this.setAttribute("data-collapse-state",this.collapseState):this.removeAttribute("data-collapse-state")}render(){const dividers=[],bounds=this.renderConstraintBounds;for(let i=0;i<this.panelCount-1;i++){const{min:valueMin,max:valueMax}=this.dividerValueRange(i,bounds),disabled=this.isDividerDisabled(i),leading=this.dividerPair(i)?.[0]??i;dividers.push(html`<div
|
|
1
|
+
import{__decorate}from"tslib";import{resolveIdReferencesIn}from"../../../internal/aria-reflection.js";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{ModalSurfaceController}from"../../../internal/modal-surface-controller.js";import{leaseInlineStyleProperty}from"../../../internal/style-property-lease.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{activateOverlay,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{isRtl}from"../../../internal/rtl.js";import{repairComposedFocus}from"../../../internal/focus-navigation.js";import{cancelDeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{nextId}from"../../../internal/a11y.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{finiteRange}from"../../../internal/numbers.js";import{SeparatorDragController,separatorArrowDirection,separatorCoordinate,separatorDelta}from"../../../internal/separator-drag.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{CollapseBreakpointController,OrientationBreakpointController}from"../../../internal/orientation-breakpoint.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{resolveCssLength}from"../../../internal/css-length.js";import{styles}from"./multi-split.styles.js";import{LYRA_DEFAULT_resizeDivider,LYRA_DEFAULT_resizeValuePercent}from"../../../internal/default-strings/layout.generated.js";const KEYBOARD_STEP=2;function isPersistedPanelLayout(value){if(typeof value!="object"||value===null)return!1;const candidate=value;if(candidate.version!==1&&candidate.version!==2||!Array.isArray(candidate.panels))return!1;const version=candidate.version;return candidate.panels.every(panel=>{if(typeof panel!="object"||panel===null)return!1;const record=panel;return version===2&&(record.collapsed!==void 0&&typeof record.collapsed!="boolean"||record.expandedSize!==void 0&&!(typeof record.expandedSize=="number"&&Number.isFinite(record.expandedSize)&&record.expandedSize>0))?!1:typeof record.panelId=="string"&&record.panelId!==""&&record.panelId.trim()===record.panelId&&typeof record.size=="number"&&Number.isFinite(record.size)&&record.size>=0})}const NO_COLLAPSED_PANELS=new Set,NO_MIN_PX=0,NO_MAX_PX=1e6,OWNED_PANEL_STYLE_PROPERTIES=["flex","order","inline-size","--_lr-multi-split-panel-min"],OWNED_PANEL_ATTRIBUTES=["data-collapse-state","data-panel-collapsed"];class LyraMultiSplit extends LyraElement{constructor(){super(...arguments),this.toggleProposalDepth=0,this.toggleProposalMutationVersion=0,this.forcedCloseVersion=0,this.sizes=[],this.defaultSizes=[],this.min=10,this.orientation="horizontal",this.orientationBreakpointBasis="container",this.narrowOrientation="vertical",this.panelConstraints=[],this.collapse="none",this.railWidth="3.5rem",this.railBreakpoint=640,this.floatBreakpoint=400,this.collapseBreakpointBasis="container",this.releasePinOnBreakpoint=!1,this.open=!1,this.trigger=null,this.for="",this.collapsedPanels=[],this.panelCount=0,this.sizesReconciledForMembership=!1,this.appliedCollapsed=[],this.expandedSizes=new Map,this._collapseState="wide",this._forced=!1,this.overlayActive=!1,this.justOpened=!1,this.nativeModal=new NativeModalCarrier(this,{onCancel:()=>{this.overlayHandle?.isTopmost()&&this.setOpen(!1)},onUnexpectedClose:()=>{this.overlayHandle?.isTopmost()&&this.setOpen(!1),this.overlayActive&&this.modalSurface.show()}}),this.modalSurface=new ModalSurfaceController(this,this.nativeModal,()=>this.baseEl??null),this.floatingGeometry=new Map,this.openingBlockSize=0,this.syncNativeModalGeometry=()=>{if(!this.overlayActive||!this.isConnected)return;const allocation=this.shadowRoot?.querySelector(".allocation"),reservation=this.shadowRoot?.querySelector(".allocation-reservation"),frame=this.nativeModal.requested?this.shadowRoot?.querySelector("[data-native-modal-carrier]"):this.baseEl;if(!allocation||!reservation||!frame)return;if(!this.nativeModalView){this.nativeModalView=this.ownerDocument.defaultView??void 0,this.nativeModalView?.addEventListener("scroll",this.syncNativeModalGeometry,!0),this.nativeModalView?.addEventListener("resize",this.syncNativeModalGeometry);const Observer=this.nativeModalView?.ResizeObserver;if(Observer){const observer=new Observer(this.syncNativeModalGeometry);this.nativeModalResizeObserver=observer,observer.observe(allocation)}}if(this.floatingFrame!==frame){for(const lease of this.floatingGeometry.values())lease.release();this.floatingGeometry.clear(),this.floatingFrame=frame}const set=(property2,value)=>{const lease=this.floatingGeometry.get(property2);lease?(frame.style.getPropertyValue(property2)!==value||frame.style.getPropertyPriority(property2))&&lease.set(value):this.floatingGeometry.set(property2,leaseInlineStyleProperty(frame,property2,value))};if(reservation.hidden){const height=this.baseEl?.getBoundingClientRect().height??0;this.openingBlockSize=height||this.openingBlockSize||allocation.getBoundingClientRect().height,set("position","fixed"),reservation.style.blockSize=`${this.openingBlockSize}px`,reservation.hidden=!1}const rect=allocation.getBoundingClientRect();for(const[property2,value]of Object.entries({position:"fixed",top:`${rect.top}px`,left:`${rect.left}px`,right:"auto",bottom:"auto",width:`${rect.width}px`,height:`${rect.height}px`,padding:"0","box-sizing":"border-box","max-inline-size":"none"}))set(property2,value)},this.overlayReturnTarget=null,this.overlayOpener=null,this.floatingDialogPanel=null,this.floatingDialogPreviousRole=null,this.floatingDialogPreviousAriaModal=null,this.drags=new Map,this.dragController=new SeparatorDragController(this,event=>this.onPointerMove(event),event=>this.onPointerUp(event)),this.ownedPanels=[],this.panelOwnership=new Map,this.constraintIssueKey="",this.constraintConfigVersion=0,this.renderConstraintBounds=[],this.initializedSizes=!1,this.measuredInlineSize=Number.POSITIVE_INFINITY,this._effectiveOrientation="horizontal",this.collapseObserverGeneration=0,this.gutterObservedDividers=[],this.gutterObservedContainerSize=0,this.orientationBreakpoints=new OrientationBreakpointController(this,()=>this.updateEffectiveOrientation(this.measuredInlineSize,!0)),this.collapseBreakpoints=new CollapseBreakpointController(this,()=>this.updateCollapseState(this.measuredInlineSize,!0)),this.onSlotChange=()=>{this.updateBrowserDerivedState(()=>this.syncPanelMembership())},this.onBackdropClick=()=>{this.overlayHandle?.dismissBackdrop()},this.onModalLayerClick=event=>{event.target===this.baseEl&&this.overlayHandle?.dismissBackdrop()},this.onPointerDown=(e,index)=>{if(e.button!==0||this.isDividerDisabled(index))return;const divider=e.currentTarget;this.dragController.start(e,divider)&&this.drags.set(e.pointerId,{index,startPos:separatorCoordinate(e,this.effectiveOrientation==="vertical"?"block":"inline"),base:this.baseEl,rtl:this.effectiveOrientation==="horizontal"&&isRtl(this),appliedDelta:0,acceptedResize:!1})},this.onPointerMove=e=>{const drag=this.drags.get(e.pointerId);if(!drag)return;if(this.isDividerDisabled(drag.index)){this.endDragGestures();return}if(this.effectiveOrientation==="horizontal"&&isRtl(this)!==drag.rtl){this.endDragGestures();return}const total=this.effectiveOrientation==="vertical"?drag.base.clientHeight:drag.base.clientWidth;if(!Number.isFinite(total)||total<=0){this.endDragGestures();return}const incremental=separatorDelta(drag.startPos,e,this.effectiveOrientation==="vertical"?"block":"inline",drag.rtl)/total*100-drag.appliedDelta,pair=this.dividerPair(drag.index);if(!pair)return;const[leading,trailing]=pair,priorValue=this.sizes[leading];if(priorValue===void 0)return;const paired=this.clampPair(this.sizes,leading,trailing,incremental,total),pairedA=paired[leading],pairedB=paired[trailing];if(pairedA===void 0||pairedB===void 0)return;const next=[...this.sizes];next[leading]=pairedA,next[trailing]=pairedB,this.requestResize(next,!1)&&(drag.appliedDelta+=pairedA-priorValue,drag.acceptedResize=!0)},this.onPointerUp=e=>{const drag=this.drags.get(e.pointerId);drag&&(this.drags.delete(e.pointerId),e.type==="pointerup"&&drag.acceptedResize&&this.settle(),this.dragController.end(e.pointerId))},this.onDividerKeyDown=(e,index)=>{if(this.isDividerDisabled(index)||e.altKey||e.ctrlKey||e.metaKey||e.isComposing)return;const direction=separatorArrowDirection(e,this.effectiveOrientation==="vertical"?"block":"inline",this.effectiveOrientation==="horizontal"&&isRtl(this));if(e.key==="Home"||e.key==="End"){const{min,max}=this.dividerValueRange(index),current=this.sizes[this.dividerPair(index)?.[0]??index];if(current!==void 0){const target=e.key==="Home"?min:max;this.applyDelta(index,target-current,!0)&&e.preventDefault()}}else direction===1?this.applyDelta(index,KEYBOARD_STEP,!0)&&e.preventDefault():direction===-1&&this.applyDelta(index,-KEYBOARD_STEP,!0)&&e.preventDefault()}}static{this.defaultStrings={...super.defaultStrings,resizeDivider:LYRA_DEFAULT_resizeDivider,resizeValuePercent:LYRA_DEFAULT_resizeValuePercent}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["sizes","defaultSizes","panelConstraints","collapsedPanels"])}static{this.styles=[LyraElement.styles,nativeModalCarrierStyles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-resize-request","lr-resize","lr-resize-change","lr-multi-split-panel-collapse-change"])}static{this.properties={collapseState:{reflect:!0,attribute:"collapse-state",noAccessor:!0}}}stopNativeModalGeometry(){this.nativeModalView?.removeEventListener("scroll",this.syncNativeModalGeometry,!0),this.nativeModalView?.removeEventListener("resize",this.syncNativeModalGeometry),this.nativeModalView=void 0,this.nativeModalResizeObserver?.disconnect(),this.nativeModalResizeObserver=void 0;for(const lease of this.floatingGeometry.values())lease.release();this.floatingGeometry.clear(),this.floatingFrame=void 0,this.openingBlockSize=0;const reservation=this.shadowRoot?.querySelector(".allocation-reservation");reservation&&(reservation.hidden=!0,reservation.style.removeProperty("block-size"))}nativeModalLabel(){const panel=this.floatingPanelEl;return panel?panel.hasAttribute("aria-label")?panel.getAttribute("aria-label"):resolveIdReferencesIn(panel.getRootNode(),panel.getAttribute("aria-labelledby")).map(element=>element.textContent?.trim()).filter(Boolean).join(" ")||this.getAttribute("aria-label"):this.getAttribute("aria-label")}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.responsiveObservationEnabled&&this.seedInlineSize(),this.seedFirstRenderState(()=>this.syncPanelMembership(!1)),this.hasUpdated&&this.syncPanelMembership(!1),this.initializedSizes&&this.ensureSizes(),this.responsiveObservationEnabled&&this.armCollapseObserver(),this.hasUpdated&&this.overlayActive&&(this.overlayHandle?.isActive()?this.overlayHandle.resume():this.activateFloatingOverlay(),queueMicrotask(()=>{!this.isConnected||!this.overlayActive||(this.syncNativeModalGeometry(),this.modalSurface.show(),this.overlayHandle?.focusInitial())})),this.hasUpdated&&this.syncExternalTriggerA11y()}seedInlineSize(){const hostWidth=this.getBoundingClientRect().width;hostWidth>0&&(this.measuredInlineSize=hostWidth)}disconnectedCallback(){this.modalSurface.disconnect(),this.stopNativeModalGeometry(),super.disconnectedCallback(),this.endDragGestures(),this.resetCollapseObserver(),this.resetGutterObserver(),this.overlayHandle?.suspend(),cancelDeferredFocusReturn(this),this.releaseExternalTriggerA11y(),this.releaseOwnedPanels()}adoptedCallback(){super.adoptedCallback(),cancelDeferredFocusReturn(this),this.releaseExternalTriggerA11y(),this.endDragGestures(),this.resetCollapseObserver(),this.resetGutterObserver(),this.releaseOwnedPanels()}firstUpdated(changed){super.firstUpdated(changed),this.responsiveObservationEnabled&&this.armCollapseObserver()}willUpdate(changed){if(super.willUpdate(changed),(!Number.isSafeInteger(this.panelCount)||this.panelCount<0)&&(this.panelCount=this.ownedPanels.length),!this.ownerDocument&&this.panelCount===0&&(this.panelCount=Math.max(this.sizes.length,this.defaultSizes.length,this.panelConstraints.length)),!this.initializedSizes)this.initializeSizes(),this.initializedSizes=!0;else if(changed.has("sizes")){const previous=changed.get("sizes");this.sizesReconciledForMembership?this.sizesReconciledForMembership=!1:!this.validLiveSizes(this.sizes)&&!this.acceptFoldedSizes(previous)&&(Array.isArray(previous)&&this.validLiveSizes(previous)?this.sizes=[...previous]:(this.sizes=[],this.ensureSizes()))}else this.sizes.length===0&&this.ensureSizes();if(this.syncCollapsedLayout(),(changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.orientationBreakpoints.configure(this.orientationBreakpoint,this.orientationBreakpointBasis),!this.hasUpdated&&this.isConnected&&this.responsiveObservationEnabled&&this.seedInlineSize(),(changed.has("orientation")||changed.has("narrowOrientation")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.updateEffectiveOrientation(this.measuredInlineSize,this.hasUpdated&&this.orientationBreakpointBasis==="viewport"),changed.has("collapse")||changed.has("railBreakpoint")||changed.has("floatBreakpoint")||changed.has("collapseBreakpointBasis")){const previousEffective=changed.has("collapse")?this.effectiveCollapseStateFor(changed.get("collapse")??"none"):this.collapseState;changed.has("collapse")&&previousEffective!=="wide"&&this.endDragGestures(),this.collapseBreakpoints.configure(this.railBreakpoint,this.floatBreakpoint,this.collapseBreakpointBasis),this.collapsingIndex!==-1&&!this._forced&&(this._collapseState=this.collapseBreakpoints.classify(this.measuredInlineSize)),this.applyEffectiveCollapseTransition(previousEffective,this.collapseState,this.hasUpdated)}if(changed.has("open")||changed.has("collapseState")||changed.has("collapse")||changed.has("panelCount")){const next=this.collapseState==="floating"&&this.open;next!==this.overlayActive&&(this.overlayActive=next,next?(this.justOpened=!0,this.activateFloatingOverlay()):this.deactivateFloatingOverlay())}this.renderConstraintBounds=this.resolveConstraintBounds(this.getContainerSize()).bounds}get collapseState(){return this.effectiveCollapseStateFor(this.collapse)}set collapseState(next){if(next==="auto"){this.releaseCollapsePin(),this.updateCollapseState(this.currentMeasuredWidth());return}this._forced=!0,this.pinnedBand=this.collapseBreakpoints.classify(this.pinMeasurementWidth()),this.setRequestedCollapseState(next)}expandPane(){this.applyPaneIntent(!0)}collapsePane(){this.applyPaneIntent(!1)}togglePane(){this.applyPaneIntent(!this.paneExpanded)}collapsePanel(panel){return this.setPanelCollapsed(panel,!0)}expandPanel(panel){return this.setPanelCollapsed(panel,!1)}togglePanel(panel){const panelId=this.panelIdOf(panel);return panelId===null?!1:(this.syncCollapsedLayout(),this.setPanelCollapsed(panelId,!this.appliedCollapsed.includes(panelId)))}panelIdOf(panel){return typeof panel=="string"?panel:this.ownedPanels.includes(panel)?panel.getAttribute("panel-id"):null}setPanelCollapsed(panel,collapsed){const panelId=this.panelIdOf(panel),ids=this.panelIdsFor(this.ownedPanels);if(panelId===null||!ids||ids.length<2||!ids.includes(panelId))return!1;const requested=this.collapsedPanels.filter(id=>typeof id=="string"),next=collapsed?[...requested.filter(id=>id!==panelId),panelId]:requested.filter(id=>id!==panelId);return this.initializedSizes?(this.syncCollapsedLayout(),this.appliedCollapsed.includes(panelId)===collapsed||collapsed&&!this.targetCollapsedIds(ids,next).includes(panelId)?!1:(this.collapsedPanels=next,this.syncCollapsedLayout(),this.persist(),this.decorateOwnedPanels(),this.emit("lr-multi-split-panel-collapse-change",{panelId,collapsed,collapsedPanels:[...this.appliedCollapsed],sizes:[...this.sizes]}),!0)):requested.includes(panelId)===collapsed?!1:(this.collapsedPanels=next,!0)}targetCollapsedIds(ids,requested=this.collapsedPanels){if(requested.length===0||!ids||ids.length<2)return[];const names=new Set(requested),target=ids.filter(id=>names.has(id));return target.length===ids.length&&target.pop(),target}indexesOf(ids,collapsed){if(collapsed.length===0)return NO_COLLAPSED_PANELS;const names=new Set(collapsed),indexes=new Set;return ids.forEach((id,index)=>{names.has(id)&&indexes.add(index)}),indexes}collapsedIndexes(){return this.appliedCollapsed.length===0?NO_COLLAPSED_PANELS:this.indexesOf(this.ownedPanels.map(panel=>panel.getAttribute("panel-id")??""),this.appliedCollapsed)}syncCollapsedLayout(){if(this.collapsedPanels.length===0&&this.appliedCollapsed.length===0)return;const ids=this.panelIdsFor(this.ownedPanels);if(!ids){this.appliedCollapsed.length>0&&(this.appliedCollapsed=[],this.expandedSizes.clear(),this.endDragGestures(),this.sizes=[],this.ensureSizes());return}const present=new Set(ids),applied=this.appliedCollapsed.filter(id=>present.has(id));for(const id of[...this.expandedSizes.keys()])present.has(id)||this.expandedSizes.delete(id);const target=this.targetCollapsedIds(ids);if(applied.length===target.length&&applied.every((id,index)=>id===target[index])&&this.validLiveSizes(this.sizes,this.indexesOf(ids,applied))){this.appliedCollapsed=applied;return}this.endDragGestures(),this.sizes=this.foldSizes(ids,applied,target),this.appliedCollapsed=target}foldSizes(ids,from,to){const next=ids.map((_,index)=>this.sizes[index]??0),closed=new Set(this.indexesOf(ids,from)),toIndexes=this.indexesOf(ids,to),bounds=this.resolveConstraintBounds(this.getContainerSize(),toIndexes).bounds,floor=this.normalizedDefaultMin(),openIndexes=()=>ids.map((_,index)=>index).filter(index=>!closed.has(index));for(const index of toIndexes){if(closed.has(index))continue;const freed=next[index];this.expandedSizes.set(ids[index],freed),next[index]=0,closed.add(index),this.distributeShare(next,freed,openIndexes(),bounds)}for(const index of[...closed]){if(toIndexes.has(index))continue;closed.delete(index);const id=ids[index],bound=bounds[index]??{min:floor,max:1/0},remembered=this.expandedSizes.get(id)??100/ids.length;this.expandedSizes.delete(id);const wanted=Math.min(Math.max(remembered,bound.min,floor),bound.max),donors=openIndexes().filter(open=>open!==index),slack=donors.map(donor=>Math.max(0,next[donor]-Math.max(bounds[donor]?.min??floor,floor))),slackTotal=slack.reduce((total,value)=>total+value,0),taken=Math.min(wanted,slackTotal);donors.forEach((donor,position)=>{next[donor]=next[donor]-(slackTotal>0?taken*slack[position]/slackTotal:0)}),next[index]=next[index]+taken}if(this.validLiveSizes(next,toIndexes))return next;const openCount=ids.length-toIndexes.size;return ids.map((_,index)=>toIndexes.has(index)?0:100/openCount)}distributeShare(sizes,amount,indexes,bounds){let remaining=amount,pool=indexes.filter(index=>sizes[index]<(bounds[index]?.max??1/0)-1e-9);for(;remaining>1e-9&&pool.length>0;){const weightTotal=pool.reduce((total2,index)=>total2+sizes[index],0),capped=new Set;let given=0;for(const index of pool){const share=weightTotal>0?remaining*sizes[index]/weightTotal:remaining/pool.length,room=(bounds[index]?.max??1/0)-sizes[index],portion=Math.min(share,room);sizes[index]=sizes[index]+portion,given+=portion,portion>=room-1e-9&&capped.add(index)}remaining-=given,pool=pool.filter(index=>!capped.has(index))}if(remaining<=1e-9||indexes.length===0)return;const total=indexes.reduce((sum,index)=>sum+sizes[index],0);for(const index of indexes)sizes[index]=sizes[index]+(total>0?remaining*sizes[index]/total:remaining/indexes.length)}dividerPair(index){const collapsed=this.collapsedIndexes();if(collapsed.size===0)return[index,index+1];const held=this.collapseActive?this.collapsingIndex:-1,closed=panel=>collapsed.has(panel)||panel===held;let leading=index;for(;leading>=0&&closed(leading);)leading--;let trailing=index+1;for(;trailing<this.panelCount&&closed(trailing);)trailing++;return leading>=0&&trailing<this.panelCount?[leading,trailing]:null}get paneExpanded(){const state=this.collapseState;return state==="floating"?this.open:state==="wide"}applyPaneIntent(expanded){if(this.collapsingIndex===-1)return;const band=this.collapseBreakpoints.classify(this.pinMeasurementWidth());if(band==="floating"){this.collapseState!=="floating"&&(this.releaseCollapsePin(),this.setRequestedCollapseState("floating")),this.open=expanded;return}const target=expanded?"wide":"rail";if(this.collapseState!==target){if(target===band){this.releaseCollapsePin(),this.setRequestedCollapseState(target);return}this.collapseState=target}}releaseCollapsePin(){this._forced=!1,this.pinnedBand=void 0}pinMeasurementWidth(){const live=this.currentMeasuredWidth();return live>0?live:this.measuredInlineSize}get effectiveOrientation(){return this._effectiveOrientation}get responsiveObservationEnabled(){return this.collapse!=="none"||this.orientationBreakpoints.containerObservationEnabled}updateEffectiveOrientation(width,shouldEmit){const next=this.orientationBreakpoints.isBelow(width)?this.narrowOrientation:this.orientation;next!==this._effectiveOrientation&&(this.endDragGestures(),this._effectiveOrientation=next,this.requestUpdate(),shouldEmit&&this.emit("lr-multi-split-orientation-change",{orientation:next}),this._forced&&this.releasePinOnBreakpoint&&(this.releaseCollapsePin(),this.updateCollapseState(width,this.hasUpdated)))}currentMeasuredWidth(){return this.baseEl?.clientWidth??0}effectiveCollapseStateFor(collapse){return collapse!=="none"&&this.panelCount>=2?this._collapseState:"wide"}applyEffectiveCollapseTransition(previous,next,shouldEmit=!0){if(previous===next)return;this.endDragGestures(),this.requestUpdate("collapseState",previous);const forceClose=previous==="floating"&&next!=="floating"&&this.open,forcedCloseVersion=this.forcedCloseVersion;shouldEmit&&(this.relocateFocusOutOfCollapsingPanel(next),this.decorateOwnedPanels(),this.emit("lr-multi-split-collapse-change",{state:next})),forceClose&&this.forcedCloseVersion===forcedCloseVersion&&this.collapseState!=="floating"&&this.setOpen(!1,{force:!0})}relocateFocusOutOfCollapsingPanel(next){if(next==="wide"||next==="floating"&&this.open)return;const index=this.collapsingIndex;if(index===-1)return;const panel=this.ownedPanels[index];panel&&repairComposedFocus(panel,()=>this.collapseFocusFallbacks(panel))}collapseFocusFallbacks(collapsing){const dividers=[...this.renderRoot.querySelectorAll('[part="divider"]')];return[...new Set([...this.ownedPanels.filter(panel=>panel!==collapsing),...dividers.filter((_,index)=>!this.isDividerDisabled(index)),...dividers])]}setOpen(next,options){if(options?.force){this.open=next,this.forcedCloseVersion+=1,this.emit("lr-toggle",{expanded:next});return}if(this.open===next)return;const collapseState=this.collapseState,open=this.open,mutationVersion=this.toggleProposalMutationVersion;this.toggleProposalDepth+=1;try{if(this.emit("lr-toggle-request",{expanded:next},{cancelable:!0}).defaultPrevented||this.toggleProposalMutationVersion!==mutationVersion||this.collapseState!==collapseState||this.open!==open)return}finally{this.toggleProposalDepth-=1}this.open=next,this.emit("lr-toggle",{expanded:next})}requestUpdate(name,oldValue,options){this.toggleProposalDepth>0&&(name==="open"&&oldValue!==this.open||name==="collapse"&&oldValue!==this.collapse||name==="collapseState"&&oldValue!==this.collapseState)&&(this.toggleProposalMutationVersion+=1),super.requestUpdate(name,oldValue,options)}setRequestedCollapseState(next,shouldEmit=!0){const previousEffective=this.collapseState;if(next===this._collapseState)return;this._collapseState=next;const nextEffective=this.collapseState;this.applyEffectiveCollapseTransition(previousEffective,nextEffective,shouldEmit),previousEffective===nextEffective&&next!==nextEffective&&this.requestUpdate("collapseState",next)}get storageFullKey(){return this.storageKey?`lr-multi-split:${this.storageKey}:panels`:void 0}panelIdsFor(panels){const ids=[],seen=new Set;for(const panel of panels){const panelId=panel.getAttribute("panel-id")??"";if(!panelId||panelId.trim()!==panelId||seen.has(panelId))return null;seen.add(panelId),ids.push(panelId)}return ids}reconcileIdentitySizes(previousIds,previousValues,nextIds){if(previousIds.length!==previousValues.length||nextIds.length===0)return null;const previousSizes=new Map;previousIds.forEach((panelId,index)=>{previousSizes.set(panelId,previousValues[index])});const retainedTotal=nextIds.reduce((total,panelId)=>total+(previousSizes.get(panelId)??0),0),missingCount=nextIds.filter(panelId=>!previousSizes.has(panelId)).length;if(!(retainedTotal>0)){const equal=100/nextIds.length;return nextIds.map(()=>equal)}const newShare=100/nextIds.length,retainedScale=(100-newShare*missingCount)/retainedTotal;return nextIds.map(panelId=>{const previous=previousSizes.get(panelId);return previous===void 0?newShare:previous*retainedScale})}reconcileSizesByPanelId(previousPanels,nextPanels){if(previousPanels.length!==this.sizes.length||nextPanels.length===0)return null;const previousIds=this.panelIdsFor(previousPanels),nextIds=this.panelIdsFor(nextPanels);return!previousIds||!nextIds?null:this.reconcileIdentitySizes(previousIds,this.sizes,nextIds)}validInitialSizes(value,collapsed=this.collapsedIndexes()){return!Array.isArray(value)||value.length!==this.panelCount||!value.every((size,index)=>collapsed.has(index)?size===0:Number.isFinite(size)&&size>=this.safeMin)?!1:Math.abs(value.reduce((sum,size)=>sum+size,0)-100)<.01}validLiveSizes(value,collapsed=this.collapsedIndexes()){if(!Array.isArray(value)||value.length!==this.panelCount)return!1;const floor=this.normalizedDefaultMin();return value.every((size,index)=>collapsed.has(index)?size===0:Number.isFinite(size)&&size>=floor)?Math.abs(value.reduce((sum,size)=>sum+size,0)-100)<.01:!1}resolveDefaultSizes(){if(this.defaultSizes.length===0)return null;if(!this.defaultSizes.some(entry=>typeof entry=="string")){const numbers=this.defaultSizes;return this.validInitialSizes(numbers)?[...numbers]:null}const containerSize=this.currentMeasuredWidth()||this.getBoundingClientRect().width;if(!(containerSize>0))return null;const resolvedPx=[];for(const entry of this.defaultSizes){if(typeof entry=="number"){if(!Number.isFinite(entry))return null;resolvedPx.push(entry/100*containerSize);continue}const px=resolveCssLength(entry,{host:this,percentBase:containerSize,viewportBasis:this.ownerDocument.defaultView??void 0});if(px==null||!(px>=0))return null;resolvedPx.push(px)}const sum=resolvedPx.reduce((total,size)=>total+size,0);if(!(sum>0))return null;const normalized=resolvedPx.map(size=>size/sum*100);return this.validInitialSizes(normalized)?normalized:null}acceptFoldedSizes(previous){const ids=this.panelIdsFor(this.ownedPanels),target=this.targetCollapsedIds(ids);return!ids||target.length===0||!this.validLiveSizes(this.sizes,this.indexesOf(ids,target))?!1:(ids.forEach((panelId,index)=>{if(!target.includes(panelId)||this.appliedCollapsed.includes(panelId))return;const share=Array.isArray(previous)?previous[index]:void 0;typeof share=="number"&&share>0&&this.expandedSizes.set(panelId,share)}),this.appliedCollapsed=target,!0)}initializeSizes(){if(this.validInitialSizes(this.sizes))return;const panelIds=this.panelIdsFor(this.ownedPanels),target=this.targetCollapsedIds(panelIds);if(panelIds&&target.length>0&&this.validInitialSizes(this.sizes,this.indexesOf(panelIds,target))){this.appliedCollapsed=target;return}if(this.loadPersisted())return;const resolved=this.resolveDefaultSizes();if(resolved){this.sizes=resolved;return}this.sizes=[],this.ensureSizes()}loadPersisted(){const panelIds=this.panelIdsFor(this.ownedPanels);if(!panelIds)return!1;const parsed=readPersistedState(this.storageFullKey,isPersistedPanelLayout);if(!parsed||parsed.panels.length===0)return!1;const persistedIds=[],persistedSizes=[],persistedCollapsed=new Map,seen=new Set;for(const panel of parsed.panels){if(seen.has(panel.panelId))return!1;seen.add(panel.panelId),persistedIds.push(panel.panelId),persistedSizes.push(panel.size),parsed.version===2&&panel.collapsed===!0&&persistedCollapsed.set(panel.panelId,panel.expandedSize)}if(Math.abs(persistedSizes.reduce((sum,size)=>sum+size,0)-100)>=.01)return!1;const normalized=this.reconcileIdentitySizes(persistedIds,persistedSizes,panelIds);if(!normalized)return!1;const restoredCollapsed=panelIds.filter(panelId=>persistedCollapsed.has(panelId));if(!this.validInitialSizes(normalized,this.indexesOf(panelIds,restoredCollapsed)))return!1;this.sizes=normalized,this.appliedCollapsed=restoredCollapsed;for(const panelId of restoredCollapsed){const expandedSize=persistedCollapsed.get(panelId);expandedSize!==void 0&&this.expandedSizes.set(panelId,expandedSize)}return restoredCollapsed.length>0&&this.collapsedPanels.length===0&&(this.collapsedPanels=restoredCollapsed),!0}persist(){const panelIds=this.panelIdsFor(this.ownedPanels);if(!panelIds||panelIds.length!==this.sizes.length)return;const collapsed=new Set(this.appliedCollapsed),layout={version:collapsed.size>0?2:1,panels:panelIds.map((panelId,index)=>{const size=this.sizes[index];if(!collapsed.has(panelId))return{panelId,size};const expandedSize=this.expandedSizes.get(panelId);return expandedSize===void 0?{panelId,size,collapsed:!0}:{panelId,size,collapsed:!0,expandedSize}})};writePersistedState(this.storageFullKey,layout)}ensureSizes(){if(this.panelCount===this.sizes.length)return;if(this.panelCount<=0){this.sizes=[];return}if(this.sizes.length===0){const equal=100/this.panelCount;this.sizes=Array.from({length:this.panelCount},()=>equal);return}const diff=this.panelCount-this.sizes.length;if(diff>0){const newShare=100/this.panelCount,scale=(100-newShare*diff)/100;this.sizes=[...this.sizes.map(s=>s*scale),...Array.from({length:diff},()=>newShare)]}else{const kept=this.sizes.slice(0,this.panelCount),removedTotal=this.sizes.slice(this.panelCount).reduce((sum,s)=>sum+s,0),keptTotal=kept.reduce((sum,s)=>sum+s,0)||1;this.sizes=kept.map(s=>s+s/keptTotal*removedTotal)}}readPanelStyle(panel,property2){return{value:panel.style.getPropertyValue(property2),priority:panel.style.getPropertyPriority(property2)}}samePanelStyle(left,right){return left.value===right.value&&left.priority===right.priority}snapshotPanelOwnership(panel){const styles2=new Map;for(const property2 of OWNED_PANEL_STYLE_PROPERTIES)styles2.set(property2,this.readPanelStyle(panel,property2));const attributes=new Map;for(const name of OWNED_PANEL_ATTRIBUTES)attributes.set(name,panel.getAttribute(name));return{styles:styles2,appliedStyles:new Map,hidden:panel.hidden,attributes,appliedAttributes:new Map}}adoptPanelOwnership(panel,snapshot){for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const current=this.readPanelStyle(panel,property2),applied=snapshot.appliedStyles.get(property2);(applied&&!this.samePanelStyle(current,applied)||!applied&&!this.samePanelStyle(current,snapshot.styles.get(property2)))&&snapshot.styles.set(property2,current)}(snapshot.appliedHidden!==void 0&&panel.hidden!==snapshot.appliedHidden||snapshot.appliedHidden===void 0&&panel.hidden!==snapshot.hidden)&&(snapshot.hidden=panel.hidden);for(const name of OWNED_PANEL_ATTRIBUTES){const current=panel.getAttribute(name),expected=snapshot.appliedAttributes.has(name)?snapshot.appliedAttributes.get(name):snapshot.attributes.get(name);current!==expected&&snapshot.attributes.set(name,current)}}applyOwnedPanelStyle(panel,snapshot,property2,value){value.value===""?panel.style.removeProperty(property2):panel.style.setProperty(property2,value.value,value.priority),snapshot.appliedStyles.set(property2,this.readPanelStyle(panel,property2))}applyOwnedPanelStyleValue(panel,snapshot,property2,value){this.applyOwnedPanelStyle(panel,snapshot,property2,{value,priority:""})}applyOwnedPanelHidden(panel,snapshot,hidden){panel.hidden=hidden,snapshot.appliedHidden=panel.hidden}applyOwnedPanelAttribute(panel,snapshot,name,value){value===null?panel.removeAttribute(name):panel.setAttribute(name,value),snapshot.appliedAttributes.set(name,panel.getAttribute(name))}restorePanelOwnership(panel,snapshot){this.adoptPanelOwnership(panel,snapshot);for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const value=snapshot.styles.get(property2);value.value===""?panel.style.removeProperty(property2):panel.style.setProperty(property2,value.value,value.priority)}panel.hidden=snapshot.hidden;for(const name of OWNED_PANEL_ATTRIBUTES){const value=snapshot.attributes.get(name)??null;value===null?panel.removeAttribute(name):panel.setAttribute(name,value)}}panelProjectionDiverged(panel,snapshot){for(const property2 of OWNED_PANEL_STYLE_PROPERTIES){const current=this.readPanelStyle(panel,property2),expected=snapshot.appliedStyles.get(property2)??snapshot.styles.get(property2);if(!this.samePanelStyle(current,expected))return!0}return panel.hidden!==(snapshot.appliedHidden??snapshot.hidden)?!0:OWNED_PANEL_ATTRIBUTES.some(name=>{const expected=snapshot.appliedAttributes.has(name)?snapshot.appliedAttributes.get(name):snapshot.attributes.get(name);return panel.getAttribute(name)!==expected})}resetPanelOwnershipObserver(){this.panelOwnershipObserver?.disconnect(),this.panelOwnershipObserver=void 0}observeOwnedPanels(){this.resetPanelOwnershipObserver();const MutationObserverConstructor=this.ownerDocument.defaultView?.MutationObserver;if(!MutationObserverConstructor||!this.isConnected||this.ownedPanels.length===0)return;const observer=new MutationObserverConstructor(records=>{records.some(record=>{const panel=record.target,snapshot=this.panelOwnership.get(panel);return snapshot?this.panelProjectionDiverged(panel,snapshot):!1})&&this.requestUpdate()});this.panelOwnershipObserver=observer;for(const panel of this.ownedPanels)observer.observe(panel,{attributes:!0,attributeFilter:["style","hidden",...OWNED_PANEL_ATTRIBUTES]})}samePanelSequence(next){return next.length===this.ownedPanels.length&&next.every((panel,index)=>panel===this.ownedPanels[index])}syncPanelMembership(reconcileSizes=!0){const next=[...this.children].filter(child=>child!==this.nativeModal.helperMount);if(this.samePanelSequence(next))return;const previousPanels=this.ownedPanels,identitySizes=reconcileSizes?this.reconcileSizesByPanelId(previousPanels,next):null,previousEffective=this.collapseState,nextSet=new Set(next);for(const panel of this.ownedPanels){if(nextSet.has(panel))continue;const snapshot=this.panelOwnership.get(panel);snapshot&&this.restorePanelOwnership(panel,snapshot),this.panelOwnership.delete(panel)}for(const panel of next)this.panelOwnership.has(panel)||this.panelOwnership.set(panel,this.snapshotPanelOwnership(panel));const countChanged=next.length!==this.panelCount;this.ownedPanels=next,this.panelCount=next.length,this.collapsingIndex!==-1&&!this._forced&&(this._collapseState=this.collapseBreakpoints.classify(this.currentMeasuredWidth())),this.applyEffectiveCollapseTransition(previousEffective,this.collapseState,this.hasUpdated),identitySizes?(this.sizesReconciledForMembership=!0,this.sizes=identitySizes):countChanged&&reconcileSizes&&(this.sizesReconciledForMembership=!0,this.ensureSizes()),this.observeOwnedPanels(),this.hasUpdated&&this.requestUpdate()}releaseOwnedPanels(){this.resetPanelOwnershipObserver();for(const panel of this.ownedPanels){const snapshot=this.panelOwnership.get(panel);snapshot&&this.restorePanelOwnership(panel,snapshot)}this.ownedPanels=[],this.panelOwnership.clear()}getContainerSize(){return this.baseEl?this.effectiveOrientation==="vertical"?this.baseEl.clientHeight:this.baseEl.clientWidth:0}resetGutterObserver(){this.gutterObserverFrame!==void 0&&(this.gutterObserverDocument?.defaultView?.cancelAnimationFrame(this.gutterObserverFrame),this.gutterObserverFrame=void 0),this.gutterResizeObserver?.disconnect(),this.gutterResizeObserver=void 0,this.gutterObserverDocument=void 0,this.gutterObservedDividers=[],this.baseEl?.style.removeProperty("--_lr-multi-split-gutters")}updateGutterBudget(){const view=this.ownerDocument.defaultView,base=this.baseEl;if(!view||!base)return;const vertical=this.effectiveOrientation==="vertical",value=`${this.gutterObservedDividers.reduce((total,divider)=>{const style=view.getComputedStyle(divider),properties=vertical?["height","padding-top","padding-bottom","border-top-width","border-bottom-width"]:["width","padding-left","padding-right","border-left-width","border-right-width"],boxProperties=style.boxSizing==="border-box"?properties.slice(0,1):properties;return total+boxProperties.reduce((size,property2)=>size+finiteRange(parseFloat(style.getPropertyValue(property2)),0,0),0)},0)}px`;base.style.getPropertyValue("--_lr-multi-split-gutters")!==value&&base.style.setProperty("--_lr-multi-split-gutters",value)}syncGutterObserver(enabled){const base=this.baseEl;if(!enabled||!this.isConnected||!base){this.resetGutterObserver();return}const ownerDocument=this.ownerDocument,dividers=[...base.querySelectorAll('[part="divider"]')];if(this.gutterResizeObserver&&this.gutterObserverDocument===ownerDocument&÷rs.length===this.gutterObservedDividers.length&÷rs.every((divider,index)=>divider===this.gutterObservedDividers[index])){this.updateGutterBudget();return}this.resetGutterObserver(),this.gutterObservedDividers=dividers,this.gutterObserverDocument=ownerDocument,this.gutterObservedContainerSize=this.getContainerSize(),this.updateGutterBudget();const ownerWindow=ownerDocument.defaultView,ResizeObserverConstructor=ownerWindow?.ResizeObserver;if(!ownerWindow||!ResizeObserverConstructor)return;const observer=new ResizeObserverConstructor(()=>{if(this.gutterResizeObserver!==observer||!this.isConnected||this.ownerDocument!==ownerDocument)return;this.updateGutterBudget();const size=this.getContainerSize();size!==this.gutterObservedContainerSize&&(this.gutterObservedContainerSize=size,this.requestUpdate())});this.gutterResizeObserver=observer;const frame=ownerWindow.requestAnimationFrame(()=>{if(!(this.gutterObserverFrame!==frame||this.gutterResizeObserver!==observer||!this.isConnected||this.ownerDocument!==ownerDocument||this.baseEl!==base)){this.gutterObserverFrame=void 0,observer.observe(base,{box:"border-box"});for(const divider of dividers)observer.observe(divider,{box:"border-box"})}});this.gutterObserverFrame=frame}get collapsingIndex(){return this.collapse==="none"||this.panelCount<2?-1:this.collapse==="start"?0:this.panelCount-1}get collapseActive(){return this.collapsingIndex!==-1&&this.collapseState!=="wide"}isDividerDisabled(index){if(this.collapseActive){const adjacent=this.collapsingIndex===0?0:this.panelCount-2;if(index===adjacent)return!0}return this.dividerPair(index)===null}updateCollapseState(width,shouldEmit=!0){if(this.collapse==="none")return;const classified=this.collapseBreakpoints.classify(width);if(this._forced){if(!this.releasePinOnBreakpoint||classified===this.pinnedBand)return;this.releaseCollapsePin()}this.setRequestedCollapseState(classified,shouldEmit)}armCollapseObserver(){const observedElement=this.baseEl;if(!this.isConnected||!observedElement)return;const ownerDocument=this.ownerDocument;if(this.collapseResizeObserver&&this.collapseObservedElement===observedElement&&this.collapseObserverOwnerDocument===ownerDocument)return;this.resetCollapseObserver();const ResizeObserverConstructor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverConstructor)return;const generation=this.collapseObserverGeneration,observer=new ResizeObserverConstructor(entries=>{if(this.collapseResizeObserver!==observer||this.collapseObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.baseEl!==observedElement)return;const box=entries[0]?.contentBoxSize?.[0],width=box?box.inlineSize:observedElement.getBoundingClientRect().width;this.measuredInlineSize=width,this.updateCollapseState(width),this.updateEffectiveOrientation(width,!0)});this.collapseResizeObserver=observer,this.collapseObservedElement=observedElement,this.collapseObserverOwnerDocument=ownerDocument,observer.observe(observedElement)}resetCollapseObserver(){this.collapseObserverGeneration+=1,this.collapseResizeObserver?.disconnect(),this.collapseResizeObserver=void 0,this.collapseObservedElement=void 0,this.collapseObserverOwnerDocument=void 0}syncCollapseObserver(){if(!this.responsiveObservationEnabled){this.resetCollapseObserver();return}this.armCollapseObserver()}get safeMin(){return finiteRange(this.min,10,0)}normalizedDefaultMin(){if(this.panelCount<=0)return 0;const requested=this.safeMin,available=Math.max(0,100-KEYBOARD_STEP);return Math.min(requested,available/this.panelCount)}resolveConstraintBounds(containerSize,collapsed=this.collapsedIndexes()){const fallbackMin=this.normalizedDefaultMin(),fallback=Array.from({length:this.panelCount},(_,index)=>collapsed.has(index)?{min:0,max:0}:{min:fallbackMin,max:1/0});if(this.panelCount<=0)return{bounds:[],usePanelConstraints:!0};const bounds=[];let minimumTotal=0,maximumTotal=0,hasUnboundedMaximum=!1,issueReason;for(let index=0;index<this.panelCount;index++){if(collapsed.has(index)){bounds.push({min:0,max:0});continue}const constraint=this.panelConstraints[index];let min=this.safeMin,max=1/0,minSet=!1,maxSet=!1;constraint&&(constraint.minPx!=null&&Number.isFinite(constraint.minPx)&&constraint.minPx>=0&&containerSize>0&&(min=constraint.minPx/containerSize*100,minSet=!0),constraint.minPercent!=null&&Number.isFinite(constraint.minPercent)&&constraint.minPercent>=0&&(min=minSet?Math.max(min,constraint.minPercent):constraint.minPercent,minSet=!0),constraint.maxPx!=null&&Number.isFinite(constraint.maxPx)&&constraint.maxPx>=0&&containerSize>0&&(max=constraint.maxPx/containerSize*100,maxSet=!0),constraint.maxPercent!=null&&Number.isFinite(constraint.maxPercent)&&constraint.maxPercent>=0&&(max=maxSet?Math.min(max,constraint.maxPercent):constraint.maxPercent,maxSet=!0),(constraint.minPx!=null&&(!Number.isFinite(constraint.minPx)||constraint.minPx<0)||constraint.maxPx!=null&&(!Number.isFinite(constraint.maxPx)||constraint.maxPx<0)||constraint.minPercent!=null&&(!Number.isFinite(constraint.minPercent)||constraint.minPercent<0)||constraint.maxPercent!=null&&(!Number.isFinite(constraint.maxPercent)||constraint.maxPercent<0))&&(issueReason??="minimum-exceeds-maximum")),min>max&&(issueReason??="minimum-exceeds-maximum"),bounds.push({min,max}),minimumTotal+=min,Number.isFinite(max)?maximumTotal+=max:hasUnboundedMaximum=!0}return issueReason==null&&minimumTotal>100+1e-9&&(issueReason="minimum-total"),issueReason==null&&!hasUnboundedMaximum&&maximumTotal<100-1e-9&&(issueReason="maximum-total"),issueReason==null?{bounds,usePanelConstraints:!0}:{bounds:fallback,usePanelConstraints:!1,issue:{reason:issueReason,panelCount:this.panelCount,minimumTotal,maximumTotal:hasUnboundedMaximum?null:maximumTotal,containerSize}}}hasClampConstraint(constraint){return!!constraint&&(constraint.minPx!=null||constraint.maxPx!=null||constraint.minPercent!=null||constraint.maxPercent!=null)}minSideExpr(constraint){const terms=[];return constraint?.minPx!=null&&Number.isFinite(constraint.minPx)&&constraint.minPx>=0&&terms.push(`${constraint.minPx}px`),constraint?.minPercent!=null&&Number.isFinite(constraint.minPercent)&&constraint.minPercent>=0&&terms.push(`${constraint.minPercent}%`),terms.length===0?`${NO_MIN_PX}px`:terms.length===1?terms[0]:`max(${this.safeMin}%, ${terms.join(", ")})`}maxSideExpr(constraint){const terms=[];return constraint?.maxPx!=null&&Number.isFinite(constraint.maxPx)&&constraint.maxPx>=0&&terms.push(`${constraint.maxPx}px`),constraint?.maxPercent!=null&&Number.isFinite(constraint.maxPercent)&&constraint.maxPercent>=0&&terms.push(`${constraint.maxPercent}%`),terms.length===0?`${NO_MAX_PX}px`:terms.length===1?terms[0]:`min(${terms.join(", ")})`}clampPair(sizes,i,j,delta,containerSize=0){const next=[...sizes],currentA=next[i],currentB=next[j];if(currentA===void 0||currentB===void 0)return next;const pairTotal=currentA+currentB,bounds=this.resolveConstraintBounds(containerSize).bounds,a=bounds[i]??{min:0,max:1/0},b=bounds[j]??{min:0,max:1/0},loRaw=Math.max(a.min,pairTotal-b.max),hiRaw=Math.min(a.max,pairTotal-b.min),lo=Math.min(loRaw,pairTotal),hi=Math.max(hiRaw,lo),clampedA=Math.min(Math.max(currentA+delta,lo),hi);return next[i]=clampedA,next[j]=pairTotal-clampedA,next}requestResize(next,commit){return next.length===this.sizes.length&&next.every((size,index)=>Math.abs(size-this.sizes[index])<=1e-9)||this.emit("lr-resize-request",{sizes:[...next]},{cancelable:!0}).defaultPrevented?!1:(this.sizes=next,this.emit("lr-resize",{sizes:[...this.sizes]}),commit&&this.settle(),!0)}settle(){this.persist(),this.emit("lr-resize-change",{sizes:[...this.sizes]})}applyDelta(index,delta,commit){const pair=this.dividerPair(index);if(!pair)return!1;const next=this.clampPair(this.sizes,pair[0],pair[1],delta,this.getContainerSize());return next.length!==this.sizes.length||next.some((size,currentIndex)=>Math.abs(size-this.sizes[currentIndex])>1e-9)?(this.requestResize(next,commit),!0):!1}get floatingPanelEl(){const index=this.collapsingIndex;return index===-1?null:this.ownedPanels[index]??null}activateFloatingOverlay(){this.openingBlockSize=this.baseEl?.getBoundingClientRect().height??0,this.modalSurface.prepare();const opener=deepActiveElement(this.ownerDocument);this.overlayOpener=isHtmlElement(opener)?opener:null;const trigger=this.resolveExternalTrigger();this.overlayReturnTarget=trigger??this.overlayOpener;const panel=this.floatingPanelEl;panel&&(this.floatingDialogPanel=panel,this.floatingDialogPreviousRole=panel.getAttribute("role"),this.floatingDialogPreviousAriaModal=panel.getAttribute("aria-modal"),this.nativeModal.requested||(panel.setAttribute("role","dialog"),panel.setAttribute("aria-modal","true"))),this.overlayHandle=activateOverlay({host:this,panel:()=>this.floatingPanelEl,modalRoot:()=>this.floatingPanelEl,auxiliaryRoots:()=>{const root=this.nativeModal.helperMount;return root?[root]:[]},restoreFocusTo:trigger??void 0,onEscape:()=>this.setOpen(!1),onBackdrop:()=>this.setOpen(!1),lockScroll:!0,suspendWhenUnrendered:!0,deferredReturn:()=>{if(!(this.resolveExternalTrigger()||this.trigger||this.for))return;const panel2=this.floatingDialogPanel;return{candidates:()=>[this.resolveExternalTrigger(),this.overlayReturnTarget,this.overlayOpener],stranded:active=>panel2!==null&&composedContains(panel2,active),isCurrent:()=>!this.overlayActive}}})}deactivateFloatingOverlay(){this.modalSurface.hide(),this.stopNativeModalGeometry(),this.nativeModal.prepare(!1);const trigger=this.resolveExternalTrigger(),panel=this.floatingDialogPanel;trigger&&this.overlayHandle?.updateRestoreFocusTo(trigger),this.overlayHandle?.deactivate(),this.overlayHandle=void 0,this.floatingDialogPanel=null,panel&&(this.floatingDialogPreviousRole===null?panel.removeAttribute("role"):panel.setAttribute("role",this.floatingDialogPreviousRole),this.floatingDialogPreviousAriaModal===null?panel.removeAttribute("aria-modal"):panel.setAttribute("aria-modal",this.floatingDialogPreviousAriaModal))}endDragGestures(){this.drags.clear(),this.dragController.cancelAll()}dividerName(index){let label;try{label=this.dividerLabel?.(index,this.panelCount)}catch{}if(typeof label=="string"&&label.trim())return label;const[leading,trailing]=this.dividerPair(index)??[index,index+1];return this.localize("resizeDivider",void 0,{a:getNumberFormat(this.effectiveLocale).format(leading+1),b:getNumberFormat(this.effectiveLocale).format(trailing+1)})}dividerValueRange(index,bounds=this.resolveConstraintBounds(this.getContainerSize()).bounds){const[leadingIndex,trailingIndex]=this.dividerPair(index)??[index,index+1],pairTotal=(this.sizes[leadingIndex]??0)+(this.sizes[trailingIndex]??0),leading=bounds[leadingIndex],trailing=bounds[trailingIndex],min=Math.max(leading.min,pairTotal-trailing.max);return{min,max:Math.max(min,Math.min(leading.max,pairTotal-trailing.min))}}updated(changed){super.updated(changed),this.overlayActive&&(this.syncNativeModalGeometry(),this.modalSurface.show()),(changed.has("collapse")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.syncCollapseObserver(),this.orientationBreakpoints.active?this.setAttribute("data-effective-orientation",this._effectiveOrientation):this.removeAttribute("data-effective-orientation"),(changed.has("panelConstraints")||changed.has("min"))&&(this.constraintConfigVersion+=1);const constraintResolution=this.resolveConstraintBounds(this.getContainerSize()),issue=constraintResolution.issue,issueKey=issue?`${issue.reason}:${issue.panelCount}:${this.constraintConfigVersion}`:"";issueKey!==this.constraintIssueKey&&(this.constraintIssueKey=issueKey,issue&&this.emit("lr-multi-split-constraints-invalid",issue));const collapsingIndex=this.collapseActive?this.collapsingIndex:-1;this.syncGutterObserver(collapsingIndex===-1&&this.panelConstraints.some(constraint=>finiteRange(constraint?.minPx??0,0,0)>0)),this.decorateOwnedPanels(constraintResolution),this.syncExternalTriggerA11y(),this.justOpened&&(this.justOpened=!1,this.overlayHandle?.focusInitial())}resolveExternalTrigger(){if(this.trigger)return this.trigger;if(!this.for)return null;const found=this.getRootNode().getElementById?.(this.for);return isHtmlElement(found)?found:null}syncExternalTriggerA11y(){const panel=this.ownedPanels[this.collapsingIndex],trigger=panel&&this.panelCount>1?this.resolveExternalTrigger():null;if(!this.isConnected||!panel||!trigger){this.releaseExternalTriggerA11y();return}this.triggerPanel!==panel&&(this.releaseExternalTriggerA11y(),this.triggerPanel=panel),panel.id||(this.generatedTriggerPanelId=nextId("multi-split-panel"),panel.id=this.generatedTriggerPanelId);const contribution={attributes:{"aria-expanded":this.paneExpanded?"true":"false"},controls:[panel]};this.triggerAria?this.triggerAria.update(trigger,contribution):this.triggerAria=acquireAriaOwnership(trigger,contribution)}releaseExternalTriggerA11y(){this.triggerAria?.release(),this.triggerAria=void 0,this.triggerPanel&&this.generatedTriggerPanelId&&this.triggerPanel.id===this.generatedTriggerPanelId&&this.triggerPanel.removeAttribute("id"),this.triggerPanel=void 0,this.generatedTriggerPanelId=void 0}decorateOwnedPanels(constraintResolution=this.resolveConstraintBounds(this.getContainerSize())){const panels=this.ownedPanels;for(const panel of panels){const snapshot=this.panelOwnership.get(panel);snapshot&&this.adoptPanelOwnership(panel,snapshot)}const collapsingIndex=this.collapseActive?this.collapsingIndex:-1,collapsed=this.collapsedIndexes(),pixelMinimumTotal=constraintResolution.usePanelConstraints?this.panelConstraints.slice(0,this.panelCount).reduce((total,constraint,index)=>collapsed.has(index)?total:total+finiteRange(constraint?.minPx??0,0,0),0):0,redistributedShare=new Array(panels.length).fill(0);if(collapsingIndex===-1){let freedPercent=0;const growableIndexes=[];let growableTotal=0;for(let i=0;i<panels.length;i++){if(collapsed.has(i))continue;const percent=this.sizes[i]??0,constraint=constraintResolution.usePanelConstraints?this.panelConstraints[i]:void 0;if(this.hasClampConstraint(constraint)){const bounds=constraintResolution.bounds[i],clamped=bounds?Math.min(Math.max(percent,bounds.min),bounds.max):percent;clamped<percent&&(freedPercent+=percent-clamped)}else growableIndexes.push(i),growableTotal+=percent}if(freedPercent>0&&growableTotal>0)for(const i of growableIndexes)redistributedShare[i]=freedPercent*((this.sizes[i]??0)/growableTotal)}panels.forEach((panel,i)=>{const snapshot=this.panelOwnership.get(panel);if(!snapshot)return;const percent=this.sizes[i]??0,constraint=constraintResolution.usePanelConstraints?this.panelConstraints[i]:void 0,pixelMinimum=finiteRange(constraint?.minPx??0,0,0);if(collapsingIndex===-1&&!collapsed.has(i)&&pixelMinimum>0&&pixelMinimumTotal>0?this.applyOwnedPanelStyleValue(panel,snapshot,"--_lr-multi-split-panel-min",`min(${pixelMinimum}px, max(0px, calc((100% - var(--_lr-multi-split-gutters, 0px)) * ${pixelMinimum/pixelMinimumTotal})))`):this.applyOwnedPanelStyle(panel,snapshot,"--_lr-multi-split-panel-min",snapshot.styles.get("--_lr-multi-split-panel-min")),this.applyOwnedPanelStyle(panel,snapshot,"inline-size",snapshot.styles.get("inline-size")),this.applyOwnedPanelHidden(panel,snapshot,snapshot.hidden),collapsingIndex===i&&this.collapseState==="rail")this.applyOwnedPanelStyleValue(panel,snapshot,"flex",`0 0 ${this.railWidth}`);else if(collapsingIndex===i&&this.collapseState==="floating"&&!this.open)this.applyOwnedPanelStyleValue(panel,snapshot,"flex","none"),this.applyOwnedPanelHidden(panel,snapshot,!0);else if(collapsingIndex===i&&this.collapseState==="floating")this.applyOwnedPanelStyleValue(panel,snapshot,"inline-size",`var(--lr-multi-split-floating-panel-inline-size, ${collapsed.has(i)?this.expandedSizes.get(panel.getAttribute("panel-id")??"")??percent:percent}%)`);else if(collapsed.has(i))this.applyOwnedPanelStyleValue(panel,snapshot,"flex","0 0 var(--_lr-multi-split-collapsed-panel-size)");else if(collapsingIndex!==-1&&i!==collapsingIndex)this.applyOwnedPanelStyleValue(panel,snapshot,"flex",this.hasClampConstraint(constraint)?`0 1 clamp(${this.minSideExpr(constraint)}, ${percent}%, ${this.maxSideExpr(constraint)})`:`${percent} 1 0%`);else{const adjustedPercent=percent+(redistributedShare[i]??0);this.applyOwnedPanelStyleValue(panel,snapshot,"flex",this.hasClampConstraint(constraint)?`0 1 clamp(${this.minSideExpr(constraint)}, ${percent}%, ${this.maxSideExpr(constraint)})`:`0 1 ${adjustedPercent}%`)}this.applyOwnedPanelStyleValue(panel,snapshot,"order",String(i*2)),this.applyOwnedPanelAttribute(panel,snapshot,"data-collapse-state",collapsingIndex===i?this.collapseState:null),this.applyOwnedPanelAttribute(panel,snapshot,"data-panel-collapsed",collapsed.has(i)?"":null)}),collapsingIndex!==-1?this.setAttribute("data-collapse-state",this.collapseState):this.removeAttribute("data-collapse-state")}render(){const dividers=[],bounds=this.renderConstraintBounds;for(let i=0;i<this.panelCount-1;i++){const{min:valueMin,max:valueMax}=this.dividerValueRange(i,bounds),disabled=this.isDividerDisabled(i),leading=this.dividerPair(i)?.[0]??i;dividers.push(html`<div
|
|
2
2
|
part="divider"
|
|
3
3
|
role="separator"
|
|
4
4
|
aria-label=${this.dividerName(i)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{activeElementIn,shadowFocusTarget}from"../../../internal/active-element.js";import{deferredPlaceReady,loadAnchoredOverlayRuntime,syncTopLayerRelease,topLayerPlacement,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{maxCssTime}from"../../../internal/css-motion-time.js";import{chevronIcon}from"../../../internal/icons.js";import{resolveGuardedRel}from"../../../internal/link-rel.js";import{LyraElement}from"../../../internal/lyra-element.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{activateNonmodalOverlay,composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{safeLinkHref}from"../../../internal/safe-url.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{navigationMenuOwner,registerNavigationMenuItemController}from"../navigation-menu/navigation-menu-owner.js";import{styles}from"./navigation-menu-item.styles.js";const PLACEMENT_STYLE_PROPERTIES=["position","margin","left","top","--lr-positioner-available-inline-size","--lr-positioner-available-block-size"],SHOW_OFFSET="translateY(var(--lr-size-neg-0-25rem))";class LyraNavigationMenuItem extends LyraElement{static{this.styles=[LyraElement.styles,styles]}get open(){return this._open}set open(next){const value=!!next;if(value===this._open)return;const source=this.hasUpdated?"programmatic":null;value?this.openPanel("programmatic",source):this.closePanel(source)}constructor(){super(),this.href="",this.target="",this.rel="",this.current=!1,this._open=!1,this.browserResolved=!1,this.closing=!1,this.slotPresence=new SlotPresenceController(this),this.panelId=nextId("navigation-menu-panel"),this.liveOpen=!1,this.placementKey="",this.pendingShow=!1,this.hideAnimationStarted=!1,this.transitionToken=0,this.focusInPanel=!1,this.hrefChangedThisUpdate=!1,this.onFocusIn=event=>{const panel=this.panelElement,target=event.composedPath()[0];this.focusInPanel=panel!==null&&target!==void 0&&composedContains(panel,target)},this.onFocusOut=event=>{const next=event.relatedTarget;if(next===null)return;const panel=this.panelElement;(!panel||!composedContains(panel,next))&&(this.focusInPanel=!1)},this.onBaseClick=()=>{if(this.isLink)return;const context=this.ownerContext;if(context){context.activate(this);return}this.isTrigger&&(this._open?this.closePanel("user"):this.openPanel("programmatic","user"))},this.onHostKeyDown=event=>{event.key!=="Escape"||event.defaultPrevented||!this._open||this.ownerContext||(event.preventDefault(),this.onOverlayEscape())},this.addController({hostUpdate:()=>{if(this._open&&!this.canDisclose&&(this.liveOpen?this.closePanel("programmatic",{repairFocus:!0,instant:!0}):(this._open=!1,this.interactionMode=void 0,this.pendingShow=!1,this.pendingMorph=void 0,this.requestUpdate("open",!0))),this.hrefChangedThisUpdate){const previous=this.baseElement,nextKind=this.isLink?"a":"button";this.semanticFocusOrigin=previous&&previous.localName!==nextKind&&shadowFocusTarget(this)===previous?previous:void 0}}}),new GlassScrollLayer(this,'[part="panel"]',()=>this.open),registerNavigationMenuItemController(this,{isTrigger:()=>this.isTrigger,isLink:()=>this.isLink,isOpen:()=>this._open,mode:()=>this._open?this.interactionMode:void 0,pin:()=>{this._open&&(this.interactionMode="pinned")},base:()=>this.baseElement,panel:()=>this.panelElement,open:(mode,source)=>this.openPanel(mode,source),close:(source,options)=>this.closePanel(source,options),isTopmost:()=>this.overlayHandle?.isTopmost()??!1,placementReady:()=>this.placementReady(),reposition:()=>{this.placementKey="",this.requestUpdate()}})}get ownerContext(){return navigationMenuOwner(this)}get isLink(){return!!safeLinkHref(this.href)}get isTrigger(){return!this.isLink&&this.slotPresence.has("panel")}get floatingLayout(){return this.ownerContext?.layout()==="bar"}get baseElement(){return this.renderRoot?.querySelector('[part~="base"]')??null}get panelElement(){return this.renderRoot?.querySelector('[part~="panel"]')??null}get canDisclose(){return this.isLink?!1:!this.browserResolved||this.slotPresence.has("panel")}connectedCallback(){super.connectedCallback(),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.addEventListener("keydown",this.onHostKeyDown),this.updateBrowserDerivedState(()=>{this.browserResolved=!0}),this.hasUpdated&&this._open&&(this.interactionMode="programmatic",this.requestUpdate())}disconnectedCallback(){this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut),this.removeEventListener("keydown",this.onHostKeyDown),this.cancelMorph(),this.stopPlacement(),this.releaseOverlay(!1),this.cancelHideAnimation(),this.closing=!1,this.focusInPanel=!1,this.semanticFocusOrigin=void 0,this._open&&this.interactionMode==="hover"?(this._open=!1,this.liveOpen=!1,this.interactionMode=void 0,this.requestUpdate("open",!0)):this._open&&(this.interactionMode="programmatic"),super.disconnectedCallback()}focus(options){const base=this.baseElement;base?base.focus(options):super.focus(options)}click(){this.baseElement?.click()}willUpdate(changed){super.willUpdate(changed),this.hrefChangedThisUpdate=changed.has("href")}updated(changed){super.updated(changed),this.isConnected&&this.hasAttribute("open")!==this._open&&this.toggleAttribute("open",this._open),this.syncFloating(),this.syncHideAnimation();const focusOrigin=this.semanticFocusOrigin;if(this.semanticFocusOrigin=void 0,focusOrigin){const internalActive=shadowFocusTarget(this),documentActive=activeElementIn(this.ownerDocument);(internalActive===null||internalActive===focusOrigin)&&(documentActive===null||documentActive===this||documentActive===this.ownerDocument.body)&&this.baseElement?.focus()}}openPanel(mode,source){if(this._open)return mode==="pinned"&&this.interactionMode==="hover"&&(this.interactionMode="pinned"),!0;if(!this.canDisclose)return this.requestUpdate("open",!0),!1;const context=this.ownerContext,morph=context?.willOpen(this);return this.cancelHideAnimation(),this.closing=!1,this.interactionMode=mode,this.pendingMorph=morph,this.pendingShow=source!==null&&!morph,this._open=!0,this.requestUpdate("open",!1),this.queueToggle(!0,source),context?.changed(this,!0,source),!0}closePanel(source,options={}){if(!this._open)return;options.repairFocus!==!1&&this.panelHoldsFocus()&&(options.focusTarget??this.baseElement)?.focus({preventScroll:!0});const wasFloating=this.placement!==void 0||this.overlayHandle!==void 0;this.cancelMorph(),this.stopPlacement(),this.releaseOverlay(options.restoreFocus===!0);const animate=!options.instant&&wasFloating&&this.liveOpen&&this.isConnected&&this.floatingLayout;this.cancelHideAnimation(),this.closing=animate,this.pendingMorph=void 0,this.pendingShow=!1,this.interactionMode=void 0,this.liveOpen=!1,this.focusInPanel=!1,this._open=!1,this.requestUpdate("open",!0),this.queueToggle(!1,source),this.ownerContext?.changed(this,!1,source)}queueToggle(open,source){source!==null&&this.updateComplete.then(()=>{this.emit("lr-toggle",{expanded:open,source})})}panelHoldsFocus(){const panel=this.panelElement;if(!panel)return!1;const active=deepActiveElement(this.ownerDocument);return active&&composedContains(panel,active)?!0:this.focusInPanel&&(active===null||active===this.ownerDocument.body)}syncFloating(){const panel=this.panelElement,visible=this.isTrigger&&this.browserResolved&&this._open;if(visible&&(this.liveOpen=!0),!(visible&&this.isConnected&&this.floatingLayout)){this.stopPlacement(),this.overlayHandle&&this.releaseOverlay(!1),panel&&!this.closing&&(this.clearPlacementStyles(panel),visible&&panel.hasAttribute("data-lr-top-layer")&&loadAnchoredOverlayRuntime().then(runtime=>runtime.releaseTopLayer?.(panel),()=>{})),visible&&(this.pendingShow=!1,this.pendingMorph=void 0);return}if(!panel)return;const context=this.ownerContext,anchor=context.anchor(this);if(!anchor)return;const key=[anchor===this.baseElement?"item":"menu",context.distance(),context.topLayer(),this.effectiveDirection].join("|");(!this.placement||key!==this.placementKey)&&this.startPlacement(anchor,panel,key),this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.panelElement,onEscape:()=>this.onOverlayEscape(),restoreFocusTo:()=>this.baseElement}));const morph=this.pendingMorph,show=this.pendingShow;if(this.pendingMorph=void 0,this.pendingShow=!1,!morph&&!show)return;const handle=this.placement;handle?.ready.then(placed=>{!placed||handle!==this.placement||!this._open||(morph?this.runMorph(morph):this.runShowAnimation())})}startPlacement(anchor,panel,key){this.stopPlacement();const context=this.ownerContext,bridge=this.renderRoot.querySelector(".hover-bridge");this.placementKey=key;const topLayer=context.topLayer();this.placedTopLayer=syncTopLayerRelease(panel,this.placedTopLayer,topLayer),this.placement=deferredPlaceReady(anchor,panel,{placement:rtlAwarePlacement("bottom-start",this),...topLayerPlacement(topLayer,resolveEffectivePositioningStrategy(this,void 0,"fixed")),offset:context.distance(),hoverBridge:bridge??void 0})}stopPlacement(){const handle=this.placement;this.placement=void 0,this.placementKey="",handle?.()}releaseOverlay(restoreFocus){const handle=this.overlayHandle;this.overlayHandle=void 0,handle?.deactivate({restoreFocus})}clearPlacementStyles(panel){for(const property2 of PLACEMENT_STYLE_PROPERTIES)panel.style.removeProperty(property2)}onOverlayEscape(){const context=this.ownerContext;if(context){context.escape(this);return}const within=composedContains(this,deepActiveElement(this.ownerDocument));this.closePanel("user",{restoreFocus:within})}async placementReady(){return await this.updateComplete,this.placement?waitForDeferredPlacement(()=>this.placement):this._open}get registryHost(){return this.ownerContext?.owner??this}runShowAnimation(){const panel=this.panelElement;panel&&animateRegistered(this.registryHost,panel,"navigation-menu.show",this.effectiveDirection,{keyframes:[{opacity:0,transform:SHOW_OFFSET},{opacity:1,transform:"translateY(0)"}],durationProperties:["--lr-navigation-menu-show-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]})}syncHideAnimation(){if(!this.closing||this.hideAnimationStarted)return;this.hideAnimationStarted=!0;const token=this.transitionToken,panel=this.panelElement,animation=panel?animateRegistered(this.registryHost,panel,"navigation-menu.hide",this.effectiveDirection,{keyframes:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:SHOW_OFFSET}],durationProperties:["--lr-navigation-menu-hide-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]}):void 0;this.hideAnimation=animation;const settle=()=>{token===this.transitionToken&&(this.hideAnimation?.cancel(),this.hideAnimation=void 0,this.hideAnimationStarted=!1,this.closing=!1)};animation?animation.finished.then(settle,settle):queueMicrotask(settle)}cancelHideAnimation(){this.transitionToken++,this.hideAnimation?.cancel(),this.hideAnimation=void 0,this.hideAnimationStarted=!1}runMorph(morph){const panel=this.panelElement,content=panel?.querySelector(".panel-content");if(!panel||!content)return;const travel="var(--lr-size-1rem)",reversed=`calc(-1 * ${travel})`,from=morph.direction==="end"?travel:reversed,mirrored=morph.direction==="end"?reversed:travel;animateRegistered(this.registryHost,content,`navigation-menu.enter-from-${morph.direction}`,this.effectiveDirection,{keyframes:[{opacity:0,transform:`translateX(${from})`},{opacity:1,transform:"translateX(0)"}],rtlKeyframes:[{opacity:0,transform:`translateX(${mirrored})`},{opacity:1,transform:"translateX(0)"}],durationProperties:["--lr-navigation-menu-switch-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]});const view=this.ownerDocument.defaultView;if(!view||prefersReducedMotion(this))return;const to=panel.getBoundingClientRect();if(Math.abs(to.width-morph.from.width)<1&&Math.abs(to.height-morph.from.height)<1)return;this.cancelMorph();const natural=content.getBoundingClientRect().width;panel.setAttribute("data-morphing",""),panel.style.inlineSize=`${morph.from.width}px`,panel.style.blockSize=`${morph.from.height}px`,content.style.inlineSize=`${natural}px`;const style=view.getComputedStyle(panel),total=maxCssTime(style.transitionDuration)+maxCssTime(style.transitionDelay);let frame,timer;const onEnd=event=>{event.target===panel&&["inline-size","block-size","width","height"].includes(event.propertyName)&&cleanup()},cleanup=()=>{this.morphCleanup===cleanup&&(this.morphCleanup=void 0,frame!==void 0&&view.cancelAnimationFrame(frame),timer!==void 0&&view.clearTimeout(timer),panel.removeEventListener("transitionend",onEnd),panel.removeAttribute("data-morphing"),panel.style.removeProperty("inline-size"),panel.style.removeProperty("block-size"),content.style.removeProperty("inline-size"))};this.morphCleanup=cleanup,panel.addEventListener("transitionend",onEnd),frame=view.requestAnimationFrame(()=>{frame=void 0,this.morphCleanup===cleanup&&(panel.style.inlineSize=`${to.width}px`,panel.style.blockSize=`${to.height}px`,timer=view.setTimeout(cleanup,total+50))})}cancelMorph(){this.morphCleanup?.()}render(){const isLink=this.isLink,isTrigger=this.isTrigger,floating=this.floatingLayout,stacked=this.ownerContext?.layout()==="stacked",expanded=this._open&&this.browserResolved,panelVisible=isTrigger&&this.browserResolved&&(this._open||this.closing),ariaLabel=hostAriaLabel(this),parts=["base"];this.current&&parts.push("base-current"),isTrigger&&expanded&&parts.push("base-open");const label=html`<span part="start" ?hidden=${!this.slotPresence.has("start")}
|
|
1
|
+
import{__decorate}from"tslib";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{activeElementIn,shadowFocusTarget}from"../../../internal/active-element.js";import{deferredPlaceReady,loadAnchoredOverlayRuntime,syncTopLayerRelease,topLayerPlacement,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{maxCssTime}from"../../../internal/css-motion-time.js";import{chevronIcon}from"../../../internal/icons.js";import{resolveGuardedRel}from"../../../internal/link-rel.js";import{LyraElement}from"../../../internal/lyra-element.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{activateNonmodalOverlay,composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{safeLinkHref}from"../../../internal/safe-url.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{navigationMenuOwner,registerNavigationMenuItemController}from"../navigation-menu/navigation-menu-owner.js";import{styles}from"./navigation-menu-item.styles.js";const PLACEMENT_STYLE_PROPERTIES=["position","margin","left","top","--lr-positioner-available-inline-size","--lr-positioner-available-block-size"],SHOW_OFFSET="translateY(var(--lr-size-neg-0-25rem))";class LyraNavigationMenuItem extends LyraElement{static{this.styles=[LyraElement.styles,styles]}get open(){return this._open}set open(next){const value=!!next;if(value===this._open)return;const source=this.hasUpdated?"programmatic":null;value?this.openPanel("programmatic",source):this.closePanel(source)}constructor(){super(),this.href="",this.target="",this.rel="",this.current=!1,this._open=!1,this.browserResolved=!1,this.closing=!1,this.slotPresence=new SlotPresenceController(this),this.panelId=nextId("navigation-menu-panel"),this.liveOpen=!1,this.placementKey="",this.pendingShow=!1,this.hideAnimationStarted=!1,this.transitionToken=0,this.focusInPanel=!1,this.hrefChangedThisUpdate=!1,this.onFocusIn=event=>{const panel=this.panelElement,target=event.composedPath()[0];this.focusInPanel=panel!==null&&target!==void 0&&composedContains(panel,target)},this.onFocusOut=event=>{const next=event.relatedTarget;if(next===null)return;const panel=this.panelElement;(!panel||!composedContains(panel,next))&&(this.focusInPanel=!1)},this.onBaseClick=()=>{if(this.isLink)return;const context=this.ownerContext;if(context){context.activate(this);return}this.isTrigger&&(this._open?this.closePanel("user"):this.openPanel("programmatic","user"))},this.onHostKeyDown=event=>{event.key!=="Escape"||event.defaultPrevented||!this._open||this.ownerContext||(event.preventDefault(),this.onOverlayEscape())},this.addController({hostUpdate:()=>{if(this._open&&!this.canDisclose&&(this.liveOpen?this.closePanel("programmatic",{repairFocus:!0,instant:!0}):(this._open=!1,this.interactionMode=void 0,this.pendingShow=!1,this.pendingMorph=void 0,this.requestUpdate("open",!0))),this.hrefChangedThisUpdate){const previous=this.baseElement,nextKind=this.isLink?"a":"button";this.semanticFocusOrigin=previous&&previous.localName!==nextKind&&shadowFocusTarget(this)===previous?previous:void 0}}}),new GlassScrollLayer(this,'[part="panel"]',()=>this.open),registerNavigationMenuItemController(this,{isTrigger:()=>this.isTrigger,isLink:()=>this.isLink,isOpen:()=>this._open,mode:()=>this._open?this.interactionMode:void 0,pin:()=>{this._open&&(this.interactionMode="pinned")},base:()=>this.baseElement,panel:()=>this.panelElement,open:(mode,source)=>this.openPanel(mode,source),close:(source,options)=>this.closePanel(source,options),isTopmost:()=>this.overlayHandle?.isTopmost()??!1,placementReady:()=>this.placementReady(),reposition:()=>{this.placementKey="",this.requestUpdate()}})}get ownerContext(){return navigationMenuOwner(this)}get isLink(){return!!safeLinkHref(this.href)}get isTrigger(){return!this.isLink&&this.slotPresence.has("panel")}get floatingLayout(){return this.ownerContext?.layout()==="bar"}get baseElement(){return this.renderRoot?.querySelector('[part~="base"]')??null}get panelElement(){return this.renderRoot?.querySelector('[part~="panel"]')??null}get canDisclose(){return this.isLink?!1:!this.browserResolved||this.slotPresence.has("panel")}connectedCallback(){super.connectedCallback(),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.addEventListener("keydown",this.onHostKeyDown),this.updateBrowserDerivedState(()=>{this.browserResolved=!0}),this.hasUpdated&&this._open&&(this.interactionMode="programmatic",this.requestUpdate())}disconnectedCallback(){this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut),this.removeEventListener("keydown",this.onHostKeyDown),this.cancelMorph(),this.stopPlacement(),this.releaseOverlay(!1),this.cancelHideAnimation(),this.closing=!1,this.focusInPanel=!1,this.semanticFocusOrigin=void 0,this._open&&this.interactionMode==="hover"?(this._open=!1,this.liveOpen=!1,this.interactionMode=void 0,this.requestUpdate("open",!0)):this._open&&(this.interactionMode="programmatic"),super.disconnectedCallback()}focus(options){const base=this.baseElement;base?base.focus(options):super.focus(options)}click(){this.baseElement?.click()}willUpdate(changed){super.willUpdate(changed),this.hrefChangedThisUpdate=changed.has("href")}updated(changed){super.updated(changed),this.isConnected&&this.hasAttribute("open")!==this._open&&this.toggleAttribute("open",this._open),this.syncFloating(),this.syncHideAnimation();const focusOrigin=this.semanticFocusOrigin;if(this.semanticFocusOrigin=void 0,focusOrigin){const internalActive=shadowFocusTarget(this),documentActive=activeElementIn(this.ownerDocument);(internalActive===null||internalActive===focusOrigin)&&(documentActive===null||documentActive===this||documentActive===this.ownerDocument.body)&&this.baseElement?.focus()}}openPanel(mode,source){if(this._open)return mode==="pinned"&&this.interactionMode==="hover"&&(this.interactionMode="pinned"),!0;if(!this.canDisclose)return this.requestUpdate("open",!0),!1;const context=this.ownerContext,morph=context?.willOpen(this);return this.cancelHideAnimation(),this.closing=!1,this.interactionMode=mode,this.pendingMorph=morph,this.pendingShow=source!==null&&!morph,this._open=!0,this.requestUpdate("open",!1),this.queueToggle(!0,source),context?.changed(this,!0,source),!0}closePanel(source,options={}){if(!this._open)return;options.repairFocus!==!1&&this.panelHoldsFocus()&&(options.focusTarget??this.baseElement)?.focus({preventScroll:!0});const wasFloating=this.placement!==void 0||this.overlayHandle!==void 0;this.cancelMorph(),this.stopPlacement(),this.releaseOverlay(options.restoreFocus===!0);const animate=!options.instant&&wasFloating&&this.liveOpen&&this.isConnected&&this.floatingLayout;this.cancelHideAnimation(),this.closing=animate,this.pendingMorph=void 0,this.pendingShow=!1,this.interactionMode=void 0,this.liveOpen=!1,this.focusInPanel=!1,this._open=!1,this.requestUpdate("open",!0),this.queueToggle(!1,source),this.ownerContext?.changed(this,!1,source)}queueToggle(open,source){source!==null&&this.updateComplete.then(()=>{this.emit("lr-toggle",{expanded:open,source})})}panelHoldsFocus(){const panel=this.panelElement;if(!panel)return!1;const active=deepActiveElement(this.ownerDocument);return active&&composedContains(panel,active)?!0:this.focusInPanel&&(active===null||active===this.ownerDocument.body)}syncFloating(){const panel=this.panelElement,visible=this.isTrigger&&this.browserResolved&&this._open;if(visible&&(this.liveOpen=!0),!(visible&&this.isConnected&&this.floatingLayout)){this.stopPlacement(),this.overlayHandle&&this.releaseOverlay(!1),panel&&!this.closing&&(this.clearPlacementStyles(panel),visible&&panel.hasAttribute("data-lr-top-layer")&&loadAnchoredOverlayRuntime().then(runtime=>runtime.releaseTopLayer?.(panel),()=>{})),visible&&(this.pendingShow=!1,this.pendingMorph=void 0);return}if(!panel)return;const context=this.ownerContext,anchor=context.anchor(this);if(!anchor)return;const key=[anchor===this.baseElement?"item":"menu",context.distance(),context.topLayer(),this.effectiveDirection].join("|");(!this.placement||key!==this.placementKey)&&this.startPlacement(anchor,panel,key),this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.panelElement,onEscape:()=>this.onOverlayEscape(),restoreFocusTo:()=>this.baseElement}));const morph=this.pendingMorph,show=this.pendingShow;if(this.pendingMorph=void 0,this.pendingShow=!1,!morph&&!show)return;const handle=this.placement;handle?.ready.then(placed=>{!placed||handle!==this.placement||!this._open||(morph?this.runMorph(morph):this.runShowAnimation())})}startPlacement(anchor,panel,key){this.stopPlacement();const context=this.ownerContext,bridge=this.renderRoot.querySelector(".hover-bridge");this.placementKey=key;const topLayer=context.topLayer();this.placedTopLayer=syncTopLayerRelease(panel,this.placedTopLayer,topLayer);const handle=deferredPlaceReady(anchor,panel,{placement:rtlAwarePlacement("bottom-start",this),...topLayerPlacement(topLayer,resolveEffectivePositioningStrategy(this,void 0,"fixed")),offset:context.distance(),hoverBridge:bridge??void 0});this.placement=handle,handle.ready.then(placed=>{!placed&&this.placement===handle&&this.closePanel("programmatic",{instant:!0})})}stopPlacement(){const handle=this.placement;this.placement=void 0,this.placementKey="",handle?.()}releaseOverlay(restoreFocus){const handle=this.overlayHandle;this.overlayHandle=void 0,handle?.deactivate({restoreFocus})}clearPlacementStyles(panel){for(const property2 of PLACEMENT_STYLE_PROPERTIES)panel.style.removeProperty(property2)}onOverlayEscape(){const context=this.ownerContext;if(context){context.escape(this);return}const within=composedContains(this,deepActiveElement(this.ownerDocument));this.closePanel("user",{restoreFocus:within})}async placementReady(){return await this.updateComplete,this.placement?waitForDeferredPlacement(()=>this.placement):this._open}get registryHost(){return this.ownerContext?.owner??this}runShowAnimation(){const panel=this.panelElement;panel&&animateRegistered(this.registryHost,panel,"navigation-menu.show",this.effectiveDirection,{keyframes:[{opacity:0,transform:SHOW_OFFSET},{opacity:1,transform:"translateY(0)"}],durationProperties:["--lr-navigation-menu-show-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]})}syncHideAnimation(){if(!this.closing||this.hideAnimationStarted)return;this.hideAnimationStarted=!0;const token=this.transitionToken,panel=this.panelElement,animation=panel?animateRegistered(this.registryHost,panel,"navigation-menu.hide",this.effectiveDirection,{keyframes:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:SHOW_OFFSET}],durationProperties:["--lr-navigation-menu-hide-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]}):void 0;this.hideAnimation=animation;const settle=()=>{token===this.transitionToken&&(this.hideAnimation?.cancel(),this.hideAnimation=void 0,this.hideAnimationStarted=!1,this.closing=!1)};animation?animation.finished.then(settle,settle):queueMicrotask(settle)}cancelHideAnimation(){this.transitionToken++,this.hideAnimation?.cancel(),this.hideAnimation=void 0,this.hideAnimationStarted=!1}runMorph(morph){const panel=this.panelElement,content=panel?.querySelector(".panel-content");if(!panel||!content)return;const travel="var(--lr-size-1rem)",reversed=`calc(-1 * ${travel})`,from=morph.direction==="end"?travel:reversed,mirrored=morph.direction==="end"?reversed:travel;animateRegistered(this.registryHost,content,`navigation-menu.enter-from-${morph.direction}`,this.effectiveDirection,{keyframes:[{opacity:0,transform:`translateX(${from})`},{opacity:1,transform:"translateX(0)"}],rtlKeyframes:[{opacity:0,transform:`translateX(${mirrored})`},{opacity:1,transform:"translateX(0)"}],durationProperties:["--lr-navigation-menu-switch-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]});const view=this.ownerDocument.defaultView;if(!view||prefersReducedMotion(this))return;const to=panel.getBoundingClientRect();if(Math.abs(to.width-morph.from.width)<1&&Math.abs(to.height-morph.from.height)<1)return;this.cancelMorph();const natural=content.getBoundingClientRect().width;panel.setAttribute("data-morphing",""),panel.style.inlineSize=`${morph.from.width}px`,panel.style.blockSize=`${morph.from.height}px`,content.style.inlineSize=`${natural}px`;const style=view.getComputedStyle(panel),total=maxCssTime(style.transitionDuration)+maxCssTime(style.transitionDelay);let frame,timer;const onEnd=event=>{event.target===panel&&["inline-size","block-size","width","height"].includes(event.propertyName)&&cleanup()},cleanup=()=>{this.morphCleanup===cleanup&&(this.morphCleanup=void 0,frame!==void 0&&view.cancelAnimationFrame(frame),timer!==void 0&&view.clearTimeout(timer),panel.removeEventListener("transitionend",onEnd),panel.removeAttribute("data-morphing"),panel.style.removeProperty("inline-size"),panel.style.removeProperty("block-size"),content.style.removeProperty("inline-size"))};this.morphCleanup=cleanup,panel.addEventListener("transitionend",onEnd),frame=view.requestAnimationFrame(()=>{frame=void 0,this.morphCleanup===cleanup&&(panel.style.inlineSize=`${to.width}px`,panel.style.blockSize=`${to.height}px`,timer=view.setTimeout(cleanup,total+50))})}cancelMorph(){this.morphCleanup?.()}render(){const isLink=this.isLink,isTrigger=this.isTrigger,floating=this.floatingLayout,stacked=this.ownerContext?.layout()==="stacked",expanded=this._open&&this.browserResolved,panelVisible=isTrigger&&this.browserResolved&&(this._open||this.closing),ariaLabel=hostAriaLabel(this),parts=["base"];this.current&&parts.push("base-current"),isTrigger&&expanded&&parts.push("base-open");const label=html`<span part="start" ?hidden=${!this.slotPresence.has("start")}
|
|
2
2
|
><slot name="start"></slot></span
|
|
3
3
|
><span part="label"><slot></slot></span
|
|
4
4
|
><span part="end" ?hidden=${!this.slotPresence.has("end")}><slot name="end"></slot></span
|
|
@@ -167,4 +167,11 @@ defaultSlot:HTMLSlotElement;private tabs;private focusedTab;private baseId;priva
|
|
|
167
167
|
/** Keeps `active` resolved to a real, navigable tab -- covers the initial default, a tab disappearing/becoming disabled or inert underneath the current selection, and a consumer assigning `.active` directly. Only a rendered selection displaced by its tab leaving reports `lr-tab-hide`/`lr-tab-show`, moving to the following tab (else the preceding one); the initial default and a direct `.active` write stay silent. Reading the focused element *before* the render that marks the outgoing button `inert` is what lets `updated()` rehome real focus rather than leaving it stranded on `<body>`.*/
|
|
168
168
|
protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private selectTab;private activateTab;
|
|
169
169
|
/** Show the panel named by an `<lr-tab panel>`.*/
|
|
170
|
-
show(panel:string):void;private syncElementActiveState;private focusOnly;private get rovingTab();private keyboardOriginTab;private
|
|
170
|
+
show(panel:string):void;private syncElementActiveState;private focusOnly;private get rovingTab();private keyboardOriginTab;private focusTabButton;private tabButton;
|
|
171
|
+
/** Moves keyboard focus to the real tab button of the enabled, non-inert tab whose `panel` is
|
|
172
|
+
* `panel`, and moves the roving tab stop with it. Under `activation="auto"` focus and selection
|
|
173
|
+
* move together, so focusing an unselected tab also selects it exactly as `show()` does
|
|
174
|
+
* (`lr-tab-hide`/`lr-tab-show`, never `lr-activate`); under `manual` only focus moves. A missing,
|
|
175
|
+
* disabled or inert tab leaves focus and selection unchanged, and so does a tab added since the
|
|
176
|
+
* group last read its children (await `updateComplete` first). Returns `true` when focus moved. */
|
|
177
|
+
focusTab(panel:string,options?:FocusOptions):boolean;private focusTabDefinition;private get isVertical();private onTabListKeyDown;private tabId;private panelId;private idsFor;private tabSlotName;private get scrollControlsSuppressed();private measureTabScrollEdges;private setTabScrollEdges;private onTabListScroll;private scrollTabs;private renderScrollControl;private onScrollControlMouseDown;private onScrollControlPointerDown;private onScrollControlPointerEnd;private renderTab;private renderPanel;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-tab-group':LyraTabGroup;}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveListMove}from"../../../internal/list-navigation.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityText}from"../../../internal/accessibility-visibility.js";import{CustomElementUpgradeObserver}from"../../../internal/custom-element-upgrade-observer.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{chevronIcon}from"../../../internal/icons.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{tag}from"../../../internal/prefix.js";import{observeScrollOverflow}from"../../../internal/scroll-overflow.js";import{scrollOverflowFadeStyles}from"../../../internal/scroll-overflow.styles.js";import{styles}from"./tab-group.styles.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{LYRA_DEFAULT_scrollNext,LYRA_DEFAULT_scrollPrevious}from"../../../internal/default-strings/layout.generated.js";function isInertChild(child){return isHtmlElement(child)&&child.inert}function isTabLabelSubtreeExcludedWithoutInert(element){if(element.hasAttribute("hidden")||element.getAttribute("aria-hidden")?.trim().toLowerCase()==="true")return!0;const rendered=element.ownerDocument.defaultView?.getComputedStyle(element);return rendered?.display==="none"||rendered?.contentVisibility==="hidden"}const SYNTHETIC_PANEL_PREFIX="lr-tab-",SCROLL_STEP_RATIO=.8;class LyraTabGroup extends LyraElement{constructor(){super(...arguments),this.active="",this.accessibleLabel=null,this.placement="top",this.activation="auto",this.withoutScrollControls=!1,this.noScrollControls=!1,this.fixedScrollControls=!1,this.tabs=[],this.focusedTab="",this.baseId=nextId("tab-group"),this.nextOpaqueId=0,this.idsBySlot=new Map,this.mutationObserverGeneration=0,this.projectionGeneration=0,this.projectionPending=!1,this.stagingSlotName="tab-group-sources",this.pendingDescriptorUpdates=new WeakSet,this.excludedUnnamedDescriptors=new Set,this.descriptorUpgrades=new CustomElementUpgradeObserver(()=>{this.excludedUnnamedDescriptors.clear(),this.queueProjectionReconciliation()}),this.restoredSourceInertWrites=new Map,this.restoredSlotWrites=new Map,this.projectedSourceSnapshots=new Map,this.projectedSlotSnapshots=new Map,this.projectedSourceObserverGeneration=0,this.rehomeTabFocus=!1,this.scrollStartAvailable=!1,this.scrollEndAvailable=!1,this.scrollOverflow=observeScrollOverflow(this,()=>this.renderRoot.querySelector('[part~="tablist"]'),()=>this.measureTabScrollEdges()),this.queueProjectionReconciliation=()=>{if(!this.isConnected||this.projectionTimer!==void 0)return;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow)return;const generation=this.projectionGeneration;this.beginProjectionSettlement(),this.projectionTimerWindow=ownerWindow,this.projectionTimer=ownerWindow.setTimeout(()=>{generation!==this.projectionGeneration||this.ownerDocument!==ownerDocument||!this.isConnected||(this.projectionTimer=void 0,this.projectionTimerWindow=void 0,this.updateBrowserDerivedState(this.syncTabs))},0)},this.syncTabs=()=>{const children=Array.from(this.children);this.adoptProjectedSourceInertStates(),this.adoptProjectedSlotStates();const projectedSlots=new Set,wasPending=this.projectionPending,next=this.readElementModel(children,projectedSlots);this.syncProjectedSlots(projectedSlots),this.syncProjectedSources(next.filter(tab=>tab.element.parentNode===this));const liveSlots=new Set(next.map(tab=>tab.slotName));for(const slotName of this.idsBySlot.keys())liveSlots.has(slotName)||this.idsBySlot.delete(slotName);(next.length!==this.tabs.length||wasPending&&!this.projectionPending||next.some((tab,index)=>{const previous=this.tabs[index];return tab.element!==previous.element||tab.slotName!==previous.slotName||tab.label!==previous.label||tab.disabled!==previous.disabled||tab.inert!==previous.inert}))&&(this.tabs=next),this.projectionPending||this.projectionTimer!==void 0?this.beginProjectionSettlement():this.settleProjection()},this.onTabListKeyDown=e=>{if(e.altKey||e.ctrlKey||e.metaKey||e.isComposing)return;const navigable=this.tabs.filter(t=>this.isNavigable(t));if(navigable.length===0)return;const origin=this.keyboardOriginTab(e,navigable),currentIndex=origin?navigable.indexOf(origin):-1;if(e.key==="Delete"){if(!origin?.element.closable)return;e.preventDefault(),origin.element.requestCloseFromOwner();return}if(this.activation==="manual"&&(e.key==="Enter"||e.key===" "||e.key==="Spacebar")){if(!origin)return;e.preventDefault(),this.activateTab(origin);return}const targetIndex=resolveListMove(e,{count:navigable.length,current:currentIndex,orientation:this.isVertical?"vertical":"horizontal",direction:this.effectiveDirection});if(targetIndex===null)return;e.preventDefault();const target=navigable[targetIndex];if(this.activation==="manual"){this.focusOnly(target);return}this.activateTab(target),this.focusTab(target.slotName)},this.onTabListScroll=()=>{this.measureTabScrollEdges()},this.onScrollControlMouseDown=event=>{event.preventDefault()},this.onScrollControlPointerDown=event=>{const control=event.currentTarget;control instanceof HTMLElement&&(control.setAttribute("data-pressed",""),control.setPointerCapture(event.pointerId))},this.onScrollControlPointerEnd=event=>{const control=event.currentTarget;control instanceof HTMLElement&&(control.removeAttribute("data-pressed"),control.hasPointerCapture(event.pointerId)&&control.releasePointerCapture(event.pointerId))}}static{this.defaultStrings={...super.defaultStrings,scrollNext:LYRA_DEFAULT_scrollNext,scrollPrevious:LYRA_DEFAULT_scrollPrevious}}static{this.styles=[LyraElement.styles,scrollOverflowFadeStyles,styles]}connectedCallback(){super.connectedCallback(),this.hasUpdated?this.syncTabs():this.seedFirstRenderState(this.syncTabs),this.resetMutationObserver();const ownerDocument=this.ownerDocument,MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor)return;const generation=this.mutationObserverGeneration,observer=new MutationObserverCtor(records=>{if(this.mutationObserver!==observer||this.mutationObserverDocument!==ownerDocument||this.mutationObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument)return;const isDirectChild=node=>node.parentNode===this,isElementTabContent=node=>{let current=node.nodeType===1?node:node.parentElement;for(;current&¤t!==this;){if(current.localName===tag("tab")&¤t.parentNode===this)return!0;current=current.parentElement}return!1},relevant=records.some(record=>{if(record.type==="childList")return record.target===this||isElementTabContent(record.target);if(record.type==="characterData")return isElementTabContent(record.target);if(record.attributeName==="inert"&&this.projectedSourceSnapshots.has(record.target)||record.attributeName==="inert"&&this.restoredSourceInertWrites.has(record.target)&&record.target.getAttribute("inert")===this.restoredSourceInertWrites.get(record.target))return!1;if(record.attributeName==="slot"){if(this.restoredSlotWrites.has(record.target)&&record.target.getAttribute("slot")===this.restoredSlotWrites.get(record.target))return!1;const snapshot=this.projectedSlotSnapshots.get(record.target);if(snapshot&&record.target.getAttribute("slot")===snapshot.appliedSlot)return!1}return isDirectChild(record.target)||isElementTabContent(record.target)});this.restoredSourceInertWrites.clear(),this.restoredSlotWrites.clear(),relevant&&(this.excludedUnnamedDescriptors.clear(),this.syncTabs())});this.mutationObserver=observer,this.mutationObserverDocument=ownerDocument,observer.observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeFilter:["alt","aria-hidden","aria-label","aria-labelledby","class","closable","disabled","hidden","inert","id","label","name","open","panel","slot","style"]})}disconnectedCallback(){this.resetProjectionReconciliation(),this.resetMutationObserver(),this.resetProjectedSourceObserver(),this.restoreProjectedSources(),this.restoreProjectedSlots(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetMutationObserver(),this.resetProjectedSourceObserver(),this.resetProjectionReconciliation()}resetProjectionReconciliation(){this.projectionGeneration+=1,this.projectionTimer!==void 0&&this.projectionTimerWindow?.clearTimeout(this.projectionTimer),this.projectionTimer=void 0,this.projectionTimerWindow=void 0,this.projectionPending=!1,this.pendingDescriptorUpdates=new WeakSet,this.descriptorUpgrades.disconnect(),this.restoredSourceInertWrites.clear(),this.restoredSlotWrites.clear(),this.excludedUnnamedDescriptors.clear(),this.settleProjection()}beginProjectionSettlement(){this.projectionSettlement||(this.projectionSettlement=new Promise(resolve=>{this.resolveProjectionSettlement=resolve}))}settleProjection(){const resolve=this.resolveProjectionSettlement;this.resolveProjectionSettlement=void 0,this.projectionSettlement=void 0,resolve?.()}async getUpdateComplete(){const generation=this.projectionGeneration,ownerDocument=this.ownerDocument;let complete=await super.getUpdateComplete();if(this.renderSlotPresence(!1)||!ownerDocument.defaultView)return complete;const current=()=>this.isConnected&&generation===this.projectionGeneration&&this.ownerDocument===ownerDocument;for(;current();){const settlement=this.projectionSettlement;if(settlement){if(await settlement,!current())return complete;complete=await super.getUpdateComplete()}else if(this.isUpdatePending)complete=await super.getUpdateComplete();else return complete}return complete}waitForDescriptorUpdate(tab){if(tab.hasUpdated===!0)return!1;const updateComplete=tab.updateComplete;if(updateComplete==null)return this.descriptorUpgrades.observeElement(tab),!1;if(!this.pendingDescriptorUpdates.has(tab)){this.pendingDescriptorUpdates.add(tab);const generation=this.projectionGeneration,ownerDocument=this.ownerDocument;updateComplete.then(()=>{generation===this.projectionGeneration&&this.ownerDocument===ownerDocument&&(this.pendingDescriptorUpdates.delete(tab),tab.parentNode===this&&this.queueProjectionReconciliation())})}return!0}resetMutationObserver(){this.mutationObserverGeneration+=1,this.mutationObserver?.disconnect(),this.mutationObserver=void 0,this.mutationObserverDocument=void 0}readElementModel(children,projectedSlots){this.projectionPending=!1;const seen=new Set,next=[],panelsByName=new Map;for(const child of children){if(child.localName!==tag("tab-panel"))continue;const name=child.getAttribute("name");name!==null&&!panelsByName.has(name)&&panelsByName.set(name,child)}const authoredNames=new Set(children.flatMap(child=>{if(child.localName===tag("tab")){const name=child.getAttribute("panel");return name?[name]:[]}if(child.localName===tag("tab-panel")){const name=child.getAttribute("name");return name?[name]:[]}return[]}));let stagingName="tab-group-sources";for(;authoredNames.has(stagingName);)stagingName+="-sources";this.stagingSlotName=stagingName;let index=0;for(const child of children){if(child.localName!==tag("tab"))continue;const authoredPanel=child.getAttribute("panel")||void 0;let slotName=authoredPanel??`${SYNTHETIC_PANEL_PREFIX}${index}`;if(!authoredPanel){let collision=0;for(;authoredNames.has(slotName)||seen.has(slotName);)collision+=1,slotName=`${SYNTHETIC_PANEL_PREFIX}${index}-${collision}`}if(index+=1,seen.has(slotName))continue;seen.add(slotName);const tabSlot=this.tabSlotName(slotName),assignedSlot=child.assignedSlot,assignedHere=assignedSlot?.getRootNode()===this.renderRoot&&(assignedSlot.name===tabSlot||assignedSlot.name===this.stagingSlotName);if(!assignedHere||!authoredPanel&&this.excludedUnnamedDescriptors.has(child)){this.projectSlot(child,this.stagingSlotName,projectedSlots),assignedHere||(this.projectionPending=!0);continue}if(this.waitForDescriptorUpdate(child)){this.projectionPending=!0,this.projectSlot(child,this.stagingSlotName,projectedSlots);continue}const visibleLabel=this.readElementLabel(child);if(!authoredPanel&&!visibleLabel){this.excludedUnnamedDescriptors.add(child),this.projectSlot(child,this.stagingSlotName,projectedSlots);continue}projectedSlots.add(child);const label=visibleLabel||slotName,panel=panelsByName.get(slotName);panel&&this.projectSlot(panel,slotName,projectedSlots),next.push({slotName,label,disabled:child.hasAttribute("disabled"),inert:isInertChild(child),element:child}),!this.active&&child.hasAttribute("active")&&(this.active=slotName)}if(this.projectionPending){for(const child of children)this.projectedSlotSnapshots.has(child)&&projectedSlots.add(child);return this.tabs}for(const tab of next)this.projectSlot(tab.element,this.tabSlotName(tab.slotName),projectedSlots);return next}readElementLabel(tab){const labelNodes=Array.from(tab.childNodes).filter(node=>node.nodeType!==Node.ELEMENT_NODE||node.getAttribute("slot")===null||node.getAttribute("slot")==="");return composedAccessibilityText(labelNodes,{ancestorBoundary:tab,isSubtreeExcluded:element=>this.isTabLabelSubtreeExcluded(element),ignoreInheritedVisibility:!0}).replace(/\s+/g," ").trim()}libraryOwnsSourceInert(element){return this.projectedSourceSnapshots.get(element)?.libraryOwnsInert===!0}isTabLabelSubtreeExcluded(element){return isTabLabelSubtreeExcludedWithoutInert(element)||element.hasAttribute("inert")&&!this.libraryOwnsSourceInert(element)}snapshotProjectedSource(source){const inert=source.getAttribute("inert");return{inert,appliedInert:inert,libraryOwnsInert:!1}}adoptProjectedSourceInert(source,snapshot){const current=source.getAttribute("inert");current!==snapshot.appliedInert&&(snapshot.inert=current,snapshot.libraryOwnsInert=!1)}makeProjectedSourceInert(source,snapshot){source.hasAttribute("inert")||(source.setAttribute("inert",""),snapshot.libraryOwnsInert=!0),snapshot.appliedInert=source.getAttribute("inert")}restoreProjectedSource(source,snapshot){this.adoptProjectedSourceInert(source,snapshot);const before=source.getAttribute("inert");snapshot.inert===null?source.removeAttribute("inert"):source.setAttribute("inert",snapshot.inert),this.mutationObserver&&this.contains(source)&&source.getAttribute("inert")!==before&&this.restoredSourceInertWrites.set(source,source.getAttribute("inert"))}restoreProjectedSources(){for(const[source,snapshot]of this.projectedSourceSnapshots)this.restoreProjectedSource(source,snapshot);this.projectedSourceSnapshots.clear()}resetProjectedSourceObserver(){this.projectedSourceObserverGeneration+=1,this.projectedSourceObserver?.disconnect(),this.projectedSourceObserver=void 0,this.projectedSourceObserverDocument=void 0}observeProjectedSources(){this.resetProjectedSourceObserver();const ownerDocument=this.ownerDocument,MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor||!this.isConnected||this.projectedSourceSnapshots.size===0)return;const generation=this.projectedSourceObserverGeneration,observer=new MutationObserverCtor(records=>{this.projectedSourceObserver!==observer||this.projectedSourceObserverDocument!==ownerDocument||this.projectedSourceObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||records.some(record=>this.projectedSourceSnapshots.has(record.target))&&this.syncTabs()});this.projectedSourceObserver=observer,this.projectedSourceObserverDocument=ownerDocument;for(const source of this.projectedSourceSnapshots.keys())observer.observe(source,{attributes:!0,attributeFilter:["inert"]})}projectedSources(tabs){const sources=new Set;for(const tab of tabs)for(const child of Array.from(tab.element.children))(child.getAttribute("slot")??"")===""&&sources.add(child);return sources}syncProjectedSources(tabs){const sources=this.projectedSources(tabs);for(const[source,snapshot]of this.projectedSourceSnapshots)this.adoptProjectedSourceInert(source,snapshot),sources.has(source)||(this.restoreProjectedSource(source,snapshot),this.projectedSourceSnapshots.delete(source));for(const source of sources){const snapshot=this.projectedSourceSnapshots.get(source)??this.snapshotProjectedSource(source);this.projectedSourceSnapshots.set(source,snapshot),this.adoptProjectedSourceInert(source,snapshot),this.makeProjectedSourceInert(source,snapshot)}this.observeProjectedSources()}adoptProjectedSourceInertStates(){for(const[source,snapshot]of this.projectedSourceSnapshots)this.adoptProjectedSourceInert(source,snapshot)}snapshotProjectedSlot(source){const slot=source.getAttribute("slot");return{slot,appliedSlot:slot,libraryOwnsSlot:!1}}adoptProjectedSlot(source,snapshot){const current=source.getAttribute("slot");current!==snapshot.appliedSlot&&(snapshot.slot=current,snapshot.libraryOwnsSlot=!1)}projectSlot(source,slot,projectedSlots){const snapshot=this.projectedSlotSnapshots.get(source)??this.snapshotProjectedSlot(source);this.projectedSlotSnapshots.set(source,snapshot),this.adoptProjectedSlot(source,snapshot),source.getAttribute("slot")!==slot&&(source.setAttribute("slot",slot),snapshot.libraryOwnsSlot=!0),snapshot.appliedSlot=source.getAttribute("slot"),projectedSlots.add(source)}restoreProjectedSlot(source,snapshot){this.adoptProjectedSlot(source,snapshot);const before=source.getAttribute("slot");snapshot.slot===null?source.removeAttribute("slot"):source.setAttribute("slot",snapshot.slot),this.mutationObserver&&this.contains(source)&&source.getAttribute("slot")!==before&&this.restoredSlotWrites.set(source,source.getAttribute("slot"))}syncProjectedSlots(projectedSlots){for(const[source,snapshot]of this.projectedSlotSnapshots)projectedSlots.has(source)||(this.restoreProjectedSlot(source,snapshot),this.projectedSlotSnapshots.delete(source))}restoreProjectedSlots(){for(const[source,snapshot]of this.projectedSlotSnapshots)this.restoreProjectedSlot(source,snapshot);this.projectedSlotSnapshots.clear()}adoptProjectedSlotStates(){for(const[source,snapshot]of this.projectedSlotSnapshots)this.adoptProjectedSlot(source,snapshot)}isNavigable(tab){return!tab.disabled&&!tab.inert}willUpdate(changed){if(super.willUpdate(changed),this.projectionPending||!changed.has("tabs")&&!changed.has("active"))return;const focused=shadowFocusTarget(this),focusedSlot=focused?.getAttribute("part")==="tab"?focused.getAttribute("data-slot"):null;focusedSlot!==null&&!this.tabs.some(tab=>tab.slotName===focusedSlot&&this.isNavigable(tab))&&(this.rehomeTabFocus=!0,this.focusedTab=this.active);const current=this.tabs.find(t=>t.slotName===this.active);if(current&&this.isNavigable(current))return;this.rehomeTabFocus=this.rehomeTabFocus||focusedSlot!==null;const outgoing=this.active,before=changed.get("tabs")??this.tabs,at=this.hasUpdated&&changed.has("tabs")&&!changed.has("active")?before.findIndex(t=>t.slotName===outgoing):-1,renamed=at<0?void 0:this.tabs.find(t=>t.element===before[at].element&&this.isNavigable(t));let candidates=this.tabs;if(at>=0){const liveByName=new Map;for(const tab of this.tabs)liveByName.has(tab.slotName)||liveByName.set(tab.slotName,tab);candidates=[...before.slice(at+1),...before.slice(0,at).reverse()].map(tab=>liveByName.get(tab.slotName))}this.active=(renamed??candidates.find(t=>t&&this.isNavigable(t)))?.slotName??"",this.focusedTab=this.active,at>=0&&!renamed&&(this.emit("lr-tab-hide",{name:outgoing}),this.active&&this.emit("lr-tab-show",{name:this.active}))}updated(changed){super.updated(changed),changed.has("tabs")&&this.queueProjectionReconciliation(),!this.projectionPending&&(changed.has("active")||changed.has("tabs"))&&this.syncElementActiveState(),this.scrollOverflow.observeExtra(this.renderRoot.querySelectorAll('[part="tab"]')),this.measureTabScrollEdges(),this.rehomeTabFocus&&(this.rehomeTabFocus=!1,this.renderRoot.querySelector('[part="tab"][tabindex="0"]')?.focus())}selectTab(tab){if(!this.isNavigable(tab)||tab.slotName===this.active)return;const previous=this.active;this.active=tab.slotName,this.focusedTab=tab.slotName,previous&&this.emit("lr-tab-hide",{name:previous}),this.emit("lr-tab-show",{name:tab.slotName})}activateTab(tab){this.isNavigable(tab)&&(this.selectTab(tab),this.emit("lr-activate",{value:tab.slotName}))}show(panel){const tab=this.tabs.find(candidate=>candidate.slotName===panel);tab&&this.selectTab(tab)}syncElementActiveState(){const definitions=new Map;for(const tab of this.tabs)definitions.has(tab.element)||definitions.set(tab.element,tab);for(const child of Array.from(this.children))if(child.localName===tag("tab")){const definition=definitions.get(child);child.toggleAttribute("active",definition?.slotName===this.active)}else child.localName===tag("tab-panel")&&child.toggleAttribute("active",child.getAttribute("name")===this.active)}focusOnly(tab){this.focusedTab=tab.slotName,this.focusTab(tab.slotName)}get rovingTab(){if(this.activation!=="manual")return this.active;const candidate=this.tabs.find(t=>t.slotName===this.focusedTab&&this.isNavigable(t));return candidate?candidate.slotName:this.active}keyboardOriginTab(event,navigable){const eventButton=event.composedPath().find(candidate=>candidate.nodeType===1&&candidate.getAttribute?.("part")==="tab"&&candidate.getRootNode()===this.renderRoot),focused=shadowFocusTarget(this),owned=(eventButton??(focused?.getAttribute("part")==="tab"?focused:void 0))?.dataset.slot;return navigable.find(tab=>tab.slotName===owned)??navigable.find(tab=>tab.slotName===this.rovingTab)}focusTab(slotName){const buttons=this.renderRoot.querySelectorAll('[part="tab"]');for(const button of Array.from(buttons))if(button.dataset.slot===slotName){button.focus();return}}get isVertical(){return this.placement==="start"||this.placement==="end"}tabId(slotName){return this.idsFor(slotName).tab}panelId(slotName){return this.idsFor(slotName).panel}idsFor(slotName){const existing=this.idsBySlot.get(slotName);if(existing)return existing;const token=`${this.baseId}-${this.nextOpaqueId++}`,ids={tab:`${token}-tab`,panel:`${token}-panel`};return this.idsBySlot.set(slotName,ids),ids}tabSlotName(slotName){return`${slotName}-tab`}get scrollControlsSuppressed(){return this.withoutScrollControls||this.noScrollControls}measureTabScrollEdges(){const tablist=this.renderRoot.querySelector('[part~="tablist"]');if(!tablist||this.isVertical){this.setTabScrollEdges(!1,!1,tablist);return}const maximum=Math.max(0,tablist.scrollWidth-tablist.clientWidth),position=Math.max(0,Math.min(maximum,this.effectiveDirection==="rtl"?-tablist.scrollLeft:tablist.scrollLeft));this.setTabScrollEdges(position>1,position<maximum-1,tablist)}setTabScrollEdges(start,end,tablist){tablist?.toggleAttribute("data-scroll-start",start),tablist?.toggleAttribute("data-scroll-end",end),!(start===this.scrollStartAvailable&&end===this.scrollEndAvailable)&&(this.scrollStartAvailable=start,this.scrollEndAvailable=end)}scrollTabs(edge){const tablist=this.renderRoot.querySelector('[part~="tablist"]');if(!tablist||!isHtmlElement(tablist)||typeof tablist.scrollBy!="function")return;const step=Math.max(1,tablist.clientWidth*SCROLL_STEP_RATIO),towardEnd=edge==="end"?1:-1,physical=this.effectiveDirection==="rtl"?-towardEnd:towardEnd;tablist.scrollBy({left:step*physical,behavior:prefersReducedMotion(this)?"instant":"smooth"})}renderScrollControl(edge){if(this.isVertical||this.scrollControlsSuppressed)return nothing;const available=edge==="start"?this.scrollStartAvailable:this.scrollEndAvailable;return html`<button
|
|
1
|
+
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveListMove}from"../../../internal/list-navigation.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityText}from"../../../internal/accessibility-visibility.js";import{CustomElementUpgradeObserver}from"../../../internal/custom-element-upgrade-observer.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{chevronIcon}from"../../../internal/icons.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{tag}from"../../../internal/prefix.js";import{observeScrollOverflow}from"../../../internal/scroll-overflow.js";import{scrollOverflowFadeStyles}from"../../../internal/scroll-overflow.styles.js";import{styles}from"./tab-group.styles.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{LYRA_DEFAULT_scrollNext,LYRA_DEFAULT_scrollPrevious}from"../../../internal/default-strings/layout.generated.js";function isInertChild(child){return isHtmlElement(child)&&child.inert}function isTabLabelSubtreeExcludedWithoutInert(element){if(element.hasAttribute("hidden")||element.getAttribute("aria-hidden")?.trim().toLowerCase()==="true")return!0;const rendered=element.ownerDocument.defaultView?.getComputedStyle(element);return rendered?.display==="none"||rendered?.contentVisibility==="hidden"}const SYNTHETIC_PANEL_PREFIX="lr-tab-",SCROLL_STEP_RATIO=.8;class LyraTabGroup extends LyraElement{constructor(){super(...arguments),this.active="",this.accessibleLabel=null,this.placement="top",this.activation="auto",this.withoutScrollControls=!1,this.noScrollControls=!1,this.fixedScrollControls=!1,this.tabs=[],this.focusedTab="",this.baseId=nextId("tab-group"),this.nextOpaqueId=0,this.idsBySlot=new Map,this.mutationObserverGeneration=0,this.projectionGeneration=0,this.projectionPending=!1,this.stagingSlotName="tab-group-sources",this.pendingDescriptorUpdates=new WeakSet,this.excludedUnnamedDescriptors=new Set,this.descriptorUpgrades=new CustomElementUpgradeObserver(()=>{this.excludedUnnamedDescriptors.clear(),this.queueProjectionReconciliation()}),this.restoredSourceInertWrites=new Map,this.restoredSlotWrites=new Map,this.projectedSourceSnapshots=new Map,this.projectedSlotSnapshots=new Map,this.projectedSourceObserverGeneration=0,this.rehomeTabFocus=!1,this.scrollStartAvailable=!1,this.scrollEndAvailable=!1,this.scrollOverflow=observeScrollOverflow(this,()=>this.renderRoot.querySelector('[part~="tablist"]'),()=>this.measureTabScrollEdges()),this.queueProjectionReconciliation=()=>{if(!this.isConnected||this.projectionTimer!==void 0)return;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow)return;const generation=this.projectionGeneration;this.beginProjectionSettlement(),this.projectionTimerWindow=ownerWindow,this.projectionTimer=ownerWindow.setTimeout(()=>{generation!==this.projectionGeneration||this.ownerDocument!==ownerDocument||!this.isConnected||(this.projectionTimer=void 0,this.projectionTimerWindow=void 0,this.updateBrowserDerivedState(this.syncTabs))},0)},this.syncTabs=()=>{const children=Array.from(this.children);this.adoptProjectedSourceInertStates(),this.adoptProjectedSlotStates();const projectedSlots=new Set,wasPending=this.projectionPending,next=this.readElementModel(children,projectedSlots);this.syncProjectedSlots(projectedSlots),this.syncProjectedSources(next.filter(tab=>tab.element.parentNode===this));const liveSlots=new Set(next.map(tab=>tab.slotName));for(const slotName of this.idsBySlot.keys())liveSlots.has(slotName)||this.idsBySlot.delete(slotName);(next.length!==this.tabs.length||wasPending&&!this.projectionPending||next.some((tab,index)=>{const previous=this.tabs[index];return tab.element!==previous.element||tab.slotName!==previous.slotName||tab.label!==previous.label||tab.disabled!==previous.disabled||tab.inert!==previous.inert}))&&(this.tabs=next),this.projectionPending||this.projectionTimer!==void 0?this.beginProjectionSettlement():this.settleProjection()},this.onTabListKeyDown=e=>{if(e.altKey||e.ctrlKey||e.metaKey||e.isComposing)return;const navigable=this.tabs.filter(t=>this.isNavigable(t));if(navigable.length===0)return;const origin=this.keyboardOriginTab(e,navigable),currentIndex=origin?navigable.indexOf(origin):-1;if(e.key==="Delete"){if(!origin?.element.closable)return;e.preventDefault(),origin.element.requestCloseFromOwner();return}if(this.activation==="manual"&&(e.key==="Enter"||e.key===" "||e.key==="Spacebar")){if(!origin)return;e.preventDefault(),this.activateTab(origin);return}const targetIndex=resolveListMove(e,{count:navigable.length,current:currentIndex,orientation:this.isVertical?"vertical":"horizontal",direction:this.effectiveDirection});if(targetIndex===null)return;e.preventDefault();const target=navigable[targetIndex];if(this.activation==="manual"){this.focusOnly(target);return}this.activateTab(target),this.focusTabButton(target.slotName)},this.onTabListScroll=()=>{this.measureTabScrollEdges()},this.onScrollControlMouseDown=event=>{event.preventDefault()},this.onScrollControlPointerDown=event=>{const control=event.currentTarget;control instanceof HTMLElement&&(control.setAttribute("data-pressed",""),control.setPointerCapture(event.pointerId))},this.onScrollControlPointerEnd=event=>{const control=event.currentTarget;control instanceof HTMLElement&&(control.removeAttribute("data-pressed"),control.hasPointerCapture(event.pointerId)&&control.releasePointerCapture(event.pointerId))}}static{this.defaultStrings={...super.defaultStrings,scrollNext:LYRA_DEFAULT_scrollNext,scrollPrevious:LYRA_DEFAULT_scrollPrevious}}static{this.styles=[LyraElement.styles,scrollOverflowFadeStyles,styles]}connectedCallback(){super.connectedCallback(),this.hasUpdated?this.syncTabs():this.seedFirstRenderState(this.syncTabs),this.resetMutationObserver();const ownerDocument=this.ownerDocument,MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor)return;const generation=this.mutationObserverGeneration,observer=new MutationObserverCtor(records=>{if(this.mutationObserver!==observer||this.mutationObserverDocument!==ownerDocument||this.mutationObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument)return;const isDirectChild=node=>node.parentNode===this,isElementTabContent=node=>{let current=node.nodeType===1?node:node.parentElement;for(;current&¤t!==this;){if(current.localName===tag("tab")&¤t.parentNode===this)return!0;current=current.parentElement}return!1},relevant=records.some(record=>{if(record.type==="childList")return record.target===this||isElementTabContent(record.target);if(record.type==="characterData")return isElementTabContent(record.target);if(record.attributeName==="inert"&&this.projectedSourceSnapshots.has(record.target)||record.attributeName==="inert"&&this.restoredSourceInertWrites.has(record.target)&&record.target.getAttribute("inert")===this.restoredSourceInertWrites.get(record.target))return!1;if(record.attributeName==="slot"){if(this.restoredSlotWrites.has(record.target)&&record.target.getAttribute("slot")===this.restoredSlotWrites.get(record.target))return!1;const snapshot=this.projectedSlotSnapshots.get(record.target);if(snapshot&&record.target.getAttribute("slot")===snapshot.appliedSlot)return!1}return isDirectChild(record.target)||isElementTabContent(record.target)});this.restoredSourceInertWrites.clear(),this.restoredSlotWrites.clear(),relevant&&(this.excludedUnnamedDescriptors.clear(),this.syncTabs())});this.mutationObserver=observer,this.mutationObserverDocument=ownerDocument,observer.observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeFilter:["alt","aria-hidden","aria-label","aria-labelledby","class","closable","disabled","hidden","inert","id","label","name","open","panel","slot","style"]})}disconnectedCallback(){this.resetProjectionReconciliation(),this.resetMutationObserver(),this.resetProjectedSourceObserver(),this.restoreProjectedSources(),this.restoreProjectedSlots(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetMutationObserver(),this.resetProjectedSourceObserver(),this.resetProjectionReconciliation()}resetProjectionReconciliation(){this.projectionGeneration+=1,this.projectionTimer!==void 0&&this.projectionTimerWindow?.clearTimeout(this.projectionTimer),this.projectionTimer=void 0,this.projectionTimerWindow=void 0,this.projectionPending=!1,this.pendingDescriptorUpdates=new WeakSet,this.descriptorUpgrades.disconnect(),this.restoredSourceInertWrites.clear(),this.restoredSlotWrites.clear(),this.excludedUnnamedDescriptors.clear(),this.settleProjection()}beginProjectionSettlement(){this.projectionSettlement||(this.projectionSettlement=new Promise(resolve=>{this.resolveProjectionSettlement=resolve}))}settleProjection(){const resolve=this.resolveProjectionSettlement;this.resolveProjectionSettlement=void 0,this.projectionSettlement=void 0,resolve?.()}async getUpdateComplete(){const generation=this.projectionGeneration,ownerDocument=this.ownerDocument;let complete=await super.getUpdateComplete();if(this.renderSlotPresence(!1)||!ownerDocument.defaultView)return complete;const current=()=>this.isConnected&&generation===this.projectionGeneration&&this.ownerDocument===ownerDocument;for(;current();){const settlement=this.projectionSettlement;if(settlement){if(await settlement,!current())return complete;complete=await super.getUpdateComplete()}else if(this.isUpdatePending)complete=await super.getUpdateComplete();else return complete}return complete}waitForDescriptorUpdate(tab){if(tab.hasUpdated===!0)return!1;const updateComplete=tab.updateComplete;if(updateComplete==null)return this.descriptorUpgrades.observeElement(tab),!1;if(!this.pendingDescriptorUpdates.has(tab)){this.pendingDescriptorUpdates.add(tab);const generation=this.projectionGeneration,ownerDocument=this.ownerDocument;updateComplete.then(()=>{generation===this.projectionGeneration&&this.ownerDocument===ownerDocument&&(this.pendingDescriptorUpdates.delete(tab),tab.parentNode===this&&this.queueProjectionReconciliation())})}return!0}resetMutationObserver(){this.mutationObserverGeneration+=1,this.mutationObserver?.disconnect(),this.mutationObserver=void 0,this.mutationObserverDocument=void 0}readElementModel(children,projectedSlots){this.projectionPending=!1;const seen=new Set,next=[],panelsByName=new Map;for(const child of children){if(child.localName!==tag("tab-panel"))continue;const name=child.getAttribute("name");name!==null&&!panelsByName.has(name)&&panelsByName.set(name,child)}const authoredNames=new Set(children.flatMap(child=>{if(child.localName===tag("tab")){const name=child.getAttribute("panel");return name?[name]:[]}if(child.localName===tag("tab-panel")){const name=child.getAttribute("name");return name?[name]:[]}return[]}));let stagingName="tab-group-sources";for(;authoredNames.has(stagingName);)stagingName+="-sources";this.stagingSlotName=stagingName;let index=0;for(const child of children){if(child.localName!==tag("tab"))continue;const authoredPanel=child.getAttribute("panel")||void 0;let slotName=authoredPanel??`${SYNTHETIC_PANEL_PREFIX}${index}`;if(!authoredPanel){let collision=0;for(;authoredNames.has(slotName)||seen.has(slotName);)collision+=1,slotName=`${SYNTHETIC_PANEL_PREFIX}${index}-${collision}`}if(index+=1,seen.has(slotName))continue;seen.add(slotName);const tabSlot=this.tabSlotName(slotName),assignedSlot=child.assignedSlot,assignedHere=assignedSlot?.getRootNode()===this.renderRoot&&(assignedSlot.name===tabSlot||assignedSlot.name===this.stagingSlotName);if(!assignedHere||!authoredPanel&&this.excludedUnnamedDescriptors.has(child)){this.projectSlot(child,this.stagingSlotName,projectedSlots),assignedHere||(this.projectionPending=!0);continue}if(this.waitForDescriptorUpdate(child)){this.projectionPending=!0,this.projectSlot(child,this.stagingSlotName,projectedSlots);continue}const visibleLabel=this.readElementLabel(child);if(!authoredPanel&&!visibleLabel){this.excludedUnnamedDescriptors.add(child),this.projectSlot(child,this.stagingSlotName,projectedSlots);continue}projectedSlots.add(child);const label=visibleLabel||slotName,panel=panelsByName.get(slotName);panel&&this.projectSlot(panel,slotName,projectedSlots),next.push({slotName,label,disabled:child.hasAttribute("disabled"),inert:isInertChild(child),element:child}),!this.active&&child.hasAttribute("active")&&(this.active=slotName)}if(this.projectionPending){for(const child of children)this.projectedSlotSnapshots.has(child)&&projectedSlots.add(child);return this.tabs}for(const tab of next)this.projectSlot(tab.element,this.tabSlotName(tab.slotName),projectedSlots);return next}readElementLabel(tab){const labelNodes=Array.from(tab.childNodes).filter(node=>node.nodeType!==Node.ELEMENT_NODE||node.getAttribute("slot")===null||node.getAttribute("slot")==="");return composedAccessibilityText(labelNodes,{ancestorBoundary:tab,isSubtreeExcluded:element=>this.isTabLabelSubtreeExcluded(element),ignoreInheritedVisibility:!0}).replace(/\s+/g," ").trim()}libraryOwnsSourceInert(element){return this.projectedSourceSnapshots.get(element)?.libraryOwnsInert===!0}isTabLabelSubtreeExcluded(element){return isTabLabelSubtreeExcludedWithoutInert(element)||element.hasAttribute("inert")&&!this.libraryOwnsSourceInert(element)}snapshotProjectedSource(source){const inert=source.getAttribute("inert");return{inert,appliedInert:inert,libraryOwnsInert:!1}}adoptProjectedSourceInert(source,snapshot){const current=source.getAttribute("inert");current!==snapshot.appliedInert&&(snapshot.inert=current,snapshot.libraryOwnsInert=!1)}makeProjectedSourceInert(source,snapshot){source.hasAttribute("inert")||(source.setAttribute("inert",""),snapshot.libraryOwnsInert=!0),snapshot.appliedInert=source.getAttribute("inert")}restoreProjectedSource(source,snapshot){this.adoptProjectedSourceInert(source,snapshot);const before=source.getAttribute("inert");snapshot.inert===null?source.removeAttribute("inert"):source.setAttribute("inert",snapshot.inert),this.mutationObserver&&this.contains(source)&&source.getAttribute("inert")!==before&&this.restoredSourceInertWrites.set(source,source.getAttribute("inert"))}restoreProjectedSources(){for(const[source,snapshot]of this.projectedSourceSnapshots)this.restoreProjectedSource(source,snapshot);this.projectedSourceSnapshots.clear()}resetProjectedSourceObserver(){this.projectedSourceObserverGeneration+=1,this.projectedSourceObserver?.disconnect(),this.projectedSourceObserver=void 0,this.projectedSourceObserverDocument=void 0}observeProjectedSources(){this.resetProjectedSourceObserver();const ownerDocument=this.ownerDocument,MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor||!this.isConnected||this.projectedSourceSnapshots.size===0)return;const generation=this.projectedSourceObserverGeneration,observer=new MutationObserverCtor(records=>{this.projectedSourceObserver!==observer||this.projectedSourceObserverDocument!==ownerDocument||this.projectedSourceObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||records.some(record=>this.projectedSourceSnapshots.has(record.target))&&this.syncTabs()});this.projectedSourceObserver=observer,this.projectedSourceObserverDocument=ownerDocument;for(const source of this.projectedSourceSnapshots.keys())observer.observe(source,{attributes:!0,attributeFilter:["inert"]})}projectedSources(tabs){const sources=new Set;for(const tab of tabs)for(const child of Array.from(tab.element.children))(child.getAttribute("slot")??"")===""&&sources.add(child);return sources}syncProjectedSources(tabs){const sources=this.projectedSources(tabs);for(const[source,snapshot]of this.projectedSourceSnapshots)this.adoptProjectedSourceInert(source,snapshot),sources.has(source)||(this.restoreProjectedSource(source,snapshot),this.projectedSourceSnapshots.delete(source));for(const source of sources){const snapshot=this.projectedSourceSnapshots.get(source)??this.snapshotProjectedSource(source);this.projectedSourceSnapshots.set(source,snapshot),this.adoptProjectedSourceInert(source,snapshot),this.makeProjectedSourceInert(source,snapshot)}this.observeProjectedSources()}adoptProjectedSourceInertStates(){for(const[source,snapshot]of this.projectedSourceSnapshots)this.adoptProjectedSourceInert(source,snapshot)}snapshotProjectedSlot(source){const slot=source.getAttribute("slot");return{slot,appliedSlot:slot,libraryOwnsSlot:!1}}adoptProjectedSlot(source,snapshot){const current=source.getAttribute("slot");current!==snapshot.appliedSlot&&(snapshot.slot=current,snapshot.libraryOwnsSlot=!1)}projectSlot(source,slot,projectedSlots){const snapshot=this.projectedSlotSnapshots.get(source)??this.snapshotProjectedSlot(source);this.projectedSlotSnapshots.set(source,snapshot),this.adoptProjectedSlot(source,snapshot),source.getAttribute("slot")!==slot&&(source.setAttribute("slot",slot),snapshot.libraryOwnsSlot=!0),snapshot.appliedSlot=source.getAttribute("slot"),projectedSlots.add(source)}restoreProjectedSlot(source,snapshot){this.adoptProjectedSlot(source,snapshot);const before=source.getAttribute("slot");snapshot.slot===null?source.removeAttribute("slot"):source.setAttribute("slot",snapshot.slot),this.mutationObserver&&this.contains(source)&&source.getAttribute("slot")!==before&&this.restoredSlotWrites.set(source,source.getAttribute("slot"))}syncProjectedSlots(projectedSlots){for(const[source,snapshot]of this.projectedSlotSnapshots)projectedSlots.has(source)||(this.restoreProjectedSlot(source,snapshot),this.projectedSlotSnapshots.delete(source))}restoreProjectedSlots(){for(const[source,snapshot]of this.projectedSlotSnapshots)this.restoreProjectedSlot(source,snapshot);this.projectedSlotSnapshots.clear()}adoptProjectedSlotStates(){for(const[source,snapshot]of this.projectedSlotSnapshots)this.adoptProjectedSlot(source,snapshot)}isNavigable(tab){return!tab.disabled&&!tab.inert}willUpdate(changed){if(super.willUpdate(changed),this.projectionPending||!changed.has("tabs")&&!changed.has("active"))return;const focused=shadowFocusTarget(this),focusedSlot=focused?.getAttribute("part")==="tab"?focused.getAttribute("data-slot"):null;focusedSlot!==null&&!this.tabs.some(tab=>tab.slotName===focusedSlot&&this.isNavigable(tab))&&(this.rehomeTabFocus=!0,this.focusedTab=this.active);const current=this.tabs.find(t=>t.slotName===this.active);if(current&&this.isNavigable(current))return;this.rehomeTabFocus=this.rehomeTabFocus||focusedSlot!==null;const outgoing=this.active,before=changed.get("tabs")??this.tabs,at=this.hasUpdated&&changed.has("tabs")&&!changed.has("active")?before.findIndex(t=>t.slotName===outgoing):-1,renamed=at<0?void 0:this.tabs.find(t=>t.element===before[at].element&&this.isNavigable(t));let candidates=this.tabs;if(at>=0){const liveByName=new Map;for(const tab of this.tabs)liveByName.has(tab.slotName)||liveByName.set(tab.slotName,tab);candidates=[...before.slice(at+1),...before.slice(0,at).reverse()].map(tab=>liveByName.get(tab.slotName))}this.active=(renamed??candidates.find(t=>t&&this.isNavigable(t)))?.slotName??"",this.focusedTab=this.active,at>=0&&!renamed&&(this.emit("lr-tab-hide",{name:outgoing}),this.active&&this.emit("lr-tab-show",{name:this.active}))}updated(changed){super.updated(changed),changed.has("tabs")&&this.queueProjectionReconciliation(),!this.projectionPending&&(changed.has("active")||changed.has("tabs"))&&this.syncElementActiveState(),this.scrollOverflow.observeExtra(this.renderRoot.querySelectorAll('[part="tab"]')),this.measureTabScrollEdges(),this.rehomeTabFocus&&(this.rehomeTabFocus=!1,this.renderRoot.querySelector('[part="tab"][tabindex="0"]')?.focus())}selectTab(tab){if(!this.isNavigable(tab)||tab.slotName===this.active)return;const previous=this.active;this.active=tab.slotName,this.focusedTab=tab.slotName,previous&&this.emit("lr-tab-hide",{name:previous}),this.emit("lr-tab-show",{name:tab.slotName})}activateTab(tab){this.isNavigable(tab)&&(this.selectTab(tab),this.emit("lr-activate",{value:tab.slotName}))}show(panel){const tab=this.tabs.find(candidate=>candidate.slotName===panel);tab&&this.selectTab(tab)}syncElementActiveState(){const definitions=new Map;for(const tab of this.tabs)definitions.has(tab.element)||definitions.set(tab.element,tab);for(const child of Array.from(this.children))if(child.localName===tag("tab")){const definition=definitions.get(child);child.toggleAttribute("active",definition?.slotName===this.active)}else child.localName===tag("tab-panel")&&child.toggleAttribute("active",child.getAttribute("name")===this.active)}focusOnly(tab){this.focusedTab=tab.slotName,this.focusTabButton(tab.slotName)}get rovingTab(){if(this.activation!=="manual")return this.active;const candidate=this.tabs.find(t=>t.slotName===this.focusedTab&&this.isNavigable(t));return candidate?candidate.slotName:this.active}keyboardOriginTab(event,navigable){const eventButton=event.composedPath().find(candidate=>candidate.nodeType===1&&candidate.getAttribute?.("part")==="tab"&&candidate.getRootNode()===this.renderRoot),focused=shadowFocusTarget(this),owned=(eventButton??(focused?.getAttribute("part")==="tab"?focused:void 0))?.dataset.slot;return navigable.find(tab=>tab.slotName===owned)??navigable.find(tab=>tab.slotName===this.rovingTab)}focusTabButton(slotName,options){const button=this.tabButton(slotName);return button?(button.focus(options),!0):!1}tabButton(slotName){const buttons=this.renderRoot.querySelectorAll('[part="tab"]');return Array.from(buttons).find(button=>button.dataset.slot===slotName)}focusTab(panel,options){const tab=this.tabs.find(candidate=>candidate.slotName===panel);return tab?this.focusTabDefinition(tab,options):!1}focusTabElement(element,options){const tab=this.tabs.find(candidate=>candidate.element===element);return tab?this.focusTabDefinition(tab,options):!1}blurTabElement(element){const tab=this.tabs.find(candidate=>candidate.element===element),button=tab?this.tabButton(tab.slotName):void 0;button&&shadowFocusTarget(this)===button&&button.blur()}focusTabDefinition(tab,options){return this.isNavigable(tab)?(this.activation==="manual"?this.focusedTab=tab.slotName:this.selectTab(tab),this.focusTabButton(tab.slotName,options)):!1}get isVertical(){return this.placement==="start"||this.placement==="end"}tabId(slotName){return this.idsFor(slotName).tab}panelId(slotName){return this.idsFor(slotName).panel}idsFor(slotName){const existing=this.idsBySlot.get(slotName);if(existing)return existing;const token=`${this.baseId}-${this.nextOpaqueId++}`,ids={tab:`${token}-tab`,panel:`${token}-panel`};return this.idsBySlot.set(slotName,ids),ids}tabSlotName(slotName){return`${slotName}-tab`}get scrollControlsSuppressed(){return this.withoutScrollControls||this.noScrollControls}measureTabScrollEdges(){const tablist=this.renderRoot.querySelector('[part~="tablist"]');if(!tablist||this.isVertical){this.setTabScrollEdges(!1,!1,tablist);return}const maximum=Math.max(0,tablist.scrollWidth-tablist.clientWidth),position=Math.max(0,Math.min(maximum,this.effectiveDirection==="rtl"?-tablist.scrollLeft:tablist.scrollLeft));this.setTabScrollEdges(position>1,position<maximum-1,tablist)}setTabScrollEdges(start,end,tablist){tablist?.toggleAttribute("data-scroll-start",start),tablist?.toggleAttribute("data-scroll-end",end),!(start===this.scrollStartAvailable&&end===this.scrollEndAvailable)&&(this.scrollStartAvailable=start,this.scrollEndAvailable=end)}scrollTabs(edge){const tablist=this.renderRoot.querySelector('[part~="tablist"]');if(!tablist||!isHtmlElement(tablist)||typeof tablist.scrollBy!="function")return;const step=Math.max(1,tablist.clientWidth*SCROLL_STEP_RATIO),towardEnd=edge==="end"?1:-1,physical=this.effectiveDirection==="rtl"?-towardEnd:towardEnd;tablist.scrollBy({left:step*physical,behavior:prefersReducedMotion(this)?"instant":"smooth"})}renderScrollControl(edge){if(this.isVertical||this.scrollControlsSuppressed)return nothing;const available=edge==="start"?this.scrollStartAvailable:this.scrollEndAvailable;return html`<button
|
|
2
2
|
type="button"
|
|
3
3
|
part=${edge==="start"?"scroll-button scroll-button__base scroll-button-start scroll-button--start":"scroll-button scroll-button__base scroll-button-end scroll-button--end"}
|
|
4
4
|
tabindex="-1"
|
|
@@ -43,4 +43,10 @@ active:boolean;
|
|
|
43
43
|
/** Shows a localized close affordance. Clicking it or pressing Delete on the focused owning tab
|
|
44
44
|
* emits `lr-close`; it never removes the tab. The visual affordance is non-focusable because the
|
|
45
45
|
* group projects it into the real tab button. */
|
|
46
|
-
closable:boolean;connectedCallback():void;private onClosePointerDown;private onCloseClick;
|
|
46
|
+
closable:boolean;connectedCallback():void;private onClosePointerDown;private onCloseClick;private get owner();
|
|
47
|
+
/** Focuses the real `role="tab"` button the owning group renders for this descriptor, exactly
|
|
48
|
+
* as the group's `focusTab(panel)` does (under `activation="auto"` that also selects it). A
|
|
49
|
+
* disabled or inert tab, or one outside an upgraded group, is not focusable and is left alone. */
|
|
50
|
+
focus(options?:FocusOptions):void;
|
|
51
|
+
/** Removes focus from the owning group's real tab button when it is focused.*/
|
|
52
|
+
blur():void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-tab':LyraTab;}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{closeIcon}from"../../../internal/icons.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./tab.styles.js";import{LYRA_DEFAULT_close}from"../../../internal/default-strings/shared.generated.js";class LyraTab extends LyraElement{constructor(){super(...arguments),this.panel="",this.disabled=!1,this.active=!1,this.closable=!1,this.onClosePointerDown=event=>{event.preventDefault(),event.stopPropagation()},this.onCloseClick=event=>{event.stopPropagation(),this.requestCloseFromOwner()}}static{this.defaultStrings={...super.defaultStrings,close:LYRA_DEFAULT_close}}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.hasAttribute("slot")||(this.slot="nav")}requestCloseFromOwner(){!this.closable||this.disabled||this.emit("lr-close",null)}render(){return html`
|
|
1
|
+
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{closeIcon}from"../../../internal/icons.js";import{LyraElement}from"../../../internal/lyra-element.js";import{tag}from"../../../internal/prefix.js";import{styles}from"./tab.styles.js";import{LYRA_DEFAULT_close}from"../../../internal/default-strings/shared.generated.js";class LyraTab extends LyraElement{constructor(){super(...arguments),this.panel="",this.disabled=!1,this.active=!1,this.closable=!1,this.onClosePointerDown=event=>{event.preventDefault(),event.stopPropagation()},this.onCloseClick=event=>{event.stopPropagation(),this.requestCloseFromOwner()}}static{this.defaultStrings={...super.defaultStrings,close:LYRA_DEFAULT_close}}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.hasAttribute("slot")||(this.slot="nav")}get owner(){const parent=this.parentElement;return parent&&parent.localName===tag("tab-group")&&typeof parent.focusTabElement=="function"?parent:void 0}focus(options){this.owner?.focusTabElement(this,options)||super.focus(options)}blur(){const owner=this.owner;owner?owner.blurTabElement(this):super.blur()}requestCloseFromOwner(){!this.closable||this.disabled||this.emit("lr-close",null)}render(){return html`
|
|
2
2
|
<slot part="base tab"></slot>
|
|
3
3
|
${this.closable?html`
|
|
4
4
|
<span
|
|
@@ -411,7 +411,7 @@ get renderedRows():HTMLElement[];
|
|
|
411
411
|
* returned elements as read-only: their lifetime belongs to the windowing math, and any of them
|
|
412
412
|
* can be recycled or removed on the next update.
|
|
413
413
|
*/
|
|
414
|
-
get projectedRows():HTMLElement[];private get externalScroller();private get spacerElement();private externalGeometry?;private externalStyleObserver?;private invalidateExternalGeometry;private scrollRoundingAnchor?;private scrollScale;private logicalScroll;private physicalScroll;private physicalRowOffset;private captureScrollRounding;private readScrollMetrics;private readPhysicalScrollMetrics;private visualBlockScale;private relativeBlockScale;private applyScrollPosition;private scrollMetricsRefreshPending;private scheduleScrollMetricsRefresh;private syncExternalScrollMetrics;private get safeRowIndexOffset();private computedAriaRowIndex;private containerScrollTop;private viewportHeight;private renderUnmeasuredWindow;private offsets;private offsetDirtyStart;private appendIdentityStart;private identityIndices;private keyIndices;private keyOccurrences;private groupPrefixDirty;private rowKeys;private rowIdentities;private fixedRowHeight;private readonly measuredHeights;private readonly measuredIndices;private indexedMeasurementIndices;private indexedMeasurementDeltaPrefix;private indexedMeasurementIndexDirty;private offsetsDirty;private identitiesDirty;private itemsChangedPendingPrune;private compositionVersion;private compositionScrollTarget?;private readonly composition;private renderStart;private renderEnd;private pinnedRow;private renderedWindow;private rowElements;private groupElements;private stickyElement?;private projectionAnchor?;private projectionPart?;private projectionDeferred;private readonly releaseRowProjection;private visibleStart;private visibleEnd;private lastEmittedStart;private lastEmittedEnd;private loadMoreArmed;private pendingScrollCorrection?;private measurementGeneration;private isFirstUpdate;private stickyHeight;private noTopLayer;private rowResizeObserver?;private groupResizeObserver?;private containerResizeObserver?;private stickyResizeObserver?;private observedSticky?;private readonly observedRows;private readonly observedRowKeys;private readonly observedRowIndices;private readonly observedGroups;private readonly observedGroupIndices;private scrollRafId?;private scrollRafOwner?;private scrollRafDocument?;private scrollListenerTarget?;private viewportResizeTarget?;private externalMetricsPending;private ownerRealmGeneration;private inResizeDelivery;private readonly pendingRowMeasurements;private readonly pendingGroupMeasurements;private readonly deferredRowObservations;private readonly deferredGroupObservations;private rowObserveRafId?;private rowObserveRafOwner?;private rowObserveRafDocument?;private activeIndexFor?;private activeIndexForLength;private activeIndexForId;private activeIndexForKeyFn?;private activeIndexCache;private get activeIndex();private pendingScrollTop;private normalizedGroups;private readonly normalizedGroupByIndex;private readonly measuredGroupHeights;private groupHeightPrefix;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private isCurrentOwnerWork;private resetOwnerRealmWork;firstUpdated(changed:PropertyValues):void;private contentRefreshPending;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private parseRowHeight;private get effectiveSource();private get itemCount();private itemAt;private keyOf;private rowIdentity;private identityAt;private groupHeightAt;private rowHeightAt;private groupContributionThrough;private groupCountThrough;private recomputeGroupHeightPrefix;private indexedOffsetForIndex;private rebuildIndexedMeasurementIndex;private pruneIndexedMeasurements;private offsetAt;private recomputeOffsets;private groupTopAt;private rowBottomAt;private entryTopAt;private findIndexAtOrAfter;private findIndexAtOrBefore;
|
|
414
|
+
get projectedRows():HTMLElement[];private get externalScroller();private get spacerElement();private externalGeometry?;private externalStyleObserver?;private invalidateExternalGeometry;private scrollRoundingAnchor?;private scrollScale;private logicalScroll;private physicalScroll;private physicalRowOffset;private captureScrollRounding;private readScrollMetrics;private readPhysicalScrollMetrics;private visualBlockScale;private relativeBlockScale;private applyScrollPosition;private scrollMetricsRefreshPending;private scheduleScrollMetricsRefresh;private syncExternalScrollMetrics;private get safeRowIndexOffset();private computedAriaRowIndex;private containerScrollTop;private viewportHeight;private renderUnmeasuredWindow;private offsets;private offsetDirtyStart;private appendIdentityStart;private identityIndices;private keyIndices;private keyOccurrences;private groupPrefixDirty;private rowKeys;private rowIdentities;private fixedRowHeight;private readonly measuredHeights;private readonly measuredIndices;private indexedMeasurementIndices;private indexedMeasurementDeltaPrefix;private indexedMeasurementIndexDirty;private offsetsDirty;private identitiesDirty;private itemsChangedPendingPrune;private compositionVersion;private compositionScrollTarget?;private readonly composition;private renderStart;private renderEnd;private pinnedRow;private renderedWindow;private rowElements;private groupElements;private stickyElement?;private projectionAnchor?;private projectionPart?;private projectionDeferred;private readonly releaseRowProjection;private visibleStart;private visibleEnd;private lastEmittedStart;private lastEmittedEnd;private loadMoreArmed;private pendingScrollCorrection?;private measurementGeneration;private smoothScrollWait?;private isFirstUpdate;private stickyHeight;private noTopLayer;private rowResizeObserver?;private groupResizeObserver?;private containerResizeObserver?;private stickyResizeObserver?;private observedSticky?;private readonly observedRows;private readonly observedRowKeys;private readonly observedRowIndices;private readonly observedGroups;private readonly observedGroupIndices;private scrollRafId?;private scrollRafOwner?;private scrollRafDocument?;private scrollListenerTarget?;private viewportResizeTarget?;private externalMetricsPending;private ownerRealmGeneration;private inResizeDelivery;private readonly pendingRowMeasurements;private readonly pendingGroupMeasurements;private readonly deferredRowObservations;private readonly deferredGroupObservations;private rowObserveRafId?;private rowObserveRafOwner?;private rowObserveRafDocument?;private activeIndexFor?;private activeIndexForLength;private activeIndexForId;private activeIndexForKeyFn?;private activeIndexCache;private get activeIndex();private pendingScrollTop;private normalizedGroups;private readonly normalizedGroupByIndex;private readonly measuredGroupHeights;private groupHeightPrefix;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private isCurrentOwnerWork;private resetOwnerRealmWork;firstUpdated(changed:PropertyValues):void;private contentRefreshPending;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private parseRowHeight;private get effectiveSource();private get itemCount();private itemAt;private keyOf;private rowIdentity;private identityAt;private groupHeightAt;private rowHeightAt;private groupContributionThrough;private groupCountThrough;private recomputeGroupHeightPrefix;private indexedOffsetForIndex;private rebuildIndexedMeasurementIndex;private pruneIndexedMeasurements;private offsetAt;private recomputeOffsets;private groupTopAt;private rowBottomAt;private entryTopAt;private findIndexAtOrAfter;private findIndexAtOrBefore;
|
|
415
415
|
/**
|
|
416
416
|
* Row `index`'s logical pixel top in this list's own scroll-coordinate space.
|
|
417
417
|
* Above 8,000,000 pixels, native scrollbar travel and row transforms use a scaled extent;
|
|
@@ -448,4 +448,4 @@ indexAtOffset(px:number):number;private computeRange;private limitCompositionWin
|
|
|
448
448
|
* and key function, and is canceled by replacement data, a new target, manual scroll intent, or
|
|
449
449
|
* disconnect, so a late observation can never drag a newer view back to a stale row.
|
|
450
450
|
*/
|
|
451
|
-
scrollToIndex(index:number,options?:{align?:'start'|'end'|'auto';behavior?:'auto'|'smooth';}):void;private hasUnmeasuredGroupThrough;private beginPendingScrollCorrection;private performScrollTo;private maybeCorrectPendingScroll;private emitRangeChangeIfNeeded;private maybeFireLoadMore;private get projectionActive();private rowSlotName;private syncRowProjection;private ensureProjectionAnchor;private teardownRowProjection;private renderProjectedRows;private focusedRowOutsideWindow;private onFocusOut;private renderRow;private recomputeGroups;private renderGroups;private currentStickyGroup;private renderStickyLayer;private syncStickyOverlay;private onStickyResized;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-virtual-list':LyraVirtualList;}}
|
|
451
|
+
scrollToIndex(index:number,options?:{align?:'start'|'end'|'auto';behavior?:'auto'|'smooth';}):void;private hasUnmeasuredGroupThrough;private beginPendingScrollCorrection;private performScrollTo;private cancelSmoothScrollWait;private waitForSmoothScroll;private maybeCorrectPendingScroll;private emitRangeChangeIfNeeded;private maybeFireLoadMore;private get projectionActive();private rowSlotName;private syncRowProjection;private ensureProjectionAnchor;private teardownRowProjection;private renderProjectedRows;private focusedRowOutsideWindow;private onFocusOut;private renderRow;private recomputeGroups;private renderGroups;private currentStickyGroup;private renderStickyLayer;private syncStickyOverlay;private onStickyResized;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-virtual-list':LyraVirtualList;}}
|