@taprootio/espalier 6.13.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.
@@ -1,4 +1,4 @@
1
- var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(h,t,r,n);else for(var p=h.length-1;p>=0;p--)(d=h[p])&&(o=(l<3?d(o):l>3?d(t,r,o):d(t,r))||o);return l>3&&o&&Object.defineProperty(t,r,o),o};import{css as f,html as c,nothing as s}from"lit";import{customElement as m,eventOptions as v,property as a,state as y}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{EspalierElementBase as g}from"../shared/esp-element-base.js";import{ESP_EVENTS as w}from"../shared/events.js";import{ref as x}from"lit/directives/ref.js";import{getIconHrefForHost as T}from"../shared/intent-values.js";import{SlottedIconController as k}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as $}from"../shared/svgs/render-sprite-icon.js";import{DEFAULT_NEW_TAB_LABEL as S,newTabSuffix as E,renderNewTabCue as z}from"../shared/new-tab-cue.js";import{srOnly as C}from"../shared/style-fragments.js";import{BUTTON_INTERACTION_LIGHTNESS_FACTOR as N}from"./action-state-lightness.js";const A=c`<svg
1
+ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(h,t,r,n);else for(var p=h.length-1;p>=0;p--)(d=h[p])&&(o=(l<3?d(o):l>3?d(t,r,o):d(t,r))||o);return l>3&&o&&Object.defineProperty(t,r,o),o};import{css as g,html as c,nothing as s}from"lit";import{customElement as v,eventOptions as y,property as a,state as w}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{EspalierElementBase as f}from"../shared/esp-element-base.js";import{ESP_EVENTS as x}from"../shared/events.js";import{ref as T}from"lit/directives/ref.js";import{getIconHrefForHost as k}from"../shared/intent-values.js";import{SlottedIconController as $}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as S}from"../shared/svgs/render-sprite-icon.js";import{DEFAULT_NEW_TAB_LABEL as E,newTabSuffix as C,renderNewTabCue as z}from"../shared/new-tab-cue.js";import{srOnly as N}from"../shared/style-fragments.js";import{BUTTON_INTERACTION_LIGHTNESS_FACTOR as A}from"./action-state-lightness.js";const m=g`var(--esp-button-padding, var(--_esp-button-default-padding, var(--esp-size-padding)))`,B=c`<svg
2
2
  xmlns="http://www.w3.org/2000/svg"
3
3
  viewBox="0 0 24 24"
4
4
  fill="none"
@@ -10,12 +10,12 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
10
10
  >
11
11
  <path stroke="none" d="M0 0h24v24H0z" fill="none" />
12
12
  <path d="M4.05 11a8 8 0 1 1 .5 4m-.5 5v-5h5" />
13
- </svg>`;let e=class extends g{constructor(){super(...arguments),this.iconSlot=new k(this),this.innerTabindex=null,this.neutralizingTabindex=!1,this.buttonType="button",this.collapsed=!1,this.disabled=!1,this.href="",this.current=!1,this.iconOnly=!1,this.incognito=!1,this.icon="",this.iconPosition="right",this.label="",this.loading=!1,this.target="",this.rel="",this.newTabLabel=S,this.formNoValidate=!1,this.buildIcon=(t,r=!1)=>this.loading&&!r?c` <span>${A}</span> `:c`
13
+ </svg>`;let e=class extends f{constructor(){super(...arguments),this.iconSlot=new $(this),this.innerTabindex=null,this.neutralizingTabindex=!1,this.buttonType="button",this.collapsed=!1,this.disabled=!1,this.href="",this.current=!1,this.iconOnly=!1,this.incognito=!1,this.icon="",this.iconPosition="right",this.label="",this.loading=!1,this.target="",this.rel="",this.newTabLabel=E,this.formNoValidate=!1,this.buildIcon=(t,r=!1)=>this.loading&&!r?c` <span>${B}</span> `:c`
14
14
  <span>
