@taprootio/espalier 7.3.0 → 7.6.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/custom-elements.json +323 -15
  3. package/dist/badge/esp-badge.d.ts +39 -0
  4. package/dist/badge/esp-badge.js +35 -6
  5. package/dist/box/esp-box.d.ts +4 -2
  6. package/dist/box/esp-box.js +6 -6
  7. package/dist/breadcrumbs/esp-breadcrumb.d.ts +1 -0
  8. package/dist/breadcrumbs/esp-breadcrumb.js +11 -3
  9. package/dist/breadcrumbs/esp-breadcrumbs.js +6 -6
  10. package/dist/button/esp-button-group.js +8 -3
  11. package/dist/button/esp-button.d.ts +3 -0
  12. package/dist/button/esp-button.js +47 -13
  13. package/dist/cli/theme-check.js +2 -2
  14. package/dist/footer/esp-footer-link-group.js +11 -8
  15. package/dist/footer/esp-footer.d.ts +5 -3
  16. package/dist/footer/esp-footer.js +25 -10
  17. package/dist/footer/paint-registration.js +1 -1
  18. package/dist/menu/paint-registration.js +1 -1
  19. package/dist/root/esp-root.d.ts +13 -0
  20. package/dist/root/esp-root.js +69 -10
  21. package/dist/root/helpers/compute-semantic-properties.js +1 -1
  22. package/dist/root/helpers/compute-theme-properties.js +1 -1
  23. package/dist/section/esp-section.d.ts +5 -4
  24. package/dist/section/esp-section.js +1 -1
  25. package/dist/shared/blockquote-styles.d.ts +5 -1
  26. package/dist/shared/blockquote-styles.js +8 -4
  27. package/dist/shared/color-engine.js +1 -1
  28. package/dist/shared/component-property-compiler.js +1 -1
  29. package/dist/shared/component-property-diagnostics.js +1 -1
  30. package/dist/shared/component-property-normalizer.js +1 -1
  31. package/dist/shared/esp-element-base.js +2 -2
  32. package/dist/shared/footer-ink-styles.js +18 -0
  33. package/dist/shared/footer-ink.js +1 -0
  34. package/dist/shared/paint-catalog.js +1 -1
  35. package/dist/shared/paint-fit.js +1 -1
  36. package/dist/shared/paint-types.d.ts +9 -0
  37. package/dist/shared/public-token-catalog.generated.js +1 -1
  38. package/dist/shared/scale-engine.js +1 -1
  39. package/dist/shared/semantic-color-names.js +1 -1
  40. package/dist/shared/settable-component-properties.js +1 -1
  41. package/dist/shared/theme-fit-report.d.ts +6 -4
  42. package/dist/shared/theme-fit-report.js +1 -1
  43. package/dist/testing/observe-paint.iife.js +2 -2
  44. package/dist/testing/observe-paint.js +3 -3
  45. package/espalier.css-data.json +139 -7
  46. package/espalier.token-manifest.json +1038 -62
  47. package/package.json +1 -1
@@ -9,6 +9,16 @@ export type EspalierBadgeSize = "small" | "medium";
9
9
  * constrains them. Leave enough inline space for critical status text
10
10
  * that must remain fully visible.
11
11
  *
12
+ * Put a badge inside an anchor and set `linked` for link styling. A
13
+ * small chain mark identifies the link without relying on color. In the
14
+ * light DOM under `esp-root`, add `data-esp-badge-link` to an anchor that
15
+ * contains only the badge to put the interaction paint and focus ring on it.
16
+ * The anchor owns navigation and keyboard focus.
17
+ *
18
+ * ```html
19
+ * <a href="#badge" data-esp-badge-link><esp-badge linked>Soups</esp-badge></a>
20
+ * ```
21
+ *
12
22
  * ```html
13
23
  * <div style="display: flex; flex-wrap: wrap; gap: var(--esp-size-tiny);">
14
24
  * <esp-badge>Draft</esp-badge>
@@ -28,6 +38,33 @@ export type EspalierBadgeSize = "small" | "medium";
28
38
  * @cssprop --esp-badge-color - Text color of a neutral badge. Defaults to
29
39
  * `var(--esp-color-text)`. The theme fits it against the neutral badge
30
40
  * background at APCA Lc 75 when either property is set in the theme.
41
+ * @cssprop --esp-badge-link-background - Resting fill of a linked badge.
42
+ * Defaults to `var(--esp-color-background)`.
43
+ * @cssprop --esp-badge-link-border-color - Resting border of a linked badge.
44
+ * Defaults to `var(--esp-color-link)`.
45
+ * @cssprop --esp-badge-link-color - Resting ink of a linked badge.
46
+ * Defaults to `var(--esp-color-link)`. The theme fits this ink against
47
+ * the resting fill at APCA Lc 75 when either property is set.
48
+ * @cssprop --esp-badge-link-hover-background - Hover fill of a linked badge.
49
+ * Defaults to `var(--esp-color-link-hover-bg)`.
50
+ * @cssprop --esp-badge-link-hover-border-color - Hover border of a linked badge.
51
+ * Defaults to `var(--esp-color-link-hover)`.
52
+ * @cssprop --esp-badge-link-hover-color - Hover ink of a linked badge.
53
+ * Defaults to `var(--esp-color-link-hover)`. The theme fits this ink
54
+ * against the hover fill at APCA Lc 75 when either property is set.
55
+ * @cssprop --esp-badge-link-focus-background - Focus fill of a linked badge.
56
+ * Defaults to `var(--esp-color-link-hover-bg)`.
57
+ * @cssprop --esp-badge-link-focus-border-color - Focus border of a linked badge.
58
+ * Defaults to `var(--esp-color-link-hover)`.
59
+ * @cssprop --esp-badge-link-focus-color - Keyboard focus ink of a linked badge
60
+ * inside the light DOM of `esp-root`.
61
+ * Defaults to `var(--esp-color-link-hover)`.
62
+ * The theme fits this ink against the focus fill at APCA Lc 75 when either
63
+ * property is set.
64
+ * @cssprop --esp-badge-link-focus-ring-color - Color of the outer keyboard
65
+ * focus ring on a badge inside a light-DOM anchor marked `data-esp-badge-link`.
66
+ * Defaults to `var(--esp-color-link)`. Choose a color with at least 3:1
67
+ * contrast against the surface surrounding the badge.
31
68
  * @cssprop --esp-badge-border-color - Border color of a neutral badge.
32
69
  * Defaults to `var(--esp-color-border)`.
33
70
  * @cssprop --esp-badge-border-radius - Border radius of the badge
@@ -52,6 +89,8 @@ export declare class EspalierBadge extends EspalierElementBase {
52
89
  */
53
90
  get size(): EspalierBadgeSize;
54
91
  set size(value: EspalierBadgeSize | string | null);
92
+ /** Use the linked color set in place of the neutral and intent colors inside a native anchor. */
93
+ linked: boolean;
55
94
  protected render(): import("lit-html").TemplateResult<1>;
56
95
  static styles: import("lit").CSSResult[];
57
96
  }
@@ -1,16 +1,27 @@
1
- var c=function(r,e,t,s){var i=arguments.length,o=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,s);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(o=(i<3?a(o):i>3?a(e,t,o):a(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o};import{css as h,html as m,nothing as f}from"lit";import{customElement as g,property as p}from"lit/decorators.js";import{classMap as b}from"lit/directives/class-map.js";import{ref as u}from"lit/directives/ref.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";import{intentSurfaceTokens as v}from"../shared/style-fragments.js";import{syncNormalizedAttribute as z}from"../shared/attribute-helpers.js";import{getIconHrefForHost as y}from"../shared/intent-values.js";import{SlottedIconController as _}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as w}from"../shared/svgs/render-sprite-icon.js";function S(r){return r==="medium"?"medium":"small"}let n=class extends d{constructor(){super(...arguments),this.intentEmitsTokens=!1,this.iconSlot=new _(this),this.sizeBacker="small",this.icon=""}get size(){return this.sizeBacker}set size(e){const t=this.sizeBacker;this.sizeBacker=S(e),this.requestUpdate("size",t),z(this,"size",this.sizeBacker)}render(){const e=y(this.icon,this),t=this.iconSlot.hasSlottedIcon(),s=t||e.length>0,i={badge:!0,[`intent-${this.intent}`]:!0,[`size-${this.size}`]:!0,"has-icon":s};return m`
2
- <span part="badge" class=${b(i)}>
1
+ var l=function(s,e,o,i){var a=arguments.length,r=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,o):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,o,i);else for(var d=s.length-1;d>=0;d--)(n=s[d])&&(r=(a<3?n(r):a>3?n(e,o,r):n(e,o))||r);return a>3&&r&&Object.defineProperty(e,o,r),r};import{css as b,html as p,nothing as g}from"lit";import{customElement as v,property as c}from"lit/decorators.js";import{classMap as m}from"lit/directives/class-map.js";import{ref as f}from"lit/directives/ref.js";import{EspalierElementBase as h}from"../shared/esp-element-base.js";import{intentSurfaceTokens as u}from"../shared/style-fragments.js";import{syncNormalizedAttribute as k}from"../shared/attribute-helpers.js";import{getIconHrefForHost as y}from"../shared/intent-values.js";import{SlottedIconController as z}from"../shared/slotted-icon-controller.js";import{renderSpriteIcon as _}from"../shared/svgs/render-sprite-icon.js";function w(s){return s==="medium"?"medium":"small"}let t=class extends h{constructor(){super(...arguments),this.intentEmitsTokens=!1,this.iconSlot=new z(this),this.sizeBacker="small",this.icon="",this.linked=!1}get size(){return this.sizeBacker}set size(e){const o=this.sizeBacker;this.sizeBacker=w(e),this.requestUpdate("size",o),k(this,"size",this.sizeBacker)}render(){const e=y(this.icon,this),o=this.iconSlot.hasSlottedIcon(),i=o||e.length>0,a={badge:!0,[`intent-${this.intent}`]:!0,[`size-${this.size}`]:!0,"has-icon":i};return p`
2
+ <span part="badge" class=${m(a)}>
3
3
  <span part="icon" class="icon" aria-hidden="true">
4
4
  <slot
5
5
  name="icon"
6
- ${u(this.iconSlot.slotRef)}
6
+ ${f(this.iconSlot.slotRef)}
7
7
  @slotchange=${this.iconSlot.handleSlotChange}
8
8
  ></slot>
9
- ${!t&&e?w(e):f}
9
+ ${!o&&e?_(e):g}
10
10
  </span>
11
11
  <span part="label" class="label"><slot></slot></span>
12
+ ${this.linked?p`<svg
13
+ class="link-mark"
14
+ aria-hidden="true"
15
+ viewBox="0 0 24 24"
16
+ fill="none"
17
+ stroke="currentColor"
18
+ stroke-width="2"
19
+ stroke-linecap="round"
20
+ >
21
+ <path d="M9 15l6-6M11 6l1-1a5 5 0 0 1 7 7l-1 1M13 18l-1 1a5 5 0 0 1-7-7l1-1"></path>
22
+ </svg>`:g}
12
23
  </span>
13
- `}};n.styles=[...d.styles,v,h`
24
+ `}};t.styles=[...h.styles,u,b`
14
25
  :host {
15
26
  display: inline-flex;
16
27
  max-width: 100%;
@@ -45,6 +56,18 @@ var c=function(r,e,t,s){var i=arguments.length,o=i<3?e:s===null?s=Object.getOwnP
45
56
  --_esp-badge-color: var(--esp-badge-color, var(--esp-color-text));
46
57
  }
47
58
 
59
+ :host([linked]) .badge {
60
+ --_esp-badge-background: var(--esp-badge-link-background, var(--esp-color-background));
61
+ --_esp-badge-border-color: var(--esp-badge-link-border-color, var(--esp-color-link));
62
+ --_esp-badge-color: var(--esp-badge-link-color, var(--esp-color-link));
63
+ }
64
+
65
+ :host([linked]:hover) .badge {
66
+ --_esp-badge-background: var(--esp-badge-link-hover-background, var(--esp-color-link-hover-bg));
67
+ --_esp-badge-border-color: var(--esp-badge-link-hover-border-color, var(--esp-color-link-hover));
68
+ --_esp-badge-color: var(--esp-badge-link-hover-color, var(--esp-color-link-hover));
69
+ }
70
+
48
71
  .size-small {
49
72
  gap: calc(var(--esp-size-tiny) / 2);
50
73
  padding: calc(var(--esp-size-tiny) / 2) var(--esp-size-tiny);
@@ -66,6 +89,12 @@ var c=function(r,e,t,s){var i=arguments.length,o=i<3?e:s===null?s=Object.getOwnP
66
89
  height: 1em;
67
90
  }
68
91
 
92
+ .link-mark {
93
+ flex: none;
94
+ width: 1em;
95
+ height: 1em;
96
+ }
97
+
69
98
  .has-icon .icon {
70
99
  display: inline-flex;
71
100
  }
@@ -81,4 +110,4 @@ var c=function(r,e,t,s){var i=arguments.length,o=i<3?e:s===null?s=Object.getOwnP
81
110
  overflow: hidden;
82
111
  text-overflow: ellipsis;
83
112
  }
84
- `],c([p({type:String})],n.prototype,"icon",void 0),c([p({type:String,reflect:!0})],n.prototype,"size",null),n=c([g("esp-badge")],n);export{n as EspalierBadge};
113
+ `],l([c({type:String})],t.prototype,"icon",void 0),l([c({type:String,reflect:!0})],t.prototype,"size",null),l([c({type:Boolean,reflect:!0})],t.prototype,"linked",void 0),t=l([v("esp-badge")],t);export{t as EspalierBadge};
@@ -43,9 +43,11 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
43
43
  *
44
44
  * @cssprop --esp-color-box-background - The background color of the box.
45
45
  * @cssprop --esp-box-background - Adds a layer in the background of the box. Intended for background images or gradients.
46
- * @cssprop --esp-box-background-opacity - The opacity of the background layer.
46
+ * @cssprop --esp-box-background-opacity - The opacity of the background layer. Defaults to `--esp-box-background-image-opacity`, then `1`.
47
+ * @cssprop --esp-box-background-image - The theme's box background image, painted when `--esp-box-background` is unset. Defaults to `none`.
48
+ * @cssprop --esp-box-background-image-opacity - The theme's opacity for that image. Defaults to `1`.
47
49
  * @cssprop --esp-size-box-padding - The padding inside the box.
48
- * @cssprop --esp-box-shadow - The box's drop shadow. Defaults to the theme's `--esp-shadow-1` elevation.
50
+ * @cssprop --esp-box-shadow - The box's drop shadow: `none`, `1`, `2` or `3` as a theme elevation step. Defaults to `1`.
49
51
  *
50
52
  * ```html
