@taprootio/espalier 6.12.0 → 6.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,7 +52,7 @@ export type ButtonIconPosition = "left" | "right";
52
52
  * ```
53
53
  *
54
54
  * @customElement esp-button
55
- * @slot - Optional custom SVG icon. Slotted icons override the
55
+ * @slot - Optional custom SVG or image icon. Slotted icons override the
56
56
  * generated SVG from the `icon` attribute.
57
57
  *
58
58
  * ```html
@@ -75,6 +75,9 @@ export type ButtonIconPosition = "left" | "right";
75
75
  * </script>
76
76
  * ```
77
77
  *
78
+ * @csspart wrapper - The button chrome and outer layout.
79
+ * @csspart control - The native button, link, or noninteractive current-page span.
80
+ * @csspart label - The text label, excluding icons and new-tab cues.
78
81
  * @cssprop --esp-button-padding - The padding inside the button label and icon areas.
79
82
  * @cssprop --esp-button-incognito-padding - The padding for the incognito button style.
80
83
  * @attr incognito - Renders the button with a borderless, transparent treatment
@@ -170,6 +173,12 @@ export declare class EspalierButton extends EspalierElementBase {
170
173
  * @type {string}
171
174
  */
172
175
  href: string;
176
+ /**
177
+ * Marks a linked destination as the current page. With `href`, renders a
178
+ * noninteractive `span[aria-current="page"]` with button chrome. Loading,
179
+ * disabled and pressed states do not apply. Ignored when `href` is empty.
180
+ */
181
+ current: boolean;
173
182
  /**
174
183
  * If true, the button only displays the icon.
175
184
  *
@@ -1,4 +1,4 @@
1
- var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,s):i,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(h,t,s,i);else for(var c=h.length-1;c>=0;c--)(d=h[c])&&(n=(a<3?d(n):a>3?d(t,s,n):d(t,s))||n);return a>3&&n&&Object.defineProperty(t,s,n),n};import{css as g,html as p,nothing as l}from"lit";import{customElement as f,eventOptions as m,property as r,state as v}from"lit/decorators.js";import{classMap as u}from"lit/directives/class-map.js";import{EspalierElementBase as b}from"../shared/esp-element-base.js";import{ESP_EVENTS as y}from"../shared/events.js";import{ref as w}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 x}from"../shared/svgs/render-sprite-icon.js";import{DEFAULT_NEW_TAB_LABEL as S,newTabSuffix as $,renderNewTabCue as E}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 z=p`<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,41 +10,47 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=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 b{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.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=>this.loading?p` <span>${z}</span> `:p`
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 ${w(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
16
- ${!this.iconSlot.hasSlottedIcon(":scope > *")&&t?x(t):l}
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,s,i){if(super.attributeChangedCallback(t,s,i),t==="aria-pressed"){this.requestUpdate();return}if(t!=="tabindex"||this.neutralizingTabindex)return;const a=i===null?null:Number(i),n=a===null||Number.isNaN(a)?null:a;n!==null&&n>=0?(this.innerTabindex=n,this.writeHostTabindex(null)):n===null&&i!==null?(this.innerTabindex=null,this.writeHostTabindex(null)):this.innerTabindex=n}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(y.CLICKED,{detail:{},bubbles:!0,composed:!0})),this.buttonType==="submit"){const s=this.closest("form");if(s){const i=document.createElement("button");i.type="submit",i.hidden=!0,this.formNoValidate&&(i.formNoValidate=!0),s.appendChild(i),s.requestSubmit(i),i.remove()}}else this.buttonType==="reset"&&this.closest("form")?.reset()}render(){const t=T(this.icon,this),s=this.loading||this.iconSlot.hasSlottedIcon(":scope > *")||t.length>0,{collapsed:i,iconOnly:a}=this,n=a?this.getAttribute("aria-label")||this.label||l:l,d=this.getAttribute("aria-pressed")||l,c={"esp-field":!0,"icon-only":a,incognito:this.incognito,"is-collapsed":i,"has-icon":s,"icon-left":s&&!a&&this.iconPosition==="left"};return this.href.length?p`
19
- <div part="wrapper" class=${u(c)}>
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
+ <span part="control" class="current-page" aria-current="page" aria-label=${d}>
20
+ <span part="label">${this.label??""}</span>${this.buildIcon(t,!0)}
21
+ </span>
22
+ </div>`:this.href.length?c`
23
+ <div part="wrapper" class=${b(u)}>
20
24
  <a
25
+ part="control"
21
26
  ?disabled=${this.disabled}
22
27
  href=${this.href}
23
- target=${this.target||l}
24
- rel=${this.rel||l}
25
- tabindex=${this.innerTabindex??l}
26
- aria-label=${n===l?l:`${n}${$(this.target,this.newTabLabel)}`}
28
+ target=${this.target||s}
29
+ rel=${this.rel||s}
30
+ tabindex=${this.innerTabindex??s}
31
+ aria-label=${d===s?s:`${d}${C(this.target,this.newTabLabel)}`}
27
32
  >
28
- <span>${this.label??""}</span>
33
+ <span part="label">${this.label??""}</span>
29
34
  ${this.buildIcon(t)}
30
- ${a?l:E(this.target,this.newTabLabel)}
35
+ ${o?s:z(this.target,this.newTabLabel)}
31
36
  </a>
32
37
  </div>
33
- `:p`
34
- <div part="wrapper" class=${u(c)}>
38
+ `:c`
39
+ <div part="wrapper" class=${b(u)}>
35
40
  <button
41
+ part="control"
36
42
  ?disabled=${this.disabled||this.loading}
37
43
  @click=${this.handleClick}
38
44
  type=${this.buttonType}
39
- tabindex=${this.innerTabindex??l}
40
- aria-label=${n}
41
- aria-pressed=${d}
45
+ tabindex=${this.innerTabindex??s}
46
+ aria-label=${d}
47
+ aria-pressed=${p}
42
48
  >
43
- <span>${this.label??""}</span>
49
+ <span part="label">${this.label??""}</span>
44
50
  ${this.buildIcon(t)}
45
51
  </button>
46
52
  </div>
47
- `}};e.styles=[...b.styles,C,g`
53
+ `}};e.styles=[...f.styles,N,g`
48
54
  :host {
49
55
  --_esp-button-radius: var(--esp-size-border-radius);
50
56
  }
@@ -63,7 +69,8 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
63
69
  border-radius: var(--_esp-button-radius);
64
70
 
65
71
  button,
66
- a {
72
+ a,
73
+ .current-page {
67
74
  width: 100%;
68
75
  block-size: 100%;
69
76
  white-space: nowrap;
@@ -73,7 +80,7 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
73
80
  cursor: pointer;
74
81
 
75
82
  > span:nth-child(1) {
76
- padding: var(--esp-button-padding, var(--esp-size-padding));
83
+ padding: ${m};
77
84
  line-height: 1.3;
78
85
  font-weight: bold;
79
86
  display: flex;
@@ -84,20 +91,34 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
84
91
  > span:nth-child(2) {
85
92
  display: none;
86
93
  place-content: center;
87
- padding: var(--esp-button-padding, var(--esp-size-padding));
94
+ padding: ${m};
88
95
 
89
96
  .generated-icon,
90
97
  ::slotted(svg),
98
+ ::slotted(img),
91
99
  > svg {
92
100
  height: calc(1 * var(--esp-size-font));
93
101
  width: calc(1 * var(--esp-size-font));
102
+ object-fit: contain;
94
103
  }
95
104
  }
96
105
  }
97
106
 
107
+ .current-page {
108
+ box-sizing: border-box;
109
+ border: none;
110
+ background: transparent;
111
+ color: inherit;
112
+ font-family: inherit;
113
+ font-size: inherit;
114
+ text-decoration: none;
115
+ cursor: default;
116
+ }
117
+
98
118
  &.icon-left {
99
119
  button,
100
- a {
120
+ a,
121
+ .current-page {
101
122
  grid-template-columns: min-content auto;
102
123
 
103
124
  > span:nth-child(2) {
@@ -108,7 +129,8 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
108
129
 
109
130
  &.has-icon {
110
131
  button,
111
- a {
132
+ a,
133
+ .current-page {
112
134
  > span:nth-child(2) {
113
135
  display: grid;
114
136
  }
@@ -117,7 +139,8 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
117
139
 
118
140
  &:where(:not(.icon-left)) {
119
141
  button,
120
- a {
142
+ a,
143
+ .current-page {
121
144
  > span:nth-child(1) {
122
145
  padding-inline-end: 0;
123
146
  }
@@ -126,7 +149,8 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
126
149
 
127
150
  &.icon-left {
128
151
  button,
129
- a {
152
+ a,
153
+ .current-page {
130
154
  > span:nth-child(1) {
131
155
  padding-inline-start: 0;
132
156
  }
@@ -141,7 +165,8 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
141
165
 
142
166
  &.icon-only {
143
167
  button,
144
- a {
168
+ a,
169
+ .current-page {
145
170
  > span:nth-child(1) {
146
171
  display: none;
147
172
  }
@@ -159,7 +184,7 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
159
184
  &:hover,
160
185
  &:focus-within {
161
186
  background-color: oklch(
162
- from var(--esp-color-action-background) calc(l * ${N})
187
+ from var(--esp-color-action-background) calc(l * ${A})
163
188
  c h
164
189
  );
165
190
  }
@@ -171,7 +196,8 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
171
196
  block-size: 100%;
172
197
 
173
198
  button,
174
- a {
199
+ a,
200
+ .current-page {
175
201
  > span:nth-child(1) {
176
202
  justify-content: start;
177
203
  padding: var(--esp-button-incognito-padding, var(--esp-size-tiny)) 0;
@@ -187,7 +213,8 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
187
213
 
188
214
  &.icon-left {
189
215
  button,
190
- a {
216
+ a,
217
+ .current-page {
191
218
  > span:nth-child(1) {
192
219
  padding-inline-start: calc(
193
220
  2 * var(--esp-button-incognito-padding, var(--esp-size-tiny))
@@ -233,4 +260,4 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
233
260
  transform: rotate(360deg);
234
261
  }
235
262
  }
236
- `],o([v()],e.prototype,"innerTabindex",void 0),o([r({attribute:"button-type",type:String})],e.prototype,"buttonType",void 0),o([r({type:Boolean})],e.prototype,"collapsed",void 0),o([r({type:Boolean,reflect:!0})],e.prototype,"disabled",void 0),o([r({type:String})],e.prototype,"href",void 0),o([r({attribute:"icon-only",type:Boolean})],e.prototype,"iconOnly",void 0),o([r({type:Boolean,reflect:!0})],e.prototype,"incognito",void 0),o([r({type:String})],e.prototype,"icon",void 0),o([r({attribute:"icon-position",type:String})],e.prototype,"iconPosition",void 0),o([r({type:String})],e.prototype,"label",void 0),o([r({type:Boolean,reflect:!0})],e.prototype,"loading",void 0),o([r({type:String})],e.prototype,"target",void 0),o([r({type:String})],e.prototype,"rel",void 0),o([r({type:String,attribute:"new-tab-label"})],e.prototype,"newTabLabel",void 0),o([r({attribute:"formnovalidate",type:Boolean})],e.prototype,"formNoValidate",void 0),o([m({capture:!1,passive:!0})],e.prototype,"handleClick",null),e=o([f("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};
@@ -0,0 +1,52 @@
1
+ import { type PropertyValues } from "lit";
2
+ import { EspalierElementBase } from "../shared/esp-element-base.js";
3
+ import type { EspalierGap } from "../stack/esp-stack.js";
4
+ /** The first and second region's shares in a two-region layout. */
5
+ export type EspalierColumnsRatio = "equal" | "40-60" | "60-40";
6
+ /**
7
+ * Places two or three independent regions beside each other when each can
8
+ * remain at least 18rem wide. All regions stack together below that threshold.
9
+ * Requires an `esp-root` ancestor.
10
+ *
11
+ * ```html
12
+ * <esp-columns ratio="40-60" gap="medium">
13
+ * <div><h2>Visit us</h2><p>Find a class near you.</p></div>
14
+ * <div><h2>Book a class</h2><p>Your booking form goes here.</p></div>
15
+ * </esp-columns>
16
+ * ```
17
+ *
18
+ * Each rendered direct unnamed-slot element is one region. Elements with
19
+ * `hidden` or computed `display: none`, and script/style/template elements, do
20
+ * not count as regions. Visibility changes retain the original slot nodes.
21
+ * Three rendered regions support only the equal ratio. Other counts, unknown
22
+ * ratios, or non-whitespace direct text
23
+ * use a single stack, retaining all slot content. Regions keep their DOM and
24
+ * reading order; this element adds no landmark or form behavior. Sections and
25
+ * contexts continue to own backgrounds and content wells.
26
+ *
27
+ * @customElement esp-columns
28
+ * @slot - Two or three independent regions in reading order.
29
+ * @csspart columns - The grid containing the original regions.
30
+ * @cssprop --esp-columns-gap - Overrides the selected gap with a non-negative CSS length, including rem, em, calc() and clamp(). Percentage gaps are not supported. Defaults to the `gap` attribute's step, `normal` when unset.
31
+ * @docPageTitle Columns
32
+ * @docUrl /components/columns
33
+ * @menuGroup Structure
34
+ * @menuIcon layout
35
+ */
36
+ export declare class EspalierColumns extends EspalierElementBase {
37
+ /** Space-scale gap name. Unknown names use normal. @default "normal" */
38
+ gap: EspalierGap;
39
+ /** Equal regions, or two regions at 40/60 or 60/40. @default "equal" */
40
+ ratio: EspalierColumnsRatio;
41
+ connectedCallback(): void;
42
+ disconnectedCallback(): void;
43
+ protected firstUpdated(changedProperties: PropertyValues): void;
44
+ protected updated(changedProperties: PropertyValues): void;
45
+ protected render(): import("lit-html").TemplateResult<1>;
46
+ static styles: import("lit").CSSResult[];
47
+ }
48
+ declare global {
49
+ interface HTMLElementTagNameMap {
50
+ "esp-columns": EspalierColumns;
51
+ }
52
+ }
@@ -0,0 +1,45 @@
1
+ var m=function(u,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(u,e,t,i);else for(var o=u.length-1;o>=0;o--)(a=u[o])&&(r=(s<3?a(r):s>3?a(e,t,r):a(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r};import{css as x,html as C}from"lit";import{customElement as q,property as v,state as S}from"lit/decorators.js";import{EspalierElementBase as y}from"../shared/esp-element-base.js";import{layoutGapStyles as w}from"../shared/layout-gap.js";import{RafThrottle as L}from"../shared/raf-throttle.js";let l=class extends y{constructor(){super(...arguments),this.gap="normal",this.ratio="equal",this.layout="stack",this.observedRegions=new Set,this.updateLayout=new L(()=>this.measureLayout())}connectedCallback(){super.connectedCallback(),this.mutationObserver=new MutationObserver(e=>{e.some(t=>t.target===this||(t.type==="characterData"||t.type==="attributes")&&t.target.parentNode===this)&&this.updateLayout.schedule()}),this.mutationObserver.observe(this,{childList:!0,characterData:!0,subtree:!0}),this.hasUpdated&&this.observeGeometry()}disconnectedCallback(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.observedRegions.clear(),this.mutationObserver?.disconnect(),this.mutationObserver=void 0,this.updateLayout.cancel(),super.disconnectedCallback()}firstUpdated(e){super.firstUpdated(e),this.observeGeometry()}updated(e){super.updated(e),this.isConnected&&this.updateLayout.schedule()}observeGeometry(){if(this.isConnected){this.resizeObserver?.disconnect(),this.observedRegions.clear(),this.resizeObserver=new ResizeObserver(()=>this.updateLayout.schedule());for(const e of this.renderRoot.querySelectorAll(".esp-columns, .gap-probe, .minimum-probe"))this.resizeObserver.observe(e);this.updateLayout.schedule()}}syncRegionObservers(e){const t=new Set(e);let i=!1;for(const s of this.observedRegions)t.has(s)||(this.resizeObserver?.unobserve(s),this.observedRegions.delete(s),i=!0);for(const s of t)this.observedRegions.has(s)||(this.resizeObserver?.observe(s),this.observedRegions.add(s),i=!0);if(i){this.mutationObserver?.disconnect(),this.mutationObserver?.observe(this,{childList:!0,characterData:!0,subtree:!0});for(const s of t)this.mutationObserver?.observe(s,{attributes:!0,attributeFilter:["hidden","style","class"]})}}measureLayout(){if(!this.isConnected)return;const e=this.renderRoot.querySelector(".esp-columns"),t=this.renderRoot.querySelector(".gap-probe"),i=this.renderRoot.querySelector(".minimum-probe"),s=this.renderRoot.querySelector("slot");if(!e||!t||!i||!s)return;const r=s.assignedNodes(),a=r.filter(n=>n instanceof Element&&!["script","style","template"].includes(n.localName));this.syncRegionObservers(a);const o=a.filter(n=>!n.hasAttribute("hidden")&&getComputedStyle(n).display!=="none").length,g=!r.some(n=>n.nodeType===Node.TEXT_NODE&&n.textContent?.trim())&&(o===2||o===3)&&(this.ratio==="equal"||o===2&&(this.ratio==="40-60"||this.ratio==="60-40")),O=getComputedStyle(e).writingMode.startsWith("vertical"),d=n=>{const f=n.getBoundingClientRect();return O?f.height:f.width},c=d(e),p=d(t),h=d(i),z=[c,p,h].every(Number.isFinite)&&c>0&&p>=0&&h>0,R=this.ratio==="equal"?(c-(o-1)*p)/o:(c-p)*.4,b=g&&z&&R>=h?this.ratio==="equal"?o===3?"equal-3":"equal-2":this.ratio:"stack";b!==this.layout&&(this.layout=b)}render(){return C`
2
+ <div class="esp-columns" part="columns" data-layout=${this.layout}>
3
+ <slot @slotchange=${()=>this.updateLayout.schedule()}></slot>
4
+
5
+ <span class="size-probe gap-probe" aria-hidden="true"></span>
6
+ <span class="size-probe minimum-probe" aria-hidden="true"></span>
7
+ </div>
8
+ `}};l.styles=[...y.styles,w("--_esp-columns-gap"),x`
9
+ :host {
10
+ display: block;
11
+ min-inline-size: 0;
12
+ max-inline-size: 100%;
13
+ }
14
+
15
+ .esp-columns {
16
+ position: relative;
17
+ display: grid;
18
+ grid-template-columns: minmax(0, 1fr);
19
+ gap: var(--esp-columns-gap, var(--_esp-columns-gap));
20
+ min-inline-size: 0;
21
+ overflow-wrap: anywhere;
22
+ }
23
+
24
+ .esp-columns[data-layout="equal-2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
25
+ .esp-columns[data-layout="equal-3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
26
+ .esp-columns[data-layout="40-60"] { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
27
+ .esp-columns[data-layout="60-40"] { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
28
+
29
+ slot { display: contents; }
30
+ ::slotted(*) {
31
+ min-inline-size: 0;
32
+ max-inline-size: 100%;
33
+ }
34
+
35
+ .size-probe {
36
+ position: absolute;
37
+ visibility: hidden;
38
+ pointer-events: none;
39
+ inset-block-start: 0;
40
+ inset-inline-start: 0;
41
+ block-size: 0;
42
+ }
43
+ .gap-probe { inline-size: var(--esp-columns-gap, var(--_esp-columns-gap)); }
44
+ .minimum-probe { inline-size: 18rem; }
45
+ `],m([v({reflect:!0,useDefault:!0})],l.prototype,"gap",void 0),m([v({reflect:!0,useDefault:!0})],l.prototype,"ratio",void 0),m([S()],l.prototype,"layout",void 0),l=m([q("esp-columns")],l);export{l as EspalierColumns};
@@ -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};
@@ -7,11 +7,13 @@ declare const HEADER_BRAND_ALIGN_VALUES: readonly ["start", "center", "end"];
7
7
  declare const HEADER_BRAND_WRAP_VALUES: readonly ["truncate", "wrap", "nowrap"];
8
8
  declare const HEADER_MENU_DISPLAY_VALUES: readonly ["auto", "inline", "drawer"];
9
9
  declare const HEADER_THEME_TOGGLE_VALUES: readonly ["hidden", "visible"];
10
+ declare const HEADER_COMPACT_SIZE_VALUES: readonly ["compact", "standard"];
10
11
  export type HeaderLayout = (typeof HEADER_LAYOUT_VALUES)[number];
11
12
  export type HeaderBrandAlign = (typeof HEADER_BRAND_ALIGN_VALUES)[number];
12
13
  export type HeaderBrandWrap = (typeof HEADER_BRAND_WRAP_VALUES)[number];
13
14
  export type HeaderMenuDisplay = (typeof HEADER_MENU_DISPLAY_VALUES)[number];
14
15
  export type HeaderThemeToggle = (typeof HEADER_THEME_TOGGLE_VALUES)[number];
16
+ export type HeaderCompactSize = (typeof HEADER_COMPACT_SIZE_VALUES)[number];
15
17
  export interface EspThemeToggleEventDetail {
16
18
  scheme: "light" | "dark";
17
19
  }
@@ -19,6 +21,24 @@ export interface EspThemeToggleEventDetail {
19
21
  * Builds a site's top navigation bar. Use its four slots to add content:
20
22
  * `topbar`, `brand`, `menu`, and `buttons`.
21
23
  *
24
+ * `height-multiplier="1.8"` enlarges the primary row and logo while preserving
25
+ * control and extra-row sizes. In a fixed `esp-page`, `compact-size="standard"`
26
+ * with `scroll-behavior="compact"` returns to the unscaled baseline. Sticky,
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.
33
+ * Optional generic/light/dark compact logos fall back to the regular logo until
34
+ * ready; the larger expanded/compact brand width is reserved in either state.
35
+ * `data-esp-compact` reports resolved compaction for paint-only styling and
36
+ * inspection. Hook-keyed layout or typography changes are unsupported. Override
37
+ * the height/logo inputs instead. Compaction holds while header keyboard focus
38
+ * or a header drawer/popover is open. The [`<esp-page>`](/components/page/)
39
+ * readiness method waits for initial geometry. Scope light-DOM anchor clearance
40
+ * to `--esp-page-header-expanded-size`, capped by the usable viewport height.
41
+ *
22
42
  * A field fills one layer above the surface it sits on.
23
43
  * Use `surface-layer="1|2|3|4"` to select the default painted layer.
24
44
  *
@@ -214,6 +234,7 @@ export interface EspThemeToggleEventDetail {
214
234
  *
215
235
  * @event {CustomEvent<EspThemeToggleEventDetail>} esp-header-theme-toggle - Fired after the built-in theme toggle changes the nearest `esp-root`. Bubbles and crosses the shadow boundary.
216
236
  *
237
+ * @attr data-esp-compact - Read-only resolved compaction hook for paint-only styling and inspection. Authored values do not control state; hook-keyed layout changes are unsupported.
217
238
  * @cssprop --esp-header-background - The background color of the header bar. Defaults to `var(--esp-color-layer-2)`.
218
239
  * @cssprop --esp-header-border-width - The border width of the header. Defaults to `0 0 1px 0`.
219
240
  * @cssprop --esp-header-border - The border style of the header. Defaults to `solid var(--esp-color-border)`.
@@ -237,6 +258,7 @@ export interface EspThemeToggleEventDetail {
237
258
  * @cssprop --esp-header-brand-gap - Space between a configured logo and brand text. Defaults to `var(--esp-size-tiny-to-small)`.
238
259
  * @cssprop --esp-header-brand-logo-size - The configured logo block size. Defaults to `calc(0.72 * var(--esp-header-height, calc(4.5 * var(--esp-size-small))))`.
239
260
  * @cssprop --esp-header-brand-logo-max-width - The configured logo maximum inline size. Defaults to `12rem`.
261
+ * @cssprop --esp-header-compact-brand-logo-aspect-ratio - Reserved ratio for a pending compact logo. Defaults to `var(--esp-header-brand-logo-aspect-ratio, 3 / 1)`.
240
262
  * @cssprop --esp-header-brand-logo-aspect-ratio - The ratio the configured logo's box is reserved at while the image is still loading or has failed, so alt text never decides the brand region's width. A logo that loads is always laid out at its own ratio, whatever this is set to. Defaults to `3 / 1`.
241
263
  * @cssprop --esp-header-brand-max-width - The maximum inline size of configured brand content. Defaults to `min(36ch, 45vw)`.
242
264
  * @cssprop --esp-header-brand-hover-color - The configured brand hover color. Defaults to `var(--esp-color-headings-hover)`.
@@ -345,6 +367,24 @@ export declare class EspalierHeader extends EspalierElementBase {
345
367
  * overrides `brand-logo`; an empty value falls back to it.
346
368
  */
347
369
  darkBrandLogo: string;
370
+ /** Compact logo URL; unresolved or failed images retain the regular logo. */
371
+ compactBrandLogo: string;
372
+ /** Compact logo for light scheme; falls back to generic, then dark compact. */
373
+ lightCompactBrandLogo: string;
374
+ /** Compact logo for dark scheme; falls back to generic, then light compact. */
375
+ darkCompactBrandLogo: string;
376
+ /**
377
+ * Scale the primary row from 1.0 to 5.0 in tenths. Controls and extra rows
378
+ * retain their baseline sizes. Invalid values normalize to 1.0.
379
+ * @default 1
380
+ */
381
+ heightMultiplier: number;
382
+ /**
383
+ * `standard` compacts to the unscaled baseline; `compact` retains the legacy
384
+ * absolute compact-height token. New geometry compacts only in a fixed esp-page.
385
+ * @default "compact"
386
+ */
387
+ compactSize: HeaderCompactSize;
348
388
  /**
349
389
  * Optional brand link used by configured logo/text branding.
350
390
  */