@taprootio/espalier 2.14.0 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +3547 -2013
- package/dist/date-picker/esp-date-picker.js +22 -22
- package/dist/flyout/esp-flyout.js +4 -4
- package/dist/font-picker/esp-font-picker.js +4 -4
- package/dist/form/esp-form.js +1 -1
- package/dist/form-item/esp-form-item.js +4 -4
- package/dist/grid/esp-grid.d.ts +4 -12
- package/dist/grid/esp-grid.js +5 -5
- package/dist/header/esp-header.js +7 -7
- package/dist/input/esp-input.js +1 -1
- package/dist/lightbox/esp-lightbox.js +16 -16
- package/dist/page/esp-page.js +26 -26
- package/dist/page/workspace-width.js +1 -0
- package/dist/pickers/esp-pick-one.d.ts +9 -30
- package/dist/pickers/esp-pick-one.js +18 -50
- package/dist/pickers/esp-pick-some.d.ts +4 -29
- package/dist/pickers/esp-pick-some.js +15 -42
- package/dist/pickers/esp-picker-base.d.ts +95 -0
- package/dist/pickers/esp-picker-base.js +33 -1
- package/dist/pickers/esp-picker-item.d.ts +1 -0
- package/dist/pickers/esp-picker-item.js +3 -3
- package/dist/pickers/esp-picker-menu.d.ts +0 -2
- package/dist/pickers/esp-picker-menu.js +6 -6
- package/dist/pickers/pick-one-selection.js +1 -0
- package/dist/popover/esp-popover.js +6 -6
- package/dist/repeater/esp-repeater.d.ts +11 -8
- package/dist/repeater/esp-repeater.js +4 -4
- package/dist/shared/color-engine.js +1 -1
- package/dist/shared/cursor-pagination.d.ts +76 -0
- package/dist/shared/cursor-pagination.js +1 -0
- package/dist/shared/form-field-description-controller.js +1 -1
- package/dist/shared/intent-values.d.ts +13 -2
- package/dist/shared/intent-values.js +1 -1
- package/dist/shared/popover-controller.js +1 -1
- package/dist/shared/raf-throttle.js +1 -0
- package/dist/shared/utilities.d.ts +27 -27
- package/dist/shared/utilities.js +1 -1
- package/dist/shared/viewport.d.ts +89 -0
- package/dist/shared/viewport.js +1 -0
- package/dist/textarea/esp-textarea.js +2 -2
- package/licenses/asset-provenance.json +1 -1
- package/package.json +9 -1
- package/dist/header/esp-menu-group.js +0 -1
- package/dist/header/esp-menu-item.js +0 -1
- package/dist/header/esp-menu.js +0 -1
package/dist/page/esp-page.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var z=function(G,e,t,i){var a=arguments.length,s=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(G,e,t,i);else for(var r=G.length-1;r>=0;r--)(o=G[r])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s};import{css as ie,html as ae,nothing as Z}from"lit";import{customElement as se,property as _,state as K}from"lit/decorators.js";import{classMap as re}from"lit/directives/class-map.js";import{createRef as M,ref as P}from"lit/directives/ref.js";import{EspalierElementBase as J}from"../shared/esp-element-base.js";import{BiDirectionalStickyController as q}from"./bi-directional-sticky-controller.js";import{getEspBus as oe}from"../shared/bus-events.js";import"../toaster/esp-toaster.js";const ee='esp-footer, footer, [role~="contentinfo"]',ne="(max-width: 50em)",h=1,le=5,he=12,pe=48,de=48,ce=16,ue=64,ge=250,me=250,ve=40;let x=class extends J{constructor(){super(),this.dialogZone=M(),this.flyoutSlot=M(),this.footerSlot=M(),this.previewSlot=M(),this.previewSpace=M(),this.previewMinWidthProbe=M(),this.previewDefaultWidthProbe=M(),this.previewMaxWidthProbe=M(),this.flyoutMinWidthProbe=M(),this.flyoutDefaultWidthProbe=M(),this.flyoutMaxWidthProbe=M(),this.mainMinWidthProbe=M(),this.mainConfiguredMaxWidthProbe=M(),this.mainMaxWidthProbe=M(),this.resizeStepProbe=M(),this.resizeLargeStepProbe=M(),this.previewObservedWidths=new WeakMap,this.previewSyncRaf=null,this.previewSyncGeneration=0,this.previewSyncTask=Promise.resolve(),this.previewOverlayRecoveryRequested=!1,this.previewHeader=null,this.previewMenu=null,this.previewCollapsedSidebarWidth=0,this.previewNavigationCollapseTask=null,this.flyoutOverlayPromotionWidth=null,this.flyoutOverlayRecoveryReady=!1,this.flyoutOverlayRecoveryGeneration=0,this.preferredPreviewWidth=null,this.preferredFlyoutWidth=null,this.flyoutFullHeightActive=!1,this.resizeSession=null,this.workspaceKeyboardSettlementTimer=null,this.workspaceRecenteringRaf=null,this.workspaceRecenteringTimer=null,this.footerWrapperIsLandmark=!0,this.allocatedPreviewWidth=0,this.allocatedFlyoutWidth=0,this.onWorkspaceResizePointerDown=(e,t)=>{if(t.button!==0||!this.separatorIsAvailable(e))return;const i=t.currentTarget,a=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,s=this.renderedWorkspaceWidths();this.endWorkspaceResize(),this.finishWorkspaceKeyboardResize(!1),this.suspendPreviewLayoutForWorkspaceResize();const o=i.getBoundingClientRect(),r=this.holdWorkspacePosition();this.toggleAttribute("data-workspace-resizing",!0);const{leading:n,trailing:d}=this.workspaceLogicalGutterWidths(),m=d>h?n+d:0,p=d>h?Math.max(1,m/d):1;this.resizeSession={separator:e,pointerId:t.pointerId,target:i,startClientX:t.clientX,startPreviewWidth:s.previewWidth,startFlyoutWidth:s.flyoutWidth,startMainWidth:a,startNavigationAllowance:this.previewNavigationResizeAllowance(),startOuterGrowthCapacity:m,trailingExpansionScale:p,trailingGroupPushDelta:0,startHandleClientX:o.left+o.width/2,startLeadingGutterWidth:r,heldLeadingGutterWidth:r,direction:this.workspaceResizeDirection()};try{i.setPointerCapture?.(t.pointerId)}catch{}t.preventDefault()},this.onWorkspaceResizePointerMove=e=>{const t=this.resizeSession;if(!t||t.pointerId!==e.pointerId)return;e.preventDefault();const i=e.clientX-t.startClientX,a=i*t.direction,s=t.separator==="main-preview"||t.separator==="preview-flyout"&&!this.previewVisible;t.trailingGroupPushDelta=s&&a>0?Math.min(a,t.startOuterGrowthCapacity/t.trailingExpansionScale,this.mainResizeGrowthCapacity(t.startMainWidth)):0,this.applyWorkspaceResize(t.separator,i,"pointer",t.startPreviewWidth,t.startFlyoutWidth,t.startMainWidth,t.startNavigationAllowance,t.startOuterGrowthCapacity,t.trailingExpansionScale,t.direction),this.align!=="start"&&!this.seedWorkspaceResizeLeadingGutter(t)&&this.trackWorkspaceResizePointer(t)},this.onWorkspaceResizePointerEnd=e=>{!this.resizeSession||this.resizeSession.pointerId!==e.pointerId||(e.preventDefault(),this.endWorkspaceResize())},this.onWorkspaceResizeBlur=e=>{this.hasAttribute("data-workspace-keyboard-adjusting")&&(e.relatedTarget instanceof Element&&e.relatedTarget.classList.contains("esp-page-workspace-resize-handle")||this.finishWorkspaceKeyboardResize())},this.onWorkspaceResizeKeyDown=(e,t)=>{if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight"||!this.separatorIsAvailable(e))return;t.preventDefault(),this.hasAttribute("data-workspace-keyboard-adjusting")||this.suspendPreviewLayoutForWorkspaceResize();const i=(t.key==="ArrowLeft"?-1:1)*this.resizeStep(t.shiftKey),a=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,s=this.renderedWorkspaceWidths();this.applyWorkspaceResize(e,i,"keyboard",s.previewWidth,s.flyoutWidth,a,this.previewNavigationResizeAllowance(),(()=>{const o=this.workspaceLogicalGutterWidths();return o.leading+o.trailing})(),1,this.workspaceResizeDirection())},this.schedulePreviewLayout=(e=!1)=>{if(!this.isConnected||!this.hasUpdated||(this.previewOverlayRecoveryRequested||=e===!0,this.resizeSession||this.hasAttribute("data-workspace-keyboard-adjusting")||this.hasAttribute("data-workspace-position-held")))return;this.previewSyncGeneration+=1;const t=this.previewSyncGeneration;this.previewSyncRaf!==null&&cancelAnimationFrame(this.previewSyncRaf),this.previewSyncRaf=requestAnimationFrame(()=>{this.previewSyncRaf=null;const i=this.previewOverlayRecoveryRequested;this.previewOverlayRecoveryRequested=!1,this.previewSyncTask=this.previewSyncTask.then(()=>this.syncPreviewLayout(t,i)).catch(()=>{})})},this.onPreviewMediaChange=()=>this.schedulePreviewLayout(!0),this.onPreviewResize=e=>{let t=!1;for(const i of e){const a=i.contentRect.width;if(i.target instanceof HTMLElement&&i.target.classList.contains("esp-page-left")){a>h&&!this.hasAttribute("data-preview-navigation-collapsed")&&(this.previewCollapsedSidebarWidth=a);continue}const s=this.previewObservedWidths.get(i.target);this.previewObservedWidths.set(i.target,a),t||=s===void 0||Math.abs(s-a)>.25}t&&this.schedulePreviewLayout(!0)},this.kind="wide",this.align="start",this.contained=!1,this.headerPosition="normal",this.fixedMenus=!1,this.previewOpen=!1,this.previewLabel="Preview",this.previewCollapseSidebar=!1,this.workspaceResizable=!1,this.previewVisible=!1,this.previewReclaiming=!1,new q(this,".esp-page-left > .sticky-wrapper"),new q(this,".esp-page-right > .sticky-wrapper"),new q(this,".esp-page-flyout > .sticky-wrapper",{topOffset:()=>this.flyoutFullHeightActive?0:void 0}),new q(this,".esp-page-preview > .sticky-wrapper",{topOffset:()=>0}),this.addEventListener("flyout-state-changed",e=>this.syncFlyoutState(e))}connectedCallback(){const e=Array.from(this.children).filter(t=>t.getAttribute("slot")==="footer");this.footerWrapperIsLandmark=!e.some(t=>this.footerElementProvidesLandmark(t)),super.connectedCallback(),this.syncMainMaximumConfiguration(),this.hasUpdated&&queueMicrotask(()=>this.setupPreviewLayoutObserver())}disconnectedCallback(){this.finishWorkspaceKeyboardResize(!1),this.endWorkspaceResize(),this.clearWorkspaceRecenteringState(),this.previewResizeObserver?.disconnect(),this.previewResizeObserver=void 0,this.previewMediaQuery?.removeEventListener("change",this.onPreviewMediaChange),this.previewMediaQuery=void 0,this.previewSyncRaf!==null&&(cancelAnimationFrame(this.previewSyncRaf),this.previewSyncRaf=null),this.previewSyncGeneration+=1,this.previewOverlayRecoveryRequested=!1,this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1),this.toggleAttribute("data-workspace-keyboard-adjusting",!1),this.toggleAttribute("descendant-flyout-overlay-open",!1),this.clearFlyoutOverlayRecovery(),this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),this.preferredPreviewWidth=null,this.preferredFlyoutWidth=null,this.previewNavigationCollapseTask=null,this.setPreviewNavigationCollapse(!1),super.disconnectedCallback()}syncFlyoutState(e){if(e&&e.target?.closest?.("esp-page")!==this){this.syncDescendantFlyoutOverlayState();return}const t=r=>{const n=r;return(typeof n.mode=="string"?n.mode:r.getAttribute("mode"))==="overlay"||n.pageOverlayRequested===!0},i=r=>{const n=r.open;return typeof n=="boolean"?n:r.hasAttribute("open")},a=r=>r.anchor!=null,s=r=>{const n=r.fullHeight;return typeof n=="boolean"?n:r.hasAttribute("full-height")},o=(this.flyoutSlot.value?.assignedElements()??[]).filter(r=>r.tagName==="ESP-FLYOUT");for(const r of o){const n=r,d=typeof n.mode=="string"?n.mode:r.getAttribute("mode");n.pageOverlayRequested&&(!i(r)||d!=="auto")&&(n.pageOverlayRequested=!1)}o.some(r=>r.pageOverlayRequested===!0)||this.clearFlyoutOverlayRecovery(),this.toggleAttribute("flyout-open",o.some(r=>i(r)&&!t(r))),this.toggleAttribute("flyout-overlay-open",o.some(r=>i(r)&&t(r))),this.toggleAttribute("flyout-anchored",o.some(r=>i(r)&&a(r))),this.flyoutFullHeightActive=o.some(r=>i(r)&&!t(r)&&s(r)),this.toggleAttribute("flyout-full-height",this.flyoutFullHeightActive),this.resizeSession&&(this.hasAttribute("flyout-overlay-open")||this.resizeSession.separator==="preview-flyout"&&!this.hasAttribute("flyout-open"))&&this.endWorkspaceResize(),this.requestUpdate(),this.schedulePreviewLayout()}syncDescendantFlyoutOverlayState(){const e=Array.from(this.querySelectorAll("esp-flyout")).some(t=>{if(t.closest("esp-page")===this)return!1;const i=t,a=typeof i.open=="boolean"?i.open:t.hasAttribute("open"),s=typeof i.mode=="string"?i.mode:t.getAttribute("mode");return a&&(s==="overlay"||i.pageOverlayRequested===!0||t.getAttribute("aria-modal")==="true")});this.toggleAttribute("descendant-flyout-overlay-open",e)}assignedFlyouts(){return(this.flyoutSlot.value?.assignedElements()??[]).filter(e=>e.tagName==="ESP-FLYOUT")}openAutoFlyouts(){return this.assignedFlyouts().filter(e=>{const t=typeof e.open=="boolean"?e.open:e.hasAttribute("open"),i=typeof e.mode=="string"?e.mode:e.getAttribute("mode");return t&&i!=="overlay"})}async setPageFlyoutOverlay(e){let t=!1;const i=new Set(this.openAutoFlyouts());for(const a of this.assignedFlyouts()){const s=e&&i.has(a);a.pageOverlayRequested!==s&&(a.pageOverlayRequested=s,t=!0)}return t&&await Promise.all(this.assignedFlyouts().map(a=>a.updateComplete??Promise.resolve())),e||this.clearFlyoutOverlayRecovery(),t}clearFlyoutOverlayRecovery(){this.flyoutOverlayPromotionWidth=null,this.flyoutOverlayRecoveryReady=!1,this.flyoutOverlayRecoveryGeneration+=1}armFlyoutOverlayRecovery(){const e=++this.flyoutOverlayRecoveryGeneration;this.flyoutOverlayRecoveryReady=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e!==this.flyoutOverlayRecoveryGeneration||!this.openAutoFlyouts().some(t=>t.pageOverlayRequested===!0)||(this.flyoutOverlayPromotionWidth=this.visiblePageInlineBounds().width,this.flyoutOverlayRecoveryReady=!0)})})}previewHasContent(){const e=this.previewSlot.value?.assignedNodes({flatten:!0});return e?e.some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent?.trim().length??0)>0):Array.from(this.childNodes).some(t=>t instanceof Element&&t.getAttribute("slot")==="preview"&&!t.hasAttribute("hidden"))}getPreviewNavigationPair(){if(!this.previewCollapseSidebar)return null;const e=Array.from(this.children),t=e.find(o=>o.slot==="header"&&o.tagName==="ESP-HEADER"),i=e.find(o=>o.slot==="sidebar"&&o.tagName==="ESP-MENU");if(!t||!i||!i.id)return null;const a=typeof t.drawerTarget=="string"?t.drawerTarget:t.getAttribute("drawer-target")??"",s=typeof i.mode=="string"?i.mode:i.getAttribute("mode");return a!==i.id||s!=="vertical"||!("previewCollapseRequested"in t)||!("previewCollapseRequested"in i)?null:{header:t,menu:i}}async setPreviewNavigationCollapse(e){const t=e?this.getPreviewNavigationPair():null,i=t!==null&&this.previewHeader===t.header&&this.previewMenu===t.menu,a=this.previewHeader&&this.previewHeader!==t?.header?this.previewHeader:null,s=this.previewMenu&&this.previewMenu!==t?.menu?this.previewMenu:null;if(a&&(a.previewCollapseRequested=!1),s&&(s.previewCollapseRequested=!1),this.previewHeader=t?.header??null,this.previewMenu=t?.menu??null,this.toggleAttribute("data-preview-navigation-collapsed",!1),await a?.updateComplete,await s?.updateComplete,!t)return!1;const o=i?this.previewCollapsedSidebarWidth:this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0;return t.header.previewCollapseRequested=!0,t.menu.previewCollapseRequested=!0,await t.header.updateComplete,await t.menu.updateComplete,t.menu.hasExternalDrawerControl===!0?(this.previewCollapsedSidebarWidth=o,this.toggleAttribute("data-preview-navigation-collapsed",!0),!0):(t.header.previewCollapseRequested=!1,t.menu.previewCollapseRequested=!1,await t.header.updateComplete,await t.menu.updateComplete,this.previewHeader=null,this.previewMenu=null,!1)}requestPreviewNavigationCollapse(){if(this.hasAttribute("data-preview-navigation-collapsed")||this.previewNavigationCollapseTask)return;const e=this.setPreviewNavigationCollapse(!0);this.previewNavigationCollapseTask=e,e.then(()=>{this.previewNavigationCollapseTask===e&&(this.previewNavigationCollapseTask=null)},()=>{this.previewNavigationCollapseTask===e&&(this.previewNavigationCollapseTask=null)})}scheduleWorkspaceSettlement(e=null){const t=()=>{this.schedulePreviewLayout(),e&&requestAnimationFrame(()=>{this.previewSyncTask.then(()=>{const s=this.shadowRoot?.activeElement,o=this.ownerDocument.activeElement;!this.isConnected||!e.isConnected||s&&s!==e||o!==this&&o!==this.ownerDocument.body||getComputedStyle(e).display!=="none"&&e.focus({preventScroll:!0})})})},i=this.previewNavigationCollapseTask;if(!i){t();return}i.then(()=>t(),()=>t())}clearWorkspaceKeyboardSettlementTimer(){this.workspaceKeyboardSettlementTimer!==null&&(clearTimeout(this.workspaceKeyboardSettlementTimer),this.workspaceKeyboardSettlementTimer=null)}finishWorkspaceKeyboardResize(e=!0){this.clearWorkspaceKeyboardSettlementTimer();const t=this.hasAttribute("data-workspace-keyboard-adjusting");this.toggleAttribute("data-workspace-keyboard-adjusting",!1),t&&e&&!this.resizeSession&&this.scheduleWorkspaceSettlement()}deferWorkspaceKeyboardSettlement(){this.clearWorkspaceKeyboardSettlementTimer(),this.workspaceKeyboardSettlementTimer=setTimeout(()=>{if(this.workspaceKeyboardSettlementTimer=null,!this.hasAttribute("data-workspace-keyboard-adjusting"))return;const e=this.shadowRoot?.activeElement,t=e instanceof HTMLElement&&e.classList.contains("esp-page-workspace-resize-handle")?e:null;this.toggleAttribute("data-workspace-keyboard-adjusting",!1),this.resizeSession||this.scheduleWorkspaceSettlement(t)},ge)}suspendPreviewLayoutForWorkspaceResize(){this.previewSyncRaf!==null&&(cancelAnimationFrame(this.previewSyncRaf),this.previewSyncRaf=null),this.previewSyncGeneration+=1,this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1)}setPreviewLayoutState(e,t){this.previewVisible=e,this.previewReclaiming=e&&t,e||this.endWorkspaceResize()}setWorkspaceWidths(e,t,i=!1){const a=Math.max(0,e),s=Math.max(0,t);this.style.setProperty("--_esp-page-preview-used-width",`${a}px`),this.style.setProperty("--_esp-page-flyout-used-width",`${s}px`),this.toggleAttribute("data-workspace-targeted",i),this.allocatedPreviewWidth=a,this.allocatedFlyoutWidth=s}clampWidth(e,t,i){return Math.min(Math.max(e,t),Math.max(t,i))}visiblePageInlineBounds(){const e=this.getBoundingClientRect();let t=e.left,i=e.right;const a=window.visualViewport,s=a?.offsetLeft??0,o=a?.width??document.documentElement.clientWidth;o>0&&(t=Math.max(t,s),i=Math.min(i,s+o));const r=this.getRootNode();let n=this.parentElement??(r instanceof ShadowRoot?r.host:null);for(;n;){const d=getComputedStyle(n).overflowX;if(["auto","clip","hidden","scroll"].includes(d)){const p=n.getBoundingClientRect();t=Math.max(t,p.left),i=Math.min(i,p.right)}const m=n.getRootNode();n=n.parentElement??(m instanceof ShadowRoot?m.host:null)}return{left:t,right:i,width:Math.max(0,i-t)}}probeWidth(e){return e.value?.getBoundingClientRect().width??0}optionalWidth(e,t){return getComputedStyle(this).getPropertyValue(e).trim()===""?null:this.probeWidth(t)}syncMainMaximumConfiguration(){const e=getComputedStyle(this).getPropertyValue("--esp-page-main-max-width").trim()!=="";this.toggleAttribute("data-main-max-configured",e)}workspaceWidthCapacity(e,t,i=0){const a=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,s=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,o=Math.max(0,this.visiblePageInlineBounds().width-a-s-Math.max(0,i));return this.workspaceWidthCapacityForAvailable(o,e,t)}workspaceWidthCapacityForAvailable(e,t,i){const a=Math.max(0,e),s=i>0?Math.min(a,i):a;return{natural:Math.max(0,a-s),maximum:Math.max(0,a-Math.max(0,t))}}workspaceTargetWidth(e,t,i){return Math.min(e.maximum,Math.max(t,i,e.natural))}allocateWorkspaceWidths(e,t,i,a,s,o,r,n=null,d=null){const m=Math.max(0,e),p=Math.max(0,a),u=Math.max(p,s),y=Math.max(0,o),W=Math.max(y,r),v=t?this.preferredPreviewWidth??(n===null?null:this.clampWidth(n,p,u)):null,w=i?this.preferredFlyoutWidth??(d===null?null:this.clampWidth(d,y,W)):null;let c=0,l=0;t&&i?(c=Math.min(u,Math.max(p,m-y)),l=Math.min(W,Math.max(y,m-c))):t?c=Math.min(u,Math.max(p,m)):i&&(l=Math.min(W,Math.max(y,m))),t&&v!==null&&(c=this.clampWidth(v,p,u),i&&w===null&&(l=this.clampWidth(m-c,y,W))),i&&w!==null&&(l=this.clampWidth(w,y,W),t&&v===null&&(c=this.clampWidth(m-l,p,u)));let b=c+l-m;if(b>0&&i){const R=Math.min(b,Math.max(0,l-y));l-=R,b-=R}return b>0&&t&&(c-=Math.min(b,Math.max(0,c-p))),{previewWidth:c,flyoutWidth:l}}workspaceResizeDirection(){return getComputedStyle(this).direction==="rtl"?-1:1}trailingWorkspaceSeparator(){return this.hasAttribute("flyout-open")&&!this.hasAttribute("flyout-overlay-open")?"flyout-end":this.previewVisible?"preview-end":null}trailingWorkspacePane(){const e=this.trailingWorkspaceSeparator()==="flyout-end"?".esp-page-flyout":this.trailingWorkspaceSeparator()==="preview-end"?".esp-page-preview":null;return e?this.shadowRoot?.querySelector(e)??null:null}workspaceLogicalGutterWidths(){const e=Math.max(0,this.shadowRoot?.querySelector(".esp-page-canvas--left")?.getBoundingClientRect().width??0),t=this.trailingWorkspacePane();if(!t)return{leading:e,trailing:0};const i=this.visiblePageInlineBounds(),a=t.getBoundingClientRect(),s=this.workspaceResizeDirection()===1?i.right-a.right:a.left-i.left;return{leading:e,trailing:Math.max(0,s)}}syncTrailingWorkspaceResizeAvailability(){const{trailing:e}=this.workspaceLogicalGutterWidths();this.toggleAttribute("data-workspace-trailing-edge-exposed",this.trailingWorkspaceSeparator()!==null&&e>h)}trailingPaneResizeRange(e,t,i){const a=e==="preview-end"?this.previewMinWidthProbe:this.flyoutMinWidthProbe,s=e==="preview-end"?this.previewMaxWidthProbe:this.flyoutMaxWidthProbe,o=Math.max(0,this.probeWidth(a)),r=Math.max(o,this.probeWidth(s));return{minimum:o,maximum:Math.max(o,Math.min(r,Math.max(0,t)+Math.max(0,i)))}}resizeStep(e){const t=this.probeWidth(e?this.resizeLargeStepProbe:this.resizeStepProbe);return t>0?t:e?ue:ce}previewNavigationResizeAllowance(){if(this.hasAttribute("data-preview-navigation-collapsed")||this.getPreviewNavigationPair()===null)return 0;const e=Math.max(0,this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0);return e>h&&(this.previewCollapsedSidebarWidth=e),e>h?e:this.previewCollapsedSidebarWidth}renderedWorkspaceWidths(){const e=this.shadowRoot?.querySelector(".esp-page-preview"),t=this.shadowRoot?.querySelector(".esp-page-flyout");return{previewWidth:this.allocatedPreviewWidth>0?this.allocatedPreviewWidth:e?.getBoundingClientRect().width??0,flyoutWidth:this.allocatedFlyoutWidth>0?this.allocatedFlyoutWidth:t?.getBoundingClientRect().width??0}}mainPreviewResizeRange(e=this.renderedWorkspaceWidths().previewWidth,t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,i=this.previewNavigationResizeAllowance()){const a=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),s=Math.max(a,this.probeWidth(this.previewMaxWidthProbe)),o=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),r=Math.max(0,t+e),n=Math.max(0,r+i-o);return{minimum:a,maximum:Math.max(a,Math.min(s,n))}}previewFlyoutResizeRange(e=this.renderedWorkspaceWidths().previewWidth,t=this.renderedWorkspaceWidths().flyoutWidth){const i=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),a=Math.max(i,this.probeWidth(this.previewMaxWidthProbe)),s=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),o=Math.max(s,this.probeWidth(this.flyoutMaxWidthProbe)),r=e+t;return{minimum:Math.max(i,r-o),maximum:Math.max(i,Math.min(a,r-s))}}separatorIsAvailable(e){return!this.workspaceResizable||this.hasAttribute("flyout-overlay-open")?!1:e==="main-preview"?this.previewVisible:e==="preview-end"||e==="flyout-end"?this.trailingWorkspaceSeparator()===e&&(this.hasAttribute("data-workspace-trailing-edge-exposed")||this.hasAttribute("data-workspace-position-held")||this.hasAttribute("data-workspace-keyboard-adjusting")):this.hasAttribute("flyout-open")}flyoutOnlyResizeRange(e=this.renderedWorkspaceWidths().flyoutWidth,t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0){const i=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),a=Math.max(i,this.probeWidth(this.flyoutMaxWidthProbe)),s=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),o=this.probeWidth(this.mainMaxWidthProbe),r=Math.max(0,t+e),n=o>0?Math.max(0,r-o):0,d=Math.max(i,n);return{minimum:d,maximum:Math.max(d,Math.min(a,r-s))}}mainResizeGrowthCapacity(e){return this.kind==="full"&&!this.hasAttribute("data-main-max-configured")?Number.POSITIVE_INFINITY:Math.max(0,this.probeWidth(this.mainMaxWidthProbe)-e)}applyWorkspaceResize(e,t,i,a,s,o,r,n,d,m){if(!this.separatorIsAvailable(e))return;const p=t*m,u=n/d,y=e==="main-preview"||e==="preview-flyout"&&!this.previewVisible,W=i==="pointer"&&y&&p>0?Math.min(p,u,this.mainResizeGrowthCapacity(o)):0;let v=e,w=a,c=s;if(e==="preview-end"||e==="flyout-end"){const l=e==="preview-end"?a:s,b=this.trailingPaneResizeRange(e,l,n),R=l+(p>0?p*d:p),C=this.clampWidth(R,b.minimum,b.maximum);e==="preview-end"?(w=C,this.preferredPreviewWidth=C):(c=C,this.preferredFlyoutWidth=C)}else if(e==="main-preview"){const l=this.mainPreviewResizeRange(a,o,r),b=a-(p-W);w=this.clampWidth(b,l.minimum,l.maximum),this.preferredPreviewWidth=w;const R=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),C=this.probeWidth(this.mainMaxWidthProbe),k=this.kind==="full"&&!this.hasAttribute("data-main-max-configured")?0:C,g=this.workspaceWidthCapacity(R,k);r>0&&w+c>g.natural+h&&this.requestPreviewNavigationCollapse();const F=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),A=Math.max(0,F-b),E=l.minimum<=F+h;if(A>0&&E&&s>0){const O=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),L=Math.max(O,this.probeWidth(this.flyoutMaxWidthProbe));c=this.clampWidth(s-A,O,L),this.preferredFlyoutWidth=c}else s>0&&(this.preferredFlyoutWidth??=s)}else if(this.previewVisible){const l=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),b=Math.max(l,this.probeWidth(this.previewMaxWidthProbe)),R=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),C=Math.max(R,this.probeWidth(this.flyoutMaxWidthProbe));if(p>=0){const k=Math.max(0,s-R),g=Math.min(p,u),F=Math.max(0,p-g),A=g*d+F,E=k+n;w=this.clampWidth(a+A,l,Math.min(b,a+E));const O=Math.max(0,w-a),L=Math.min(O,n);c=s-Math.min(Math.max(0,O-L),k)}else{const k=this.previewFlyoutResizeRange(a,s),g=a+p;w=this.clampWidth(g,k.minimum,k.maximum),c=a+s-w;const F=Math.max(0,l-g),A=k.minimum<=l+h;if(F>0&&A){const E=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),O=Math.max(0,o-E);c=this.clampWidth(c+Math.min(F,O),R,C)}}this.preferredPreviewWidth=w,this.preferredFlyoutWidth=c}else{v="main-flyout";const l=this.flyoutOnlyResizeRange(s,o);c=this.clampWidth(s-(p-W),l.minimum,l.maximum),w=0,this.preferredFlyoutWidth=c}this.setWorkspaceWidths(w,c,!0),this.requestUpdate(),this.previewVisible&&this.setPreviewLayoutState(!0,!0),i==="keyboard"&&(this.toggleAttribute("data-workspace-keyboard-adjusting",!0),this.deferWorkspaceKeyboardSettlement()),this.dispatchEvent(new CustomEvent("esp-page-workspace-resize",{bubbles:!0,composed:!0,detail:{separator:v,source:i,previewWidth:w,flyoutWidth:c}}))}appliedSeparatorInlineDelta(e){if(e.separator==="preview-end"){const a=this.allocatedPreviewWidth-e.startPreviewWidth;return a>0?a/e.trailingExpansionScale:a}if(e.separator==="flyout-end"){const a=this.allocatedFlyoutWidth-e.startFlyoutWidth;return a>0?a/e.trailingExpansionScale:a}if(e.separator==="main-preview")return e.trailingGroupPushDelta+e.startPreviewWidth-this.allocatedPreviewWidth+(e.startFlyoutWidth-this.allocatedFlyoutWidth);const t=e.startFlyoutWidth-this.allocatedFlyoutWidth;if(!this.previewVisible)return e.trailingGroupPushDelta+t;if(this.allocatedPreviewWidth<e.startPreviewWidth)return t;const i=Math.max(0,this.allocatedPreviewWidth+this.allocatedFlyoutWidth-e.startPreviewWidth-e.startFlyoutWidth);return t+i/e.trailingExpansionScale}clearWorkspaceRecenteringState(){this.workspaceRecenteringRaf!==null&&(cancelAnimationFrame(this.workspaceRecenteringRaf),this.workspaceRecenteringRaf=null),this.workspaceRecenteringTimer!==null&&(clearTimeout(this.workspaceRecenteringTimer),this.workspaceRecenteringTimer=null),this.toggleAttribute("data-workspace-position-held",!1),this.style.removeProperty("--_esp-page-resize-leading-gutter-width")}holdWorkspacePosition(){const e=this.workspaceLogicalGutterWidths().leading;return this.clearWorkspaceRecenteringState(),this.style.setProperty("--_esp-page-resize-leading-gutter-width",`${e}px`),this.toggleAttribute("data-workspace-position-held",!0),e}trackWorkspaceResizePointer(e){const t=e.startHandleClientX+this.appliedSeparatorInlineDelta(e)*e.direction;for(let i=0;i<3;i+=1){const a=e.target.getBoundingClientRect(),s=a.left+a.width/2,o=(t-s)*e.direction;if(Math.abs(o)<=.25)return;const r=Math.max(0,e.heldLeadingGutterWidth+o);if(Math.abs(r-e.heldLeadingGutterWidth)<=.25)return;e.heldLeadingGutterWidth=r,this.style.setProperty("--_esp-page-resize-leading-gutter-width",`${e.heldLeadingGutterWidth}px`)}}seedWorkspaceResizeLeadingGutter(e){if(this.align==="start")return!1;const t=this.appliedSeparatorInlineDelta(e);if(t<=0)return!1;let i=0;if(e.separator==="preview-end"||e.separator==="flyout-end")i=this.allocatedPreviewWidth-e.startPreviewWidth+this.allocatedFlyoutWidth-e.startFlyoutWidth;else if(e.separator==="preview-flyout"&&this.previewVisible)i=this.allocatedPreviewWidth-e.startPreviewWidth;else{const a=Math.max(0,e.startPreviewWidth-this.allocatedPreviewWidth+e.startFlyoutWidth-this.allocatedFlyoutWidth),s=this.probeWidth(this.mainMaxWidthProbe),o=this.kind==="full"&&!this.hasAttribute("data-main-max-configured")?Number.POSITIVE_INFINITY:Math.max(0,s-e.startMainWidth);i=Math.min(e.trailingGroupPushDelta+a,o)}return e.heldLeadingGutterWidth=Math.max(0,e.startLeadingGutterWidth+t-i),this.style.setProperty("--_esp-page-resize-leading-gutter-width",`${e.heldLeadingGutterWidth}px`),!0}finishWorkspaceRecentering(){this.clearWorkspaceRecenteringState(),this.syncTrailingWorkspaceResizeAvailability(),this.isConnected&&this.scheduleWorkspaceSettlement()}beginWorkspaceRecentering(){const e=this.workspaceLogicalGutterWidths(),t=e.leading+e.trailing,i=this.align==="center"?t/2:this.align==="end"?t:0;if(Math.abs(i-e.leading)<=h){this.finishWorkspaceRecentering();return}this.workspaceRecenteringRaf=requestAnimationFrame(()=>{this.workspaceRecenteringRaf=null,!(this.resizeSession||!this.hasAttribute("data-workspace-position-held"))&&(this.style.setProperty("--_esp-page-resize-leading-gutter-width",`${i}px`),this.workspaceRecenteringTimer=setTimeout(()=>this.finishWorkspaceRecentering(),me+ve))})}endWorkspaceResize(){const e=this.resizeSession;this.resizeSession=null,this.toggleAttribute("data-workspace-resizing",!1),e?.target.hasPointerCapture?.(e.pointerId)&&e.target.releasePointerCapture(e.pointerId),e&&this.beginWorkspaceRecentering()}previewFitsWithinPage(e,t,i,a,s,o){const r=this.shadowRoot?.querySelector(".esp-page-main"),n=this.shadowRoot?.querySelector(".esp-page-preview"),d=this.shadowRoot?.querySelector(".esp-page-flyout");if(!r||!n||!d)return!1;const m=this.visiblePageInlineBounds(),p=r.getBoundingClientRect(),u=n.getBoundingClientRect(),y=d.getBoundingClientRect(),W=Math.max(t,i),v=Math.max(s,o),w=u.width+h>=t&&u.width<=W+h,c=!a||y.width+h>=s&&y.width<=v+h,l=u.left+h>=m.left&&u.right<=m.right+h&&(!a||y.left+h>=m.left&&y.right<=m.right+h),b=getComputedStyle(this).direction==="rtl"?p.left+h>=u.right&&(!a||u.left+h>=y.right):p.right<=u.left+h&&(!a||u.right<=y.left+h);return p.width+h>=e&&w&&c&&l&&b}flyoutFitsWithinPage(e,t,i){const a=this.shadowRoot?.querySelector(".esp-page-main"),s=this.shadowRoot?.querySelector(".esp-page-flyout");if(!a||!s)return!1;const o=this.visiblePageInlineBounds(),r=a.getBoundingClientRect(),n=s.getBoundingClientRect(),d=Math.max(t,i),m=n.width+h>=t&&n.width<=d+h,p=n.left+h>=o.left&&n.right<=o.right+h,u=getComputedStyle(this).direction==="rtl"?r.left+h>=n.right:r.right<=n.left+h;return r.width+h>=e&&m&&p&&u}workspaceMinimumsCanFit(e,t,i,a,s){const o=this.visiblePageInlineBounds().width;if(o<=0||e<=0||t&&i<=0||a&&s<=0)return!1;const r=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,n=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,m=(t&&this.getPreviewNavigationPair()!==null?0:r)+n+e+(t?i:0)+(a?s:0);return o+h>=m}workspaceGeometrySample(){const e=this.visiblePageInlineBounds(),t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect(),i=this.shadowRoot?.querySelector(".esp-page-preview")?.getBoundingClientRect(),a=this.shadowRoot?.querySelector(".esp-page-flyout")?.getBoundingClientRect();return[e.left,e.right,e.width,t?.left??0,t?.right??0,t?.width??0,i?.left??0,i?.right??0,i?.width??0,a?.left??0,a?.right??0,a?.width??0]}workspaceGeometryMatches(e,t){return e.length===t.length&&e.every((i,a)=>Math.abs(i-(t[a]??i))<=h)}workspaceCandidateIsMeasurable(e,t){const i=this.shadowRoot?.querySelector(".esp-page-preview")?.getBoundingClientRect().width??0,a=this.shadowRoot?.querySelector(".esp-page-flyout")?.getBoundingClientRect().width??0;return(!e||i>h)&&(!t||a>h)}async candidateFitsAfterLayoutSettles(e,t,i){if(await this.updateComplete,e!==this.previewSyncGeneration||!this.isConnected)return null;let a=null,s=0;for(let o=0;o<he;o+=1){if(await new Promise(n=>requestAnimationFrame(()=>n())),e!==this.previewSyncGeneration||!this.isConnected)return null;if(t())return!0;if(!i()){a=null,s=0;continue}const r=this.workspaceGeometrySample();if(s=a&&this.workspaceGeometryMatches(a,r)?s+1:1,s>=le)return!1;a=r}return null}async promoteFlyoutIfClipped(e,t,i,a){if(i<=0)return!1;const s=await this.candidateFitsAfterLayoutSettles(e,()=>this.flyoutFitsWithinPage(t,i,a),()=>this.workspaceCandidateIsMeasurable(!1,!0));return s===null?!0:s?!1:(await this.promoteFlyoutToOverlay(),!0)}async promoteFlyoutToOverlay(){this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),this.flyoutOverlayPromotionWidth===null&&(this.flyoutOverlayPromotionWidth=this.visiblePageInlineBounds().width,this.armFlyoutOverlayRecovery()),await this.setPageFlyoutOverlay(!0)}async syncPreviewLayout(e,t=!0){if(e!==this.previewSyncGeneration||!this.isConnected||this.resizeSession||this.hasAttribute("data-workspace-keyboard-adjusting")||this.hasAttribute("data-workspace-position-held"))return;let i=!1;const a=this.previewVisible;this.toggleAttribute("data-preview-measuring",!0);try{const s=this.previewOpen&&this.previewHasContent(),o=this.previewMediaQuery?.matches??!1,r=this.hasAttribute("flyout-overlay-open"),n=this.hasAttribute("flyout-open"),d=this.hasAttribute("data-preview-navigation-collapsed"),m=this.getPreviewNavigationPair(),p=m===null?0:d?this.previewCollapsedSidebarWidth:this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,u=this.probeWidth(this.previewMinWidthProbe),y=this.optionalWidth("--esp-page-preview-default-width",this.previewDefaultWidthProbe),W=this.probeWidth(this.previewMaxWidthProbe),v=this.probeWidth(this.flyoutMinWidthProbe),w=this.optionalWidth("--esp-page-flyout-default-width",this.flyoutDefaultWidthProbe),c=this.probeWidth(this.flyoutMaxWidthProbe),l=this.probeWidth(this.mainMinWidthProbe);this.syncMainMaximumConfiguration();const b=this.probeWidth(this.mainMaxWidthProbe),R=this.kind==="full"&&!this.hasAttribute("data-main-max-configured")?0:b,C=this.openAutoFlyouts().some(S=>S.pageOverlayRequested===!0);if(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),C){const S=this.visiblePageInlineBounds().width,T=this.flyoutOverlayPromotionWidth===null||S>=this.flyoutOverlayPromotionWidth+pe;!o&&t&&this.flyoutOverlayRecoveryReady&&T&&this.workspaceMinimumsCanFit(l,s,u,!0,v)?await this.setPageFlyoutOverlay(!1):o&&await this.setPageFlyoutOverlay(!1);return}if(await this.updateComplete,e!==this.previewSyncGeneration)return;const k=s&&!o&&!r,g=n&&!o;if(l>0&&(!k||u>0)&&(!g||v>0)&&(k||g)&&!this.workspaceMinimumsCanFit(l,k,u,g,v)){g&&await this.promoteFlyoutToOverlay();return}const A=(k?u:0)+(g?v:0),L=k&&this.preferredPreviewWidth!==null||g&&this.preferredFlyoutWidth!==null||(k&&y!==null||g&&w!==null),H=(k?this.preferredPreviewWidth===null?u:this.clampWidth(this.preferredPreviewWidth,u,W):0)+(g?this.preferredFlyoutWidth===null?v:this.clampWidth(this.preferredFlyoutWidth,v,c):0),f=S=>{const T=this.workspaceTargetWidth(S,A,H),B=this.allocateWorkspaceWidths(T,k,g,u,W,v,c,y,w),V=S.maximum+l,X=Math.max(0,V-S.natural),te=B.previewWidth+B.flyoutWidth,Q=Math.max(0,Math.min(X,V-te));return{allocation:B,mainWidth:Q,reclaimsMain:Q+h<X}},D=(S,T)=>Math.abs(S.mainWidth-T.mainWidth)>h||Math.abs(S.allocation.previewWidth-T.allocation.previewWidth)>h||Math.abs(S.allocation.flyoutWidth-T.allocation.flyoutWidth)>h,N=this.workspaceWidthCapacity(l,R,d?p:0),I=f(N);let $=I.allocation;if(this.setWorkspaceWidths($.previewWidth,$.flyoutWidth,L),!k||u<=0){g&&await this.promoteFlyoutIfClipped(e,l,v,c);return}if(m!==null&&p>h){const S=N.maximum+l,T=this.workspaceWidthCapacityForAvailable(S+p,l,R),B=f(T);(d?D(f(this.workspaceWidthCapacityForAvailable(Math.max(0,S-de),l,R)),B):I.reclaimsMain&&D(I,B))?i=await this.setPreviewNavigationCollapse(!0):await this.setPreviewNavigationCollapse(!1)}else await this.setPreviewNavigationCollapse(!1);if(e!==this.previewSyncGeneration)return;const j=this.workspaceWidthCapacity(l,R);if(j.maximum+h<A){this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,g?v:0),i=!1,g&&await this.promoteFlyoutToOverlay();return}const U=f(j);if($=U.allocation,this.setWorkspaceWidths($.previewWidth,$.flyoutWidth,L),a||this.toggleAttribute("data-preview-validating",!0),this.setPreviewLayoutState(!0,U.reclaimsMain),await this.updateComplete,e!==this.previewSyncGeneration)return;const Y=await this.candidateFitsAfterLayoutSettles(e,()=>this.previewFitsWithinPage(l,u,W,g,v,c),()=>this.workspaceCandidateIsMeasurable(!0,g));if(Y===null)return;Y?this.toggleAttribute("data-preview-validating",!1):(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,g?v:0),i=!1,g&&await this.promoteFlyoutToOverlay())}finally{e===this.previewSyncGeneration&&!i&&await this.setPreviewNavigationCollapse(!1),e===this.previewSyncGeneration&&(this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1),this.syncTrailingWorkspaceResizeAvailability(),this.requestUpdate())}}setupPreviewLayoutObserver(){if(this.isConnected){if(!this.previewMediaQuery&&typeof window.matchMedia=="function"&&(this.previewMediaQuery=window.matchMedia(ne),this.previewMediaQuery.addEventListener("change",this.onPreviewMediaChange)),!this.previewResizeObserver&&typeof ResizeObserver<"u"){this.previewResizeObserver=new ResizeObserver(this.onPreviewResize),this.previewResizeObserver.observe(this);const e=this.shadowRoot?.querySelector(".esp-page-left");e&&this.previewResizeObserver.observe(e);for(const t of[this.previewMinWidthProbe,this.previewDefaultWidthProbe,this.previewMaxWidthProbe,this.flyoutMinWidthProbe,this.flyoutDefaultWidthProbe,this.flyoutMaxWidthProbe,this.mainMinWidthProbe,this.mainConfiguredMaxWidthProbe,this.mainMaxWidthProbe,this.resizeStepProbe,this.resizeLargeStepProbe])t.value&&this.previewResizeObserver.observe(t.value)}this.schedulePreviewLayout(!0)}}footerElementProvidesLandmark(e){return e.matches(ee)||e.querySelector(ee)!==null}syncFooterLandmark(){const t=(this.footerSlot.value?.assignedElements({flatten:!0})??[]).some(i=>this.footerElementProvidesLandmark(i));this.footerWrapperIsLandmark=!t}showPreview(){this.previewOpen=!0}closePreview(){this.previewOpen=!1}togglePreview(){this.previewOpen=!this.previewOpen}AddDialog(e){this.dialogZone.value?.appendChild(e)}firstUpdated(e){super.firstUpdated(e),this.syncFlyoutState(),this.setupPreviewLayoutObserver()}updated(e){super.updated(e),(e.has("fixedMenus")||e.has("headerPosition"))&&oe().publish("fixed-menus-changed",{fixed:this.fixedMenus||this.headerPosition==="fixed"}),(e.has("previewOpen")||e.has("previewCollapseSidebar")||e.has("align"))&&this.schedulePreviewLayout(!0),e.has("workspaceResizable")&&!this.workspaceResizable&&(this.finishWorkspaceKeyboardResize(),this.endWorkspaceResize(),this.clearWorkspaceRecenteringState())}render(){const e=this.fixedMenus||this.headerPosition==="fixed",t=!e&&this.headerPosition==="sticky",i=this.mainPreviewResizeRange(),a=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),s=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),o=Math.max(s,this.probeWidth(this.flyoutMaxWidthProbe)),r=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),n=this.probeWidth(this.mainMaxWidthProbe),d=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,m=this.hasAttribute("flyout-open"),p=d+this.allocatedPreviewWidth,u=i.minimum<=a+h,y=m&&u?Math.max(0,this.allocatedFlyoutWidth-s):0,W=Math.max(r,p-i.maximum),v=Math.max(W,Math.max(r,p-i.minimum)+y),w=n>0?Math.max(W,Math.min(Math.max(r,n),v)):v,c=n>0&&d+h>=n?`${Math.round(d)}px main, ${Math.round(this.allocatedPreviewWidth)}px preview`:Z;let l,b;if(this.previewVisible){const f=this.previewFlyoutResizeRange(),D=this.allocatedPreviewWidth+this.allocatedFlyoutWidth,I=f.minimum<=a+h?Math.max(0,d-r):0;l=Math.max(s,D-f.maximum),b=Math.max(l,Math.min(o,D-f.minimum+I))}else{const f=this.flyoutOnlyResizeRange();l=f.minimum,b=f.maximum}const R=this.previewVisible?"preview-flyout-resize-handle":"main-flyout-resize-handle",C=this.previewVisible?"Resize preview and help panes":"Resize help pane",k=this.previewVisible?`${Math.round(this.allocatedPreviewWidth)}px preview, ${Math.round(this.allocatedFlyoutWidth)}px help`:`${Math.round(this.allocatedFlyoutWidth)}px help`,g=m?"flyout-end":"preview-end",F=g==="flyout-end"?this.allocatedFlyoutWidth:this.allocatedPreviewWidth,A=this.workspaceLogicalGutterWidths(),E=this.trailingPaneResizeRange(g,F,A.leading+A.trailing),O=g==="flyout-end"?"flyout-end-resize-handle":"preview-end-resize-handle",L=g==="flyout-end"?"Resize help pane from its outer edge":"Resize preview pane from its outer edge";return ae`
|
|
2
|
-
<div part="wrapper" class="esp-page ${
|
|
1
|
+
var M=function(q,e,t,i){var a=arguments.length,s=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(q,e,t,i);else for(var r=q.length-1;r>=0;r--)(o=q[r])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s};import{css as re,html as oe,nothing as ee}from"lit";import{customElement as ne,property as _,state as H}from"lit/decorators.js";import{classMap as le}from"lit/directives/class-map.js";import{createRef as R,ref as z}from"lit/directives/ref.js";import{EspalierElementBase as te}from"../shared/esp-element-base.js";import{BiDirectionalStickyController as N}from"./bi-directional-sticky-controller.js";import{getEspBus as pe}from"../shared/bus-events.js";import{RafThrottle as ie}from"../shared/raf-throttle.js";import{InlineBounds as he,PaneProbes as j,probeWidth as de,WidthRange as G}from"./workspace-width.js";import{slotHasContent as ce}from"../shared/slot-content.js";import"../toaster/esp-toaster.js";const ae='esp-footer, footer, [role~="contentinfo"]',ue="(max-width: 50em)",l=1,ge=5,me=12,ve=48,we=48,fe=16,ye=64,be=250,ke=250,We=40;let x=class extends te{constructor(){super(),this.dialogZone=R(),this.flyoutSlot=R(),this.footerSlot=R(),this.previewSlot=R(),this.previewSpace=R(),this.previewMinWidthProbe=R(),this.previewDefaultWidthProbe=R(),this.previewMaxWidthProbe=R(),this.previewProbes=new j(this.previewMinWidthProbe,this.previewDefaultWidthProbe,this.previewMaxWidthProbe),this.flyoutMinWidthProbe=R(),this.flyoutDefaultWidthProbe=R(),this.flyoutMaxWidthProbe=R(),this.flyoutProbes=new j(this.flyoutMinWidthProbe,this.flyoutDefaultWidthProbe,this.flyoutMaxWidthProbe),this.mainMinWidthProbe=R(),this.mainConfiguredMaxWidthProbe=R(),this.mainMaxWidthProbe=R(),this.mainProbes=new j(this.mainMinWidthProbe,this.mainMaxWidthProbe,this.mainMaxWidthProbe),this.resizeStepProbe=R(),this.resizeLargeStepProbe=R(),this.previewObservedWidths=new WeakMap,this.previewSyncFrame=new ie(()=>this.runScheduledPreviewLayout()),this.previewSyncGeneration=0,this.previewSyncTask=Promise.resolve(),this.previewOverlayRecoveryRequested=!1,this.previewHeader=null,this.previewMenu=null,this.previewCollapsedSidebarWidth=0,this.previewNavigationCollapseTask=null,this.flyoutOverlayPromotionWidth=null,this.flyoutOverlayRecoveryReady=!1,this.flyoutOverlayRecoveryGeneration=0,this.preferredPreviewWidth=null,this.preferredFlyoutWidth=null,this.flyoutFullHeightActive=!1,this.resizeSession=null,this.workspaceKeyboardSettlementTimer=null,this.workspaceRecenteringFrame=new ie(()=>this.applyWorkspaceRecentering()),this.pendingRecenterLeading=0,this.workspaceRecenteringTimer=null,this.footerWrapperIsLandmark=!0,this.allocatedPreviewWidth=0,this.allocatedFlyoutWidth=0,this.onWorkspaceResizePointerDown=(e,t)=>{if(t.button!==0||!this.separatorIsAvailable(e))return;const i=t.currentTarget,a=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,s=this.renderedWorkspaceWidths();this.endWorkspaceResize(),this.finishWorkspaceKeyboardResize(!1),this.suspendPreviewLayoutForWorkspaceResize();const o=i.getBoundingClientRect(),r=this.holdWorkspacePosition();this.toggleAttribute("data-workspace-resizing",!0);const{leading:n,trailing:d}=this.workspaceLogicalGutterWidths(),m=d>l?n+d:0,h=d>l?Math.max(1,m/d):1;this.resizeSession={separator:e,pointerId:t.pointerId,target:i,startClientX:t.clientX,startPreviewWidth:s.previewWidth,startFlyoutWidth:s.flyoutWidth,startMainWidth:a,startNavigationAllowance:this.previewNavigationResizeAllowance(),startOuterGrowthCapacity:m,trailingExpansionScale:h,trailingGroupPushDelta:0,startHandleClientX:o.left+o.width/2,startLeadingGutterWidth:r,heldLeadingGutterWidth:r,direction:this.workspaceResizeDirection()};try{i.setPointerCapture?.(t.pointerId)}catch{}t.preventDefault()},this.onWorkspaceResizePointerMove=e=>{const t=this.resizeSession;if(!t||t.pointerId!==e.pointerId)return;e.preventDefault();const i=e.clientX-t.startClientX,a=i*t.direction,s=t.separator==="main-preview"||t.separator==="preview-flyout"&&!this.previewVisible;t.trailingGroupPushDelta=s&&a>0?Math.min(a,t.startOuterGrowthCapacity/t.trailingExpansionScale,this.mainResizeGrowthCapacity(t.startMainWidth)):0,this.applyWorkspaceResize(t.separator,i,"pointer",t.startPreviewWidth,t.startFlyoutWidth,t.startMainWidth,t.startNavigationAllowance,t.startOuterGrowthCapacity,t.trailingExpansionScale,t.direction),this.align!=="start"&&!this.seedWorkspaceResizeLeadingGutter(t)&&this.trackWorkspaceResizePointer(t)},this.onWorkspaceResizePointerEnd=e=>{!this.resizeSession||this.resizeSession.pointerId!==e.pointerId||(e.preventDefault(),this.endWorkspaceResize())},this.onWorkspaceResizeBlur=e=>{this.hasAttribute("data-workspace-keyboard-adjusting")&&(e.relatedTarget instanceof Element&&e.relatedTarget.classList.contains("esp-page-workspace-resize-handle")||this.finishWorkspaceKeyboardResize())},this.onWorkspaceResizeKeyDown=(e,t)=>{if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight"||!this.separatorIsAvailable(e))return;t.preventDefault(),this.hasAttribute("data-workspace-keyboard-adjusting")||this.suspendPreviewLayoutForWorkspaceResize();const i=(t.key==="ArrowLeft"?-1:1)*this.resizeStep(t.shiftKey),a=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,s=this.renderedWorkspaceWidths();this.applyWorkspaceResize(e,i,"keyboard",s.previewWidth,s.flyoutWidth,a,this.previewNavigationResizeAllowance(),(()=>{const o=this.workspaceLogicalGutterWidths();return o.leading+o.trailing})(),1,this.workspaceResizeDirection())},this.schedulePreviewLayout=(e=!1)=>{!this.isConnected||!this.hasUpdated||(this.previewOverlayRecoveryRequested||=e===!0,!(this.resizeSession||this.hasAttribute("data-workspace-keyboard-adjusting")||this.hasAttribute("data-workspace-position-held"))&&(this.previewSyncGeneration+=1,this.previewSyncFrame.restart()))},this.onPreviewMediaChange=()=>this.schedulePreviewLayout(!0),this.onPreviewResize=e=>{let t=!1;for(const i of e){const a=i.contentRect.width;if(i.target instanceof HTMLElement&&i.target.classList.contains("esp-page-left")){a>l&&!this.hasAttribute("data-preview-navigation-collapsed")&&(this.previewCollapsedSidebarWidth=a);continue}const s=this.previewObservedWidths.get(i.target);this.previewObservedWidths.set(i.target,a),t||=s===void 0||Math.abs(s-a)>.25}t&&this.schedulePreviewLayout(!0)},this.kind="wide",this.align="start",this.contained=!1,this.headerPosition="normal",this.fixedMenus=!1,this.previewOpen=!1,this.previewLabel="Preview",this.previewCollapseSidebar=!1,this.workspaceResizable=!1,this.previewVisible=!1,this.previewReclaiming=!1,new N(this,".esp-page-left > .sticky-wrapper"),new N(this,".esp-page-right > .sticky-wrapper"),new N(this,".esp-page-flyout > .sticky-wrapper",{topOffset:()=>this.flyoutFullHeightActive?0:void 0}),new N(this,".esp-page-preview > .sticky-wrapper",{topOffset:()=>0}),this.addEventListener("flyout-state-changed",e=>this.syncFlyoutState(e))}connectedCallback(){const e=Array.from(this.children).filter(t=>t.getAttribute("slot")==="footer");this.footerWrapperIsLandmark=!e.some(t=>this.footerElementProvidesLandmark(t)),super.connectedCallback(),this.syncMainMaximumConfiguration(),this.hasUpdated&&queueMicrotask(()=>this.setupPreviewLayoutObserver())}disconnectedCallback(){this.finishWorkspaceKeyboardResize(!1),this.endWorkspaceResize(),this.clearWorkspaceRecenteringState(),this.previewResizeObserver?.disconnect(),this.previewResizeObserver=void 0,this.previewMediaQuery?.removeEventListener("change",this.onPreviewMediaChange),this.previewMediaQuery=void 0,this.previewSyncFrame.cancel(),this.previewSyncGeneration+=1,this.previewOverlayRecoveryRequested=!1,this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1),this.toggleAttribute("data-workspace-keyboard-adjusting",!1),this.toggleAttribute("descendant-flyout-overlay-open",!1),this.clearFlyoutOverlayRecovery(),this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),this.preferredPreviewWidth=null,this.preferredFlyoutWidth=null,this.previewNavigationCollapseTask=null,this.setPreviewNavigationCollapse(!1),super.disconnectedCallback()}syncFlyoutState(e){if(e&&e.target?.closest?.("esp-page")!==this){this.syncDescendantFlyoutOverlayState();return}const t=r=>{const n=r;return(typeof n.mode=="string"?n.mode:r.getAttribute("mode"))==="overlay"||n.pageOverlayRequested===!0},i=r=>{const n=r.open;return typeof n=="boolean"?n:r.hasAttribute("open")},a=r=>r.anchor!=null,s=r=>{const n=r.fullHeight;return typeof n=="boolean"?n:r.hasAttribute("full-height")},o=(this.flyoutSlot.value?.assignedElements()??[]).filter(r=>r.tagName==="ESP-FLYOUT");for(const r of o){const n=r,d=typeof n.mode=="string"?n.mode:r.getAttribute("mode");n.pageOverlayRequested&&(!i(r)||d!=="auto")&&(n.pageOverlayRequested=!1)}o.some(r=>r.pageOverlayRequested===!0)||this.clearFlyoutOverlayRecovery(),this.toggleAttribute("flyout-open",o.some(r=>i(r)&&!t(r))),this.toggleAttribute("flyout-overlay-open",o.some(r=>i(r)&&t(r))),this.toggleAttribute("flyout-anchored",o.some(r=>i(r)&&a(r))),this.flyoutFullHeightActive=o.some(r=>i(r)&&!t(r)&&s(r)),this.toggleAttribute("flyout-full-height",this.flyoutFullHeightActive),this.resizeSession&&(this.hasAttribute("flyout-overlay-open")||this.resizeSession.separator==="preview-flyout"&&!this.hasAttribute("flyout-open"))&&this.endWorkspaceResize(),this.requestUpdate(),this.schedulePreviewLayout()}syncDescendantFlyoutOverlayState(){const e=Array.from(this.querySelectorAll("esp-flyout")).some(t=>{if(t.closest("esp-page")===this)return!1;const i=t,a=typeof i.open=="boolean"?i.open:t.hasAttribute("open"),s=typeof i.mode=="string"?i.mode:t.getAttribute("mode");return a&&(s==="overlay"||i.pageOverlayRequested===!0||t.getAttribute("aria-modal")==="true")});this.toggleAttribute("descendant-flyout-overlay-open",e)}assignedFlyouts(){return(this.flyoutSlot.value?.assignedElements()??[]).filter(e=>e.tagName==="ESP-FLYOUT")}openAutoFlyouts(){return this.assignedFlyouts().filter(e=>{const t=typeof e.open=="boolean"?e.open:e.hasAttribute("open"),i=typeof e.mode=="string"?e.mode:e.getAttribute("mode");return t&&i!=="overlay"})}async setPageFlyoutOverlay(e){let t=!1;const i=new Set(this.openAutoFlyouts());for(const a of this.assignedFlyouts()){const s=e&&i.has(a);a.pageOverlayRequested!==s&&(a.pageOverlayRequested=s,t=!0)}return t&&await Promise.all(this.assignedFlyouts().map(a=>a.updateComplete??Promise.resolve())),e||this.clearFlyoutOverlayRecovery(),t}clearFlyoutOverlayRecovery(){this.flyoutOverlayPromotionWidth=null,this.flyoutOverlayRecoveryReady=!1,this.flyoutOverlayRecoveryGeneration+=1}armFlyoutOverlayRecovery(){const e=++this.flyoutOverlayRecoveryGeneration;this.flyoutOverlayRecoveryReady=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e!==this.flyoutOverlayRecoveryGeneration||!this.openAutoFlyouts().some(t=>t.pageOverlayRequested===!0)||(this.flyoutOverlayPromotionWidth=this.visiblePageInlineBounds().width,this.flyoutOverlayRecoveryReady=!0)})})}previewHasContent(){const e=this.previewSlot.value;return e?ce(e):Array.from(this.childNodes).some(t=>t instanceof Element&&t.getAttribute("slot")==="preview"&&!t.hasAttribute("hidden"))}getPreviewNavigationPair(){if(!this.previewCollapseSidebar)return null;const e=Array.from(this.children),t=e.find(o=>o.slot==="header"&&o.tagName==="ESP-HEADER"),i=e.find(o=>o.slot==="sidebar"&&o.tagName==="ESP-MENU");if(!t||!i||!i.id)return null;const a=typeof t.drawerTarget=="string"?t.drawerTarget:t.getAttribute("drawer-target")??"",s=typeof i.mode=="string"?i.mode:i.getAttribute("mode");return a!==i.id||s!=="vertical"||!("previewCollapseRequested"in t)||!("previewCollapseRequested"in i)?null:{header:t,menu:i}}async setPreviewNavigationCollapse(e){const t=e?this.getPreviewNavigationPair():null,i=t!==null&&this.previewHeader===t.header&&this.previewMenu===t.menu,a=this.previewHeader&&this.previewHeader!==t?.header?this.previewHeader:null,s=this.previewMenu&&this.previewMenu!==t?.menu?this.previewMenu:null;if(a&&(a.previewCollapseRequested=!1),s&&(s.previewCollapseRequested=!1),this.previewHeader=t?.header??null,this.previewMenu=t?.menu??null,this.toggleAttribute("data-preview-navigation-collapsed",!1),await a?.updateComplete,await s?.updateComplete,!t)return!1;const o=i?this.previewCollapsedSidebarWidth:this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0;return t.header.previewCollapseRequested=!0,t.menu.previewCollapseRequested=!0,await t.header.updateComplete,await t.menu.updateComplete,t.menu.hasExternalDrawerControl===!0?(this.previewCollapsedSidebarWidth=o,this.toggleAttribute("data-preview-navigation-collapsed",!0),!0):(t.header.previewCollapseRequested=!1,t.menu.previewCollapseRequested=!1,await t.header.updateComplete,await t.menu.updateComplete,this.previewHeader=null,this.previewMenu=null,!1)}requestPreviewNavigationCollapse(){if(this.hasAttribute("data-preview-navigation-collapsed")||this.previewNavigationCollapseTask)return;const e=this.setPreviewNavigationCollapse(!0);this.previewNavigationCollapseTask=e,e.then(()=>{this.previewNavigationCollapseTask===e&&(this.previewNavigationCollapseTask=null)},()=>{this.previewNavigationCollapseTask===e&&(this.previewNavigationCollapseTask=null)})}scheduleWorkspaceSettlement(e=null){const t=()=>{this.schedulePreviewLayout(),e&&requestAnimationFrame(()=>{this.previewSyncTask.then(()=>{const s=this.shadowRoot?.activeElement,o=this.ownerDocument.activeElement;!this.isConnected||!e.isConnected||s&&s!==e||o!==this&&o!==this.ownerDocument.body||getComputedStyle(e).display!=="none"&&e.focus({preventScroll:!0})})})},i=this.previewNavigationCollapseTask;if(!i){t();return}i.then(()=>t(),()=>t())}clearWorkspaceKeyboardSettlementTimer(){this.workspaceKeyboardSettlementTimer!==null&&(clearTimeout(this.workspaceKeyboardSettlementTimer),this.workspaceKeyboardSettlementTimer=null)}finishWorkspaceKeyboardResize(e=!0){this.clearWorkspaceKeyboardSettlementTimer();const t=this.hasAttribute("data-workspace-keyboard-adjusting");this.toggleAttribute("data-workspace-keyboard-adjusting",!1),t&&e&&!this.resizeSession&&this.scheduleWorkspaceSettlement()}deferWorkspaceKeyboardSettlement(){this.clearWorkspaceKeyboardSettlementTimer(),this.workspaceKeyboardSettlementTimer=setTimeout(()=>{if(this.workspaceKeyboardSettlementTimer=null,!this.hasAttribute("data-workspace-keyboard-adjusting"))return;const e=this.shadowRoot?.activeElement,t=e instanceof HTMLElement&&e.classList.contains("esp-page-workspace-resize-handle")?e:null;this.toggleAttribute("data-workspace-keyboard-adjusting",!1),this.resizeSession||this.scheduleWorkspaceSettlement(t)},be)}suspendPreviewLayoutForWorkspaceResize(){this.previewSyncFrame.cancel(),this.previewSyncGeneration+=1,this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1)}setPreviewLayoutState(e,t){this.previewVisible=e,this.previewReclaiming=e&&t,e||this.endWorkspaceResize()}setWorkspaceWidths(e,t,i=!1){const a=Math.max(0,e),s=Math.max(0,t);this.style.setProperty("--_esp-page-preview-used-width",`${a}px`),this.style.setProperty("--_esp-page-flyout-used-width",`${s}px`),this.toggleAttribute("data-workspace-targeted",i),this.allocatedPreviewWidth=a,this.allocatedFlyoutWidth=s}clampWidth(e,t,i){return G.of(t,i).clamp(e)}visiblePageInlineBounds(){const e=this.getBoundingClientRect();let t=e.left,i=e.right;const a=window.visualViewport,s=a?.offsetLeft??0,o=a?.width??document.documentElement.clientWidth;o>0&&(t=Math.max(t,s),i=Math.min(i,s+o));const r=this.getRootNode();let n=this.parentElement??(r instanceof ShadowRoot?r.host:null);for(;n;){const d=getComputedStyle(n).overflowX;if(["auto","clip","hidden","scroll"].includes(d)){const h=n.getBoundingClientRect();t=Math.max(t,h.left),i=Math.min(i,h.right)}const m=n.getRootNode();n=n.parentElement??(m instanceof ShadowRoot?m.host:null)}return new he(t,i)}probeWidth(e){return de(e)}optionalWidth(e,t){return getComputedStyle(this).getPropertyValue(e).trim()===""?null:this.probeWidth(t)}syncMainMaximumConfiguration(){const e=getComputedStyle(this).getPropertyValue("--esp-page-main-max-width").trim()!=="";this.toggleAttribute("data-main-max-configured",e)}workspaceWidthCapacity(e,t,i=0){const a=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,s=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,o=Math.max(0,this.visiblePageInlineBounds().width-a-s-Math.max(0,i));return this.workspaceWidthCapacityForAvailable(o,e,t)}workspaceWidthCapacityForAvailable(e,t,i){const a=Math.max(0,e),s=i>0?Math.min(a,i):a;return{natural:Math.max(0,a-s),maximum:Math.max(0,a-Math.max(0,t))}}workspaceTargetWidth(e,t,i){return Math.min(e.maximum,Math.max(t,i,e.natural))}allocateWorkspaceWidths(e,t,i,a,s,o,r,n=null,d=null){const m=Math.max(0,e),h=Math.max(0,a),u=Math.max(h,s),y=Math.max(0,o),W=Math.max(y,r),v=t?this.preferredPreviewWidth??(n===null?null:this.clampWidth(n,h,u)):null,w=i?this.preferredFlyoutWidth??(d===null?null:this.clampWidth(d,y,W)):null;let c=0,p=0;t&&i?(c=Math.min(u,Math.max(h,m-y)),p=Math.min(W,Math.max(y,m-c))):t?c=Math.min(u,Math.max(h,m)):i&&(p=Math.min(W,Math.max(y,m))),t&&v!==null&&(c=this.clampWidth(v,h,u),i&&w===null&&(p=this.clampWidth(m-c,y,W))),i&&w!==null&&(p=this.clampWidth(w,y,W),t&&v===null&&(c=this.clampWidth(m-p,h,u)));let b=c+p-m;if(b>0&&i){const P=Math.min(b,Math.max(0,p-y));p-=P,b-=P}return b>0&&t&&(c-=Math.min(b,Math.max(0,c-h))),{previewWidth:c,flyoutWidth:p}}workspaceResizeDirection(){return getComputedStyle(this).direction==="rtl"?-1:1}trailingWorkspaceSeparator(){return this.hasAttribute("flyout-open")&&!this.hasAttribute("flyout-overlay-open")?"flyout-end":this.previewVisible?"preview-end":null}trailingWorkspacePane(){const e=this.trailingWorkspaceSeparator()==="flyout-end"?".esp-page-flyout":this.trailingWorkspaceSeparator()==="preview-end"?".esp-page-preview":null;return e?this.shadowRoot?.querySelector(e)??null:null}workspaceLogicalGutterWidths(){const e=Math.max(0,this.shadowRoot?.querySelector(".esp-page-canvas--left")?.getBoundingClientRect().width??0),t=this.trailingWorkspacePane();if(!t)return{leading:e,trailing:0};const i=this.visiblePageInlineBounds(),a=t.getBoundingClientRect(),s=this.workspaceResizeDirection()===1?i.right-a.right:a.left-i.left;return{leading:e,trailing:Math.max(0,s)}}syncTrailingWorkspaceResizeAvailability(){const{trailing:e}=this.workspaceLogicalGutterWidths();this.toggleAttribute("data-workspace-trailing-edge-exposed",this.trailingWorkspaceSeparator()!==null&&e>l)}trailingPaneResizeRange(e,t,i){const a=e==="preview-end"?this.previewMinWidthProbe:this.flyoutMinWidthProbe,s=e==="preview-end"?this.previewMaxWidthProbe:this.flyoutMaxWidthProbe,o=Math.max(0,this.probeWidth(a)),r=Math.max(o,this.probeWidth(s));return G.of(o,r).cappedAt(Math.max(0,t)+Math.max(0,i))}resizeStep(e){const t=this.probeWidth(e?this.resizeLargeStepProbe:this.resizeStepProbe);return t>0?t:e?ye:fe}previewNavigationResizeAllowance(){if(this.hasAttribute("data-preview-navigation-collapsed")||this.getPreviewNavigationPair()===null)return 0;const e=Math.max(0,this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0);return e>l&&(this.previewCollapsedSidebarWidth=e),e>l?e:this.previewCollapsedSidebarWidth}renderedWorkspaceWidths(){const e=this.shadowRoot?.querySelector(".esp-page-preview"),t=this.shadowRoot?.querySelector(".esp-page-flyout");return{previewWidth:this.allocatedPreviewWidth>0?this.allocatedPreviewWidth:e?.getBoundingClientRect().width??0,flyoutWidth:this.allocatedFlyoutWidth>0?this.allocatedFlyoutWidth:t?.getBoundingClientRect().width??0}}mainPreviewResizeRange(e=this.renderedWorkspaceWidths().previewWidth,t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,i=this.previewNavigationResizeAllowance()){const a=this.previewProbes.minimum,s=this.previewProbes.maximum,o=this.mainProbes.minimum,r=Math.max(0,t+e),n=Math.max(0,r+i-o);return G.of(a,Math.max(a,Math.min(s,n)))}previewFlyoutResizeRange(e=this.renderedWorkspaceWidths().previewWidth,t=this.renderedWorkspaceWidths().flyoutWidth){const i=this.previewProbes.minimum,a=this.previewProbes.maximum,s=this.flyoutProbes.minimum,o=this.flyoutProbes.maximum,r=e+t;return G.of(Math.max(i,r-o),Math.max(i,Math.min(a,r-s)))}separatorIsAvailable(e){return!this.workspaceResizable||this.hasAttribute("flyout-overlay-open")?!1:e==="main-preview"?this.previewVisible:e==="preview-end"||e==="flyout-end"?this.trailingWorkspaceSeparator()===e&&(this.hasAttribute("data-workspace-trailing-edge-exposed")||this.hasAttribute("data-workspace-position-held")||this.hasAttribute("data-workspace-keyboard-adjusting")):this.hasAttribute("flyout-open")}flyoutOnlyResizeRange(e=this.renderedWorkspaceWidths().flyoutWidth,t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0){const i=this.flyoutProbes.minimum,a=this.flyoutProbes.maximum,s=this.mainProbes.minimum,o=this.probeWidth(this.mainMaxWidthProbe),r=Math.max(0,t+e),n=o>0?Math.max(0,r-o):0,d=Math.max(i,n);return G.of(d,Math.min(a,r-s))}mainResizeGrowthCapacity(e){return this.kind==="full"&&!this.hasAttribute("data-main-max-configured")?Number.POSITIVE_INFINITY:Math.max(0,this.probeWidth(this.mainMaxWidthProbe)-e)}applyWorkspaceResize(e,t,i,a,s,o,r,n,d,m){if(!this.separatorIsAvailable(e))return;const h=t*m,u=n/d,y=e==="main-preview"||e==="preview-flyout"&&!this.previewVisible,W=i==="pointer"&&y&&h>0?Math.min(h,u,this.mainResizeGrowthCapacity(o)):0;let v=e,w=a,c=s;if(e==="preview-end"||e==="flyout-end"){const p=e==="preview-end"?a:s,b=this.trailingPaneResizeRange(e,p,n),P=p+(h>0?h*d:h),C=b.clamp(P);e==="preview-end"?(w=C,this.preferredPreviewWidth=C):(c=C,this.preferredFlyoutWidth=C)}else if(e==="main-preview"){const p=this.mainPreviewResizeRange(a,o,r),b=a-(h-W);w=p.clamp(b),this.preferredPreviewWidth=w;const P=this.mainProbes.minimum,C=this.probeWidth(this.mainMaxWidthProbe),k=this.kind==="full"&&!this.hasAttribute("data-main-max-configured")?0:C,g=this.workspaceWidthCapacity(P,k);r>0&&w+c>g.natural+l&&this.requestPreviewNavigationCollapse();const F=this.previewProbes.minimum,A=Math.max(0,F-b),O=p.min<=F+l;if(A>0&&O&&s>0){const E=this.flyoutProbes.minimum,L=this.flyoutProbes.maximum;c=this.clampWidth(s-A,E,L),this.preferredFlyoutWidth=c}else s>0&&(this.preferredFlyoutWidth??=s)}else if(!this.previewVisible)v="main-flyout",c=this.flyoutOnlyResizeRange(s,o).clamp(s-(h-W)),w=0,this.preferredFlyoutWidth=c;else{const p=this.previewProbes.minimum,b=this.previewProbes.maximum,P=this.flyoutProbes.minimum,C=this.flyoutProbes.maximum;if(h>=0){const k=Math.max(0,s-P),g=Math.min(h,u),F=Math.max(0,h-g),A=g*d+F,O=k+n;w=this.clampWidth(a+A,p,Math.min(b,a+O));const E=Math.max(0,w-a),L=Math.min(E,n);c=s-Math.min(Math.max(0,E-L),k)}else{const k=this.previewFlyoutResizeRange(a,s),g=a+h;w=k.clamp(g),c=a+s-w;const F=Math.max(0,p-g),A=k.min<=p+l;if(F>0&&A){const O=this.mainProbes.minimum,E=Math.max(0,o-O);c=this.clampWidth(c+Math.min(F,E),P,C)}}this.preferredPreviewWidth=w,this.preferredFlyoutWidth=c}this.setWorkspaceWidths(w,c,!0),this.requestUpdate(),this.previewVisible&&this.setPreviewLayoutState(!0,!0),i==="keyboard"&&(this.toggleAttribute("data-workspace-keyboard-adjusting",!0),this.deferWorkspaceKeyboardSettlement()),this.dispatchEvent(new CustomEvent("esp-page-workspace-resize",{bubbles:!0,composed:!0,detail:{separator:v,source:i,previewWidth:w,flyoutWidth:c}}))}appliedSeparatorInlineDelta(e){if(e.separator==="preview-end"){const a=this.allocatedPreviewWidth-e.startPreviewWidth;return a>0?a/e.trailingExpansionScale:a}if(e.separator==="flyout-end"){const a=this.allocatedFlyoutWidth-e.startFlyoutWidth;return a>0?a/e.trailingExpansionScale:a}if(e.separator==="main-preview")return e.trailingGroupPushDelta+e.startPreviewWidth-this.allocatedPreviewWidth+(e.startFlyoutWidth-this.allocatedFlyoutWidth);const t=e.startFlyoutWidth-this.allocatedFlyoutWidth;if(!this.previewVisible)return e.trailingGroupPushDelta+t;if(this.allocatedPreviewWidth<e.startPreviewWidth)return t;const i=Math.max(0,this.allocatedPreviewWidth+this.allocatedFlyoutWidth-e.startPreviewWidth-e.startFlyoutWidth);return t+i/e.trailingExpansionScale}clearWorkspaceRecenteringState(){this.workspaceRecenteringFrame.cancel(),this.workspaceRecenteringTimer!==null&&(clearTimeout(this.workspaceRecenteringTimer),this.workspaceRecenteringTimer=null),this.toggleAttribute("data-workspace-position-held",!1),this.style.removeProperty("--_esp-page-resize-leading-gutter-width")}holdWorkspacePosition(){const e=this.workspaceLogicalGutterWidths().leading;return this.clearWorkspaceRecenteringState(),this.style.setProperty("--_esp-page-resize-leading-gutter-width",`${e}px`),this.toggleAttribute("data-workspace-position-held",!0),e}trackWorkspaceResizePointer(e){const t=e.startHandleClientX+this.appliedSeparatorInlineDelta(e)*e.direction;for(let i=0;i<3;i+=1){const a=e.target.getBoundingClientRect(),s=a.left+a.width/2,o=(t-s)*e.direction;if(Math.abs(o)<=.25)return;const r=Math.max(0,e.heldLeadingGutterWidth+o);if(Math.abs(r-e.heldLeadingGutterWidth)<=.25)return;e.heldLeadingGutterWidth=r,this.style.setProperty("--_esp-page-resize-leading-gutter-width",`${e.heldLeadingGutterWidth}px`)}}seedWorkspaceResizeLeadingGutter(e){if(this.align==="start")return!1;const t=this.appliedSeparatorInlineDelta(e);if(t<=0)return!1;let i=0;if(e.separator==="preview-end"||e.separator==="flyout-end")i=this.allocatedPreviewWidth-e.startPreviewWidth+this.allocatedFlyoutWidth-e.startFlyoutWidth;else if(e.separator==="preview-flyout"&&this.previewVisible)i=this.allocatedPreviewWidth-e.startPreviewWidth;else{const a=Math.max(0,e.startPreviewWidth-this.allocatedPreviewWidth+e.startFlyoutWidth-this.allocatedFlyoutWidth),s=this.probeWidth(this.mainMaxWidthProbe),o=this.kind==="full"&&!this.hasAttribute("data-main-max-configured")?Number.POSITIVE_INFINITY:Math.max(0,s-e.startMainWidth);i=Math.min(e.trailingGroupPushDelta+a,o)}return e.heldLeadingGutterWidth=Math.max(0,e.startLeadingGutterWidth+t-i),this.style.setProperty("--_esp-page-resize-leading-gutter-width",`${e.heldLeadingGutterWidth}px`),!0}finishWorkspaceRecentering(){this.clearWorkspaceRecenteringState(),this.syncTrailingWorkspaceResizeAvailability(),this.isConnected&&this.scheduleWorkspaceSettlement()}beginWorkspaceRecentering(){const e=this.workspaceLogicalGutterWidths(),t=e.leading+e.trailing,i=this.align==="center"?t/2:this.align==="end"?t:0;if(Math.abs(i-e.leading)<=l){this.finishWorkspaceRecentering();return}this.pendingRecenterLeading=i,this.workspaceRecenteringFrame.restart()}applyWorkspaceRecentering(){this.resizeSession||!this.hasAttribute("data-workspace-position-held")||(this.style.setProperty("--_esp-page-resize-leading-gutter-width",`${this.pendingRecenterLeading}px`),this.workspaceRecenteringTimer=setTimeout(()=>this.finishWorkspaceRecentering(),ke+We))}endWorkspaceResize(){const e=this.resizeSession;this.resizeSession=null,this.toggleAttribute("data-workspace-resizing",!1),e?.target.hasPointerCapture?.(e.pointerId)&&e.target.releasePointerCapture(e.pointerId),e&&this.beginWorkspaceRecentering()}previewFitsWithinPage(e,t,i,a,s,o){const r=this.shadowRoot?.querySelector(".esp-page-main"),n=this.shadowRoot?.querySelector(".esp-page-preview"),d=this.shadowRoot?.querySelector(".esp-page-flyout");if(!r||!n||!d)return!1;const m=this.visiblePageInlineBounds(),h=r.getBoundingClientRect(),u=n.getBoundingClientRect(),y=d.getBoundingClientRect(),W=Math.max(t,i),v=Math.max(s,o),w=u.width+l>=t&&u.width<=W+l,c=!a||y.width+l>=s&&y.width<=v+l,p=u.left+l>=m.left&&u.right<=m.right+l&&(!a||y.left+l>=m.left&&y.right<=m.right+l),b=getComputedStyle(this).direction==="rtl"?h.left+l>=u.right&&(!a||u.left+l>=y.right):h.right<=u.left+l&&(!a||u.right<=y.left+l);return h.width+l>=e&&w&&c&&p&&b}flyoutFitsWithinPage(e,t,i){const a=this.shadowRoot?.querySelector(".esp-page-main"),s=this.shadowRoot?.querySelector(".esp-page-flyout");if(!a||!s)return!1;const o=this.visiblePageInlineBounds(),r=a.getBoundingClientRect(),n=s.getBoundingClientRect(),d=Math.max(t,i),m=n.width+l>=t&&n.width<=d+l,h=n.left+l>=o.left&&n.right<=o.right+l,u=getComputedStyle(this).direction==="rtl"?r.left+l>=n.right:r.right<=n.left+l;return r.width+l>=e&&m&&h&&u}workspaceMinimumsCanFit(e,t,i,a,s){const o=this.visiblePageInlineBounds().width;if(o<=0||e<=0||t&&i<=0||a&&s<=0)return!1;const r=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,n=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,m=(t&&this.getPreviewNavigationPair()!==null?0:r)+n+e+(t?i:0)+(a?s:0);return o+l>=m}workspaceGeometrySample(){const e=this.visiblePageInlineBounds(),t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect(),i=this.shadowRoot?.querySelector(".esp-page-preview")?.getBoundingClientRect(),a=this.shadowRoot?.querySelector(".esp-page-flyout")?.getBoundingClientRect();return[e.left,e.right,e.width,t?.left??0,t?.right??0,t?.width??0,i?.left??0,i?.right??0,i?.width??0,a?.left??0,a?.right??0,a?.width??0]}workspaceGeometryMatches(e,t){return e.length===t.length&&e.every((i,a)=>Math.abs(i-(t[a]??i))<=l)}workspaceCandidateIsMeasurable(e,t){const i=this.shadowRoot?.querySelector(".esp-page-preview")?.getBoundingClientRect().width??0,a=this.shadowRoot?.querySelector(".esp-page-flyout")?.getBoundingClientRect().width??0;return(!e||i>l)&&(!t||a>l)}async candidateFitsAfterLayoutSettles(e,t,i){if(await this.updateComplete,e!==this.previewSyncGeneration||!this.isConnected)return null;let a=null,s=0;for(let o=0;o<me;o+=1){if(await new Promise(n=>requestAnimationFrame(()=>n())),e!==this.previewSyncGeneration||!this.isConnected)return null;if(t())return!0;if(!i()){a=null,s=0;continue}const r=this.workspaceGeometrySample();if(s=a&&this.workspaceGeometryMatches(a,r)?s+1:1,s>=ge)return!1;a=r}return null}async promoteFlyoutIfClipped(e,t,i,a){if(i<=0)return!1;const s=await this.candidateFitsAfterLayoutSettles(e,()=>this.flyoutFitsWithinPage(t,i,a),()=>this.workspaceCandidateIsMeasurable(!1,!0));return s===null?!0:s?!1:(await this.promoteFlyoutToOverlay(),!0)}async promoteFlyoutToOverlay(){this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),this.flyoutOverlayPromotionWidth===null&&(this.flyoutOverlayPromotionWidth=this.visiblePageInlineBounds().width,this.armFlyoutOverlayRecovery()),await this.setPageFlyoutOverlay(!0)}async syncPreviewLayout(e,t=!0){if(e!==this.previewSyncGeneration||!this.isConnected||this.resizeSession||this.hasAttribute("data-workspace-keyboard-adjusting")||this.hasAttribute("data-workspace-position-held"))return;let i=!1;const a=this.previewVisible;this.toggleAttribute("data-preview-measuring",!0);try{const s=this.previewOpen&&this.previewHasContent(),o=this.previewMediaQuery?.matches??!1,r=this.hasAttribute("flyout-overlay-open"),n=this.hasAttribute("flyout-open"),d=this.hasAttribute("data-preview-navigation-collapsed"),m=this.getPreviewNavigationPair(),h=m===null?0:d?this.previewCollapsedSidebarWidth:this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,u=this.probeWidth(this.previewMinWidthProbe),y=this.optionalWidth("--esp-page-preview-default-width",this.previewDefaultWidthProbe),W=this.probeWidth(this.previewMaxWidthProbe),v=this.probeWidth(this.flyoutMinWidthProbe),w=this.optionalWidth("--esp-page-flyout-default-width",this.flyoutDefaultWidthProbe),c=this.probeWidth(this.flyoutMaxWidthProbe),p=this.probeWidth(this.mainMinWidthProbe);this.syncMainMaximumConfiguration();const b=this.probeWidth(this.mainMaxWidthProbe),P=this.kind==="full"&&!this.hasAttribute("data-main-max-configured")?0:b,C=this.openAutoFlyouts().some(S=>S.pageOverlayRequested===!0);if(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),C){const S=this.visiblePageInlineBounds().width,T=this.flyoutOverlayPromotionWidth===null||S>=this.flyoutOverlayPromotionWidth+ve;!o&&t&&this.flyoutOverlayRecoveryReady&&T&&this.workspaceMinimumsCanFit(p,s,u,!0,v)?await this.setPageFlyoutOverlay(!1):o&&await this.setPageFlyoutOverlay(!1);return}if(await this.updateComplete,e!==this.previewSyncGeneration)return;const k=s&&!o&&!r,g=n&&!o;if(p>0&&(!k||u>0)&&(!g||v>0)&&(k||g)&&!this.workspaceMinimumsCanFit(p,k,u,g,v)){g&&await this.promoteFlyoutToOverlay();return}const A=(k?u:0)+(g?v:0),L=k&&this.preferredPreviewWidth!==null||g&&this.preferredFlyoutWidth!==null||(k&&y!==null||g&&w!==null),U=(k?this.preferredPreviewWidth===null?u:this.clampWidth(this.preferredPreviewWidth,u,W):0)+(g?this.preferredFlyoutWidth===null?v:this.clampWidth(this.preferredFlyoutWidth,v,c):0),f=S=>{const T=this.workspaceTargetWidth(S,A,U),B=this.allocateWorkspaceWidths(T,k,g,u,W,v,c,y,w),K=S.maximum+p,Z=Math.max(0,K-S.natural),se=B.previewWidth+B.flyoutWidth,J=Math.max(0,Math.min(Z,K-se));return{allocation:B,mainWidth:J,reclaimsMain:J+l<Z}},D=(S,T)=>Math.abs(S.mainWidth-T.mainWidth)>l||Math.abs(S.allocation.previewWidth-T.allocation.previewWidth)>l||Math.abs(S.allocation.flyoutWidth-T.allocation.flyoutWidth)>l,V=this.workspaceWidthCapacity(p,P,d?h:0),I=f(V);let $=I.allocation;if(this.setWorkspaceWidths($.previewWidth,$.flyoutWidth,L),!k||u<=0){g&&await this.promoteFlyoutIfClipped(e,p,v,c);return}if(m!==null&&h>l){const S=V.maximum+p,T=this.workspaceWidthCapacityForAvailable(S+h,p,P),B=f(T);(d?D(f(this.workspaceWidthCapacityForAvailable(Math.max(0,S-we),p,P)),B):I.reclaimsMain&&D(I,B))?i=await this.setPreviewNavigationCollapse(!0):await this.setPreviewNavigationCollapse(!1)}else await this.setPreviewNavigationCollapse(!1);if(e!==this.previewSyncGeneration)return;const Y=this.workspaceWidthCapacity(p,P);if(Y.maximum+l<A){this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,g?v:0),i=!1,g&&await this.promoteFlyoutToOverlay();return}const X=f(Y);if($=X.allocation,this.setWorkspaceWidths($.previewWidth,$.flyoutWidth,L),a||this.toggleAttribute("data-preview-validating",!0),this.setPreviewLayoutState(!0,X.reclaimsMain),await this.updateComplete,e!==this.previewSyncGeneration)return;const Q=await this.candidateFitsAfterLayoutSettles(e,()=>this.previewFitsWithinPage(p,u,W,g,v,c),()=>this.workspaceCandidateIsMeasurable(!0,g));if(Q===null)return;Q?this.toggleAttribute("data-preview-validating",!1):(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,g?v:0),i=!1,g&&await this.promoteFlyoutToOverlay())}finally{e===this.previewSyncGeneration&&!i&&await this.setPreviewNavigationCollapse(!1),e===this.previewSyncGeneration&&(this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1),this.syncTrailingWorkspaceResizeAvailability(),this.requestUpdate())}}runScheduledPreviewLayout(){const e=this.previewSyncGeneration,t=this.previewOverlayRecoveryRequested;this.previewOverlayRecoveryRequested=!1,this.previewSyncTask=this.previewSyncTask.then(()=>this.syncPreviewLayout(e,t)).catch(()=>{})}setupPreviewLayoutObserver(){if(this.isConnected){if(!this.previewMediaQuery&&typeof window.matchMedia=="function"&&(this.previewMediaQuery=window.matchMedia(ue),this.previewMediaQuery.addEventListener("change",this.onPreviewMediaChange)),!this.previewResizeObserver&&typeof ResizeObserver<"u"){this.previewResizeObserver=new ResizeObserver(this.onPreviewResize),this.previewResizeObserver.observe(this);const e=this.shadowRoot?.querySelector(".esp-page-left");e&&this.previewResizeObserver.observe(e);for(const t of[this.previewMinWidthProbe,this.previewDefaultWidthProbe,this.previewMaxWidthProbe,this.flyoutMinWidthProbe,this.flyoutDefaultWidthProbe,this.flyoutMaxWidthProbe,this.mainMinWidthProbe,this.mainConfiguredMaxWidthProbe,this.mainMaxWidthProbe,this.resizeStepProbe,this.resizeLargeStepProbe])t.value&&this.previewResizeObserver.observe(t.value)}this.schedulePreviewLayout(!0)}}footerElementProvidesLandmark(e){return e.matches(ae)||e.querySelector(ae)!==null}syncFooterLandmark(){const t=(this.footerSlot.value?.assignedElements({flatten:!0})??[]).some(i=>this.footerElementProvidesLandmark(i));this.footerWrapperIsLandmark=!t}showPreview(){this.previewOpen=!0}closePreview(){this.previewOpen=!1}togglePreview(){this.previewOpen=!this.previewOpen}AddDialog(e){this.dialogZone.value?.appendChild(e)}firstUpdated(e){super.firstUpdated(e),this.syncFlyoutState(),this.setupPreviewLayoutObserver()}updated(e){super.updated(e),(e.has("fixedMenus")||e.has("headerPosition"))&&pe().publish("fixed-menus-changed",{fixed:this.fixedMenus||this.headerPosition==="fixed"}),(e.has("previewOpen")||e.has("previewCollapseSidebar")||e.has("align"))&&this.schedulePreviewLayout(!0),e.has("workspaceResizable")&&!this.workspaceResizable&&(this.finishWorkspaceKeyboardResize(),this.endWorkspaceResize(),this.clearWorkspaceRecenteringState())}render(){const e=this.fixedMenus||this.headerPosition==="fixed",t=!e&&this.headerPosition==="sticky",i=this.mainPreviewResizeRange(),a=this.previewProbes.minimum,s=this.flyoutProbes.minimum,o=this.flyoutProbes.maximum,r=this.mainProbes.minimum,n=this.probeWidth(this.mainMaxWidthProbe),d=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,m=this.hasAttribute("flyout-open"),h=d+this.allocatedPreviewWidth,u=i.min<=a+l,y=m&&u?Math.max(0,this.allocatedFlyoutWidth-s):0,W=Math.max(r,h-i.max),v=Math.max(W,Math.max(r,h-i.min)+y),w=n>0?Math.max(W,Math.min(Math.max(r,n),v)):v,c=n>0&&d+l>=n?`${Math.round(d)}px main, ${Math.round(this.allocatedPreviewWidth)}px preview`:ee;let p,b;if(this.previewVisible){const f=this.previewFlyoutResizeRange(),D=this.allocatedPreviewWidth+this.allocatedFlyoutWidth,I=f.min<=a+l?Math.max(0,d-r):0;p=Math.max(s,D-f.max),b=Math.max(p,Math.min(o,D-f.min+I))}else{const f=this.flyoutOnlyResizeRange();p=f.min,b=f.max}const P=this.previewVisible?"preview-flyout-resize-handle":"main-flyout-resize-handle",C=this.previewVisible?"Resize preview and help panes":"Resize help pane",k=this.previewVisible?`${Math.round(this.allocatedPreviewWidth)}px preview, ${Math.round(this.allocatedFlyoutWidth)}px help`:`${Math.round(this.allocatedFlyoutWidth)}px help`,g=m?"flyout-end":"preview-end",F=g==="flyout-end"?this.allocatedFlyoutWidth:this.allocatedPreviewWidth,A=this.workspaceLogicalGutterWidths(),O=this.trailingPaneResizeRange(g,F,A.leading+A.trailing),E=g==="flyout-end"?"flyout-end-resize-handle":"preview-end-resize-handle",L=g==="flyout-end"?"Resize help pane from its outer edge":"Resize preview pane from its outer edge";return oe`
|
|
2
|
+
<div part="wrapper" class="esp-page ${le({"fixed-menus":e,"fixed-header":e,"sticky-header":t})}">
|
|
3
3
|
<div part="canvas" class="esp-page-canvas esp-page-canvas--left" aria-hidden="true"></div>
|
|
4
4
|
<div part="canvas" class="esp-page-canvas esp-page-canvas--right" aria-hidden="true"></div>
|
|
5
5
|
<div part="surface" class="esp-page-surface" aria-hidden="true"></div>
|
|
@@ -23,7 +23,7 @@ var z=function(G,e,t,i){var a=arguments.length,s=a<3?e:i===null?i=Object.getOwnP
|
|
|
23
23
|
<div class="sticky-wrapper">
|
|
24
24
|
<slot
|
|
25
25
|
name="flyout"
|
|
26
|
-
${
|
|
26
|
+
${z(this.flyoutSlot)}
|
|
27
27
|
@slotchange=${()=>this.syncFlyoutState()}
|
|
28
28
|
></slot>
|
|
29
29
|
</div>
|
|
@@ -31,64 +31,64 @@ var z=function(G,e,t,i){var a=arguments.length,s=a<3?e:i===null?i=Object.getOwnP
|
|
|
31
31
|
<div
|
|
32
32
|
class="esp-page-preview-width-probe esp-page-preview-min-width-probe"
|
|
33
33
|
aria-hidden="true"
|
|
34
|
-
${
|
|
34
|
+
${z(this.previewMinWidthProbe)}
|
|
35
35
|
></div>
|
|
36
36
|
<div
|
|
37
37
|
class="esp-page-preview-default-width-probe"
|
|
38
38
|
aria-hidden="true"
|
|
39
|
-
${
|
|
39
|
+
${z(this.previewDefaultWidthProbe)}
|
|
40
40
|
></div>
|
|
41
41
|
<div
|
|
42
42
|
class="esp-page-preview-max-width-probe"
|
|
43
43
|
aria-hidden="true"
|
|
44
|
-
${
|
|
44
|
+
${z(this.previewMaxWidthProbe)}
|
|
45
45
|
></div>
|
|
46
46
|
<div
|
|
47
47
|
class="esp-page-flyout-min-width-probe"
|
|
48
48
|
aria-hidden="true"
|
|
49
|
-
${
|
|
49
|
+
${z(this.flyoutMinWidthProbe)}
|
|
50
50
|
></div>
|
|
51
51
|
<div
|
|
52
52
|
class="esp-page-flyout-default-width-probe"
|
|
53
53
|
aria-hidden="true"
|
|
54
|
-
${
|
|
54
|
+
${z(this.flyoutDefaultWidthProbe)}
|
|
55
55
|
></div>
|
|
56
56
|
<div
|
|
57
57
|
class="esp-page-flyout-max-width-probe"
|
|
58
58
|
aria-hidden="true"
|
|
59
|
-
${
|
|
59
|
+
${z(this.flyoutMaxWidthProbe)}
|
|
60
60
|
></div>
|
|
61
61
|
<div
|
|
62
62
|
class="esp-page-preview-main-min-probe esp-page-main-min-width-probe"
|
|
63
63
|
aria-hidden="true"
|
|
64
|
-
${
|
|
64
|
+
${z(this.mainMinWidthProbe)}
|
|
65
65
|
></div>
|
|
66
66
|
<div
|
|
67
67
|
class="esp-page-main-configured-max-width-probe"
|
|
68
68
|
aria-hidden="true"
|
|
69
|
-
${
|
|
69
|
+
${z(this.mainConfiguredMaxWidthProbe)}
|
|
70
70
|
></div>
|
|
71
71
|
<div
|
|
72
72
|
class="esp-page-main-max-width-probe"
|
|
73
73
|
aria-hidden="true"
|
|
74
|
-
${
|
|
74
|
+
${z(this.mainMaxWidthProbe)}
|
|
75
75
|
></div>
|
|
76
76
|
<div
|
|
77
77
|
class="esp-page-resize-step-probe"
|
|
78
78
|
aria-hidden="true"
|
|
79
|
-
${
|
|
79
|
+
${z(this.resizeStepProbe)}
|
|
80
80
|
></div>
|
|
81
81
|
<div
|
|
82
82
|
class="esp-page-resize-large-step-probe"
|
|
83
83
|
aria-hidden="true"
|
|
84
|
-
${
|
|
84
|
+
${z(this.resizeLargeStepProbe)}
|
|
85
85
|
></div>
|
|
86
|
-
<div class="esp-page-preview-space" ${
|
|
86
|
+
<div class="esp-page-preview-space" ${z(this.previewSpace)}>
|
|
87
87
|
<aside part="preview" class="esp-page-preview" aria-label=${this.previewLabel}>
|
|
88
88
|
<div part="preview-content" class="sticky-wrapper">
|
|
89
89
|
<slot
|
|
90
90
|
name="preview"
|
|
91
|
-
${
|
|
91
|
+
${z(this.previewSlot)}
|
|
92
92
|
@slotchange=${this.schedulePreviewLayout}
|
|
93
93
|
></slot>
|
|
94
94
|
</div>
|
|
@@ -115,12 +115,12 @@ var z=function(G,e,t,i){var a=arguments.length,s=a<3?e:i===null?i=Object.getOwnP
|
|
|
115
115
|
@blur=${this.onWorkspaceResizeBlur}
|
|
116
116
|
></div>
|
|
117
117
|
<div
|
|
118
|
-
part=${
|
|
118
|
+
part=${P}
|
|
119
119
|
class="esp-page-workspace-resize-handle esp-page-preview-flyout-resize-handle"
|
|
120
120
|
role="separator"
|
|
121
121
|
aria-orientation="vertical"
|
|
122
122
|
aria-label=${C}
|
|
123
|
-
aria-valuemin=${Math.round(
|
|
123
|
+
aria-valuemin=${Math.round(p)}
|
|
124
124
|
aria-valuemax=${Math.round(b)}
|
|
125
125
|
aria-valuenow=${Math.round(this.allocatedFlyoutWidth)}
|
|
126
126
|
aria-valuetext=${k}
|
|
@@ -134,13 +134,13 @@ var z=function(G,e,t,i){var a=arguments.length,s=a<3?e:i===null?i=Object.getOwnP
|
|
|
134
134
|
@blur=${this.onWorkspaceResizeBlur}
|
|
135
135
|
></div>
|
|
136
136
|
<div
|
|
137
|
-
part=${
|
|
137
|
+
part=${E}
|
|
138
138
|
class="esp-page-workspace-resize-handle esp-page-workspace-end-resize-handle"
|
|
139
139
|
role="separator"
|
|
140
140
|
aria-orientation="vertical"
|
|
141
141
|
aria-label=${L}
|
|
142
|
-
aria-valuemin=${Math.round(
|
|
143
|
-
aria-valuemax=${Math.round(
|
|
142
|
+
aria-valuemin=${Math.round(O.min)}
|
|
143
|
+
aria-valuemax=${Math.round(O.max)}
|
|
144
144
|
aria-valuenow=${Math.round(F)}
|
|
145
145
|
tabindex="0"
|
|
146
146
|
@pointerdown=${f=>this.onWorkspaceResizePointerDown(g,f)}
|
|
@@ -152,13 +152,13 @@ var z=function(G,e,t,i){var a=arguments.length,s=a<3?e:i===null?i=Object.getOwnP
|
|
|
152
152
|
@blur=${this.onWorkspaceResizeBlur}
|
|
153
153
|
></div>
|
|
154
154
|
</div>
|
|
155
|
-
<div class="esp-page-footer" role=${this.footerWrapperIsLandmark?"contentinfo":
|
|
156
|
-
<slot name="footer" ${
|
|
155
|
+
<div class="esp-page-footer" role=${this.footerWrapperIsLandmark?"contentinfo":ee}>
|
|
156
|
+
<slot name="footer" ${z(this.footerSlot)} @slotchange=${this.syncFooterLandmark}></slot>
|
|
157
157
|
</div>
|
|
158
|
-
<div id="dialog-drop-zone" ${
|
|
158
|
+
<div id="dialog-drop-zone" ${z(this.dialogZone)}></div>
|
|
159
159
|
<esp-toaster></esp-toaster>
|
|
160
160
|
</div>
|
|
161
|
-
`}};x.styles=[...
|
|
161
|
+
`}};x.styles=[...te.styles,re`
|
|
162
162
|
:host {
|
|
163
163
|
--_esp-page-resolved-max-width: var(
|
|
164
164
|
--esp-page-main-max-width,
|
|
@@ -874,4 +874,4 @@ var z=function(G,e,t,i){var a=arguments.length,s=a<3?e:i===null?i=Object.getOwnP
|
|
|
874
874
|
transition: none;
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
|
-
`],
|
|
877
|
+
`],M([H()],x.prototype,"footerWrapperIsLandmark",void 0),M([H()],x.prototype,"allocatedPreviewWidth",void 0),M([H()],x.prototype,"allocatedFlyoutWidth",void 0),M([_({reflect:!0})],x.prototype,"kind",void 0),M([_({reflect:!0})],x.prototype,"align",void 0),M([_({type:Boolean,reflect:!0})],x.prototype,"contained",void 0),M([_({attribute:"header-position",reflect:!0})],x.prototype,"headerPosition",void 0),M([_({attribute:"fixed-menus",type:Boolean,reflect:!0})],x.prototype,"fixedMenus",void 0),M([_({attribute:"preview-open",type:Boolean,reflect:!0})],x.prototype,"previewOpen",void 0),M([_({attribute:"preview-label",type:String,reflect:!0})],x.prototype,"previewLabel",void 0),M([_({attribute:"preview-collapse-sidebar",type:Boolean,reflect:!0})],x.prototype,"previewCollapseSidebar",void 0),M([_({attribute:"workspace-resizable",type:Boolean,reflect:!0})],x.prototype,"workspaceResizable",void 0),M([_({attribute:"preview-visible",type:Boolean,reflect:!0})],x.prototype,"previewVisible",void 0),M([_({attribute:"preview-reclaiming",type:Boolean,reflect:!0})],x.prototype,"previewReclaiming",void 0),x=M([ne("esp-page")],x);export{x as EspalierPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class r{constructor(t,i){this.min=t,this.max=i}static of(t,i){const e=Math.max(0,t);return new r(e,Math.max(e,i))}static exactly(t){return r.of(t,t)}clamp(t){return Math.min(Math.max(t,this.min),this.max)}headroom(t){return Math.max(0,this.max-t)}cappedAt(t){return r.of(this.min,Math.min(this.max,t))}}function a(m){return m.value?.getBoundingClientRect().width??0}class s{constructor(t,i,e){this.minProbe=t,this.defaultProbe=i,this.maxProbe=e}get minimum(){return Math.max(0,a(this.minProbe))}get maximum(){return Math.max(this.minimum,a(this.maxProbe))}get defaultWidth(){return a(this.defaultProbe)}bounds(){return r.of(this.minimum,this.maximum)}}class n{constructor(t,i){this.left=t,this.right=i}get width(){return Math.max(0,this.right-this.left)}}export{n as InlineBounds,s as PaneProbes,r as WidthRange,a as probeWidth};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type PropertyValues } from "lit";
|
|
2
2
|
import "./esp-picker-item.js";
|
|
3
3
|
import "./esp-picker-menu.js";
|
|
4
|
+
import { type PickerItem } from "./esp-picker-item.js";
|
|
4
5
|
import { EspalierPickerBase } from "./esp-picker-base.js";
|
|
5
|
-
import type { TypeaheadFetchItems } from "./types.js";
|
|
6
6
|
/**
|
|
7
7
|
* Component for selecting a single option from a list of
|
|
8
8
|
* options. For selecting multiple options, see
|
|
@@ -133,6 +133,13 @@ import type { TypeaheadFetchItems } from "./types.js";
|
|
|
133
133
|
* @customElement esp-pick-one
|
|
134
134
|
*/
|
|
135
135
|
export declare class EspalierPickOne extends EspalierPickerBase {
|
|
136
|
+
protected decorateFilteredItems(items: PickerItem[]): PickerItem[];
|
|
137
|
+
protected get typeaheadRestoreText(): string;
|
|
138
|
+
/**
|
|
139
|
+
* Single-select keeps the last remote result set only while something is
|
|
140
|
+
* selected, so reopening shows the same list with the pick highlighted.
|
|
141
|
+
*/
|
|
142
|
+
protected get preservesRemoteResultsOnReset(): boolean;
|
|
136
143
|
/**
|
|
137
144
|
* The currently selected item value, or `undefined` when no item
|
|
138
145
|
* is selected.
|
|
@@ -142,31 +149,6 @@ export declare class EspalierPickOne extends EspalierPickerBase {
|
|
|
142
149
|
*/
|
|
143
150
|
get value(): string | undefined;
|
|
144
151
|
set value(val: string | undefined);
|
|
145
|
-
/**
|
|
146
|
-
* When true, the picker input becomes a typeahead search field.
|
|
147
|
-
* The user types to filter the option list. The match is
|
|
148
|
-
* constrained — the user must pick from the filtered results.
|
|
149
|
-
*
|
|
150
|
-
* @type {boolean}
|
|
151
|
-
*/
|
|
152
|
-
typeahead: boolean;
|
|
153
|
-
/**
|
|
154
|
-
* Async callback for fetching items from a remote source.
|
|
155
|
-
* When set alongside `typeahead`, the picker delegates to this
|
|
156
|
-
* callback instead of filtering locally.
|
|
157
|
-
*
|
|
158
|
-
* The callback receives the current query string and an
|
|
159
|
-
* `AbortSignal` that the component will abort when a newer
|
|
160
|
-
* query arrives before the previous request completes.
|
|
161
|
-
*/
|
|
162
|
-
fetchItems: TypeaheadFetchItems | null;
|
|
163
|
-
/**
|
|
164
|
-
* Debounce delay in milliseconds for typeahead input. Defaults
|
|
165
|
-
* to `0` for local filtering and `300` for remote fetching.
|
|
166
|
-
*
|
|
167
|
-
* @type {number}
|
|
168
|
-
*/
|
|
169
|
-
debounceMs: number | undefined;
|
|
170
152
|
protected getPickerFormValue(): string | null;
|
|
171
153
|
protected getPickerValidity(): {
|
|
172
154
|
flags: ValidityStateFlags;
|
|
@@ -174,10 +156,7 @@ export declare class EspalierPickOne extends EspalierPickerBase {
|
|
|
174
156
|
} | null;
|
|
175
157
|
protected handlePickerReset(): void;
|
|
176
158
|
protected handlePickerRestore(state: string): void;
|
|
177
|
-
protected
|
|
178
|
-
protected get showOptions(): boolean;
|
|
179
|
-
protected willUpdate(changedProperties: PropertyValues): void;
|
|
180
|
-
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
159
|
+
protected syncSelectionFromItems(changedProperties: PropertyValues): void;
|
|
181
160
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
182
161
|
static styles: import("lit").CSSResult[];
|
|
183
162
|
}
|
|
@@ -1,75 +1,43 @@
|
|
|
1
|
-
var h=function(
|
|
1
|
+
var h=function(a,e,n,t){var i=arguments.length,s=i<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,n):t,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(a,e,n,t);else for(var l=a.length-1;l>=0;l--)(o=a[l])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s};import{css as d,html as m}from"lit";import{customElement as f,property as I,state as y}from"lit/decorators.js";import{classMap as g}from"lit/directives/class-map.js";import{ref as p}from"lit/directives/ref.js";import"./esp-picker-item.js";import"./esp-picker-menu.js";import{EspalierElementBase as k}from"../shared/esp-element-base.js";import{styleMap as P}from"lit/directives/style-map.js";import{caretUpDown as w}from"../shared/svgs/caret-up-down.js";import{filter as v}from"../shared/svgs/filter.js";import{EspalierPickerBase as u}from"./esp-picker-base.js";import{PickOneSelection as r}from"./pick-one-selection.js";let c=class extends u{constructor(){super(...arguments),this.selection=r.empty(),this.suppressAutoSelect=!1,this.lastMenuPointSelectionAt=Number.NEGATIVE_INFINITY,this.suppressNextHostClick=!1,this.handleHostPointerDown=e=>{this.selectOpenMenuAtPoint(e)&&(this.lastMenuPointSelectionAt=performance.now())},this.handleHostMouseDown=e=>{if(performance.now()-this.lastMenuPointSelectionAt<500){e.preventDefault(),e.stopPropagation();return}this.selectOpenMenuAtPoint(e)}}get selectedItem(){return this.selection.item}decorateFilteredItems(e){if(!this.selectedItem)return e.map(t=>({...t}));const n=this.selectedItem.value;return e.map(t=>({...t,selected:t.value===n}))}get typeaheadRestoreText(){return this.selectedItem?.text??""}get preservesRemoteResultsOnReset(){return this.typeaheadIsRemote&&this.selectedItem!==void 0}get value(){return this.selectedItem?.value}set value(e){const n=this.pickerItems??[];for(const i of n)i.selected=i.value===e;const t=this.pickerMenu.value?.pickerItems;if(t&&t!==n)for(const i of t)i.selected=i.value===e;this.selection=r.resolve(n,e),this.formCtrl.syncValue()}getPickerFormValue(){return this.selectedItem?.value??null}getPickerValidity(){return this.required&&!this.selectedItem?{flags:{valueMissing:!0},message:this.requiredMessage||"Please select an option."}:null}handlePickerReset(){this.selection=r.empty()}handlePickerRestore(e){this.value=e}syncSelectionFromItems(e){if(e.has("pickerItems")){if(this.selection.hasPending){this.value=this.selection.pending;return}if(!this.selectedItem){const n=this.pickerItems.find(t=>t.selected);n&&(this.selection=r.of(n))}}}selectOpenMenuAtPoint(e){return!this.showOptions||!(this.pickerMenu.value?.selectItemAtPoint(e.clientX,e.clientY)??!1)?!1:(this.suppressNextHostClick=!0,e.preventDefault(),e.stopPropagation(),!0)}render(){const{showOptions:e}=this;return m`
|
|
2
2
|
<div
|
|
3
3
|
tabindex="-1"
|
|
4
|
-
class=${
|
|
4
|
+
class=${g({"esp-field":!0,"show-options":e})}
|
|
5
5
|
@pointerdown=${this.handleHostPointerDown}
|
|
6
6
|
@mousedown=${this.handleHostMouseDown}
|
|
7
7
|
@click=${t=>{if(this.suppressNextHostClick){this.suppressNextHostClick=!1,t.preventDefault(),t.stopPropagation();return}this.typeahead&&!this.showOptions&&(this.suppressAutoSelect=!0),this.theInput.value?.focus(),this.showOptions=!this.showOptions,t.stopPropagation()}}
|
|
8
8
|
>
|
|
9
9
|
<section>
|
|
10
10
|
<input
|
|
11
|
-
${
|
|
11
|
+
${p(this.theInput)}
|
|
12
12
|
class="esp-input"
|
|
13
13
|
value=${this.selectedItem?.text??""}
|
|
14
|
-
style=${
|
|
14
|
+
style=${P(this.selectedItem?.styles??{})}
|
|
15
15
|
placeholder=${this.placeholder}
|
|
16
16
|
?readonly=${!this.typeahead}
|
|
17
|
-
@input=${
|
|
17
|
+
@input=${this.handleTypeaheadInput}
|
|
18
18
|
@focus=${()=>{this.inputFocused=!0,this.typeahead&&!this.suppressAutoSelect&&this.theInput.value?.select(),this.suppressAutoSelect=!1}}
|
|
19
|
-
@blur=${
|
|
20
|
-
@keydown=${t=>{if(this.pickerMenu.value)switch(t.key){case"
|
|
19
|
+
@blur=${this.handleInputBlur}
|
|
20
|
+
@keydown=${t=>{if(this.pickerMenu.value&&!this.handleSharedPickerKeydown(t))switch(t.key){case"ArrowDown":case"ArrowUp":case"Enter":case"Home":case"End":this.handleMenuNavigationKey(t.key,t);break}}}
|
|
21
21
|
/>
|
|
22
22
|
</section>
|
|
23
|
-
<label>${this.typeahead&&this.inputFocused?
|
|
23
|
+
<label>${this.typeahead&&this.inputFocused?v:w}</label>
|
|
24
24
|
|
|
25
25
|
<esp-picker-menu
|
|
26
|
-
.pickerItems=${this.
|
|
26
|
+
.pickerItems=${this.menuItems}
|
|
27
27
|
.loading=${this.typeaheadLoading}
|
|
28
28
|
.emptyMessage=${this.typeahead?"No matches":""}
|
|
29
29
|
.label=${this.placeholder}
|
|
30
30
|
tabindex="-1"
|
|
31
|
-
${
|
|
32
|
-
@selection-changed=${t=>{if(t.stopPropagation(),this.typeahead)return;const
|
|
33
|
-
@close-menu=${t=>{if(this.showOptions=!1,this.clearActiveDescendant(),this.typeahead){const
|
|
31
|
+
${p(this.pickerMenu)}
|
|
32
|
+
@selection-changed=${t=>{if(t.stopPropagation(),this.typeahead)return;const i=t.detail,s=i.length>0?i[0]:void 0;(i.length>0?this.selectedItem!==s:this.selectedItem!==void 0)&&(this.selection=this.showOptions?r.of(s):this.selection.withProvisionalItem(s),this.formCtrl.syncValue(),this.emitValueChanged(this.selectedItem))}}
|
|
33
|
+
@close-menu=${t=>{if(this.showOptions=!1,this.clearActiveDescendant(),this.typeahead){const i=t.detail,s=i.length>0?i[0]:void 0;if(s?this.selectedItem?.value!==s.value:this.selectedItem!==void 0){if(this.selection=r.of(s),s)for(const l of this.pickerItems)l.selected=l.value===s.value;this.formCtrl.syncValue(),this.emitValueChanged(this.selectedItem)}this.suppressAutoSelect=!0,this.theInput.value?.focus(),this.resetTypeaheadInput()}else this.theInput.value?.focus()}}
|
|
34
34
|
>
|
|
35
35
|
</esp-picker-menu>
|
|
36
36
|
</div>
|
|
37
|
-
<slot ${
|
|
38
|
-
`}};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
<slot ${p(this.itemsSlot)}></slot>
|
|
38
|
+
`}};c.styles=[...k.styles,u.pickerFieldStyles,d`
|
|
39
|
+
.esp-field input.esp-input {
|
|
40
|
+
width: 0;
|
|
41
|
+
flex-grow: 1;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
.esp-field {
|
|
45
|
-
display: grid;
|
|
46
|
-
grid-template-columns: auto min-content;
|
|
47
|
-
position: relative;
|
|
48
|
-
|
|
49
|
-
& input.esp-input {
|
|
50
|
-
width: 0;
|
|
51
|
-
flex-grow: 1;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
> section {
|
|
55
|
-
cursor: pointer;
|
|
56
|
-
display: flex;
|
|
57
|
-
flex-wrap: wrap;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
> label {
|
|
61
|
-
display: grid;
|
|
62
|
-
place-content: center;
|
|
63
|
-
cursor: pointer;
|
|
64
|
-
|
|
65
|
-
> svg {
|
|
66
|
-
height: var(--esp-size-normal-to-medium);
|
|
67
|
-
width: var(--esp-size-normal-to-medium);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
:host([typeahead]) .esp-field > section {
|
|
73
|
-
cursor: text;
|
|
74
|
-
}
|
|
75
|
-
`],h([r()],n.prototype,"selectedItem",void 0),h([r()],n.prototype,"typeaheadLoading",void 0),h([r()],n.prototype,"filteredItems",void 0),h([r()],n.prototype,"inputFocused",void 0),h([p({type:String})],n.prototype,"value",null),h([p({type:Boolean,reflect:!0})],n.prototype,"typeahead",void 0),h([p({attribute:!1})],n.prototype,"fetchItems",void 0),h([p({type:Number,attribute:"debounce-ms"})],n.prototype,"debounceMs",void 0),n=h([m("esp-pick-one")],n);export{n as EspalierPickOne};
|
|
43
|
+
`],h([y()],c.prototype,"selection",void 0),h([I({type:String})],c.prototype,"value",null),c=h([f("esp-pick-one")],c);export{c as EspalierPickOne};
|
|
@@ -3,7 +3,6 @@ import "./esp-picker-item.js";
|
|
|
3
3
|
import "./esp-picker-menu.js";
|
|
4
4
|
import { type PickerItem } from "./esp-picker-item.js";
|
|
5
5
|
import { EspalierPickerBase } from "./esp-picker-base.js";
|
|
6
|
-
import type { TypeaheadFetchItems } from "./types.js";
|
|
7
6
|
/**
|
|
8
7
|
* Component for selecting multiple options from a list of options.
|
|
9
8
|
*
|
|
@@ -154,34 +153,13 @@ import type { TypeaheadFetchItems } from "./types.js";
|
|
|
154
153
|
* @customElement esp-pick-some
|
|
155
154
|
*/
|
|
156
155
|
export declare class EspalierPickSome extends EspalierPickerBase {
|
|
156
|
+
protected decorateFilteredItems(items: PickerItem[]): PickerItem[];
|
|
157
|
+
/** Multi-select always clears the input — chips carry the selection. */
|
|
158
|
+
protected get typeaheadRestoreText(): string;
|
|
157
159
|
/**
|
|
158
160
|
* The values of all currently selected items.
|
|
159
161
|
*/
|
|
160
162
|
get values(): Array<string>;
|
|
161
|
-
/**
|
|
162
|
-
* When true, the picker input becomes a typeahead search field.
|
|
163
|
-
* The user types to filter the option list.
|
|
164
|
-
*
|
|
165
|
-
* @type {boolean}
|
|
166
|
-
*/
|
|
167
|
-
typeahead: boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Async callback for fetching items from a remote source.
|
|
170
|
-
* When set alongside `typeahead`, the picker delegates to this
|
|
171
|
-
* callback instead of filtering locally.
|
|
172
|
-
*
|
|
173
|
-
* The callback receives the current query string and an
|
|
174
|
-
* `AbortSignal` that the component will abort when a newer
|
|
175
|
-
* query arrives before the previous request completes.
|
|
176
|
-
*/
|
|
177
|
-
fetchItems: TypeaheadFetchItems | null;
|
|
178
|
-
/**
|
|
179
|
-
* Debounce delay in milliseconds for typeahead input. Defaults
|
|
180
|
-
* to `0` for local filtering and `300` for remote fetching.
|
|
181
|
-
*
|
|
182
|
-
* @type {number}
|
|
183
|
-
*/
|
|
184
|
-
debounceMs: number | undefined;
|
|
185
163
|
/**
|
|
186
164
|
* Callback for adding a new value when the user types text
|
|
187
165
|
* that does not match any existing item. The callback receives
|
|
@@ -199,10 +177,7 @@ export declare class EspalierPickSome extends EspalierPickerBase {
|
|
|
199
177
|
} | null;
|
|
200
178
|
protected handlePickerReset(): void;
|
|
201
179
|
protected handlePickerRestore(state: string): void;
|
|
202
|
-
protected
|
|
203
|
-
protected get showOptions(): boolean;
|
|
204
|
-
protected willUpdate(changedProperties: PropertyValues): void;
|
|
205
|
-
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
180
|
+
protected syncSelectionFromItems(changedProperties: PropertyValues): void;
|
|
206
181
|
protected render(): TemplateResult<1>;
|
|
207
182
|
static styles: import("lit").CSSResult[];
|
|
208
183
|
}
|