51
53
  * <style>
@@ -1,10 +1,10 @@
1
- var p=function(r,e,s,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,s,i);else for(var n=r.length-1;n>=0;n--)(l=r[n])&&(o=(a<3?l(o):a>3?l(e,s,o):l(e,s))||o);return a>3&&o&&Object.defineProperty(e,s,o),o};import{paintedSurface as c}from"../shared/surface-layer.js";import{css as v,html as b}from"lit";import{customElement as f,property as h}from"lit/decorators.js";import{classMap as u}from"lit/directives/class-map.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";let t=class extends d{constructor(){super(...arguments),this.fullScreen=!1}render(){const{fullScreen:e}=this;return b`
2
- <div class=${u({"esp-box":!0,"full-screen":e})}>
1
+ var l=function(t,e,s,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,s,i);else for(var p=t.length-1;p>=0;p--)(n=t[p])&&(o=(a<3?n(o):a>3?n(e,s,o):n(e,s))||o);return a>3&&o&&Object.defineProperty(e,s,o),o};import{paintedSurface as c}from"../shared/surface-layer.js";import{css as b,html as v}from"lit";import{customElement as u,property as x}from"lit/decorators.js";import{classMap as f}from"lit/directives/class-map.js";import{EspalierElementBase as d}from"../shared/esp-element-base.js";let r=class extends d{constructor(){super(...arguments),this.fullScreen=!1}render(){const{fullScreen:e}=this;return v`
2
+ <div class=${f({"esp-box":!0,"full-screen":e})}>
3
3
  <div part="box">
4
4
  <slot></slot>
5
5
  </div>
6
6
  </div>
7
- `}};t.styles=[...d.styles,c(1),v`
7
+ `}};r.styles=[...d.styles,c(1),b`
8
8
  :host {
9
9
  display: block;
10
10
  }
@@ -25,8 +25,8 @@ var p=function(r,e,s,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnP
25
25
  top: 0;
26
26
  right: 0;
27
27
  bottom: 0;
28
- opacity: var(--esp-box-background-opacity, 1);
29
- background: var(--esp-box-background, initial);
28
+ opacity: var(--esp-box-background-opacity, var(--esp-box-background-image-opacity, 1));
29
+ background: var(--esp-box-background, var(--esp-box-background-image, none));
30
30
  z-index: 0;
31
31
  border-radius: var(--esp-size-border-radius);
32
32
  }
@@ -76,4 +76,4 @@ var p=function(r,e,s,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnP
76
76
  }
77
77
  }
78
78
  }
79
- `],p([h({attribute:"full-screen",type:Boolean})],t.prototype,"fullScreen",void 0),t=p([f("esp-box")],t);export{t as EspalierBox};
79
+ `],l([x({attribute:"full-screen",type:Boolean})],r.prototype,"fullScreen",void 0),r=l([u("esp-box")],r);export{r as EspalierBox};
@@ -46,6 +46,7 @@ import { LitElement } from "lit";
46
46
  * to recolor a single icon.
47
47
  * @cssprop --esp-breadcrumb-separator-size - Width and height of a separator icon.
48
48
  * Defaults to `var(--esp-size-normal-to-medium)`. The settable range is 0.5rem to 2rem.
49
+ * @cssprop --esp-breadcrumb-separator-stroke-width - Built-in line mark weight, from 0.5 to 6 in SVG units. Defaults to `2`.
49
50
  * @docPageTitle Breadcrumb
50
51
  * @docUrl /components/breadcrumbs/breadcrumb
51
52
  * @menuGroup Navigation
