@taprootio/espalier 2.12.1 → 2.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.
@@ -62,15 +62,19 @@ export interface PageWorkspaceResizeDetail {
62
62
  * @slot right - Content to place in the right aside.
63
63
  * @slot preview - Persistent preview content placed after the main surface and
64
64
  * before help. It grows from `--esp-page-preview-min-width` to
65
- * `--esp-page-preview-max-width`, starts at viewport top, and gives its content
66
- * an independent `100dvh` vertical scroller. At either scroll boundary, wheel
67
- * and trackpad motion chains back to the main document. Unlike flyout content,
68
- * preview content is never replaced by the flyout request bus.
65
+ * `--esp-page-preview-max-width`, starting at
66
+ * `--esp-page-preview-default-width` when that token is set. It starts at
67
+ * viewport top and gives its content an independent `100dvh` vertical scroller. At
68
+ * either scroll boundary, wheel and trackpad motion chains back to the main
69
+ * document. Unlike flyout content, preview content is never replaced by the
70
+ * flyout request bus.
69
71
  * @slot flyout - A transient `esp-flyout` panel that lives on the
70
72
  * canvas after preview. Closed it costs no width; open it grows from
71
- * `--esp-page-flyout-min-width` to `--esp-page-flyout-max-width` after preview
72
- * receives flexible space, then docks as a width-competing right sidebar when
73
- * no gutter exists, and becomes an overlay drawer on small viewports.
73
+ * `--esp-page-flyout-min-width` to `--esp-page-flyout-max-width`, starting at
74
+ * `--esp-page-flyout-default-width` when that token is set. It receives
75
+ * remaining flexible space after preview when no default is set, then docks as
76
+ * a width-competing right sidebar when no gutter exists and becomes an overlay
77
+ * drawer on small viewports.
74
78
  * The persistent `right` aside and the transient flyout are
75
79
  * complementary, not alternatives. A flyout opened with an `anchor`
76
80
  * aligns to that trigger and stays in the same document scroll flow. When a
@@ -154,7 +158,8 @@ export interface PageWorkspaceResizeDetail {
154
158
  * while preview or in-grid help competes for space. Defaults to `30rem`.
155
159
  * @cssprop --esp-page-main-max-width - Maximum width of the main content well.
156
160
  * Defaults from `kind`: `1536px` (wide), `768px` (narrow), or unbounded (full).
157
- * Surplus width beyond it becomes canvas gutters.
161
+ * An explicit value overrides every kind default, including `full`. Surplus
162
+ * width beyond it becomes canvas gutters.
158
163
  * @cssprop --esp-page-max-width - Legacy fallback for
159
164
  * `--esp-page-main-max-width`.
160
165
  * @cssprop --esp-page-background-image - The background image to
@@ -193,10 +198,18 @@ export interface PageWorkspaceResizeDetail {
193
198
  * additive surface.
194
199
  * @cssprop --esp-page-preview-min-width - Minimum preview width. Defaults to
195
200
  * `22.5rem` (360px, a reasonable mobile-device surface).
201
+ * @cssprop --esp-page-preview-default-width - Initial automatic preview
202
+ * target, clamped between the preview minimum and maximum. When unset, the
203
+ * established preview-first flexible allocation remains in effect. A retained
204
+ * pointer or keyboard resize preference supersedes this target.
196
205
  * @cssprop --esp-page-preview-max-width - Maximum preview width. Defaults to
197
206
  * `48rem`. Preview receives flexible trailing space before help grows.
198
207
  * @cssprop --esp-page-flyout-min-width - Minimum in-grid help width. Defaults
199
208
  * to `20rem`.
209
+ * @cssprop --esp-page-flyout-default-width - Initial automatic in-grid help
210
+ * target, clamped between the help minimum and maximum. When unset, the
211
+ * established flexible allocation remains in effect. A retained pointer or
212
+ * keyboard resize preference supersedes this target.
200
213
  * @cssprop --esp-page-flyout-max-width - Maximum help width and overlay drawer
201
214
  * cap before the `85vw` viewport cap. Defaults to `30rem`.
202
215
  * @cssprop --esp-page-resize-step - Arrow-key resize step. Defaults to `1rem`.
@@ -417,9 +430,10 @@ export declare class EspalierPage extends EspalierElementBase {
417
430
  * - `narrow` — constrains the main content well to 768px and applies
418
431
  * a `max-inline-size: 66ch` reading measure. Optimized for
419
432
  * long-form reading content.
420
- * - `full` — no max-width constraint; the content well spans the
421
- * full available space. Optimized for immersive canvases like
422
- * maps or design tools.
433
+ * - `full` — no max-width constraint unless
434
+ * `--esp-page-main-max-width` is explicitly configured. Optimized for
435
+ * immersive canvases like maps or design tools and finite authoring
436
+ * workspaces that opt back into a cap.
423
437
  */
424
438
  kind: "wide" | "narrow" | "full";
425
439
  /**
@@ -436,8 +450,8 @@ export declare class EspalierPage extends EspalierElementBase {
436
450
  * - `end` — the surface hugs the trailing edge; spare width collects in
437
451
  * the leading gutter.
438
452
  *
439
- * Has no effect when `kind="full"` (no cap means no gutters) or on
440
- * viewports narrower than the cap (the surface already fills the width).
453
+ * Has no effect when an unconfigured `kind="full"` leaves main unbounded,
454
+ * or on viewports narrower than the complete visible workspace cap.
441
455
  */
442
456
  align: "start" | "center" | "end";
443
457
  /**
@@ -1,5 +1,5 @@
1
- var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(F,e,t,i);else for(var o=F.length-1;o>=0;o--)(r=F[o])&&(a=(s<3?r(a):s>3?r(e,t,a):r(e,t))||a);return s>3&&a&&Object.defineProperty(e,t,a),a};import{css as D,html as K,nothing as G}from"lit";import{customElement as j,property as M,state as L}from"lit/decorators.js";import{classMap as V}from"lit/directives/class-map.js";import{createRef as x,ref as R}from"lit/directives/ref.js";import{EspalierElementBase as q}from"../shared/esp-element-base.js";import{BiDirectionalStickyController as _}from"./bi-directional-sticky-controller.js";import{getEspBus as H}from"../shared/bus-events.js";import"../toaster/esp-toaster.js";const I='esp-footer, footer, [role~="contentinfo"]',U="(max-width: 50em)",c=1,Y=5,Q=12,X=48,Z=16,J=64,ee=250;let w=class extends q{constructor(){super(),this.dialogZone=x(),this.flyoutSlot=x(),this.footerSlot=x(),this.previewSlot=x(),this.previewSpace=x(),this.previewMinWidthProbe=x(),this.previewMaxWidthProbe=x(),this.flyoutMinWidthProbe=x(),this.flyoutMaxWidthProbe=x(),this.mainMinWidthProbe=x(),this.mainMaxWidthProbe=x(),this.resizeStepProbe=x(),this.resizeLargeStepProbe=x(),this.previewObservedWidths=new WeakMap,this.previewSyncRaf=null,this.previewSyncGeneration=0,this.previewSyncTask=Promise.resolve(),this.previewOverlayRecoveryRequested=!1,this.previewHeader=null,this.previewMenu=null,this.previewCollapsedSidebarWidth=0,this.previewNavigationCollapseTask=null,this.flyoutOverlayPromotionWidth=null,this.flyoutOverlayRecoveryReady=!1,this.flyoutOverlayRecoveryGeneration=0,this.preferredPreviewWidth=null,this.preferredFlyoutWidth=null,this.resizeSession=null,this.workspaceKeyboardSettlementTimer=null,this.footerWrapperIsLandmark=!0,this.allocatedPreviewWidth=0,this.allocatedFlyoutWidth=0,this.onWorkspaceResizePointerDown=(e,t)=>{if(t.button!==0||!this.separatorIsAvailable(e))return;const i=t.currentTarget,s=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,a=this.renderedWorkspaceWidths();this.endWorkspaceResize(),this.finishWorkspaceKeyboardResize(!1),this.suspendPreviewLayoutForWorkspaceResize(),this.resizeSession={separator:e,pointerId:t.pointerId,target:i,startClientX:t.clientX,startPreviewWidth:a.previewWidth,startFlyoutWidth:a.flyoutWidth,startMainWidth:s,startNavigationAllowance:this.previewNavigationResizeAllowance(),direction:this.workspaceResizeDirection()};try{i.setPointerCapture?.(t.pointerId)}catch{}this.toggleAttribute("data-workspace-resizing",!0),t.preventDefault()},this.onWorkspaceResizePointerMove=e=>{const t=this.resizeSession;!t||t.pointerId!==e.pointerId||(e.preventDefault(),this.applyWorkspaceResize(t.separator,e.clientX-t.startClientX,"pointer",t.startPreviewWidth,t.startFlyoutWidth,t.startMainWidth,t.startNavigationAllowance,t.direction))},this.onWorkspaceResizePointerEnd=e=>{!this.resizeSession||this.resizeSession.pointerId!==e.pointerId||(e.preventDefault(),this.endWorkspaceResize())},this.onWorkspaceResizeBlur=e=>{this.hasAttribute("data-workspace-keyboard-adjusting")&&(e.relatedTarget instanceof Element&&e.relatedTarget.classList.contains("esp-page-workspace-resize-handle")||this.finishWorkspaceKeyboardResize())},this.onWorkspaceResizeKeyDown=(e,t)=>{if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight"||!this.separatorIsAvailable(e))return;t.preventDefault(),this.hasAttribute("data-workspace-keyboard-adjusting")||this.suspendPreviewLayoutForWorkspaceResize();const i=(t.key==="ArrowLeft"?-1:1)*this.resizeStep(t.shiftKey),s=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,a=this.renderedWorkspaceWidths();this.applyWorkspaceResize(e,i,"keyboard",a.previewWidth,a.flyoutWidth,s,this.previewNavigationResizeAllowance(),this.workspaceResizeDirection())},this.schedulePreviewLayout=(e=!1)=>{if(!this.isConnected||!this.hasUpdated||(this.previewOverlayRecoveryRequested||=e===!0,this.resizeSession||this.hasAttribute("data-workspace-keyboard-adjusting")))return;this.previewSyncGeneration+=1;const t=this.previewSyncGeneration;this.previewSyncRaf!==null&&cancelAnimationFrame(this.previewSyncRaf),this.previewSyncRaf=requestAnimationFrame(()=>{this.previewSyncRaf=null;const i=this.previewOverlayRecoveryRequested;this.previewOverlayRecoveryRequested=!1,this.previewSyncTask=this.previewSyncTask.then(()=>this.syncPreviewLayout(t,i)).catch(()=>{})})},this.onPreviewMediaChange=()=>this.schedulePreviewLayout(!0),this.onPreviewResize=e=>{let t=!1;for(const i of e){const s=i.contentRect.width;if(i.target instanceof HTMLElement&&i.target.classList.contains("esp-page-left")){s>c&&!this.hasAttribute("data-preview-navigation-collapsed")&&(this.previewCollapsedSidebarWidth=s);continue}const a=this.previewObservedWidths.get(i.target);this.previewObservedWidths.set(i.target,s),t||=a===void 0||Math.abs(a-s)>.25}t&&this.schedulePreviewLayout(!0)},this.kind="wide",this.align="start",this.contained=!1,this.headerPosition="normal",this.fixedMenus=!1,this.previewOpen=!1,this.previewLabel="Preview",this.previewCollapseSidebar=!1,this.workspaceResizable=!1,this.previewVisible=!1,this.previewReclaiming=!1,new _(this,".esp-page-left > .sticky-wrapper"),new _(this,".esp-page-right > .sticky-wrapper"),new _(this,".esp-page-flyout > .sticky-wrapper"),new _(this,".esp-page-preview > .sticky-wrapper",{topOffset:()=>0}),this.addEventListener("flyout-state-changed",e=>this.syncFlyoutState(e))}connectedCallback(){const e=Array.from(this.children).filter(t=>t.getAttribute("slot")==="footer");this.footerWrapperIsLandmark=!e.some(t=>this.footerElementProvidesLandmark(t)),super.connectedCallback(),this.hasUpdated&&queueMicrotask(()=>this.setupPreviewLayoutObserver())}disconnectedCallback(){this.finishWorkspaceKeyboardResize(!1),this.endWorkspaceResize(),this.previewResizeObserver?.disconnect(),this.previewResizeObserver=void 0,this.previewMediaQuery?.removeEventListener("change",this.onPreviewMediaChange),this.previewMediaQuery=void 0,this.previewSyncRaf!==null&&(cancelAnimationFrame(this.previewSyncRaf),this.previewSyncRaf=null),this.previewSyncGeneration+=1,this.previewOverlayRecoveryRequested=!1,this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1),this.toggleAttribute("data-workspace-keyboard-adjusting",!1),this.toggleAttribute("descendant-flyout-overlay-open",!1),this.clearFlyoutOverlayRecovery(),this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),this.preferredPreviewWidth=null,this.preferredFlyoutWidth=null,this.previewNavigationCollapseTask=null,this.setPreviewNavigationCollapse(!1),super.disconnectedCallback()}syncFlyoutState(e){if(e&&e.target?.closest?.("esp-page")!==this){this.syncDescendantFlyoutOverlayState();return}const t=r=>{const o=r;return(typeof o.mode=="string"?o.mode:r.getAttribute("mode"))==="overlay"||o.pageOverlayRequested===!0},i=r=>{const o=r.open;return typeof o=="boolean"?o:r.hasAttribute("open")},s=r=>r.anchor!=null,a=(this.flyoutSlot.value?.assignedElements()??[]).filter(r=>r.tagName==="ESP-FLYOUT");for(const r of a){const o=r,n=typeof o.mode=="string"?o.mode:r.getAttribute("mode");o.pageOverlayRequested&&(!i(r)||n!=="auto")&&(o.pageOverlayRequested=!1)}a.some(r=>r.pageOverlayRequested===!0)||this.clearFlyoutOverlayRecovery(),this.toggleAttribute("flyout-open",a.some(r=>i(r)&&!t(r))),this.toggleAttribute("flyout-overlay-open",a.some(r=>i(r)&&t(r))),this.toggleAttribute("flyout-anchored",a.some(r=>i(r)&&s(r))),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"),a=typeof i.mode=="string"?i.mode:t.getAttribute("mode");return s&&(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 s of this.assignedFlyouts()){const a=e&&i.has(s);s.pageOverlayRequested!==a&&(s.pageOverlayRequested=a,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?.assignedNodes({flatten:!0});return e?e.some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent?.trim().length??0)>0):Array.from(this.childNodes).some(t=>t instanceof Element&&t.getAttribute("slot")==="preview"&&!t.hasAttribute("hidden"))}getPreviewNavigationPair(){if(!this.previewCollapseSidebar)return null;const e=Array.from(this.children),t=e.find(r=>r.slot==="header"&&r.tagName==="ESP-HEADER"),i=e.find(r=>r.slot==="sidebar"&&r.tagName==="ESP-MENU");if(!t||!i||!i.id)return null;const s=typeof t.drawerTarget=="string"?t.drawerTarget:t.getAttribute("drawer-target")??"",a=typeof i.mode=="string"?i.mode:i.getAttribute("mode");return s!==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,s=this.previewHeader&&this.previewHeader!==t?.header?this.previewHeader:null,a=this.previewMenu&&this.previewMenu!==t?.menu?this.previewMenu:null;if(s&&(s.previewCollapseRequested=!1),a&&(a.previewCollapseRequested=!1),this.previewHeader=t?.header??null,this.previewMenu=t?.menu??null,this.toggleAttribute("data-preview-navigation-collapsed",!1),await s?.updateComplete,await a?.updateComplete,!t)return!1;const r=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=r,this.toggleAttribute("data-preview-navigation-collapsed",!0),!0):(t.header.previewCollapseRequested=!1,t.menu.previewCollapseRequested=!1,await t.header.updateComplete,await t.menu.updateComplete,this.previewHeader=null,this.previewMenu=null,!1)}requestPreviewNavigationCollapse(){if(this.hasAttribute("data-preview-navigation-collapsed")||this.previewNavigationCollapseTask)return;const e=this.setPreviewNavigationCollapse(!0);this.previewNavigationCollapseTask=e,e.then(()=>{this.previewNavigationCollapseTask===e&&(this.previewNavigationCollapseTask=null)},()=>{this.previewNavigationCollapseTask===e&&(this.previewNavigationCollapseTask=null)})}scheduleWorkspaceSettlement(e=null){const t=()=>{this.schedulePreviewLayout(),e&&requestAnimationFrame(()=>{this.previewSyncTask.then(()=>{const a=this.shadowRoot?.activeElement,r=this.ownerDocument.activeElement;!this.isConnected||!e.isConnected||a&&a!==e||r!==this&&r!==this.ownerDocument.body||getComputedStyle(e).display!=="none"&&e.focus({preventScroll:!0})})})},i=this.previewNavigationCollapseTask;if(!i){t();return}i.then(()=>t(),()=>t())}clearWorkspaceKeyboardSettlementTimer(){this.workspaceKeyboardSettlementTimer!==null&&(clearTimeout(this.workspaceKeyboardSettlementTimer),this.workspaceKeyboardSettlementTimer=null)}finishWorkspaceKeyboardResize(e=!0){this.clearWorkspaceKeyboardSettlementTimer();const t=this.hasAttribute("data-workspace-keyboard-adjusting");this.toggleAttribute("data-workspace-keyboard-adjusting",!1),t&&e&&!this.resizeSession&&this.scheduleWorkspaceSettlement()}deferWorkspaceKeyboardSettlement(){this.clearWorkspaceKeyboardSettlementTimer(),this.workspaceKeyboardSettlementTimer=setTimeout(()=>{if(this.workspaceKeyboardSettlementTimer=null,!this.hasAttribute("data-workspace-keyboard-adjusting"))return;const e=this.shadowRoot?.activeElement,t=e instanceof HTMLElement&&e.classList.contains("esp-page-workspace-resize-handle")?e:null;this.toggleAttribute("data-workspace-keyboard-adjusting",!1),this.resizeSession||this.scheduleWorkspaceSettlement(t)},ee)}suspendPreviewLayoutForWorkspaceResize(){this.previewSyncRaf!==null&&(cancelAnimationFrame(this.previewSyncRaf),this.previewSyncRaf=null),this.previewSyncGeneration+=1,this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1)}setPreviewLayoutState(e,t){this.previewVisible=e,this.previewReclaiming=e&&t,e||this.endWorkspaceResize()}setWorkspaceWidths(e,t,i=!1){const s=Math.max(0,e),a=Math.max(0,t);this.style.setProperty("--_esp-page-preview-used-width",`${s}px`),this.style.setProperty("--_esp-page-flyout-used-width",`${a}px`),this.toggleAttribute("data-workspace-preferred",i),this.allocatedPreviewWidth=s,this.allocatedFlyoutWidth=a}clampWidth(e,t,i){return Math.min(Math.max(e,t),Math.max(t,i))}workspaceUsesPreference(e,t){return e&&this.preferredPreviewWidth!==null||t&&this.preferredFlyoutWidth!==null}preferredWorkspaceWidth(e,t,i,s,a,r){const o=e?this.clampWidth(this.preferredPreviewWidth??i,Math.max(0,i),Math.max(i,s)):0,n=t?this.clampWidth(this.preferredFlyoutWidth??a,Math.max(0,a),Math.max(a,r)):0;return o+n}visiblePageInlineBounds(){const e=this.getBoundingClientRect();let t=e.left,i=e.right;const s=window.visualViewport,a=s?.offsetLeft??0,r=s?.width??document.documentElement.clientWidth;r>0&&(t=Math.max(t,a),i=Math.min(i,a+r));const o=this.getRootNode();let n=this.parentElement??(o instanceof ShadowRoot?o.host:null);for(;n;){const v=getComputedStyle(n).overflowX;if(["auto","clip","hidden","scroll"].includes(v)){const d=n.getBoundingClientRect();t=Math.max(t,d.left),i=Math.min(i,d.right)}const p=n.getRootNode();n=n.parentElement??(p instanceof ShadowRoot?p.host:null)}return{left:t,right:i,width:Math.max(0,i-t)}}visibleSpaceWidth(){const e=this.previewSpace.value?.getBoundingClientRect();if(!e)return 0;const t=this.visiblePageInlineBounds(),i=Math.max(0,t.left-e.left),s=Math.max(0,e.right-t.right);return Math.max(0,e.width-i-s)}probeWidth(e){return e.value?.getBoundingClientRect().width??0}allocateWorkspaceWidths(e,t,i,s,a,r,o){const n=Math.max(0,e),v=Math.max(0,s),p=Math.max(v,a),d=Math.max(0,r),l=Math.max(d,o);let h=0,u=0;t&&i?(h=Math.min(p,Math.max(v,n-d)),u=Math.min(l,Math.max(d,n-h))):t?h=Math.min(p,Math.max(v,n)):i&&(u=Math.min(l,Math.max(d,n))),t&&this.preferredPreviewWidth!==null&&(h=this.clampWidth(this.preferredPreviewWidth,v,p),i&&this.preferredFlyoutWidth===null&&(u=this.clampWidth(n-h,d,l))),i&&this.preferredFlyoutWidth!==null&&(u=this.clampWidth(this.preferredFlyoutWidth,d,l),t&&this.preferredPreviewWidth===null&&(h=this.clampWidth(n-u,v,p)));let g=h+u-n;if(g>0&&i){const b=Math.min(g,Math.max(0,u-d));u-=b,g-=b}return g>0&&t&&(h-=Math.min(g,Math.max(0,h-v))),{previewWidth:h,flyoutWidth:u}}workspaceResizeDirection(){return getComputedStyle(this).direction==="rtl"?-1:1}resizeStep(e){const t=this.probeWidth(e?this.resizeLargeStepProbe:this.resizeStepProbe);return t>0?t:e?J:Z}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>c&&(this.previewCollapsedSidebarWidth=e),e>c?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=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),a=Math.max(s,this.probeWidth(this.previewMaxWidthProbe)),r=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),o=this.probeWidth(this.mainMaxWidthProbe),n=Math.max(0,t+e),v=o>0?Math.max(0,n-o):0,p=Math.max(s,v),d=Math.max(0,n+i-r);return{minimum:p,maximum:Math.max(p,Math.min(a,d))}}previewFlyoutResizeRange(e=this.renderedWorkspaceWidths().previewWidth,t=this.renderedWorkspaceWidths().flyoutWidth){const i=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),s=Math.max(i,this.probeWidth(this.previewMaxWidthProbe)),a=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),r=Math.max(a,this.probeWidth(this.flyoutMaxWidthProbe)),o=e+t;return{minimum:Math.max(i,o-r),maximum:Math.max(i,Math.min(s,o-a))}}separatorIsAvailable(e){return!this.workspaceResizable||this.hasAttribute("flyout-overlay-open")?!1:e==="main-preview"?this.previewVisible:this.hasAttribute("flyout-open")}flyoutOnlyResizeRange(e=this.renderedWorkspaceWidths().flyoutWidth,t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0){const i=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),s=Math.max(i,this.probeWidth(this.flyoutMaxWidthProbe)),a=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),r=this.probeWidth(this.mainMaxWidthProbe),o=Math.max(0,t+e),n=r>0?Math.max(0,o-r):0,v=Math.max(i,n);return{minimum:v,maximum:Math.max(v,Math.min(s,o-a))}}applyWorkspaceResize(e,t,i,s,a,r,o,n){if(!this.separatorIsAvailable(e))return;const v=t*n;let p=e,d=s,l=a;if(e==="main-preview"){const h=this.mainPreviewResizeRange(s,r,o),u=s-v;d=this.clampWidth(u,h.minimum,h.maximum),this.preferredPreviewWidth=d;const g=Math.max(0,this.probeWidth(this.mainMinWidthProbe));o>0&&d>Math.max(0,r+s-g)+c&&this.requestPreviewNavigationCollapse();const b=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),W=Math.max(0,b-u),y=h.minimum<=b+c;if(W>0&&y&&a>0){const m=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),f=Math.max(m,this.probeWidth(this.flyoutMaxWidthProbe));l=this.clampWidth(a-W,m,f),this.preferredFlyoutWidth=l}else a>0&&(this.preferredFlyoutWidth??=a)}else if(this.previewVisible){const h=this.previewFlyoutResizeRange(s,a),u=s+v;d=this.clampWidth(u,h.minimum,h.maximum),l=s+a-d,this.preferredPreviewWidth=d;const g=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),b=Math.max(0,g-u),W=h.minimum<=g+c;if(b>0&&W){const y=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),m=Math.max(y,this.probeWidth(this.flyoutMaxWidthProbe)),f=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),S=Math.max(0,r-f);l=this.clampWidth(l+Math.min(b,S),y,m)}this.preferredFlyoutWidth=l}else{p="main-flyout";const h=this.flyoutOnlyResizeRange(a,r);l=this.clampWidth(a-v,h.minimum,h.maximum),d=0,this.preferredFlyoutWidth=l}this.setWorkspaceWidths(d,l,!0),this.previewVisible&&this.setPreviewLayoutState(!0,!0),i==="keyboard"&&(this.toggleAttribute("data-workspace-keyboard-adjusting",!0),this.deferWorkspaceKeyboardSettlement()),this.dispatchEvent(new CustomEvent("esp-page-workspace-resize",{bubbles:!0,composed:!0,detail:{separator:p,source:i,previewWidth:d,flyoutWidth:l}}))}endWorkspaceResize(){const e=this.resizeSession;this.resizeSession=null,this.toggleAttribute("data-workspace-resizing",!1),e?.target.hasPointerCapture?.(e.pointerId)&&e.target.releasePointerCapture(e.pointerId),e&&this.scheduleWorkspaceSettlement()}previewFitsWithinPage(e,t,i,s,a,r){const o=this.shadowRoot?.querySelector(".esp-page-main"),n=this.shadowRoot?.querySelector(".esp-page-preview"),v=this.shadowRoot?.querySelector(".esp-page-flyout");if(!o||!n||!v)return!1;const p=this.visiblePageInlineBounds(),d=o.getBoundingClientRect(),l=n.getBoundingClientRect(),h=v.getBoundingClientRect(),u=Math.max(t,i),g=Math.max(a,r),b=l.width+c>=t&&l.width<=u+c,W=!s||h.width+c>=a&&h.width<=g+c,y=l.left+c>=p.left&&l.right<=p.right+c&&(!s||h.left+c>=p.left&&h.right<=p.right+c),m=getComputedStyle(this).direction==="rtl"?d.left+c>=l.right&&(!s||l.left+c>=h.right):d.right<=l.left+c&&(!s||l.right<=h.left+c);return d.width+c>=e&&b&&W&&y&&m}flyoutFitsWithinPage(e,t,i){const s=this.shadowRoot?.querySelector(".esp-page-main"),a=this.shadowRoot?.querySelector(".esp-page-flyout");if(!s||!a)return!1;const r=this.visiblePageInlineBounds(),o=s.getBoundingClientRect(),n=a.getBoundingClientRect(),v=Math.max(t,i),p=n.width+c>=t&&n.width<=v+c,d=n.left+c>=r.left&&n.right<=r.right+c,l=getComputedStyle(this).direction==="rtl"?o.left+c>=n.right:o.right<=n.left+c;return o.width+c>=e&&p&&d&&l}workspaceMinimumsCanFit(e,t,i,s,a){const r=this.visiblePageInlineBounds().width;if(r<=0||e<=0||t&&i<=0||s&&a<=0)return!1;const o=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,n=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,p=(t&&this.getPreviewNavigationPair()!==null?0:o)+n+e+(t?i:0)+(s?a:0);return r+c>=p}preferredWorkspaceFitsWithNavigation(e,t,i){const s=this.visiblePageInlineBounds().width,a=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,r=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,o=a+i+r+e+t;return s+c>=o}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))<=c)}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>c)&&(!t||s>c)}async candidateFitsAfterLayoutSettles(e,t,i){if(await this.updateComplete,e!==this.previewSyncGeneration||!this.isConnected)return null;let s=null,a=0;for(let r=0;r<Q;r+=1){if(await new Promise(n=>requestAnimationFrame(()=>n())),e!==this.previewSyncGeneration||!this.isConnected)return null;if(t())return!0;if(!i()){s=null,a=0;continue}const o=this.workspaceGeometrySample();if(a=s&&this.workspaceGeometryMatches(s,o)?a+1:1,a>=Y)return!1;s=o}return null}async promoteFlyoutIfClipped(e,t,i,s){if(i<=0)return!1;const a=await this.candidateFitsAfterLayoutSettles(e,()=>this.flyoutFitsWithinPage(t,i,s),()=>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"))return;let i=!1;const s=this.previewVisible;this.toggleAttribute("data-preview-measuring",!0);try{const a=this.previewOpen&&this.previewHasContent(),r=this.previewMediaQuery?.matches??!1,o=this.hasAttribute("flyout-overlay-open"),n=this.hasAttribute("flyout-open"),v=this.hasAttribute("data-preview-navigation-collapsed")?this.previewCollapsedSidebarWidth:0,p=this.probeWidth(this.previewMinWidthProbe),d=this.probeWidth(this.previewMaxWidthProbe),l=this.probeWidth(this.flyoutMinWidthProbe),h=this.probeWidth(this.flyoutMaxWidthProbe),u=this.probeWidth(this.mainMinWidthProbe),g=this.openAutoFlyouts().some(P=>P.pageOverlayRequested===!0);if(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),g){const P=this.visiblePageInlineBounds().width,A=this.flyoutOverlayPromotionWidth===null||P>=this.flyoutOverlayPromotionWidth+X;!r&&t&&this.flyoutOverlayRecoveryReady&&A&&this.workspaceMinimumsCanFit(u,a,p,!0,l)?await this.setPageFlyoutOverlay(!1):r&&await this.setPageFlyoutOverlay(!1);return}if(this.toggleAttribute("data-preview-navigation-collapsed",!1),await this.updateComplete,e!==this.previewSyncGeneration)return;const b=this.visibleSpaceWidth(),W=Math.max(0,b-v),y=a&&!r&&!o,m=n&&!r;if(u>0&&(!y||p>0)&&(!m||l>0)&&(y||m)&&!this.workspaceMinimumsCanFit(u,y,p,m,l)){m&&await this.promoteFlyoutToOverlay();return}const S=(y?p:0)+(m?l:0),C=this.workspaceUsesPreference(y,m),O=this.preferredWorkspaceWidth(y,m,p,d,l,h),E=C?Math.max(S,O):S;let z=this.allocateWorkspaceWidths(W,y,m,p,d,l,h);if(this.setWorkspaceWidths(z.previewWidth,z.flyoutWidth,C),!y||p<=0){if(m){if(C){const P=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,A=Math.max(l,P+W-u);z=this.allocateWorkspaceWidths(A,!1,!0,p,d,l,h),this.setWorkspaceWidths(0,z.flyoutWidth,!0),await this.updateComplete}await this.promoteFlyoutIfClipped(e,u,l,h)}return}if(W+c>=E){s||this.toggleAttribute("data-preview-validating",!0),this.setPreviewLayoutState(!0,!1);const P=await this.candidateFitsAfterLayoutSettles(e,()=>this.previewFitsWithinPage(u,p,d,m,l,h),()=>this.workspaceCandidateIsMeasurable(!0,m));if(P===null)return;if(P){this.toggleAttribute("data-preview-validating",!1);return}this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,m?l:0),m&&await this.promoteFlyoutToOverlay();return}const N=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,T=C?this.preferredWorkspaceFitsWithNavigation(u,E,v):N+W+c>=u+E;if(i=T?!1:await this.setPreviewNavigationCollapse(this.previewCollapseSidebar),T&&await this.setPreviewNavigationCollapse(!1),e!==this.previewSyncGeneration)return;if(C){const P=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,A=Math.max(S,P+this.visibleSpaceWidth()-u);z=this.allocateWorkspaceWidths(A,!0,m,p,d,l,h),this.setWorkspaceWidths(z.previewWidth,z.flyoutWidth,!0)}if(s||this.toggleAttribute("data-preview-validating",!0),this.setPreviewLayoutState(!0,!0),await this.updateComplete,e!==this.previewSyncGeneration)return;const $=this.visibleSpaceWidth();z=this.allocateWorkspaceWidths($,!0,m,p,d,l,h),this.setWorkspaceWidths(z.previewWidth,z.flyoutWidth,C);const B=await this.candidateFitsAfterLayoutSettles(e,()=>this.previewFitsWithinPage(u,p,d,m,l,h),()=>this.workspaceCandidateIsMeasurable(!0,m));if(B===null)return;B?this.toggleAttribute("data-preview-validating",!1):(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,m?l:0),i=!1,m&&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.requestUpdate())}}setupPreviewLayoutObserver(){if(this.isConnected){if(!this.previewMediaQuery&&typeof window.matchMedia=="function"&&(this.previewMediaQuery=window.matchMedia(U),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.previewMaxWidthProbe,this.flyoutMinWidthProbe,this.flyoutMaxWidthProbe,this.mainMinWidthProbe,this.resizeStepProbe,this.resizeLargeStepProbe])t.value&&this.previewResizeObserver.observe(t.value)}this.schedulePreviewLayout(!0)}}footerElementProvidesLandmark(e){return e.matches(I)||e.querySelector(I)!==null}syncFooterLandmark(){const t=(this.footerSlot.value?.assignedElements({flatten:!0})??[]).some(i=>this.footerElementProvidesLandmark(i));this.footerWrapperIsLandmark=!t}showPreview(){this.previewOpen=!0}closePreview(){this.previewOpen=!1}togglePreview(){this.previewOpen=!this.previewOpen}AddDialog(e){this.dialogZone.value?.appendChild(e)}firstUpdated(e){super.firstUpdated(e),this.syncFlyoutState(),this.setupPreviewLayoutObserver()}updated(e){super.updated(e),(e.has("fixedMenus")||e.has("headerPosition"))&&H().publish("fixed-menus-changed",{fixed:this.fixedMenus||this.headerPosition==="fixed"}),(e.has("previewOpen")||e.has("previewCollapseSidebar"))&&this.schedulePreviewLayout(!0),e.has("workspaceResizable")&&!this.workspaceResizable&&(this.finishWorkspaceKeyboardResize(),this.endWorkspaceResize())}render(){const e=this.fixedMenus||this.headerPosition==="fixed",t=!e&&this.headerPosition==="sticky",i=this.mainPreviewResizeRange(),s=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),a=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),r=Math.max(a,this.probeWidth(this.flyoutMaxWidthProbe)),o=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),n=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,v=this.hasAttribute("flyout-open"),p=n+this.allocatedPreviewWidth,d=i.minimum<=s+c,l=v&&d?Math.max(0,this.allocatedFlyoutWidth-a):0,h=Math.max(o,p-i.maximum),u=Math.max(h,Math.max(o,p-i.minimum)+l);let g,b;if(this.previewVisible){const f=this.previewFlyoutResizeRange(),S=this.allocatedPreviewWidth+this.allocatedFlyoutWidth,O=f.minimum<=s+c?Math.max(0,n-o):0;g=Math.max(a,S-f.maximum),b=Math.max(g,Math.min(r,S-f.minimum+O))}else{const f=this.flyoutOnlyResizeRange();g=f.minimum,b=f.maximum}const W=this.previewVisible?"preview-flyout-resize-handle":"main-flyout-resize-handle",y=this.previewVisible?"Resize preview and help panes":"Resize help pane";return K`
2
- <div part="wrapper" class="esp-page ${V({"fixed-menus":e,"fixed-header":e,"sticky-header":t})}">
1
+ var R=function(A,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(A,e,t,i);else for(var o=A.length-1;o>=0;o--)(r=A[o])&&(a=(s<3?r(a):s>3?r(e,t,a):r(e,t))||a);return s>3&&a&&Object.defineProperty(e,t,a),a};import{css as j,html as H,nothing as U}from"lit";import{customElement as Y,property as P,state as E}from"lit/decorators.js";import{classMap as Q}from"lit/directives/class-map.js";import{createRef as W,ref as x}from"lit/directives/ref.js";import{EspalierElementBase as N}from"../shared/esp-element-base.js";import{BiDirectionalStickyController as _}from"./bi-directional-sticky-controller.js";import{getEspBus as X}from"../shared/bus-events.js";import"../toaster/esp-toaster.js";const $='esp-footer, footer, [role~="contentinfo"]',Z="(max-width: 50em)",h=1,J=5,ee=12,te=48,ie=16,ae=64,se=250;let k=class extends N{constructor(){super(),this.dialogZone=W(),this.flyoutSlot=W(),this.footerSlot=W(),this.previewSlot=W(),this.previewSpace=W(),this.previewMinWidthProbe=W(),this.previewDefaultWidthProbe=W(),this.previewMaxWidthProbe=W(),this.flyoutMinWidthProbe=W(),this.flyoutDefaultWidthProbe=W(),this.flyoutMaxWidthProbe=W(),this.mainMinWidthProbe=W(),this.mainConfiguredMaxWidthProbe=W(),this.mainMaxWidthProbe=W(),this.resizeStepProbe=W(),this.resizeLargeStepProbe=W(),this.previewObservedWidths=new WeakMap,this.previewSyncRaf=null,this.previewSyncGeneration=0,this.previewSyncTask=Promise.resolve(),this.previewOverlayRecoveryRequested=!1,this.previewHeader=null,this.previewMenu=null,this.previewCollapsedSidebarWidth=0,this.previewNavigationCollapseTask=null,this.flyoutOverlayPromotionWidth=null,this.flyoutOverlayRecoveryReady=!1,this.flyoutOverlayRecoveryGeneration=0,this.preferredPreviewWidth=null,this.preferredFlyoutWidth=null,this.resizeSession=null,this.workspaceKeyboardSettlementTimer=null,this.footerWrapperIsLandmark=!0,this.allocatedPreviewWidth=0,this.allocatedFlyoutWidth=0,this.onWorkspaceResizePointerDown=(e,t)=>{if(t.button!==0||!this.separatorIsAvailable(e))return;const i=t.currentTarget,s=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,a=this.renderedWorkspaceWidths();this.endWorkspaceResize(),this.finishWorkspaceKeyboardResize(!1),this.suspendPreviewLayoutForWorkspaceResize(),this.resizeSession={separator:e,pointerId:t.pointerId,target:i,startClientX:t.clientX,startPreviewWidth:a.previewWidth,startFlyoutWidth:a.flyoutWidth,startMainWidth:s,startNavigationAllowance:this.previewNavigationResizeAllowance(),direction:this.workspaceResizeDirection()};try{i.setPointerCapture?.(t.pointerId)}catch{}this.toggleAttribute("data-workspace-resizing",!0),t.preventDefault()},this.onWorkspaceResizePointerMove=e=>{const t=this.resizeSession;!t||t.pointerId!==e.pointerId||(e.preventDefault(),this.applyWorkspaceResize(t.separator,e.clientX-t.startClientX,"pointer",t.startPreviewWidth,t.startFlyoutWidth,t.startMainWidth,t.startNavigationAllowance,t.direction))},this.onWorkspaceResizePointerEnd=e=>{!this.resizeSession||this.resizeSession.pointerId!==e.pointerId||(e.preventDefault(),this.endWorkspaceResize())},this.onWorkspaceResizeBlur=e=>{this.hasAttribute("data-workspace-keyboard-adjusting")&&(e.relatedTarget instanceof Element&&e.relatedTarget.classList.contains("esp-page-workspace-resize-handle")||this.finishWorkspaceKeyboardResize())},this.onWorkspaceResizeKeyDown=(e,t)=>{if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight"||!this.separatorIsAvailable(e))return;t.preventDefault(),this.hasAttribute("data-workspace-keyboard-adjusting")||this.suspendPreviewLayoutForWorkspaceResize();const i=(t.key==="ArrowLeft"?-1:1)*this.resizeStep(t.shiftKey),s=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,a=this.renderedWorkspaceWidths();this.applyWorkspaceResize(e,i,"keyboard",a.previewWidth,a.flyoutWidth,s,this.previewNavigationResizeAllowance(),this.workspaceResizeDirection())},this.schedulePreviewLayout=(e=!1)=>{if(!this.isConnected||!this.hasUpdated||(this.previewOverlayRecoveryRequested||=e===!0,this.resizeSession||this.hasAttribute("data-workspace-keyboard-adjusting")))return;this.previewSyncGeneration+=1;const t=this.previewSyncGeneration;this.previewSyncRaf!==null&&cancelAnimationFrame(this.previewSyncRaf),this.previewSyncRaf=requestAnimationFrame(()=>{this.previewSyncRaf=null;const i=this.previewOverlayRecoveryRequested;this.previewOverlayRecoveryRequested=!1,this.previewSyncTask=this.previewSyncTask.then(()=>this.syncPreviewLayout(t,i)).catch(()=>{})})},this.onPreviewMediaChange=()=>this.schedulePreviewLayout(!0),this.onPreviewResize=e=>{let t=!1;for(const i of e){const s=i.contentRect.width;if(i.target instanceof HTMLElement&&i.target.classList.contains("esp-page-left")){s>h&&!this.hasAttribute("data-preview-navigation-collapsed")&&(this.previewCollapsedSidebarWidth=s);continue}const a=this.previewObservedWidths.get(i.target);this.previewObservedWidths.set(i.target,s),t||=a===void 0||Math.abs(a-s)>.25}t&&this.schedulePreviewLayout(!0)},this.kind="wide",this.align="start",this.contained=!1,this.headerPosition="normal",this.fixedMenus=!1,this.previewOpen=!1,this.previewLabel="Preview",this.previewCollapseSidebar=!1,this.workspaceResizable=!1,this.previewVisible=!1,this.previewReclaiming=!1,new _(this,".esp-page-left > .sticky-wrapper"),new _(this,".esp-page-right > .sticky-wrapper"),new _(this,".esp-page-flyout > .sticky-wrapper"),new _(this,".esp-page-preview > .sticky-wrapper",{topOffset:()=>0}),this.addEventListener("flyout-state-changed",e=>this.syncFlyoutState(e))}connectedCallback(){const e=Array.from(this.children).filter(t=>t.getAttribute("slot")==="footer");this.footerWrapperIsLandmark=!e.some(t=>this.footerElementProvidesLandmark(t)),super.connectedCallback(),this.syncMainMaximumConfiguration(),this.hasUpdated&&queueMicrotask(()=>this.setupPreviewLayoutObserver())}disconnectedCallback(){this.finishWorkspaceKeyboardResize(!1),this.endWorkspaceResize(),this.previewResizeObserver?.disconnect(),this.previewResizeObserver=void 0,this.previewMediaQuery?.removeEventListener("change",this.onPreviewMediaChange),this.previewMediaQuery=void 0,this.previewSyncRaf!==null&&(cancelAnimationFrame(this.previewSyncRaf),this.previewSyncRaf=null),this.previewSyncGeneration+=1,this.previewOverlayRecoveryRequested=!1,this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1),this.toggleAttribute("data-workspace-keyboard-adjusting",!1),this.toggleAttribute("descendant-flyout-overlay-open",!1),this.clearFlyoutOverlayRecovery(),this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),this.preferredPreviewWidth=null,this.preferredFlyoutWidth=null,this.previewNavigationCollapseTask=null,this.setPreviewNavigationCollapse(!1),super.disconnectedCallback()}syncFlyoutState(e){if(e&&e.target?.closest?.("esp-page")!==this){this.syncDescendantFlyoutOverlayState();return}const t=r=>{const o=r;return(typeof o.mode=="string"?o.mode:r.getAttribute("mode"))==="overlay"||o.pageOverlayRequested===!0},i=r=>{const o=r.open;return typeof o=="boolean"?o:r.hasAttribute("open")},s=r=>r.anchor!=null,a=(this.flyoutSlot.value?.assignedElements()??[]).filter(r=>r.tagName==="ESP-FLYOUT");for(const r of a){const o=r,p=typeof o.mode=="string"?o.mode:r.getAttribute("mode");o.pageOverlayRequested&&(!i(r)||p!=="auto")&&(o.pageOverlayRequested=!1)}a.some(r=>r.pageOverlayRequested===!0)||this.clearFlyoutOverlayRecovery(),this.toggleAttribute("flyout-open",a.some(r=>i(r)&&!t(r))),this.toggleAttribute("flyout-overlay-open",a.some(r=>i(r)&&t(r))),this.toggleAttribute("flyout-anchored",a.some(r=>i(r)&&s(r))),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"),a=typeof i.mode=="string"?i.mode:t.getAttribute("mode");return s&&(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 s of this.assignedFlyouts()){const a=e&&i.has(s);s.pageOverlayRequested!==a&&(s.pageOverlayRequested=a,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?.assignedNodes({flatten:!0});return e?e.some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent?.trim().length??0)>0):Array.from(this.childNodes).some(t=>t instanceof Element&&t.getAttribute("slot")==="preview"&&!t.hasAttribute("hidden"))}getPreviewNavigationPair(){if(!this.previewCollapseSidebar)return null;const e=Array.from(this.children),t=e.find(r=>r.slot==="header"&&r.tagName==="ESP-HEADER"),i=e.find(r=>r.slot==="sidebar"&&r.tagName==="ESP-MENU");if(!t||!i||!i.id)return null;const s=typeof t.drawerTarget=="string"?t.drawerTarget:t.getAttribute("drawer-target")??"",a=typeof i.mode=="string"?i.mode:i.getAttribute("mode");return s!==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,s=this.previewHeader&&this.previewHeader!==t?.header?this.previewHeader:null,a=this.previewMenu&&this.previewMenu!==t?.menu?this.previewMenu:null;if(s&&(s.previewCollapseRequested=!1),a&&(a.previewCollapseRequested=!1),this.previewHeader=t?.header??null,this.previewMenu=t?.menu??null,this.toggleAttribute("data-preview-navigation-collapsed",!1),await s?.updateComplete,await a?.updateComplete,!t)return!1;const r=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=r,this.toggleAttribute("data-preview-navigation-collapsed",!0),!0):(t.header.previewCollapseRequested=!1,t.menu.previewCollapseRequested=!1,await t.header.updateComplete,await t.menu.updateComplete,this.previewHeader=null,this.previewMenu=null,!1)}requestPreviewNavigationCollapse(){if(this.hasAttribute("data-preview-navigation-collapsed")||this.previewNavigationCollapseTask)return;const e=this.setPreviewNavigationCollapse(!0);this.previewNavigationCollapseTask=e,e.then(()=>{this.previewNavigationCollapseTask===e&&(this.previewNavigationCollapseTask=null)},()=>{this.previewNavigationCollapseTask===e&&(this.previewNavigationCollapseTask=null)})}scheduleWorkspaceSettlement(e=null){const t=()=>{this.schedulePreviewLayout(),e&&requestAnimationFrame(()=>{this.previewSyncTask.then(()=>{const a=this.shadowRoot?.activeElement,r=this.ownerDocument.activeElement;!this.isConnected||!e.isConnected||a&&a!==e||r!==this&&r!==this.ownerDocument.body||getComputedStyle(e).display!=="none"&&e.focus({preventScroll:!0})})})},i=this.previewNavigationCollapseTask;if(!i){t();return}i.then(()=>t(),()=>t())}clearWorkspaceKeyboardSettlementTimer(){this.workspaceKeyboardSettlementTimer!==null&&(clearTimeout(this.workspaceKeyboardSettlementTimer),this.workspaceKeyboardSettlementTimer=null)}finishWorkspaceKeyboardResize(e=!0){this.clearWorkspaceKeyboardSettlementTimer();const t=this.hasAttribute("data-workspace-keyboard-adjusting");this.toggleAttribute("data-workspace-keyboard-adjusting",!1),t&&e&&!this.resizeSession&&this.scheduleWorkspaceSettlement()}deferWorkspaceKeyboardSettlement(){this.clearWorkspaceKeyboardSettlementTimer(),this.workspaceKeyboardSettlementTimer=setTimeout(()=>{if(this.workspaceKeyboardSettlementTimer=null,!this.hasAttribute("data-workspace-keyboard-adjusting"))return;const e=this.shadowRoot?.activeElement,t=e instanceof HTMLElement&&e.classList.contains("esp-page-workspace-resize-handle")?e:null;this.toggleAttribute("data-workspace-keyboard-adjusting",!1),this.resizeSession||this.scheduleWorkspaceSettlement(t)},se)}suspendPreviewLayoutForWorkspaceResize(){this.previewSyncRaf!==null&&(cancelAnimationFrame(this.previewSyncRaf),this.previewSyncRaf=null),this.previewSyncGeneration+=1,this.toggleAttribute("data-preview-measuring",!1),this.toggleAttribute("data-preview-validating",!1)}setPreviewLayoutState(e,t){this.previewVisible=e,this.previewReclaiming=e&&t,e||this.endWorkspaceResize()}setWorkspaceWidths(e,t,i=!1){const s=Math.max(0,e),a=Math.max(0,t);this.style.setProperty("--_esp-page-preview-used-width",`${s}px`),this.style.setProperty("--_esp-page-flyout-used-width",`${a}px`),this.toggleAttribute("data-workspace-targeted",i),this.allocatedPreviewWidth=s,this.allocatedFlyoutWidth=a}clampWidth(e,t,i){return Math.min(Math.max(e,t),Math.max(t,i))}visiblePageInlineBounds(){const e=this.getBoundingClientRect();let t=e.left,i=e.right;const s=window.visualViewport,a=s?.offsetLeft??0,r=s?.width??document.documentElement.clientWidth;r>0&&(t=Math.max(t,a),i=Math.min(i,a+r));const o=this.getRootNode();let p=this.parentElement??(o instanceof ShadowRoot?o.host:null);for(;p;){const g=getComputedStyle(p).overflowX;if(["auto","clip","hidden","scroll"].includes(g)){const c=p.getBoundingClientRect();t=Math.max(t,c.left),i=Math.min(i,c.right)}const l=p.getRootNode();p=p.parentElement??(l instanceof ShadowRoot?l.host:null)}return{left:t,right:i,width:Math.max(0,i-t)}}probeWidth(e){return e.value?.getBoundingClientRect().width??0}optionalWidth(e,t){return getComputedStyle(this).getPropertyValue(e).trim()===""?null:this.probeWidth(t)}syncMainMaximumConfiguration(){const e=getComputedStyle(this).getPropertyValue("--esp-page-main-max-width").trim()!=="";this.toggleAttribute("data-main-max-configured",e)}workspaceWidthCapacity(e,t,i=0){const s=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,a=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,r=Math.max(0,this.visiblePageInlineBounds().width-s-a-Math.max(0,i)),o=t>0?Math.min(r,t):r;return{natural:Math.max(0,r-o),maximum:Math.max(0,r-Math.max(0,e))}}workspaceTargetWidth(e,t,i){return Math.min(e.maximum,Math.max(t,i,e.natural))}allocateWorkspaceWidths(e,t,i,s,a,r,o,p=null,g=null){const l=Math.max(0,e),c=Math.max(0,s),d=Math.max(c,a),n=Math.max(0,r),b=Math.max(n,o),f=t?this.preferredPreviewWidth??(p===null?null:this.clampWidth(p,c,d)):null,v=i?this.preferredFlyoutWidth??(g===null?null:this.clampWidth(g,n,b)):null;let w=0,y=0;t&&i?(w=Math.min(d,Math.max(c,l-n)),y=Math.min(b,Math.max(n,l-w))):t?w=Math.min(d,Math.max(c,l)):i&&(y=Math.min(b,Math.max(n,l))),t&&f!==null&&(w=this.clampWidth(f,c,d),i&&v===null&&(y=this.clampWidth(l-w,n,b))),i&&v!==null&&(y=this.clampWidth(v,n,b),t&&f===null&&(w=this.clampWidth(l-y,c,d)));let M=w+y-l;if(M>0&&i){const u=Math.min(M,Math.max(0,y-n));y-=u,M-=u}return M>0&&t&&(w-=Math.min(M,Math.max(0,w-c))),{previewWidth:w,flyoutWidth:y}}workspaceResizeDirection(){return getComputedStyle(this).direction==="rtl"?-1:1}resizeStep(e){const t=this.probeWidth(e?this.resizeLargeStepProbe:this.resizeStepProbe);return t>0?t:e?ae:ie}previewNavigationResizeAllowance(){if(this.hasAttribute("data-preview-navigation-collapsed")||this.getPreviewNavigationPair()===null)return 0;const e=Math.max(0,this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0);return e>h&&(this.previewCollapsedSidebarWidth=e),e>h?e:this.previewCollapsedSidebarWidth}renderedWorkspaceWidths(){const e=this.shadowRoot?.querySelector(".esp-page-preview"),t=this.shadowRoot?.querySelector(".esp-page-flyout");return{previewWidth:this.allocatedPreviewWidth>0?this.allocatedPreviewWidth:e?.getBoundingClientRect().width??0,flyoutWidth:this.allocatedFlyoutWidth>0?this.allocatedFlyoutWidth:t?.getBoundingClientRect().width??0}}mainPreviewResizeRange(e=this.renderedWorkspaceWidths().previewWidth,t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,i=this.previewNavigationResizeAllowance()){const s=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),a=Math.max(s,this.probeWidth(this.previewMaxWidthProbe)),r=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),o=this.probeWidth(this.mainMaxWidthProbe),p=Math.max(0,t+e),g=o>0?Math.max(0,p-o):0,l=Math.max(s,g),c=Math.max(0,p+i-r);return{minimum:l,maximum:Math.max(l,Math.min(a,c))}}previewFlyoutResizeRange(e=this.renderedWorkspaceWidths().previewWidth,t=this.renderedWorkspaceWidths().flyoutWidth){const i=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),s=Math.max(i,this.probeWidth(this.previewMaxWidthProbe)),a=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),r=Math.max(a,this.probeWidth(this.flyoutMaxWidthProbe)),o=e+t;return{minimum:Math.max(i,o-r),maximum:Math.max(i,Math.min(s,o-a))}}separatorIsAvailable(e){return!this.workspaceResizable||this.hasAttribute("flyout-overlay-open")?!1:e==="main-preview"?this.previewVisible:this.hasAttribute("flyout-open")}flyoutOnlyResizeRange(e=this.renderedWorkspaceWidths().flyoutWidth,t=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0){const i=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),s=Math.max(i,this.probeWidth(this.flyoutMaxWidthProbe)),a=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),r=this.probeWidth(this.mainMaxWidthProbe),o=Math.max(0,t+e),p=r>0?Math.max(0,o-r):0,g=Math.max(i,p);return{minimum:g,maximum:Math.max(g,Math.min(s,o-a))}}applyWorkspaceResize(e,t,i,s,a,r,o,p){if(!this.separatorIsAvailable(e))return;const g=t*p;let l=e,c=s,d=a;if(e==="main-preview"){const n=this.mainPreviewResizeRange(s,r,o),b=s-g;c=this.clampWidth(b,n.minimum,n.maximum),this.preferredPreviewWidth=c;const f=Math.max(0,this.probeWidth(this.mainMinWidthProbe));o>0&&c>Math.max(0,r+s-f)+h&&this.requestPreviewNavigationCollapse();const v=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),w=Math.max(0,v-b),y=n.minimum<=v+h;if(w>0&&y&&a>0){const M=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),u=Math.max(M,this.probeWidth(this.flyoutMaxWidthProbe));d=this.clampWidth(a-w,M,u),this.preferredFlyoutWidth=d}else a>0&&(this.preferredFlyoutWidth??=a)}else if(this.previewVisible){const n=this.previewFlyoutResizeRange(s,a),b=s+g;c=this.clampWidth(b,n.minimum,n.maximum),d=s+a-c,this.preferredPreviewWidth=c;const f=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),v=Math.max(0,f-b),w=n.minimum<=f+h;if(v>0&&w){const y=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),M=Math.max(y,this.probeWidth(this.flyoutMaxWidthProbe)),u=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),m=Math.max(0,r-u);d=this.clampWidth(d+Math.min(v,m),y,M)}this.preferredFlyoutWidth=d}else{l="main-flyout";const n=this.flyoutOnlyResizeRange(a,r);d=this.clampWidth(a-g,n.minimum,n.maximum),c=0,this.preferredFlyoutWidth=d}this.setWorkspaceWidths(c,d,!0),this.previewVisible&&this.setPreviewLayoutState(!0,!0),i==="keyboard"&&(this.toggleAttribute("data-workspace-keyboard-adjusting",!0),this.deferWorkspaceKeyboardSettlement()),this.dispatchEvent(new CustomEvent("esp-page-workspace-resize",{bubbles:!0,composed:!0,detail:{separator:l,source:i,previewWidth:c,flyoutWidth:d}}))}endWorkspaceResize(){const e=this.resizeSession;this.resizeSession=null,this.toggleAttribute("data-workspace-resizing",!1),e?.target.hasPointerCapture?.(e.pointerId)&&e.target.releasePointerCapture(e.pointerId),e&&this.scheduleWorkspaceSettlement()}previewFitsWithinPage(e,t,i,s,a,r){const o=this.shadowRoot?.querySelector(".esp-page-main"),p=this.shadowRoot?.querySelector(".esp-page-preview"),g=this.shadowRoot?.querySelector(".esp-page-flyout");if(!o||!p||!g)return!1;const l=this.visiblePageInlineBounds(),c=o.getBoundingClientRect(),d=p.getBoundingClientRect(),n=g.getBoundingClientRect(),b=Math.max(t,i),f=Math.max(a,r),v=d.width+h>=t&&d.width<=b+h,w=!s||n.width+h>=a&&n.width<=f+h,y=d.left+h>=l.left&&d.right<=l.right+h&&(!s||n.left+h>=l.left&&n.right<=l.right+h),M=getComputedStyle(this).direction==="rtl"?c.left+h>=d.right&&(!s||d.left+h>=n.right):c.right<=d.left+h&&(!s||d.right<=n.left+h);return c.width+h>=e&&v&&w&&y&&M}flyoutFitsWithinPage(e,t,i){const s=this.shadowRoot?.querySelector(".esp-page-main"),a=this.shadowRoot?.querySelector(".esp-page-flyout");if(!s||!a)return!1;const r=this.visiblePageInlineBounds(),o=s.getBoundingClientRect(),p=a.getBoundingClientRect(),g=Math.max(t,i),l=p.width+h>=t&&p.width<=g+h,c=p.left+h>=r.left&&p.right<=r.right+h,d=getComputedStyle(this).direction==="rtl"?o.left+h>=p.right:o.right<=p.left+h;return o.width+h>=e&&l&&c&&d}workspaceMinimumsCanFit(e,t,i,s,a){const r=this.visiblePageInlineBounds().width;if(r<=0||e<=0||t&&i<=0||s&&a<=0)return!1;const o=this.shadowRoot?.querySelector(".esp-page-left")?.getBoundingClientRect().width??0,p=this.shadowRoot?.querySelector(".esp-page-right")?.getBoundingClientRect().width??0,l=(t&&this.getPreviewNavigationPair()!==null?0:o)+p+e+(t?i:0)+(s?a:0);return r+h>=l}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))<=h)}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>h)&&(!t||s>h)}async candidateFitsAfterLayoutSettles(e,t,i){if(await this.updateComplete,e!==this.previewSyncGeneration||!this.isConnected)return null;let s=null,a=0;for(let r=0;r<ee;r+=1){if(await new Promise(p=>requestAnimationFrame(()=>p())),e!==this.previewSyncGeneration||!this.isConnected)return null;if(t())return!0;if(!i()){s=null,a=0;continue}const o=this.workspaceGeometrySample();if(a=s&&this.workspaceGeometryMatches(s,o)?a+1:1,a>=J)return!1;s=o}return null}async promoteFlyoutIfClipped(e,t,i,s){if(i<=0)return!1;const a=await this.candidateFitsAfterLayoutSettles(e,()=>this.flyoutFitsWithinPage(t,i,s),()=>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"))return;let i=!1;const s=this.previewVisible;this.toggleAttribute("data-preview-measuring",!0);try{const a=this.previewOpen&&this.previewHasContent(),r=this.previewMediaQuery?.matches??!1,o=this.hasAttribute("flyout-overlay-open"),p=this.hasAttribute("flyout-open"),g=this.hasAttribute("data-preview-navigation-collapsed")?this.previewCollapsedSidebarWidth:0,l=this.probeWidth(this.previewMinWidthProbe),c=this.optionalWidth("--esp-page-preview-default-width",this.previewDefaultWidthProbe),d=this.probeWidth(this.previewMaxWidthProbe),n=this.probeWidth(this.flyoutMinWidthProbe),b=this.optionalWidth("--esp-page-flyout-default-width",this.flyoutDefaultWidthProbe),f=this.probeWidth(this.flyoutMaxWidthProbe),v=this.probeWidth(this.mainMinWidthProbe);this.syncMainMaximumConfiguration();const w=this.probeWidth(this.mainMaxWidthProbe),y=this.kind==="full"&&!this.hasAttribute("data-main-max-configured")?0:w,M=this.openAutoFlyouts().some(S=>S.pageOverlayRequested===!0);if(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,0),M){const S=this.visiblePageInlineBounds().width,V=this.flyoutOverlayPromotionWidth===null||S>=this.flyoutOverlayPromotionWidth+te;!r&&t&&this.flyoutOverlayRecoveryReady&&V&&this.workspaceMinimumsCanFit(v,a,l,!0,n)?await this.setPageFlyoutOverlay(!1):r&&await this.setPageFlyoutOverlay(!1);return}if(this.toggleAttribute("data-preview-navigation-collapsed",!1),await this.updateComplete,e!==this.previewSyncGeneration)return;const u=a&&!r&&!o,m=p&&!r;if(v>0&&(!u||l>0)&&(!m||n>0)&&(u||m)&&!this.workspaceMinimumsCanFit(v,u,l,m,n)){m&&await this.promoteFlyoutToOverlay();return}const z=(u?l:0)+(m?n:0),T=u&&this.preferredPreviewWidth!==null||m&&this.preferredFlyoutWidth!==null||(u&&c!==null||m&&b!==null),L=(u?this.preferredPreviewWidth===null?l:this.clampWidth(this.preferredPreviewWidth,l,d):0)+(m?this.preferredFlyoutWidth===null?n:this.clampWidth(this.preferredFlyoutWidth,n,f):0),F=this.workspaceWidthCapacity(v,y,g),B=this.workspaceTargetWidth(F,z,L);let C=this.allocateWorkspaceWidths(B,u,m,l,d,n,f,c,b);if(this.setWorkspaceWidths(C.previewWidth,C.flyoutWidth,T),!u||l<=0){m&&await this.promoteFlyoutIfClipped(e,v,n,f);return}if(F.natural+h>=z){s||this.toggleAttribute("data-preview-validating",!0),this.setPreviewLayoutState(!0,B>F.natural+h);const S=await this.candidateFitsAfterLayoutSettles(e,()=>this.previewFitsWithinPage(v,l,d,m,n,f),()=>this.workspaceCandidateIsMeasurable(!0,m));if(S===null)return;if(S){this.toggleAttribute("data-preview-validating",!1);return}this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,m?n:0),m&&await this.promoteFlyoutToOverlay();return}const q=F.maximum+h>=z;if(i=q?!1:await this.setPreviewNavigationCollapse(this.previewCollapseSidebar),q&&await this.setPreviewNavigationCollapse(!1),e!==this.previewSyncGeneration)return;const O=this.workspaceWidthCapacity(v,y);if(O.maximum+h<z){this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,m?n:0),i=!1,m&&await this.promoteFlyoutToOverlay();return}const I=this.workspaceTargetWidth(O,z,L),G=I>O.natural+h;if(C=this.allocateWorkspaceWidths(I,!0,m,l,d,n,f,c,b),this.setWorkspaceWidths(C.previewWidth,C.flyoutWidth,T),s||this.toggleAttribute("data-preview-validating",!0),this.setPreviewLayoutState(!0,G),await this.updateComplete,e!==this.previewSyncGeneration)return;const D=await this.candidateFitsAfterLayoutSettles(e,()=>this.previewFitsWithinPage(v,l,d,m,n,f),()=>this.workspaceCandidateIsMeasurable(!0,m));if(D===null)return;D?this.toggleAttribute("data-preview-validating",!1):(this.setPreviewLayoutState(!1,!1),this.setWorkspaceWidths(0,m?n:0),i=!1,m&&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.requestUpdate())}}setupPreviewLayoutObserver(){if(this.isConnected){if(!this.previewMediaQuery&&typeof window.matchMedia=="function"&&(this.previewMediaQuery=window.matchMedia(Z),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($)||e.querySelector($)!==null}syncFooterLandmark(){const t=(this.footerSlot.value?.assignedElements({flatten:!0})??[]).some(i=>this.footerElementProvidesLandmark(i));this.footerWrapperIsLandmark=!t}showPreview(){this.previewOpen=!0}closePreview(){this.previewOpen=!1}togglePreview(){this.previewOpen=!this.previewOpen}AddDialog(e){this.dialogZone.value?.appendChild(e)}firstUpdated(e){super.firstUpdated(e),this.syncFlyoutState(),this.setupPreviewLayoutObserver()}updated(e){super.updated(e),(e.has("fixedMenus")||e.has("headerPosition"))&&X().publish("fixed-menus-changed",{fixed:this.fixedMenus||this.headerPosition==="fixed"}),(e.has("previewOpen")||e.has("previewCollapseSidebar"))&&this.schedulePreviewLayout(!0),e.has("workspaceResizable")&&!this.workspaceResizable&&(this.finishWorkspaceKeyboardResize(),this.endWorkspaceResize())}render(){const e=this.fixedMenus||this.headerPosition==="fixed",t=!e&&this.headerPosition==="sticky",i=this.mainPreviewResizeRange(),s=Math.max(0,this.probeWidth(this.previewMinWidthProbe)),a=Math.max(0,this.probeWidth(this.flyoutMinWidthProbe)),r=Math.max(a,this.probeWidth(this.flyoutMaxWidthProbe)),o=Math.max(0,this.probeWidth(this.mainMinWidthProbe)),p=this.shadowRoot?.querySelector(".esp-page-main")?.getBoundingClientRect().width??0,g=this.hasAttribute("flyout-open"),l=p+this.allocatedPreviewWidth,c=i.minimum<=s+h,d=g&&c?Math.max(0,this.allocatedFlyoutWidth-a):0,n=Math.max(o,l-i.maximum),b=Math.max(n,Math.max(o,l-i.minimum)+d);let f,v;if(this.previewVisible){const u=this.previewFlyoutResizeRange(),m=this.allocatedPreviewWidth+this.allocatedFlyoutWidth,z=u.minimum<=s+h?Math.max(0,p-o):0;f=Math.max(a,m-u.maximum),v=Math.max(f,Math.min(r,m-u.minimum+z))}else{const u=this.flyoutOnlyResizeRange();f=u.minimum,v=u.maximum}const w=this.previewVisible?"preview-flyout-resize-handle":"main-flyout-resize-handle",y=this.previewVisible?"Resize preview and help panes":"Resize help pane";return H`
2
+ <div part="wrapper" class="esp-page ${Q({"fixed-menus":e,"fixed-header":e,"sticky-header":t})}">
3
3
  <div part="canvas" class="esp-page-canvas esp-page-canvas--left" aria-hidden="true"></div>
4
4
  <div part="canvas" class="esp-page-canvas esp-page-canvas--right" aria-hidden="true"></div>
5
5
  <div part="surface" class="esp-page-surface" aria-hidden="true"></div>
@@ -23,7 +23,7 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
23
23
  <div class="sticky-wrapper">
24
24
  <slot
25
25
  name="flyout"
26
- ${R(this.flyoutSlot)}
26
+ ${x(this.flyoutSlot)}
27
27
  @slotchange=${()=>this.syncFlyoutState()}
28
28
  ></slot>
29
29
  </div>
@@ -31,49 +31,64 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
31
31
  <div
32
32
  class="esp-page-preview-width-probe esp-page-preview-min-width-probe"
33
33
  aria-hidden="true"
34
- ${R(this.previewMinWidthProbe)}
34
+ ${x(this.previewMinWidthProbe)}
35
+ ></div>
36
+ <div
37
+ class="esp-page-preview-default-width-probe"
38
+ aria-hidden="true"
39
+ ${x(this.previewDefaultWidthProbe)}
35
40
  ></div>
36
41
  <div
37
42
  class="esp-page-preview-max-width-probe"
38
43
  aria-hidden="true"
39
- ${R(this.previewMaxWidthProbe)}
44
+ ${x(this.previewMaxWidthProbe)}
40
45
  ></div>
41
46
  <div
42
47
  class="esp-page-flyout-min-width-probe"
43
48
  aria-hidden="true"
44
- ${R(this.flyoutMinWidthProbe)}
49
+ ${x(this.flyoutMinWidthProbe)}
50
+ ></div>
51
+ <div
52
+ class="esp-page-flyout-default-width-probe"
53
+ aria-hidden="true"
54
+ ${x(this.flyoutDefaultWidthProbe)}
45
55
  ></div>
46
56
  <div
47
57
  class="esp-page-flyout-max-width-probe"
48
58
  aria-hidden="true"
49
- ${R(this.flyoutMaxWidthProbe)}
59
+ ${x(this.flyoutMaxWidthProbe)}
50
60
  ></div>
51
61
  <div
52
62
  class="esp-page-preview-main-min-probe esp-page-main-min-width-probe"
53
63
  aria-hidden="true"
54
- ${R(this.mainMinWidthProbe)}
64
+ ${x(this.mainMinWidthProbe)}
65
+ ></div>
66
+ <div
67
+ class="esp-page-main-configured-max-width-probe"
68
+ aria-hidden="true"
69
+ ${x(this.mainConfiguredMaxWidthProbe)}
55
70
  ></div>
56
71
  <div
57
72
  class="esp-page-main-max-width-probe"
58
73
  aria-hidden="true"
59
- ${R(this.mainMaxWidthProbe)}
74
+ ${x(this.mainMaxWidthProbe)}
60
75
  ></div>
61
76
  <div
62
77
  class="esp-page-resize-step-probe"
63
78
  aria-hidden="true"
64
- ${R(this.resizeStepProbe)}
79
+ ${x(this.resizeStepProbe)}
65
80
  ></div>
66
81
  <div
67
82
  class="esp-page-resize-large-step-probe"
68
83
  aria-hidden="true"
69
- ${R(this.resizeLargeStepProbe)}
84
+ ${x(this.resizeLargeStepProbe)}
70
85
  ></div>
71
- <div class="esp-page-preview-space" ${R(this.previewSpace)}>
86
+ <div class="esp-page-preview-space" ${x(this.previewSpace)}>
72
87
  <aside part="preview" class="esp-page-preview" aria-label=${this.previewLabel}>
73
88
  <div part="preview-content" class="sticky-wrapper">
74
89
  <slot
75
90
  name="preview"
76
- ${R(this.previewSlot)}
91
+ ${x(this.previewSlot)}
77
92
  @slotchange=${this.schedulePreviewLayout}
78
93
  ></slot>
79
94
  </div>
@@ -86,44 +101,44 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
86
101
  role="separator"
87
102
  aria-orientation="vertical"
88
103
  aria-label="Resize main pane"
89
- aria-valuemin=${Math.round(h)}
90
- aria-valuemax=${Math.round(u)}
91
- aria-valuenow=${Math.round(n)}
104
+ aria-valuemin=${Math.round(n)}
105
+ aria-valuemax=${Math.round(b)}
106
+ aria-valuenow=${Math.round(p)}
92
107
  tabindex="0"
93
- @pointerdown=${f=>this.onWorkspaceResizePointerDown("main-preview",f)}
108
+ @pointerdown=${u=>this.onWorkspaceResizePointerDown("main-preview",u)}
94
109
  @pointermove=${this.onWorkspaceResizePointerMove}
95
110
  @pointerup=${this.onWorkspaceResizePointerEnd}
96
111
  @pointercancel=${this.onWorkspaceResizePointerEnd}
97
112
  @lostpointercapture=${this.onWorkspaceResizePointerEnd}
98
- @keydown=${f=>this.onWorkspaceResizeKeyDown("main-preview",f)}
113
+ @keydown=${u=>this.onWorkspaceResizeKeyDown("main-preview",u)}
99
114
  @blur=${this.onWorkspaceResizeBlur}
100
115
  ></div>
101
116
  <div
102
- part=${W}
117
+ part=${w}
103
118
  class="esp-page-workspace-resize-handle esp-page-preview-flyout-resize-handle"
104
119
  role="separator"
105
120
  aria-orientation="vertical"
106
121
  aria-label=${y}
107
- aria-valuemin=${Math.round(g)}
108
- aria-valuemax=${Math.round(b)}
122
+ aria-valuemin=${Math.round(f)}
123
+ aria-valuemax=${Math.round(v)}
109
124
  aria-valuenow=${Math.round(this.allocatedFlyoutWidth)}
110
125
  tabindex="0"
111
- @pointerdown=${f=>this.onWorkspaceResizePointerDown("preview-flyout",f)}
126
+ @pointerdown=${u=>this.onWorkspaceResizePointerDown("preview-flyout",u)}
112
127
  @pointermove=${this.onWorkspaceResizePointerMove}
113
128
  @pointerup=${this.onWorkspaceResizePointerEnd}
114
129
  @pointercancel=${this.onWorkspaceResizePointerEnd}
115
130
  @lostpointercapture=${this.onWorkspaceResizePointerEnd}
116
- @keydown=${f=>this.onWorkspaceResizeKeyDown("preview-flyout",f)}
131
+ @keydown=${u=>this.onWorkspaceResizeKeyDown("preview-flyout",u)}
117
132
  @blur=${this.onWorkspaceResizeBlur}
118
133
  ></div>
119
134
  </div>
120
- <div class="esp-page-footer" role=${this.footerWrapperIsLandmark?"contentinfo":G}>
121
- <slot name="footer" ${R(this.footerSlot)} @slotchange=${this.syncFooterLandmark}></slot>
135
+ <div class="esp-page-footer" role=${this.footerWrapperIsLandmark?"contentinfo":U}>
136
+ <slot name="footer" ${x(this.footerSlot)} @slotchange=${this.syncFooterLandmark}></slot>
122
137
  </div>
123
- <div id="dialog-drop-zone" ${R(this.dialogZone)}></div>
138
+ <div id="dialog-drop-zone" ${x(this.dialogZone)}></div>
124
139
  <esp-toaster></esp-toaster>
125
140
  </div>
126
- `}};w.styles=[...q.styles,D`
141
+ `}};k.styles=[...N.styles,j`
127
142
  :host {
128
143
  --_esp-page-resolved-max-width: var(
129
144
  --esp-page-main-max-width,
@@ -151,6 +166,10 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
151
166
  );
152
167
  --_esp-page-preview-used-width: 0px;
153
168
  --_esp-page-flyout-used-width: 0px;
169
+ --_esp-page-workspace-track: minmax(
170
+ calc(var(--_esp-page-flyout-min) + var(--_esp-page-preview-min)),
171
+ calc(var(--_esp-page-preview-used-width) + var(--_esp-page-flyout-used-width))
172
+ );
154
173
 
155
174
  --_esp-page-main-track: minmax(0, var(--_esp-page-resolved-max-width));
156
175
 
@@ -200,6 +219,9 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
200
219
  --esp-page-main-max-width,
201
220
  var(--esp-page-max-width, none)
202
221
  );
222
+ }
223
+
224
+ :host([kind="full"]:not([data-main-max-configured])) {
203
225
  --_esp-page-main-track: 1fr;
204
226
  --_esp-page-gutter-left: 0fr;
205
227
  --_esp-page-gutter-right: 0fr;
@@ -215,11 +237,11 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
215
237
  }
216
238
 
217
239
 
218
- :host([flyout-open][data-workspace-preferred]) {
240
+ :host([flyout-open][data-workspace-targeted]) {
219
241
  --_esp-page-flyout-min: var(--_esp-page-flyout-used-width);
220
242
  }
221
243
 
222
- :host([preview-reclaiming][data-workspace-preferred]) {
244
+ :host([preview-reclaiming][data-workspace-targeted]) {
223
245
  --_esp-page-preview-min: var(--_esp-page-preview-used-width);
224
246
  }
225
247
 
@@ -231,8 +253,8 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
231
253
  );
232
254
  }
233
255
 
234
- :host([kind="full"][flyout-open]),
235
- :host([kind="full"][preview-reclaiming]) {
256
+ :host([kind="full"]:not([data-main-max-configured])[flyout-open]),
257
+ :host([kind="full"]:not([data-main-max-configured])[preview-reclaiming]) {
236
258
  --_esp-page-main-track: minmax(var(--_esp-page-main-min-width), 1fr);
237
259
  }
238
260
 
@@ -251,8 +273,8 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
251
273
  --_esp-page-main-track: minmax(0, var(--_esp-page-resolved-max-width));
252
274
  }
253
275
 
254
- :host([kind="full"][flyout-open]),
255
- :host([kind="full"][preview-reclaiming]) {
276
+ :host([kind="full"]:not([data-main-max-configured])[flyout-open]),
277
+ :host([kind="full"]:not([data-main-max-configured])[preview-reclaiming]) {
256
278
  --_esp-page-main-track: 1fr;
257
279
  }
258
280
 
@@ -314,7 +336,8 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
314
336
  }
315
337
 
316
338
 
317
- :host([kind="full"]) slot[name="header"]::slotted(esp-header) {
339
+ :host([kind="full"]:not([data-main-max-configured]))
340
+ slot[name="header"]::slotted(esp-header) {
318
341
  --esp-header-content-max-width: 100%;
319
342
  }
320
343
 
@@ -332,7 +355,8 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
332
355
  --esp-footer-content-lead: 1;
333
356
  }
334
357
 
335
- :host([kind="full"]) slot[name="footer"]::slotted(esp-footer) {
358
+ :host([kind="full"]:not([data-main-max-configured]))
359
+ slot[name="footer"]::slotted(esp-footer) {
336
360
  --esp-footer-content-max-width: 100%;
337
361
  }
338
362
 
@@ -415,11 +439,10 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
415
439
  [canvas-left-end surface-start left-start] min-content
416
440
  [left-end main-start] var(--_esp-page-main-track)
417
441
  [main-end right-start] min-content
418
- [right-end surface-end canvas-right-start flyout-start] minmax(
419
- calc(var(--_esp-page-flyout-min) + var(--_esp-page-preview-min)),
420
- var(--_esp-page-gutter-right)
421
- )
422
- [flyout-end canvas-right-end full-end];
442
+ [right-end surface-end canvas-right-start flyout-start]
443
+ var(--_esp-page-workspace-track)
444
+ [flyout-end] var(--_esp-page-gutter-right)
445
+ [canvas-right-end full-end];
423
446
 
424
447
  transition: grid-template-columns 0.25s ease;
425
448
  grid-template-rows:
@@ -588,10 +611,13 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
588
611
 
589
612
 
590
613
  > .esp-page-preview-min-width-probe,
614
+ > .esp-page-preview-default-width-probe,
591
615
  > .esp-page-preview-max-width-probe,
592
616
  > .esp-page-flyout-min-width-probe,
617
+ > .esp-page-flyout-default-width-probe,
593
618
  > .esp-page-flyout-max-width-probe,
594
619
  > .esp-page-main-min-width-probe,
620
+ > .esp-page-main-configured-max-width-probe,
595
621
  > .esp-page-main-max-width-probe,
596
622
  > .esp-page-resize-step-probe,
597
623
  > .esp-page-resize-large-step-probe {
@@ -610,6 +636,10 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
610
636
  inline-size: var(--_esp-page-preview-resolved-max-width);
611
637
  }
612
638
 
639
+ > .esp-page-preview-default-width-probe {
640
+ inline-size: var(--esp-page-preview-default-width, 0px);
641
+ }
642
+
613
643
  > .esp-page-flyout-min-width-probe {
614
644
  inline-size: var(--_esp-page-flyout-resolved-min-width);
615
645
  }
@@ -618,10 +648,18 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
618
648
  inline-size: var(--_esp-page-flyout-resolved-max-width);
619
649
  }
620
650
 
651
+ > .esp-page-flyout-default-width-probe {
652
+ inline-size: var(--esp-page-flyout-default-width, 0px);
653
+ }
654
+
621
655
  > .esp-page-main-min-width-probe {
622
656
  inline-size: var(--_esp-page-main-min-width);
623
657
  }
624
658
 
659
+ > .esp-page-main-configured-max-width-probe {
660
+ inline-size: var(--esp-page-main-max-width, 0px);
661
+ }
662
+
625
663
  > .esp-page-main-max-width-probe {
626
664
  inline-size: var(--_esp-page-resolved-max-width);
627
665
  }
@@ -784,4 +822,4 @@ var k=function(F,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnP
784
822
  transition: none;
785
823
  }
786
824
  }
787
- `],k([L()],w.prototype,"footerWrapperIsLandmark",void 0),k([L()],w.prototype,"allocatedPreviewWidth",void 0),k([L()],w.prototype,"allocatedFlyoutWidth",void 0),k([M({reflect:!0})],w.prototype,"kind",void 0),k([M({reflect:!0})],w.prototype,"align",void 0),k([M({type:Boolean,reflect:!0})],w.prototype,"contained",void 0),k([M({attribute:"header-position",reflect:!0})],w.prototype,"headerPosition",void 0),k([M({attribute:"fixed-menus",type:Boolean,reflect:!0})],w.prototype,"fixedMenus",void 0),k([M({attribute:"preview-open",type:Boolean,reflect:!0})],w.prototype,"previewOpen",void 0),k([M({attribute:"preview-label",type:String,reflect:!0})],w.prototype,"previewLabel",void 0),k([M({attribute:"preview-collapse-sidebar",type:Boolean,reflect:!0})],w.prototype,"previewCollapseSidebar",void 0),k([M({attribute:"workspace-resizable",type:Boolean,reflect:!0})],w.prototype,"workspaceResizable",void 0),k([M({attribute:"preview-visible",type:Boolean,reflect:!0})],w.prototype,"previewVisible",void 0),k([M({attribute:"preview-reclaiming",type:Boolean,reflect:!0})],w.prototype,"previewReclaiming",void 0),w=k([j("esp-page")],w);export{w as EspalierPage};
825
+ `],R([E()],k.prototype,"footerWrapperIsLandmark",void 0),R([E()],k.prototype,"allocatedPreviewWidth",void 0),R([E()],k.prototype,"allocatedFlyoutWidth",void 0),R([P({reflect:!0})],k.prototype,"kind",void 0),R([P({reflect:!0})],k.prototype,"align",void 0),R([P({type:Boolean,reflect:!0})],k.prototype,"contained",void 0),R([P({attribute:"header-position",reflect:!0})],k.prototype,"headerPosition",void 0),R([P({attribute:"fixed-menus",type:Boolean,reflect:!0})],k.prototype,"fixedMenus",void 0),R([P({attribute:"preview-open",type:Boolean,reflect:!0})],k.prototype,"previewOpen",void 0),R([P({attribute:"preview-label",type:String,reflect:!0})],k.prototype,"previewLabel",void 0),R([P({attribute:"preview-collapse-sidebar",type:Boolean,reflect:!0})],k.prototype,"previewCollapseSidebar",void 0),R([P({attribute:"workspace-resizable",type:Boolean,reflect:!0})],k.prototype,"workspaceResizable",void 0),R([P({attribute:"preview-visible",type:Boolean,reflect:!0})],k.prototype,"previewVisible",void 0),R([P({attribute:"preview-reclaiming",type:Boolean,reflect:!0})],k.prototype,"previewReclaiming",void 0),k=R([Y("esp-page")],k);export{k as EspalierPage};
@@ -1615,6 +1615,12 @@
1615
1615
  "component": "esp-page",
1616
1616
  "description": "Offset reserved for fixed headers. Defaults to `var(--esp-header-height)`."
1617
1617
  },
1618
+ {
1619
+ "name": "--esp-page-flyout-default-width",
1620
+ "category": "component",
1621
+ "component": "esp-page",
1622
+ "description": "Initial automatic in-grid help target, clamped between the help minimum and maximum. When unset, the established flexible allocation remains in effect. A retained pointer or keyboard resize preference supersedes this target."
1623
+ },
1618
1624
  {
1619
1625
  "name": "--esp-page-flyout-max-width",
1620
1626
  "category": "component",
@@ -1649,7 +1655,7 @@
1649
1655
  "name": "--esp-page-main-max-width",
1650
1656
  "category": "component",
1651
1657
  "component": "esp-page",
1652
- "description": "Maximum width of the main content well. Defaults from `kind`: `1536px` (wide), `768px` (narrow), or unbounded (full). Surplus width beyond it becomes canvas gutters."
1658
+ "description": "Maximum width of the main content well. Defaults from `kind`: `1536px` (wide), `768px` (narrow), or unbounded (full). An explicit value overrides every kind default, including `full`. Surplus width beyond it becomes canvas gutters."
1653
1659
  },
1654
1660
  {
1655
1661
  "name": "--esp-page-main-min-width",
@@ -1675,6 +1681,12 @@
1675
1681
  "component": "esp-page",
1676
1682
  "description": "Leading tear-off edge between main and preview. Defaults to `1px dotted var(--esp-color-border)`."
1677
1683
  },
1684
+ {
1685
+ "name": "--esp-page-preview-default-width",
1686
+ "category": "component",
1687
+ "component": "esp-page",
1688
+ "description": "Initial automatic preview target, clamped between the preview minimum and maximum. When unset, the established preview-first flexible allocation remains in effect. A retained pointer or keyboard resize preference supersedes this target."
1689
+ },
1678
1690
  {
1679
1691
  "name": "--esp-page-preview-max-width",
1680
1692
  "category": "component",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taprootio/espalier",
3
- "version": "2.12.1",
3
+ "version": "2.13.1",
4
4
  "packageManager": "bun@1.3.12",
5
5
  "description": "Espalier — a themeable, accessible, framework-agnostic, enterprise-grade design system built on web standards and love.",
6
6
  "customElements": "custom-elements.json",