15
- <slot ${x(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
16
- ${!this.iconSlot.hasSlottedIcon(":scope > :not(slot)")&&t?$(t):s}
15
+ <slot ${T(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
16
+ ${!this.iconSlot.hasSlottedIcon(":scope > :not(slot)")&&t?S(t):s}
17
17
  </span>
18
- `}static get observedAttributes(){return[...super.observedAttributes,"tabindex","aria-pressed"]}attributeChangedCallback(t,r,n){if(super.attributeChangedCallback(t,r,n),t==="aria-pressed"){this.requestUpdate();return}if(t!=="tabindex"||this.neutralizingTabindex)return;const l=n===null?null:Number(n),o=l===null||Number.isNaN(l)?null:l;o!==null&&o>=0?(this.innerTabindex=o,this.writeHostTabindex(null)):o===null&&n!==null?(this.innerTabindex=null,this.writeHostTabindex(null)):this.innerTabindex=o}writeHostTabindex(t){this.getAttribute("tabindex")!==t&&(this.neutralizingTabindex=!0,t===null?this.removeAttribute("tabindex"):this.setAttribute("tabindex",t),this.neutralizingTabindex=!1)}removeAttribute(t){super.removeAttribute(t),t==="tabindex"&&!this.neutralizingTabindex&&(this.innerTabindex=null)}focus(t){this.focusShadowElementAfterUpdate("button, a",t)}handleClick(t){if(this.dispatchEvent(new CustomEvent(w.CLICKED,{detail:{},bubbles:!0,composed:!0})),this.buttonType==="submit"){const r=this.closest("form");if(r){const n=document.createElement("button");n.type="submit",n.hidden=!0,this.formNoValidate&&(n.formNoValidate=!0),r.appendChild(n),r.requestSubmit(n),n.remove()}}else this.buttonType==="reset"&&this.closest("form")?.reset()}render(){const t=T(this.icon,this),r=this.current&&this.href.length>0,n=this.loading&&!r||this.iconSlot.hasSlottedIcon(":scope > :not(slot)")||t.length>0,{collapsed:l,iconOnly:o}=this,d=o?this.getAttribute("aria-label")||this.label||s:s,p=this.getAttribute("aria-pressed")||s,u={"esp-field":!0,"icon-only":o,incognito:this.incognito,"is-collapsed":l,"has-icon":n,"icon-left":n&&!o&&this.iconPosition==="left"};return r?c`<div part="wrapper" class=${b(u)}>
18
+ `}static get observedAttributes(){return[...super.observedAttributes,"tabindex","aria-pressed"]}attributeChangedCallback(t,r,n){if(super.attributeChangedCallback(t,r,n),t==="aria-pressed"){this.requestUpdate();return}if(t!=="tabindex"||this.neutralizingTabindex)return;const l=n===null?null:Number(n),o=l===null||Number.isNaN(l)?null:l;o!==null&&o>=0?(this.innerTabindex=o,this.writeHostTabindex(null)):o===null&&n!==null?(this.innerTabindex=null,this.writeHostTabindex(null)):this.innerTabindex=o}writeHostTabindex(t){this.getAttribute("tabindex")!==t&&(this.neutralizingTabindex=!0,t===null?this.removeAttribute("tabindex"):this.setAttribute("tabindex",t),this.neutralizingTabindex=!1)}removeAttribute(t){super.removeAttribute(t),t==="tabindex"&&!this.neutralizingTabindex&&(this.innerTabindex=null)}focus(t){this.focusShadowElementAfterUpdate("button, a",t)}handleClick(t){if(this.dispatchEvent(new CustomEvent(x.CLICKED,{detail:{},bubbles:!0,composed:!0})),this.buttonType==="submit"){const r=this.closest("form");if(r){const n=document.createElement("button");n.type="submit",n.hidden=!0,this.formNoValidate&&(n.formNoValidate=!0),r.appendChild(n),r.requestSubmit(n),n.remove()}}else this.buttonType==="reset"&&this.closest("form")?.reset()}render(){const t=k(this.icon,this),r=this.current&&this.href.length>0,n=this.loading&&!r||this.iconSlot.hasSlottedIcon(":scope > :not(slot)")||t.length>0,{collapsed:l,iconOnly:o}=this,d=o?this.getAttribute("aria-label")||this.label||s:s,p=this.getAttribute("aria-pressed")||s,u={"esp-field":!0,"icon-only":o,incognito:this.incognito,"is-collapsed":l,"has-icon":n,"icon-left":n&&!o&&this.iconPosition==="left"};return r?c`<div part="wrapper" class=${b(u)}>
19
19
  <span part="control" class="current-page" aria-current="page" aria-label=${d}>
20
20
  <span part="label">${this.label??""}</span>${this.buildIcon(t,!0)}
21
21
  </span>
@@ -28,7 +28,7 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
28
28
  target=${this.target||s}
29
29
  rel=${this.rel||s}
30
30
  tabindex=${this.innerTabindex??s}
31
- aria-label=${d===s?s:`${d}${E(this.target,this.newTabLabel)}`}
31
+ aria-label=${d===s?s:`${d}${C(this.target,this.newTabLabel)}`}
32
32
  >
33
33
  <span part="label">${this.label??""}</span>
34
34
  ${this.buildIcon(t)}
@@ -50,7 +50,7 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
50
50
  ${this.buildIcon(t)}
51
51
  </button>
52
52
  </div>
53
- `}};e.styles=[...g.styles,C,f`
53
+ `}};e.styles=[...f.styles,N,g`
54
54
  :host {
55
55
  --_esp-button-radius: var(--esp-size-border-radius);
56
56
  }
@@ -80,7 +80,7 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
80
80
  cursor: pointer;
81
81
 
82
82
  > span:nth-child(1) {
83
- padding: var(--esp-button-padding, var(--esp-size-padding));
83
+ padding: ${m};
84
84
  line-height: 1.3;
85
85
  font-weight: bold;
86
86
  display: flex;
@@ -91,7 +91,7 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
91
91
  > span:nth-child(2) {
92
92
  display: none;
93
93
  place-content: center;
94
- padding: var(--esp-button-padding, var(--esp-size-padding));
94
+ padding: ${m};
95
95
 
96
96
  .generated-icon,
97
97
  ::slotted(svg),
@@ -184,7 +184,7 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
184
184
  &:hover,
185
185
  &:focus-within {
186
186
  background-color: oklch(
187
- from var(--esp-color-action-background) calc(l * ${N})
187
+ from var(--esp-color-action-background) calc(l * ${A})
188
188
  c h
189
189
  );
190
190
  }
@@ -260,4 +260,4 @@ var i=function(h,t,r,n){var l=arguments.length,o=l<3?t:n===null?n=Object.getOwnP
260
260
  transform: rotate(360deg);
261
261
  }
262
262
  }
263
- `],i([y()],e.prototype,"innerTabindex",void 0),i([a({attribute:"button-type",type:String})],e.prototype,"buttonType",void 0),i([a({type:Boolean})],e.prototype,"collapsed",void 0),i([a({type:Boolean,reflect:!0})],e.prototype,"disabled",void 0),i([a({type:String})],e.prototype,"href",void 0),i([a({type:Boolean,reflect:!0})],e.prototype,"current",void 0),i([a({attribute:"icon-only",type:Boolean})],e.prototype,"iconOnly",void 0),i([a({type:Boolean,reflect:!0})],e.prototype,"incognito",void 0),i([a({type:String})],e.prototype,"icon",void 0),i([a({attribute:"icon-position",type:String})],e.prototype,"iconPosition",void 0),i([a({type:String})],e.prototype,"label",void 0),i([a({type:Boolean,reflect:!0})],e.prototype,"loading",void 0),i([a({type:String})],e.prototype,"target",void 0),i([a({type:String})],e.prototype,"rel",void 0),i([a({type:String,attribute:"new-tab-label"})],e.prototype,"newTabLabel",void 0),i([a({attribute:"formnovalidate",type:Boolean})],e.prototype,"formNoValidate",void 0),i([v({capture:!1,passive:!0})],e.prototype,"handleClick",null),e=i([m("esp-button")],e);export{e as EspalierButton};
263
+ `],i([w()],e.prototype,"innerTabindex",void 0),i([a({attribute:"button-type",type:String})],e.prototype,"buttonType",void 0),i([a({type:Boolean})],e.prototype,"collapsed",void 0),i([a({type:Boolean,reflect:!0})],e.prototype,"disabled",void 0),i([a({type:String})],e.prototype,"href",void 0),i([a({type:Boolean,reflect:!0})],e.prototype,"current",void 0),i([a({attribute:"icon-only",type:Boolean})],e.prototype,"iconOnly",void 0),i([a({type:Boolean,reflect:!0})],e.prototype,"incognito",void 0),i([a({type:String})],e.prototype,"icon",void 0),i([a({attribute:"icon-position",type:String})],e.prototype,"iconPosition",void 0),i([a({type:String})],e.prototype,"label",void 0),i([a({type:Boolean,reflect:!0})],e.prototype,"loading",void 0),i([a({type:String})],e.prototype,"target",void 0),i([a({type:String})],e.prototype,"rel",void 0),i([a({type:String,attribute:"new-tab-label"})],e.prototype,"newTabLabel",void 0),i([a({attribute:"formnovalidate",type:Boolean})],e.prototype,"formNoValidate",void 0),i([y({capture:!1,passive:!0})],e.prototype,"handleClick",null),e=i([v("esp-button")],e);export{e as EspalierButton};
@@ -1,11 +1,11 @@
1
- var a=function(i,e,r,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,r,n);else for(var d=i.length-1;d>=0;d--)(l=i[d])&&(o=(s<3?l(o):s>3?l(e,r,o):l(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};import{LitElement as h,css as u,html as b,nothing as p}from"lit";import{customElement as v,eventOptions as m,property as c}from"lit/decorators.js";import{ref as f}from"lit/directives/ref.js";import{getIconHrefForHost as g}from"../shared/intent-values.js";import{SlottedIconController as S}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as x}from"../shared/svgs/render-sprite-icon.js";import{DocumentSpriteController as y}from"../shared/document-sprite.js";import{ESP_EVENTS as C}from"../shared/events.js";let t=class extends h{constructor(){super(),this.iconSlot=new S(this),this.ariaLabel=null,this.ariaControls=null,this.ariaExpanded=null,this.icon="",new y(this,{reactToSpriteChanges:!0})}handleClick(e){this.dispatchEvent(new CustomEvent(C.CLICKED,{detail:{},bubbles:!0,composed:!0}))}render(){const e=g(this.icon,this),r=this.iconSlot.hasSlottedIcon(":scope > *");return b`<button
1
+ var a=function(i,e,r,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,r,n);else for(var c=i.length-1;c>=0;c--)(l=i[c])&&(o=(s<3?l(o):s>3?l(e,r,o):l(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};import{LitElement as h,css as u,html as b,nothing as p}from"lit";import{customElement as v,eventOptions as m,property as d}from"lit/decorators.js";import{ref as f}from"lit/directives/ref.js";import{getIconHrefForHost as g}from"../shared/intent-values.js";import{SlottedIconController as x}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as S}from"../shared/svgs/render-sprite-icon.js";import{DocumentSpriteController as y}from"../shared/document-sprite.js";import{ESP_EVENTS as C}from"../shared/events.js";let t=class extends h{constructor(){super(),this.iconSlot=new x(this),this.ariaLabel=null,this.ariaControls=null,this.ariaExpanded=null,this.icon="",new y(this,{reactToSpriteChanges:!0})}handleClick(e){this.dispatchEvent(new CustomEvent(C.CLICKED,{detail:{},bubbles:!0,composed:!0}))}render(){const e=g(this.icon,this),r=this.iconSlot.hasSlottedIcon(":scope > *");return b`<button
2
2
  @click=${this.handleClick}
3
3
  aria-label=${this.ariaLabel??p}
4
4
  aria-controls=${this.ariaControls??p}
5
5
  aria-expanded=${this.ariaExpanded??p}
6
6
  >
7
7
  <slot ${f(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
8
- ${!r&&e?x(e):p}
8
+ ${!r&&e?S(e):p}
9
9
  </button>`}};t.styles=u`
10
10
  :host {
11
11
  position: relative;
@@ -15,15 +15,16 @@ var a=function(i,e,r,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnP
15
15
  }
16
16
 
17
17
  button {
18
+ box-sizing: border-box;
18
19
  display: grid;
19
- background: var(--esp-header-button-background, var(--esp-color-layer-3));
20
- box-shadow: var(--esp-header-button-box-shadow, 0px 0px 3px 0px var(--esp-color-shadow));
20
+ background: var(--_esp-header-button-background, var(--esp-header-button-background, var(--esp-color-layer-3)));
21
+ box-shadow: var(--_esp-header-button-box-shadow, var(--esp-header-button-box-shadow, 0px 0px 3px 0px var(--esp-color-shadow)));
21
22
  width: calc(0.85 * var(--esp-header-height, calc(4.5 * var(--esp-size-small))));
22
23
  height: var(--esp-header-height, calc(4.5 * var(--esp-size-small)));
23
24
  overflow: hidden;
24
25
  place-content: center;
25
26
  border: none;
26
- border-left: var(--esp-header-button-border-left, 1px dotted var(--esp-color-border));
27
+ border-left: var(--_esp-header-button-border-left, var(--esp-header-button-border-left, 1px dotted var(--esp-color-border)));
27
28
  cursor: pointer;
28
29
  transition:
29
30
  background-color 0.5s ease,
@@ -37,7 +38,7 @@ var a=function(i,e,r,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnP
37
38
  }
38
39
 
39
40
  &:hover {
40
- background: var(--esp-header-button-background-hover, var(--esp-color-layer-4));
41
+ background: var(--_esp-header-button-background-hover, var(--esp-header-button-background-hover, var(--esp-color-layer-4)));
41
42
  }
42
43
  }
43
- `,a([c({attribute:"aria-label",type:String})],t.prototype,"ariaLabel",void 0),a([c({attribute:"aria-controls",type:String})],t.prototype,"ariaControls",void 0),a([c({attribute:"aria-expanded",type:String})],t.prototype,"ariaExpanded",void 0),a([c({type:String})],t.prototype,"icon",void 0),a([m({capture:!1,passive:!0})],t.prototype,"handleClick",null),t=a([v("esp-header-button")],t);export{t as EspalierHeaderButton};
44
+ `,a([d({attribute:"aria-label",type:String})],t.prototype,"ariaLabel",void 0),a([d({attribute:"aria-controls",type:String})],t.prototype,"ariaControls",void 0),a([d({attribute:"aria-expanded",type:String})],t.prototype,"ariaExpanded",void 0),a([d({type:String})],t.prototype,"icon",void 0),a([m({capture:!1,passive:!0})],t.prototype,"handleClick",null),t=a([v("esp-header-button")],t);export{t as EspalierHeaderButton};
@@ -25,6 +25,11 @@ export interface EspThemeToggleEventDetail {
25
25
  * control and extra-row sizes. In a fixed `esp-page`, `compact-size="standard"`
26
26
  * with `scroll-behavior="compact"` returns to the unscaled baseline. Sticky,
27
27
  * normal and standalone hosts retain expanded geometry with these options.
28
+ * Expanded rows above 1.0 center navigation and use unframed icon controls,
29
+ * without the horizontal current-item underline. Compaction restores standard
30
+ * chrome. Navigation buttons keep theme-space margins and a smaller default
31
+ * padding; explicit `--esp-button-padding` still wins. A full-screen drawer's
32
+ * existing close control sits at the viewport's top/end corner.
28
33
  * Optional generic/light/dark compact logos fall back to the regular logo until
29
34
  * ready; the larger expanded/compact brand width is reserved in either state.
30
35
  * `data-esp-compact` reports resolved compaction for paint-only styling and
@@ -1,10 +1,10 @@
1
- var i=function(f,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(f,e,t,r);else for(var d=f.length-1;d>=0;d--)(o=f[d])&&(s=(n<3?o(s):n>3?o(e,t,s):o(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};import{paintedSurface as j}from"../shared/surface-layer.js";import{css as $,html as b,nothing as m,unsafeCSS as Q}from"lit";import{customElement as Y,property as l,state as v}from"lit/decorators.js";import{classMap as W}from"lit/directives/class-map.js";import{styleMap as K}from"lit/directives/style-map.js";import"../burger/esp-burger.js";import{createRef as A,ref as R}from"lit/directives/ref.js";import{MENU_PRESENTATION_CHANGED as T,MENU_LAYOUT_CHANGED as H,MENU_FIT_PROBE_STYLES as Z,menuPresentationStyle as J,renderMenuNode as X}from"../menu/menu-presentation.js";import{EspalierMenu as _}from"../menu/esp-menu.js";import{RafThrottle as q}from"../shared/raf-throttle.js";import{viewportSize as ee}from"../shared/viewport.js";import{CONFIGURED_BRAND_LOGO_ASPECT_RATIO as U,configuredBrandLogoGeometry as te,renderConfiguredBrand as F,resolveConfiguredBrand as re}from"../shared/configured-brand.js";import{EspalierElementBase as I}from"../shared/esp-element-base.js";import{ESP_EVENTS as x}from"../shared/events.js";import{HEADER_GEOMETRY_PAINT_PROPERTIES as ne,HeaderGeometryController as oe}from"./header-geometry-controller.js";const ae="(max-width: 36rem)",V=$`
1
+ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(f,e,t,r);else for(var d=f.length-1;d>=0;d--)(a=f[d])&&(i=(n<3?a(i):n>3?a(e,t,i):a(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};import{paintedSurface as j}from"../shared/surface-layer.js";import{css as $,html as b,nothing as m,unsafeCSS as Q}from"lit";import{customElement as Y,property as l,state as v}from"lit/decorators.js";import{classMap as W}from"lit/directives/class-map.js";import{styleMap as K}from"lit/directives/style-map.js";import"../burger/esp-burger.js";import{createRef as A,ref as R}from"lit/directives/ref.js";import{MENU_PRESENTATION_CHANGED as _,MENU_LAYOUT_CHANGED as H,MENU_FIT_PROBE_STYLES as Z,menuPresentationStyle as J,renderMenuNode as X}from"../menu/menu-presentation.js";import{EspalierMenu as T}from"../menu/esp-menu.js";import{RafThrottle as q}from"../shared/raf-throttle.js";import{viewportSize as ee}from"../shared/viewport.js";import{CONFIGURED_BRAND_LOGO_ASPECT_RATIO as U,configuredBrandLogoGeometry as te,renderConfiguredBrand as F,resolveConfiguredBrand as re}from"../shared/configured-brand.js";import{EspalierElementBase as I}from"../shared/esp-element-base.js";import{ESP_EVENTS as x}from"../shared/events.js";import{HEADER_GEOMETRY_PAINT_PROPERTIES as ne,HeaderGeometryController as oe}from"./header-geometry-controller.js";const ae="(max-width: 36rem)",V=$`
2
2
  background-color 0.24s ease,
3
3
  border-color 0.24s ease,
4
4
  box-shadow 0.24s ease,
5
5
  color 0.24s ease,
6
6
  transform 0.24s ease
7
- `;function L(f,e){const t=new Set(f);return{allowedValues:t,converter:{fromAttribute(n){return n??e},toAttribute(n){return t.has(n)?n:e}},defaultValue:e}}const se=["standard","centered-brand","centered-menu","extended","extended-centered","minimal"],ie=["start","center","end"],de=["truncate","wrap","nowrap"],le=["auto","inline","drawer"],he=["hidden","visible"],ce=["compact","standard"],ue=new Set(Array.from({length:41},(f,e)=>(e+10)/10)),M=L(se,"standard"),D=L(ie,"start"),B=L(de,"truncate"),O=L(le,"auto"),P=L(he,"hidden"),z=L(ce,"compact");let a=class extends I{constructor(){super(...arguments),this.menuOpen=!1,this.navigationConstrained=!1,this.menuTooLarge=!1,this.mobileMenu=!1,this.scrolled=!1,this.hiddenByScroll=!1,this.scrollProgress=0,this.showBurger=!1,this.layout=M.defaultValue,this.brandText="",this.brandLogo="",this.lightBrandLogo="",this.darkBrandLogo="",this.compactBrandLogo="",this.lightCompactBrandLogo="",this.darkCompactBrandLogo="",this.heightMultiplier=1,this.compactSize=z.defaultValue,this.brandHref="",this.brandAlt="",this.brandColor="",this.lightBrandColor="",this.darkBrandColor="",this.brandAlign=D.defaultValue,this.brandWrap=B.defaultValue,this.menuDisplay=O.defaultValue,this.themeToggle=P.defaultValue,this.scrollBehavior="none",this.scrollThreshold=16,this.dockOffset=0,this.drawerTarget="",this.previewCollapseRequested=!1,this.fullBleedContent=!1,this.geometry=new oe(this,()=>({heightMultiplier:this.heightMultiplier,compactSize:this.compactSize,compactLogo:!!(this.compactBrandLogo||this.lightCompactBrandLogo||this.darkCompactBrandLogo)}),()=>this.syncBrandFitWidth()),this.readyCompactLogo="",this.naturalBrandWidth=0,this.syncCompactLogoReadiness=()=>{const e=this.shadowRoot?.querySelector(".compact-brand-fit .brand-logo"),t=this.compactLogoSource,r=t&&e?.getAttribute("src")===t&&e.complete&&e.naturalWidth>0?t:"";r!==this.readyCompactLogo&&(this.readyCompactLogo=r)},this.keyboardFocusHeld=!1,this.pointerFocusPending=!1,this.onGeometryKeyboard=()=>{this.pointerFocusPending=!1,this.keyboardFocusHeld=!0,this.updateScrollState()},this.onGeometryPointer=()=>{this.pointerFocusPending=!0,this.keyboardFocusHeld=!1,this.updateScrollState()},this.onGeometryPointerEnd=()=>{this.pointerFocusPending=!1},this.openHeaderPopovers=new Set,this.onHeaderPopoverOpened=e=>{e.target&&this.openHeaderPopovers.add(e.target),this.updateScrollState()},this.onHeaderPopoverClosed=e=>{e.target&&this.openHeaderPopovers.delete(e.target),this.updateScrollState()},this.onHeaderGroupToggle=e=>{e.detail.open?this.onHeaderPopoverOpened(e):this.onHeaderPopoverClosed(e)},this.onGeometryFocus=e=>{const t=e.composedPath();this.keyboardFocusHeld=!this.pointerFocusPending&&t.some(r=>r instanceof Element&&r.matches(":focus-visible")),this.updateScrollState()},this.onGeometryFocusOut=()=>{queueMicrotask(()=>{this.matches(":focus-within")||(this.keyboardFocusHeld=!1,this.pointerFocusPending=!1),this.updateScrollState()})},this.menuContainer=A(),this.menuButton=A(),this.menu=void 0,this.externalDrawerTarget=null,this.lastScrollY=0,this.lastInlineMenuWidth=0,this.mobileMenuQuery=null,this.menuDrawerListenersAttached=!1,this.observingMenuContainer=!1,this.scrollListenersAttached=!1,this.scrollFrame=new q(()=>this.runScrollStateUpdate()),this.resizeObserver=new ResizeObserver(()=>this.syncMenuLayout()),this.menuChildObserver=null,this.endProbe=A(),this.observedEndProbe=null,this.endProbeObserver=null,this.invalidMenuSlot=null,this.actionsWidth=0,this.syncPrimaryMenu=()=>{const r=(this.menuContainer.value?.querySelector('slot[name="menu"]')?.assignedElements()??[])[0],n=r instanceof _&&r.parentElement===this?r:void 0,s=r&&!n?r:null;s&&s!==this.invalidMenuSlot&&console.warn("<esp-header>: the menu slot expects an <esp-menu> element, received",s),this.invalidMenuSlot=s,this.geometry.setPrimaryMenu(n),n!==this.menu&&(this.demoteMenuToggle(),this.removeMenuDrawerListeners(),this.menu?.removeEventListener(T,this.onPrimaryPresentationChanged),this.menu?.removeEventListener(H,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=null,this.menu.sliding=!1),this.menuChildObserver?.disconnect(),this.menuChildObserver=null,this.menu=n,this.lastInlineMenuWidth=0,this.lastDrawerBrandKey="",this.addMenuDrawerListeners(),this.menu?.addEventListener(T,this.onPrimaryPresentationChanged),this.observeMenuChildren(),this.syncDrawerBrand(),this.requestUpdate()),this.menu?.addEventListener(T,this.onPrimaryPresentationChanged),this.menu?.addEventListener(H,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=this.menu.mode==="horizontal"?this:null),this.syncExternalDrawerTarget(),this.syncMenuLayout()},this.onPrimaryPresentationChanged=()=>{this.menu?.headerDrawerActive&&this.returnEndFocusToBurger(),this.requestUpdate()},this.onPrimaryLayoutChanged=()=>{if(!this.menu)return;this.geometry.invalidate();const e=this.menu.mode==="horizontal"&&this.menu.parentElement===this?this:null;this.menu.headerEndOwner!==e&&(this.menu.headerEndOwner=e),this.menu.headerDrawerActive&&this.returnEndFocusToBurger(),this.observeMenuChildren(),this.requestUpdate(),this.syncMenuLayout()},this.updateScrollState=()=>this.scrollFrame.schedule(),this.handleMobileMenuQueryChange=e=>{this.mobileMenu=e.matches,this.syncMenuLayout(),this.syncExternalDrawerControl()},this.toggleTheme=()=>{const e=this.getThemeRoot();if(!e)return;e.scheme=e.scheme==="dark"?"light":"dark";const t=e.scheme==="dark"?"dark":"light";this.dispatchEvent(new CustomEvent(x.HEADER_THEME_TOGGLE,{detail:{scheme:t},bubbles:!0,composed:!0}))},this.handleMenuToggleClicked=()=>{if(this.menuOpen){this.closeNav();return}this.openNav()},this.onMenuDrawerOpened=()=>{this.menuOpen=!0,document.body.classList.add("menu-open"),this.burger&&(this.burger.menuOpen=!0)},this.onMenuDrawerClosed=()=>{this.menuOpen=!1,document.body.classList.remove("menu-open"),this.burger&&(this.burger.menuOpen=!1),this.demoteMenuToggle(),this.updateScrollState()},this.onMenuDrawerPresented=e=>{e.target!==this.menu||!this.menu?.isFullScreenDrawer||this.promoteMenuToggle()},this.menuTogglePromoted=!1,this.promotedToggleFrame=new q(()=>this.positionPromotedToggle()),this.handlePromotedViewportResize=()=>this.promotedToggleFrame.schedule(),this.lastDrawerBrandKey="",this.inertedHeaderChrome=[],this.onGeometryContentChanged=()=>this.geometry.invalidate()}resolveBrand(){return re({scheme:this.scheme,brandLogo:this.brandLogo,brandColor:this.brandColor,lightBrandLogo:this.lightBrandLogo,darkBrandLogo:this.darkBrandLogo,lightBrandColor:this.lightBrandColor,darkBrandColor:this.darkBrandColor})}get compactLogoSource(){if(!this.resolveBrand().brandLogo)return"";const e=this.scheme==="dark"?this.darkCompactBrandLogo:this.lightCompactBrandLogo,t=this.scheme==="dark"?this.lightCompactBrandLogo:this.darkCompactBrandLogo;return e||this.compactBrandLogo||t}syncBrandFitWidth(){const e=this.menuContainer.value?.parentElement;if(!e)return;const t=e.querySelector(".brand-fit-probe");this.naturalBrandWidth=t?.getBoundingClientRect().width??0;const r=e.querySelector('slot[name="brand"]')?.assignedElements().length,n=[...t?.querySelectorAll(".brand-logo")??[]].map(d=>d.getBoundingClientRect().width),s=getComputedStyle(e),o=[s.paddingTop,s.paddingBottom,s.borderTopWidth,s.borderBottomWidth].reduce((d,h)=>d+(parseFloat(h)||0),0);for(const[d,h]of[["--_esp-header-stable-brand-width",this.geometry.active&&!r?this.naturalBrandWidth:null],["--_esp-header-logo-reservation-width",Math.max(0,...n)],["--_esp-header-bar-block-insets",o]])if(h===null)e.style.removeProperty(d);else{const c=`${h}px`;e.style.getPropertyValue(d)!==c&&e.style.setProperty(d,c)}}get headerOverlayHeld(){for(const e of this.openHeaderPopovers)e instanceof Element&&!e.isConnected&&this.openHeaderPopovers.delete(e);return this.menuOpen||this.openHeaderPopovers.size>0}get usesIntrinsicNavigation(){return!!this.menu?.headerNavigationOwned}syncEndProbeObserver(){const e=this.endProbe.value??null;e!==this.observedEndProbe&&(this.endProbeObserver?.disconnect(),this.observedEndProbe=e,e&&(this.endProbeObserver??=new ResizeObserver(()=>this.syncMenuLayout()),this.endProbeObserver.observe(e,{box:"border-box"})),this.syncMenuLayout())}returnEndFocusToBurger(){const e=this.shadowRoot?.querySelector(".header-end"),t=this.shadowRoot?.activeElement;t&&e?.contains(t)&&this.updateComplete.then(()=>this.getBurgerFocusTarget()?.focus({preventScroll:!0}))}readHeaderEndFit(){const e=this.menuContainer.value?.parentElement;if(!e||!this.menu)return null;const t=getComputedStyle(e),r=e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0),n=parseFloat(t.columnGap)||0,s=e.querySelector(":scope > .brand"),d=s?.querySelector("slot")?.assignedElements().length?Math.max(s?.scrollWidth??0,s?.getBoundingClientRect().width??0):this.naturalBrandWidth,h=e.querySelector(":scope > .buttons"),c=Array.from(h?.children??[]).flatMap(g=>g.matches(".header-end, .header-end-measurement, .menu-toggle")?[]:g instanceof HTMLSlotElement?g.assignedElements():[g]).filter(g=>getComputedStyle(g).display!=="none");let u=c.reduce((g,N)=>{const G=getComputedStyle(N);return g+N.getBoundingClientRect().width+(parseFloat(G.marginLeft)||0)+(parseFloat(G.marginRight)||0)},0);const E=this.endProbe.value?.getBoundingClientRect().width??0,p=h&&parseFloat(getComputedStyle(h).columnGap)||0;u+=p*Math.max(0,c.length-1+(E>0?1:0));const y=this.menu.getHeaderNavigationWidths().main,w=E+u,S=this.layout==="extended"?y>r||d+w+n>r:this.layout==="extended-centered"?y>r||d+2*w+2*n>r:this.layout==="centered-brand"?d+2*Math.max(y,w)+2*n>r:d+y+w+2*n>r,C=this.getExternalDrawerTarget()?h?.querySelector(".menu-toggle"):null,k=u+(C&&getComputedStyle(C).display!=="none"?C.getBoundingClientRect().width+(c.length||E?p:0):0);return{width:r,brandWidth:d,main:y,endWidth:E,actions:u,actionFloor:k,gap:n,tooWide:S}}syncMenuLayout(){if(this.syncBrandFitWidth(),!this.menuContainer.value||!this.menu||!this.menu.getWidth)return;this.positionPromotedToggle();const e=this.menu.getWidth();e>0&&(this.lastInlineMenuWidth=e);const t=this.lastInlineMenuWidth||e,r=this.getExternalDrawerTarget(),n=this.menuDisplay!=="inline",s=this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested,o=n&&this.menuDisplay==="auto",d=o?this.layout==="centered-menu"?this.centeredMenuCapacity():this.menuContainer.value.clientWidth:0,h=this.usesIntrinsicNavigation?this.readHeaderEndFit():null;h&&this.actionsWidth!==h.actionFloor&&(this.actionsWidth=h.actionFloor,this.requestUpdate()),this.menuTooLarge=o&&(h?h.tooWide:t>d);const c=n&&!r&&this.hasDrawerableContent()&&(this.menuTooLarge||s||this.mobileMenu);c&&this.returnEndFocusToBurger(),this.menu.sliding=c,this.navigationConstrained=h?.tooWide??!1}centeredMenuCapacity(){const e=this.menuContainer.value?.parentElement;if(!(e instanceof HTMLElement))return 0;const t=d=>d?d.getBoundingClientRect().width:0,r=getComputedStyle(e),n=e.clientWidth-(Number.parseFloat(r.paddingLeft)||0)-(Number.parseFloat(r.paddingRight)||0),s=e.querySelector(":scope > section.brand"),o=e.querySelector(":scope > section.buttons");return n-t(s)-t(o)+t(o?.querySelector("esp-header-button.menu-toggle"))}menuHasContent(){return!!(this.menu??this.querySelector(':scope > [slot="menu"]'))?.querySelector("esp-menu-item, esp-menu-group")}hasDrawerableContent(){return this.showBurger||!!this.getExternalDrawerTarget()||this.menuHasContent()}getExternalDrawerTarget(){if(!this.drawerTarget)return null;const e=document.getElementById(this.drawerTarget);return e===this.menu?null:e&&"openDrawer"in e&&typeof e.openDrawer=="function"&&"closeDrawer"in e&&typeof e.closeDrawer=="function"?e:null}getBurgerFocusTarget(){const t=this.shadowRoot?.querySelector("esp-header-button.menu-toggle")?.shadowRoot?.querySelector("button"),r=this.menuButton.value?.shadowRoot?.querySelector("button");return t??r??null}getScrollTokens(){const e=this.scrollBehavior.split(/\s+/).map(t=>t.trim().toLowerCase()).filter(Boolean);return new Set(e.filter(t=>t!=="none"))}getEffectiveScrollThreshold(){return Number.isFinite(this.scrollThreshold)?Math.max(0,this.scrollThreshold):0}clearScrollState(){this.geometry.requestScroll(0,!1,!1,this.getEffectiveScrollThreshold(),!1),this.scrolled=!1,this.hiddenByScroll=!1,this.scrollProgress=0}runScrollStateUpdate(){const e=this.getScrollTokens();if(!e.size){this.clearScrollState();return}const t=Math.max(0,window.scrollY||document.documentElement.scrollTop||0),r=this.getEffectiveScrollThreshold(),n=Number.isFinite(this.dockOffset)?Math.max(0,this.dockOffset):r,s=t>(e.has("dock")?n:r),o=t>this.lastScrollY,d=e.has("reveal")&&o&&t>r&&!this.menuOpen;if(this.geometry.requestScroll(t,e.has("compact"),e.has("collapse-topbar")&&s,r,this.headerOverlayHeld||this.keyboardFocusHeld),this.scrolled=s,this.hiddenByScroll=d,e.has("progress")){const h=document.documentElement,c=Math.max(1,h.scrollHeight-window.innerHeight);this.scrollProgress=Math.min(1,t/c)}else this.scrollProgress=0;this.lastScrollY=t}cancelScrollUpdate(){this.scrollFrame.cancel()}syncScrollListeners(){const e=this.getScrollTokens().size>0;if(e&&!this.scrollListenersAttached?(window.addEventListener("scroll",this.updateScrollState,{passive:!0}),window.addEventListener("resize",this.updateScrollState,{passive:!0}),this.scrollListenersAttached=!0):!e&&this.scrollListenersAttached&&this.removeScrollListeners(),e){this.updateScrollState();return}this.cancelScrollUpdate(),this.clearScrollState()}removeScrollListeners(){this.scrollListenersAttached&&(window.removeEventListener("scroll",this.updateScrollState),window.removeEventListener("resize",this.updateScrollState),this.scrollListenersAttached=!1)}addMenuDrawerListeners(){!this.menu||this.menuDrawerListenersAttached||(this.menu.addEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.menu.addEventListener("esp-menu-drawer-presented",this.onMenuDrawerPresented),this.menu.addEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.menuDrawerListenersAttached=!0)}removeMenuDrawerListeners(){!this.menu||!this.menuDrawerListenersAttached||(this.menu.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.menu.removeEventListener("esp-menu-drawer-presented",this.onMenuDrawerPresented),this.menu.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.menuDrawerListenersAttached=!1)}observeMenuContainer(){if(!this.menuContainer.value||this.observingMenuContainer)return;this.resizeObserver.observe(this.menuContainer.value);const e=this.menuContainer.value.parentElement;if(e){this.resizeObserver.observe(e);for(const t of e.querySelectorAll(":scope > section.brand, :scope > section.buttons, :scope > .brand-fit-probe"))this.resizeObserver.observe(t)}this.observingMenuContainer=!0}disconnectResizeObserver(){this.observingMenuContainer&&(this.resizeObserver.disconnect(),this.observingMenuContainer=!1)}observeMenuChildren(){if(this.usesIntrinsicNavigation){this.menuChildObserver?.disconnect(),this.menuChildObserver=null;return}!this.menu||this.menuChildObserver||(this.menuChildObserver=new MutationObserver(()=>{this.syncMenuLayout(),this.requestUpdate()}),this.menuChildObserver.observe(this.menu,{childList:!0,subtree:!0}))}syncMobileMenuQuery(){if("matchMedia"in window){if(!this.mobileMenuQuery){this.mobileMenuQuery=window.matchMedia(ae),this.mobileMenu=this.mobileMenuQuery.matches,this.mobileMenuQuery.addEventListener("change",this.handleMobileMenuQueryChange);return}this.mobileMenu=this.mobileMenuQuery.matches}}getThemeRoot(){return this.traverseToClosest("esp-root")}syncExternalDrawerTarget(){const e=this.getExternalDrawerTarget(),t=e===this.menu?null:e;t!==this.externalDrawerTarget&&(this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.externalDrawerTarget instanceof _&&(this.externalDrawerTarget.hasExternalDrawerControl=!1),this.externalDrawerTarget=t,this.externalDrawerTarget?.addEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.addEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed)),this.syncExternalDrawerControl()}burgerVisibleForTarget(){if(this.menuDisplay==="inline")return!1;const e=this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested;return this.menuTooLarge||this.mobileMenu||e}syncExternalDrawerControl(){this.externalDrawerTarget instanceof _&&(this.externalDrawerTarget.hasExternalDrawerControl=this.burgerVisibleForTarget())}openNav(){const e=this.getBurgerFocusTarget(),t=this.getExternalDrawerTarget();if(this.burger&&(this.burger.menuOpen=!0),t){this.menuOpen=!0,t.openDrawer(e),document.body.classList.add("menu-open");return}if(this.menu){this.menu.sliding=!0,this.menuOpen=!0,this.menu.isFullScreenDrawer&&this.canPromoteMenuToggle()&&(this.menu.liftedCloseControl=this.getMenuToggleElement()),this.menu.openDrawer(e),document.body.classList.add("menu-open");return}this.burger&&(this.burger.menuOpen=!1)}closeNav(){this.menuOpen=!1,this.burger&&(this.burger.menuOpen=!1),this.demoteMenuToggle();const e=this.getExternalDrawerTarget();if(e){e.closeDrawer(),document.body.classList.remove("menu-open");return}this.menu&&(this.menu.closeDrawer(),document.body.classList.remove("menu-open"))}getMenuToggleElement(){return this.shadowRoot?.querySelector("esp-header-button.menu-toggle")??null}canPromoteMenuToggle(){const e=this.getMenuToggleElement();return!!e&&typeof e?.showPopover=="function"}setHeaderChromeInert(e){if(!e){for(const o of this.inertedHeaderChrome)o.inert=!1;this.inertedHeaderChrome=[];return}const t=this.menuContainer.value?.parentElement,r=this.getMenuToggleElement();if(!t||!r)return;const n=[];for(const o of t.querySelectorAll(":scope > section.brand, :scope > section.topbar"))n.push(o);const s=t.querySelector(":scope > section.buttons");for(const o of s?.children??[])if(!(!(o instanceof HTMLElement)||o===r)){if(o instanceof HTMLSlotElement){for(const d of o.assignedElements())d instanceof HTMLElement&&n.push(d);continue}n.push(o)}for(const o of n)o.inert||(o.inert=!0,this.inertedHeaderChrome.push(o))}promoteMenuToggle(){const e=this.getMenuToggleElement();if(!e||this.menuTogglePromoted||typeof e.showPopover!="function")return;const t=e.getBoundingClientRect();e.setAttribute("popover","manual"),Object.assign(e.style,{position:"fixed",inset:"auto",margin:"0",padding:"0",border:"0",background:"transparent",overflow:"visible"}),this.setPromotedTogglePosition(e,t.left,t.top,t.width,t.height);try{e.showPopover()}catch{e.removeAttribute("popover"),e.removeAttribute("style"),this.menu&&(this.menu.liftedCloseControl=null);return}this.menuTogglePromoted=!0,window.addEventListener("resize",this.handlePromotedViewportResize),this.menu&&(this.menu.liftedCloseControl=e),this.setHeaderChromeInert(!0)}positionPromotedToggle(){if(!this.menuTogglePromoted)return;const e=this.getMenuToggleElement(),t=this.shadowRoot?.querySelector("section.buttons");if(!e||!t)return;const r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),s=getComputedStyle(t).direction==="rtl";this.setPromotedTogglePosition(e,s?r.left:r.right-n.width,r.top+(r.height-n.height)/2,n.width,n.height)}setPromotedTogglePosition(e,t,r,n,s){const o=ee();e.style.left=`${Math.max(0,Math.min(t,o.width-n))}px`,e.style.top=`${Math.max(0,Math.min(r,o.height-s))}px`}demoteMenuToggle(){if(window.removeEventListener("resize",this.handlePromotedViewportResize),this.promotedToggleFrame.cancel(),this.menu?.liftedCloseControl&&(this.menu.liftedCloseControl=null),!this.menuTogglePromoted)return;this.menuTogglePromoted=!1,this.setHeaderChromeInert(!1);const e=this.getMenuToggleElement();if(e){try{e.hidePopover()}catch{}e.removeAttribute("popover"),e.removeAttribute("style")}}syncDrawerBrand(){if(!this.menu)return;const e=this.resolveBrand(),t=e.brandLogo||this.brandText?{brandLogo:e.brandLogo,brandText:this.brandText,brandHref:this.brandHref,brandAlt:this.brandAlt,brandColor:e.brandColor}:null,r=JSON.stringify(t);r!==this.lastDrawerBrandKey&&(this.lastDrawerBrandKey=r,this.menu.drawerBrand=t)}get burger(){return this.menuButton.value??void 0}willUpdate(e){super.willUpdate(e),ue.has(this.heightMultiplier)||(this.heightMultiplier=1),z.allowedValues.has(this.compactSize)||(this.compactSize=z.defaultValue),["heightMultiplier","compactSize","compactBrandLogo","lightCompactBrandLogo","darkCompactBrandLogo"].some(t=>e.has(t))&&this.geometry.configure(),["scheme","brandLogo","lightBrandLogo","darkBrandLogo","compactBrandLogo","lightCompactBrandLogo","darkCompactBrandLogo"].some(t=>e.has(t))&&(this.readyCompactLogo=""),e.has("layout")&&!M.allowedValues.has(this.layout)&&(this.layout=M.defaultValue),e.has("brandAlign")&&!D.allowedValues.has(this.brandAlign)&&(this.brandAlign=D.defaultValue),e.has("brandWrap")&&!B.allowedValues.has(this.brandWrap)&&(this.brandWrap=B.defaultValue),e.has("menuDisplay")&&!O.allowedValues.has(this.menuDisplay)&&(this.menuDisplay=O.defaultValue),e.has("themeToggle")&&!P.allowedValues.has(this.themeToggle)&&(this.themeToggle=P.defaultValue)}firstUpdated(e){super.firstUpdated(e),this.shadowRoot?.addEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.addEventListener("error",this.syncCompactLogoReadiness,!0),this.menuContainer.value&&(this.syncPrimaryMenu(),this.observeMenuContainer(),this.syncExternalDrawerTarget(),this.syncMobileMenuQuery(),this.syncScrollListeners(),this.syncMenuLayout())}updated(e){super.updated(e),this.syncCompactLogoReadiness(),this.syncDrawerBrand(),this.syncEndProbeObserver(),(e.has("scheme")||e.has("layout")||e.has("brandLogo")||e.has("brandText")||e.has("lightBrandLogo")||e.has("darkBrandLogo"))&&this.geometry.invalidate(),(!e.size||[...e.keys()].some(t=>t!=="scrollProgress"&&t!=="hiddenByScroll"))&&this.geometry.measure(),this.observeMenuChildren(),(e.has("showBurger")||e.has("drawerTarget")||e.has("menuDisplay")||e.has("layout")||e.has("previewCollapseRequested"))&&(this.syncExternalDrawerTarget(),this.syncMenuLayout()),(e.has("mobileMenu")||e.has("menuTooLarge"))&&this.syncExternalDrawerControl(),e.has("scrollBehavior")?this.syncScrollListeners():(e.has("scrollThreshold")||e.has("dockOffset"))&&this.updateScrollState()}connectedCallback(){super.connectedCallback(),this.geometry.connect(),this.shadowRoot?.addEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.addEventListener("error",this.syncCompactLogoReadiness,!0),this.addEventListener(x.POPOVER_OPENED,this.onHeaderPopoverOpened),this.addEventListener(x.POPOVER_CLOSED,this.onHeaderPopoverClosed),this.addEventListener(x.MENU_GROUP_TOGGLE,this.onHeaderGroupToggle),this.addEventListener("keydown",this.onGeometryKeyboard),this.addEventListener("pointerdown",this.onGeometryPointer),this.addEventListener("pointerup",this.onGeometryPointerEnd),this.addEventListener("pointercancel",this.onGeometryPointerEnd),this.addEventListener("focusin",this.onGeometryFocus),this.addEventListener("focusout",this.onGeometryFocusOut),this.addEventListener("slotchange",this.onGeometryContentChanged),this.syncScrollListeners(),this.syncMobileMenuQuery(),this.addMenuDrawerListeners(),this.syncExternalDrawerTarget(),this.observeMenuContainer(),this.hasUpdated&&this.syncPrimaryMenu(),this.observeMenuChildren()}disconnectedCallback(){this.geometry.disconnect(),this.shadowRoot?.removeEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.removeEventListener("error",this.syncCompactLogoReadiness,!0),this.readyCompactLogo="",this.removeEventListener(x.POPOVER_OPENED,this.onHeaderPopoverOpened),this.removeEventListener(x.POPOVER_CLOSED,this.onHeaderPopoverClosed),this.removeEventListener(x.MENU_GROUP_TOGGLE,this.onHeaderGroupToggle),this.openHeaderPopovers.clear(),this.keyboardFocusHeld=!1,this.pointerFocusPending=!1,this.removeEventListener("keydown",this.onGeometryKeyboard),this.removeEventListener("pointerdown",this.onGeometryPointer),this.removeEventListener("pointerup",this.onGeometryPointerEnd),this.removeEventListener("pointercancel",this.onGeometryPointerEnd),this.removeEventListener("focusin",this.onGeometryFocus),this.removeEventListener("focusout",this.onGeometryFocusOut),this.removeEventListener("slotchange",this.onGeometryContentChanged),this.menu?.removeEventListener(T,this.onPrimaryPresentationChanged),this.menu?.removeEventListener(H,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=null),this.removeMenuDrawerListeners(),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.externalDrawerTarget instanceof _&&(this.externalDrawerTarget.hasExternalDrawerControl=!1),this.externalDrawerTarget=null,this.mobileMenuQuery?.removeEventListener("change",this.handleMobileMenuQueryChange),this.mobileMenuQuery=null,this.removeScrollListeners(),this.cancelScrollUpdate(),this.disconnectResizeObserver(),this.endProbeObserver?.disconnect(),this.observedEndProbe=null,this.menuChildObserver?.disconnect(),this.menuChildObserver=null,this.demoteMenuToggle(),super.disconnectedCallback()}renderHeaderEnd(e,t,r){return b`<nav
7
+ `;function L(f,e){const t=new Set(f);return{allowedValues:t,converter:{fromAttribute(n){return n??e},toAttribute(n){return t.has(n)?n:e}},defaultValue:e}}const se=["standard","centered-brand","centered-menu","extended","extended-centered","minimal"],ie=["start","center","end"],de=["truncate","wrap","nowrap"],le=["auto","inline","drawer"],he=["hidden","visible"],ce=["compact","standard"],ue=new Set(Array.from({length:41},(f,e)=>(e+10)/10)),M=L(se,"standard"),D=L(ie,"start"),B=L(de,"truncate"),z=L(le,"auto"),O=L(he,"hidden"),P=L(ce,"compact");let o=class extends I{constructor(){super(...arguments),this.menuOpen=!1,this.navigationConstrained=!1,this.menuTooLarge=!1,this.mobileMenu=!1,this.scrolled=!1,this.hiddenByScroll=!1,this.scrollProgress=0,this.showBurger=!1,this.layout=M.defaultValue,this.brandText="",this.brandLogo="",this.lightBrandLogo="",this.darkBrandLogo="",this.compactBrandLogo="",this.lightCompactBrandLogo="",this.darkCompactBrandLogo="",this.heightMultiplier=1,this.compactSize=P.defaultValue,this.brandHref="",this.brandAlt="",this.brandColor="",this.lightBrandColor="",this.darkBrandColor="",this.brandAlign=D.defaultValue,this.brandWrap=B.defaultValue,this.menuDisplay=z.defaultValue,this.themeToggle=O.defaultValue,this.scrollBehavior="none",this.scrollThreshold=16,this.dockOffset=0,this.drawerTarget="",this.previewCollapseRequested=!1,this.fullBleedContent=!1,this.geometry=new oe(this,()=>({heightMultiplier:this.heightMultiplier,compactSize:this.compactSize,compactLogo:!!(this.compactBrandLogo||this.lightCompactBrandLogo||this.darkCompactBrandLogo)}),()=>this.syncBrandFitWidth()),this.readyCompactLogo="",this.naturalBrandWidth=0,this.syncCompactLogoReadiness=()=>{const e=this.shadowRoot?.querySelector(".compact-brand-fit .brand-logo"),t=this.compactLogoSource,r=t&&e?.getAttribute("src")===t&&e.complete&&e.naturalWidth>0?t:"";r!==this.readyCompactLogo&&(this.readyCompactLogo=r)},this.keyboardFocusHeld=!1,this.pointerFocusPending=!1,this.onGeometryKeyboard=()=>{this.pointerFocusPending=!1,this.keyboardFocusHeld=!0,this.updateScrollState()},this.onGeometryPointer=()=>{this.pointerFocusPending=!0,this.keyboardFocusHeld=!1,this.updateScrollState()},this.onGeometryPointerEnd=()=>{this.pointerFocusPending=!1},this.openHeaderPopovers=new Set,this.onHeaderPopoverOpened=e=>{e.target&&this.openHeaderPopovers.add(e.target),this.updateScrollState()},this.onHeaderPopoverClosed=e=>{e.target&&this.openHeaderPopovers.delete(e.target),this.updateScrollState()},this.onHeaderGroupToggle=e=>{e.detail.open?this.onHeaderPopoverOpened(e):this.onHeaderPopoverClosed(e)},this.onGeometryFocus=e=>{const t=e.composedPath();this.keyboardFocusHeld=!this.pointerFocusPending&&t.some(r=>r instanceof Element&&r.matches(":focus-visible")),this.updateScrollState()},this.onGeometryFocusOut=()=>{queueMicrotask(()=>{this.matches(":focus-within")||(this.keyboardFocusHeld=!1,this.pointerFocusPending=!1),this.updateScrollState()})},this.menuContainer=A(),this.menuButton=A(),this.menu=void 0,this.externalDrawerTarget=null,this.lastScrollY=0,this.lastInlineMenuWidth=0,this.mobileMenuQuery=null,this.menuDrawerListenersAttached=!1,this.observingMenuContainer=!1,this.scrollListenersAttached=!1,this.scrollFrame=new q(()=>this.runScrollStateUpdate()),this.resizeObserver=new ResizeObserver(()=>this.syncMenuLayout()),this.menuChildObserver=null,this.endProbe=A(),this.observedEndProbe=null,this.endProbeObserver=null,this.invalidMenuSlot=null,this.actionsWidth=0,this.syncPrimaryMenu=()=>{const r=(this.menuContainer.value?.querySelector('slot[name="menu"]')?.assignedElements()??[])[0],n=r instanceof T&&r.parentElement===this?r:void 0,i=r&&!n?r:null;i&&i!==this.invalidMenuSlot&&console.warn("<esp-header>: the menu slot expects an <esp-menu> element, received",i),this.invalidMenuSlot=i,this.geometry.setPrimaryMenu(n),n!==this.menu&&(this.demoteMenuToggle(),this.removeMenuDrawerListeners(),this.menu?.removeEventListener(_,this.onPrimaryPresentationChanged),this.menu?.removeEventListener(H,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=null,this.menu.sliding=!1),this.menuChildObserver?.disconnect(),this.menuChildObserver=null,this.menu=n,this.lastInlineMenuWidth=0,this.lastDrawerBrandKey="",this.addMenuDrawerListeners(),this.menu?.addEventListener(_,this.onPrimaryPresentationChanged),this.observeMenuChildren(),this.syncDrawerBrand(),this.requestUpdate()),this.menu?.addEventListener(_,this.onPrimaryPresentationChanged),this.menu?.addEventListener(H,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=this.menu.mode==="horizontal"?this:null),this.syncExternalDrawerTarget(),this.syncMenuLayout()},this.onPrimaryPresentationChanged=()=>{this.menu?.headerDrawerActive&&this.returnEndFocusToBurger(),this.requestUpdate()},this.onPrimaryLayoutChanged=()=>{if(!this.menu)return;this.geometry.invalidate();const e=this.menu.mode==="horizontal"&&this.menu.parentElement===this?this:null;this.menu.headerEndOwner!==e&&(this.menu.headerEndOwner=e),this.menu.headerDrawerActive&&this.returnEndFocusToBurger(),this.observeMenuChildren(),this.requestUpdate(),this.syncMenuLayout()},this.updateScrollState=()=>this.scrollFrame.schedule(),this.handleMobileMenuQueryChange=e=>{this.mobileMenu=e.matches,this.syncMenuLayout(),this.syncExternalDrawerControl()},this.toggleTheme=()=>{const e=this.getThemeRoot();if(!e)return;e.scheme=e.scheme==="dark"?"light":"dark";const t=e.scheme==="dark"?"dark":"light";this.dispatchEvent(new CustomEvent(x.HEADER_THEME_TOGGLE,{detail:{scheme:t},bubbles:!0,composed:!0}))},this.handleMenuToggleClicked=()=>{if(this.menuOpen){this.closeNav();return}this.openNav()},this.onMenuDrawerOpened=()=>{this.menuOpen=!0,document.body.classList.add("menu-open"),this.burger&&(this.burger.menuOpen=!0)},this.onMenuDrawerClosed=()=>{this.menuOpen=!1,document.body.classList.remove("menu-open"),this.burger&&(this.burger.menuOpen=!1),this.demoteMenuToggle(),this.updateScrollState()},this.onMenuDrawerPresented=e=>{e.target!==this.menu||!this.menu?.isFullScreenDrawer||this.promoteMenuToggle()},this.menuTogglePromoted=!1,this.promotedToggleFrame=new q(()=>this.positionPromotedToggle()),this.handlePromotedViewportResize=()=>this.promotedToggleFrame.schedule(),this.lastDrawerBrandKey="",this.inertedHeaderChrome=[],this.onGeometryContentChanged=()=>this.geometry.invalidate()}resolveBrand(){return re({scheme:this.scheme,brandLogo:this.brandLogo,brandColor:this.brandColor,lightBrandLogo:this.lightBrandLogo,darkBrandLogo:this.darkBrandLogo,lightBrandColor:this.lightBrandColor,darkBrandColor:this.darkBrandColor})}get compactLogoSource(){if(!this.resolveBrand().brandLogo)return"";const e=this.scheme==="dark"?this.darkCompactBrandLogo:this.lightCompactBrandLogo,t=this.scheme==="dark"?this.lightCompactBrandLogo:this.darkCompactBrandLogo;return e||this.compactBrandLogo||t}syncBrandFitWidth(){const e=this.menuContainer.value?.parentElement;if(!e)return;const t=e.querySelector(".brand-fit-probe");this.naturalBrandWidth=t?.getBoundingClientRect().width??0;const r=e.querySelector('slot[name="brand"]')?.assignedElements().length,n=[...t?.querySelectorAll(".brand-logo")??[]].map(d=>d.getBoundingClientRect().width),i=getComputedStyle(e),a=[i.paddingTop,i.paddingBottom,i.borderTopWidth,i.borderBottomWidth].reduce((d,h)=>d+(parseFloat(h)||0),0);for(const[d,h]of[["--_esp-header-stable-brand-width",this.geometry.active&&!r?this.naturalBrandWidth:null],["--_esp-header-logo-reservation-width",Math.max(0,...n)],["--_esp-header-bar-block-insets",a]])if(h===null)e.style.removeProperty(d);else{const c=`${h}px`;e.style.getPropertyValue(d)!==c&&e.style.setProperty(d,c)}}get headerOverlayHeld(){for(const e of this.openHeaderPopovers)e instanceof Element&&!e.isConnected&&this.openHeaderPopovers.delete(e);return this.menuOpen||this.openHeaderPopovers.size>0}get usesIntrinsicNavigation(){return!!this.menu?.headerNavigationOwned}syncEndProbeObserver(){const e=this.endProbe.value??null;e!==this.observedEndProbe&&(this.endProbeObserver?.disconnect(),this.observedEndProbe=e,e&&(this.endProbeObserver??=new ResizeObserver(()=>this.syncMenuLayout()),this.endProbeObserver.observe(e,{box:"border-box"})),this.syncMenuLayout())}returnEndFocusToBurger(){const e=this.shadowRoot?.querySelector(".header-end"),t=this.shadowRoot?.activeElement;t&&e?.contains(t)&&this.updateComplete.then(()=>this.getBurgerFocusTarget()?.focus({preventScroll:!0}))}readHeaderEndFit(){const e=this.menuContainer.value?.parentElement;if(!e||!this.menu)return null;const t=getComputedStyle(e),r=e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0),n=parseFloat(t.columnGap)||0,i=e.querySelector(":scope > .brand"),d=i?.querySelector("slot")?.assignedElements().length?Math.max(i?.scrollWidth??0,i?.getBoundingClientRect().width??0):this.naturalBrandWidth,h=e.querySelector(":scope > .buttons"),c=Array.from(h?.children??[]).flatMap(g=>g.matches(".header-end, .header-end-measurement, .menu-toggle")?[]:g instanceof HTMLSlotElement?g.assignedElements():[g]).filter(g=>getComputedStyle(g).display!=="none");let u=c.reduce((g,N)=>{const G=getComputedStyle(N);return g+N.getBoundingClientRect().width+(parseFloat(G.marginLeft)||0)+(parseFloat(G.marginRight)||0)},0);const E=this.endProbe.value?.getBoundingClientRect().width??0,p=h&&parseFloat(getComputedStyle(h).columnGap)||0;u+=p*Math.max(0,c.length-1+(E>0?1:0));const y=this.menu.getHeaderNavigationWidths().main,w=E+u,S=this.layout==="extended"?y>r||d+w+n>r:this.layout==="extended-centered"?y>r||d+2*w+2*n>r:this.layout==="centered-brand"?d+2*Math.max(y,w)+2*n>r:d+y+w+2*n>r,C=this.getExternalDrawerTarget()?h?.querySelector(".menu-toggle"):null,k=u+(C&&getComputedStyle(C).display!=="none"?C.getBoundingClientRect().width+(c.length||E?p:0):0);return{width:r,brandWidth:d,main:y,endWidth:E,actions:u,actionFloor:k,gap:n,tooWide:S}}syncMenuLayout(){if(this.syncBrandFitWidth(),!this.menuContainer.value||!this.menu||!this.menu.getWidth)return;this.positionPromotedToggle();const e=this.menu.getWidth();e>0&&(this.lastInlineMenuWidth=e);const t=this.lastInlineMenuWidth||e,r=this.getExternalDrawerTarget(),n=this.menuDisplay!=="inline",i=this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested,a=n&&this.menuDisplay==="auto",d=a?this.layout==="centered-menu"?this.centeredMenuCapacity():this.menuContainer.value.clientWidth:0,h=this.usesIntrinsicNavigation?this.readHeaderEndFit():null;h&&this.actionsWidth!==h.actionFloor&&(this.actionsWidth=h.actionFloor,this.requestUpdate()),this.menuTooLarge=a&&(h?h.tooWide:t>d);const c=n&&!r&&this.hasDrawerableContent()&&(this.menuTooLarge||i||this.mobileMenu);c&&this.returnEndFocusToBurger(),this.menu.sliding=c,this.navigationConstrained=h?.tooWide??!1}centeredMenuCapacity(){const e=this.menuContainer.value?.parentElement;if(!(e instanceof HTMLElement))return 0;const t=d=>d?d.getBoundingClientRect().width:0,r=getComputedStyle(e),n=e.clientWidth-(Number.parseFloat(r.paddingLeft)||0)-(Number.parseFloat(r.paddingRight)||0),i=e.querySelector(":scope > section.brand"),a=e.querySelector(":scope > section.buttons");return n-t(i)-t(a)+t(a?.querySelector("esp-header-button.menu-toggle"))}menuHasContent(){return!!(this.menu??this.querySelector(':scope > [slot="menu"]'))?.querySelector("esp-menu-item, esp-menu-group")}hasDrawerableContent(){return this.showBurger||!!this.getExternalDrawerTarget()||this.menuHasContent()}getExternalDrawerTarget(){if(!this.drawerTarget)return null;const e=document.getElementById(this.drawerTarget);return e===this.menu?null:e&&"openDrawer"in e&&typeof e.openDrawer=="function"&&"closeDrawer"in e&&typeof e.closeDrawer=="function"?e:null}getBurgerFocusTarget(){const t=this.shadowRoot?.querySelector("esp-header-button.menu-toggle")?.shadowRoot?.querySelector("button"),r=this.menuButton.value?.shadowRoot?.querySelector("button");return t??r??null}getScrollTokens(){const e=this.scrollBehavior.split(/\s+/).map(t=>t.trim().toLowerCase()).filter(Boolean);return new Set(e.filter(t=>t!=="none"))}getEffectiveScrollThreshold(){return Number.isFinite(this.scrollThreshold)?Math.max(0,this.scrollThreshold):0}clearScrollState(){this.geometry.requestScroll(0,!1,!1,this.getEffectiveScrollThreshold(),!1),this.scrolled=!1,this.hiddenByScroll=!1,this.scrollProgress=0}runScrollStateUpdate(){const e=this.getScrollTokens();if(!e.size){this.clearScrollState();return}const t=Math.max(0,window.scrollY||document.documentElement.scrollTop||0),r=this.getEffectiveScrollThreshold(),n=Number.isFinite(this.dockOffset)?Math.max(0,this.dockOffset):r,i=t>(e.has("dock")?n:r),a=t>this.lastScrollY,d=e.has("reveal")&&a&&t>r&&!this.menuOpen;if(this.geometry.requestScroll(t,e.has("compact"),e.has("collapse-topbar")&&i,r,this.headerOverlayHeld||this.keyboardFocusHeld),this.scrolled=i,this.hiddenByScroll=d,e.has("progress")){const h=document.documentElement,c=Math.max(1,h.scrollHeight-window.innerHeight);this.scrollProgress=Math.min(1,t/c)}else this.scrollProgress=0;this.lastScrollY=t}cancelScrollUpdate(){this.scrollFrame.cancel()}syncScrollListeners(){const e=this.getScrollTokens().size>0;if(e&&!this.scrollListenersAttached?(window.addEventListener("scroll",this.updateScrollState,{passive:!0}),window.addEventListener("resize",this.updateScrollState,{passive:!0}),this.scrollListenersAttached=!0):!e&&this.scrollListenersAttached&&this.removeScrollListeners(),e){this.updateScrollState();return}this.cancelScrollUpdate(),this.clearScrollState()}removeScrollListeners(){this.scrollListenersAttached&&(window.removeEventListener("scroll",this.updateScrollState),window.removeEventListener("resize",this.updateScrollState),this.scrollListenersAttached=!1)}addMenuDrawerListeners(){!this.menu||this.menuDrawerListenersAttached||(this.menu.addEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.menu.addEventListener("esp-menu-drawer-presented",this.onMenuDrawerPresented),this.menu.addEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.menuDrawerListenersAttached=!0)}removeMenuDrawerListeners(){!this.menu||!this.menuDrawerListenersAttached||(this.menu.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.menu.removeEventListener("esp-menu-drawer-presented",this.onMenuDrawerPresented),this.menu.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.menuDrawerListenersAttached=!1)}observeMenuContainer(){if(!this.menuContainer.value||this.observingMenuContainer)return;this.resizeObserver.observe(this.menuContainer.value);const e=this.menuContainer.value.parentElement;if(e){this.resizeObserver.observe(e);for(const t of e.querySelectorAll(":scope > section.brand, :scope > section.buttons, :scope > .brand-fit-probe"))this.resizeObserver.observe(t)}this.observingMenuContainer=!0}disconnectResizeObserver(){this.observingMenuContainer&&(this.resizeObserver.disconnect(),this.observingMenuContainer=!1)}observeMenuChildren(){if(this.usesIntrinsicNavigation){this.menuChildObserver?.disconnect(),this.menuChildObserver=null;return}!this.menu||this.menuChildObserver||(this.menuChildObserver=new MutationObserver(()=>{this.syncMenuLayout(),this.requestUpdate()}),this.menuChildObserver.observe(this.menu,{childList:!0,subtree:!0}))}syncMobileMenuQuery(){if("matchMedia"in window){if(!this.mobileMenuQuery){this.mobileMenuQuery=window.matchMedia(ae),this.mobileMenu=this.mobileMenuQuery.matches,this.mobileMenuQuery.addEventListener("change",this.handleMobileMenuQueryChange);return}this.mobileMenu=this.mobileMenuQuery.matches}}getThemeRoot(){return this.traverseToClosest("esp-root")}syncExternalDrawerTarget(){const e=this.getExternalDrawerTarget(),t=e===this.menu?null:e;t!==this.externalDrawerTarget&&(this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.externalDrawerTarget instanceof T&&(this.externalDrawerTarget.hasExternalDrawerControl=!1),this.externalDrawerTarget=t,this.externalDrawerTarget?.addEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.addEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed)),this.syncExternalDrawerControl()}burgerVisibleForTarget(){if(this.menuDisplay==="inline")return!1;const e=this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested;return this.menuTooLarge||this.mobileMenu||e}syncExternalDrawerControl(){this.externalDrawerTarget instanceof T&&(this.externalDrawerTarget.hasExternalDrawerControl=this.burgerVisibleForTarget())}openNav(){const e=this.getBurgerFocusTarget(),t=this.getExternalDrawerTarget();if(this.burger&&(this.burger.menuOpen=!0),t){this.menuOpen=!0,t.openDrawer(e),document.body.classList.add("menu-open");return}if(this.menu){this.menu.sliding=!0,this.menuOpen=!0,this.menu.isFullScreenDrawer&&this.canPromoteMenuToggle()&&(this.menu.liftedCloseControl=this.getMenuToggleElement()),this.menu.openDrawer(e),document.body.classList.add("menu-open");return}this.burger&&(this.burger.menuOpen=!1)}closeNav(){this.menuOpen=!1,this.burger&&(this.burger.menuOpen=!1),this.demoteMenuToggle();const e=this.getExternalDrawerTarget();if(e){e.closeDrawer(),document.body.classList.remove("menu-open");return}this.menu&&(this.menu.closeDrawer(),document.body.classList.remove("menu-open"))}getMenuToggleElement(){return this.shadowRoot?.querySelector("esp-header-button.menu-toggle")??null}canPromoteMenuToggle(){const e=this.getMenuToggleElement();return!!e&&typeof e?.showPopover=="function"}setHeaderChromeInert(e){if(!e){for(const a of this.inertedHeaderChrome)a.inert=!1;this.inertedHeaderChrome=[];return}const t=this.menuContainer.value?.parentElement,r=this.getMenuToggleElement();if(!t||!r)return;const n=[];for(const a of t.querySelectorAll(":scope > section.brand, :scope > section.topbar"))n.push(a);const i=t.querySelector(":scope > section.buttons");for(const a of i?.children??[])if(!(!(a instanceof HTMLElement)||a===r)){if(a instanceof HTMLSlotElement){for(const d of a.assignedElements())d instanceof HTMLElement&&n.push(d);continue}n.push(a)}for(const a of n)a.inert||(a.inert=!0,this.inertedHeaderChrome.push(a))}promoteMenuToggle(){const e=this.getMenuToggleElement();if(!e||this.menuTogglePromoted||typeof e.showPopover!="function")return;const t=e.getBoundingClientRect();e.setAttribute("popover","manual"),Object.assign(e.style,{position:"fixed",inset:"auto",margin:"0",padding:"0",border:"0",background:"transparent",overflow:"visible"}),this.setPromotedTogglePosition(e,t.width);try{e.showPopover()}catch{e.removeAttribute("popover"),e.removeAttribute("style"),this.menu&&(this.menu.liftedCloseControl=null);return}this.menuTogglePromoted=!0,window.addEventListener("resize",this.handlePromotedViewportResize),this.menu&&(this.menu.liftedCloseControl=e),this.setHeaderChromeInert(!0)}positionPromotedToggle(){if(!this.menuTogglePromoted)return;const e=this.getMenuToggleElement();if(!e)return;const t=e.getBoundingClientRect();this.setPromotedTogglePosition(e,t.width)}setPromotedTogglePosition(e,t){const r=ee(),n=getComputedStyle(e).direction==="rtl";e.style.left=`${n?0:Math.max(0,r.width-t)}px`,e.style.top="0px"}demoteMenuToggle(){if(window.removeEventListener("resize",this.handlePromotedViewportResize),this.promotedToggleFrame.cancel(),this.menu?.liftedCloseControl&&(this.menu.liftedCloseControl=null),!this.menuTogglePromoted)return;this.menuTogglePromoted=!1,this.setHeaderChromeInert(!1);const e=this.getMenuToggleElement();if(e){try{e.hidePopover()}catch{}e.removeAttribute("popover"),e.removeAttribute("style")}}syncDrawerBrand(){if(!this.menu)return;const e=this.resolveBrand(),t=e.brandLogo||this.brandText?{brandLogo:e.brandLogo,brandText:this.brandText,brandHref:this.brandHref,brandAlt:this.brandAlt,brandColor:e.brandColor}:null,r=JSON.stringify(t);r!==this.lastDrawerBrandKey&&(this.lastDrawerBrandKey=r,this.menu.drawerBrand=t)}get burger(){return this.menuButton.value??void 0}willUpdate(e){super.willUpdate(e),ue.has(this.heightMultiplier)||(this.heightMultiplier=1),P.allowedValues.has(this.compactSize)||(this.compactSize=P.defaultValue),["heightMultiplier","compactSize","compactBrandLogo","lightCompactBrandLogo","darkCompactBrandLogo"].some(t=>e.has(t))&&this.geometry.configure(),["scheme","brandLogo","lightBrandLogo","darkBrandLogo","compactBrandLogo","lightCompactBrandLogo","darkCompactBrandLogo"].some(t=>e.has(t))&&(this.readyCompactLogo=""),e.has("layout")&&!M.allowedValues.has(this.layout)&&(this.layout=M.defaultValue),e.has("brandAlign")&&!D.allowedValues.has(this.brandAlign)&&(this.brandAlign=D.defaultValue),e.has("brandWrap")&&!B.allowedValues.has(this.brandWrap)&&(this.brandWrap=B.defaultValue),e.has("menuDisplay")&&!z.allowedValues.has(this.menuDisplay)&&(this.menuDisplay=z.defaultValue),e.has("themeToggle")&&!O.allowedValues.has(this.themeToggle)&&(this.themeToggle=O.defaultValue)}firstUpdated(e){super.firstUpdated(e),this.shadowRoot?.addEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.addEventListener("error",this.syncCompactLogoReadiness,!0),this.menuContainer.value&&(this.syncPrimaryMenu(),this.observeMenuContainer(),this.syncExternalDrawerTarget(),this.syncMobileMenuQuery(),this.syncScrollListeners(),this.syncMenuLayout())}updated(e){super.updated(e),this.syncCompactLogoReadiness(),this.syncDrawerBrand(),this.syncEndProbeObserver(),(e.has("scheme")||e.has("layout")||e.has("brandLogo")||e.has("brandText")||e.has("lightBrandLogo")||e.has("darkBrandLogo"))&&this.geometry.invalidate(),(!e.size||[...e.keys()].some(t=>t!=="scrollProgress"&&t!=="hiddenByScroll"))&&this.geometry.measure(),this.observeMenuChildren(),(e.has("showBurger")||e.has("drawerTarget")||e.has("menuDisplay")||e.has("layout")||e.has("previewCollapseRequested"))&&(this.syncExternalDrawerTarget(),this.syncMenuLayout()),(e.has("mobileMenu")||e.has("menuTooLarge"))&&this.syncExternalDrawerControl(),e.has("scrollBehavior")?this.syncScrollListeners():(e.has("scrollThreshold")||e.has("dockOffset"))&&this.updateScrollState()}connectedCallback(){super.connectedCallback(),this.geometry.connect(),this.shadowRoot?.addEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.addEventListener("error",this.syncCompactLogoReadiness,!0),this.addEventListener(x.POPOVER_OPENED,this.onHeaderPopoverOpened),this.addEventListener(x.POPOVER_CLOSED,this.onHeaderPopoverClosed),this.addEventListener(x.MENU_GROUP_TOGGLE,this.onHeaderGroupToggle),this.addEventListener("keydown",this.onGeometryKeyboard),this.addEventListener("pointerdown",this.onGeometryPointer),this.addEventListener("pointerup",this.onGeometryPointerEnd),this.addEventListener("pointercancel",this.onGeometryPointerEnd),this.addEventListener("focusin",this.onGeometryFocus),this.addEventListener("focusout",this.onGeometryFocusOut),this.addEventListener("slotchange",this.onGeometryContentChanged),this.syncScrollListeners(),this.syncMobileMenuQuery(),this.addMenuDrawerListeners(),this.syncExternalDrawerTarget(),this.observeMenuContainer(),this.hasUpdated&&this.syncPrimaryMenu(),this.observeMenuChildren()}disconnectedCallback(){this.geometry.disconnect(),this.shadowRoot?.removeEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.removeEventListener("error",this.syncCompactLogoReadiness,!0),this.readyCompactLogo="",this.removeEventListener(x.POPOVER_OPENED,this.onHeaderPopoverOpened),this.removeEventListener(x.POPOVER_CLOSED,this.onHeaderPopoverClosed),this.removeEventListener(x.MENU_GROUP_TOGGLE,this.onHeaderGroupToggle),this.openHeaderPopovers.clear(),this.keyboardFocusHeld=!1,this.pointerFocusPending=!1,this.removeEventListener("keydown",this.onGeometryKeyboard),this.removeEventListener("pointerdown",this.onGeometryPointer),this.removeEventListener("pointerup",this.onGeometryPointerEnd),this.removeEventListener("pointercancel",this.onGeometryPointerEnd),this.removeEventListener("focusin",this.onGeometryFocus),this.removeEventListener("focusout",this.onGeometryFocusOut),this.removeEventListener("slotchange",this.onGeometryContentChanged),this.menu?.removeEventListener(_,this.onPrimaryPresentationChanged),this.menu?.removeEventListener(H,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=null),this.removeMenuDrawerListeners(),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.externalDrawerTarget instanceof T&&(this.externalDrawerTarget.hasExternalDrawerControl=!1),this.externalDrawerTarget=null,this.mobileMenuQuery?.removeEventListener("change",this.handleMobileMenuQueryChange),this.mobileMenuQuery=null,this.removeScrollListeners(),this.cancelScrollUpdate(),this.disconnectResizeObserver(),this.endProbeObserver?.disconnect(),this.observedEndProbe=null,this.menuChildObserver?.disconnect(),this.menuChildObserver=null,this.demoteMenuToggle(),super.disconnectedCallback()}renderHeaderEnd(e,t,r){return b`<nav
8
8
  class=${W({"header-end":!t,"header-end-probe":t})}
9
9
  ${t?R(this.endProbe):m}
10
10
  aria-label=${t?m:`${this.menu?.ariaLabel??"Navigation"} links`}
@@ -14,7 +14,7 @@ var i=function(f,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnP
14
14
  style=${J(this.menu)}
15
15
  >
16
16
  ${e.map(n=>X(n,{mode:"horizontal",sourceStyle:!0}))}
17
- </nav>`}render(){const{menuOpen:e,menuTooLarge:t,mobileMenu:r}=this,n=this.menuDisplay!=="inline",s=n&&(this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested),o=this.getScrollTokens(),d=o.has("progress"),h=this.resolveBrand(),c={"--_esp-header-brand-color":h.brandColor||null,"--_esp-header-scroll-progress":String(this.scrollProgress),"--_esp-header-actions-width":`${this.actionsWidth}px`,"--_esp-header-height-multiplier":String(this.geometry.multiplier),"--_esp-header-own-menu-offset":this.geometry.active?`${this.geometry.record.visibleBlockSize}px`:null},u=this.compactLogoSource,E=this.geometry.compact&&u&&this.readyCompactLogo===u,p=this.menu?.headerEndNodes??[],y=!p.length||!!this.menu?.headerDrawerActive,w=!!this.menu?.headerDrawerActive,S=this.menuDisplay==="inline"||this.usesIntrinsicNavigation&&!w&&!!this.getExternalDrawerTarget(),C={"primary-drawer":w,"has-header-end":p.length>0,"explicit-inline":S,"navigation-constrained":this.navigationConstrained,"menu-open":e,"too-wide":n&&this.hasDrawerableContent()&&(t||r||s),[`layout-${this.layout==="minimal"&&S?"standard":this.layout}`]:!0,"is-scrolled":this.scrolled,"geometry-topbar-collapsed":this.geometry.topbarCollapsed,"geometry-active":this.geometry.active,"geometry-compact":this.geometry.compact,"geometry-standard":this.geometry.standard,"geometry-initial":this.geometry.pending,"hide-on-scroll":this.hiddenByScroll,"scroll-compact":o.has("compact"),"scroll-elevate":o.has("elevate"),"scroll-transparent":o.has("transparent")||o.has("transparent-to-solid"),"scroll-collapse-topbar":o.has("collapse-topbar")};this.toggleAttribute("data-esp-compact",this.geometry.compact);const k=this.scheme==="dark"?"light":"dark";return b`
17
+ </nav>`}render(){const{menuOpen:e,menuTooLarge:t,mobileMenu:r}=this,n=this.menuDisplay!=="inline",i=n&&(this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested),a=this.getScrollTokens(),d=a.has("progress"),h=this.resolveBrand(),c={"--_esp-header-brand-color":h.brandColor||null,"--_esp-header-scroll-progress":String(this.scrollProgress),"--_esp-header-actions-width":`${this.actionsWidth}px`,"--_esp-header-height-multiplier":String(this.geometry.multiplier),"--_esp-header-own-menu-offset":this.geometry.active?`${this.geometry.record.visibleBlockSize}px`:null},u=this.compactLogoSource,E=this.geometry.compact&&u&&this.readyCompactLogo===u,p=this.menu?.headerEndNodes??[],y=!p.length||!!this.menu?.headerDrawerActive,w=!!this.menu?.headerDrawerActive,S=this.menuDisplay==="inline"||this.usesIntrinsicNavigation&&!w&&!!this.getExternalDrawerTarget(),C={"primary-drawer":w,"has-header-end":p.length>0,"explicit-inline":S,"navigation-constrained":this.navigationConstrained,"menu-open":e,"too-wide":n&&this.hasDrawerableContent()&&(t||r||i),[`layout-${this.layout==="minimal"&&S?"standard":this.layout}`]:!0,"is-scrolled":this.scrolled,"geometry-topbar-collapsed":this.geometry.topbarCollapsed,"geometry-active":this.geometry.active,"scaled-header":this.heightMultiplier>1,"geometry-compact":this.geometry.compact,"geometry-standard":this.geometry.standard,"geometry-initial":this.geometry.pending,"hide-on-scroll":this.hiddenByScroll,"scroll-compact":a.has("compact"),"scroll-elevate":a.has("elevate"),"scroll-transparent":a.has("transparent")||a.has("transparent-to-solid"),"scroll-collapse-topbar":a.has("collapse-topbar")};this.toggleAttribute("data-esp-compact",this.geometry.compact);const k=this.scheme==="dark"?"light":"dark";return b`
18
18
  <header class=${W(C)} style=${K(c)}>
19
19
  <section class="topbar">
20
20
  <slot name="topbar" @slotchange=${this.onGeometryContentChanged}></slot>
@@ -67,7 +67,7 @@ var i=function(f,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnP
67
67
  </div>
68
68
  ${d?b`<div class="scroll-progress" aria-hidden="true"></div>`:m}
69
69
  </header>
70
- `}};a.styles=[...I.styles,Z,j(2,"header"),te,$`
70
+ `}};o.styles=[...I.styles,Z,j(2,"header"),te,$`
71
71
  :host {
72
72
  --_esp-header-base-height: var(--esp-header-height, calc(4.5 * var(--esp-size-small)));
73
73
  --_esp-header-current-height: var(--_esp-header-base-height);
@@ -78,6 +78,8 @@ var i=function(f,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnP
78
78
  }
79
79
 
80
80
  header {
81
+ --_esp-menu-button-margin: var(--esp-size-tiny);
82
+ --_esp-menu-button-default-padding: var(--esp-size-tiny) var(--esp-size-small);
81
83
  --_esp-header-border-value: var(--esp-header-border, solid var(--esp-color-border));
82
84
  --_esp-header-border-width-value: var(--esp-header-border-width, 0 0 1px 0);
83
85
  --_esp-header-extended-border-value: var(--esp-header-extended-menu-border, 1px solid var(--esp-color-border));
@@ -246,7 +248,7 @@ var i=function(f,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnP
246
248
  .header-end,
247
249
  .header-end-probe {
248
250
  display: flex;
249
- align-items: stretch;
251
+ align-items: var(--_esp-menu-horizontal-align, stretch);
250
252
  --esp-header-height: var(--_esp-header-current-height);
251
253
  }
252
254
 
@@ -426,6 +428,14 @@ var i=function(f,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnP
426
428
  --esp-header-extended-menu-height,
427
429
  calc(3.5 * var(--esp-size-small))
428
430
  );
431
+ --_esp-menu-button-row-height: var(
432
+ --esp-header-height,
433
+ var(--esp-header-extended-menu-height, calc(3.5 * var(--esp-size-small)))
434
+ );
435
+ --_esp-menu-button-row-min-height: var(
436
+ --esp-header-height,
437
+ var(--esp-header-extended-menu-height, calc(3.5 * var(--esp-size-small)))
438
+ );
429
439
  }
430
440
  }
431
441
 
@@ -526,6 +536,26 @@ var i=function(f,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnP
526
536
  }
527
537
  }
528
538
 
539
+
540
+ header.scaled-header:not(.geometry-compact),
541
+ :host([data-esp-geometry-measuring]) header.scaled-header {
542
+ --_esp-menu-horizontal-align: center;
543
+ --_esp-menu-button-row-height: auto;
544
+ --_esp-menu-button-row-min-height: var(--_esp-header-current-height);
545
+ }
546
+
547
+ header.scaled-header:not(.geometry-compact) {
548
+ --_esp-menu-active-indicator-shadow: none;
549
+
550
+ section.buttons > esp-header-button:not([popover]),
551
+ section.buttons ::slotted(*) {
552
+ --_esp-header-button-background: transparent;
553
+ --_esp-header-button-background-hover: transparent;
554
+ --_esp-header-button-border-left: none;
555
+ --_esp-header-button-box-shadow: none;
556
+ }
557
+ }
558
+
529
559
  header.geometry-active {
530
560
  --_esp-header-expanded-bar-height: calc(var(--_esp-header-base-height) * var(--_esp-header-height-multiplier));
531
561
  --_esp-header-bar-height: var(--_esp-header-expanded-bar-height);
@@ -538,6 +568,7 @@ var i=function(f,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnP
538
568
  transition: grid-template-rows 0.24s ease, min-height 0.24s ease, ${V};
539
569
 
540
570
  > section:not(.topbar) { min-height: 0; }
571
+ section.menu-container { align-self: center; }
541
572
 
542
573
  &.layout-extended,
543
574
  &.layout-extended-centered {
@@ -737,4 +768,4 @@ var i=function(f,e,t,r){var n=arguments.length,s=n<3?e:r===null?r=Object.getOwnP
737
768
  transition: none;
738
769
  }
739
770
  }
740
- `],i([v()],a.prototype,"menuOpen",void 0),i([v()],a.prototype,"navigationConstrained",void 0),i([v()],a.prototype,"menuTooLarge",void 0),i([v()],a.prototype,"mobileMenu",void 0),i([v()],a.prototype,"scrolled",void 0),i([v()],a.prototype,"hiddenByScroll",void 0),i([v()],a.prototype,"scrollProgress",void 0),i([l({attribute:"show-burger",type:Boolean})],a.prototype,"showBurger",void 0),i([l({converter:M.converter,reflect:!0})],a.prototype,"layout",void 0),i([l({attribute:"brand-text",type:String})],a.prototype,"brandText",void 0),i([l({attribute:"brand-logo",type:String})],a.prototype,"brandLogo",void 0),i([l({attribute:"light-brand-logo",type:String})],a.prototype,"lightBrandLogo",void 0),i([l({attribute:"dark-brand-logo",type:String})],a.prototype,"darkBrandLogo",void 0),i([l({attribute:"compact-brand-logo",type:String})],a.prototype,"compactBrandLogo",void 0),i([l({attribute:"light-compact-brand-logo",type:String})],a.prototype,"lightCompactBrandLogo",void 0),i([l({attribute:"dark-compact-brand-logo",type:String})],a.prototype,"darkCompactBrandLogo",void 0),i([l({attribute:"height-multiplier",type:Number,reflect:!0})],a.prototype,"heightMultiplier",void 0),i([l({attribute:"compact-size",converter:z.converter,reflect:!0})],a.prototype,"compactSize",void 0),i([l({attribute:"brand-href",type:String})],a.prototype,"brandHref",void 0),i([l({attribute:"brand-alt",type:String})],a.prototype,"brandAlt",void 0),i([l({attribute:"brand-color",type:String})],a.prototype,"brandColor",void 0),i([l({attribute:"light-brand-color",type:String})],a.prototype,"lightBrandColor",void 0),i([l({attribute:"dark-brand-color",type:String})],a.prototype,"darkBrandColor",void 0),i([l({attribute:"brand-align",converter:D.converter,reflect:!0})],a.prototype,"brandAlign",void 0),i([l({attribute:"brand-wrap",converter:B.converter,reflect:!0})],a.prototype,"brandWrap",void 0),i([l({attribute:"menu-display",converter:O.converter,reflect:!0})],a.prototype,"menuDisplay",void 0),i([l({attribute:"theme-toggle",converter:P.converter,reflect:!0})],a.prototype,"themeToggle",void 0),i([l({attribute:"scroll-behavior",type:String})],a.prototype,"scrollBehavior",void 0),i([l({attribute:"scroll-threshold",type:Number})],a.prototype,"scrollThreshold",void 0),i([l({attribute:"dock-offset",type:Number})],a.prototype,"dockOffset",void 0),i([l({attribute:"drawer-target",type:String})],a.prototype,"drawerTarget",void 0),i([l({attribute:!1})],a.prototype,"previewCollapseRequested",void 0),i([l({attribute:"full-bleed-content",type:Boolean,reflect:!0})],a.prototype,"fullBleedContent",void 0),i([v()],a.prototype,"readyCompactLogo",void 0),a=i([Y("esp-header")],a);export{a as EspalierHeader};
771
+ `],s([v()],o.prototype,"menuOpen",void 0),s([v()],o.prototype,"navigationConstrained",void 0),s([v()],o.prototype,"menuTooLarge",void 0),s([v()],o.prototype,"mobileMenu",void 0),s([v()],o.prototype,"scrolled",void 0),s([v()],o.prototype,"hiddenByScroll",void 0),s([v()],o.prototype,"scrollProgress",void 0),s([l({attribute:"show-burger",type:Boolean})],o.prototype,"showBurger",void 0),s([l({converter:M.converter,reflect:!0})],o.prototype,"layout",void 0),s([l({attribute:"brand-text",type:String})],o.prototype,"brandText",void 0),s([l({attribute:"brand-logo",type:String})],o.prototype,"brandLogo",void 0),s([l({attribute:"light-brand-logo",type:String})],o.prototype,"lightBrandLogo",void 0),s([l({attribute:"dark-brand-logo",type:String})],o.prototype,"darkBrandLogo",void 0),s([l({attribute:"compact-brand-logo",type:String})],o.prototype,"compactBrandLogo",void 0),s([l({attribute:"light-compact-brand-logo",type:String})],o.prototype,"lightCompactBrandLogo",void 0),s([l({attribute:"dark-compact-brand-logo",type:String})],o.prototype,"darkCompactBrandLogo",void 0),s([l({attribute:"height-multiplier",type:Number,reflect:!0})],o.prototype,"heightMultiplier",void 0),s([l({attribute:"compact-size",converter:P.converter,reflect:!0})],o.prototype,"compactSize",void 0),s([l({attribute:"brand-href",type:String})],o.prototype,"brandHref",void 0),s([l({attribute:"brand-alt",type:String})],o.prototype,"brandAlt",void 0),s([l({attribute:"brand-color",type:String})],o.prototype,"brandColor",void 0),s([l({attribute:"light-brand-color",type:String})],o.prototype,"lightBrandColor",void 0),s([l({attribute:"dark-brand-color",type:String})],o.prototype,"darkBrandColor",void 0),s([l({attribute:"brand-align",converter:D.converter,reflect:!0})],o.prototype,"brandAlign",void 0),s([l({attribute:"brand-wrap",converter:B.converter,reflect:!0})],o.prototype,"brandWrap",void 0),s([l({attribute:"menu-display",converter:z.converter,reflect:!0})],o.prototype,"menuDisplay",void 0),s([l({attribute:"theme-toggle",converter:O.converter,reflect:!0})],o.prototype,"themeToggle",void 0),s([l({attribute:"scroll-behavior",type:String})],o.prototype,"scrollBehavior",void 0),s([l({attribute:"scroll-threshold",type:Number})],o.prototype,"scrollThreshold",void 0),s([l({attribute:"dock-offset",type:Number})],o.prototype,"dockOffset",void 0),s([l({attribute:"drawer-target",type:String})],o.prototype,"drawerTarget",void 0),s([l({attribute:!1})],o.prototype,"previewCollapseRequested",void 0),s([l({attribute:"full-bleed-content",type:Boolean,reflect:!0})],o.prototype,"fullBleedContent",void 0),s([v()],o.prototype,"readyCompactLogo",void 0),o=s([Y("esp-header")],o);export{o as EspalierHeader};
@@ -14,6 +14,8 @@ export type { MenuItemAppearance } from "./menu-presentation.js";
14
14
  *
15
15
  * Button appearance supports esp-button's public `--esp-button-padding` token.
16
16
  * Incognito padding does not apply.
17
+ * Inside a header, button appearance has theme-space margins and a smaller
18
+ * default padding so adjacent actions stay separate. An explicit padding wins.
17
19
  *
18
20
  * To give readers that run no JavaScript a real link, write a plain
19
21
  * `<a slot="link">` beside the attributes, with the same `href`, `target`,
@@ -1,7 +1,7 @@
1
- var o=function(d,e,r,s){var p=arguments.length,n=p<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(d,e,r,s);else for(var c=d.length-1;c>=0;c--)(i=d[c])&&(n=(p<3?i(n):p>3?i(e,r,n):i(e,r))||n);return p>3&&n&&Object.defineProperty(e,r,n),n};import{css as f,html as l,nothing as h}from"lit";import{customElement as g,property as a,state as u}from"lit/decorators.js";import{classMap as y}from"lit/directives/class-map.js";import{ref as m}from"lit/directives/ref.js";import{getIconHrefForHost as w}from"../shared/intent-values.js";import{EspalierElementBase as v}from"../shared/esp-element-base.js";import{ESP_EVENTS as k}from"../shared/events.js";import{pathsMatch as z}from"../shared/path-matching.js";import{SlottedIconController as x}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as $}from"../shared/svgs/render-sprite-icon.js";import{DEFAULT_NEW_TAB_LABEL as E,renderNewTabCue as S}from"../shared/new-tab-cue.js";import{srOnly as C}from"../shared/style-fragments.js";import{MENU_SOURCE_CHANGED as _,resolveMenuItemAppearance as b}from"./menu-presentation.js";import"../button/esp-button.js";let t=class extends v{constructor(){super(...arguments),this.iconSlot=new x(this),this.label="",this.url="",this.appearance="link",this.target="",this.rel="",this.newTabLabel=E,this.icon="",this.headerEnd=!1,this.promotedForHeader=!1,this.mode="vertical",this.depth=0,this.touchDevice=!1,this.active=!1}get headerEndPromoted(){return this.promotedForHeader}setHeaderEndPromoted(e){this.promotedForHeader=e,this.toggleAttribute("data-esp-header-end-promoted",e)}connectedCallback(){this.setHeaderEndPromoted(!1),super.connectedCallback(),this.checkActive()}disconnectedCallback(){this.setHeaderEndPromoted(!1),super.disconnectedCallback()}willUpdate(e){super.willUpdate(e),e.has("appearance")&&(this.appearance=b(this.appearance))}updated(e){super.updated(e),["label","url","target","rel","newTabLabel","icon","headerEnd","appearance"].some(r=>e.has(r))&&this.dispatchEvent(new CustomEvent(_,{bubbles:!0,composed:!0})),e.has("url")&&this.checkActive()}checkActive(){if(!this.url){this.active=!1;return}this.active=z(this.url)}handleButtonClick(){this.dispatchEvent(new CustomEvent(k.CLICKED,{detail:{},bubbles:!0,composed:!0}))}render(){const e=w(this.icon,this),r=this.iconSlot.hasSlottedIcon(":scope > :not([slot]), :scope > [slot='']"),s=r||e.length>0,p=b(this.appearance)==="button",n={item:!0,"button-appearance":p,"is-horizontal":this.mode==="horizontal"&&this.depth===0,"is-vertical":this.mode!=="horizontal"||this.depth>0,"is-drawer":this.mode==="drawer","is-nested":this.depth>0,"has-icon":s,"is-active":this.active},i=l`<span part="menu-text">${this.label}</span>`,c=l`<span class="icon-area" aria-hidden=${s?"true":h}>
1
+ var o=function(d,e,r,s){var p=arguments.length,n=p<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(d,e,r,s);else for(var c=d.length-1;c>=0;c--)(i=d[c])&&(n=(p<3?i(n):p>3?i(e,r,n):i(e,r))||n);return p>3&&n&&Object.defineProperty(e,r,n),n};import{css as g,html as l,nothing as h}from"lit";import{customElement as f,property as a,state as u}from"lit/decorators.js";import{classMap as w}from"lit/directives/class-map.js";import{ref as m}from"lit/directives/ref.js";import{getIconHrefForHost as y}from"../shared/intent-values.js";import{EspalierElementBase as v}from"../shared/esp-element-base.js";import{ESP_EVENTS as k}from"../shared/events.js";import{pathsMatch as z}from"../shared/path-matching.js";import{SlottedIconController as x}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as $}from"../shared/svgs/render-sprite-icon.js";import{DEFAULT_NEW_TAB_LABEL as E,renderNewTabCue as _}from"../shared/new-tab-cue.js";import{srOnly as S}from"../shared/style-fragments.js";import{MENU_SOURCE_CHANGED as C,resolveMenuItemAppearance as b}from"./menu-presentation.js";import"../button/esp-button.js";let t=class extends v{constructor(){super(...arguments),this.iconSlot=new x(this),this.label="",this.url="",this.appearance="link",this.target="",this.rel="",this.newTabLabel=E,this.icon="",this.headerEnd=!1,this.promotedForHeader=!1,this.mode="vertical",this.depth=0,this.touchDevice=!1,this.active=!1}get headerEndPromoted(){return this.promotedForHeader}setHeaderEndPromoted(e){this.promotedForHeader=e,this.toggleAttribute("data-esp-header-end-promoted",e)}connectedCallback(){this.setHeaderEndPromoted(!1),super.connectedCallback(),this.checkActive()}disconnectedCallback(){this.setHeaderEndPromoted(!1),super.disconnectedCallback()}willUpdate(e){super.willUpdate(e),e.has("appearance")&&(this.appearance=b(this.appearance))}updated(e){super.updated(e),["label","url","target","rel","newTabLabel","icon","headerEnd","appearance"].some(r=>e.has(r))&&this.dispatchEvent(new CustomEvent(C,{bubbles:!0,composed:!0})),e.has("url")&&this.checkActive()}checkActive(){if(!this.url){this.active=!1;return}this.active=z(this.url)}handleButtonClick(){this.dispatchEvent(new CustomEvent(k.CLICKED,{detail:{},bubbles:!0,composed:!0}))}render(){const e=y(this.icon,this),r=this.iconSlot.hasSlottedIcon(":scope > :not([slot]), :scope > [slot='']"),s=r||e.length>0,p=b(this.appearance)==="button",n={item:!0,"button-appearance":p,"is-horizontal":this.mode==="horizontal"&&this.depth===0,"is-vertical":this.mode!=="horizontal"||this.depth>0,"is-drawer":this.mode==="drawer","is-nested":this.depth>0,"has-icon":s,"is-active":this.active},i=l`<span part="menu-text">${this.label}</span>`,c=l`<span class="icon-area" aria-hidden=${s?"true":h}>
2
2
  <slot ${m(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
3
3
  ${!r&&e?$(e):h}
4
- </span>`;return l`<div class=${y(n)} ?hidden=${this.headerEndPromoted}>
4
+ </span>`;return l`<div class=${w(n)} ?hidden=${this.headerEndPromoted}>
5
5
  ${p?l`<esp-button
6
6
  collapsed
7
7
  exportparts="label: menu-text"
@@ -13,9 +13,9 @@ var o=function(d,e,r,s){var p=arguments.length,n=p<3?e:s===null?s=Object.getOwnP
13
13
  .current=${this.active}
14
14
  .icon=${this.icon}
15
15
  ><slot ${m(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot></esp-button>`:this.active?l`<span class="current-page" aria-current="page">${i}${c}</span>`:this.url?l`<a href=${this.url} target=${this.target||h} rel=${this.rel||h}
16
- >${i}${c}${S(this.target,this.newTabLabel)}</a
16
+ >${i}${c}${_(this.target,this.newTabLabel)}</a
17
17
  >`:l`<button type="button" @click=${this.handleButtonClick}>${i}${c}</button>`}
18
- </div>`}};t.styles=[...v.styles,C,f`
18
+ </div>`}};t.styles=[...v.styles,S,g`
19
19
  :host {
20
20
  display: block;
21
21
  }
@@ -52,9 +52,11 @@ var o=function(d,e,r,s){var p=arguments.length,n=p<3?e:s===null?s=Object.getOwnP
52
52
  }
53
53
 
54
54
  .button-appearance > esp-button {
55
+ --_esp-button-default-padding: var(--_esp-menu-button-default-padding);
55
56
  display: inline-block;
56
57
  inline-size: fit-content;
57
- max-inline-size: 100%;
58
+ max-inline-size: calc(100% - 2 * var(--_esp-menu-button-margin, 0px));
59
+ margin: var(--_esp-menu-button-margin, 0px);
58
60
  vertical-align: middle;
59
61
  font: inherit;
60
62
  }
@@ -76,7 +78,8 @@ var o=function(d,e,r,s){var p=arguments.length,n=p<3?e:s===null?s=Object.getOwnP
76
78
  .button-appearance.is-horizontal {
77
79
  display: flex;
78
80
  align-items: center;
79
- height: var(--esp-header-height, calc(4.5 * var(--esp-size-small)));
81
+ height: var(--_esp-menu-button-row-height, var(--esp-header-height, calc(4.5 * var(--esp-size-small))));
82
+ min-block-size: var(--_esp-menu-button-row-min-height, 0px);
80
83
  font-weight: var(--esp-menu-item-font-weight, var(--esp-font-weight-menu, 700));
81
84
  }
82
85
 
@@ -230,11 +233,11 @@ var o=function(d,e,r,s){var p=arguments.length,n=p<3?e:s===null?s=Object.getOwnP
230
233
 
231
234
  .is-horizontal.is-active:not(.button-appearance) {
232
235
  background-color: var(--esp-menu-item-active-background, transparent);
233
- box-shadow: inset 0 -2px 0
236
+ box-shadow: var(--_esp-menu-active-indicator-shadow, inset 0 -2px 0
234
237
  var(
235
238
  --esp-menu-item-active-indicator-color,
236
239
  var(--esp-menu-item-active-color, var(--esp-color-link))
237
- );
240
+ ));
238
241
  }
239
242
 
240
243
  @media (prefers-reduced-motion: reduce) {
@@ -273,4 +276,4 @@ var o=function(d,e,r,s){var p=arguments.length,n=p<3?e:s===null?s=Object.getOwnP
273
276
  width: var(--esp-menu-item-icon-size, calc(1 * var(--esp-size-font)));
274
277
  object-fit: contain;
275
278
  }
276
- `],o([a({type:String})],t.prototype,"label",void 0),o([a({type:String})],t.prototype,"url",void 0),o([a({type:String,reflect:!0})],t.prototype,"appearance",void 0),o([a({type:String})],t.prototype,"target",void 0),o([a({type:String})],t.prototype,"rel",void 0),o([a({type:String,attribute:"new-tab-label"})],t.prototype,"newTabLabel",void 0),o([a({type:String})],t.prototype,"icon",void 0),o([a({type:Boolean,attribute:"header-end",reflect:!0})],t.prototype,"headerEnd",void 0),o([u()],t.prototype,"promotedForHeader",void 0),o([a({attribute:!1,type:String})],t.prototype,"mode",void 0),o([a({attribute:!1,type:Number})],t.prototype,"depth",void 0),o([a({attribute:!1,type:Boolean})],t.prototype,"touchDevice",void 0),o([u()],t.prototype,"active",void 0),t=o([g("esp-menu-item")],t);export{t as EspalierMenuItem};
279
+ `],o([a({type:String})],t.prototype,"label",void 0),o([a({type:String})],t.prototype,"url",void 0),o([a({type:String,reflect:!0})],t.prototype,"appearance",void 0),o([a({type:String})],t.prototype,"target",void 0),o([a({type:String})],t.prototype,"rel",void 0),o([a({type:String,attribute:"new-tab-label"})],t.prototype,"newTabLabel",void 0),o([a({type:String})],t.prototype,"icon",void 0),o([a({type:Boolean,attribute:"header-end",reflect:!0})],t.prototype,"headerEnd",void 0),o([u()],t.prototype,"promotedForHeader",void 0),o([a({attribute:!1,type:String})],t.prototype,"mode",void 0),o([a({attribute:!1,type:Number})],t.prototype,"depth",void 0),o([a({attribute:!1,type:Boolean})],t.prototype,"touchDevice",void 0),o([u()],t.prototype,"active",void 0),t=o([f("esp-menu-item")],t);export{t as EspalierMenuItem};