@@ -1,6 +1,6 @@
1
- var o=function(s,e,r,i){var n=arguments.length,t=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,r,i);else for(var c=s.length-1;c>=0;c--)(l=s[c])&&(t=(n<3?l(t):n>3?l(e,r,t):l(e,r))||t);return n>3&&t&&Object.defineProperty(e,r,t),t};import{LitElement as u,css as m,html as h}from"lit";import{customElement as d,property as p}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 a=class extends u{constructor(){super(...arguments),this.label="",this.url="",this.automaticSeparator="",this.isLastElement=!1}get separator(){return this.authoredSeparator===void 0?this.automaticSeparator:this.authoredSeparator}set separator(e){const r=this.separator;this.authoredSeparator=e,this.requestUpdate("separator",r)}setAutomaticSeparator(e){const r=this.separator;this.automaticSeparator=e,this.authoredSeparator||(this.authoredSeparator=void 0),this.requestUpdate("separator",r)}_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)}>
1
+ var o=function(s,e,r,i){var n=arguments.length,t=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,r,i);else for(var c=s.length-1;c>=0;c--)(l=s[c])&&(t=(n<3?l(t):n>3?l(e,r,t):l(e,r))||t);return n>3&&t&&Object.defineProperty(e,r,t),t};import{LitElement as u,css as d,html as h}from"lit";import{customElement as m,property as p}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 a=class extends u{constructor(){super(...arguments),this.label="",this.url="",this.automaticSeparator="",this.isLastElement=!1}get separator(){return this.authoredSeparator===void 0?this.automaticSeparator:this.authoredSeparator}set separator(e){const r=this.separator;this.authoredSeparator=e,this.requestUpdate("separator",r)}setAutomaticSeparator(e){const r=this.separator;this.automaticSeparator=e,this.authoredSeparator||(this.authoredSeparator=void 0),this.requestUpdate("separator",r)}_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
2
  ${this._renderLink()}${this.separator?v(this.separator):""}
3
- </div>`}};a.styles=m`
3
+ </div>`}};a.styles=d`
4
4
 
5
5
  :host {
6
6
  display: block;
@@ -58,4 +58,12 @@ var o=function(s,e,r,i){var n=arguments.length,t=n<3?e:i===null?i=Object.getOwnP
58
58
  height: var(--esp-breadcrumb-separator-size, var(--esp-size-normal-to-medium));
59
59
  width: var(--esp-breadcrumb-separator-size, var(--esp-size-normal-to-medium));
60
60
  }
61
- `,o([p({type:String})],a.prototype,"label",void 0),o([p({type:String})],a.prototype,"url",void 0),o([p({type:String,noAccessor:!0})],a.prototype,"separator",null),o([p({attribute:"is-last-element",type:Boolean})],a.prototype,"isLastElement",void 0),a=o([d("esp-breadcrumb")],a);export{a as EspalierBreadcrumb};
61
+
62
+ svg[data-built-in-stroke] {
63
+ stroke-width: var(--esp-breadcrumb-separator-stroke-width, 2);
64
+ }
65
+
66
+ :host(:dir(rtl)) svg[data-mirror-rtl] {
67
+ scale: -1 1;
68
+ }
69
+ `,o([p({type:String})],a.prototype,"label",void 0),o([p({type:String})],a.prototype,"url",void 0),o([p({type:String,noAccessor:!0})],a.prototype,"separator",null),o([p({attribute:"is-last-element",type:Boolean})],a.prototype,"isLastElement",void 0),a=o([m("esp-breadcrumb")],a);export{a as EspalierBreadcrumb};
@@ -1,20 +1,20 @@
1
- var p=function(l,t,s,o){var n=arguments.length,r=n<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,s):o,e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(l,t,s,o);else for(var i=l.length-1;i>=0;i--)(e=l[i])&&(r=(n<3?e(r):n>3?e(t,s,r):e(t,s))||r);return n>3&&r&&Object.defineProperty(t,s,r),r};import{css as v,html as w}from"lit";import{customElement as g,property as m}from"lit/decorators.js";import{EspalierElementBase as u}from"../shared/esp-element-base.js";import{createRef as b,ref as S}from"lit/directives/ref.js";import{BREADCRUMB_SEPARATOR_STYLES as c,BREADCRUMB_TRAIL_ENDS as f}from"./breadcrumb-separators.js";import{EspalierBreadcrumb as y}from"./esp-breadcrumb.js";export*from"./esp-breadcrumb.js";const E=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
1
+ var p=function(l,t,a,s){var n=arguments.length,e=n<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,a):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(l,t,a,s);else for(var i=l.length-1;i>=0;i--)(r=l[i])&&(e=(n<3?r(e):n>3?r(t,a,e):r(t,a))||e);return n>3&&e&&Object.defineProperty(t,a,e),e};import{css as v,html as w}from"lit";import{customElement as g,property as d}from"lit/decorators.js";import{EspalierElementBase as h}from"../shared/esp-element-base.js";import{createRef as b,ref as S}from"lit/directives/ref.js";import{BREADCRUMB_SEPARATOR_STYLES as m,BREADCRUMB_TRAIL_ENDS as c}from"./breadcrumb-separators.js";import{EspalierBreadcrumb as y}from"./esp-breadcrumb.js";export*from"./esp-breadcrumb.js";const E=`<svg aria-hidden="true" data-mirror-rtl 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>`,x=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
5
+ </svg>`,x=`<svg aria-hidden="true" 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>`;function d(l){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
10
+ </svg>`;function f(l,t){return`<svg aria-hidden="true" data-built-in-stroke${t?" data-mirror-rtl":""} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
11
11
  stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
12
12
  <path d="${l}" />
13
- </svg>`}const B={"arrow-filled":E,chevron:d("M9 6l6 6-6 6"),"line-arrow":d("M5 12h14m-6-6 6 6-6 6"),slash:d("M15 5l-6 14"),none:""};let a=class extends u{constructor(){super(...arguments),this.itemsSlot=b(),this.ariaLabel=null,this.separatorStyle=c[0],this.trailEnd=f[0]}updated(t){super.updated(t),(t.has("separatorStyle")||t.has("trailEnd"))&&this.assignSeparators()}assignSeparators(){const t=this.itemsSlot.value?.assignedElements().filter(e=>e instanceof y)??[],s=c.find(e=>e===this.separatorStyle)??c[0],o=B[s],n={"arrow-down-filled":x,same:o,none:""},r=f.find(e=>e===this.trailEnd)??f[0];for(const[e,i]of t.entries()){const h=e===t.length-1;i.isLastElement=h,i.setAutomaticSeparator(h?n[r]:o)}}render(){return w`
13
+ </svg>`}const B={"arrow-filled":E,chevron:f("M9 6l6 6-6 6",!0),"line-arrow":f("M5 12h14m-6-6 6 6-6 6",!0),slash:f("M15 5l-6 14",!1),none:""};let o=class extends h{constructor(){super(...arguments),this.itemsSlot=b(),this.ariaLabel=null,this.separatorStyle=m[0],this.trailEnd=c[0]}updated(t){super.updated(t),(t.has("separatorStyle")||t.has("trailEnd"))&&this.assignSeparators()}assignSeparators(){const t=this.itemsSlot.value?.assignedElements().filter(r=>r instanceof y)??[],a=m.find(r=>r===this.separatorStyle)??m[0],s=B[a],n={"arrow-down-filled":x,same:s,none:""},e=c.find(r=>r===this.trailEnd)??c[0];for(const[r,i]of t.entries()){const u=r===t.length-1;i.isLastElement=u,i.setAutomaticSeparator(u?n[e]:s)}}render(){return w`
14
14
  <nav aria-label=${this.ariaLabel??"Breadcrumb"}>
15
15
  <slot ${S(this.itemsSlot)} @slotchange=${this.assignSeparators}></slot>
16
16
  </nav>
17
- `}};a.styles=[...u.styles,v`
17
+ `}};o.styles=[...h.styles,v`
18
18
  nav {
19
19
  display: flex;
20
20
  flex-wrap: wrap;
@@ -22,4 +22,4 @@ var p=function(l,t,s,o){var n=arguments.length,r=n<3?t:o===null?o=Object.getOwnP
22
22
  gap: var(--esp-size-tiny-to-small);
23
23
  font-size: var(--esp-size-small-to-normal);
24
24
  }
25
- `],p([m({attribute:"aria-label",type:String})],a.prototype,"ariaLabel",void 0),p([m({attribute:"separator-style",type:String})],a.prototype,"separatorStyle",void 0),p([m({attribute:"trail-end",type:String})],a.prototype,"trailEnd",void 0),a=p([g("esp-breadcrumbs")],a);export{a as EspalierBreadcrumbs};
25
+ `],p([d({attribute:"aria-label",type:String})],o.prototype,"ariaLabel",void 0),p([d({attribute:"separator-style",type:String})],o.prototype,"separatorStyle",void 0),p([d({attribute:"trail-end",type:String})],o.prototype,"trailEnd",void 0),o=p([g("esp-breadcrumbs")],o);export{o as EspalierBreadcrumbs};
@@ -1,4 +1,4 @@
1
- var u=function(r,t,o,e){var s=arguments.length,n=s<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,o):e,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,t,o,e);else for(var l=r.length-1;l>=0;l--)(i=r[l])&&(n=(s<3?i(n):s>3?i(t,o,n):i(t,o))||n);return s>3&&n&&Object.defineProperty(t,o,n),n};import{css as d,html as p,LitElement as h,nothing as b}from"lit";import{customElement as f,property as c}from"lit/decorators.js";const g=["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"];function v(r){const t=r.tagName;return t==="ESP-BUTTON"?!0:t==="ESP-TOOLTIP"?!!r.querySelector("esp-button"):t==="ESP-POPOVER"?!!r.querySelector('esp-button[slot="target"]'):!1}let a=class extends h{constructor(){super(...arguments),this.label="",this.toolbar=!1,this.activeButton=null,this.managedButtons=new Set,this.managedTooltips=new Set}connectedCallback(){super.connectedCallback(),this.stateObserver??=new MutationObserver(()=>this.applyRovingTabindex()),this.stateObserver.observe(this,{subtree:!0,attributes:!0,attributeFilter:["disabled","loading"]})}disconnectedCallback(){super.disconnectedCallback(),this.stateObserver?.disconnect()}isEnabled(t){return!t.disabled&&!t.loading}handleSlotChange(t){const o=t.target;for(const e of o.assignedElements()){v(e)||console.warn(`<esp-button-group> unexpected child <${e.tagName.toLowerCase()}>. Only <esp-button>, <esp-tooltip>, or <esp-popover> (containing an <esp-button>) are supported.`);let s;const n=e.tagName;n==="ESP-BUTTON"?s=[e]:n==="ESP-POPOVER"?s=Array.from(e.querySelectorAll(':scope > esp-button[slot="target"]')):s=Array.from(e.querySelectorAll(":scope > esp-button"));for(const i of s)i.style.setProperty("--_esp-button-radius","0"),i.style.setProperty("--esp-field-border-width","0px")}this.applyRovingTabindex()}getButtons(){const t=this.shadowRoot?.querySelector("slot");if(!t)return[];const o=[];for(const e of t.assignedElements()){const s=e.tagName;s==="ESP-BUTTON"?o.push(e):s==="ESP-TOOLTIP"?o.push(...e.querySelectorAll(":scope > esp-button")):s==="ESP-POPOVER"&&o.push(...e.querySelectorAll(':scope > esp-button[slot="target"]'))}return o}getTooltips(){const t=this.shadowRoot?.querySelector("slot");return t?t.assignedElements().filter(o=>o.tagName==="ESP-TOOLTIP"):[]}applyTabindexValues(){const t=this.getButtons(),o=new Set(t);for(const e of this.managedButtons)o.has(e)||e.removeAttribute("tabindex");this.managedButtons=o;for(const e of t)e.setAttribute("tabindex",e===this.activeButton?"0":"-1")}syncTooltipOptOut(){const t=this.getTooltips(),o=new Set(t);for(const e of this.managedTooltips)o.has(e)||e.removeAttribute("trigger-tabindex");this.managedTooltips=o;for(const e of t)e.setAttribute("trigger-tabindex","-1")}applyRovingTabindex(){if(!this.toolbar)return;this.syncTooltipOptOut();const t=this.getButtons().filter(o=>this.isEnabled(o));t.length===0?this.activeButton=null:(!this.activeButton||!t.includes(this.activeButton))&&(this.activeButton=t[0]),this.applyTabindexValues()}clearRovingTabindex(){this.activeButton=null;for(const t of this.managedButtons)t.removeAttribute("tabindex");this.managedButtons.clear();for(const t of this.managedTooltips)t.removeAttribute("trigger-tabindex");this.managedTooltips.clear()}handleKeyDown(t){if(!this.toolbar||!g.includes(t.key))return;const o=this.getButtons().filter(n=>this.isEnabled(n));if(o.length===0)return;t.preventDefault();const e=this.activeButton?o.indexOf(this.activeButton):-1;let s;switch(t.key){case"Home":s=0;break;case"End":s=o.length-1;break;case"ArrowRight":case"ArrowDown":s=e===-1?0:(e+1)%o.length;break;default:s=e===-1?0:(e-1+o.length)%o.length}this.activeButton=o[s],this.applyTabindexValues(),this.activeButton.focus()}handleFocusIn(t){if(!this.toolbar)return;const o=t.composedPath(),e=this.getButtons().find(s=>this.isEnabled(s)&&o.includes(s));e&&e!==this.activeButton&&(this.activeButton=e,this.applyTabindexValues())}firstUpdated(){this.applyRovingTabindex()}updated(t){super.updated(t),t.has("toolbar")&&(this.toolbar?this.applyRovingTabindex():this.clearRovingTabindex())}render(){return p`
1
+ var u=function(r,t,o,e){var s=arguments.length,n=s<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,o):e,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,t,o,e);else for(var i=r.length-1;i>=0;i--)(a=r[i])&&(n=(s<3?a(n):s>3?a(t,o,n):a(t,o))||n);return s>3&&n&&Object.defineProperty(t,o,n),n};import{css as d,html as c,LitElement as h,nothing as b}from"lit";import{customElement as f,property as p}from"lit/decorators.js";const g=["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"];function v(r){const t=r.tagName;return t==="ESP-BUTTON"?!0:t==="ESP-TOOLTIP"?!!r.querySelector("esp-button"):t==="ESP-POPOVER"?!!r.querySelector('esp-button[slot="target"]'):!1}let l=class extends h{constructor(){super(...arguments),this.label="",this.toolbar=!1,this.activeButton=null,this.managedButtons=new Set,this.managedTooltips=new Set,this.groupedButtons=new Set}connectedCallback(){super.connectedCallback(),this.stateObserver??=new MutationObserver(()=>this.applyRovingTabindex()),this.stateObserver.observe(this,{subtree:!0,attributes:!0,attributeFilter:["disabled","loading"]})}disconnectedCallback(){super.disconnectedCallback(),this.stateObserver?.disconnect()}isEnabled(t){return!t.disabled&&!t.loading}handleSlotChange(t){const o=t.target,e=new Set;for(const s of o.assignedElements()){v(s)||console.warn(`<esp-button-group> unexpected child <${s.tagName.toLowerCase()}>. Only <esp-button>, <esp-tooltip>, or <esp-popover> (containing an <esp-button>) are supported.`);let n;const a=s.tagName;a==="ESP-BUTTON"?n=[s]:a==="ESP-POPOVER"?n=Array.from(s.querySelectorAll(':scope > esp-button[slot="target"]')):n=Array.from(s.querySelectorAll(":scope > esp-button"));for(const i of n)i.style.setProperty("--_esp-button-radius","0"),i.style.setProperty("--esp-field-border-width","0px"),i.style.setProperty("--_esp-button-group-border-width","0px"),e.add(i)}for(const s of this.groupedButtons)e.has(s)||s.style.removeProperty("--_esp-button-group-border-width");this.groupedButtons=e,this.applyRovingTabindex()}getButtons(){const t=this.shadowRoot?.querySelector("slot");if(!t)return[];const o=[];for(const e of t.assignedElements()){const s=e.tagName;s==="ESP-BUTTON"?o.push(e):s==="ESP-TOOLTIP"?o.push(...e.querySelectorAll(":scope > esp-button")):s==="ESP-POPOVER"&&o.push(...e.querySelectorAll(':scope > esp-button[slot="target"]'))}return o}getTooltips(){const t=this.shadowRoot?.querySelector("slot");return t?t.assignedElements().filter(o=>o.tagName==="ESP-TOOLTIP"):[]}applyTabindexValues(){const t=this.getButtons(),o=new Set(t);for(const e of this.managedButtons)o.has(e)||e.removeAttribute("tabindex");this.managedButtons=o;for(const e of t)e.setAttribute("tabindex",e===this.activeButton?"0":"-1")}syncTooltipOptOut(){const t=this.getTooltips(),o=new Set(t);for(const e of this.managedTooltips)o.has(e)||e.removeAttribute("trigger-tabindex");this.managedTooltips=o;for(const e of t)e.setAttribute("trigger-tabindex","-1")}applyRovingTabindex(){if(!this.toolbar)return;this.syncTooltipOptOut();const t=this.getButtons().filter(o=>this.isEnabled(o));t.length===0?this.activeButton=null:(!this.activeButton||!t.includes(this.activeButton))&&(this.activeButton=t[0]),this.applyTabindexValues()}clearRovingTabindex(){this.activeButton=null;for(const t of this.managedButtons)t.removeAttribute("tabindex");this.managedButtons.clear();for(const t of this.managedTooltips)t.removeAttribute("trigger-tabindex");this.managedTooltips.clear()}handleKeyDown(t){if(!this.toolbar||!g.includes(t.key))return;const o=this.getButtons().filter(n=>this.isEnabled(n));if(o.length===0)return;t.preventDefault();const e=this.activeButton?o.indexOf(this.activeButton):-1;let s;switch(t.key){case"Home":s=0;break;case"End":s=o.length-1;break;case"ArrowRight":case"ArrowDown":s=e===-1?0:(e+1)%o.length;break;default:s=e===-1?0:(e-1+o.length)%o.length}this.activeButton=o[s],this.applyTabindexValues(),this.activeButton.focus()}handleFocusIn(t){if(!this.toolbar)return;const o=t.composedPath(),e=this.getButtons().find(s=>this.isEnabled(s)&&o.includes(s));e&&e!==this.activeButton&&(this.activeButton=e,this.applyTabindexValues())}firstUpdated(){this.applyRovingTabindex()}updated(t){super.updated(t),t.has("toolbar")&&(this.toolbar?this.applyRovingTabindex():this.clearRovingTabindex())}render(){return c`
2
2
  <div
3
3
  class="button-group"
4
4
  role=${this.toolbar?"toolbar":"group"}
@@ -8,7 +8,7 @@ var u=function(r,t,o,e){var s=arguments.length,n=s<3?t:e===null?e=Object.getOwnP
8
8
  >
9
9
  <slot @slotchange=${this.handleSlotChange}></slot>
10
10
  </div>
11
- `}};a.styles=d`
11
+ `}};l.styles=d`
12
12
  :host {
13
13
  display: inline-flex;
14
14
  }
@@ -26,7 +26,12 @@ var u=function(r,t,o,e){var s=arguments.length,n=s<3?t:e===null?e=Object.getOwnP
26
26
  --esp-field-border-width: 0px;
27
27
  }
28
28
 
29
+
30
+ ::slotted(esp-button) {
31
+ --_esp-button-group-border-width: 0px;
32
+ }
33
+
29
34
  ::slotted(:not(:first-child)) {
30
35
  border-left: var(--esp-button-group-divider, 1px dotted var(--esp-color-border));
31
36
  }
32
- `,u([c({type:String})],a.prototype,"label",void 0),u([c({type:Boolean})],a.prototype,"toolbar",void 0),a=u([f("esp-button-group")],a);export{a as EspalierButtonGroup};
37
+ `,u([p({type:String})],l.prototype,"label",void 0),u([p({type:Boolean})],l.prototype,"toolbar",void 0),l=u([f("esp-button-group")],l);export{l as EspalierButtonGroup};
@@ -80,6 +80,9 @@ export type ButtonIconPosition = "left" | "right";
80
80
  * @csspart label - The text label, excluding icons and new-tab cues.
81
81
  * @cssprop --esp-button-padding - The padding inside the button label and icon areas.
82
82
  * @cssprop --esp-button-incognito-padding - The padding for the incognito button style.
83
+ * @cssprop --esp-button-border-width - The button's border width, from `0` to `0.5rem`. Defaults to `--esp-field-border-width`, then `1px`.
84
+ * @cssprop --esp-button-shadow - The button's resting shadow, drawn as a drop shadow. Set `none`, `1`, `2` or `3` in `componentProperties`, or raw CSS: `none` or `<x> <y> <blur> <color>` with no spread. Defaults to `none`.
85
+ * @cssprop --esp-button-press-offset - How far the button moves down and right while pressed, from `0` to `0.5rem`, with its shadow dropped. Reduced motion skips the move. Defaults to `0`.
83
86
  * @attr incognito - Renders the button with a borderless, transparent treatment
84
87
  * for quiet icon or inline actions.
85
88
  * @attr aria-pressed - Forwards a toggle's pressed state to the inner native
@@ -1,4 +1,4 @@
1
- var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(h,t,r,o);else for(var p=h.length-1;p>=0;p--)(d=h[p])&&(n=(l<3?d(n):l>3?d(t,r,n):d(t,r))||n);return l>3&&n&&Object.defineProperty(t,r,n),n};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 _}from"./action-state-lightness.js";const m=g`var(--esp-button-padding, var(--_esp-button-default-padding, var(--esp-size-padding)))`,B=c`<svg
1
+ var i=function(h,t,a,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,a):o,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(h,t,a,o);else for(var c=h.length-1;c>=0;c--)(d=h[c])&&(n=(l<3?d(n):l>3?d(t,a,n):d(t,a))||n);return l>3&&n&&Object.defineProperty(t,a,n),n};import{css as f,html as p,nothing as s}from"lit";import{customElement as m,eventOptions as y,property as r,state as w}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 k}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 $}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 z,renderNewTabCue as C}from"../shared/new-tab-cue.js";import{srOnly as N}from"../shared/style-fragments.js";import{BUTTON_INTERACTION_LIGHTNESS_FACTOR as _}from"./action-state-lightness.js";const v=f`var(--esp-button-padding, var(--_esp-button-default-padding, var(--esp-size-padding)))`,A=p`<svg
2
2
  xmlns="http://www.w3.org/2000/svg"
3
3
  viewBox="0 0 24 24"
4
4
  fill="none"
@@ -10,16 +10,16 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=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 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`
13
+ </svg>`;let e=class extends g{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,a=!1)=>this.loading&&!a?p` <span>${A}</span> `:p`
14
14
  <span>
