@taprootio/espalier 6.9.0 → 6.10.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.
@@ -4,6 +4,32 @@ import { LitElement } from "lit";
4
4
  * [esp-breadcrumbs](/components/breadcrumbs/) to show breadcrumb
5
5
  * navigation.
6
6
  *
7
+ * A crumb with a `url` renders as a link. A crumb without one is the current
8
+ * page: it renders as italic text marked `aria-current="page"` and wraps onto
9
+ * further lines when it is longer than the trail.
10
+ *
11
+ * To give readers that run no JavaScript a real link, write a plain
12
+ * `<a slot="link">` inside a linked crumb, with the same `href` and label text:
13
+ *
14
+ * ```html
15
+ * <esp-breadcrumbs>
16
+ * <esp-breadcrumb label="Code" url="/code">
17
+ * <a slot="link" href="/code">Code</a>
18
+ * </esp-breadcrumb>
19
+ * <esp-breadcrumb label="This page"></esp-breadcrumb>
20
+ * </esp-breadcrumbs>
21
+ * ```
22
+ *
23
+ * @slot link - Optional plain `<a href>` copy of the crumb's link for HTML-only
24
+ * readers such as crawlers, link previews and readers without JavaScript. The
25
+ * crumb has no `<slot>` for it, so once the crumb upgrades the copy is never
26
+ * rendered, takes no focus and is hidden from assistive technology; the crumb
27
+ * renders only from `label` and `url`, so keep the copy equal to them. Until
28
+ * the crumb upgrades, the copy is an ordinary visible child. A page that shows
29
+ * content before components load and wants no flash can hide it, at the cost of
30
+ * those readers:
31
+ * `:not(:defined) > [slot="link"], :not(:defined) > [slot="brand-link"] { display: none; }`.
32
+ *
7
33
  * @cssprop --esp-breadcrumb-color - The text color of the breadcrumb link. Defaults to
8
34
  * `var(--esp-color-link)`, so a trail reads as navigation in the same ink as the links in
9
35
  * the surrounding content.
@@ -1,13 +1,26 @@
1
- var a=function(l,t,o,s){var i=arguments.length,e=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,o):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(l,t,o,s);else for(var p=l.length-1;p>=0;p--)(n=l[p])&&(e=(i<3?n(e):i>3?n(t,o,e):n(t,o))||e);return i>3&&e&&Object.defineProperty(t,o,e),e};import{LitElement as d,css as m,html as h}from"lit";import{customElement as u,property as c}from"lit/decorators.js";import{unsafeSVG as b}from"lit/directives/unsafe-svg.js";let r=class extends d{constructor(){super(...arguments),this.label="",this.url="",this.separator="",this.isLastElement=!1}_renderLink(){return this.url?h`<a href=${this.url}>${this.label}</a>`:h`<label>${this.label}</label>`}render(){return h`${this._renderLink()}${this.separator?b(this.separator):""}`}};r.styles=m`
1
+ var a=function(n,e,o,s){var i=arguments.length,r=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,o):s,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,e,o,s);else for(var p=n.length-1;p>=0;p--)(l=n[p])&&(r=(i<3?l(r):i>3?l(e,o,r):l(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r};import{LitElement as m,css as d,html as h}from"lit";import{customElement as u,property as c}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{unsafeSVG as v}from"lit/directives/unsafe-svg.js";let t=class extends m{constructor(){super(...arguments),this.label="",this.url="",this.separator="",this.isLastElement=!1}_renderLink(){return this.url?h`<a href=${this.url}>${this.label}</a>`:h`<span aria-current="page">${this.label}</span>`}render(){const e={crumb:!0,"is-current":!this.url};return h`<div class=${b(e)}>
2
+ ${this._renderLink()}${this.separator?v(this.separator):""}
3
+ </div>`}};t.styles=d`
4
+
2
5
  :host {
6
+ display: block;
7
+ min-width: 0;
8
+ }
9
+
10
+
11
+ .crumb {
3
12
  display: grid;
4
13
  grid-template-columns: min-content min-content;
5
14
  gap: var(--esp-size-tiny-to-small);
6
15
  align-items: center;
7
16
  }
8
17
 
18
+ .crumb.is-current {
19
+ grid-template-columns: minmax(0, auto) min-content;
20
+ }
21
+
9
22
 
