@taprootio/espalier 6.12.0 → 6.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/css/esp-reset.css +17 -0
- package/custom-elements.json +37178 -35039
- package/dist/button/esp-button.d.ts +10 -1
- package/dist/button/esp-button.js +58 -31
- package/dist/columns/esp-columns.d.ts +52 -0
- package/dist/columns/esp-columns.js +45 -0
- package/dist/header/esp-header-button.js +8 -7
- package/dist/header/esp-header.d.ts +40 -0
- package/dist/header/esp-header.js +207 -47
- package/dist/header/header-geometry-controller.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/menu/esp-menu-item.d.ts +18 -1
- package/dist/menu/esp-menu-item.js +79 -17
- package/dist/menu/esp-menu.js +18 -14
- package/dist/menu/menu-presentation.d.ts +1 -0
- package/dist/menu/menu-presentation.js +15 -14
- package/dist/menu/swipe-reveal-controller.js +1 -1
- package/dist/page/bi-directional-sticky-controller.js +1 -1
- package/dist/page/esp-page.d.ts +10 -2
- package/dist/page/esp-page.js +37 -35
- package/dist/page/esp-page.styles.js +36 -0
- package/dist/row/esp-row.js +3 -26
- package/dist/shared/configured-brand.d.ts +3 -1
- package/dist/shared/configured-brand.js +5 -5
- package/dist/shared/layout-gap.js +5 -0
- package/dist/stack/esp-stack.js +3 -26
- package/espalier.css-data.json +17 -1
- package/espalier.token-manifest.json +25 -1
- package/package.json +5 -1
package/dist/page/esp-page.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
var W=function(N,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(N,e,t,i);else for(var a=N.length-1;a>=0;a--)(o=N[a])&&(r=(s<3?o(r):s>3?o(e,t,r):o(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r};import{html as le,nothing as E}from"lit";import{customElement as he,property as z,state as q}from"lit/decorators.js";import{classMap as de}from"lit/directives/class-map.js";import{createRef as R,ref as P}from"lit/directives/ref.js";import{EspalierElementBase as pe}from"../shared/esp-element-base.js";import{BiDirectionalStickyController as H}from"./bi-directional-sticky-controller.js";import{getEspBus as ue}from"../shared/bus-events.js";import{RafThrottle as ce}from"../shared/raf-throttle.js";import{InlineBounds as ve,PaneProbes as j,PREVIEW_LAYOUT_EPSILON as l,probeWidth as we,WidthRange as _}from"./workspace-width.js";import{absorbWorkspaceSurplus as me,clampWorkspaceWidth as O,workspaceTargetWidth as fe,workspaceWidthCapacityForAvailable as Q}from"./workspace-geometry.js";import{slotHasContent as re}from"../shared/slot-content.js";import"../toaster/esp-toaster.js";import{pageStyles as ye}from"./esp-page.styles.js";import{COMPACT_VIEWPORT_MEDIA_QUERY as ge}from"../shared/responsive.js";const oe='esp-footer, footer, [role~="contentinfo"]',be=5,We=12,Re=48,Pe=48,ke=16,Me=64;let y=class extends pe{constructor(){super(),this.dialogZone=R(),this.flyoutSlot=R(),this.footerSlot=R(),this.previewSlot=R(),this.sidebarSlot=R(),this.rightSlot=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 ce(()=>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.footerWrapperIsLandmark=!0,this.sidebarHasContent=!1,this.rightHasContent=!1,this.allocatedPreviewWidth=0,this.allocatedFlyoutWidth=0,this.onWorkspaceResizePointerDown=(e,t)=>{this.workspaceResizeController?.onWorkspaceResizePointerDown(e,t)},this.onWorkspaceResizePointerMove=e=>{this.workspaceResizeController?.onWorkspaceResizePointerMove(e)},this.onWorkspaceResizePointerEnd=e=>{this.workspaceResizeController?.onWorkspaceResizePointerEnd(e)},this.onWorkspaceResizeBlur=e=>{this.workspaceResizeController?.onWorkspaceResizeBlur(e)},this.onWorkspaceResizeKeyDown=(e,t)=>{this.workspaceResizeController?.onWorkspaceResizeKeyDown(e,t)},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 s=i.contentRect.width;if(i.target instanceof HTMLElement&&i.target.classList.contains("esp-page-left")){s>l&&!this.hasAttribute("data-preview-navigation-collapsed")&&(this.previewCollapsedSidebarWidth=s);continue}const r=this.previewObservedWidths.get(i.target);this.previewObservedWidths.set(i.target,s),t||=r===void 0||Math.abs(r-s)>.25}t&&this.schedulePreviewLayout(!0)},this.onSidebarSlotChange=()=>{this.syncAsideContent(),this.schedulePreviewLayout()},this.kind="wide",this.align="start",this.contained=!1,this.headerPosition="normal",this.previewOpen=!1,this.sidebarLabel="Sidebar",this.rightLabel="Related",this.previewLabel="Preview",this.previewCollapseSidebar=!1,this.workspaceResizable=!1,this.previewVisible=!1,this.previewReclaiming=!1,this.warnedSiteRails=!1,new H(this,".esp-page-left > .sticky-wrapper"),new H(this,".esp-page-right > .sticky-wrapper"),new H(this,".esp-page-flyout > .sticky-wrapper",{topOffset:()=>this.flyoutFullHeightActive?0:void 0}),new H(this,".esp-page-preview > .sticky-wrapper",{topOffset:()=>0}),this.addEventListener("esp-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)),this.syncAsideContent(),super.connectedCallback(),this.syncMainMaximumConfiguration(),this.ensureWorkspaceResizeController(),this.hasUpdated&&queueMicrotask(()=>this.setupPreviewLayoutObserver())}disconnectedCallback(){this.toggleAttribute("data-workspace-resize-ready",!1),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=a=>{const n=a;return(typeof n.mode=="string"?n.mode:a.getAttribute("mode"))==="overlay"||n.pageOverlayRequested===!0},i=a=>{const n=a.open;return typeof n=="boolean"?n:a.hasAttribute("open")},s=a=>a.anchor!=null,r=a=>{const n=a.fullHeight;return typeof n=="boolean"?n:a.hasAttribute("full-height")},o=(this.flyoutSlot.value?.assignedElements()??[]).filter(a=>a.tagName==="ESP-FLYOUT");for(const a of o){const n=a,p=typeof n.mode=="string"?n.mode:a.getAttribute("mode");n.pageOverlayRequested&&(!i(a)||p!=="auto")&&(n.pageOverlayRequested=!1)}o.some(a=>a.pageOverlayRequested===!0)||this.clearFlyoutOverlayRecovery(),this.toggleAttribute("flyout-open",o.some(a=>i(a)&&!t(a))),this.toggleAttribute("flyout-overlay-open",o.some(a=>i(a)&&t(a))),this.toggleAttribute("flyout-anchored",o.some(a=>i(a)&&s(a))),this.flyoutFullHeightActive=o.some(a=>i(a)&&!t(a)&&r(a)),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,s=typeof i.open=="boolean"?i.open:t.hasAttribute("open"),r=typeof i.mode=="string"?i.mode:t.getAttribute("mode");return s&&(r==="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 s of this.assignedFlyouts()){const r=e&&i.has(s);s.pageOverlayRequested!==r&&(s.pageOverlayRequested=r,t=!0)}return t&&await Promise.all(this.assignedFlyouts().map(s=>s.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?re(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 s=typeof t.drawerTarget=="string"?t.drawerTarget:t.getAttribute("drawer-target")??"",r=typeof i.mode=="string"?i.mode:i.getAttribute("mode");return s!==i.id||r!=="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,s=this.previewHeader&&this.previewHeader!==t?.header?this.previewHeader:null,r=this.previewMenu&&this.previewMenu!==t?.menu?this.previewMenu:null;if(s&&(s.previewCollapseRequested=!1),r&&(r.previewCollapseRequested=!1),this.previewHeader=t?.header??null,this.previewMenu=t?.menu??null,this.toggleAttribute("data-preview-navigation-collapsed",!1),await s?.updateComplete,await r?.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)})}createWorkspaceResizeHost(){const e=this;return{element:e,get previewSyncTask(){return e.previewSyncTask},get previewNavigationCollapseTask(){return e.previewNavigationCollapseTask},get previewSyncFrame(){return e.previewSyncFrame},get previewSyncGeneration(){return e.previewSyncGeneration},set previewSyncGeneration(t){e.previewSyncGeneration=t},get previewVisible(){return e.previewVisible},get allocatedPreviewWidth(){return e.allocatedPreviewWidth},get allocatedFlyoutWidth(){return e.allocatedFlyoutWidth},get preferredPreviewWidth(){return e.preferredPreviewWidth},set preferredPreviewWidth(t){e.preferredPreviewWidth=t},get preferredFlyoutWidth(){return e.preferredFlyoutWidth},set preferredFlyoutWidth(t){e.preferredFlyoutWidth=t},get align(){return e.align},get previewProbes(){return e.previewProbes},get flyoutProbes(){return e.flyoutProbes},get mainProbes(){return e.mainProbes},get mainMaxWidthProbe(){return e.mainMaxWidthProbe},schedulePreviewLayout:t=>e.schedulePreviewLayout(t),setWorkspaceWidths:(t,i,s)=>e.setWorkspaceWidths(t,i,s),setPreviewLayoutState:(t,i)=>e.setPreviewLayoutState(t,i)}}createWorkspaceResizeGeometry(){return{separatorIsAvailable:e=>this.separatorIsAvailable(e),mainResizeGrowthCapacity:e=>this.mainResizeGrowthCapacity(e),trailingPaneResizeRange:(e,t,i)=>this.trailingPaneResizeRange(e,t,i),mainPreviewResizeRange:(e,t,i)=>this.mainPreviewResizeRange(e,t,i),workspaceWidthCapacity:(e,t,i)=>this.workspaceWidthCapacity(e,t,i),flyoutOnlyResizeRange:(e,t)=>this.flyoutOnlyResizeRange(e,t),previewFlyoutResizeRange:(e,t)=>this.previewFlyoutResizeRange(e,t),probeWidth:e=>this.probeWidth(e),mainTrackUnbounded:()=>this.mainTrackUnbounded(),renderedWorkspaceWidths:()=>this.renderedWorkspaceWidths(),workspaceLogicalGutterWidths:()=>this.workspaceLogicalGutterWidths(),previewNavigationResizeAllowance:()=>this.previewNavigationResizeAllowance(),workspaceResizeDirection:()=>this.workspaceResizeDirection(),syncTrailingWorkspaceResizeAvailability:()=>this.syncTrailingWorkspaceResizeAvailability()}}ensureWorkspaceResizeController(){if(!this.workspaceResizable||!this.isConnected){this.toggleAttribute("data-workspace-resize-ready",!1);return}if(this.workspaceResizeController){this.toggleAttribute("data-workspace-resize-ready",!0);return}if(this.workspaceResizeControllerLoad)return;this.toggleAttribute("data-workspace-resize-ready",!1);const e=import("./workspace-resize-session.js").then(({WorkspaceResizeSessionController:t})=>{!this.workspaceResizable||!this.isConnected||(this.workspaceResizeController=new t(this.createWorkspaceResizeHost(),this.createWorkspaceResizeGeometry(),{requestPreviewNavigationCollapse:()=>this.requestPreviewNavigationCollapse(),resizeStep:i=>this.resizeStep(i)}),this.toggleAttribute("data-workspace-resize-ready",this.workspaceResizable))}).catch(t=>{this.toggleAttribute("data-workspace-resize-ready",!1),console.warn("<esp-page>: workspace resizing could not be loaded; retry is available",t)}).finally(()=>{this.workspaceResizeControllerLoad===e&&(this.workspaceResizeControllerLoad=void 0)});this.workspaceResizeControllerLoad=e}get resizeSession(){return this.workspaceResizeController?.currentSession??null}finishWorkspaceKeyboardResize(e=!0){this.workspaceResizeController?.finishWorkspaceKeyboardResize(e)}endWorkspaceResize(){this.workspaceResizeController?.endWorkspaceResize()}clearWorkspaceRecenteringState(){this.workspaceResizeController?.clearWorkspaceRecenteringState()}setPreviewLayoutState(e,t){this.previewVisible=e,this.previewReclaiming=e&&t,e||this.endWorkspaceResize()}setWorkspaceWidths(e,t,i=!1){const s=Math.max(0,e),r=Math.max(0,t);this.style.setProperty("--_esp-page-preview-used-width",`${s}px`),this.style.setProperty("--_esp-page-flyout-used-width",`${r}px`),this.toggleAttribute("data-workspace-targeted",i),this.allocatedPreviewWidth=s,this.allocatedFlyoutWidth=r}visiblePageInlineBounds(){const e=this.getBoundingClientRect();let t=e.left,i=e.right;const s=window.visualViewport,r=s?.offsetLeft??0,o=s?.width??document.documentElement.clientWidth;o>0&&(t=Math.max(t,r),i=Math.min(i,r+o));const a=this.getRootNode();let n=this.parentElement??(a instanceof ShadowRoot?a.host:null);for(;n;){const p=getComputedStyle(n).overflowX;if(["auto","clip","hidden","scroll"].includes(p)){const v=n.getBoundingClientRect();t=Math.max(t,v.left),i=Math.min(i,v.right)}const u=n.getRootNode();n=n.parentElement??(u instanceof ShadowRoot?u.host:null)}return new ve(t,i)}probeWidth(e){return we(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 s=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,r=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,o=Math.max(0,this.visiblePageInlineBounds().width-s-r-Math.max(0,i));return Q(o,e,t)}allocateWorkspaceWidths(e,t,i,s,r,o,a,n=null,p=null){const u=Math.max(0,e),v=Math.max(0,s),h=Math.max(v,r),w=Math.max(0,o),k=Math.max(w,a),m=t?this.preferredPreviewWidth??(n===null?null:O(n,v,h)):null,x=i?this.preferredFlyoutWidth??(p===null?null:O(p,w,k)):null;let g=0,d=0;t&&i?(g=Math.min(h,Math.max(v,u-w)),d=Math.min(k,Math.max(w,u-g))):t?g=Math.min(h,Math.max(v,u)):i&&(d=Math.min(k,Math.max(w,u))),t&&m!==null&&(g=O(m,v,h),i&&x===null&&(d=O(u-g,w,k))),i&&x!==null&&(d=O(x,w,k),t&&m===null&&(g=O(u-d,v,h)));let M=g+d-u;if(M>0&&i){const F=Math.min(M,Math.max(0,d-w));d-=F,M-=F}return M>0&&t&&(g-=Math.min(M,Math.max(0,g-v))),{previewWidth:g,flyoutWidth:d}}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(),s=t.getBoundingClientRect(),r=this.workspaceResizeDirection()===1?i.right-s.right:s.left-i.left;return{leading:e,trailing:Math.max(0,r)}}syncTrailingWorkspaceResizeAvailability(){const{trailing:e}=this.workspaceLogicalGutterWidths();this.toggleAttribute("data-workspace-trailing-edge-exposed",this.trailingWorkspaceSeparator()!==null&&e>l)}trailingPaneResizeRange(e,t,i){const s=e==="preview-end"?this.previewMinWidthProbe:this.flyoutMinWidthProbe,r=e==="preview-end"?this.previewMaxWidthProbe:this.flyoutMaxWidthProbe,o=Math.max(0,this.probeWidth(s)),a=Math.max(o,this.probeWidth(r));return _.of(o,a).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?Me:ke}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 s=this.previewProbes.minimum,r=this.previewProbes.maximum,o=this.mainProbes.minimum,a=Math.max(0,t+e),n=Math.max(0,a+i-o);return _.of(s,Math.max(s,Math.min(r,n)))}previewFlyoutResizeRange(e=this.renderedWorkspaceWidths().previewWidth,t=this.renderedWorkspaceWidths().flyoutWidth){const i=this.previewProbes.minimum,s=this.previewProbes.maximum,r=this.flyoutProbes.minimum,o=this.flyoutProbes.maximum,a=e+t;return _.of(Math.max(i,a-o),Math.max(i,Math.min(s,a-r)))}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,s=this.flyoutProbes.maximum,r=this.mainProbes.minimum,o=this.probeWidth(this.mainMaxWidthProbe),a=Math.max(0,t+e),n=o>0?Math.max(0,a-o):0,p=Math.max(i,n);return _.of(p,Math.min(s,a-r))}mainTrackUnbounded(){return this.kind==="site"||this.kind==="full"&&!this.hasAttribute("data-main-max-configured")}mainResizeGrowthCapacity(e){return this.mainTrackUnbounded()?Number.POSITIVE_INFINITY:Math.max(0,this.probeWidth(this.mainMaxWidthProbe)-e)}previewFitsWithinPage(e,t,i,s,r,o){const a=this.shadowRoot?.querySelector(".esp-page-main"),n=this.shadowRoot?.querySelector(".esp-page-preview"),p=this.shadowRoot?.querySelector(".esp-page-flyout");if(!a||!n||!p)return!1;const u=this.visiblePageInlineBounds(),v=a.getBoundingClientRect(),h=n.getBoundingClientRect(),w=p.getBoundingClientRect(),k=Math.max(t,i),m=Math.max(r,o),x=h.width+l>=t&&h.width<=k+l,g=!s||w.width+l>=r&&w.width<=m+l,d=h.left+l>=u.left&&h.right<=u.right+l&&(!s||w.left+l>=u.left&&w.right<=u.right+l),M=getComputedStyle(this).direction==="rtl"?v.left+l>=h.right&&(!s||h.left+l>=w.right):v.right<=h.left+l&&(!s||h.right<=w.left+l);return v.width+l>=e&&x&&g&&d&&M}flyoutFitsWithinPage(e,t,i){const s=this.shadowRoot?.querySelector(".esp-page-main"),r=this.shadowRoot?.querySelector(".esp-page-flyout");if(!s||!r)return!1;const o=this.visiblePageInlineBounds(),a=s.getBoundingClientRect(),n=r.getBoundingClientRect(),p=Math.max(t,i),u=n.width+l>=t&&n.width<=p+l,v=n.left+l>=o.left&&n.right<=o.right+l,h=getComputedStyle(this).direction==="rtl"?a.left+l>=n.right:a.right<=n.left+l;return a.width+l>=e&&u&&v&&h}workspaceMinimumsCanFit(e,t,i,s,r){const o=this.visiblePageInlineBounds().width;if(o<=0||e<=0||t&&i<=0||s&&r<=0)return!1;const a=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,n=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,u=(t&&this.getPreviewNavigationPair()!==null?0:a)+n+e+(t?i:0)+(s?r:0);return o+l>=u}workspaceGeometrySample(){const e=this.visiblePageInlineBounds(),t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect(),i=this.shadowRoot?.querySelector(".esp-page-preview")?.getBoundingClientRect(),s=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,s?.left??0,s?.right??0,s?.width??0]}workspaceGeometryMatches(e,t){return e.length===t.length&&e.every((i,s)=>Math.abs(i-(t[s]??i))<=l)}workspaceCandidateIsMeasurable(e,t){const i=this.shadowRoot?.querySelector(".esp-page-preview")?.getBoundingClientRect().width??0,s=this.shadowRoot?.querySelector(".esp-page-flyout")?.getBoundingClientRect().width??0;return(!e||i>l)&&(!t||s>l)}async candidateFitsAfterLayoutSettles(e,t,i){if(await this.updateComplete,e!==this.previewSyncGeneration||!this.isConnected)return null;let s=null,r=0;for(let o=0;o<We;o+=1){if(await new Promise(n=>requestAnimationFrame(()=>n())),e!==this.previewSyncGeneration||!this.isConnected)return null;if(t())return!0;if(!i()){s=null,r=0;continue}const a=this.workspaceGeometrySample();if(r=s&&this.workspaceGeometryMatches(s,a)?r+1:1,r>=be)return!1;s=a}return null}async promoteFlyoutIfClipped(e,t,i,s){if(i<=0)return!1;const r=await this.candidateFitsAfterLayoutSettles(e,()=>this.flyoutFitsWithinPage(t,i,s),()=>this.workspaceCandidateIsMeasurable(!1,!0));return r===null?!0:r?!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 s=this.previewVisible;this.toggleAttribute("data-preview-measuring",!0);try{const r=this.previewOpen&&this.previewHasContent(),o=this.previewMediaQuery?.matches??!1,a=this.hasAttribute("flyout-overlay-open"),n=this.hasAttribute("flyout-open"),p=this.hasAttribute("data-preview-navigation-collapsed"),u=this.getPreviewNavigationPair(),v=u===null?0:p?this.previewCollapsedSidebarWidth:this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,h=this.probeWidth(this.previewMinWidthProbe),w=this.optionalWidth("--esp-page-preview-default-width",this.previewDefaultWidthProbe),k=this.probeWidth(this.previewMaxWidthProbe),m=this.probeWidth(this.flyoutMinWidthProbe),x=this.optionalWidth("--esp-page-flyout-default-width",this.flyoutDefaultWidthProbe),g=this.probeWidth(this.flyoutMaxWidthProbe),d=this.probeWidth(this.mainMinWidthProbe);this.syncMainMaximumConfiguration();const M=this.probeWidth(this.mainMaxWidthProbe),F=this.mainTrackUnbounded()?0:M,V=this.openAutoFlyouts().some(b=>b.pageOverlayRequested===!0);if(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),V){const b=this.visiblePageInlineBounds().width,S=this.flyoutOverlayPromotionWidth===null||b>=this.flyoutOverlayPromotionWidth+Re;!o&&t&&this.flyoutOverlayRecoveryReady&&S&&this.workspaceMinimumsCanFit(d,r,h,!0,m)?await this.setPageFlyoutOverlay(!1):o&&await this.setPageFlyoutOverlay(!1);return}if(await this.updateComplete,e!==this.previewSyncGeneration)return;const C=r&&!o&&!a,c=n&&!o;if(d>0&&(!C||h>0)&&(!c||m>0)&&(C||c)&&!this.workspaceMinimumsCanFit(d,C,h,c,m)){c&&await this.promoteFlyoutToOverlay();return}const $=(C?h:0)+(c?m:0),B=C&&this.preferredPreviewWidth!==null||c&&this.preferredFlyoutWidth!==null,I=B||(C&&w!==null||c&&x!==null),X=(C?this.preferredPreviewWidth===null?h:O(this.preferredPreviewWidth,h,k):0)+(c?this.preferredFlyoutWidth===null?m:O(this.preferredFlyoutWidth,m,g):0),f=(b,S,A,D)=>[O(b??D??S,S,A),A],L=b=>{const S=fe(b,$,X),A=this.allocateWorkspaceWidths(S,C,c,h,k,m,g,w,x),D=C&&B&&me(Math.min(b.natural,b.maximum),f(this.preferredPreviewWidth,h,k,w),c?f(this.preferredFlyoutWidth,m,g,x):null)||A,ie=b.maximum+d,se=Math.max(0,ie-b.natural),ne=A.previewWidth+A.flyoutWidth,ae=Math.max(0,Math.min(se,ie-ne));return{allocation:A,shown:D,mainWidth:ae,reclaimsMain:ae+l<se}},K=(b,S)=>Math.abs(b.mainWidth-S.mainWidth)>l||Math.abs(b.allocation.previewWidth-S.allocation.previewWidth)>l||Math.abs(b.allocation.flyoutWidth-S.allocation.flyoutWidth)>l,G=this.workspaceWidthCapacity(d,F,p?v:0),Y=L(G);let T=Y.shown;if(this.setWorkspaceWidths(T.previewWidth,T.flyoutWidth,I),!C||h<=0){c&&await this.promoteFlyoutIfClipped(e,d,m,g);return}if(u!==null&&v>l){const b=G.maximum+d,S=Q(b+v,d,F),A=L(S);(p?K(L(Q(Math.max(0,b-Pe),d,F)),A):Y.reclaimsMain&&K(Y,A))?i=await this.setPreviewNavigationCollapse(!0):await this.setPreviewNavigationCollapse(!1)}else await this.setPreviewNavigationCollapse(!1);if(e!==this.previewSyncGeneration)return;const J=this.workspaceWidthCapacity(d,F);if(J.maximum+l<$){this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,c?m:0),i=!1,c&&await this.promoteFlyoutToOverlay();return}const ee=L(J);if(T=ee.shown,this.setWorkspaceWidths(T.previewWidth,T.flyoutWidth,I),s||this.toggleAttribute("data-preview-validating",!0),this.setPreviewLayoutState(!0,ee.reclaimsMain),await this.updateComplete,e!==this.previewSyncGeneration)return;const te=await this.candidateFitsAfterLayoutSettles(e,()=>this.previewFitsWithinPage(d,h,k,c,m,g),()=>this.workspaceCandidateIsMeasurable(!0,c));if(te===null)return;te?this.toggleAttribute("data-preview-validating",!1):(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,c?m:0),i=!1,c&&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(ge),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(oe)||e.querySelector(oe)!==null}syncAsideContent(){const e=(t,i)=>t?re(t):Array.from(this.children).some(s=>s.getAttribute("slot")===i);this.sidebarHasContent=e(this.sidebarSlot.value,"sidebar"),this.rightHasContent=e(this.rightSlot.value,"right")}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()}async getUpdateComplete(){const e=await super.getUpdateComplete();return await this.workspaceResizeControllerLoad,this.isUpdatePending?super.getUpdateComplete():e}updated(e){super.updated(e),e.has("headerPosition")&&ue().publish("fixed-menus-changed",{fixed:this.headerPosition==="fixed"}),(e.has("previewOpen")||e.has("previewCollapseSidebar")||e.has("align"))&&this.schedulePreviewLayout(!0),e.has("workspaceResizable")&&(this.workspaceResizable?this.ensureWorkspaceResizeController():(this.toggleAttribute("data-workspace-resize-ready",!1),this.finishWorkspaceKeyboardResize(),this.endWorkspaceResize(),this.clearWorkspaceRecenteringState())),this.warnSiteRailSlots()}warnSiteRailSlots(){this.kind!=="site"||this.warnedSiteRails||!["sidebar","right"].some(t=>(this.shadowRoot?.querySelector(`slot[name="${t}"]`)?.assignedElements({flatten:!0}).length??0)>0)||(this.warnedSiteRails=!0,console.warn('Espalier page: kind="site" does not compose with the sidebar/right rails \u2014 sections span the full viewport and the shared well column ignores rail width. Use kind="wide" for railed layouts, or remove the rail slots from a site page.'))}render(){const e=this.headerPosition==="fixed",t=!e&&this.headerPosition==="sticky",i=this.mainPreviewResizeRange(this.renderedWorkspaceWidths().previewWidth,this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,this.previewNavigationResizeAllowance()),s=this.previewProbes.minimum,r=this.flyoutProbes.minimum,o=this.flyoutProbes.maximum,a=this.mainProbes.minimum,n=this.probeWidth(this.mainMaxWidthProbe),p=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,u=this.hasAttribute("flyout-open"),v=p+this.allocatedPreviewWidth,h=i.min<=s+l,w=u&&h?Math.max(0,this.allocatedFlyoutWidth-r):0,k=Math.max(a,v-i.max),m=Math.max(k,Math.max(a,v-i.min)+w),x=n>0?Math.max(k,Math.min(Math.max(a,n),m)):m,g=n>0&&p+l>=n?`${Math.round(p)}px main, ${Math.round(this.allocatedPreviewWidth)}px preview`:E;let d,M;if(this.previewVisible){const f=this.previewFlyoutResizeRange(this.renderedWorkspaceWidths().previewWidth,this.renderedWorkspaceWidths().flyoutWidth),L=this.allocatedPreviewWidth+this.allocatedFlyoutWidth,G=f.min<=s+l?Math.max(0,p-a):0;d=Math.max(r,L-f.max),M=Math.max(d,Math.min(o,L-f.min+G))}else{const f=this.flyoutOnlyResizeRange(this.renderedWorkspaceWidths().flyoutWidth,p);d=f.min,M=f.max}const F=this.previewVisible?"preview-flyout-resize-handle":"main-flyout-resize-handle",V=this.previewVisible?"Resize preview and help panes":"Resize help pane",C=this.previewVisible?`${Math.round(this.allocatedPreviewWidth)}px preview, ${Math.round(this.allocatedFlyoutWidth)}px help`:`${Math.round(this.allocatedFlyoutWidth)}px help`,c=u?"flyout-end":"preview-end",U=c==="flyout-end"?this.allocatedFlyoutWidth:this.allocatedPreviewWidth,$=this.workspaceLogicalGutterWidths(),B=this.trailingPaneResizeRange(c,U,$.leading+$.trailing),Z=c==="flyout-end"?"flyout-end-resize-handle":"preview-end-resize-handle",I=c==="flyout-end"?"Resize help pane from its outer edge":"Resize preview pane from its outer edge";return le`
|
|
2
|
-
<div part="wrapper" class="esp-page ${
|
|
1
|
+
var P=function(T,e,t,i){var r=arguments.length,a=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(T,e,t,i);else for(var s=T.length-1;s>=0;s--)(o=T[s])&&(a=(r<3?o(a):r>3?o(e,t,a):o(e,t))||a);return r>3&&a&&Object.defineProperty(e,t,a),a};import{html as he,nothing as H}from"lit";import{customElement as de,property as x,state as B}from"lit/decorators.js";import{classMap as pe}from"lit/directives/class-map.js";import{createRef as b,ref as W}from"lit/directives/ref.js";import{EspalierElementBase as ue}from"../shared/esp-element-base.js";import{BiDirectionalStickyController as _}from"./bi-directional-sticky-controller.js";import{headerGeometryFor as ce}from"../header/header-geometry-controller.js";import{getEspBus as ve}from"../shared/bus-events.js";import{RafThrottle as ye}from"../shared/raf-throttle.js";import{InlineBounds as me,PaneProbes as j,PREVIEW_LAYOUT_EPSILON as l,probeWidth as fe,WidthRange as D}from"./workspace-width.js";import{absorbWorkspaceSurplus as ge,clampWorkspaceWidth as F,workspaceTargetWidth as we,workspaceWidthCapacityForAvailable as Q}from"./workspace-geometry.js";import{slotHasContent as ae}from"../shared/slot-content.js";import"../toaster/esp-toaster.js";import{pageStyles as be}from"./esp-page.styles.js";import{COMPACT_VIEWPORT_MEDIA_QUERY as We}from"../shared/responsive.js";const oe=["--esp-page-header-expanded-size","--_esp-page-geometry-reservation","--_esp-page-geometry-visible","--_esp-page-header-menu-offset"],ne='esp-footer, footer, [role~="contentinfo"]',Re=5,Pe=12,ke=48,Me=48,Ce=16,Se=64;let g=class extends ue{whenHeaderGeometryReady(){return this.isConnected?this.syncHeaderGeometry():(this.geometryHeader||this.resolveHeaderGeometryReady)&&this.resetHeaderGeometry(),this.headerGeometryReady}resolveHeaderGeometryTarget(){return this.querySelector(':scope > esp-header[slot="header"]')}rearmHeaderGeometryReady(){this.resolveHeaderGeometryReady?.(),this.headerGeometryReady=new Promise(e=>{this.resolveHeaderGeometryReady=e})}finishHeaderGeometryReady(){this.resolveHeaderGeometryReady?.(),this.resolveHeaderGeometryReady=void 0}get fixedVisibleClearance(){return this.headerPosition==="fixed"&&this.geometryRecord?.active&&!this.hasAttribute("data-header-geometry-pending")?this.geometryOffsets?.visible:void 0}updateHeaderGeometry(){for(const e of this.stickyControllers)e.updateHeaderGeometry()}resetHeaderGeometry(){this.headerGeometryGeneration+=1,this.unsubscribeHeaderGeometry?.(),this.unsubscribeHeaderGeometry=void 0,this.headerGeometry?.setOwner(null,!1),this.headerGeometry=void 0,this.geometryHeader=null,this.geometryRecord=void 0,this.geometryOffsets=void 0,this.geometryOffsetObserver?.disconnect(),this.toggleAttribute("data-header-geometry-active",!1),this.toggleAttribute("data-header-geometry-pending",!1);for(const e of oe)this.style.removeProperty(e);this.finishHeaderGeometryReady()}constructor(){super(),this.headerSlot=b(),this.geometryHeader=null,this.headerGeometryGeneration=0,this.headerGeometryReady=Promise.resolve(),this.syncHeaderGeometry=()=>{const e=this.resolveHeaderGeometryTarget();if(e===this.geometryHeader){this.headerGeometry?.setOwner(this,this.headerPosition==="fixed");return}const t=!this.geometryHeader&&this.hasAttribute("data-header-geometry-pending")&&!!this.resolveHeaderGeometryReady;if((!t||!e)&&this.resetHeaderGeometry(),!e){this.updateHeaderGeometry();return}this.geometryHeader=e,t||this.rearmHeaderGeometryReady(),this.toggleAttribute("data-header-geometry-pending",!0),this.updateHeaderGeometry();const i=this.headerGeometryGeneration;customElements.whenDefined("esp-header").then(async()=>{if(await this.updateComplete,!this.isConnected||i!==this.headerGeometryGeneration)return;const r=ce(e);if(r){this.headerGeometry=r,r.setOwner(this,this.headerPosition==="fixed"),this.unsubscribeHeaderGeometry=r.subscribe(this.onHeaderGeometry),this.geometryOffsetObserver=new ResizeObserver(this.resolveGeometryOffsets);for(const a of this.shadowRoot?.querySelectorAll(".header-reservation-probe, .header-visible-probe")??[])this.geometryOffsetObserver.observe(a)}})},this.onHeaderSlotChange=()=>{this.syncHeaderGeometry(),this.schedulePreviewLayout()},this.onHeaderGeometry=e=>{const t=this.geometryRecord,i=t?.active;if(this.geometryRecord=e,!e.active){this.geometryOffsets=void 0,this.toggleAttribute("data-header-geometry-active",!1),this.toggleAttribute("data-header-geometry-pending",!1);for(const a of oe)this.style.removeProperty(a);this.updateHeaderGeometry(),this.finishHeaderGeometryReady();return}if((!i||t?.settled&&!e.settled)&&!this.resolveHeaderGeometryReady&&this.rearmHeaderGeometryReady(),(!i||e.expandedBlockSize<=0)&&this.toggleAttribute("data-header-geometry-pending",!0),this.toggleAttribute("data-header-geometry-active",!0),this.style.setProperty("--esp-page-header-expanded-size",`${e.expandedBlockSize}px`),e.expandedBlockSize<=0)return;const r=this.hasAttribute("data-header-geometry-pending");this.resolveGeometryOffsets(),this.toggleAttribute("data-header-geometry-pending",!1),r&&this.updateHeaderGeometry(),this.headerPosition==="fixed"&&this.headerGeometry?.acknowledgeFixedHost(this),e.settled&&this.finishHeaderGeometryReady()},this.resolveGeometryOffsets=()=>{const e=this.geometryRecord;if(!e?.active||e.expandedBlockSize<=0)return;const t=this.shadowRoot?.querySelector(".esp-page"),i=t?.querySelector(".header-reservation-probe"),r=t?.querySelector(".header-visible-probe");if(!t||!i||!r)return;for(const[s,n]of[["--_esp-page-geometry-expanded",e.expandedBlockSize],["--_esp-page-geometry-current",e.visibleBlockSize]]){const h=`${n}px`;t.style.getPropertyValue(s)!==h&&t.style.setProperty(s,h)}const a=i.getBoundingClientRect().height,o=r.getBoundingClientRect().height;if(!(a===this.geometryOffsets?.reservation&&o===this.geometryOffsets.visible)){this.geometryOffsets={reservation:a,visible:o};for(const[s,n]of[["--_esp-page-geometry-reservation",a],["--_esp-page-geometry-visible",o],["--_esp-page-header-menu-offset",o]]){const h=`${n}px`;this.style.getPropertyValue(s)!==h&&this.style.setProperty(s,h)}this.updateHeaderGeometry()}},this.dialogZone=b(),this.flyoutSlot=b(),this.footerSlot=b(),this.previewSlot=b(),this.sidebarSlot=b(),this.rightSlot=b(),this.previewSpace=b(),this.previewMinWidthProbe=b(),this.previewDefaultWidthProbe=b(),this.previewMaxWidthProbe=b(),this.previewProbes=new j(this.previewMinWidthProbe,this.previewDefaultWidthProbe,this.previewMaxWidthProbe),this.flyoutMinWidthProbe=b(),this.flyoutDefaultWidthProbe=b(),this.flyoutMaxWidthProbe=b(),this.flyoutProbes=new j(this.flyoutMinWidthProbe,this.flyoutDefaultWidthProbe,this.flyoutMaxWidthProbe),this.mainMinWidthProbe=b(),this.mainConfiguredMaxWidthProbe=b(),this.mainMaxWidthProbe=b(),this.mainProbes=new j(this.mainMinWidthProbe,this.mainMaxWidthProbe,this.mainMaxWidthProbe),this.resizeStepProbe=b(),this.resizeLargeStepProbe=b(),this.previewObservedWidths=new WeakMap,this.previewSyncFrame=new ye(()=>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.footerWrapperIsLandmark=!0,this.sidebarHasContent=!1,this.rightHasContent=!1,this.allocatedPreviewWidth=0,this.allocatedFlyoutWidth=0,this.onWorkspaceResizePointerDown=(e,t)=>{this.workspaceResizeController?.onWorkspaceResizePointerDown(e,t)},this.onWorkspaceResizePointerMove=e=>{this.workspaceResizeController?.onWorkspaceResizePointerMove(e)},this.onWorkspaceResizePointerEnd=e=>{this.workspaceResizeController?.onWorkspaceResizePointerEnd(e)},this.onWorkspaceResizeBlur=e=>{this.workspaceResizeController?.onWorkspaceResizeBlur(e)},this.onWorkspaceResizeKeyDown=(e,t)=>{this.workspaceResizeController?.onWorkspaceResizeKeyDown(e,t)},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 r=i.contentRect.width;if(i.target instanceof HTMLElement&&i.target.classList.contains("esp-page-left")){r>l&&!this.hasAttribute("data-preview-navigation-collapsed")&&(this.previewCollapsedSidebarWidth=r);continue}const a=this.previewObservedWidths.get(i.target);this.previewObservedWidths.set(i.target,r),t||=a===void 0||Math.abs(a-r)>.25}t&&this.schedulePreviewLayout(!0)},this.onSidebarSlotChange=()=>{this.syncAsideContent(),this.schedulePreviewLayout()},this.kind="wide",this.align="start",this.contained=!1,this.headerPosition="normal",this.previewOpen=!1,this.sidebarLabel="Sidebar",this.rightLabel="Related",this.previewLabel="Preview",this.previewCollapseSidebar=!1,this.workspaceResizable=!1,this.previewVisible=!1,this.previewReclaiming=!1,this.warnedSiteRails=!1,this.stickyControllers=[new _(this,".esp-page-left > .sticky-wrapper",{topOffset:()=>this.fixedVisibleClearance}),new _(this,".esp-page-right > .sticky-wrapper",{topOffset:()=>this.fixedVisibleClearance}),new _(this,".esp-page-flyout > .sticky-wrapper",{topOffset:()=>this.flyoutFullHeightActive?0:this.fixedVisibleClearance}),new _(this,".esp-page-preview > .sticky-wrapper",{topOffset:()=>0})],this.addEventListener("esp-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)),this.syncAsideContent(),this.resolveHeaderGeometryTarget()&&(this.toggleAttribute("data-header-geometry-pending",!0),this.rearmHeaderGeometryReady()),super.connectedCallback(),this.syncMainMaximumConfiguration(),this.ensureWorkspaceResizeController(),this.hasUpdated&&queueMicrotask(()=>{this.setupPreviewLayoutObserver(),this.syncHeaderGeometry()})}disconnectedCallback(){this.resetHeaderGeometry(),this.toggleAttribute("data-workspace-resize-ready",!1),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=s=>{const n=s;return(typeof n.mode=="string"?n.mode:s.getAttribute("mode"))==="overlay"||n.pageOverlayRequested===!0},i=s=>{const n=s.open;return typeof n=="boolean"?n:s.hasAttribute("open")},r=s=>s.anchor!=null,a=s=>{const n=s.fullHeight;return typeof n=="boolean"?n:s.hasAttribute("full-height")},o=(this.flyoutSlot.value?.assignedElements()??[]).filter(s=>s.tagName==="ESP-FLYOUT");for(const s of o){const n=s,h=typeof n.mode=="string"?n.mode:s.getAttribute("mode");n.pageOverlayRequested&&(!i(s)||h!=="auto")&&(n.pageOverlayRequested=!1)}o.some(s=>s.pageOverlayRequested===!0)||this.clearFlyoutOverlayRecovery(),this.toggleAttribute("flyout-open",o.some(s=>i(s)&&!t(s))),this.toggleAttribute("flyout-overlay-open",o.some(s=>i(s)&&t(s))),this.toggleAttribute("flyout-anchored",o.some(s=>i(s)&&r(s))),this.flyoutFullHeightActive=o.some(s=>i(s)&&!t(s)&&a(s)),this.toggleAttribute("flyout-full-height",this.flyoutFullHeightActive),this.updateHeaderGeometry(),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,r=typeof i.open=="boolean"?i.open:t.hasAttribute("open"),a=typeof i.mode=="string"?i.mode:t.getAttribute("mode");return r&&(a==="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 r of this.assignedFlyouts()){const a=e&&i.has(r);r.pageOverlayRequested!==a&&(r.pageOverlayRequested=a,t=!0)}return t&&await Promise.all(this.assignedFlyouts().map(r=>r.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?ae(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 r=typeof t.drawerTarget=="string"?t.drawerTarget:t.getAttribute("drawer-target")??"",a=typeof i.mode=="string"?i.mode:i.getAttribute("mode");return r!==i.id||a!=="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,r=this.previewHeader&&this.previewHeader!==t?.header?this.previewHeader:null,a=this.previewMenu&&this.previewMenu!==t?.menu?this.previewMenu:null;if(r&&(r.previewCollapseRequested=!1),a&&(a.previewCollapseRequested=!1),this.previewHeader=t?.header??null,this.previewMenu=t?.menu??null,this.toggleAttribute("data-preview-navigation-collapsed",!1),await r?.updateComplete,await a?.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)})}createWorkspaceResizeHost(){const e=this;return{element:e,get previewSyncTask(){return e.previewSyncTask},get previewNavigationCollapseTask(){return e.previewNavigationCollapseTask},get previewSyncFrame(){return e.previewSyncFrame},get previewSyncGeneration(){return e.previewSyncGeneration},set previewSyncGeneration(t){e.previewSyncGeneration=t},get previewVisible(){return e.previewVisible},get allocatedPreviewWidth(){return e.allocatedPreviewWidth},get allocatedFlyoutWidth(){return e.allocatedFlyoutWidth},get preferredPreviewWidth(){return e.preferredPreviewWidth},set preferredPreviewWidth(t){e.preferredPreviewWidth=t},get preferredFlyoutWidth(){return e.preferredFlyoutWidth},set preferredFlyoutWidth(t){e.preferredFlyoutWidth=t},get align(){return e.align},get previewProbes(){return e.previewProbes},get flyoutProbes(){return e.flyoutProbes},get mainProbes(){return e.mainProbes},get mainMaxWidthProbe(){return e.mainMaxWidthProbe},schedulePreviewLayout:t=>e.schedulePreviewLayout(t),setWorkspaceWidths:(t,i,r)=>e.setWorkspaceWidths(t,i,r),setPreviewLayoutState:(t,i)=>e.setPreviewLayoutState(t,i)}}createWorkspaceResizeGeometry(){return{separatorIsAvailable:e=>this.separatorIsAvailable(e),mainResizeGrowthCapacity:e=>this.mainResizeGrowthCapacity(e),trailingPaneResizeRange:(e,t,i)=>this.trailingPaneResizeRange(e,t,i),mainPreviewResizeRange:(e,t,i)=>this.mainPreviewResizeRange(e,t,i),workspaceWidthCapacity:(e,t,i)=>this.workspaceWidthCapacity(e,t,i),flyoutOnlyResizeRange:(e,t)=>this.flyoutOnlyResizeRange(e,t),previewFlyoutResizeRange:(e,t)=>this.previewFlyoutResizeRange(e,t),probeWidth:e=>this.probeWidth(e),mainTrackUnbounded:()=>this.mainTrackUnbounded(),renderedWorkspaceWidths:()=>this.renderedWorkspaceWidths(),workspaceLogicalGutterWidths:()=>this.workspaceLogicalGutterWidths(),previewNavigationResizeAllowance:()=>this.previewNavigationResizeAllowance(),workspaceResizeDirection:()=>this.workspaceResizeDirection(),syncTrailingWorkspaceResizeAvailability:()=>this.syncTrailingWorkspaceResizeAvailability()}}ensureWorkspaceResizeController(){if(!this.workspaceResizable||!this.isConnected){this.toggleAttribute("data-workspace-resize-ready",!1);return}if(this.workspaceResizeController){this.toggleAttribute("data-workspace-resize-ready",!0);return}if(this.workspaceResizeControllerLoad)return;this.toggleAttribute("data-workspace-resize-ready",!1);const e=import("./workspace-resize-session.js").then(({WorkspaceResizeSessionController:t})=>{!this.workspaceResizable||!this.isConnected||(this.workspaceResizeController=new t(this.createWorkspaceResizeHost(),this.createWorkspaceResizeGeometry(),{requestPreviewNavigationCollapse:()=>this.requestPreviewNavigationCollapse(),resizeStep:i=>this.resizeStep(i)}),this.toggleAttribute("data-workspace-resize-ready",this.workspaceResizable))}).catch(t=>{this.toggleAttribute("data-workspace-resize-ready",!1),console.warn("<esp-page>: workspace resizing could not be loaded; retry is available",t)}).finally(()=>{this.workspaceResizeControllerLoad===e&&(this.workspaceResizeControllerLoad=void 0)});this.workspaceResizeControllerLoad=e}get resizeSession(){return this.workspaceResizeController?.currentSession??null}finishWorkspaceKeyboardResize(e=!0){this.workspaceResizeController?.finishWorkspaceKeyboardResize(e)}endWorkspaceResize(){this.workspaceResizeController?.endWorkspaceResize()}clearWorkspaceRecenteringState(){this.workspaceResizeController?.clearWorkspaceRecenteringState()}setPreviewLayoutState(e,t){this.previewVisible=e,this.previewReclaiming=e&&t,e||this.endWorkspaceResize()}setWorkspaceWidths(e,t,i=!1){const r=Math.max(0,e),a=Math.max(0,t);this.style.setProperty("--_esp-page-preview-used-width",`${r}px`),this.style.setProperty("--_esp-page-flyout-used-width",`${a}px`),this.toggleAttribute("data-workspace-targeted",i),this.allocatedPreviewWidth=r,this.allocatedFlyoutWidth=a}visiblePageInlineBounds(){const e=this.getBoundingClientRect();let t=e.left,i=e.right;const r=window.visualViewport,a=r?.offsetLeft??0,o=r?.width??document.documentElement.clientWidth;o>0&&(t=Math.max(t,a),i=Math.min(i,a+o));const s=this.getRootNode();let n=this.parentElement??(s instanceof ShadowRoot?s.host:null);for(;n;){const h=getComputedStyle(n).overflowX;if(["auto","clip","hidden","scroll"].includes(h)){const v=n.getBoundingClientRect();t=Math.max(t,v.left),i=Math.min(i,v.right)}const u=n.getRootNode();n=n.parentElement??(u instanceof ShadowRoot?u.host:null)}return new me(t,i)}probeWidth(e){return fe(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 r=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,a=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,o=Math.max(0,this.visiblePageInlineBounds().width-r-a-Math.max(0,i));return Q(o,e,t)}allocateWorkspaceWidths(e,t,i,r,a,o,s,n=null,h=null){const u=Math.max(0,e),v=Math.max(0,r),d=Math.max(v,a),y=Math.max(0,o),k=Math.max(y,s),m=t?this.preferredPreviewWidth??(n===null?null:F(n,v,d)):null,z=i?this.preferredFlyoutWidth??(h===null?null:F(h,y,k)):null;let w=0,p=0;t&&i?(w=Math.min(d,Math.max(v,u-y)),p=Math.min(k,Math.max(y,u-w))):t?w=Math.min(d,Math.max(v,u)):i&&(p=Math.min(k,Math.max(y,u))),t&&m!==null&&(w=F(m,v,d),i&&z===null&&(p=F(u-w,y,k))),i&&z!==null&&(p=F(z,y,k),t&&m===null&&(w=F(u-p,v,d)));let M=w+p-u;if(M>0&&i){const O=Math.min(M,Math.max(0,p-y));p-=O,M-=O}return M>0&&t&&(w-=Math.min(M,Math.max(0,w-v))),{previewWidth:w,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(),r=t.getBoundingClientRect(),a=this.workspaceResizeDirection()===1?i.right-r.right:r.left-i.left;return{leading:e,trailing:Math.max(0,a)}}syncTrailingWorkspaceResizeAvailability(){const{trailing:e}=this.workspaceLogicalGutterWidths();this.toggleAttribute("data-workspace-trailing-edge-exposed",this.trailingWorkspaceSeparator()!==null&&e>l)}trailingPaneResizeRange(e,t,i){const r=e==="preview-end"?this.previewMinWidthProbe:this.flyoutMinWidthProbe,a=e==="preview-end"?this.previewMaxWidthProbe:this.flyoutMaxWidthProbe,o=Math.max(0,this.probeWidth(r)),s=Math.max(o,this.probeWidth(a));return D.of(o,s).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?Se: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>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 r=this.previewProbes.minimum,a=this.previewProbes.maximum,o=this.mainProbes.minimum,s=Math.max(0,t+e),n=Math.max(0,s+i-o);return D.of(r,Math.max(r,Math.min(a,n)))}previewFlyoutResizeRange(e=this.renderedWorkspaceWidths().previewWidth,t=this.renderedWorkspaceWidths().flyoutWidth){const i=this.previewProbes.minimum,r=this.previewProbes.maximum,a=this.flyoutProbes.minimum,o=this.flyoutProbes.maximum,s=e+t;return D.of(Math.max(i,s-o),Math.max(i,Math.min(r,s-a)))}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,r=this.flyoutProbes.maximum,a=this.mainProbes.minimum,o=this.probeWidth(this.mainMaxWidthProbe),s=Math.max(0,t+e),n=o>0?Math.max(0,s-o):0,h=Math.max(i,n);return D.of(h,Math.min(r,s-a))}mainTrackUnbounded(){return this.kind==="site"||this.kind==="full"&&!this.hasAttribute("data-main-max-configured")}mainResizeGrowthCapacity(e){return this.mainTrackUnbounded()?Number.POSITIVE_INFINITY:Math.max(0,this.probeWidth(this.mainMaxWidthProbe)-e)}previewFitsWithinPage(e,t,i,r,a,o){const s=this.shadowRoot?.querySelector(".esp-page-main"),n=this.shadowRoot?.querySelector(".esp-page-preview"),h=this.shadowRoot?.querySelector(".esp-page-flyout");if(!s||!n||!h)return!1;const u=this.visiblePageInlineBounds(),v=s.getBoundingClientRect(),d=n.getBoundingClientRect(),y=h.getBoundingClientRect(),k=Math.max(t,i),m=Math.max(a,o),z=d.width+l>=t&&d.width<=k+l,w=!r||y.width+l>=a&&y.width<=m+l,p=d.left+l>=u.left&&d.right<=u.right+l&&(!r||y.left+l>=u.left&&y.right<=u.right+l),M=getComputedStyle(this).direction==="rtl"?v.left+l>=d.right&&(!r||d.left+l>=y.right):v.right<=d.left+l&&(!r||d.right<=y.left+l);return v.width+l>=e&&z&&w&&p&&M}flyoutFitsWithinPage(e,t,i){const r=this.shadowRoot?.querySelector(".esp-page-main"),a=this.shadowRoot?.querySelector(".esp-page-flyout");if(!r||!a)return!1;const o=this.visiblePageInlineBounds(),s=r.getBoundingClientRect(),n=a.getBoundingClientRect(),h=Math.max(t,i),u=n.width+l>=t&&n.width<=h+l,v=n.left+l>=o.left&&n.right<=o.right+l,d=getComputedStyle(this).direction==="rtl"?s.left+l>=n.right:s.right<=n.left+l;return s.width+l>=e&&u&&v&&d}workspaceMinimumsCanFit(e,t,i,r,a){const o=this.visiblePageInlineBounds().width;if(o<=0||e<=0||t&&i<=0||r&&a<=0)return!1;const s=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,n=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,u=(t&&this.getPreviewNavigationPair()!==null?0:s)+n+e+(t?i:0)+(r?a:0);return o+l>=u}workspaceGeometrySample(){const e=this.visiblePageInlineBounds(),t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect(),i=this.shadowRoot?.querySelector(".esp-page-preview")?.getBoundingClientRect(),r=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,r?.left??0,r?.right??0,r?.width??0]}workspaceGeometryMatches(e,t){return e.length===t.length&&e.every((i,r)=>Math.abs(i-(t[r]??i))<=l)}workspaceCandidateIsMeasurable(e,t){const i=this.shadowRoot?.querySelector(".esp-page-preview")?.getBoundingClientRect().width??0,r=this.shadowRoot?.querySelector(".esp-page-flyout")?.getBoundingClientRect().width??0;return(!e||i>l)&&(!t||r>l)}async candidateFitsAfterLayoutSettles(e,t,i){if(await this.updateComplete,e!==this.previewSyncGeneration||!this.isConnected)return null;let r=null,a=0;for(let o=0;o<Pe;o+=1){if(await new Promise(n=>requestAnimationFrame(()=>n())),e!==this.previewSyncGeneration||!this.isConnected)return null;if(t())return!0;if(!i()){r=null,a=0;continue}const s=this.workspaceGeometrySample();if(a=r&&this.workspaceGeometryMatches(r,s)?a+1:1,a>=Re)return!1;r=s}return null}async promoteFlyoutIfClipped(e,t,i,r){if(i<=0)return!1;const a=await this.candidateFitsAfterLayoutSettles(e,()=>this.flyoutFitsWithinPage(t,i,r),()=>this.workspaceCandidateIsMeasurable(!1,!0));return a===null?!0:a?!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 r=this.previewVisible;this.toggleAttribute("data-preview-measuring",!0);try{const a=this.previewOpen&&this.previewHasContent(),o=this.previewMediaQuery?.matches??!1,s=this.hasAttribute("flyout-overlay-open"),n=this.hasAttribute("flyout-open"),h=this.hasAttribute("data-preview-navigation-collapsed"),u=this.getPreviewNavigationPair(),v=u===null?0:h?this.previewCollapsedSidebarWidth:this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,d=this.probeWidth(this.previewMinWidthProbe),y=this.optionalWidth("--esp-page-preview-default-width",this.previewDefaultWidthProbe),k=this.probeWidth(this.previewMaxWidthProbe),m=this.probeWidth(this.flyoutMinWidthProbe),z=this.optionalWidth("--esp-page-flyout-default-width",this.flyoutDefaultWidthProbe),w=this.probeWidth(this.flyoutMaxWidthProbe),p=this.probeWidth(this.mainMinWidthProbe);this.syncMainMaximumConfiguration();const M=this.probeWidth(this.mainMaxWidthProbe),O=this.mainTrackUnbounded()?0:M,V=this.openAutoFlyouts().some(R=>R.pageOverlayRequested===!0);if(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),V){const R=this.visiblePageInlineBounds().width,S=this.flyoutOverlayPromotionWidth===null||R>=this.flyoutOverlayPromotionWidth+ke;!o&&t&&this.flyoutOverlayRecoveryReady&&S&&this.workspaceMinimumsCanFit(p,a,d,!0,m)?await this.setPageFlyoutOverlay(!1):o&&await this.setPageFlyoutOverlay(!1);return}if(await this.updateComplete,e!==this.previewSyncGeneration)return;const C=a&&!o&&!s,c=n&&!o;if(p>0&&(!C||d>0)&&(!c||m>0)&&(C||c)&&!this.workspaceMinimumsCanFit(p,C,d,c,m)){c&&await this.promoteFlyoutToOverlay();return}const E=(C?d:0)+(c?m:0),L=C&&this.preferredPreviewWidth!==null||c&&this.preferredFlyoutWidth!==null,q=L||(C&&y!==null||c&&z!==null),X=(C?this.preferredPreviewWidth===null?d:F(this.preferredPreviewWidth,d,k):0)+(c?this.preferredFlyoutWidth===null?m:F(this.preferredFlyoutWidth,m,w):0),f=(R,S,A,I)=>[F(R??I??S,S,A),A],G=R=>{const S=we(R,E,X),A=this.allocateWorkspaceWidths(S,C,c,d,k,m,w,y,z),I=C&&L&&ge(Math.min(R.natural,R.maximum),f(this.preferredPreviewWidth,d,k,y),c?f(this.preferredFlyoutWidth,m,w,z):null)||A,ie=R.maximum+p,re=Math.max(0,ie-R.natural),le=A.previewWidth+A.flyoutWidth,se=Math.max(0,Math.min(re,ie-le));return{allocation:A,shown:I,mainWidth:se,reclaimsMain:se+l<re}},K=(R,S)=>Math.abs(R.mainWidth-S.mainWidth)>l||Math.abs(R.allocation.previewWidth-S.allocation.previewWidth)>l||Math.abs(R.allocation.flyoutWidth-S.allocation.flyoutWidth)>l,N=this.workspaceWidthCapacity(p,O,h?v:0),Y=G(N);let $=Y.shown;if(this.setWorkspaceWidths($.previewWidth,$.flyoutWidth,q),!C||d<=0){c&&await this.promoteFlyoutIfClipped(e,p,m,w);return}if(u!==null&&v>l){const R=N.maximum+p,S=Q(R+v,p,O),A=G(S);(h?K(G(Q(Math.max(0,R-Me),p,O)),A):Y.reclaimsMain&&K(Y,A))?i=await this.setPreviewNavigationCollapse(!0):await this.setPreviewNavigationCollapse(!1)}else await this.setPreviewNavigationCollapse(!1);if(e!==this.previewSyncGeneration)return;const J=this.workspaceWidthCapacity(p,O);if(J.maximum+l<E){this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,c?m:0),i=!1,c&&await this.promoteFlyoutToOverlay();return}const ee=G(J);if($=ee.shown,this.setWorkspaceWidths($.previewWidth,$.flyoutWidth,q),r||this.toggleAttribute("data-preview-validating",!0),this.setPreviewLayoutState(!0,ee.reclaimsMain),await this.updateComplete,e!==this.previewSyncGeneration)return;const te=await this.candidateFitsAfterLayoutSettles(e,()=>this.previewFitsWithinPage(p,d,k,c,m,w),()=>this.workspaceCandidateIsMeasurable(!0,c));if(te===null)return;te?this.toggleAttribute("data-preview-validating",!1):(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,c?m:0),i=!1,c&&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(We),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(ne)||e.querySelector(ne)!==null}syncAsideContent(){const e=(t,i)=>t?ae(t):Array.from(this.children).some(r=>r.getAttribute("slot")===i);this.sidebarHasContent=e(this.sidebarSlot.value,"sidebar"),this.rightHasContent=e(this.rightSlot.value,"right")}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(),this.syncHeaderGeometry()}async getUpdateComplete(){const e=await super.getUpdateComplete();return await this.workspaceResizeControllerLoad,this.isUpdatePending?super.getUpdateComplete():e}updated(e){super.updated(e),e.has("headerPosition")&&(this.syncHeaderGeometry(),this.geometryRecord?.active&&(this.rearmHeaderGeometryReady(),this.onHeaderGeometry(this.headerGeometry?.record??this.geometryRecord)),ve().publish("fixed-menus-changed",{fixed:this.headerPosition==="fixed"})),(e.has("previewOpen")||e.has("previewCollapseSidebar")||e.has("align"))&&this.schedulePreviewLayout(!0),e.has("workspaceResizable")&&(this.workspaceResizable?this.ensureWorkspaceResizeController():(this.toggleAttribute("data-workspace-resize-ready",!1),this.finishWorkspaceKeyboardResize(),this.endWorkspaceResize(),this.clearWorkspaceRecenteringState())),this.warnSiteRailSlots()}warnSiteRailSlots(){this.kind!=="site"||this.warnedSiteRails||!["sidebar","right"].some(t=>(this.shadowRoot?.querySelector(`slot[name="${t}"]`)?.assignedElements({flatten:!0}).length??0)>0)||(this.warnedSiteRails=!0,console.warn('Espalier page: kind="site" does not compose with the sidebar/right rails \u2014 sections span the full viewport and the shared well column ignores rail width. Use kind="wide" for railed layouts, or remove the rail slots from a site page.'))}render(){const e=this.headerPosition==="fixed",t=!e&&this.headerPosition==="sticky",i=this.mainPreviewResizeRange(this.renderedWorkspaceWidths().previewWidth,this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,this.previewNavigationResizeAllowance()),r=this.previewProbes.minimum,a=this.flyoutProbes.minimum,o=this.flyoutProbes.maximum,s=this.mainProbes.minimum,n=this.probeWidth(this.mainMaxWidthProbe),h=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,u=this.hasAttribute("flyout-open"),v=h+this.allocatedPreviewWidth,d=i.min<=r+l,y=u&&d?Math.max(0,this.allocatedFlyoutWidth-a):0,k=Math.max(s,v-i.max),m=Math.max(k,Math.max(s,v-i.min)+y),z=n>0?Math.max(k,Math.min(Math.max(s,n),m)):m,w=n>0&&h+l>=n?`${Math.round(h)}px main, ${Math.round(this.allocatedPreviewWidth)}px preview`:H;let p,M;if(this.previewVisible){const f=this.previewFlyoutResizeRange(this.renderedWorkspaceWidths().previewWidth,this.renderedWorkspaceWidths().flyoutWidth),G=this.allocatedPreviewWidth+this.allocatedFlyoutWidth,N=f.min<=r+l?Math.max(0,h-s):0;p=Math.max(a,G-f.max),M=Math.max(p,Math.min(o,G-f.min+N))}else{const f=this.flyoutOnlyResizeRange(this.renderedWorkspaceWidths().flyoutWidth,h);p=f.min,M=f.max}const O=this.previewVisible?"preview-flyout-resize-handle":"main-flyout-resize-handle",V=this.previewVisible?"Resize preview and help panes":"Resize help pane",C=this.previewVisible?`${Math.round(this.allocatedPreviewWidth)}px preview, ${Math.round(this.allocatedFlyoutWidth)}px help`:`${Math.round(this.allocatedFlyoutWidth)}px help`,c=u?"flyout-end":"preview-end",U=c==="flyout-end"?this.allocatedFlyoutWidth:this.allocatedPreviewWidth,E=this.workspaceLogicalGutterWidths(),L=this.trailingPaneResizeRange(c,U,E.leading+E.trailing),Z=c==="flyout-end"?"flyout-end-resize-handle":"preview-end-resize-handle",q=c==="flyout-end"?"Resize help pane from its outer edge":"Resize preview pane from its outer edge";return he`
|
|
2
|
+
<div part="wrapper" class="esp-page ${pe({"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>
|
|
6
|
+
<div class="header-reservation-probe" aria-hidden="true" inert></div>
|
|
7
|
+
<div class="header-visible-probe" aria-hidden="true" inert></div>
|
|
6
8
|
<div class="esp-page-top">
|
|
7
|
-
<slot name="header" @slotchange=${this.
|
|
9
|
+
<slot name="header" ${W(this.headerSlot)} @slotchange=${this.onHeaderSlotChange}></slot>
|
|
8
10
|
</div>
|
|
9
11
|
|
|
10
12
|
<aside
|
|
11
13
|
class="esp-page-left"
|
|
12
|
-
role=${this.sidebarHasContent?
|
|
13
|
-
aria-label=${this.sidebarHasContent?this.sidebarLabel:
|
|
14
|
+
role=${this.sidebarHasContent?H:"none"}
|
|
15
|
+
aria-label=${this.sidebarHasContent?this.sidebarLabel:H}
|
|
14
16
|
>
|
|
15
17
|
<div class="sticky-wrapper">
|
|
16
18
|
<slot
|
|
17
19
|
name="sidebar"
|
|
18
|
-
${
|
|
20
|
+
${W(this.sidebarSlot)}
|
|
19
21
|
@slotchange=${this.onSidebarSlotChange}
|
|
20
22
|
></slot>
|
|
21
23
|
</div>
|
|
@@ -25,13 +27,13 @@ var W=function(N,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnP
|
|
|
25
27
|
</div>
|
|
26
28
|
<aside
|
|
27
29
|
class="esp-page-right"
|
|
28
|
-
role=${this.rightHasContent?
|
|
29
|
-
aria-label=${this.rightHasContent?this.rightLabel:
|
|
30
|
+
role=${this.rightHasContent?H:"none"}
|
|
31
|
+
aria-label=${this.rightHasContent?this.rightLabel:H}
|
|
30
32
|
>
|
|
31
33
|
<div class="sticky-wrapper">
|
|
32
34
|
<slot
|
|
33
35
|
name="right"
|
|
34
|
-
${
|
|
36
|
+
${W(this.rightSlot)}
|
|
35
37
|
@slotchange=${()=>this.syncAsideContent()}
|
|
36
38
|
></slot>
|
|
37
39
|
</div>
|
|
@@ -40,7 +42,7 @@ var W=function(N,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnP
|
|
|
40
42
|
<div class="sticky-wrapper">
|
|
41
43
|
<slot
|
|
42
44
|
name="flyout"
|
|
43
|
-
${
|
|
45
|
+
${W(this.flyoutSlot)}
|
|
44
46
|
@slotchange=${()=>this.syncFlyoutState()}
|
|
45
47
|
></slot>
|
|
46
48
|
</div>
|
|
@@ -48,64 +50,64 @@ var W=function(N,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnP
|
|
|
48
50
|
<div
|
|
49
51
|
class="esp-page-preview-width-probe esp-page-preview-min-width-probe"
|
|
50
52
|
aria-hidden="true"
|
|
51
|
-
${
|
|
53
|
+
${W(this.previewMinWidthProbe)}
|
|
52
54
|
></div>
|
|
53
55
|
<div
|
|
54
56
|
class="esp-page-preview-default-width-probe"
|
|
55
57
|
aria-hidden="true"
|
|
56
|
-
${
|
|
58
|
+
${W(this.previewDefaultWidthProbe)}
|
|
57
59
|
></div>
|
|
58
60
|
<div
|
|
59
61
|
class="esp-page-preview-max-width-probe"
|
|
60
62
|
aria-hidden="true"
|
|
61
|
-
${
|
|
63
|
+
${W(this.previewMaxWidthProbe)}
|
|
62
64
|
></div>
|
|
63
65
|
<div
|
|
64
66
|
class="esp-page-flyout-min-width-probe"
|
|
65
67
|
aria-hidden="true"
|
|
66
|
-
${
|
|
68
|
+
${W(this.flyoutMinWidthProbe)}
|
|
67
69
|
></div>
|
|
68
70
|
<div
|
|
69
71
|
class="esp-page-flyout-default-width-probe"
|
|
70
72
|
aria-hidden="true"
|
|
71
|
-
${
|
|
73
|
+
${W(this.flyoutDefaultWidthProbe)}
|
|
72
74
|
></div>
|
|
73
75
|
<div
|
|
74
76
|
class="esp-page-flyout-max-width-probe"
|
|
75
77
|
aria-hidden="true"
|
|
76
|
-
${
|
|
78
|
+
${W(this.flyoutMaxWidthProbe)}
|
|
77
79
|
></div>
|
|
78
80
|
<div
|
|
79
81
|
class="esp-page-preview-main-min-probe esp-page-main-min-width-probe"
|
|
80
82
|
aria-hidden="true"
|
|
81
|
-
${
|
|
83
|
+
${W(this.mainMinWidthProbe)}
|
|
82
84
|
></div>
|
|
83
85
|
<div
|
|
84
86
|
class="esp-page-main-configured-max-width-probe"
|
|
85
87
|
aria-hidden="true"
|
|
86
|
-
${
|
|
88
|
+
${W(this.mainConfiguredMaxWidthProbe)}
|
|
87
89
|
></div>
|
|
88
90
|
<div
|
|
89
91
|
class="esp-page-main-max-width-probe"
|
|
90
92
|
aria-hidden="true"
|
|
91
|
-
${
|
|
93
|
+
${W(this.mainMaxWidthProbe)}
|
|
92
94
|
></div>
|
|
93
95
|
<div
|
|
94
96
|
class="esp-page-resize-step-probe"
|
|
95
97
|
aria-hidden="true"
|
|
96
|
-
${
|
|
98
|
+
${W(this.resizeStepProbe)}
|
|
97
99
|
></div>
|
|
98
100
|
<div
|
|
99
101
|
class="esp-page-resize-large-step-probe"
|
|
100
102
|
aria-hidden="true"
|
|
101
|
-
${
|
|
103
|
+
${W(this.resizeLargeStepProbe)}
|
|
102
104
|
></div>
|
|
103
|
-
<div class="esp-page-preview-space" ${
|
|
105
|
+
<div class="esp-page-preview-space" ${W(this.previewSpace)}>
|
|
104
106
|
<aside part="preview" class="esp-page-preview" aria-label=${this.previewLabel}>
|
|
105
107
|
<div part="preview-content" class="sticky-wrapper">
|
|
106
108
|
<slot
|
|
107
109
|
name="preview"
|
|
108
|
-
${
|
|
110
|
+
${W(this.previewSlot)}
|
|
109
111
|
@slotchange=${this.schedulePreviewLayout}
|
|
110
112
|
></slot>
|
|
111
113
|
</div>
|
|
@@ -119,9 +121,9 @@ var W=function(N,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnP
|
|
|
119
121
|
aria-orientation="vertical"
|
|
120
122
|
aria-label="Resize main pane"
|
|
121
123
|
aria-valuemin=${Math.round(k)}
|
|
122
|
-
aria-valuemax=${Math.round(
|
|
123
|
-
aria-valuenow=${Math.round(
|
|
124
|
-
aria-valuetext=${
|
|
124
|
+
aria-valuemax=${Math.round(z)}
|
|
125
|
+
aria-valuenow=${Math.round(h)}
|
|
126
|
+
aria-valuetext=${w}
|
|
125
127
|
tabindex="0"
|
|
126
128
|
@pointerdown=${f=>this.onWorkspaceResizePointerDown("main-preview",f)}
|
|
127
129
|
@pointermove=${this.onWorkspaceResizePointerMove}
|
|
@@ -132,12 +134,12 @@ var W=function(N,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnP
|
|
|
132
134
|
@blur=${this.onWorkspaceResizeBlur}
|
|
133
135
|
></div>
|
|
134
136
|
<div
|
|
135
|
-
part=${
|
|
137
|
+
part=${O}
|
|
136
138
|
class="esp-page-workspace-resize-handle esp-page-preview-flyout-resize-handle"
|
|
137
139
|
role="separator"
|
|
138
140
|
aria-orientation="vertical"
|
|
139
141
|
aria-label=${V}
|
|
140
|
-
aria-valuemin=${Math.round(
|
|
142
|
+
aria-valuemin=${Math.round(p)}
|
|
141
143
|
aria-valuemax=${Math.round(M)}
|
|
142
144
|
aria-valuenow=${Math.round(this.allocatedFlyoutWidth)}
|
|
143
145
|
aria-valuetext=${C}
|
|
@@ -155,9 +157,9 @@ var W=function(N,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnP
|
|
|
155
157
|
class="esp-page-workspace-resize-handle esp-page-workspace-end-resize-handle"
|
|
156
158
|
role="separator"
|
|
157
159
|
aria-orientation="vertical"
|
|
158
|
-
aria-label=${
|
|
159
|
-
aria-valuemin=${Math.round(
|
|
160
|
-
aria-valuemax=${Math.round(
|
|
160
|
+
aria-label=${q}
|
|
161
|
+
aria-valuemin=${Math.round(L.min)}
|
|
162
|
+
aria-valuemax=${Math.round(L.max)}
|
|
161
163
|
aria-valuenow=${Math.round(U)}
|
|
162
164
|
tabindex="0"
|
|
163
165
|
@pointerdown=${f=>this.onWorkspaceResizePointerDown(c,f)}
|
|
@@ -169,10 +171,10 @@ var W=function(N,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnP
|
|
|
169
171
|
@blur=${this.onWorkspaceResizeBlur}
|
|
170
172
|
></div>
|
|
171
173
|
</div>
|
|
172
|
-
<div class="esp-page-footer" role=${this.footerWrapperIsLandmark?"contentinfo":
|
|
173
|
-
<slot name="footer" ${
|
|
174
|
+
<div class="esp-page-footer" role=${this.footerWrapperIsLandmark?"contentinfo":H}>
|
|
175
|
+
<slot name="footer" ${W(this.footerSlot)} @slotchange=${this.syncFooterLandmark}></slot>
|
|
174
176
|
</div>
|
|
175
|
-
<div id="dialog-drop-zone" ${
|
|
177
|
+
<div id="dialog-drop-zone" ${W(this.dialogZone)}></div>
|
|
176
178
|
<esp-toaster></esp-toaster>
|
|
177
179
|
</div>
|
|
178
|
-
`}};
|
|
180
|
+
`}};g.styles=be,P([B()],g.prototype,"footerWrapperIsLandmark",void 0),P([B()],g.prototype,"sidebarHasContent",void 0),P([B()],g.prototype,"rightHasContent",void 0),P([B()],g.prototype,"allocatedPreviewWidth",void 0),P([B()],g.prototype,"allocatedFlyoutWidth",void 0),P([x({reflect:!0})],g.prototype,"kind",void 0),P([x({reflect:!0})],g.prototype,"align",void 0),P([x({type:Boolean,reflect:!0})],g.prototype,"contained",void 0),P([x({attribute:"header-position",reflect:!0})],g.prototype,"headerPosition",void 0),P([x({attribute:"preview-open",type:Boolean,reflect:!0})],g.prototype,"previewOpen",void 0),P([x({attribute:"sidebar-label",type:String,reflect:!0})],g.prototype,"sidebarLabel",void 0),P([x({attribute:"right-label",type:String,reflect:!0})],g.prototype,"rightLabel",void 0),P([x({attribute:"preview-label",type:String,reflect:!0})],g.prototype,"previewLabel",void 0),P([x({attribute:"preview-collapse-sidebar",type:Boolean,reflect:!0})],g.prototype,"previewCollapseSidebar",void 0),P([x({attribute:"workspace-resizable",type:Boolean,reflect:!0})],g.prototype,"workspaceResizable",void 0),P([x({attribute:"preview-visible",type:Boolean,reflect:!0})],g.prototype,"previewVisible",void 0),P([x({attribute:"preview-reclaiming",type:Boolean,reflect:!0})],g.prototype,"previewReclaiming",void 0),g=P([de("esp-page")],g);export{g as EspalierPage};
|
|
@@ -688,6 +688,42 @@ import{css as a,unsafeCSS as e}from"lit";import{EspalierElementBase as i}from"..
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
|
|
691
|
+
.esp-page > .header-reservation-probe,
|
|
692
|
+
.esp-page > .header-visible-probe {
|
|
693
|
+
position: absolute;
|
|
694
|
+
inline-size: 0;
|
|
695
|
+
visibility: hidden;
|
|
696
|
+
pointer-events: none;
|
|
697
|
+
box-sizing: content-box;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
.esp-page > .header-reservation-probe {
|
|
701
|
+
block-size: var(--esp-page-fixed-header-offset, var(--_esp-page-geometry-expanded, 0px));
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
.esp-page > .header-visible-probe {
|
|
705
|
+
block-size: var(--esp-page-visible-header-offset, var(--esp-page-fixed-header-offset, var(--_esp-page-geometry-current, 0px)));
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
:host([data-header-geometry-active]) {
|
|
709
|
+
--_esp-page-fixed-header-offset: var(--_esp-page-geometry-reservation, 0px);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
:host([data-header-geometry-active]) .esp-page slot[name="header"]::slotted(esp-header),
|
|
713
|
+
:host([data-header-geometry-active]) .esp-page slot[name="sidebar"]::slotted(esp-menu),
|
|
714
|
+
:host([data-header-geometry-active]) .esp-page slot[name="right"]::slotted(esp-menu) {
|
|
715
|
+
--esp-menu-top-offset: var(--_esp-page-geometry-visible, 0px);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
:host([data-header-geometry-pending]) .esp-page > div.esp-page-top { position: relative; }
|
|
719
|
+
|
|
720
|
+
:host([data-header-geometry-pending]) .esp-page > div.esp-page-main,
|
|
721
|
+
:host([data-header-geometry-pending]) .esp-page > aside.esp-page-left,
|
|
722
|
+
:host([data-header-geometry-pending]) .esp-page > aside.esp-page-right,
|
|
723
|
+
:host([data-header-geometry-pending]) .esp-page > div.esp-page-flyout,
|
|
724
|
+
:host([data-header-geometry-pending]) .esp-page > .esp-page-surface,
|
|
725
|
+
:host([data-header-geometry-pending]) .esp-page > .esp-page-canvas { margin-top: 0; }
|
|
726
|
+
|
|
691
727
|
.esp-page:has(esp-dialog[is-open="true"]) {
|
|
692
728
|
overflow: hidden;
|
|
693
729
|
}
|
package/dist/row/esp-row.js
CHANGED
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
var
|
|
1
|
+
var s=function(p,r,o,l){var a=arguments.length,e=a<3?r:l===null?l=Object.getOwnPropertyDescriptor(r,o):l,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(p,r,o,l);else for(var f=p.length-1;f>=0;f--)(n=p[f])&&(e=(a<3?n(e):a>3?n(r,o,e):n(r,o))||e);return a>3&&e&&Object.defineProperty(r,o,e),e};import{css as w,html as c}from"lit";import{customElement as y,property as i}from"lit/decorators.js";import{layoutGapStyles as h}from"../shared/layout-gap.js";import{EspalierElementBase as u}from"../shared/esp-element-base.js";const d=["start","center","end","between"];let t=class extends u{constructor(){super(...arguments),this.gap="normal",this.align="center",this.justify="start",this.nowrap=!1}render(){return c`
|
|
2
2
|
<div class="esp-row" part="row">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}};t.styles=[...
|
|
5
|
+
`}};t.styles=[...u.styles,h("--_esp-row-gap"),w`
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
|
-
--_esp-row-gap: var(--esp-size-normal);
|
|
9
8
|
--_esp-row-align: center;
|
|
10
9
|
--_esp-row-justify: flex-start;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
:host([gap="none"]) {
|
|
14
|
-
--_esp-row-gap: 0px;
|
|
15
|
-
}
|
|
16
|
-
:host([gap="tiny"]) {
|
|
17
|
-
--_esp-row-gap: var(--esp-size-tiny);
|
|
18
|
-
}
|
|
19
|
-
:host([gap="small"]) {
|
|
20
|
-
--_esp-row-gap: var(--esp-size-small);
|
|
21
|
-
}
|
|
22
|
-
:host([gap="medium"]) {
|
|
23
|
-
--_esp-row-gap: var(--esp-size-medium);
|
|
24
|
-
}
|
|
25
|
-
:host([gap="big"]) {
|
|
26
|
-
--_esp-row-gap: var(--esp-size-big);
|
|
27
|
-
}
|
|
28
|
-
:host([gap="large"]) {
|
|
29
|
-
--_esp-row-gap: var(--esp-size-large);
|
|
30
|
-
}
|
|
31
|
-
:host([gap="huge"]) {
|
|
32
|
-
--_esp-row-gap: var(--esp-size-huge);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
12
|
:host([align="start"]) {
|
|
36
13
|
--_esp-row-align: flex-start;
|
|
37
14
|
}
|
|
@@ -64,4 +41,4 @@ var o=function(p,r,s,a){var i=arguments.length,e=i<3?r:a===null?a=Object.getOwnP
|
|
|
64
41
|
:host([nowrap]) .esp-row {
|
|
65
42
|
flex-wrap: nowrap;
|
|
66
43
|
}
|
|
67
|
-
`],
|
|
44
|
+
`],s([i({reflect:!0,useDefault:!0})],t.prototype,"gap",void 0),s([i({reflect:!0,useDefault:!0})],t.prototype,"align",void 0),s([i({reflect:!0,useDefault:!0})],t.prototype,"justify",void 0),s([i({type:Boolean,reflect:!0})],t.prototype,"nowrap",void 0),t=s([y("esp-row")],t);export{t as EspalierRow,d as ROW_JUSTIFIES};
|
|
@@ -4,6 +4,8 @@ export interface ConfiguredBrandOptions {
|
|
|
4
4
|
brandText: string;
|
|
5
5
|
brandHref: string;
|
|
6
6
|
brandAlt: string;
|
|
7
|
+
/** Let the host reserve stable logo space across resolved source changes. */
|
|
8
|
+
reserveLogoSpace?: boolean;
|
|
7
9
|
}
|
|
8
10
|
export interface ConfiguredBrandConfiguration {
|
|
9
11
|
scheme: "light" | "dark" | "";
|
|
@@ -50,4 +52,4 @@ export declare const configuredBrandLogoGeometry: import("lit").CSSResult;
|
|
|
50
52
|
* Plain anchors and images are intentional: a brand identity should not gain
|
|
51
53
|
* the interaction chrome of Espalier's application-navigation controls.
|
|
52
54
|
*/
|
|
53
|
-
export declare function renderConfiguredBrand({ brandLogo, brandText, brandHref, brandAlt, }: ConfiguredBrandOptions): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
55
|
+
export declare function renderConfiguredBrand({ brandLogo, brandText, brandHref, brandAlt, reserveLogoSpace, }: ConfiguredBrandOptions): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{css as
|
|
1
|
+
import{css as g,html as r,nothing as l}from"lit";function f({scheme:o,brandLogo:n,brandColor:s,lightBrandLogo:a,darkBrandLogo:t,lightBrandColor:d,darkBrandColor:e}){return{brandLogo:(o==="dark"?t:a)||n,brandColor:(o==="dark"?e:d)||s}}const u=g`3 / 1`,$=g`
|
|
2
2
|
.brand-logo {
|
|
3
3
|
overflow-wrap: anywhere;
|
|
4
4
|
}
|
|
5
|
-
`;function
|
|
6
|
-
${o?
|
|
7
|
-
${r
|
|
8
|
-
`;return
|
|
5
|
+
`;function m({brandLogo:o,brandText:n,brandHref:s,brandAlt:a,reserveLogoSpace:t=!1}){if(!o&&!n)return l;const e=o?r`<img class="brand-logo" src=${o} alt=${a||(n?"":"Site logo")} />`:l,c=r`
|
|
6
|
+
${o&&t?r`<span class="brand-logo-reservation">${e}</span>`:e}
|
|
7
|
+
${n?r`<span class="brand-text">${n}</span>`:l}
|
|
8
|
+
`;return s?r`<a class="configured-brand" href=${s}>${c}</a>`:r`<span class="configured-brand">${c}</span>`}export{u as CONFIGURED_BRAND_LOGO_ASPECT_RATIO,$ as configuredBrandLogoGeometry,m as renderConfiguredBrand,f as resolveConfiguredBrand};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{css as r,unsafeCSS as a}from"lit";const i=["none","tiny","small","normal","medium","big","large","huge"],n={none:"0px",tiny:"var(--esp-size-tiny)",small:"var(--esp-size-small)",normal:"var(--esp-size-normal)",medium:"var(--esp-size-medium)",big:"var(--esp-size-big)",large:"var(--esp-size-large)",huge:"var(--esp-size-huge)"};function p(e){return r`
|
|
2
|
+
:host { ${a(e)}: var(--esp-size-normal); }
|
|
3
|
+
${a(i.map(s=>`:host([gap="${s}"]) { ${e}: ${n[s]}; }`).join(`
|
|
4
|
+
`))}
|
|
5
|
+
`}export{i as LAYOUT_GAPS,p as layoutGapStyles};
|
package/dist/stack/esp-stack.js
CHANGED
|
@@ -1,36 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=function(l,t,a,r){var n=arguments.length,e=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,a):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(l,t,a,r);else for(var o=l.length-1;o>=0;o--)(i=l[o])&&(e=(n<3?i(e):n>3?i(t,a,e):i(t,a))||e);return n>3&&e&&Object.defineProperty(t,a,e),e};import{css as f,html as g}from"lit";import{customElement as h,property as c}from"lit/decorators.js";import{layoutGapStyles as d,LAYOUT_GAPS as m}from"../shared/layout-gap.js";import{EspalierElementBase as u}from"../shared/esp-element-base.js";const v=m,y=["start","center","end","stretch"];let s=class extends u{constructor(){super(...arguments),this.gap="normal",this.align="stretch"}render(){return g`
|
|
2
2
|
<div class="esp-stack" part="stack">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}};s.styles=[...
|
|
5
|
+
`}};s.styles=[...u.styles,d("--_esp-stack-gap"),f`
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
|
-
--_esp-stack-gap: var(--esp-size-normal);
|
|
9
8
|
--_esp-stack-align: stretch;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
:host([gap="none"]) {
|
|
13
|
-
--_esp-stack-gap: 0px;
|
|
14
|
-
}
|
|
15
|
-
:host([gap="tiny"]) {
|
|
16
|
-
--_esp-stack-gap: var(--esp-size-tiny);
|
|
17
|
-
}
|
|
18
|
-
:host([gap="small"]) {
|
|
19
|
-
--_esp-stack-gap: var(--esp-size-small);
|
|
20
|
-
}
|
|
21
|
-
:host([gap="medium"]) {
|
|
22
|
-
--_esp-stack-gap: var(--esp-size-medium);
|
|
23
|
-
}
|
|
24
|
-
:host([gap="big"]) {
|
|
25
|
-
--_esp-stack-gap: var(--esp-size-big);
|
|
26
|
-
}
|
|
27
|
-
:host([gap="large"]) {
|
|
28
|
-
--_esp-stack-gap: var(--esp-size-large);
|
|
29
|
-
}
|
|
30
|
-
:host([gap="huge"]) {
|
|
31
|
-
--_esp-stack-gap: var(--esp-size-huge);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
11
|
:host([align="start"]) {
|
|
35
12
|
--_esp-stack-align: flex-start;
|
|
36
13
|
}
|
|
@@ -53,4 +30,4 @@ var o=function(l,t,a,r){var n=arguments.length,e=n<3?t:r===null?r=Object.getOwnP
|
|
|
53
30
|
:host(:not([align])) ::slotted(esp-button-group) {
|
|
54
31
|
align-self: flex-start;
|
|
55
32
|
}
|
|
56
|
-
`],
|
|
33
|
+
`],p([c({reflect:!0,useDefault:!0})],s.prototype,"gap",void 0),p([c({reflect:!0,useDefault:!0})],s.prototype,"align",void 0),s=p([h("esp-stack")],s);export{s as EspalierStack,y as STACK_ALIGNS,v as STACK_GAPS};
|
package/espalier.css-data.json
CHANGED
|
@@ -433,6 +433,10 @@
|
|
|
433
433
|
"name": "--esp-color-warning",
|
|
434
434
|
"description": ""
|
|
435
435
|
},
|
|
436
|
+
{
|
|
437
|
+
"name": "--esp-columns-gap",
|
|
438
|
+
"description": "Overrides the selected gap with a non-negative CSS length, including rem, em, calc() and clamp(). Percentage gaps are not supported. Defaults to the `gap` attribute's step, `normal` when unset."
|
|
439
|
+
},
|
|
436
440
|
{
|
|
437
441
|
"name": "--esp-details-color-background",
|
|
438
442
|
"description": "The background color."
|
|
@@ -945,6 +949,10 @@
|
|
|
945
949
|
"name": "--esp-header-color",
|
|
946
950
|
"description": "The text/icon color inherited by header controls. Defaults to `var(--esp-color-text)`."
|
|
947
951
|
},
|
|
952
|
+
{
|
|
953
|
+
"name": "--esp-header-compact-brand-logo-aspect-ratio",
|
|
954
|
+
"description": "Reserved ratio for a pending compact logo. Defaults to `var(--esp-header-brand-logo-aspect-ratio, 3 / 1)`."
|
|
955
|
+
},
|
|
948
956
|
{
|
|
949
957
|
"name": "--esp-header-compact-height",
|
|
950
958
|
"description": "The height of compact scroll-reactive headers. Defaults to `max(44px, calc(3.5 * var(--esp-size-small)))`."
|
|
@@ -1427,7 +1435,7 @@
|
|
|
1427
1435
|
},
|
|
1428
1436
|
{
|
|
1429
1437
|
"name": "--esp-page-fixed-header-offset",
|
|
1430
|
-
"description": "
|
|
1438
|
+
"description": "Fixed reservation override; also the default visible clearance override. With active header geometry, defaults to the measured expanded header size; legacy headers use `var(--esp-header-height)`."
|
|
1431
1439
|
},
|
|
1432
1440
|
{
|
|
1433
1441
|
"name": "--esp-page-flyout-default-width",
|
|
@@ -1441,6 +1449,10 @@
|
|
|
1441
1449
|
"name": "--esp-page-flyout-min-width",
|
|
1442
1450
|
"description": "Minimum in-grid help width. Defaults to `20rem`."
|
|
1443
1451
|
},
|
|
1452
|
+
{
|
|
1453
|
+
"name": "--esp-page-header-expanded-size",
|
|
1454
|
+
"description": "Read-only measured expanded header size exported for descendants. Independent of reservation overrides; unavailable for legacy headers."
|
|
1455
|
+
},
|
|
1444
1456
|
{
|
|
1445
1457
|
"name": "--esp-page-header-z-index",
|
|
1446
1458
|
"description": "Z-index for fixed/sticky header regions. Defaults to `20`."
|
|
@@ -1513,6 +1525,10 @@
|
|
|
1513
1525
|
"name": "--esp-page-surface-shadow",
|
|
1514
1526
|
"description": "The box shadow drawn on the left and right edges of the content surface. On by default; casts into the gutters and is clipped away when the surface fills the viewport, so it only shows above the cap. Set to `none` to remove it."
|
|
1515
1527
|
},
|
|
1528
|
+
{
|
|
1529
|
+
"name": "--esp-page-visible-header-offset",
|
|
1530
|
+
"description": "Independent visible clearance override for menus and sidebars. Defaults to the fixed offset override, then the live measured header size."
|
|
1531
|
+
},
|
|
1516
1532
|
{
|
|
1517
1533
|
"name": "--esp-page-well-max-width",
|
|
1518
1534
|
"description": "The shared content-column width in `kind=\"site\"`: the header and footer alignment contract and every `esp-section` well default to it. Defaults to `72rem`."
|