15
- <slot ${T(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
15
+ <slot ${x(this.iconSlot.slotRef)} @slotchange=${this.iconSlot.handleSlotChange}></slot>
16
16
  ${!this.iconSlot.hasSlottedIcon(":scope > :not(slot)")&&t?S(t):s}
17
17
  </span>
18
- `}static get observedAttributes(){return[...super.observedAttributes,"tabindex","aria-pressed","aria-label"]}attributeChangedCallback(t,r,o){if(super.attributeChangedCallback(t,r,o),t==="aria-pressed"||t==="aria-label"){this.requestUpdate();return}if(t!=="tabindex"||this.neutralizingTabindex)return;const l=o===null?null:Number(o),n=l===null||Number.isNaN(l)?null:l;n!==null&&n>=0?(this.innerTabindex=n,this.writeHostTabindex(null)):n===null&&o!==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(x.CLICKED,{detail:{},bubbles:!0,composed:!0})),this.buttonType==="submit"){const r=this.closest("form");if(r){const o=document.createElement("button");o.type="submit",o.hidden=!0,this.formNoValidate&&(o.formNoValidate=!0),r.appendChild(o),r.requestSubmit(o),o.remove()}}else this.buttonType==="reset"&&this.closest("form")?.reset()}render(){const t=k(this.icon,this),r=this.current&&this.href.length>0,o=this.loading&&!r||this.iconSlot.hasSlottedIcon(":scope > :not(slot)")||t.length>0,{collapsed:l,iconOnly:n}=this,d=this.getAttribute("aria-label")||(n?this.label:"")||s,p=this.getAttribute("aria-pressed")||s,u={"esp-field":!0,"icon-only":n,incognito:this.incognito,"is-collapsed":l,"has-icon":o,"icon-left":o&&!n&&this.iconPosition==="left"};return r?c`<div part="wrapper" class=${b(u)}>
18
+ `}static get observedAttributes(){return[...super.observedAttributes,"tabindex","aria-pressed","aria-label"]}attributeChangedCallback(t,a,o){if(super.attributeChangedCallback(t,a,o),t==="aria-pressed"||t==="aria-label"){this.requestUpdate();return}if(t!=="tabindex"||this.neutralizingTabindex)return;const l=o===null?null:Number(o),n=l===null||Number.isNaN(l)?null:l;n!==null&&n>=0?(this.innerTabindex=n,this.writeHostTabindex(null)):n===null&&o!==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(k.CLICKED,{detail:{},bubbles:!0,composed:!0})),this.buttonType==="submit"){const a=this.closest("form");if(a){const o=document.createElement("button");o.type="submit",o.hidden=!0,this.formNoValidate&&(o.formNoValidate=!0),a.appendChild(o),a.requestSubmit(o),o.remove()}}else this.buttonType==="reset"&&this.closest("form")?.reset()}render(){const t=T(this.icon,this),a=this.current&&this.href.length>0,o=this.loading&&!a||this.iconSlot.hasSlottedIcon(":scope > :not(slot)")||t.length>0,{collapsed:l,iconOnly:n}=this,d=this.getAttribute("aria-label")||(n?this.label:"")||s,c=this.getAttribute("aria-pressed")||s,u={"esp-field":!0,"icon-only":n,incognito:this.incognito,"is-collapsed":l,"has-icon":o,"icon-left":o&&!n&&this.iconPosition==="left"};return a?p`<div part="wrapper" class=${b(u)}>
19
19
  <span part="control" class="current-page" aria-current="page" aria-label=${n?d:s}>
20
20
  <span part="label">${this.label??""}</span>${this.buildIcon(t,!0)}
21
21
  </span>
22
- </div>`:this.href.length?c`
22
+ </div>`:this.href.length?p`
23
23
  <div part="wrapper" class=${b(u)}>
24
24
  <a
25
25
  part="control"
@@ -28,14 +28,14 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnP
28
28
  target=${this.target||s}
29
29
  rel=${this.rel||s}
30
30
  tabindex=${this.innerTabindex??s}
31
- aria-label=${d===s?s:`${d}${C(this.target,this.newTabLabel)}`}
31
+ aria-label=${d===s?s:`${d}${z(this.target,this.newTabLabel)}`}
32
32
  >
33
33
  <span part="label">${this.label??""}</span>
34
34
  ${this.buildIcon(t)}
35
- ${n?s:z(this.target,this.newTabLabel)}
35
+ ${n?s:C(this.target,this.newTabLabel)}
36
36
  </a>
37
37
  </div>
38
- `:c`
38
+ `:p`
39
39
  <div part="wrapper" class=${b(u)}>
40
40
  <button
41
41
  part="control"
@@ -44,13 +44,13 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnP
44
44
  type=${this.buttonType}
45
45
  tabindex=${this.innerTabindex??s}
46
46
  aria-label=${d}
47
- aria-pressed=${p}
47
+ aria-pressed=${c}
48
48
  >
49
49
  <span part="label">${this.label??""}</span>
50
50
  ${this.buildIcon(t)}
51
51
  </button>
52
52
  </div>
53
- `}};e.styles=[...f.styles,N,g`
53
+ `}};e.styles=[...g.styles,N,f`
54
54
  :host {
55
55
  --_esp-button-radius: var(--esp-size-border-radius);
56
56
  }
@@ -70,6 +70,9 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnP
70
70
 
71
71
  .esp-field {
72
72
  border-radius: var(--_esp-button-radius);
73
+ border-width: var(--_esp-button-group-border-width, var(--esp-button-border-width, var(--esp-field-border-width, 1px)));
74
+
75
+ filter: drop-shadow(var(--esp-button-shadow, none));
73
76
 
74
77
  button,
75
78
  a,
@@ -83,7 +86,7 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnP
83
86
  cursor: pointer;
84
87
 
85
88
  > span:nth-child(1) {
86
- padding: ${m};
89
+ padding: ${v};
87
90
  line-height: 1.3;
88
91
  font-weight: bold;
89
92
  display: flex;
@@ -94,7 +97,7 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnP
94
97
  > span:nth-child(2) {
95
98
  display: none;
96
99
  place-content: center;
97
- padding: ${m};
100
+ padding: ${v};
98
101
 
99
102
  .generated-icon,
100
103
  ::slotted(svg),
@@ -195,6 +198,9 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnP
195
198
  &.incognito {
196
199
  background-color: transparent;
197
200
  border-color: transparent;
201
+ border-width: var(--esp-field-border-width, 1px);
202
+ box-shadow: none;
203
+ filter: none;
198
204
  color: var(--esp-color-text);
199
205
  block-size: 100%;
200
206
 
@@ -239,6 +245,22 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnP
239
245
 
240
246
  &:active {
241
247
  box-shadow: none;
248
+ filter: none;
249
+ }
250
+
251
+
252
+ &:has(> button:enabled:active, > a[href]:not([disabled]):active) {
253
+
254
+ position: relative;
255
+ translate: var(--esp-button-press-offset, none) var(--esp-button-press-offset, none);
256
+
257
+
258
+ button::after,
259
+ a::after {
260
+ content: "";
261
+ position: absolute;
262
+ inset: calc(-1 * var(--esp-button-press-offset, 0px)) 0 0 calc(-1 * var(--esp-button-press-offset, 0px));
263
+ }
242
264
  }
243
265
 
244
266
  &:has(button:disabled):hover,
@@ -255,6 +277,18 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnP
255
277
  }
256
278
  }
257
279
 
280
+ @media (prefers-reduced-motion: reduce) {
281
+ .esp-field:has(> button:enabled:active, > a[href]:not([disabled]):active) {
282
+ translate: none;
283
+
284
+
285
+ button::after,
286
+ a::after {
287
+ content: none;
288
+ }
289
+ }
290
+ }
291
+
258
292
  @keyframes rotate-360 {
259
293
  0% {
260
294
  transform: rotate(0deg);
@@ -263,4 +297,4 @@ var i=function(h,t,r,o){var l=arguments.length,n=l<3?t:o===null?o=Object.getOwnP
263
297
  transform: rotate(360deg);
264
298
  }
265
299
  }
266
- `],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};
300
+ `],i([w()],e.prototype,"innerTabindex",void 0),i([r({attribute:"button-type",type:String})],e.prototype,"buttonType",void 0),i([r({type:Boolean})],e.prototype,"collapsed",void 0),i([r({type:Boolean,reflect:!0})],e.prototype,"disabled",void 0),i([r({type:String})],e.prototype,"href",void 0),i([r({type:Boolean,reflect:!0})],e.prototype,"current",void 0),i([r({attribute:"icon-only",type:Boolean})],e.prototype,"iconOnly",void 0),i([r({type:Boolean,reflect:!0})],e.prototype,"incognito",void 0),i([r({type:String})],e.prototype,"icon",void 0),i([r({attribute:"icon-position",type:String})],e.prototype,"iconPosition",void 0),i([r({type:String})],e.prototype,"label",void 0),i([r({type:Boolean,reflect:!0})],e.prototype,"loading",void 0),i([r({type:String})],e.prototype,"target",void 0),i([r({type:String})],e.prototype,"rel",void 0),i([r({type:String,attribute:"new-tab-label"})],e.prototype,"newTabLabel",void 0),i([r({attribute:"formnovalidate",type:Boolean})],e.prototype,"formNoValidate",void 0),i([y({capture:!1,passive:!0})],e.prototype,"handleClick",null),e=i([m("esp-button")],e);export{e as EspalierButton};
@@ -1,2 +1,2 @@
1
- import{encodeTheme as W,isObjectRecord as d,isSemanticColorName as j,parseAnchorSource as v,validateThemePair as ee}from"../shared/theme.js";import{THEME_FIT_ANCHOR_FIELDS as M,THEME_FIT_APCA_FIELDS as D,THEME_FIT_COMPONENT_APCA_FIELDS as H,THEME_FIT_COMPONENT_PROPERTY_FIELDS as N,THEME_FIT_DATA_PALETTE_LINT_FIELDS as V,THEME_FIT_DATA_PALETTE_LINT_IDS as te,THEME_FIT_EXPLICIT_VALUES as re,THEME_FIT_LINT_FIELDS as K,THEME_FIT_LINT_IDS as ne,THEME_FIT_LINT_SEVERITIES as oe,THEME_FIT_PAIRING_VALUES as ie,THEME_FIT_REPORT_FIELDS as F,THEME_FIT_SUITE_FIELDS as L,THEME_FIT_TOKEN_FIELDS as P,themeFitReportSuite as se}from"../shared/theme-fit-report.js";import{COLOR_VISION_SIMULATIONS as ce,DATA_SERIES_KEYS as w,isPaletteCollisionDescription as ae}from"../shared/data-colors.js";import{isPaintKind as fe,isPaintName as A}from"../shared/paint-catalog.js";import{paintRequiredRatio as ue}from"../shared/paint-color.js";import{isSafeKey as pe}from"../shared/unsafe-keys.js";import{isSettableComponentPropertyName as R,SETTABLE_COMPONENT_PROPERTIES as de,SEMANTIC_COLOR_PROPERTIES as me}from"../shared/settable-component-properties.js";import{isColorSource as le,isLightnessKey as ge,isThemeSlug as z,toneReferenceName as he}from"../shared/theme-mapping-grammar.js";const x="usage: espalier theme check <theme.json> [--json] [--expect <fit.json>] [--update-expect <fit.json>]";function ot(e,t){const[r,o,...n]=e;if(r!=="theme"||o!=="check")return t.error(x),2;const s=ye(n,t);return s?Se(s,t):2}function ye(e,t){const r={file:"",json:!1};for(let o=0;o<e.length;o+=1){const n=e[o];if(n==="--json")r.json=!0;else if(n==="--expect"||n==="--update-expect"){const s=e[o+1];if(s===void 0)return t.error(`${n} requires a file path. ${x}`),null;n==="--expect"?r.expect=s:r.updateExpect=s,o+=1}else if(!n.startsWith("--")&&r.file==="")r.file=n;else return t.error(`Unknown argument "${n}". ${x}`),null}return r.file===""?(t.error(x),null):r.expect!==void 0&&r.updateExpect!==void 0?(t.error(`--expect checks the committed fit tables and --update-expect rewrites them \u2014 pick one. ${x}`),null):r}function $e(e,t){let r;try{r=t.readFile(e)}catch(s){return t.error(`Cannot read ${e}: ${s instanceof Error?s.message:String(s)}`),null}let o;try{o=JSON.parse(r)}catch(s){return t.error(`${e} is not JSON: ${s instanceof Error?s.message:String(s)}`),null}if(typeof o!="object"||o===null||Array.isArray(o))return t.error(`${e} must contain a theme object.`),null;const n=o;if("light"in n||"dark"in n){for(const s of["light","dark"]){const i=n[s];if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))return t.error(`${e}: "${s}" must be a theme object.`),null}return{light:n.light??{},dark:n.dark??{}}}return{light:n,dark:n}}function Se(e,t){const r=$e(e.file,t);if(!r)return 2;const o=ee(W(r.light),W(r.dark));if(!o.valid){for(const c of o.warnings)t.error(`warning: ${c}`);for(const c of o.errors)t.error(`error: ${c}`);return t.error(`${e.file}: ${o.errors.length} validation error(s).`),1}const n=se(r.light,r.dark);for(const c of o.warnings)Ye(c,n)||t.error(`warning: ${c}`);const s=Ge(n),i=e.json?t.error:t.log;if(e.updateExpect!==void 0){try{t.writeFile(e.updateExpect,`${JSON.stringify(n,null,2)}
2
- `)}catch(c){return t.error(`Cannot write ${e.updateExpect}: ${c instanceof Error?c.message:String(c)}`),2}i(`Wrote fit tables to ${e.updateExpect}.`)}if(e.expect!==void 0){let c;try{c=t.readFile(e.expect)}catch{return t.error(`Expected fit tables not found at ${e.expect} \u2014 create them with --update-expect ${e.expect}.`),2}let a;try{a=JSON.parse(c)}catch{return t.error(`${e.expect} is not JSON.`),2}if(!ke(a))return t.error(`${e.expect} is not a fit-table suite \u2014 regenerate it with --update-expect ${e.expect}.`),2;for(const u of[...a.light,...a.dark])u.componentProperties??=[];const f=Oe(a,n);if(f.length>0){s>0&&ze(n,s,t);for(const u of f)t.error(`drift: ${u}`);return t.error(`Fit tables drifted from ${e.expect} (${f.length} difference(s)). Review, then refresh deliberately with --update-expect.`),1}i(`Fit tables match ${e.expect}.`)}return e.json?(t.log(JSON.stringify(n,null,2)),s>0?1:0):(We(n,s,t),s>0?1:0)}function ke(e){if(!d(e)||!L.every(({field:r,kind:o})=>S(e[String(r)],o)))return!1;const t=e;if(!I(t.surfaces))return!1;for(const r of["light","dark"]){const n=t.paletteLints[r].map(k);if(!I(n))return!1;const s=t[r],i=new Set;for(const c of s){if(!xe(c,r)||!t.surfaces.includes(c.surface)||i.has(c.surface))return!1;i.add(c.surface)}}return!0}function U(e){return typeof e=="number"&&Number.isFinite(e)}function Ee(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function I(e){return new Set(e).size===e.length}function Te(e){return d(e)&&V.every(({field:t,kind:r})=>S(e[String(t)],r))}function _e(e){return d(e)&&K.every(({field:t,kind:r})=>S(e[String(t)],r))}function Fe(e){return d(e)&&P.every(({field:t,kind:r})=>S(e[String(t)],r))}const G=new Set(["requested","adjusted","apca","targetLc"]);function Le(e){if(!d(e)||!R(e.name))return!1;const t=de[e.name].pairsWith!==void 0;return!t&&(e.authored===null||Object.keys(e).some(r=>G.has(r)))||t&&(!U(e.targetLc)||e.targetLc<=0)?!1:N.every(({field:r,kind:o})=>!t&&G.has(r)||S(e[r],o))}function Ae(e){if(e===null||typeof e=="string")return!0;if(!d(e)||Object.keys(e).length!==2)return!1;const{source:t,lightness:r}=e;if(!ge(r)&&he(r)===null)return!1;if(le(t))return!0;const o=typeof t=="string"?v(t):null;return o!==null&&z(o.name)&&(o.slot===void 0||z(o.slot))}function S(e,t){switch(t){case"anchor":return e===void 0||J(e,M);case"anchor-record":return d(e)&&Object.keys(e).every(pe)&&Object.values(e).every(r=>typeof r=="string");case"apca":return e===void 0||J(e,D);case"boolean":return typeof e=="boolean";case"component-apca":return J(e,H);case"component-property-array":return e===void 0||Array.isArray(e)&&e.every(Le);case"component-property-name":return R(e);case"component-property-value":return Ae(e);case"contrast-ground":return typeof e=="string"&&(me.has(e)||R(e));case"data-palette-record":return d(e)?["light","dark"].every(r=>{const o=e[r];return d(o)&&w.every(n=>typeof o[n]=="string")}):!1;case"explicit":return e===void 0||re.includes(e);case"fit-lint-id":return ne.includes(e);case"fit-lint-token-array":return Array.isArray(e)&&e.every(r=>j(r)||R(r));case"lint-array":return Array.isArray(e)&&e.every(_e);case"message":case"string":return typeof e=="string";case"number":return U(e);case"paint-record":return e===void 0||Ie(e);case"pairing":return e===void 0||ie.includes(e);case"palette-lint-id":return te.includes(e);case"palette-lint-record":return d(e)&&["light","dark"].every(r=>Array.isArray(e[r])&&e[r].every(Te));case"report-array":return Array.isArray(e);case"scheme":return e==="light"||e==="dark";case"semantic":return j(e);case"semantic-array":return Array.isArray(e)&&e.every(j);case"series-pair":return we(e);case"simulation":return ce.includes(e);case"string-array":return Ee(e);case"token-array":return Array.isArray(e)&&e.every(Fe);case"warning":return oe.includes(e);default:{const r=t;return!1}}}function Ie(e){return d(e)?["light","dark"].every(t=>{const r=e[t];if(!Array.isArray(r))return!1;const o=new Set;for(const n of r){if(!d(n)||!A(n.role)||o.has(n.role)||n.context!==null&&!A(n.context)||!Array.isArray(n.pairs)||!Array.from(n.pairs).every(Pe))return!1;o.add(n.role)}return!0}):!1}function Pe(e){return d(e)&&A(e.element)&&A(e.foreground)&&A(e.background)&&A(e.state)&&fe(e.kind)&&U(e.ratio)&&e.ratio>=1&&e.ratio<=21&&e.required===ue(e.kind)}function J(e,t){return d(e)&&t.every(({field:r,kind:o})=>S(e[String(r)],o))}function we(e){if(!Array.isArray(e)||e.length!==2)return!1;const t=w.indexOf(e[0]),r=w.indexOf(e[1]);return t>=0&&r>t}function xe(e,t){if(!d(e)||!F.every(({field:n,kind:s})=>S(e[String(n)],s)))return!1;const r=e;if(r.scheme!==t)return!1;const o=r.componentProperties??[];return o.every(n=>n.surface===r.surface)&&I(o.map(n=>n.name))&&I(r.tokens.map(n=>n.token))&&I(r.adjustedTokens)&&I(r.lints.map(n=>n.id))}function Oe({paint:e,...t},{paint:r,...o}){const n=[];for(const i of L)i.compared&&Ce(n,i,t,o);return($(Q(t))!==$(Q(o))||n.length===0&&$(t)!==$(o))&&n.push("fit tables differ outside compared fields"),n}function Ce(e,t,r,o){const{field:n,kind:s}=t;if(s==="string-array"){const i=r[n],c=o[n];Y(e,String(n),i,c),E(e,String(n),i,c);return}if(s==="data-palette-record"){const i=r[n],c=o[n];for(const a of["light","dark"])for(const f of w)B(e,`${a}/${String(n)}/${f}`,i[a][f],c[a][f]);return}if(s==="palette-lint-record"){const i=r[n],c=o[n];for(const a of["light","dark"])He(e,a,String(n),i[a],c[a]),E(e,`${a}/${String(n)}`,i[a].map(k),c[a].map(k));return}if(s==="report-array"&&(n==="light"||n==="dark")){Ne(e,n,r[n],o[n]);return}T(e,"fit tables",String(n),r[n],o[n],s)}function Ne(e,t,r,o){const n=new Map(r.map(i=>[i.surface,i])),s=new Map(o.map(i=>[i.surface,i]));E(e,`${t}/reports`,r.map(i=>i.surface),o.map(i=>i.surface));for(const i of _(n.keys(),s.keys())){const c=n.get(i),a=s.get(i),f=`${t}/${i}`;if(!c||!a){e.push(`${f}: surface ${c?"removed":"added"}`);continue}Re(e,f,c,a)}}function Re(e,t,r,o){for(const n of F){const{compared:s,field:i,kind:c}=n;if(!(!s||i==="scheme"||i==="surface")){if(c==="anchor-record"){Ve(e,`${t}/${String(i)}`,r[i],o[i]);continue}if(c==="semantic-array"){const a=r[i],f=o[i];Y(e,`${t}/${String(i)}`,a,f),E(e,`${t}/${String(i)}`,a,f);continue}if(c==="lint-array"){const a=r[i],f=o[i];De(e,t,String(i),a,f),E(e,`${t}/${String(i)}`,a.map(u=>u.id),f.map(u=>u.id));continue}if(c==="component-property-array"){be(e,`${t}/${String(i)}`,r.componentProperties,o.componentProperties);continue}if(c==="token-array"){je(e,t,String(i),r[i],o[i]);continue}T(e,t,String(i),r[i],o[i],c)}}}function be(e,t,r,o){const n=new Map(r.map(i=>[i.name,i])),s=new Map(o.map(i=>[i.name,i]));E(e,t,[...n.keys()],[...s.keys()]);for(const i of _(n.keys(),s.keys())){const c=n.get(i),a=s.get(i),f=`${t}/${i}`;if(!c||!a){e.push(`${f}: property ${c?"removed":"added"}`);continue}for(const{compared:u,field:l,kind:p}of N)!u||l==="name"||(l==="apca"?q(e,f,l,c.apca,a.apca,H):T(e,f,l,c[l],a[l],p))}}function je(e,t,r,o,n){const s=new Map(o.map(a=>[a.token,a])),i=new Map(n.map(a=>[a.token,a]));E(e,`${t}/${r}`,o.map(a=>a.token),n.map(a=>a.token));const c=r==="tokens"?t:`${t}/${r}`;for(const a of _(s.keys(),i.keys())){const f=s.get(a),u=i.get(a),l=`${c}/${a}`;if(!f||!u){e.push(`${l}: token ${f?"removed":"added"}`);continue}Me(e,l,f,u)}}function Me(e,t,r,o){for(const{compared:n,field:s,kind:i}of P)if(!(!n||s==="token")){if(i==="anchor"){q(e,t,"anchor",r.anchor,o.anchor,M);continue}if(i==="apca"){q(e,t,"apca",r.apca,o.apca,D);continue}T(e,t,String(s),r[s],o[s],i)}}function q(e,t,r,o,n,s){const i=o,c=n;for(const{compared:a,field:f,kind:u}of s)a&&T(e,t,`${r}.${String(f)}`,i?.[f],c?.[f],u)}function De(e,t,r,o,n){const s=new Map(o.map(c=>[c.id,c])),i=new Map(n.map(c=>[c.id,c]));for(const c of _(s.keys(),i.keys())){const a=s.get(c),f=i.get(c),u=`${t}/${r}/${c}`;if(!a||!f){e.push(`${u}: lint ${a?"removed":"added"}`);continue}for(const{compared:l,field:p,kind:C}of K)if(!(!l||p==="id")){if(C==="fit-lint-token-array"){Ke(e,u,String(p),a[p],f[p]);continue}T(e,u,String(p),a[p],f[p],C)}}}function He(e,t,r,o,n){const s=new Map(o.map(c=>[k(c),c])),i=new Map(n.map(c=>[k(c),c]));for(const c of _(s.keys(),i.keys())){const a=s.get(c),f=i.get(c),u=`${t}/${r}/${c}`;if(!a||!f){e.push(`${u}: lint ${a?"removed":"added"}`);continue}for(const{compared:l,field:p,kind:C}of V)!l||p==="id"||p==="series"||p==="simulation"||T(e,u,String(p),a[p],f[p],C)}}function k(e){return`${e.id}/${e.series[0]}+${e.series[1]}/${e.simulation}`}function Ve(e,t,r,o){for(const n of _(Object.keys(r),Object.keys(o)))B(e,`${t}/${n}`,r[n],o[n])}function Y(e,t,r,o){const n=new Set(r),s=new Set(o);for(const i of _(n,s))n.has(i)!==s.has(i)&&e.push(`${t}/${i}: ${n.has(i)?"removed":"added"}`)}function E(e,t,r,o){const n=new Set(r),s=new Set(o),i=r.filter(a=>s.has(a)),c=o.filter(a=>n.has(a));i.some((a,f)=>a!==c[f])&&e.push(`${t}: order changed`)}function Ke(e,t,r,o,n){const s=Math.max(o.length,n.length);for(let i=0;i<s;i+=1)X(e,t,`${r}[${i}]`,o[i],n[i])}function B(e,t,r,o){r!==o&&e.push(`${t}: ${b(r)} \u2192 ${b(o)}`)}function X(e,t,r,o,n,s){if(!Object.is(o,n)){if(s==="message"){e.push(`${t}: message changed`);return}e.push(`${t}: ${r} ${b(o)} \u2192 ${b(n)}`)}}function Ue(e,t,r,o,n){$(o)!==$(n)&&e.push(`${t}: ${r} changed`)}function T(e,t,r,o,n,s){if(qe(s)){X(e,t,r,o,n,s);return}Ue(e,t,r,o,n)}const Je={anchor:!1,"anchor-record":!1,apca:!1,boolean:!0,"component-apca":!1,"component-property-array":!1,"component-property-name":!0,"component-property-value":!1,"contrast-ground":!0,"data-palette-record":!1,explicit:!0,"fit-lint-id":!0,"fit-lint-token-array":!1,"lint-array":!1,message:!0,number:!0,"paint-record":!1,pairing:!0,"palette-lint-id":!0,"palette-lint-record":!1,"report-array":!1,scheme:!0,semantic:!0,"semantic-array":!1,"series-pair":!1,simulation:!0,string:!0,"string-array":!1,"token-array":!1,warning:!0};function qe(e){return Je[e]===!0}function b(e){return e===void 0?"(absent)":e===""?'""':String(e)}function _(e,t){return[...new Set([...e,...t])].sort()}function $(e){return Array.isArray(e)?`[${e.map($).join(",")}]`:d(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${$(e[t])}`).join(",")}}`:JSON.stringify(e)??"undefined"}function Q(e){const t=g(e,h(L)),r=["light","dark"];if(y(L,"dataPalette")){const o=g(e.dataPalette,r);for(const n of r)m(o,n,g(e.dataPalette[n],w));m(t,"dataPalette",o)}if(y(L,"paletteLints")){const o=g(e.paletteLints,r);for(const n of r)m(o,n,Z(e.paletteLints[n],k,h(V)));m(t,"paletteLints",o)}for(const o of r){if(!y(L,o))continue;const n=O();for(const s of e[o]){const i=g(s,h(F));if(y(F,"tokens")){const c=O();for(const a of s.tokens){const f=g(a,h(P));a.anchor&&y(P,"anchor")&&m(f,"anchor",g(a.anchor,h(M))),a.apca&&y(P,"apca")&&m(f,"apca",g(a.apca,h(D))),m(c,a.token,f)}m(i,"tokens",c)}if(y(F,"componentProperties")){const c=O();for(const a of s.componentProperties){const f=g(a,h(N));a.apca&&y(N,"apca")&&m(f,"apca",g(a.apca,h(H))),m(c,a.name,f)}m(i,"componentProperties",c)}y(F,"lints")&&m(i,"lints",Z(s.lints,c=>c.id,h(K))),m(n,s.surface,i)}m(t,o,n)}return t}function Z(e,t,r){const o=O();for(const n of e)m(o,t(n),g(n,r));return o}function h(e){return e.filter(({compared:t})=>t).map(({field:t})=>t)}function y(e,t){return e.some(r=>r.field===t&&r.compared)}function g(e,t){const r=new Set(t.map(String)),o=O();for(const[n,s]of Object.entries(e))r.has(n)||(o[n]=s);return o}function O(){return Object.create(null)}function m(e,t,r){Object.keys(r).length>0&&(e[t]=r)}function We(e,t,r){for(const o of["light","dark"]){for(const n of e.paletteLints[o])r.log(` ${o} lint(${n.id}): ${n.message}`);for(const n of e[o]){r.log(Be(o,n));for(const s of n.lints)r.log(` lint(${s.id}): ${s.message}`)}}r.log(`Checked ${e.surfaces.length} surface(s) \xD7 2 schemes \u2014 `+(t===0?"no lints.":`${t} lint(s), listed above.`))}function ze(e,t,r){r.error(`${t} theme lint(s) are standing while fit-table drift is present:`);for(const o of["light","dark"]){for(const n of e.paletteLints[o])r.error(`lint: ${o}/paletteLints/${k(n)}: ${n.message}`);for(const n of e[o])for(const s of n.lints)r.error(`lint: ${o}/${n.surface}/lints/${s.id}: ${s.message}`)}}function Ge(e){return[...e.light,...e.dark].reduce((r,o)=>r+o.lints.length,0)+e.paletteLints.light.length+e.paletteLints.dark.length}function Ye(e,t){return["light","dark"].some(r=>{const o=`${r}: `;if(!e.startsWith(o))return!1;const n=e.slice(o.length);return t.paletteLints[r].some(s=>ae(n,s))})}function Be(e,t){const r=t.adjustedTokens.length===0?"contrast enforcement moved nothing":`contrast enforcement moved ${t.adjustedTokens.join(", ")}`,o=t.tokens.filter(s=>s.explicit==="inherited").length,n=o===0?"":`; ${o} inherited explicit pin(s) \u2014 see the fit tables`;return`${e}/${t.surface}: ${t.tokens.length} tokens, ${r}${n}.`}export{ot as runEspalierCli};
1
+ import{encodeTheme as W,isObjectRecord as d,isSemanticColorName as j,parseAnchorSource as ee,validateThemePair as te}from"../shared/theme.js";import{THEME_FIT_ANCHOR_FIELDS as M,THEME_FIT_APCA_FIELDS as D,THEME_FIT_COMPONENT_APCA_FIELDS as H,THEME_FIT_COMPONENT_PROPERTY_FIELDS as R,THEME_FIT_DATA_PALETTE_LINT_FIELDS as K,THEME_FIT_DATA_PALETTE_LINT_IDS as re,THEME_FIT_EXPLICIT_VALUES as ne,THEME_FIT_LINT_FIELDS as V,THEME_FIT_LINT_IDS as oe,THEME_FIT_LINT_SEVERITIES as ie,THEME_FIT_PAIRING_VALUES as se,THEME_FIT_REPORT_FIELDS as A,THEME_FIT_SUITE_FIELDS as L,THEME_FIT_TOKEN_FIELDS as P,themeFitReportSuite as ce}from"../shared/theme-fit-report.js";import{COLOR_VISION_SIMULATIONS as ae,DATA_SERIES_KEYS as w,isPaletteCollisionDescription as fe}from"../shared/data-colors.js";import{isPaintKind as ue,isPaintName as I}from"../shared/paint-catalog.js";import{FOOTER_HEADING_INK as pe,FOOTER_LINK_INK as de}from"../shared/footer-ink.js";import{paintRequiredRatio as me}from"../shared/paint-color.js";import{isSafeKey as le}from"../shared/unsafe-keys.js";import{isSettableComponentPropertyName as C,SETTABLE_COMPONENT_PROPERTIES as ge,SEMANTIC_COLOR_PROPERTIES as he}from"../shared/settable-component-properties.js";import{isColorSource as ye,isLightnessKey as $e,isThemeSlug as z,toneReferenceName as Se}from"../shared/theme-mapping-grammar.js";const O="usage: espalier theme check <theme.json> [--json] [--expect <fit.json>] [--update-expect <fit.json>]";function ct(e,t){const[r,o,...n]=e;if(r!=="theme"||o!=="check")return t.error(O),2;const s=ke(n,t);return s?Ee(s,t):2}function ke(e,t){const r={file:"",json:!1};for(let o=0;o<e.length;o+=1){const n=e[o];if(n==="--json")r.json=!0;else if(n==="--expect"||n==="--update-expect"){const s=e[o+1];if(s===void 0)return t.error(`${n} requires a file path. ${O}`),null;n==="--expect"?r.expect=s:r.updateExpect=s,o+=1}else if(!n.startsWith("--")&&r.file==="")r.file=n;else return t.error(`Unknown argument "${n}". ${O}`),null}return r.file===""?(t.error(O),null):r.expect!==void 0&&r.updateExpect!==void 0?(t.error(`--expect checks the committed fit tables and --update-expect rewrites them \u2014 pick one. ${O}`),null):r}function Te(e,t){let r;try{r=t.readFile(e)}catch(s){return t.error(`Cannot read ${e}: ${s instanceof Error?s.message:String(s)}`),null}let o;try{o=JSON.parse(r)}catch(s){return t.error(`${e} is not JSON: ${s instanceof Error?s.message:String(s)}`),null}if(typeof o!="object"||o===null||Array.isArray(o))return t.error(`${e} must contain a theme object.`),null;const n=o;if("light"in n||"dark"in n){for(const s of["light","dark"]){const i=n[s];if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))return t.error(`${e}: "${s}" must be a theme object.`),null}return{light:n.light??{},dark:n.dark??{}}}return{light:n,dark:n}}function Ee(e,t){const r=Te(e.file,t);if(!r)return 2;const o=te(W(r.light),W(r.dark));if(!o.valid){for(const c of o.warnings)t.error(`warning: ${c}`);for(const c of o.errors)t.error(`error: ${c}`);return t.error(`${e.file}: ${o.errors.length} validation error(s).`),1}const n=ce(r.light,r.dark);for(const c of o.warnings)Xe(c,n)||t.error(`warning: ${c}`);const s=Be(n),i=e.json?t.error:t.log;if(e.updateExpect!==void 0){try{t.writeFile(e.updateExpect,`${JSON.stringify(n,null,2)}
2
+ `)}catch(c){return t.error(`Cannot write ${e.updateExpect}: ${c instanceof Error?c.message:String(c)}`),2}i(`Wrote fit tables to ${e.updateExpect}.`)}if(e.expect!==void 0){let c;try{c=t.readFile(e.expect)}catch{return t.error(`Expected fit tables not found at ${e.expect} \u2014 create them with --update-expect ${e.expect}.`),2}let a;try{a=JSON.parse(c)}catch{return t.error(`${e.expect} is not JSON.`),2}if(!_e(a))return t.error(`${e.expect} is not a fit-table suite \u2014 regenerate it with --update-expect ${e.expect}.`),2;for(const u of[...a.light,...a.dark])u.componentProperties??=[];const f=Re(a,n);if(f.length>0){s>0&&Ye(n,s,t);for(const u of f)t.error(`drift: ${u}`);return t.error(`Fit tables drifted from ${e.expect} (${f.length} difference(s)). Review, then refresh deliberately with --update-expect.`),1}i(`Fit tables match ${e.expect}.`)}return e.json?(t.log(JSON.stringify(n,null,2)),s>0?1:0):(Ge(n,s,t),s>0?1:0)}function _e(e){if(!d(e)||!L.every(({field:r,kind:o})=>k(e[String(r)],o)))return!1;const t=e;if(!S(t.surfaces))return!1;for(const r of["light","dark"]){const n=t.paletteLints[r].map(T);if(!S(n))return!1;const s=t[r],i=new Set;for(const c of s){if(!Ne(c,r)||!t.surfaces.includes(c.surface)||i.has(c.surface))return!1;i.add(c.surface)}}return!0}function U(e){return typeof e=="number"&&Number.isFinite(e)}function Fe(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function S(e){return new Set(e).size===e.length}function Ae(e){return d(e)&&K.every(({field:t,kind:r})=>k(e[String(t)],r))}function Le(e){return d(e)&&V.every(({field:t,kind:r})=>k(e[String(t)],r))}function G(e){return d(e)&&P.every(({field:t,kind:r})=>k(e[String(t)],r))}const Y=new Set(["requested","adjusted","apca","targetLc"]);function Ie(e){if(!d(e)||!C(e.name))return!1;const t=ge[e.name].pairsWith!==void 0;return!t&&(e.authored===null||Object.keys(e).some(r=>Y.has(r)))||t&&(!U(e.targetLc)||e.targetLc<=0)?!1:R.every(({field:r,kind:o})=>!t&&Y.has(r)||k(e[r],o))}function Pe(e){if(e===null||typeof e=="string")return!0;if(!d(e)||Object.keys(e).length!==2)return!1;const{source:t,lightness:r}=e;if(!$e(r)&&Se(r)===null)return!1;if(ye(t))return!0;const o=typeof t=="string"?ee(t):null;return o!==null&&z(o.name)&&(o.slot===void 0||z(o.slot))}function k(e,t){switch(t){case"anchor":return e===void 0||J(e,M);case"anchor-record":return d(e)&&Object.keys(e).every(le)&&Object.values(e).every(r=>typeof r=="string");case"apca":return e===void 0||J(e,D);case"boolean":return typeof e=="boolean";case"component-apca":return J(e,H);case"component-property-array":return e===void 0||Array.isArray(e)&&e.every(Ie);case"component-property-name":return C(e);case"component-property-value":return Pe(e);case"contrast-ground":return typeof e=="string"&&(he.has(e)||C(e));case"data-palette-record":return d(e)?["light","dark"].every(r=>{const o=e[r];return d(o)&&w.every(n=>typeof o[n]=="string")}):!1;case"explicit":return e===void 0||ne.includes(e);case"fit-lint-id":return oe.includes(e);case"fit-lint-token-array":return Array.isArray(e)&&e.every(r=>j(r)||C(r)||r===pe||r===de);case"lint-array":return Array.isArray(e)&&e.every(Le);case"message":case"string":return typeof e=="string";case"number":return U(e);case"optional-token-array":return e===void 0||Array.isArray(e)&&e.every(G);case"paint-record":return e===void 0||we(e);case"pairing":return e===void 0||se.includes(e);case"palette-lint-id":return re.includes(e);case"palette-lint-record":return d(e)&&["light","dark"].every(r=>Array.isArray(e[r])&&e[r].every(Ae));case"report-array":return Array.isArray(e);case"scheme":return e==="light"||e==="dark";case"semantic":return j(e);case"semantic-array":return Array.isArray(e)&&e.every(j);case"series-pair":return xe(e);case"simulation":return ae.includes(e);case"string-array":return Fe(e);case"token-array":return Array.isArray(e)&&e.every(G);case"warning":return ie.includes(e);default:{const r=t;return!1}}}function we(e){return d(e)?["light","dark"].every(t=>{const r=e[t];if(!Array.isArray(r))return!1;const o=new Set;for(const n of r){if(!d(n)||!I(n.role)||o.has(n.role)||n.context!==null&&!I(n.context)||!Array.isArray(n.pairs)||!Array.from(n.pairs).every(Oe))return!1;o.add(n.role)}return!0}):!1}function Oe(e){return d(e)&&I(e.element)&&I(e.foreground)&&I(e.background)&&I(e.state)&&ue(e.kind)&&U(e.ratio)&&e.ratio>=1&&e.ratio<=21&&e.required===me(e.kind)}function J(e,t){return d(e)&&t.every(({field:r,kind:o})=>k(e[String(r)],o))}function xe(e){if(!Array.isArray(e)||e.length!==2)return!1;const t=w.indexOf(e[0]),r=w.indexOf(e[1]);return t>=0&&r>t}function Ne(e,t){if(!d(e)||!A.every(({field:n,kind:s})=>k(e[String(n)],s)))return!1;const r=e;if(r.scheme!==t)return!1;const o=r.componentProperties??[];return o.every(n=>n.surface===r.surface)&&S(o.map(n=>n.name))&&S(r.tokens.map(n=>n.token))&&S((r.footerTokens??[]).map(n=>n.token))&&S(r.adjustedTokens)&&S(r.lints.map(n=>n.id))}function Re({paint:e,...t},{paint:r,...o}){const n=[];for(const i of L)i.compared&&Ce(n,i,t,o);return($(Z(t))!==$(Z(o))||n.length===0&&$(t)!==$(o))&&n.push("fit tables differ outside compared fields"),n}function Ce(e,t,r,o){const{field:n,kind:s}=t;if(s==="string-array"){const i=r[n],c=o[n];B(e,String(n),i,c),E(e,String(n),i,c);return}if(s==="data-palette-record"){const i=r[n],c=o[n];for(const a of["light","dark"])for(const f of w)X(e,`${a}/${String(n)}/${f}`,i[a][f],c[a][f]);return}if(s==="palette-lint-record"){const i=r[n],c=o[n];for(const a of["light","dark"])Ve(e,a,String(n),i[a],c[a]),E(e,`${a}/${String(n)}`,i[a].map(T),c[a].map(T));return}if(s==="report-array"&&(n==="light"||n==="dark")){be(e,n,r[n],o[n]);return}_(e,"fit tables",String(n),r[n],o[n],s)}function be(e,t,r,o){const n=new Map(r.map(i=>[i.surface,i])),s=new Map(o.map(i=>[i.surface,i]));E(e,`${t}/reports`,r.map(i=>i.surface),o.map(i=>i.surface));for(const i of F(n.keys(),s.keys())){const c=n.get(i),a=s.get(i),f=`${t}/${i}`;if(!c||!a){e.push(`${f}: surface ${c?"removed":"added"}`);continue}je(e,f,c,a)}}function je(e,t,r,o){for(const n of A){const{compared:s,field:i,kind:c}=n;if(!(!s||i==="scheme"||i==="surface")){if(c==="anchor-record"){Ue(e,`${t}/${String(i)}`,r[i],o[i]);continue}if(c==="semantic-array"){const a=r[i],f=o[i];B(e,`${t}/${String(i)}`,a,f),E(e,`${t}/${String(i)}`,a,f);continue}if(c==="lint-array"){const a=r[i],f=o[i];Ke(e,t,String(i),a,f),E(e,`${t}/${String(i)}`,a.map(u=>u.id),f.map(u=>u.id));continue}if(c==="component-property-array"){Me(e,`${t}/${String(i)}`,r.componentProperties,o.componentProperties);continue}if(c==="token-array"||c==="optional-token-array"){De(e,t,String(i),r[i]??[],o[i]??[]);continue}_(e,t,String(i),r[i],o[i],c)}}}function Me(e,t,r,o){const n=new Map(r.map(i=>[i.name,i])),s=new Map(o.map(i=>[i.name,i]));E(e,t,[...n.keys()],[...s.keys()]);for(const i of F(n.keys(),s.keys())){const c=n.get(i),a=s.get(i),f=`${t}/${i}`;if(!c||!a){e.push(`${f}: property ${c?"removed":"added"}`);continue}for(const{compared:u,field:l,kind:p}of R)!u||l==="name"||(l==="apca"?q(e,f,l,c.apca,a.apca,H):_(e,f,l,c[l],a[l],p))}}function De(e,t,r,o,n){const s=new Map(o.map(a=>[a.token,a])),i=new Map(n.map(a=>[a.token,a]));E(e,`${t}/${r}`,o.map(a=>a.token),n.map(a=>a.token));const c=r==="tokens"?t:`${t}/${r}`;for(const a of F(s.keys(),i.keys())){const f=s.get(a),u=i.get(a),l=`${c}/${a}`;if(!f||!u){e.push(`${l}: token ${f?"removed":"added"}`);continue}He(e,l,f,u)}}function He(e,t,r,o){for(const{compared:n,field:s,kind:i}of P)if(!(!n||s==="token")){if(i==="anchor"){q(e,t,"anchor",r.anchor,o.anchor,M);continue}if(i==="apca"){q(e,t,"apca",r.apca,o.apca,D);continue}_(e,t,String(s),r[s],o[s],i)}}function q(e,t,r,o,n,s){const i=o,c=n;for(const{compared:a,field:f,kind:u}of s)a&&_(e,t,`${r}.${String(f)}`,i?.[f],c?.[f],u)}function Ke(e,t,r,o,n){const s=new Map(o.map(c=>[c.id,c])),i=new Map(n.map(c=>[c.id,c]));for(const c of F(s.keys(),i.keys())){const a=s.get(c),f=i.get(c),u=`${t}/${r}/${c}`;if(!a||!f){e.push(`${u}: lint ${a?"removed":"added"}`);continue}for(const{compared:l,field:p,kind:N}of V)if(!(!l||p==="id")){if(N==="fit-lint-token-array"){Je(e,u,String(p),a[p],f[p]);continue}_(e,u,String(p),a[p],f[p],N)}}}function Ve(e,t,r,o,n){const s=new Map(o.map(c=>[T(c),c])),i=new Map(n.map(c=>[T(c),c]));for(const c of F(s.keys(),i.keys())){const a=s.get(c),f=i.get(c),u=`${t}/${r}/${c}`;if(!a||!f){e.push(`${u}: lint ${a?"removed":"added"}`);continue}for(const{compared:l,field:p,kind:N}of K)!l||p==="id"||p==="series"||p==="simulation"||_(e,u,String(p),a[p],f[p],N)}}function T(e){return`${e.id}/${e.series[0]}+${e.series[1]}/${e.simulation}`}function Ue(e,t,r,o){for(const n of F(Object.keys(r),Object.keys(o)))X(e,`${t}/${n}`,r[n],o[n])}function B(e,t,r,o){const n=new Set(r),s=new Set(o);for(const i of F(n,s))n.has(i)!==s.has(i)&&e.push(`${t}/${i}: ${n.has(i)?"removed":"added"}`)}function E(e,t,r,o){const n=new Set(r),s=new Set(o),i=r.filter(a=>s.has(a)),c=o.filter(a=>n.has(a));i.some((a,f)=>a!==c[f])&&e.push(`${t}: order changed`)}function Je(e,t,r,o,n){const s=Math.max(o.length,n.length);for(let i=0;i<s;i+=1)Q(e,t,`${r}[${i}]`,o[i],n[i])}function X(e,t,r,o){r!==o&&e.push(`${t}: ${b(r)} \u2192 ${b(o)}`)}function Q(e,t,r,o,n,s){if(!Object.is(o,n)){if(s==="message"){e.push(`${t}: message changed`);return}e.push(`${t}: ${r} ${b(o)} \u2192 ${b(n)}`)}}function qe(e,t,r,o,n){$(o)!==$(n)&&e.push(`${t}: ${r} changed`)}function _(e,t,r,o,n,s){if(ze(s)){Q(e,t,r,o,n,s);return}qe(e,t,r,o,n)}const We={anchor:!1,"anchor-record":!1,apca:!1,boolean:!0,"component-apca":!1,"component-property-array":!1,"component-property-name":!0,"component-property-value":!1,"contrast-ground":!0,"data-palette-record":!1,explicit:!0,"fit-lint-id":!0,"fit-lint-token-array":!1,"lint-array":!1,message:!0,number:!0,"optional-token-array":!1,"paint-record":!1,pairing:!0,"palette-lint-id":!0,"palette-lint-record":!1,"report-array":!1,scheme:!0,semantic:!0,"semantic-array":!1,"series-pair":!1,simulation:!0,string:!0,"string-array":!1,"token-array":!1,warning:!0};function ze(e){return We[e]===!0}function b(e){return e===void 0?"(absent)":e===""?'""':String(e)}function F(e,t){return[...new Set([...e,...t])].sort()}function $(e){return Array.isArray(e)?`[${e.map($).join(",")}]`:d(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${$(e[t])}`).join(",")}}`:JSON.stringify(e)??"undefined"}function Z(e){const t=g(e,h(L)),r=["light","dark"];if(y(L,"dataPalette")){const o=g(e.dataPalette,r);for(const n of r)m(o,n,g(e.dataPalette[n],w));m(t,"dataPalette",o)}if(y(L,"paletteLints")){const o=g(e.paletteLints,r);for(const n of r)m(o,n,v(e.paletteLints[n],T,h(K)));m(t,"paletteLints",o)}for(const o of r){if(!y(L,o))continue;const n=x();for(const s of e[o]){const i=g(s,h(A));for(const c of["tokens","footerTokens"]){if(!y(A,c))continue;const a=x();for(const f of s[c]??[]){const u=g(f,h(P));f.anchor&&y(P,"anchor")&&m(u,"anchor",g(f.anchor,h(M))),f.apca&&y(P,"apca")&&m(u,"apca",g(f.apca,h(D))),m(a,f.token,u)}m(i,c,a)}if(y(A,"componentProperties")){const c=x();for(const a of s.componentProperties){const f=g(a,h(R));a.apca&&y(R,"apca")&&m(f,"apca",g(a.apca,h(H))),m(c,a.name,f)}m(i,"componentProperties",c)}y(A,"lints")&&m(i,"lints",v(s.lints,c=>c.id,h(V))),m(n,s.surface,i)}m(t,o,n)}return t}function v(e,t,r){const o=x();for(const n of e)m(o,t(n),g(n,r));return o}function h(e){return e.filter(({compared:t})=>t).map(({field:t})=>t)}function y(e,t){return e.some(r=>r.field===t&&r.compared)}function g(e,t){const r=new Set(t.map(String)),o=x();for(const[n,s]of Object.entries(e))r.has(n)||(o[n]=s);return o}function x(){return Object.create(null)}function m(e,t,r){Object.keys(r).length>0&&(e[t]=r)}function Ge(e,t,r){for(const o of["light","dark"]){for(const n of e.paletteLints[o])r.log(` ${o} lint(${n.id}): ${n.message}`);for(const n of e[o]){r.log(Qe(o,n));for(const s of n.lints)r.log(` lint(${s.id}): ${s.message}`)}}r.log(`Checked ${e.surfaces.length} surface(s) \xD7 2 schemes \u2014 `+(t===0?"no lints.":`${t} lint(s), listed above.`))}function Ye(e,t,r){r.error(`${t} theme lint(s) are standing while fit-table drift is present:`);for(const o of["light","dark"]){for(const n of e.paletteLints[o])r.error(`lint: ${o}/paletteLints/${T(n)}: ${n.message}`);for(const n of e[o])for(const s of n.lints)r.error(`lint: ${o}/${n.surface}/lints/${s.id}: ${s.message}`)}}function Be(e){return[...e.light,...e.dark].reduce((r,o)=>r+o.lints.length,0)+e.paletteLints.light.length+e.paletteLints.dark.length}function Xe(e,t){return["light","dark"].some(r=>{const o=`${r}: `;if(!e.startsWith(o))return!1;const n=e.slice(o.length);return t.paletteLints[r].some(s=>fe(n,s))})}function Qe(e,t){const r=t.adjustedTokens.length===0?"contrast enforcement moved nothing":`contrast enforcement moved ${t.adjustedTokens.join(", ")}`,o=t.tokens.filter(s=>s.explicit==="inherited").length,n=o===0?"":`; ${o} inherited explicit pin(s) \u2014 see the fit tables`;return`${e}/${t.surface}: ${t.tokens.length} tokens, ${r}${n}.`}export{ct as runEspalierCli};