10
- :is(a, label) {
23
+ :is(a, span[aria-current="page"]) {
11
24
  font-weight: bold;
12
25
  width: min-content;
13
26
  text-decoration: none;
@@ -26,12 +39,15 @@ var a=function(l,t,o,s){var i=arguments.length,e=i<3?t:s===null?s=Object.getOwnP
26
39
  }
27
40
 
28
41
 
29
- label {
42
+ span[aria-current="page"] {
30
43
  color: var(
31
44
  --esp-breadcrumb-current-color,
32
45
  var(--esp-breadcrumb-color, var(--esp-color-headings))
33
46
  );
34
47
  font-style: italic;
48
+ white-space: normal;
49
+ width: auto;
50
+ overflow-wrap: anywhere;
35
51
  }
36
52
 
37
53
 
@@ -43,4 +59,4 @@ var a=function(l,t,o,s){var i=arguments.length,e=i<3?t:s===null?s=Object.getOwnP
43
59
  height: var(--esp-size-normal-to-medium);
44
60
  width: var(--esp-size-normal-to-medium);
45
61
  }
46
- `,a([c({type:String})],r.prototype,"label",void 0),a([c({type:String})],r.prototype,"url",void 0),a([c({type:String})],r.prototype,"separator",void 0),a([c({attribute:"is-last-element",type:Boolean})],r.prototype,"isLastElement",void 0),r=a([u("esp-breadcrumb")],r);export{r as EspalierBreadcrumb};
62
+ `,a([c({type:String})],t.prototype,"label",void 0),a([c({type:String})],t.prototype,"url",void 0),a([c({type:String})],t.prototype,"separator",void 0),a([c({attribute:"is-last-element",type:Boolean})],t.prototype,"isLastElement",void 0),t=a([u("esp-breadcrumb")],t);export{t as EspalierBreadcrumb};
@@ -16,9 +16,14 @@ export * from "./esp-breadcrumb.js";
16
16
  * </esp-breadcrumbs>
17
17
  * ```
18
18
  *
19
+ * The trail is a `nav` landmark named `Breadcrumb`; set `aria-label` to
20
+ * rename it. A trail wider than its container wraps between crumbs, so do not
21
+ * wrap `esp-breadcrumbs` in a `nav` of your own.
22
+ *
19
23
  * Every crumb with a `url` is a link, including the last one — a trail
20
24
  * may end at the deepest folder rather than at the current page. Leave
21
- * `url` off a crumb to render it as the italic current-page label:
25
+ * `url` off a crumb to render it as the italic current-page label, which
26
+ * wraps onto further lines when it is longer than the trail:
22
27
  *
23
28
  * ```html
24
29
  * <esp-breadcrumbs>
@@ -27,6 +32,22 @@ export * from "./esp-breadcrumb.js";
27
32
  * </esp-breadcrumbs>
28
33
  * ```
29
34
  *
35
+ * To give readers that run no JavaScript real links, write a plain
36
+ * `<a slot="link">` inside each linked crumb, with the same `href` and label
37
+ * text. The copy is never rendered once the crumb upgrades:
38
+ *
39
+ * ```html
40
+ * <esp-breadcrumbs>
41
+ * <esp-breadcrumb label="Code" url="/code">
42
+ * <a slot="link" href="/code">Code</a>
43
+ * </esp-breadcrumb>
44
+ * <esp-breadcrumb label="Guides" url="/code/guides">
45
+ * <a slot="link" href="/code/guides">Guides</a>
46
+ * </esp-breadcrumb>
47
+ * <esp-breadcrumb label="This page"></esp-breadcrumb>
48
+ * </esp-breadcrumbs>
49
+ * ```
50
+ *
30
51
  * Custom separators can be specified in the `<esp-breadcrumb>`:
31
52
  *
32
53
  * ```html
@@ -77,6 +98,12 @@ export * from "./esp-breadcrumb.js";
77
98
  * @menuIcon directions
78
99
  */
79
100
  export declare class EspalierBreadcrumbs extends EspalierElementBase {
101
+ /**
102
+ * Accessible name of the breadcrumb navigation landmark. Defaults to
103
+ * `Breadcrumb`; set it to translate the name for a non-English site.
104
+ * Removing the attribute returns the name to `Breadcrumb`.
105
+ */
106
+ ariaLabel: string | null;
80
107
  protected firstUpdated(changedProperties: PropertyValues): void;
81
108
  protected render(): import("lit-html").TemplateResult<1>;
82
109
  static styles: import("lit").CSSResult[];
@@ -1,21 +1,22 @@
1
- var f=function(l,e,t,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(l,e,t,s);else for(var i=l.length-1;i>=0;i--)(a=l[i])&&(r=(o<3?a(r):o>3?a(e,t,r):a(e,t))||r);return o>3&&r&&Object.defineProperty(e,t,r),r};import{css as h,html as u}from"lit";import{customElement as v}from"lit/decorators.js";import{EspalierElementBase as m}from"../shared/esp-element-base.js";import{createRef as d,ref as g}from"lit/directives/ref.js";export*from"./esp-breadcrumb.js";const p=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
1
+ var p=function(o,e,t,r){var a=arguments.length,s=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,r);else for(var i=o.length-1;i>=0;i--)(n=o[i])&&(s=(a<3?n(s):a>3?n(e,t,s):n(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s};import{css as h,html as u}from"lit";import{customElement as v,property as d}from"lit/decorators.js";import{EspalierElementBase as m}from"../shared/esp-element-base.js";import{createRef as g,ref as w}from"lit/directives/ref.js";export*from"./esp-breadcrumb.js";const c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
2
2
  <path stroke="none" d="M0 0h24v24H0z" fill="none" />
3
3
  <path
4
4
  d="M12.089 3.634a2 2 0 0 0 -1.089 1.78l-.001 2.586h-6.999a2 2 0 0 0 -2 2v4l.005 .15a2 2 0 0 0 1.995 1.85l6.999 -.001l.001 2.587a2 2 0 0 0 3.414 1.414l6.586 -6.586a2 2 0 0 0 0 -2.828l-6.586 -6.586a2 2 0 0 0 -2.18 -.434l-.145 .068z" />
5
- </svg>`,c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
5
+ </svg>`,f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
6
6
  <path stroke="none" d="M0 0h24v24H0z" fill="none" />
7
7
  <path
8
8
  d="M10 2l-.15 .005a2 2 0 0 0 -1.85 1.995v6.999l-2.586 .001a2 2 0 0 0 -1.414 3.414l6.586 6.586a2 2 0 0 0 2.828 0l6.586 -6.586a2 2 0 0 0 .434 -2.18l-.068 -.145a2 2 0 0 0 -1.78 -1.089l-2.586 -.001v-6.999a2 2 0 0 0 -2 -2h-4z"
9
9
  />
10
- </svg>`;let n=class extends m{constructor(){super(...arguments),this.itemsSlot=d()}firstUpdated(e){if(super.firstUpdated(e),!this.itemsSlot.value){console.warn("No items slot found for breadcrumbs.");return}this.assignSeparators()}assignSeparators(){const e=this.itemsSlot.value?.assignedElements()??[];for(let t=0;t<e.length;t++){const s=e[t],o=t===e.length-1;s.isLastElement=o;const r=s.separator===p||s.separator===c;s.separator&&!r||(s.separator=o?c:p)}}render(){return u`
11
- <div class="crumbs">
12
- <slot ${g(this.itemsSlot)} @slotchange=${this.assignSeparators}></slot>
13
- </div>
14
- `}};n.styles=[...m.styles,h`
15
- div.crumbs {
10
+ </svg>`;let l=class extends m{constructor(){super(...arguments),this.itemsSlot=g(),this.ariaLabel=null}firstUpdated(e){if(super.firstUpdated(e),!this.itemsSlot.value){console.warn("No items slot found for breadcrumbs.");return}this.assignSeparators()}assignSeparators(){const e=this.itemsSlot.value?.assignedElements()??[];for(let t=0;t<e.length;t++){const r=e[t],a=t===e.length-1;r.isLastElement=a;const s=r.separator===c||r.separator===f;r.separator&&!s||(r.separator=a?f:c)}}render(){return u`
11
+ <nav aria-label=${this.ariaLabel??"Breadcrumb"}>
12
+ <slot ${w(this.itemsSlot)} @slotchange=${this.assignSeparators}></slot>
13
+ </nav>
14
+ `}};l.styles=[...m.styles,h`
15
+ nav {
16
16
  display: flex;
17
+ flex-wrap: wrap;
17
18
  align-items: center;
18
19
  gap: var(--esp-size-tiny-to-small);
19
20
  font-size: var(--esp-size-small-to-normal);
20
21
  }
21
- `],n=f([v("esp-breadcrumbs")],n);export{n as EspalierBreadcrumbs};
22
+ `],p([d({attribute:"aria-label",type:String})],l.prototype,"ariaLabel",void 0),l=p([v("esp-breadcrumbs")],l);export{l as EspalierBreadcrumbs};
@@ -142,6 +142,30 @@ export type FooterColumns = "auto" | "1" | "2" | "3" | "4" | "5" | "6";
142
142
  * preferably responsive `<picture>` markup or an `esp-image` with appropriate
143
143
  * alternative text.
144
144
  * @slot brand - Custom brand identity. Overrides configured brand properties.
145
+ * @slot brand-link - Optional plain `<a href>` copy of the configured brand link
146
+ * (`brand-href`) for HTML-only readers such as crawlers, link previews and
147
+ * readers without JavaScript. Give it the same `href` and the text the
148
+ * configured brand renders: the logo's alt text (`brand-alt`, nothing when
149
+ * there is `brand-text`, or "Site logo" when there is neither) followed by
150
+ * `brand-text`. The brand links only when it has a logo or text and
151
+ * `brand-href` is set. The copy carries no `target` or `rel`. Once the footer upgrades, the copy is never
152
+ * rendered, takes no focus and is hidden from assistive technology; the footer
153
+ * renders only from the `brand-*` attributes, so keep the copy equal to them.
154
+ * Filling the `brand` slot still replaces the configured brand. Until the
155
+ * footer upgrades, the copy is an ordinary visible child. A page that shows
156
+ * content before components load and wants no flash can hide it, at the cost of
157
+ * those readers:
158
+ * `:not(:defined) > [slot="link"], :not(:defined) > [slot="brand-link"] { display: none; }`.
159
+ *
160
+ * ```html
161
+ * <esp-footer brand-text="Taproot" brand-href="/">
162
+ * <a slot="brand-link" href="/">Taproot</a>
163
+ * <esp-footer-link-group heading="Product">
164
+ * <a href="/features">Features</a>
165
+ * </esp-footer-link-group>
166
+ * </esp-footer>
167
+ * ```
168
+ *
145
169
  * @slot - Bare `esp-footer-link-group` children for automatic flow, or
146
170
  * `esp-footer-column` children for creator-controlled group stacks.
147
171
  * @slot aside - Supporting content such as a newsletter, call to action,
@@ -63,6 +63,32 @@ export interface EspThemeToggleEventDetail {
63
63
  * </esp-header>
64
64
  * ```
65
65
  *
66
+ * @slot brand-link - Optional plain `<a href>` copy of the configured brand
67
+ * link (`brand-href`) for HTML-only readers such as crawlers, link previews and
68
+ * readers without JavaScript. Give it the same `href` and the text the
69
+ * configured brand renders: the logo's alt text (`brand-alt`, nothing when
70
+ * there is `brand-text`, or "Site logo" when there is neither) followed by
71
+ * `brand-text`. The brand links only when it has a logo or text and
72
+ * `brand-href` is set. The copy carries no `target` or `rel`. Once the header upgrades, the copy is never
73
+ * rendered, takes no focus and is hidden from assistive technology; the header
74
+ * renders only from the `brand-*` attributes, so keep the copy equal to them.
75
+ * Filling the `brand` slot still replaces the configured brand. Until the
76
+ * header upgrades, the copy is an ordinary visible child. A page that shows
77
+ * content before components load and wants no flash can hide it, at the cost of
78
+ * those readers:
79
+ * `:not(:defined) > [slot="link"], :not(:defined) > [slot="brand-link"] { display: none; }`.
80
+ *
81
+ * ```html
82
+ * <esp-header brand-text="Taproot" brand-href="/">
83
+ * <a slot="brand-link" href="/">Taproot</a>
84
+ * <esp-menu slot="menu" mode="horizontal">
85
+ * <esp-menu-item label="Docs" url="/docs">
86
+ * <a slot="link" href="/docs">Docs</a>
87
+ * </esp-menu-item>
88
+ * </esp-menu>
89
+ * </esp-header>
90
+ * ```
91
+ *
66
92
  * @slot menu - Place site navigation here. The `menu` slot
67
93
  * should be populated with an [`<esp-menu>`](/components/menu/)
68
94
  * containing [`<esp-menu-item>`](/components/menu/item/) children:
@@ -9,13 +9,33 @@ import type { EspalierMenuMode } from "./esp-menu.js";
9
9
  * accessible panel; inside that panel, deeper levels render as
10
10
  * vertical disclosure navigation.
11
11
  *
12
+ * To give readers that run no JavaScript a real link for a linked group,
13
+ * write a plain `<a slot="link">` beside the attributes, with the same
14
+ * `href`, `target`, `rel` and label text:
15
+ *
16
+ * ```html
17
+ * <esp-menu-group label="Guides" url="/guides" target="_blank" rel="noopener">
18
+ * <a slot="link" href="/guides" target="_blank" rel="noopener">Guides</a>
19
+ * <esp-menu-item label="Start here" url="/guides/start"></esp-menu-item>
20
+ * </esp-menu-group>
21
+ * ```
22
+ *
12
23
  * @customElement esp-menu-group
13
24
  * @slot - Menu items or nested menu groups.
14
25
  * @slot icon - Optional SVG or image icon for the group.
26
+ * @slot link - Optional plain `<a href>` copy of a linked group's link for
27
+ * HTML-only readers such as crawlers, link previews and readers without
28
+ * JavaScript. Once the group upgrades, the copy is never rendered, takes no
29
+ * focus and is hidden from assistive technology; the group renders only from
30
+ * `label`, `url`, `target` and `rel`, so keep the copy equal to them. Until the
31
+ * group upgrades, the copy is an ordinary visible child. A page that shows
32
+ * content before components load and wants no flash can hide it, at the cost of
33
+ * those readers:
34
+ * `:not(:defined) > [slot="link"], :not(:defined) > [slot="brand-link"] { display: none; }`.
15
35
  *
16
36
  * @event {CustomEvent<{ open: boolean }>} esp-menu-group-toggle - Fired when the group opens or closes.
17
37
  *
18
- * @cssprop --esp-menu-group-color - Text color of the group header.
38
+ * @cssprop --esp-menu-group-color - Text color of the group header. Defaults to `--esp-menu-item-color`, then `--esp-color-text`.
19
39
  * @cssprop --esp-menu-group-background - Background color of the group header.
20
40
  * @cssprop --esp-menu-group-hover-background - Hover background color of the group header.
21
41
  * @cssprop --esp-menu-group-indicator-color - Color of the expand/collapse indicator.
@@ -27,6 +47,7 @@ import type { EspalierMenuMode } from "./esp-menu.js";
27
47
  * @cssprop --esp-menu-group-icon-background - Background color of the icon rail.
28
48
  * @cssprop --esp-menu-group-icon-size - Size of generated and slotted group icons.
29
49
  * @cssprop --esp-menu-item-font-family - Font family of the group label, shared with menu items. Defaults to the theme's `--esp-font-menu`, then `--esp-font-body`.
50
+ * @cssprop --esp-menu-item-font-weight - Font weight of horizontal group labels, shared with menu items. Defaults to `--esp-font-weight-menu`, then `700`.
30
51
  * @docPageTitle Menu Group
31
52
  * @docUrl /components/menu/group
32
53
  * @menuGroup Navigation
@@ -1,4 +1,4 @@
1
- var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,i):a,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(l,e,i,a);else for(var c=l.length-1;c>=0;c--)(d=l[c])&&(s=(p<3?d(s):p>3?d(e,i,s):d(e,i))||s);return p>3&&s&&Object.defineProperty(e,i,s),s},u;import{css as b,html as n,nothing as h}from"lit";import{customElement as y,property as r,state as x}from"lit/decorators.js";import{classMap as w}from"lit/directives/class-map.js";import{createRef as f,ref as g}from"lit/directives/ref.js";import{EspalierElementBase as m}from"../shared/esp-element-base.js";import{ESP_EVENTS as k}from"../shared/events.js";import{getIconHrefForHost as z}from"../shared/intent-values.js";import{pathStartsWithSegment as v,pathsMatch as S}from"../shared/path-matching.js";import{SlottedIconController as L}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as $}from"../shared/svgs/render-sprite-icon.js";import{DEFAULT_NEW_TAB_LABEL as T,renderNewTabCue as E}from"../shared/new-tab-cue.js";import{srOnly as C}from"../shared/style-fragments.js";import{EspalierMenuItem as D}from"./esp-menu-item.js";let t=u=class extends m{constructor(){super(...arguments),this.itemsSlot=f(),this.toggleButton=f(),this.iconSlot=new L(this),this.openedByUrlPrefix=!1,this.dismissedUrlPrefix=!1,this.label="",this.url="",this.target="",this.rel="",this.newTabLabel=T,this.icon="",this.open=!1,this.mode="vertical",this.depth=0,this.touchDevice=!1,this.fullScreenPresentation=!1,this.active=!1,this.urlPrefix="",this.globalListenersActive=!1,this.handleDocumentClick=e=>{this.open&&(e.composedPath().includes(this)||this.setOpen(!1))},this.handleDocumentKeydown=e=>{!this.open||e.key!=="Escape"||(e.preventDefault(),this.setOpen(!1),this.toggleButton.value?.focus())}}connectedCallback(){super.connectedCallback(),this.checkActive()}disconnectedCallback(){super.disconnectedCallback(),this.removeGlobalDismissListeners()}firstUpdated(e){super.firstUpdated(e),this.propagateToChildren()}updated(e){super.updated(e),(e.has("mode")||e.has("depth")||e.has("touchDevice"))&&this.propagateToChildren(),(e.has("mode")||e.has("depth")||e.has("urlPrefix"))&&this.syncUrlPrefixExpansion(),e.has("url")&&this.checkActive(),e.has("open")&&!this.open&&(this.openedByUrlPrefix=!1),(e.has("open")||e.has("mode"))&&(this.open&&this.isHorizontalTopLevel?this.addGlobalDismissListeners():this.removeGlobalDismissListeners())}checkActive(){if(!this.url){this.active=!1;return}this.active=S(this.url)}get isHorizontalTopLevel(){return this.mode==="horizontal"&&this.depth===0}get childMode(){return this.mode==="horizontal"?"vertical":this.mode}syncUrlPrefixExpansion(){const e=v(location.pathname,this.urlPrefix);if(e||(this.dismissedUrlPrefix=!1),e&&!this.dismissedUrlPrefix&&!this.isHorizontalTopLevel){this.open||(this.open=!0,this.openedByUrlPrefix=!0);return}this.openedByUrlPrefix&&(this.open=!1,this.openedByUrlPrefix=!1)}getChildren(){return this.itemsSlot.value?Array.from(this.itemsSlot.value.assignedElements()):[]}propagateToChildren(){for(const e of this.getChildren())e instanceof D?(e.mode=this.childMode,e.depth=this.depth+1,e.touchDevice=this.touchDevice):e instanceof u&&(e.mode=this.childMode,e.depth=this.depth+1,e.touchDevice=this.touchDevice)}handleSlotChange(){this.propagateToChildren()}setOpen(e){this.open!==e&&(this.openedByUrlPrefix=!1,this.dismissedUrlPrefix=!e&&v(location.pathname,this.urlPrefix),this.open=e,this.dispatchEvent(new CustomEvent(k.MENU_GROUP_TOGGLE,{detail:{open:this.open},bubbles:!0,composed:!0})))}handleHeaderClick(){this.toggleOpen()}handleLinkClick(e){e.stopPropagation()}handleToggleClick(e){e.stopPropagation(),this.toggleOpen()}toggleOpen(){this.setOpen(!this.open)}handleToggleKeydown(e){e.key==="Escape"&&(e.preventDefault(),this.setOpen(!1),this.toggleButton.value?.focus())}addGlobalDismissListeners(){this.globalListenersActive||(document.addEventListener("click",this.handleDocumentClick,!0),document.addEventListener("keydown",this.handleDocumentKeydown),this.globalListenersActive=!0)}removeGlobalDismissListeners(){this.globalListenersActive&&(document.removeEventListener("click",this.handleDocumentClick,!0),document.removeEventListener("keydown",this.handleDocumentKeydown),this.globalListenersActive=!1)}renderIcon(){const e=z(this.icon,this),i=this.iconSlot.hasSlottedIcon();return n`
1
+ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,i):a,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(l,e,i,a);else for(var c=l.length-1;c>=0;c--)(d=l[c])&&(s=(p<3?d(s):p>3?d(e,i,s):d(e,i))||s);return p>3&&s&&Object.defineProperty(e,i,s),s},u;import{css as b,html as n,nothing as h}from"lit";import{customElement as y,property as r,state as w}from"lit/decorators.js";import{classMap as k}from"lit/directives/class-map.js";import{createRef as m,ref as g}from"lit/directives/ref.js";import{EspalierElementBase as f}from"../shared/esp-element-base.js";import{ESP_EVENTS as x}from"../shared/events.js";import{getIconHrefForHost as z}from"../shared/intent-values.js";import{pathStartsWithSegment as v,pathsMatch as S}from"../shared/path-matching.js";import{SlottedIconController as L}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 T}from"../shared/new-tab-cue.js";import{srOnly as C}from"../shared/style-fragments.js";import{EspalierMenuItem as D}from"./esp-menu-item.js";let t=u=class extends f{constructor(){super(...arguments),this.itemsSlot=m(),this.toggleButton=m(),this.iconSlot=new L(this),this.openedByUrlPrefix=!1,this.dismissedUrlPrefix=!1,this.label="",this.url="",this.target="",this.rel="",this.newTabLabel=E,this.icon="",this.open=!1,this.mode="vertical",this.depth=0,this.touchDevice=!1,this.fullScreenPresentation=!1,this.active=!1,this.urlPrefix="",this.globalListenersActive=!1,this.handleDocumentClick=e=>{this.open&&(e.composedPath().includes(this)||this.setOpen(!1))},this.handleDocumentKeydown=e=>{!this.open||e.key!=="Escape"||(e.preventDefault(),this.setOpen(!1),this.toggleButton.value?.focus())}}connectedCallback(){super.connectedCallback(),this.checkActive()}disconnectedCallback(){super.disconnectedCallback(),this.removeGlobalDismissListeners()}firstUpdated(e){super.firstUpdated(e),this.propagateToChildren()}updated(e){super.updated(e),(e.has("mode")||e.has("depth")||e.has("touchDevice"))&&this.propagateToChildren(),(e.has("mode")||e.has("depth")||e.has("urlPrefix"))&&this.syncUrlPrefixExpansion(),e.has("url")&&this.checkActive(),e.has("open")&&!this.open&&(this.openedByUrlPrefix=!1),(e.has("open")||e.has("mode"))&&(this.open&&this.isHorizontalTopLevel?this.addGlobalDismissListeners():this.removeGlobalDismissListeners())}checkActive(){if(!this.url){this.active=!1;return}this.active=S(this.url)}get isHorizontalTopLevel(){return this.mode==="horizontal"&&this.depth===0}get childMode(){return this.mode==="horizontal"?"vertical":this.mode}syncUrlPrefixExpansion(){const e=v(location.pathname,this.urlPrefix);if(e||(this.dismissedUrlPrefix=!1),e&&!this.dismissedUrlPrefix&&!this.isHorizontalTopLevel){this.open||(this.open=!0,this.openedByUrlPrefix=!0);return}this.openedByUrlPrefix&&(this.open=!1,this.openedByUrlPrefix=!1)}getChildren(){return this.itemsSlot.value?Array.from(this.itemsSlot.value.assignedElements()):[]}propagateToChildren(){for(const e of this.getChildren())e instanceof D?(e.mode=this.childMode,e.depth=this.depth+1,e.touchDevice=this.touchDevice):e instanceof u&&(e.mode=this.childMode,e.depth=this.depth+1,e.touchDevice=this.touchDevice)}handleSlotChange(){this.propagateToChildren()}setOpen(e){this.open!==e&&(this.openedByUrlPrefix=!1,this.dismissedUrlPrefix=!e&&v(location.pathname,this.urlPrefix),this.open=e,this.dispatchEvent(new CustomEvent(x.MENU_GROUP_TOGGLE,{detail:{open:this.open},bubbles:!0,composed:!0})))}handleHeaderClick(){this.toggleOpen()}handleLinkClick(e){e.stopPropagation()}handleToggleClick(e){e.stopPropagation(),this.toggleOpen()}toggleOpen(){this.setOpen(!this.open)}handleGroupKeydown(e){e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.setOpen(!1),this.toggleButton.value?.focus())}addGlobalDismissListeners(){this.globalListenersActive||(document.addEventListener("click",this.handleDocumentClick,!0),document.addEventListener("keydown",this.handleDocumentKeydown),this.globalListenersActive=!0)}removeGlobalDismissListeners(){this.globalListenersActive&&(document.removeEventListener("click",this.handleDocumentClick,!0),document.removeEventListener("keydown",this.handleDocumentKeydown),this.globalListenersActive=!1)}renderIcon(){const e=z(this.icon,this),i=this.iconSlot.hasSlottedIcon();return n`
2
2
  <slot
3
3
  name="icon"
4
4
  ${g(this.iconSlot.slotRef)}
@@ -10,8 +10,8 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
10
10
  class="group-toggle"
11
11
  type="button"
12
12
  aria-expanded=${this.open?"true":"false"}
13
+ aria-controls="group-items"
13
14
  @click=${this.handleToggleClick}
14
- @keydown=${this.handleToggleKeydown}
15
15
  >
16
16
  ${e}<span class="indicator" aria-hidden="true"></span>
17
17
  </button>`}render(){const e={group:!0,"is-horizontal":this.isHorizontalTopLevel,"is-vertical":!this.isHorizontalTopLevel,"is-nested":this.depth>0,"is-drawer":this.mode==="drawer","is-open":this.open,"is-active":this.active,"has-icon":this.icon.length>0||this.iconSlot.hasSlottedIcon()},i=n`<span class="group-label-text" part="menu-text">${this.label}</span>`,a=this.url?this.active?n`
@@ -24,16 +24,17 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
24
24
  target=${this.target||h}
25
25
  rel=${this.rel||h}
26
26
  @click=${this.handleLinkClick}
27
- >${i}${E(this.target,this.newTabLabel)}</a
27
+ >${i}${T(this.target,this.newTabLabel)}</a
28
28
  >
29
29
  ${this.renderToggle(n`<span class="sr-only">Toggle ${this.label}</span>`)}
30
30
  `:this.renderToggle(i);return n`
31
- <div class=${w(e)}>
31
+ <div class=${k(e)} @keydown=${this.handleGroupKeydown}>
32
32
  <div class="group-header" @click=${this.handleHeaderClick}>
33
33
  <span class="group-label">${a}</span>
34
34
  <span class="group-icon" aria-hidden="true">${this.renderIcon()}</span>
35
35
  </div>
36
36
  <div
37
+ id="group-items"
37
38
  class="group-items"
38
39
  ?hidden=${this.isHorizontalTopLevel&&!this.open}
39
40
  ?inert=${!this.open}
@@ -44,7 +45,7 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
44
45
  </div>
45
46
  </div>
46
47
  </div>
47
- `}};t.styles=[...m.styles,C,b`
48
+ `}};t.styles=[...f.styles,C,b`
48
49
  :host {
49
50
  display: block;
50
51
  position: relative;
@@ -56,7 +57,7 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
56
57
  display: grid;
57
58
  grid-template-columns: minmax(0, 1fr) min-content;
58
59
  align-items: stretch;
59
- color: var(--esp-menu-group-color, var(--esp-color-headings));
60
+ color: var(--esp-menu-group-color, var(--esp-menu-item-color, var(--esp-color-text)));
60
61
  background-color: var(--esp-menu-group-background, var(--esp-color-layer-1));
61
62
  border-right: 1px solid var(--esp-menu-group-border-color, var(--esp-color-border));
62
63
  border-bottom: 1px solid var(--esp-menu-group-border-color, var(--esp-color-border));
@@ -82,6 +83,8 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
82
83
  display: flex;
83
84
  width: 100%;
84
85
  min-width: 0;
86
+
87
+ min-height: 0;
85
88
  }
86
89
 
87
90
  .group-link,
@@ -108,12 +111,17 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
108
111
  )
109
112
  )
110
113
  );
111
- font-weight: 600;
112
114
  text-align: left;
113
115
  text-decoration: none;
114
116
  cursor: pointer;
115
117
  }
116
118
 
119
+ .is-horizontal .group-link,
120
+ .is-horizontal .current-page,
121
+ .is-horizontal .group-toggle {
122
+ font-weight: var(--esp-menu-item-font-weight, var(--esp-font-weight-menu, 700));
123
+ }
124
+
117
125
  .group-link,
118
126
  .current-page {
119
127
  flex: 0 1 auto;
@@ -122,7 +130,7 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
122
130
  background: none;
123
131
  }
124
132
 
125
- .current-page {
133
+ .is-active .current-page {
126
134
  color: var(--esp-menu-item-active-color, var(--esp-color-link));
127
135
  font-weight: var(--esp-menu-item-active-font-weight, var(--esp-font-weight-headings));
128
136
  }
@@ -150,6 +158,11 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
150
158
  position: relative;
151
159
  }
152
160
 
161
+ :host([full-screen-presentation]) .group-toggle:only-child .indicator {
162
+ position: absolute;
163
+ inset-inline-end: var(--esp-size-small);
164
+ }
165
+
153
166
  :host([full-screen-presentation]) .group-link,
154
167
  :host([full-screen-presentation]) .current-page {
155
168
  flex: 1 1 auto;
@@ -210,14 +223,19 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
210
223
  .indicator {
211
224
  display: inline-block;
212
225
  flex: 0 0 auto;
213
- width: 0;
214
- height: 0;
215
- border-top: 3.5px solid transparent;
216
- border-bottom: 3.5px solid transparent;
217
- border-left: 4.5px solid var(--esp-menu-group-indicator-color, var(--esp-color-headings));
226
+ width: 0.3em;
227
+ height: 0.45em;
228
+ background: var(--esp-menu-group-indicator-color, currentColor);
229
+ clip-path: polygon(0 0, 100% 50%, 0 100%);
218
230
  transition: transform 0.2s ease;
219
231
  }
220
232
 
233
+ @media (forced-colors: active) {
234
+ .indicator {
235
+ background: ButtonText;
236
+ }
237
+ }
238
+
221
239
  .is-open .indicator {
222
240
  transform: rotate(90deg);
223
241
  }
@@ -274,4 +292,4 @@ var o=function(l,e,i,a){var p=arguments.length,s=p<3?e:a===null?a=Object.getOwnP
274
292
  transition: none;
275
293
  }
276
294
  }
277
- `],o([r({type:String})],t.prototype,"label",void 0),o([r({type:String})],t.prototype,"url",void 0),o([r({type:String})],t.prototype,"target",void 0),o([r({type:String})],t.prototype,"rel",void 0),o([r({type:String,attribute:"new-tab-label"})],t.prototype,"newTabLabel",void 0),o([r({type:String})],t.prototype,"icon",void 0),o([r({type:Boolean,reflect:!0})],t.prototype,"open",void 0),o([r({attribute:!1,type:String})],t.prototype,"mode",void 0),o([r({attribute:!1,type:Number})],t.prototype,"depth",void 0),o([r({attribute:!1,type:Boolean})],t.prototype,"touchDevice",void 0),o([r({attribute:"full-screen-presentation",type:Boolean,reflect:!0})],t.prototype,"fullScreenPresentation",void 0),o([x()],t.prototype,"active",void 0),o([r({type:String,attribute:"url-prefix"})],t.prototype,"urlPrefix",void 0),t=u=o([y("esp-menu-group")],t);export{t as EspalierMenuGroup};
295
+ `],o([r({type:String})],t.prototype,"label",void 0),o([r({type:String})],t.prototype,"url",void 0),o([r({type:String})],t.prototype,"target",void 0),o([r({type:String})],t.prototype,"rel",void 0),o([r({type:String,attribute:"new-tab-label"})],t.prototype,"newTabLabel",void 0),o([r({type:String})],t.prototype,"icon",void 0),o([r({type:Boolean,reflect:!0})],t.prototype,"open",void 0),o([r({attribute:!1,type:String})],t.prototype,"mode",void 0),o([r({attribute:!1,type:Number})],t.prototype,"depth",void 0),o([r({attribute:!1,type:Boolean})],t.prototype,"touchDevice",void 0),o([r({attribute:"full-screen-presentation",type:Boolean,reflect:!0})],t.prototype,"fullScreenPresentation",void 0),o([w()],t.prototype,"active",void 0),o([r({type:String,attribute:"url-prefix"})],t.prototype,"urlPrefix",void 0),t=u=o([y("esp-menu-group")],t);export{t as EspalierMenuGroup};
@@ -7,9 +7,28 @@ import type { EspalierMenuMode } from "./esp-menu.js";
7
7
  * Items render as links when `url` is provided and as buttons when
8
8
  * no URL is present. Button-style items dispatch `esp-clicked`.
9
9
  *
10
+ * To give readers that run no JavaScript a real link, write a plain
11
+ * `<a slot="link">` beside the attributes, with the same `href`, `target`,
12
+ * `rel` and label text. A new-tab link adds its "(opens in a new tab)" cue
13
+ * to the rendered link only, so a copy may add its own hidden cue:
14
+ *
15
+ * ```html
16
+ * <esp-menu-item label="Docs" url="/docs" target="_blank" rel="noopener">
17
+ * <a slot="link" href="/docs" target="_blank" rel="noopener">Docs</a>
18
+ * </esp-menu-item>
19
+ * ```
20
+ *
10
21
  * @customElement esp-menu-item
11
22
  * @slot - Optional SVG or image icon. Slotted content overrides the
12
23
  * generated sprite icon from the `icon` attribute.
24
+ * @slot link - Optional plain `<a href>` copy of the item's link for HTML-only
25
+ * readers such as crawlers, link previews and readers without JavaScript. Once
26
+ * the item upgrades, the copy is never rendered, takes no focus and is hidden
27
+ * from assistive technology; the item renders only from `label`, `url`,
28
+ * `target` and `rel`, so keep the copy equal to them. Until the item upgrades,
29
+ * the copy is an ordinary visible child. A page that shows content before
30
+ * components load and wants no flash can hide it, at the cost of those readers:
31
+ * `:not(:defined) > [slot="link"], :not(:defined) > [slot="brand-link"] { display: none; }`.
13
32
  *
14
33
  * @event {CustomEvent} esp-clicked - Fired when the item is rendered as a button (no `url`) and activated.
15
34
  *
@@ -1,4 +1,4 @@
1
- var r=function(p,t,a,s){var c=arguments.length,o=c<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,a):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(p,t,a,s);else for(var h=p.length-1;h>=0;h--)(n=p[h])&&(o=(c<3?n(o):c>3?n(t,a,o):n(t,a))||o);return c>3&&o&&Object.defineProperty(t,a,o),o};import{css as m,html as l,nothing as d}from"lit";import{customElement as v,property as i,state as f}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{ref as g}from"lit/directives/ref.js";import{getIconHrefForHost as y}from"../shared/intent-values.js";import{EspalierElementBase as u}from"../shared/esp-element-base.js";import{ESP_EVENTS as k}from"../shared/events.js";import{pathsMatch as w}from"../shared/path-matching.js";import{SlottedIconController as z}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as x}from"../shared/svgs/render-sprite-icon.js";import{DEFAULT_NEW_TAB_LABEL as S,renderNewTabCue as $}from"../shared/new-tab-cue.js";import{srOnly as _}from"../shared/style-fragments.js";let e=class extends u{constructor(){super(...arguments),this.iconSlot=new z(this),this.label="",this.url="",this.target="",this.rel="",this.newTabLabel=S,this.icon="",this.mode="vertical",this.depth=0,this.touchDevice=!1,this.active=!1}connectedCallback(){super.connectedCallback(),this.checkActive()}updated(t){super.updated(t),t.has("url")&&this.checkActive()}checkActive(){if(!this.url){this.active=!1;return}this.active=w(this.url)}handleButtonClick(){this.dispatchEvent(new CustomEvent(k.CLICKED,{detail:{},bubbles:!0,composed:!0}))}render(){const t=y(this.icon,this),a=this.iconSlot.hasSlottedIcon(":scope > *"),s=a||t.length>0,c={item:!0,"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},o=l`<span part="menu-text">${this.label}</span>`,n=l`<span class="icon-area" aria-hidden=${s?"true":d}>
1
+ var r=function(p,t,a,s){var c=arguments.length,o=c<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,a):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(p,t,a,s);else for(var h=p.length-1;h>=0;h--)(n=p[h])&&(o=(c<3?n(o):c>3?n(t,a,o):n(t,a))||o);return c>3&&o&&Object.defineProperty(t,a,o),o};import{css as m,html as l,nothing as d}from"lit";import{customElement as v,property as i,state as f}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{ref as g}from"lit/directives/ref.js";import{getIconHrefForHost as y}from"../shared/intent-values.js";import{EspalierElementBase as u}from"../shared/esp-element-base.js";import{ESP_EVENTS as k}from"../shared/events.js";import{pathsMatch as w}from"../shared/path-matching.js";import{SlottedIconController as z}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as x}from"../shared/svgs/render-sprite-icon.js";import{DEFAULT_NEW_TAB_LABEL as S,renderNewTabCue as $}from"../shared/new-tab-cue.js";import{srOnly as _}from"../shared/style-fragments.js";let e=class extends u{constructor(){super(...arguments),this.iconSlot=new z(this),this.label="",this.url="",this.target="",this.rel="",this.newTabLabel=S,this.icon="",this.mode="vertical",this.depth=0,this.touchDevice=!1,this.active=!1}connectedCallback(){super.connectedCallback(),this.checkActive()}updated(t){super.updated(t),t.has("url")&&this.checkActive()}checkActive(){if(!this.url){this.active=!1;return}this.active=w(this.url)}handleButtonClick(){this.dispatchEvent(new CustomEvent(k.CLICKED,{detail:{},bubbles:!0,composed:!0}))}render(){const t=y(this.icon,this),a=this.iconSlot.hasSlottedIcon(":scope > :not([slot]), :scope > [slot='']"),s=a||t.length>0,c={item:!0,"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},o=l`<span part="menu-text">${this.label}</span>`,n=l`<span class="icon-area" aria-hidden=${s?"true":d}>
2
2
  <slot ${g(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
3
3
  ${!a&&t?x(t):d}
4
4
  </span>`;return l`<div class=${b(c)}>
@@ -0,0 +1 @@
1
+ const e=':is(esp-menu-item, esp-menu-group, esp-breadcrumb) > a[slot="link"], :is(esp-header, esp-footer) > a[slot="brand-link"]';export{e as LINK_COPY_SELECTOR};
@@ -1 +1 @@
1
- const c=['a[href]:not([disabled]):not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"]):not([disabled])'].join(", "),l="[autofocus]:not([disabled])";class o{static lock(t,e={}){const s=e.preserveScrollPosition===!0,n=o.owners.get(t);n===!0||n===s||(o.owners.size===0&&(o.snapshot={x:window.scrollX,y:window.scrollY,html:o.capture(document.documentElement,["overflow","overflow-x","overflow-y","overscroll-behavior","overscroll-behavior-x","overscroll-behavior-y"]),body:o.capture(document.body,["overflow","overflow-x","overflow-y","overscroll-behavior","overscroll-behavior-x","overscroll-behavior-y","position","top","left","width"])}),o.owners.set(t,s),o.applyCurrentTreatment())}static unlock(t){if(!(!o.owners.delete(t)||!o.snapshot)){if(o.owners.size===0){o.restoreSnapshot(),o.snapshot=null;return}o.applyCurrentTreatment()}}static capture(t,e){return e.map(s=>({name:s,value:t.style.getPropertyValue(s),priority:t.style.getPropertyPriority(s)}))}static restore(t,e){for(const{name:s}of e)t.style.removeProperty(s);for(const{name:s,value:n,priority:i}of e)n&&t.style.setProperty(s,n,i)}static applyCurrentTreatment(){const t=o.snapshot;if(!t)return;const e=[...o.owners.values()].some(Boolean);!e&&o.positionFrozen&&(o.restore(document.documentElement,t.html),o.restore(document.body,t.body),o.restoreViewport(t),o.positionFrozen=!1),document.body.style.overflow="hidden",e&&(o.positionFrozen||(t.x=window.scrollX,t.y=window.scrollY),document.documentElement.style.overflow="hidden",document.documentElement.style.overscrollBehavior="contain",document.body.style.overscrollBehavior="contain",document.body.style.position="fixed",document.body.style.top=`${-t.y}px`,document.body.style.left=`${-t.x}px`,document.body.style.width="100%",o.positionFrozen=!0)}static restoreSnapshot(){const t=o.snapshot;t&&(o.restore(document.documentElement,t.html),o.restore(document.body,t.body),o.positionFrozen&&o.restoreViewport(t),o.positionFrozen=!1)}static restoreViewport(t){window.scrollTo?.({top:t.y,left:t.x,behavior:"instant"})}static _reset(){o.restoreSnapshot(),o.owners.clear(),o.snapshot=null,o.positionFrozen=!1}}o.owners=new Map,o.snapshot=null,o.positionFrozen=!1;function f(){o._reset()}class r{static lock(t){const e=r._counts.get(t);return e!==void 0?(r._counts.set(t,e+1),!0):t.inert?!1:(r._counts.set(t,1),t.inert=!0,!0)}static unlock(t){const e=r._counts.get(t)??0;if(e<=0)return;const s=e-1;s===0?(t.inert=!1,r._counts.delete(t)):r._counts.set(t,s)}static _reset(){r._counts.clear()}}r._counts=new Map;function d(){r._reset()}class u{get isPromoting(){return this._promoting}constructor(t){this._isOpen=!1,this._previouslyFocused=null,this._inertElements=[],this._promoted=!1,this._pendingReactivation=!1,this._dropZone=null,this._promoting=!1,this._host=t.host,this._opts=t,t.host.addController(this)}static addOpenListener(t){u.openListeners.add(t)}static removeOpenListener(t){u.openListeners.delete(t)}redirectFocusRestore(t){this._isOpen&&(this._previouslyFocused=t)}get isOpen(){return this._isOpen}open(){if(!this._isOpen){this._pendingReactivation?this._pendingReactivation=!1:this._previouslyFocused=document.activeElement??null,this._isOpen=!0;for(const t of u.openListeners)t(this);o.lock(this,this._opts.scrollLock),this._opts.promote!==!1&&this._promoteToDropZone(),this._setInert(!0)}}close(){if(this._pendingReactivation=!1,!this._isOpen){this._previouslyFocused?.focus(),this._previouslyFocused=null;return}this._isOpen=!1,o.unlock(this),this._setInert(!1),this._previouslyFocused?.focus(),this._previouslyFocused=null}trapFocus(t){const e=this.getFocusableElements();if(e.length===0)return;const s=e[0],n=e[e.length-1],i=this._getDeepActiveElement();t.shiftKey?(i===s||this._isOrContains(s,i))&&(t.preventDefault(),n.focus()):(i===n||this._isOrContains(n,i))&&(t.preventDefault(),s.focus())}moveFocusInto(){const t=this._getAutofocusElement();if(t&&(t.focus(),this._autofocusLanded(t)))return;const e=this.getFocusableElements();if(e.length>0){e[0].focus();return}const s=this._opts.getFocusFallback?.();if(s){s.focus();return}this._opts.getFocusTrapContainer()?.focus()}_getAutofocusElement(){return this._getMatchingElements(l)[0]??null}getFocusableElements(){return this._getMatchingElements(c)}_getMatchingElements(t){if(t===c&&this._opts.getFocusScope)return this._opts.getFocusScope();const e=this._opts.getFocusTrapContainer();if(!e)return[];const s=[];for(const n of Array.from(e.querySelectorAll("*")))if(n instanceof HTMLElement){if(n.matches(t)&&s.push(n),n.shadowRoot){const i=n.shadowRoot.querySelectorAll(t);s.push(...Array.from(i))}if(n instanceof HTMLSlotElement)for(const i of n.assignedElements({flatten:!0})){if(!(i instanceof HTMLElement))continue;i.matches(t)&&s.push(i);const a=i.querySelectorAll(t);if(s.push(...Array.from(a)),i.shadowRoot){const h=i.shadowRoot.querySelectorAll(t);s.push(...Array.from(h))}}}for(const n of Array.from(this._host.children)){if(!(n instanceof HTMLElement))continue;n.matches(t)&&(s.includes(n)||s.push(n));const i=n.querySelectorAll(t);for(const a of Array.from(i))s.includes(a)||s.push(a);if(n.shadowRoot){const a=n.shadowRoot.querySelectorAll(t);for(const h of Array.from(a))s.includes(h)||s.push(h)}}return s}hostConnected(){}hostDisconnected(){this._promoting||this._isOpen&&(this._setInert(!1),o.unlock(this),this._isOpen=!1,this._pendingReactivation=!0)}_setInert(t){if(t){this._inertElements=[];const e=this._resolveInertAnchor(),s=e.parentElement??document.body;for(const n of s.children)n instanceof HTMLElement&&n!==e&&r.lock(n)&&this._inertElements.push(n)}else{for(const e of this._inertElements)r.unlock(e);this._inertElements=[]}}_resolveInertAnchor(){if(this._dropZone)return this._dropZone;const t=this._opts.getInertAnchor?.();if(t)return t;let e=this._host;for(;!e.parentElement;){const s=e.getRootNode();if(s instanceof ShadowRoot&&s.host instanceof HTMLElement)e=s.host;else break}return e}_getDeepActiveElement(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}_isOrContains(t,e){return e?t===e?!0:t.contains(e):!1}_autofocusLanded(t){const e=this._getActiveElementChain(),s=e[0];return e.some(n=>this._isOrContains(t,n)?!0:n!==s&&n instanceof HTMLElement&&this._isOrContains(n,t))}_getActiveElementChain(){const t=[];let e=document.activeElement;for(;e;){t.push(e);const s=e.shadowRoot?.activeElement??null;if(!s||s===e)break;e=s}return t}_promoteToDropZone(){if(this._promoted&&this._dropZone){this._promoting=!0;try{this._dropZone.appendChild(this._host)}finally{this._promoting=!1}return}const t=this._host,e=t.closest("esp-page");if(e){if(customElements.get("esp-page")){this._tryPromote(e);return}customElements.whenDefined("esp-page").then(()=>{if(!this._isOpen||!t.isConnected)return;const s=t.closest("esp-page");this._tryPromote(s)&&(this._setInert(!1),this._setInert(!0))})}}_tryPromote(t){if(!t||this._promoted)return!1;const e=t.AddDialog;if(typeof e=="function"){this._promoting=!0;try{e.call(t,this._host)}finally{this._promoting=!1}return this._promoted=!0,this._dropZone=this._host.parentElement,!0}return!1}}u.openListeners=new Set;export{c as FOCUSABLE_SELECTOR,u as OverlayController,o as ScrollLock,d as _resetInertLock,f as _resetScrollLock};
1
+ import{LINK_COPY_SELECTOR as l}from"./link-copy.js";const c=['a[href]:not([disabled]):not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"]):not([disabled])'].join(", "),f="[autofocus]:not([disabled])";class o{static lock(t,e={}){const s=e.preserveScrollPosition===!0,n=o.owners.get(t);n===!0||n===s||(o.owners.size===0&&(o.snapshot={x:window.scrollX,y:window.scrollY,html:o.capture(document.documentElement,["overflow","overflow-x","overflow-y","overscroll-behavior","overscroll-behavior-x","overscroll-behavior-y"]),body:o.capture(document.body,["overflow","overflow-x","overflow-y","overscroll-behavior","overscroll-behavior-x","overscroll-behavior-y","position","top","left","width"])}),o.owners.set(t,s),o.applyCurrentTreatment())}static unlock(t){if(!(!o.owners.delete(t)||!o.snapshot)){if(o.owners.size===0){o.restoreSnapshot(),o.snapshot=null;return}o.applyCurrentTreatment()}}static capture(t,e){return e.map(s=>({name:s,value:t.style.getPropertyValue(s),priority:t.style.getPropertyPriority(s)}))}static restore(t,e){for(const{name:s}of e)t.style.removeProperty(s);for(const{name:s,value:n,priority:i}of e)n&&t.style.setProperty(s,n,i)}static applyCurrentTreatment(){const t=o.snapshot;if(!t)return;const e=[...o.owners.values()].some(Boolean);!e&&o.positionFrozen&&(o.restore(document.documentElement,t.html),o.restore(document.body,t.body),o.restoreViewport(t),o.positionFrozen=!1),document.body.style.overflow="hidden",e&&(o.positionFrozen||(t.x=window.scrollX,t.y=window.scrollY),document.documentElement.style.overflow="hidden",document.documentElement.style.overscrollBehavior="contain",document.body.style.overscrollBehavior="contain",document.body.style.position="fixed",document.body.style.top=`${-t.y}px`,document.body.style.left=`${-t.x}px`,document.body.style.width="100%",o.positionFrozen=!0)}static restoreSnapshot(){const t=o.snapshot;t&&(o.restore(document.documentElement,t.html),o.restore(document.body,t.body),o.positionFrozen&&o.restoreViewport(t),o.positionFrozen=!1)}static restoreViewport(t){window.scrollTo?.({top:t.y,left:t.x,behavior:"instant"})}static _reset(){o.restoreSnapshot(),o.owners.clear(),o.snapshot=null,o.positionFrozen=!1}}o.owners=new Map,o.snapshot=null,o.positionFrozen=!1;function p(){o._reset()}class r{static lock(t){const e=r._counts.get(t);return e!==void 0?(r._counts.set(t,e+1),!0):t.inert?!1:(r._counts.set(t,1),t.inert=!0,!0)}static unlock(t){const e=r._counts.get(t)??0;if(e<=0)return;const s=e-1;s===0?(t.inert=!1,r._counts.delete(t)):r._counts.set(t,s)}static _reset(){r._counts.clear()}}r._counts=new Map;function m(){r._reset()}class u{get isPromoting(){return this._promoting}constructor(t){this._isOpen=!1,this._previouslyFocused=null,this._inertElements=[],this._promoted=!1,this._pendingReactivation=!1,this._dropZone=null,this._promoting=!1,this._host=t.host,this._opts=t,t.host.addController(this)}static addOpenListener(t){u.openListeners.add(t)}static removeOpenListener(t){u.openListeners.delete(t)}redirectFocusRestore(t){this._isOpen&&(this._previouslyFocused=t)}get isOpen(){return this._isOpen}open(){if(!this._isOpen){this._pendingReactivation?this._pendingReactivation=!1:this._previouslyFocused=document.activeElement??null,this._isOpen=!0;for(const t of u.openListeners)t(this);o.lock(this,this._opts.scrollLock),this._opts.promote!==!1&&this._promoteToDropZone(),this._setInert(!0)}}close(){if(this._pendingReactivation=!1,!this._isOpen){this._previouslyFocused?.focus(),this._previouslyFocused=null;return}this._isOpen=!1,o.unlock(this),this._setInert(!1),this._previouslyFocused?.focus(),this._previouslyFocused=null}trapFocus(t){const e=this.getFocusableElements();if(e.length===0)return;const s=e[0],n=e[e.length-1],i=this._getDeepActiveElement();t.shiftKey?(i===s||this._isOrContains(s,i))&&(t.preventDefault(),n.focus()):(i===n||this._isOrContains(n,i))&&(t.preventDefault(),s.focus())}moveFocusInto(){const t=this._getAutofocusElement();if(t&&(t.focus(),this._autofocusLanded(t)))return;const e=this.getFocusableElements();if(e.length>0){e[0].focus();return}const s=this._opts.getFocusFallback?.();if(s){s.focus();return}this._opts.getFocusTrapContainer()?.focus()}_getAutofocusElement(){return this._getMatchingElements(f)[0]??null}getFocusableElements(){return this._getMatchingElements(c)}_getMatchingElements(t){if(t===c&&this._opts.getFocusScope)return this._opts.getFocusScope();const e=this._opts.getFocusTrapContainer();if(!e)return[];const s=[];for(const n of Array.from(e.querySelectorAll("*")))if(n instanceof HTMLElement){if(n.matches(t)&&s.push(n),n.shadowRoot){const i=n.shadowRoot.querySelectorAll(t);s.push(...Array.from(i))}if(n instanceof HTMLSlotElement)for(const i of n.assignedElements({flatten:!0})){if(!(i instanceof HTMLElement))continue;i.matches(t)&&s.push(i);const a=i.querySelectorAll(t);if(s.push(...Array.from(a)),i.shadowRoot){const h=i.shadowRoot.querySelectorAll(t);s.push(...Array.from(h))}}}for(const n of Array.from(this._host.children)){if(!(n instanceof HTMLElement))continue;n.matches(t)&&(s.includes(n)||s.push(n));const i=n.querySelectorAll(t);for(const a of Array.from(i))s.includes(a)||s.push(a);if(n.shadowRoot){const a=n.shadowRoot.querySelectorAll(t);for(const h of Array.from(a))s.includes(h)||s.push(h)}}return s.filter(n=>!(n.matches(l)&&n.parentElement?.shadowRoot))}hostConnected(){}hostDisconnected(){this._promoting||this._isOpen&&(this._setInert(!1),o.unlock(this),this._isOpen=!1,this._pendingReactivation=!0)}_setInert(t){if(t){this._inertElements=[];const e=this._resolveInertAnchor(),s=e.parentElement??document.body;for(const n of s.children)n instanceof HTMLElement&&n!==e&&r.lock(n)&&this._inertElements.push(n)}else{for(const e of this._inertElements)r.unlock(e);this._inertElements=[]}}_resolveInertAnchor(){if(this._dropZone)return this._dropZone;const t=this._opts.getInertAnchor?.();if(t)return t;let e=this._host;for(;!e.parentElement;){const s=e.getRootNode();if(s instanceof ShadowRoot&&s.host instanceof HTMLElement)e=s.host;else break}return e}_getDeepActiveElement(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}_isOrContains(t,e){return e?t===e?!0:t.contains(e):!1}_autofocusLanded(t){const e=this._getActiveElementChain(),s=e[0];return e.some(n=>this._isOrContains(t,n)?!0:n!==s&&n instanceof HTMLElement&&this._isOrContains(n,t))}_getActiveElementChain(){const t=[];let e=document.activeElement;for(;e;){t.push(e);const s=e.shadowRoot?.activeElement??null;if(!s||s===e)break;e=s}return t}_promoteToDropZone(){if(this._promoted&&this._dropZone){this._promoting=!0;try{this._dropZone.appendChild(this._host)}finally{this._promoting=!1}return}const t=this._host,e=t.closest("esp-page");if(e){if(customElements.get("esp-page")){this._tryPromote(e);return}customElements.whenDefined("esp-page").then(()=>{if(!this._isOpen||!t.isConnected)return;const s=t.closest("esp-page");this._tryPromote(s)&&(this._setInert(!1),this._setInert(!0))})}}_tryPromote(t){if(!t||this._promoted)return!1;const e=t.AddDialog;if(typeof e=="function"){this._promoting=!0;try{e.call(t,this._host)}finally{this._promoting=!1}return this._promoted=!0,this._dropZone=this._host.parentElement,!0}return!1}}u.openListeners=new Set;export{c as FOCUSABLE_SELECTOR,u as OverlayController,o as ScrollLock,m as _resetInertLock,p as _resetScrollLock};
@@ -1271,7 +1271,7 @@
1271
1271
  },
1272
1272
  {
1273
1273
  "name": "--esp-menu-group-color",
1274
- "description": "Text color of the group header."
1274
+ "description": "Text color of the group header. Defaults to `--esp-menu-item-color`, then `--esp-color-text`."
1275
1275
  },
1276
1276
  {
1277
1277
  "name": "--esp-menu-group-hover-background",
@@ -1809,7 +1809,7 @@
1809
1809
  "name": "--esp-menu-group-color",
1810
1810
  "category": "component",
1811
1811
  "component": "esp-menu-group",
1812
- "description": "Text color of the group header."
1812
+ "description": "Text color of the group header. Defaults to `--esp-menu-item-color`, then `--esp-color-text`."
1813
1813
  },
1814
1814
  {
1815
1815
  "name": "--esp-menu-group-hover-background",
@@ -1922,7 +1922,7 @@
1922
1922
  {
1923
1923
  "name": "--esp-menu-item-font-weight",
1924
1924
  "category": "component",
1925
- "component": "esp-menu-item",
1925
+ "component": "esp-menu-group",
1926
1926
  "description": "Font weight of horizontal item labels. Defaults to `--esp-font-weight-menu`, then `700`."
1927
1927
  },
1928
1928
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taprootio/espalier",
3
- "version": "6.9.0",
3
+ "version": "6.10.0",
4
4
  "packageManager": "bun@1.3.12",
5
5
  "description": "Espalier — a themeable, accessible, framework-agnostic, enterprise-grade design system built on web standards and love.",
6
6
  "customElements": "custom-elements.json",