@taprootio/espalier 6.12.0 → 6.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/css/esp-reset.css +17 -0
- package/custom-elements.json +3013 -856
- package/dist/button/esp-button.d.ts +10 -1
- package/dist/button/esp-button.js +55 -28
- package/dist/columns/esp-columns.d.ts +52 -0
- package/dist/columns/esp-columns.js +45 -0
- package/dist/header/esp-header.d.ts +35 -0
- package/dist/header/esp-header.js +175 -46
- package/dist/header/header-geometry-controller.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/menu/esp-menu-item.d.ts +16 -1
- package/dist/menu/esp-menu-item.js +74 -15
- package/dist/menu/esp-menu.js +1 -1
- package/dist/menu/menu-presentation.d.ts +1 -0
- package/dist/menu/menu-presentation.js +15 -14
- package/dist/menu/swipe-reveal-controller.js +1 -1
- package/dist/page/bi-directional-sticky-controller.js +1 -1
- package/dist/page/esp-page.d.ts +10 -2
- package/dist/page/esp-page.js +37 -35
- package/dist/page/esp-page.styles.js +36 -0
- package/dist/row/esp-row.js +3 -26
- package/dist/shared/configured-brand.d.ts +3 -1
- package/dist/shared/configured-brand.js +5 -5
- package/dist/shared/layout-gap.js +5 -0
- package/dist/stack/esp-stack.js +3 -26
- package/espalier.css-data.json +17 -1
- package/espalier.token-manifest.json +25 -1
- package/package.json +5 -1
|
@@ -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
|
|
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
|
|
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
|
|
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`
|
|
14
14
|
<span>
|
|
15
|
-
<slot ${
|
|
16
|
-
${!this.iconSlot.hasSlottedIcon(":scope >
|
|
15
|
+
<slot ${x(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
|
|
16
|
+
${!this.iconSlot.hasSlottedIcon(":scope > :not(slot)")&&t?$(t):s}
|
|
17
17
|
</span>
|
|
18
|
-
`}static get observedAttributes(){return[...super.observedAttributes,"tabindex","aria-pressed"]}attributeChangedCallback(t,
|
|
19
|
-
|
|
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)}>
|
|
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||
|
|
24
|
-
rel=${this.rel||
|
|
25
|
-
tabindex=${this.innerTabindex??
|
|
26
|
-
aria-label=${
|
|
28
|
+
target=${this.target||s}
|
|
29
|
+
rel=${this.rel||s}
|
|
30
|
+
tabindex=${this.innerTabindex??s}
|
|
31
|
+
aria-label=${d===s?s:`${d}${E(this.target,this.newTabLabel)}`}
|
|
27
32
|
>
|
|
28
|
-
<span>${this.label??""}</span>
|
|
33
|
+
<span part="label">${this.label??""}</span>
|
|
29
34
|
${this.buildIcon(t)}
|
|
30
|
-
${
|
|
35
|
+
${o?s:z(this.target,this.newTabLabel)}
|
|
31
36
|
</a>
|
|
32
37
|
</div>
|
|
33
|
-
`:
|
|
34
|
-
<div part="wrapper" class=${u
|
|
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??
|
|
40
|
-
aria-label=${
|
|
41
|
-
aria-pressed=${
|
|
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=[...
|
|
53
|
+
`}};e.styles=[...g.styles,C,f`
|
|
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;
|
|
@@ -88,16 +95,30 @@ var o=function(h,t,s,i){var a=arguments.length,n=a<3?t:i===null?i=Object.getOwnP
|
|
|
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
|
}
|
|
@@ -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
|
-
`],
|
|
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};
|
|
@@ -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};
|
|
@@ -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,19 @@ 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
|
+
* Optional generic/light/dark compact logos fall back to the regular logo until
|
|
29
|
+
* ready; the larger expanded/compact brand width is reserved in either state.
|
|
30
|
+
* `data-esp-compact` reports resolved compaction for paint-only styling and
|
|
31
|
+
* inspection. Hook-keyed layout or typography changes are unsupported. Override
|
|
32
|
+
* the height/logo inputs instead. Compaction holds while header keyboard focus
|
|
33
|
+
* or a header drawer/popover is open. The [`<esp-page>`](/components/page/)
|
|
34
|
+
* readiness method waits for initial geometry. Scope light-DOM anchor clearance
|
|
35
|
+
* to `--esp-page-header-expanded-size`, capped by the usable viewport height.
|
|
36
|
+
*
|
|
22
37
|
* A field fills one layer above the surface it sits on.
|
|
23
38
|
* Use `surface-layer="1|2|3|4"` to select the default painted layer.
|
|
24
39
|
*
|
|
@@ -214,6 +229,7 @@ export interface EspThemeToggleEventDetail {
|
|
|
214
229
|
*
|
|
215
230
|
* @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
231
|
*
|
|
232
|
+
* @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
233
|
* @cssprop --esp-header-background - The background color of the header bar. Defaults to `var(--esp-color-layer-2)`.
|
|
218
234
|
* @cssprop --esp-header-border-width - The border width of the header. Defaults to `0 0 1px 0`.
|
|
219
235
|
* @cssprop --esp-header-border - The border style of the header. Defaults to `solid var(--esp-color-border)`.
|
|
@@ -237,6 +253,7 @@ export interface EspThemeToggleEventDetail {
|
|
|
237
253
|
* @cssprop --esp-header-brand-gap - Space between a configured logo and brand text. Defaults to `var(--esp-size-tiny-to-small)`.
|
|
238
254
|
* @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
255
|
* @cssprop --esp-header-brand-logo-max-width - The configured logo maximum inline size. Defaults to `12rem`.
|
|
256
|
+
* @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
257
|
* @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
258
|
* @cssprop --esp-header-brand-max-width - The maximum inline size of configured brand content. Defaults to `min(36ch, 45vw)`.
|
|
242
259
|
* @cssprop --esp-header-brand-hover-color - The configured brand hover color. Defaults to `var(--esp-color-headings-hover)`.
|
|
@@ -345,6 +362,24 @@ export declare class EspalierHeader extends EspalierElementBase {
|
|
|
345
362
|
* overrides `brand-logo`; an empty value falls back to it.
|
|
346
363
|
*/
|
|
347
364
|
darkBrandLogo: string;
|
|
365
|
+
/** Compact logo URL; unresolved or failed images retain the regular logo. */
|
|
366
|
+
compactBrandLogo: string;
|
|
367
|
+
/** Compact logo for light scheme; falls back to generic, then dark compact. */
|
|
368
|
+
lightCompactBrandLogo: string;
|
|
369
|
+
/** Compact logo for dark scheme; falls back to generic, then light compact. */
|
|
370
|
+
darkCompactBrandLogo: string;
|
|
371
|
+
/**
|
|
372
|
+
* Scale the primary row from 1.0 to 5.0 in tenths. Controls and extra rows
|
|
373
|
+
* retain their baseline sizes. Invalid values normalize to 1.0.
|
|
374
|
+
* @default 1
|
|
375
|
+
*/
|
|
376
|
+
heightMultiplier: number;
|
|
377
|
+
/**
|
|
378
|
+
* `standard` compacts to the unscaled baseline; `compact` retains the legacy
|
|
379
|
+
* absolute compact-height token. New geometry compacts only in a fixed esp-page.
|
|
380
|
+
* @default "compact"
|
|
381
|
+
*/
|
|
382
|
+
compactSize: HeaderCompactSize;
|
|
348
383
|
/**
|
|
349
384
|
* Optional brand link used by configured logo/text branding.
|
|
350
385
|
*/
|