@taprootio/espalier 7.1.1 → 7.3.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 (102) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/custom-elements.json +11675 -20250
  3. package/dist/badge/esp-badge.d.ts +7 -0
  4. package/dist/badge/esp-badge.js +11 -5
  5. package/dist/breadcrumbs/breadcrumb-separators.d.ts +4 -0
  6. package/dist/breadcrumbs/breadcrumb-separators.js +1 -0
  7. package/dist/breadcrumbs/esp-breadcrumb.d.ts +13 -14
  8. package/dist/breadcrumbs/esp-breadcrumb.js +6 -7
  9. package/dist/breadcrumbs/esp-breadcrumbs.d.ts +16 -9
  10. package/dist/breadcrumbs/esp-breadcrumbs.js +9 -6
  11. package/dist/button/paint-registration.js +1 -0
  12. package/dist/cli/theme-check.js +2 -2
  13. package/dist/font-picker/esp-font-picker.d.ts +11 -14
  14. package/dist/font-picker/esp-font-picker.js +5 -5
  15. package/dist/footer/esp-footer-link-group.js +1 -1
  16. package/dist/footer/esp-footer.d.ts +5 -0
  17. package/dist/footer/esp-footer.js +10 -4
  18. package/dist/footer/paint-registration.js +1 -0
  19. package/dist/header/esp-header-button.js +5 -1
  20. package/dist/header/esp-header.js +12 -8
  21. package/dist/header/header-geometry-controller.js +1 -1
  22. package/dist/header/is-tall-header-paint.d.ts +7 -0
  23. package/dist/header/is-tall-header-paint.js +1 -0
  24. package/dist/header/paint-registration.js +1 -0
  25. package/dist/index.d.ts +4 -2
  26. package/dist/index.js +1 -1
  27. package/dist/menu/esp-menu-group.js +8 -8
  28. package/dist/menu/esp-menu-item.js +8 -8
  29. package/dist/menu/esp-menu.js +10 -6
  30. package/dist/menu/navigation-focus-outline.js +8 -0
  31. package/dist/menu/navigation-paint.js +1 -0
  32. package/dist/menu/paint-registration.js +1 -0
  33. package/dist/pickers/esp-picker-item.js +1 -1
  34. package/dist/root/esp-root.d.ts +8 -1
  35. package/dist/root/esp-root.js +47 -10
  36. package/dist/root/helpers/compute-semantic-properties.js +1 -1
  37. package/dist/root/helpers/compute-theme-properties.js +1 -1
  38. package/dist/root/helpers/data-companion-properties.js +1 -1
  39. package/dist/root/helpers/lightness-ramp-properties.js +1 -1
  40. package/dist/shared/blockquote-styles.d.ts +3 -0
  41. package/dist/shared/blockquote-styles.js +4 -4
  42. package/dist/shared/color-engine.js +1 -1
  43. package/dist/shared/component-property-compiler.js +1 -0
  44. package/dist/shared/component-property-diagnostics.js +1 -0
  45. package/dist/shared/component-property-normalizer.js +1 -0
  46. package/dist/shared/component-property-resets.js +1 -0
  47. package/dist/shared/composed-dom.js +1 -0
  48. package/dist/shared/configured-brand-color.js +1 -0
  49. package/dist/shared/configured-brand.js +5 -5
  50. package/dist/shared/css-named-colors.js +1 -0
  51. package/dist/shared/document-sprite.js +1 -1
  52. package/dist/shared/esp-element-base.d.ts +3 -0
  53. package/dist/shared/esp-element-base.js +3 -3
  54. package/dist/shared/font-helpers.d.ts +3 -3
  55. package/dist/shared/font-helpers.js +1 -1
  56. package/dist/shared/font-plan.d.ts +1 -1
  57. package/dist/shared/governing-root.d.ts +24 -0
  58. package/dist/shared/governing-root.js +1 -0
  59. package/dist/shared/intent-values.js +1 -1
  60. package/dist/shared/paint-catalog.d.ts +27 -0
  61. package/dist/shared/paint-catalog.js +1 -0
  62. package/dist/shared/paint-color.d.ts +25 -0
  63. package/dist/shared/paint-color.js +1 -0
  64. package/dist/shared/paint-fit.js +1 -0
  65. package/dist/shared/paint-identity.js +1 -0
  66. package/dist/shared/paint-types.d.ts +88 -0
  67. package/dist/shared/paint-types.js +0 -0
  68. package/dist/shared/public-token-catalog.generated.js +1 -0
  69. package/dist/shared/root-event-subscription.d.ts +11 -0
  70. package/dist/shared/scoped-style-declarations.js +1 -0
  71. package/dist/shared/semantic-color-names.d.ts +16 -0
  72. package/dist/shared/semantic-color-names.js +1 -0
  73. package/dist/shared/settable-component-properties.js +1 -0
  74. package/dist/shared/theme-core.d.ts +808 -0
  75. package/dist/shared/theme-core.js +1 -0
  76. package/dist/shared/theme-fit-report.d.ts +39 -5
  77. package/dist/shared/theme-fit-report.js +1 -1
  78. package/dist/shared/theme-mapping-grammar.d.ts +16 -0
  79. package/dist/shared/theme-mapping-grammar.js +1 -0
  80. package/dist/shared/theme-properties.d.ts +3 -1
  81. package/dist/shared/theme-properties.js +1 -1
  82. package/dist/shared/theme-validation.d.ts +52 -0
  83. package/dist/shared/theme-validation.js +1 -0
  84. package/dist/shared/theme.d.ts +6 -899
  85. package/dist/shared/theme.js +1 -1
  86. package/dist/shared/token-pairings.d.ts +25 -0
  87. package/dist/shared/token-pairings.js +1 -0
  88. package/dist/shared/wcag-contrast.d.ts +14 -0
  89. package/dist/shared/wcag-contrast.js +1 -0
  90. package/dist/testing/index.d.ts +7 -0
  91. package/dist/testing/index.js +1 -0
  92. package/dist/testing/observe-paint.d.ts +29 -0
  93. package/dist/testing/observe-paint.iife.js +3 -0
  94. package/dist/testing/observe-paint.js +3 -0
  95. package/dist/testing/paint-bands.js +1 -0
  96. package/dist/testing/paint-coverage.d.ts +14 -0
  97. package/dist/testing/paint-coverage.js +1 -0
  98. package/dist/testing/paint-dom.js +1 -0
  99. package/dist/testing/svg-paint.js +1 -0
  100. package/espalier.css-data.json +62 -2
  101. package/espalier.token-manifest.json +5724 -29
  102. package/package.json +10 -1
@@ -23,6 +23,13 @@ export type EspalierBadgeSize = "small" | "medium";
23
23
  * @slot icon - Optional custom icon. When provided, it overrides
24
24
  * the generated SVG from the `icon` attribute.
25
25
  *
26
+ * @cssprop --esp-badge-background - Background of a neutral badge.
27
+ * Defaults to `var(--esp-color-layer-2)`.
28
+ * @cssprop --esp-badge-color - Text color of a neutral badge. Defaults to
29
+ * `var(--esp-color-text)`. The theme fits it against the neutral badge
30
+ * background at APCA Lc 75 when either property is set in the theme.
31
+ * @cssprop --esp-badge-border-color - Border color of a neutral badge.
32
+ * Defaults to `var(--esp-color-border)`.
26
33
  * @cssprop --esp-badge-border-radius - Border radius of the badge
27
34
  * shell. Defaults to `999px`.
28
35
  *
@@ -1,16 +1,16 @@
1
- var c=function(s,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,o);else for(var l=s.length-1;l>=0;l--)(a=s[l])&&(i=(n<3?a(i):n>3?a(e,t,i):a(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};import{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 u}from"lit/directives/class-map.js";import{ref as b}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(s){return s==="medium"?"medium":"small"}let r=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(),o=t||e.length>0,n={badge:!0,[`intent-${this.intent}`]:!0,[`size-${this.size}`]:!0,"has-icon":o};return m`
2
- <span part="badge" class=${u(n)}>
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)}>
3
3
  <span part="icon" class="icon" aria-hidden="true">
4
4
  <slot
5
5
  name="icon"
6
- ${b(this.iconSlot.slotRef)}
6
+ ${u(this.iconSlot.slotRef)}
7
7
  @slotchange=${this.iconSlot.handleSlotChange}
8
8
  ></slot>
9
9
  ${!t&&e?w(e):f}
10
10
  </span>
11
11
  <span part="label" class="label"><slot></slot></span>
12
12
  </span>
13
- `}};r.styles=[...d.styles,v,h`
13
+ `}};n.styles=[...d.styles,v,h`
14
14
  :host {
15
15
  display: inline-flex;
16
16
  max-width: 100%;
@@ -39,6 +39,12 @@ var c=function(s,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnP
39
39
  white-space: nowrap;
40
40
  }
41
41
 
42
+ .badge.intent-neutral {
43
+ --_esp-badge-background: var(--esp-badge-background, var(--esp-color-layer-2));
44
+ --_esp-badge-border-color: var(--esp-badge-border-color, var(--esp-color-border));
45
+ --_esp-badge-color: var(--esp-badge-color, var(--esp-color-text));
46
+ }
47
+
42
48
  .size-small {
43
49
  gap: calc(var(--esp-size-tiny) / 2);
44
50
  padding: calc(var(--esp-size-tiny) / 2) var(--esp-size-tiny);
@@ -75,4 +81,4 @@ var c=function(s,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnP
75
81
  overflow: hidden;
76
82
  text-overflow: ellipsis;
77
83
  }
78
- `],c([p({type:String})],r.prototype,"icon",void 0),c([p({type:String,reflect:!0})],r.prototype,"size",null),r=c([g("esp-badge")],r);export{r as EspalierBadge};
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};
@@ -0,0 +1,4 @@
1
+ export declare const BREADCRUMB_SEPARATOR_STYLES: readonly ["arrow-filled", "chevron", "line-arrow", "slash", "none"];
2
+ export type BreadcrumbSeparatorStyle = (typeof BREADCRUMB_SEPARATOR_STYLES)[number];
3
+ export declare const BREADCRUMB_TRAIL_ENDS: readonly ["arrow-down-filled", "same", "none"];
4
+ export type BreadcrumbTrailEnd = (typeof BREADCRUMB_TRAIL_ENDS)[number];
@@ -0,0 +1 @@
1
+ const e=Object.freeze(["arrow-filled","chevron","line-arrow","slash","none"]),o=Object.freeze(["arrow-down-filled","same","none"]);export{e as BREADCRUMB_SEPARATOR_STYLES,o as BREADCRUMB_TRAIL_ENDS};
@@ -38,13 +38,14 @@ import { LitElement } from "lit";
38
38
  * @cssprop --esp-breadcrumb-hover-background - The background behind a hovered link.
39
39
  * Defaults to `var(--esp-color-link-hover-bg)`.
40
40
  * @cssprop --esp-breadcrumb-current-color - The text color of the current-page crumb, which
41
- * is not a link. Defaults to `--esp-breadcrumb-color` when that is set, then to
42
- * `var(--esp-color-headings)`, keeping the current page distinct from the links beside it.
41
+ * is not a link. Defaults to `var(--esp-breadcrumb-color, var(--esp-color-headings))`, keeping
42
+ * the current page distinct from the links beside it.
43
43
  * @cssprop --esp-breadcrumb-separator-color - The color of the separator icons. Defaults to
44
- * `oklch(from var(--esp-color-link) l c calc(h + 90))`, an accent that takes the link ink's
45
- * scheme-adapted lightness and chroma at a different hue, so the arrows are their own color
46
- * rather than the heading color. Set it on `esp-breadcrumbs` to recolor a whole trail, or on
47
- * one `esp-breadcrumb` to recolor a single arrow.
44
+ * `color-mix(in oklch, var(--esp-breadcrumb-color, var(--esp-color-link)) 70%, transparent)`.
45
+ * Set it on `esp-breadcrumbs` to recolor a whole trail or on one `esp-breadcrumb`
46
+ * to recolor a single icon.
47
+ * @cssprop --esp-breadcrumb-separator-size - Width and height of a separator icon.
48
+ * Defaults to `var(--esp-size-normal-to-medium)`. The settable range is 0.5rem to 2rem.
48
49
  * @docPageTitle Breadcrumb
49
50
  * @docUrl /components/breadcrumbs/breadcrumb
50
51
  * @menuGroup Navigation
@@ -59,17 +60,15 @@ export declare class EspalierBreadcrumb extends LitElement {
59
60
  **/
60
61
  url: string;
61
62
  /**
62
- * Used to override the SVG separator displayed after the
63
- * breadcrumb.
64
- * @type {string}
63
+ * The effective SVG separator. Write SVG markup here to override the trail's choice.
64
+ * @default ""
65
65
  */
66
- separator: string;
66
+ get separator(): string;
67
+ set separator(value: string);
67
68
  /**
68
69
  * Marks this crumb as the end of the trail. The parent
69
- * `esp-breadcrumbs` sets it to pick the down-arrow separator and
70
- * the current-crumb styling. It does not decide link versus label —
71
- * a crumb that carries a `url` stays clickable wherever it sits, so
72
- * a trail can end at its deepest folder.
70
+ * `esp-breadcrumbs` sets it alongside the end separator. A crumb
71
+ * with a `url` stays clickable wherever it sits.
73
72
  * @type {boolean}
74
73
  */
75
74
  isLastElement: boolean;
@@ -1,6 +1,6 @@
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)}>
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)}>
2
2
  ${this._renderLink()}${this.separator?v(this.separator):""}
3
- </div>`}};t.styles=d`
3
+ </div>`}};a.styles=m`
4
4
 
5
5
  :host {
6
6
  display: block;
@@ -50,13 +50,12 @@ var a=function(n,e,o,s){var i=arguments.length,r=i<3?e:s===null?s=Object.getOwnP
50
50
  overflow-wrap: anywhere;
51
51
  }
52
52
 
53
-
54
53
  svg {
55
54
  color: var(
56
55
  --esp-breadcrumb-separator-color,
57
- oklch(from var(--esp-color-link) l c calc(h + 90))
56
+ color-mix(in oklch, var(--esp-breadcrumb-color, var(--esp-color-link)) 70%, transparent)
58
57
  );
59
- height: var(--esp-size-normal-to-medium);
60
- width: var(--esp-size-normal-to-medium);
58
+ height: var(--esp-breadcrumb-separator-size, var(--esp-size-normal-to-medium));
59
+ width: var(--esp-breadcrumb-separator-size, var(--esp-size-normal-to-medium));
61
60
  }
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};
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};
@@ -1,10 +1,10 @@
1
1
  import { type PropertyValues } from "lit";
2
2
  import { EspalierElementBase } from "../shared/esp-element-base.js";
3
+ import { type BreadcrumbSeparatorStyle, type BreadcrumbTrailEnd } from "./breadcrumb-separators.js";
3
4
  export * from "./esp-breadcrumb.js";
4
5
  /**
5
- * Used to display breadcrumb navigation. By default, the breadcrumbs
6
- * will be separated by right-arrows, with the final item having a
7
- * down-arrow after it.
6
+ * Displays breadcrumb navigation. By default, a filled right arrow separates
7
+ * crumbs and a filled down arrow follows the final crumb.
8
8
  * [esp-breadcrumb](/components/breadcrumbs/breadcrumb) instances
9
9
  * should be placed in the default slot to build out the navigation.
10
10
  *
@@ -48,7 +48,11 @@ export * from "./esp-breadcrumb.js";
48
48
  * </esp-breadcrumbs>
49
49
  * ```
50
50
  *
51
- * Custom separators can be specified in the `<esp-breadcrumb>`:
51
+ * Set `separator-style` to `arrow-filled`, `chevron`, `line-arrow`, `slash`,
52
+ * or `none`. Set `trail-end` independently to `arrow-down-filled`, `same`
53
+ * (use the between-crumb choice), or `none`. An unrecognized value uses the
54
+ * default for that setting. The `separator` attribute on an individual crumb
55
+ * overrides both settings for that crumb:
52
56
  *
53
57
  * ```html
54
58
  * <esp-breadcrumbs>
@@ -67,10 +71,9 @@ export * from "./esp-breadcrumb.js";
67
71
  * @customElement esp-breadcrumbs
68
72
  * @slot - `<esp-breadcrumb>` items to display.
69
73
  * @cssprop --esp-breadcrumb-separator-color - The color of the separator icons. Defaults to
70
- * `oklch(from var(--esp-color-link) l c calc(h + 90))`, an accent that takes the link ink's
71
- * scheme-adapted lightness and chroma at a different hue, so the arrows are their own color
72
- * rather than the heading color. Set it on `esp-breadcrumbs` to recolor a whole trail, or on
73
- * one `esp-breadcrumb` to recolor a single arrow.
74
+ * `color-mix(in oklch, var(--esp-breadcrumb-color, var(--esp-color-link)) 70%, transparent)`.
75
+ * Set it on `esp-breadcrumbs` to recolor a whole trail or on one `esp-breadcrumb`
76
+ * to recolor a single icon.
74
77
  *
75
78
  * ```html
76
79
  * <style>
@@ -104,7 +107,11 @@ export declare class EspalierBreadcrumbs extends EspalierElementBase {
104
107
  * Removing the attribute returns the name to `Breadcrumb`.
105
108
  */
106
109
  ariaLabel: string | null;
107
- protected firstUpdated(changedProperties: PropertyValues): void;
110
+ /** Separator between crumbs. Defaults to `arrow-filled`. */
111
+ separatorStyle: BreadcrumbSeparatorStyle | null;
112
+ /** Separator after the last crumb. Defaults to `arrow-down-filled`. */
113
+ trailEnd: BreadcrumbTrailEnd | null;
114
+ protected updated(changedProperties: PropertyValues): void;
108
115
  protected render(): import("lit-html").TemplateResult<1>;
109
116
  static styles: import("lit").CSSResult[];
110
117
  }
@@ -1,17 +1,20 @@
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">
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">
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>`,f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
5
+ </svg>`,x=`<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 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`
10
+ </svg>`;function d(l){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
11
+ stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
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`
11
14
  <nav aria-label=${this.ariaLabel??"Breadcrumb"}>
12
- <slot ${w(this.itemsSlot)} @slotchange=${this.assignSeparators}></slot>
15
+ <slot ${S(this.itemsSlot)} @slotchange=${this.assignSeparators}></slot>
13
16
  </nav>
14
- `}};l.styles=[...m.styles,h`
17
+ `}};a.styles=[...u.styles,v`
15
18
  nav {
16
19
  display: flex;
17
20
  flex-wrap: wrap;
@@ -19,4 +22,4 @@ var p=function(o,e,t,r){var a=arguments.length,s=a<3?e:r===null?r=Object.getOwnP
19
22
  gap: var(--esp-size-tiny-to-small);
20
23
  font-size: var(--esp-size-small-to-normal);
21
24
  }
22
- `],p([d({attribute:"aria-label",type:String})],l.prototype,"ariaLabel",void 0),l=p([v("esp-breadcrumbs")],l);export{l as EspalierBreadcrumbs};
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};
@@ -0,0 +1 @@
1
+ import{PAINT_INTERACTIONS as I,closestPaintElement as d,isPaintFocus as C,navigationPaintFlags as S,navigationPaintPlacement as y,navigationPaintState as g}from"../menu/navigation-paint.js";import{derivePaintLightness as v,parsePaintColor as p}from"../shared/paint-color.js";import{TOKEN_PAIRINGS as A}from"../shared/token-pairings.js";import{BUTTON_INTERACTION_LIGHTNESS_FACTOR as B}from"./action-state-lightness.js";const h="action-interaction-fill",b="button-focus-shadow",k=A.actionText.bg,P=({element:t,source:o})=>{const r=o==="fill"||o==="stroke";if(o!=="text"&&o!=="shadow"&&!r)return;const n=d(t,"[part=wrapper].esp-field:not(.incognito)"),e=n&&d(n,"esp-button"),c=n?.querySelector(":scope > [part=control]");if(!n||!e||!c||o==="shadow"&&t!==n||o==="text"&&!d(t,"[part=label]"))return;const l=d(e,"esp-menu-item"),f=!l&&d(e,"esp-footer");if(!(l&&d(e,"esp-header"))&&!f)return;const i=l?y(e):"inline",u=c.matches("[aria-current=page]"),a=c.matches("button:disabled"),s=!a&&n.matches(":hover"),m=!a&&n.matches(":focus-within"),x=s||m,N=u?s?"current-hover":"current":m?s?"hover-focus":"focus":s?"hover":"rest",w=f?"footer-action-button":"nav-button";return{element:r?`${w}-icon`:w,owner:c,state:()=>g(i,N),...o==="shadow"?{foregroundDerivations:[b],foregroundAliases:["shadow"]}:x?{backgroundDerivations:[h]}:{}}};function T(t,o=!1){const r=o?["footerActionButton"]:S(t),n=o?void 0:{kind:"button",...t==="inline"?{depth:"top-level"}:t==="inline-panel"?{depth:"nested"}:{}},e=o?"footer-action-button":"nav-button",c=o?[...r,"footerActionIcon"]:r,l=t==="inline"?"layer2":"layer1",f=I.flatMap(i=>{const u=g(t,i),a={element:e,foreground:"actionText",background:i==="rest"?k:h,state:u,kind:"text",flags:r,...n?{navigation:n}:{}},s={...a,element:`${e}-icon`,kind:"graphic",flags:c,...n?{navigation:{...n,icon:!0}}:{}};return C(i)?[a,s,{...a,foreground:b,background:l,kind:"ring",indicator:"blurred-shadow"}]:[a,s]});if(n)for(const i of["current","current-hover"]){const u={element:e,foreground:"actionText",background:i==="current"?k:h,state:g(t,i),kind:"text",flags:r,navigation:{...n,canBeCurrent:!0}};f.push(u,{...u,element:`${e}-icon`,kind:"graphic",navigation:{...n,canBeCurrent:!0,icon:!0}})}return f}const O={entriesByRole:{header:["inline","inline-panel","panel","full-screen"].flatMap(t=>T(t)),footer:T("inline",!0)},targets:{header:[P],footer:[P]},derivations:{[h]:t=>v(t.readColor("actionBackground"),o=>o*B),[b]:t=>{const o=t.readProperty("--esp-field-focus-shadow");if(o)return p(o);if(t.scheme==="light")return p(t.readColor("shadow")??"");const r=t.readProperty("--_esp-context-shadow");if(r)return p(r);const n=t.readProperty("--esp-l-ink")?.trim(),e=n?.endsWith("%")?Number(n.slice(0,-1))/100:Number(n);return n&&Number.isFinite(e)?v(t.readColor("primary"),()=>e):null}}};export{O as buttonPaintRegistration};
@@ -1,2 +1,2 @@
1
- import{encodeTheme as D,isObjectRecord as l,isSemanticColorName as P,validateThemePair as q}from"../shared/theme.js";import{THEME_FIT_ANCHOR_FIELDS as N,THEME_FIT_APCA_FIELDS as C,THEME_FIT_DATA_PALETTE_LINT_FIELDS as M,THEME_FIT_DATA_PALETTE_LINT_IDS as G,THEME_FIT_EXPLICIT_VALUES as X,THEME_FIT_LINT_FIELDS as R,THEME_FIT_LINT_IDS as Y,THEME_FIT_LINT_SEVERITIES as B,THEME_FIT_PAIRING_VALUES as Q,THEME_FIT_REPORT_FIELDS as _,THEME_FIT_SUITE_FIELDS as k,THEME_FIT_TOKEN_FIELDS as I,themeFitReportSuite as Z}from"../shared/theme-fit-report.js";import{COLOR_VISION_SIMULATIONS as v,DATA_SERIES_KEYS as x,isPaletteCollisionDescription as ee}from"../shared/data-colors.js";import{isSafeKey as te}from"../shared/unsafe-keys.js";const A="usage: espalier theme check <theme.json> [--json] [--expect <fit.json>] [--update-expect <fit.json>]";function Me(e,t){const[r,o,...n]=e;if(r!=="theme"||o!=="check")return t.error(A),2;const s=re(n,t);return s?oe(s,t):2}function re(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. ${A}`),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}". ${A}`),null}return r.file===""?(t.error(A),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. ${A}`),null):r}function ne(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 oe(e,t){const r=ne(e.file,t);if(!r)return 2;const o=q(D(r.light),D(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=Z(r.light,r.dark);for(const c of o.warnings)we(c,n)||t.error(`warning: ${c}`);const s=Ae(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(!ie(a))return t.error(`${e.expect} is not a fit-table suite \u2014 regenerate it with --update-expect ${e.expect}.`),2;const f=le(a,n);if(f.length>0){s>0&&xe(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):(Ie(n,s,t),s>0?1:0)}function ie(e){if(!l(e)||!k.every(({field:r,kind:o})=>T(e[String(r)],o)))return!1;const t=e;if(!w(t.surfaces))return!1;for(const r of["light","dark"]){const n=t.paletteLints[r].map(h);if(!w(n))return!1;const s=t[r],i=new Set;for(const c of s){if(!pe(c,r)||!t.surfaces.includes(c.surface)||i.has(c.surface))return!1;i.add(c.surface)}}return!0}function se(e){return typeof e=="number"&&Number.isFinite(e)}function ce(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function w(e){return new Set(e).size===e.length}function ae(e){return l(e)&&M.every(({field:t,kind:r})=>T(e[String(t)],r))}function fe(e){return l(e)&&R.every(({field:t,kind:r})=>T(e[String(t)],r))}function ue(e){return l(e)&&I.every(({field:t,kind:r})=>T(e[String(t)],r))}function T(e,t){switch(t){case"anchor":return e===void 0||H(e,N);case"anchor-record":return l(e)&&Object.keys(e).every(te)&&Object.values(e).every(r=>typeof r=="string");case"apca":return e===void 0||H(e,C);case"boolean":return typeof e=="boolean";case"data-palette-record":return l(e)?["light","dark"].every(r=>{const o=e[r];return l(o)&&x.every(n=>typeof o[n]=="string")}):!1;case"explicit":return e===void 0||X.includes(e);case"fit-lint-id":return Y.includes(e);case"lint-array":return Array.isArray(e)&&e.every(fe);case"message":case"string":return typeof e=="string";case"number":return se(e);case"pairing":return e===void 0||Q.includes(e);case"palette-lint-id":return G.includes(e);case"palette-lint-record":return l(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 P(e);case"semantic-array":return Array.isArray(e)&&e.every(P);case"series-pair":return de(e);case"simulation":return v.includes(e);case"string-array":return ce(e);case"token-array":return Array.isArray(e)&&e.every(ue);case"warning":return B.includes(e);default:{const r=t;return!1}}}function H(e,t){return l(e)&&t.every(({field:r,kind:o})=>T(e[String(r)],o))}function de(e){if(!Array.isArray(e)||e.length!==2)return!1;const t=x.indexOf(e[0]),r=x.indexOf(e[1]);return t>=0&&r>t}function pe(e,t){if(!l(e)||!_.every(({field:o,kind:n})=>T(e[String(o)],n)))return!1;const r=e;return r.scheme!==t?!1:w(r.tokens.map(o=>o.token))&&w(r.adjustedTokens)&&w(r.lints.map(o=>o.id))}function le(e,t){const r=[];for(const n of k)n.compared&&me(r,n,e,t);return(g(W(e))!==g(W(t))||r.length===0&&g(e)!==g(t))&&r.push("fit tables differ outside compared fields"),r}function me(e,t,r,o){const{field:n,kind:s}=t;if(s==="string-array"){const i=r[n],c=o[n];U(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 x)J(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"])ke(e,a,String(n),i[a],c[a]),E(e,`${a}/${String(n)}`,i[a].map(h),c[a].map(h));return}if(s==="report-array"&&(n==="light"||n==="dark")){ge(e,n,r[n],o[n]);return}F(e,"fit tables",String(n),r[n],o[n],s)}function ge(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 L(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}he(e,f,c,a)}}function he(e,t,r,o){for(const n of _){const{compared:s,field:i,kind:c}=n;if(!(!s||i==="scheme"||i==="surface")){if(c==="anchor-record"){Te(e,`${t}/${String(i)}`,r[i],o[i]);continue}if(c==="semantic-array"){const a=r[i],f=o[i];U(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];Se(e,t,String(i),a,f),E(e,`${t}/${String(i)}`,a.map(u=>u.id),f.map(u=>u.id));continue}if(c==="token-array"){$e(e,t,String(i),r[i],o[i]);continue}F(e,t,String(i),r[i],o[i],c)}}}function $e(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 L(s.keys(),i.keys())){const f=s.get(a),u=i.get(a),S=`${c}/${a}`;if(!f||!u){e.push(`${S}: token ${f?"removed":"added"}`);continue}ye(e,S,f,u)}}function ye(e,t,r,o){for(const{compared:n,field:s,kind:i}of I)if(!(!n||s==="token")){if(i==="anchor"){V(e,t,"anchor",r.anchor,o.anchor,N);continue}if(i==="apca"){V(e,t,"apca",r.apca,o.apca,C);continue}F(e,t,String(s),r[s],o[s],i)}}function V(e,t,r,o,n,s){const i=o,c=n;for(const{compared:a,field:f,kind:u}of s)a&&F(e,t,`${r}.${String(f)}`,i?.[f],c?.[f],u)}function Se(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 L(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:S,field:d,kind:b}of R)if(!(!S||d==="id")){if(b==="semantic-array"){Ee(e,u,String(d),a[d],f[d]);continue}F(e,u,String(d),a[d],f[d],b)}}}function ke(e,t,r,o,n){const s=new Map(o.map(c=>[h(c),c])),i=new Map(n.map(c=>[h(c),c]));for(const c of L(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:S,field:d,kind:b}of M)!S||d==="id"||d==="series"||d==="simulation"||F(e,u,String(d),a[d],f[d],b)}}function h(e){return`${e.id}/${e.series[0]}+${e.series[1]}/${e.simulation}`}function Te(e,t,r,o){for(const n of L(Object.keys(r),Object.keys(o)))J(e,`${t}/${n}`,r[n],o[n])}function U(e,t,r,o){const n=new Set(r),s=new Set(o);for(const i of L(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 Ee(e,t,r,o,n){const s=Math.max(o.length,n.length);for(let i=0;i<s;i+=1)K(e,t,`${r}[${i}]`,o[i],n[i])}function J(e,t,r,o){r!==o&&e.push(`${t}: ${j(r)} \u2192 ${j(o)}`)}function K(e,t,r,o,n,s){if(!Object.is(o,n)){if(s==="message"){e.push(`${t}: message changed`);return}e.push(`${t}: ${r} ${j(o)} \u2192 ${j(n)}`)}}function Fe(e,t,r,o,n){g(o)!==g(n)&&e.push(`${t}: ${r} changed`)}function F(e,t,r,o,n,s){if(_e(s)){K(e,t,r,o,n,s);return}Fe(e,t,r,o,n)}const Le={anchor:!1,"anchor-record":!1,apca:!1,boolean:!0,"data-palette-record":!1,explicit:!0,"fit-lint-id":!0,"lint-array":!1,message:!0,number:!0,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 _e(e){return Le[e]===!0}function j(e){return e===void 0?"(absent)":e===""?'""':String(e)}function L(e,t){return[...new Set([...e,...t])].sort()}function g(e){return Array.isArray(e)?`[${e.map(g).join(",")}]`:l(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${g(e[t])}`).join(",")}}`:JSON.stringify(e)??"undefined"}function W(e){const t=m(e,$(k)),r=["light","dark"];if(y(k,"dataPalette")){const o=m(e.dataPalette,r);for(const n of r)p(o,n,m(e.dataPalette[n],x));p(t,"dataPalette",o)}if(y(k,"paletteLints")){const o=m(e.paletteLints,r);for(const n of r)p(o,n,z(e.paletteLints[n],h,$(M)));p(t,"paletteLints",o)}for(const o of r){if(!y(k,o))continue;const n=O();for(const s of e[o]){const i=m(s,$(_));if(y(_,"tokens")){const c=O();for(const a of s.tokens){const f=m(a,$(I));a.anchor&&y(I,"anchor")&&p(f,"anchor",m(a.anchor,$(N))),a.apca&&y(I,"apca")&&p(f,"apca",m(a.apca,$(C))),p(c,a.token,f)}p(i,"tokens",c)}y(_,"lints")&&p(i,"lints",z(s.lints,c=>c.id,$(R))),p(n,s.surface,i)}p(t,o,n)}return t}function z(e,t,r){const o=O();for(const n of e)p(o,t(n),m(n,r));return o}function $(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 m(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 p(e,t,r){Object.keys(r).length>0&&(e[t]=r)}function Ie(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 xe(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/${h(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 Ae(e){return[...e.light,...e.dark].reduce((r,o)=>r+o.lints.length,0)+e.paletteLints.light.length+e.paletteLints.dark.length}function we(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=>ee(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{Me as runEspalierCli};
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};
@@ -4,25 +4,20 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
4
4
  import { type EspalierFormField } from "../form-item/esp-form-item.js";
5
5
  import { type PropertyValues } from "lit";
6
6
  import { type FontCategory, type FontPickerFont, type FontSource, type GoogleFont } from "./font-types.js";
7
+ import type { EspalierRoot } from "../root/esp-root.js";
7
8
  export { DEVICE_DEFAULT_WEIGHTS, SYSTEM_TEXT_WEIGHTS, WEB_SAFE_FONTS, type FontCategory, type FontPickerFont, type FontPickerValueChangedDetail, type FontSource, type GoogleFont, type WebSafeCategory, type WebSafeFont, } from "./font-types.js";
8
9
  /**
9
- * Load the font catalog from the build-generated `font-definitions.json`
10
- * file served alongside the font CSS files. The JSON is fetched from
11
- * `{fontCSSRoot}font-definitions.json` where `fontCSSRoot` comes from
12
- * the nearest `<esp-root>` element's `font-css-root` attribute.
13
- *
14
- * Results are cached at the module level so only one fetch occurs per page.
15
- * A failed request is not cached: it rejects every caller waiting on it,
16
- * and the next call retries.
10
+ * Load the catalog configured on `root`. With no argument, use the first
11
+ * light-DOM root. Callers sharing a catalog URL share its request and result.
12
+ * A failed request rejects all its callers and can be retried.
17
13
  */
18
- export declare const getGoogleFonts: () => Promise<Array<GoogleFont>>;
14
+ export declare const getGoogleFonts: (root?: EspalierRoot) => Promise<Array<GoogleFont>>;
19
15
  /**
20
- * Build the CSS `font-family` value used by picker items.
21
- * Consumers should reference this when setting `styles.fontFamily`
22
- * on picker items to match the preview `@font-face` name.
16
+ * Build the CSS family name used by picker items. Pass the picker's governing
17
+ * root to match its preview face when the page uses multiple font CSS sources.
23
18
  */
24
- export declare const previewFontFamily: (family: string) => string;
25
- export declare const getFontPreviewFamily: (font: FontPickerFont) => string;
19
+ export declare const previewFontFamily: (family: string, root?: EspalierRoot) => string;
20
+ export declare const getFontPreviewFamily: (font: FontPickerFont, root?: EspalierRoot) => string;
26
21
  /**
27
22
  * Font picker component backed by the Google Fonts catalog by default.
28
23
  *
@@ -134,6 +129,8 @@ export declare class EspalierFontPicker extends EspalierElementBase implements E
134
129
  protected getUpdateComplete(): Promise<boolean>;
135
130
  protected firstUpdated(_changedProperties: PropertyValues): void;
136
131
  protected updated(changedProperties: PropertyValues): void;
132
+ disconnectedCallback(): void;
133
+ protected governingRootChanged(root: EspalierRoot | null): void;
137
134
  protected render(): import("lit-html").TemplateResult<1>;
138
135
  }
139
136
  /**
@@ -1,9 +1,9 @@
1
- var h=function(e,t,o,i){var s=arguments.length,n=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,o,i);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(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"../pickers/esp-pick-one.js";import"../tooltip/esp-tooltip.js";import{customElement as x,property as y,state as A}from"lit/decorators.js";import{EspalierElementBase as T}from"../shared/esp-element-base.js";import{html as D}from"lit";import{extractFamily as L,getFallbackFont as N,removeRuntimeGoogleFontLink as B,removeRuntimeGoogleFontLinks as U,syncRuntimeGoogleFontLink as W}from"../shared/font-helpers.js";import{fontFallbackAliases as j}from"../shared/font-plan.js";import{customWebSafeFont as E,matchWebSafeFont as O}from"../shared/font-stacks.js";import{getIconHrefForHost as q}from"../shared/intent-values.js";import{WEB_SAFE_FONTS as I,isSystemPreset as b}from"./font-types.js";import{FormItemRelay as P}from"../shared/form-item-relay.js";import{DEVICE_DEFAULT_WEIGHTS as ut,SYSTEM_TEXT_WEIGHTS as dt,WEB_SAFE_FONTS as ht}from"./font-types.js";let F,m;const M=async()=>{const e=document.getElementsByTagName("esp-root")[0];if(!e)throw new Error("<esp-font-picker> requires an <esp-root> ancestor. Wrap your application in <esp-root> to use the font picker.");const t=e.fontDefinitionsUrl||`${e.fontCSSRoot}font-definitions.json`,o=await fetch(t);if(!o.ok)throw new Error(`Failed to load font definitions from ${t} (${o.status}). Run 'npm run build-fonts' to generate the font catalog.`);return await o.json()},z=async()=>{if(F)return F;if(!m){const e=M().then(t=>(F=t,t),t=>{throw m===e&&(m=void 0),t});m=e}return m},R="esp-preview-",H=e=>`${R}${e}`,g=new Map,v=async e=>{if(g.has(e))return!0;try{const t=document.getElementsByTagName("esp-root")[0];if(!t)return!1;const o=e.replaceAll(" ","-"),i=await fetch(`${t.fontCSSRoot}${o}.css`);if(!i.ok)return!1;let s=await i.text();s=s.replace(/font-family:\s*'([^']+)'/g,(a,l)=>`font-family: '${R}${l}'`);const n=document.createElement("style");return n.textContent=s,n.dataset.font=e,document.head.appendChild(n),g.set(e,n),!0}catch(t){return console.warn(`Failed to load CSS for font ${e}:`,t),!1}},w=e=>{const t=g.get(e);t&&(t.remove(),g.delete(e))},_=e=>e.closest("esp-root"),k=e=>_(e)?.correlationId??"",G=(e,t)=>`picker:${t}:${e}`,S=(e,t)=>{if(!t)return;const o=_(e),i=o?.correlationId??"";if(o?.googleFontLoading==="none"){p(e,t);return}W({owner:G(t,i),family:t,enabled:!0})},p=(e,t)=>{if(!t)return;const o=k(e);Array.from(document.getElementsByTagName("esp-font-picker")).some(s=>k(s)===o&&s.selectedGoogleFamily===t)||B(G(t,o))},d=e=>e.kind!=="web-safe",V="http://www.w3.org/2000/svg",X=(e,t)=>{const o=document.createElement("esp-tooltip");o.setAttribute("text",t==="device"?"Device font, no download":"Google font"),o.setAttribute("trigger-tabindex","-1"),o.setAttribute("style","display: grid; place-self: center;");const i=document.createElementNS(V,"svg");i.setAttribute("aria-hidden","true"),i.setAttribute("style","display: block; width: var(--esp-size-medium); height: var(--esp-size-medium); margin: var(--esp-size-tiny);");const s=document.createElementNS(V,"use");return s.setAttribute("href",q(t==="device"?"device-desktop":"brand-google",e)),i.append(s),o.append(i),o},C=e=>d(e)?e.family:e.stack,K=e=>{if(!d(e))return e.stack;const t=j(e.family,400,e.category);return[`"${e.family}"`,...t,`"${H(e.family)}"`,N(e.category)].join(", ")},$=(e,t)=>e.filter(o=>{switch(t){case"not-display":return o.category!=="display";default:return o.category===t}});let u=class extends T{constructor(){super(...arguments),this.loadedFonts=new Set,this.formItemRelay=new P(()=>this.shadowRoot?.querySelector("esp-pick-one")),this._rangeGeneration=0,this._initGeneration=0,this._fontsReady=Promise.resolve(),this.fonts=[],this.category=null,this.fontSource="google",this.value="",this.placeholder="Choose a font...",this.handleItemsInViewEvent=t=>{t.stopPropagation(),this.handleItemsInView(t.detail)}}focus(){this.shadowRoot?.querySelector("esp-pick-one")?.focus()}setFormItemDescription(t){this.formItemRelay.setDescription(t)}setFormItemLabel(t){this.formItemRelay.setLabel(t)}setFormItemInvalid(t){this.formItemRelay.setInvalid(t)}async getUpdateComplete(){const t=await super.getUpdateComplete();return await this._fontsReady,t}firstUpdated(t){super.firstUpdated(t),this._fontsReady=this.initFonts()}updated(t){super.updated(t),this.formItemRelay.apply();const o=t.has("fontSource")&&t.get("fontSource")!==void 0,i=t.has("category")&&t.get("category")!==void 0;if(o||i){if(o&&this.fontSource==="web-safe"){const s=this.value;for(const n of this.loadedFonts)w(n);this.loadedFonts.clear(),this.value="",s&&p(this,s)}this._fontsReady=this.initFonts()}if(t.has("value")&&this.value&&this.fontSource!=="web-safe"){const s=t.get("value"),n=this.googleFamilyFor(this.value),a=s?this.googleFamilyFor(s)??void 0:void 0;n&&s!==this.value?this.ensureFontLoaded(n,this.value,a):!n&&a&&p(this,a)}}get selectedGoogleFamily(){return this.fontSource==="web-safe"?null:this.googleFamilyFor(this.value)}googleFamilyFor(t){if(!t)return null;const o=this.fonts.filter(d);if(o.some(s=>s.family===t))return t;const i=L(t);return o.some(s=>s.family===i)?i:null}resolveSelection(){const t=this.value;if(!t||this.fonts.length===0)return{font:null,rowValue:t};const o=this.fontSource==="web-safe"?null:this.googleFamilyFor(t);if(o)return{font:this.fonts.find(l=>d(l)&&l.family===o)??null,rowValue:o};if(this.fontSource==="google")return{font:null,rowValue:t};const i=this.fonts.filter(a=>!d(a)),s=O(t,i);if(s)return{font:s,rowValue:s.stack};const n=E(t);return{font:n,rowValue:n?.stack??t}}async ensureFontLoaded(t,o,i){await v(t)&&this.loadedFonts.add(t),this.value===o&&(S(this,t),i&&i!==t&&p(this,i))}async initFonts(){const t=++this._initGeneration,o=this.fontSource,i=this.category?$(I,this.category):I;if(o==="web-safe"){this.fonts=i;return}const s=[...i.filter(b),...i.filter(f=>!b(f))];o==="all"&&(this.fonts=s);let n;try{n=await z()}catch(f){if(o!=="all")throw f;console.warn("esp-font-picker: the Google catalog is unavailable; listing device fonts only.",f);return}if(t!==this._initGeneration||this.fontSource!==o)return;const a=this.category?$(n,this.category):n;this.fonts=o==="all"?[...s,...a]:a;const l=this.value,c=this.googleFamilyFor(l);if(c){if(await v(c)){if(t!==this._initGeneration||this.fontSource!==o||this.value!==l){w(c);return}this.loadedFonts.add(c)}if(t!==this._initGeneration||this.fontSource!==o||this.value!==l)return;S(this,c)}}async handleItemsInView(t){if(this.fontSource==="web-safe")return;const o=++this._rangeGeneration,i=3,s=t.items??[],n=new Set,a=new Set(this.fonts.filter(d).map(r=>r.family)),l=Math.max(0,t.first),c=Math.min(t.last+i,s.length);for(let r=l;r<c;r++)a.has(s[r].value)&&n.add(s[r].value);for(const r of n)this.loadedFonts.has(r)||await v(r)&&this.loadedFonts.add(r);if(o!==this._rangeGeneration)return;const f=new Set(Array.from(document.getElementsByTagName("esp-font-picker")).map(r=>r.selectedGoogleFamily).filter(r=>!!r));for(const r of this.loadedFonts)f.has(r)||n.has(r)||(this.loadedFonts.delete(r),w(r))}render(){const t=this.resolveSelection(),o=this.fontSource==="all",s=[...t.font&&!this.fonts.includes(t.font)?[t.font]:[],...this.fonts].map(n=>({text:n.family,value:C(n),selected:t.font===n,styles:{fontFamily:K(n)},...o?{slotNodes:[X(this,d(n)?"google":"device")]}:{}}));return D`<esp-pick-one
1
+ var m=function(o,e,t,n){var s=arguments.length,r=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,e,t,n);else for(var a=o.length-1;a>=0;a--)(i=o[a])&&(r=(s<3?i(r):s>3?i(e,t,r):i(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r};import"../pickers/esp-pick-one.js";import"../tooltip/esp-tooltip.js";import{customElement as M,property as w,state as T}from"lit/decorators.js";import{EspalierElementBase as W}from"../shared/esp-element-base.js";import{html as U}from"lit";import{extractFamily as B,getFallbackFont as N,removeRuntimeGoogleFontLink as j,removeRuntimeGoogleFontLinks as z,syncRuntimeGoogleFontLink as H}from"../shared/font-helpers.js";import{fontFallbackAliases as X}from"../shared/font-plan.js";import{customWebSafeFont as G,matchWebSafeFont as K}from"../shared/font-stacks.js";import{getIconHrefForHost as Y}from"../shared/intent-values.js";import{WEB_SAFE_FONTS as P,isSystemPreset as $}from"./font-types.js";import{FormItemRelay as J}from"../shared/form-item-relay.js";import{governingRoot as p}from"../shared/governing-root.js";import{DEVICE_DEFAULT_WEIGHTS as ke,SYSTEM_TEXT_WEIGHTS as Re,WEB_SAFE_FONTS as be}from"./font-types.js";const F=new Map,A=o=>o.fontDefinitionsUrl||`${o.fontCSSRoot}font-definitions.json`;function y(o,e){try{const t=new URL(e,o.baseURI).href;return{configuredUrl:e,key:t,url:t}}catch{return{configuredUrl:e,key:`\0${e}`,url:null}}}function k(o){const e=o.ownerDocument;return{document:e,catalog:y(e,A(o)),previews:y(e,o.fontCSSRoot).key}}function R(o,e){return o?.document===e?.document&&o?.previews===e?.previews}const Q=async o=>{const e=await fetch(o);if(!e.ok)throw new Error(`Failed to load font definitions from ${o} (${e.status}). Run 'npm run build-fonts' to generate the font catalog.`);return await e.json()};async function x({configuredUrl:o,url:e}){if(!e)throw new TypeError(`Invalid font catalog URL: ${o}`);let t=F.get(e);return t||(t=Q(e).catch(n=>{throw F.get(e)===t&&F.delete(e),n}),F.set(e,t)),t}const Fe=async(o=document.getElementsByTagName("esp-root")[0])=>{if(!o)throw new Error("<esp-font-picker> requires an <esp-root> ancestor. Wrap your application in <esp-root> to use the font picker.");return x(y(o.ownerDocument,A(o)))},b="esp-preview-",v=new WeakMap,C=o=>{let e=v.get(o);return e||(e={prefixes:new Map,styles:new Map},v.set(o,e)),e},D=o=>{const{prefixes:e}=C(o.ownerDocument),t=y(o.ownerDocument,o.fontCSSRoot).key;let n=e.get(t);return n||(n=e.size?`${b}${e.size}-`:b,e.set(t,n)),n},Z=(o,e)=>`${e?D(e):b}${o}`,ee=(o,e)=>y(o.ownerDocument,`${o.fontCSSRoot}${e.replaceAll(" ","-")}.css`),te=async(o,e,t,n)=>{try{const s=await fetch(e);if(!s.ok)return null;const r=await s.text(),i=o.createElement("style");return i.dataset.font=t,i.textContent=r.replace(/font-family:\s*'([^']+)'/g,(a,f)=>`font-family: '${n}${f}'`),i}catch(s){return console.warn(`Failed to load CSS for font ${t}:`,s),null}},oe=(o,e,{key:t,url:n})=>{const s=o.ownerDocument,r=C(s);let i=r.styles.get(t);return i||(i={users:0,ready:(n?te(s,n,e,D(o)):Promise.resolve(null)).then(c=>v.get(s)!==r||r.styles.get(t)!==i?null:(c&&s.head.append(c),c))},r.styles.set(t,i)),i.users++,{cache:r,key:t,stylesheet:i}},V=({cache:o,key:e,stylesheet:t})=>{--t.users>0||(o.styles.delete(e),t.ready.then(n=>n?.remove()))},S=new WeakMap,d=o=>o.kind!=="web-safe",O="http://www.w3.org/2000/svg",ne=(o,e)=>{const t=document.createElement("esp-tooltip");t.setAttribute("text",e==="device"?"Device font, no download":"Google font"),t.setAttribute("trigger-tabindex","-1"),t.setAttribute("style","display: grid; place-self: center;");const n=document.createElementNS(O,"svg");n.setAttribute("aria-hidden","true"),n.setAttribute("style","display: block; width: var(--esp-size-medium); height: var(--esp-size-medium); margin: var(--esp-size-tiny);");const s=document.createElementNS(O,"use");return s.setAttribute("href",Y(e==="device"?"device-desktop":"brand-google",o)),n.append(s),t.append(n),t},L=o=>d(o)?o.family:o.stack,se=(o,e)=>{if(!d(o))return o.stack;const t=X(o.family,400,o.category);return[`"${o.family}"`,...t,`"${Z(o.family,e)}"`,N(o.category)].join(", ")},q=(o,e)=>o.filter(t=>{switch(e){case"not-display":return t.category!=="display";default:return t.category===e}});let h=class extends W{constructor(){super(...arguments),this.loadedFonts=new Map,this.fontAssets=null,this.formItemRelay=new J(()=>this.shadowRoot?.querySelector("esp-pick-one")),this._rangeGeneration=0,this._initGeneration=0,this._fontsReady=Promise.resolve(),this.fullFontOwner=null,this.fonts=[],this.category=null,this.fontSource="google",this.value="",this.placeholder="Choose a font...",this.handleItemsInViewEvent=e=>{e.stopPropagation(),this.handleItemsInView(e.detail)}}focus(){this.shadowRoot?.querySelector("esp-pick-one")?.focus()}setFormItemDescription(e){this.formItemRelay.setDescription(e)}setFormItemLabel(e){this.formItemRelay.setLabel(e)}setFormItemInvalid(e){this.formItemRelay.setInvalid(e)}async getUpdateComplete(){const e=await super.getUpdateComplete();return await this._fontsReady,e}firstUpdated(e){super.firstUpdated(e),this._fontsReady=this.initFonts()}updated(e){super.updated(e),this.formItemRelay.apply();const t=e.has("fontSource")&&e.get("fontSource")!==void 0,n=e.has("category")&&e.get("category")!==void 0;if((t||n)&&(t&&this.fontSource==="web-safe"&&(this.clearPreviewFonts(),this.value="",this.releaseFullFont()),this._fontsReady=this.initFonts()),e.has("value")){const s=this.selectedGoogleFamily;s?this.ensureFontLoaded(s):this.releaseFullFont()}}disconnectedCallback(){super.disconnectedCallback(),this.releaseFullFont()}governingRootChanged(e){if(!this.hasUpdated)return;if(!e&&!this.isConnected){this._initGeneration++,this.fontAssets=null,this.clearPreviewFonts(),this.releaseFullFont();return}const t=e?k(e):null,n=this.fontAssets?.catalog.key!==t?.catalog.key;n||this.syncSelectedFullFont(e),(n||!R(this.fontAssets,t))&&(this._fontsReady=this.initFonts(e))}clearPreviewFonts(){this._rangeGeneration++;for(const e of this.loadedFonts.values())V(e);this.loadedFonts.clear()}unloadPreviewFont(e){const t=this.loadedFonts.get(e);t&&(this.loadedFonts.delete(e),V(t))}async loadPreviewFont(e,t){const n=ee(e,t);let s=this.loadedFonts.get(t);(!s||s.key!==n.key||s.cache!==C(e.ownerDocument))&&(this.unloadPreviewFont(t),s=oe(e,t,n),this.loadedFonts.set(t,s)),!await s.stylesheet.ready&&this.loadedFonts.get(t)===s&&this.unloadPreviewFont(t)}syncSelectedFullFont(e=p(this)){const t=this.selectedGoogleFamily,n=this.isConnected&&e&&e.googleFontLoading!=="none"&&t?`picker:${e.correlationId}:${t}`:null,s=e?.ownerDocument;if((n!==this.fullFontOwner?.key||s!==this.fullFontOwner?.document)&&this.releaseFullFont(),!n||!t||!s)return;let r=S.get(s);r||(r=new Map,S.set(s,r));let i=r.get(n);i||(i=new Set,r.set(n,i)),i.add(this),this.fullFontOwner={document:s,key:n},H({owner:n,family:t,enabled:!0},s)}releaseFullFont(){if(!this.fullFontOwner)return;const{document:e,key:t}=this.fullFontOwner;this.fullFontOwner=null;const n=S.get(e),s=n?.get(t);s?.delete(this),!s?.size&&(n?.delete(t),j(t,e))}get selectedGoogleFamily(){return this.fontSource==="web-safe"?null:this.googleFamilyFor(this.value)}googleFamilyFor(e){if(!e)return null;const t=this.fonts.filter(d);if(t.some(s=>s.family===e))return e;const n=B(e);return t.some(s=>s.family===n)?n:null}resolveSelection(){const e=this.value;if(!e||this.fonts.length===0)return{font:null,rowValue:e};const t=this.fontSource==="web-safe"?null:this.googleFamilyFor(e);if(t)return{font:this.fonts.find(a=>d(a)&&a.family===t)??null,rowValue:t};if(this.fontSource==="google")return{font:null,rowValue:e};const n=this.fonts.filter(i=>!d(i)),s=K(e,n);if(s)return{font:s,rowValue:s.stack};const r=G(e);return{font:r,rowValue:r?.stack??e}}async ensureFontLoaded(e){const t=this.isConnected?p(this):null;t&&(this.syncSelectedFullFont(t),await this.loadPreviewFont(t,e))}async initFonts(e=this.isConnected?p(this):null){const t=++this._initGeneration,n=this.fontSource,s=this.category,r=s?q(P,s):P,i=n!=="web-safe"&&e?k(e):null,a=this.fontAssets,f=a?.catalog.key!==i?.catalog.key;if((!i||f||!R(a,i))&&this.clearPreviewFonts(),(!i||f||a?.document!==i.document)&&this.releaseFullFont(),this.fontAssets=i,n==="web-safe"){this.fonts=r;return}const c=[...r.filter($),...r.filter(g=>!$(g))];if(n==="all"?this.fonts=c:(!i||f)&&(this.fonts=[]),!i)return;const u=await x(i.catalog).then(g=>({fonts:g}),g=>({error:g})),l=this.isConnected?p(this):null;if(!l||t!==this._initGeneration||this.fontSource!==n||this.category!==s)return;const E=k(l);if(i.catalog.key!==E.catalog.key||!R(i,E))return this.initFonts(l);if("error"in u){if(n!=="all")throw u.error;console.warn("esp-font-picker: the Google catalog is unavailable; listing device fonts only.",u.error);return}const I=s?q(u.fonts,s):u.fonts;this.fonts=n==="all"?[...c,...I]:I;const _=this.selectedGoogleFamily;this.syncSelectedFullFont(l),_&&await this.loadPreviewFont(l,_)}async handleItemsInView(e){const t=p(this);if(this.fontSource==="web-safe"||!t)return;const n=++this._rangeGeneration,s=3,r=e.items??[],i=new Set,a=new Set(this.fonts.filter(d).map(l=>l.family)),f=Math.max(0,e.first),c=Math.min(e.last+s,r.length);for(let l=f;l<c;l++)a.has(r[l].value)&&i.add(r[l].value);for(const l of i){if(n!==this._rangeGeneration)return;await this.loadPreviewFont(t,l)}if(n!==this._rangeGeneration)return;const u=this.selectedGoogleFamily;for(const l of this.loadedFonts.keys())l===u||i.has(l)||this.unloadPreviewFont(l)}render(){const e=this.resolveSelection(),t=this.fontSource==="all",n=p(this),r=[...e.font&&!this.fonts.includes(e.font)?[e.font]:[],...this.fonts].map(i=>({text:i.family,value:L(i),selected:e.font===i,styles:{fontFamily:se(i,n??void 0)},...t?{slotNodes:[ne(this,d(i)?"google":"device")]}:{}}));return U`<esp-pick-one
2
2
  typeahead
3
- .pickerItems=${s}
4
- .value=${t.rowValue}
3
+ .pickerItems=${r}
4
+ .value=${e.rowValue}
5
5
  .placeholder=${this.placeholder}
6
6
  @esp-picker-menu-range-changed=${this.handleItemsInViewEvent}
7
- @esp-value-changed=${async n=>{n.stopPropagation();const a=this.value;if(!n.detail){const r=a?this.googleFamilyFor(a):null;this.value="",r&&p(this,r),this.emitValueChanged(void 0);return}const l=this.fonts.find(r=>C(r)===n.detail.value)??(this.fontSource==="all"?E(n.detail.value)??void 0:void 0),c=n.detail.value;this.value=c,this.emitValueChanged(l);const f=a?this.googleFamilyFor(a):null;if(f&&f!==c&&p(this,f),l&&d(l)){if(await v(c)&&this.loadedFonts.add(c),this.value!==c)return;S(this,c)}}}
7
+ @esp-value-changed=${i=>{if(i.stopPropagation(),!i.detail){this.value="",this.releaseFullFont(),this.emitValueChanged(void 0);return}const a=this.fonts.find(l=>L(l)===i.detail.value)??(this.fontSource==="all"?G(i.detail.value)??void 0:void 0),f=this.selectedGoogleFamily,c=i.detail.value;if(this.value=c,this.emitValueChanged(a),this.value!==c)return;const u=this.selectedGoogleFamily;u!==f&&this.releaseFullFont(),u&&this.ensureFontLoaded(u)}}
8
8
  >
9
- </esp-pick-one>`}};u.clearsFormItemErrorOnChange=!0,h([A()],u.prototype,"fonts",void 0),h([y({attribute:"category",type:String})],u.prototype,"category",void 0),h([y({attribute:"font-source",type:String})],u.prototype,"fontSource",void 0),h([y({type:String})],u.prototype,"value",void 0),h([y({type:String})],u.prototype,"placeholder",void 0),u=h([x("esp-font-picker")],u);const lt=()=>{F=void 0,m=void 0;for(const e of document.head.querySelectorAll("style[data-font]"))e.remove();g.clear(),U("picker:")};export{ut as DEVICE_DEFAULT_WEIGHTS,u as EspalierFontPicker,dt as SYSTEM_TEXT_WEIGHTS,ht as WEB_SAFE_FONTS,K as getFontPreviewFamily,z as getGoogleFonts,H as previewFontFamily,lt as resetFontCache};
9
+ </esp-pick-one>`}};h.clearsFormItemErrorOnChange=!0,m([T()],h.prototype,"fonts",void 0),m([w({attribute:"category",type:String})],h.prototype,"category",void 0),m([w({attribute:"font-source",type:String})],h.prototype,"fontSource",void 0),m([w({type:String})],h.prototype,"value",void 0),m([w({type:String})],h.prototype,"placeholder",void 0),h=m([M("esp-font-picker")],h);const we=()=>{F.clear(),v.delete(document);for(const o of document.head.querySelectorAll("style[data-font]"))o.remove();S.delete(document),z("picker:")};export{ke as DEVICE_DEFAULT_WEIGHTS,h as EspalierFontPicker,Re as SYSTEM_TEXT_WEIGHTS,be as WEB_SAFE_FONTS,se as getFontPreviewFamily,Fe as getGoogleFonts,Z as previewFontFamily,we as resetFontCache};
@@ -42,7 +42,7 @@ var n=function(a,e,r,o){var s=arguments.length,l=s<3?e:o===null?o=Object.getOwnP
42
42
  var(--_esp-font-body-effective, var(--esp-font-body, var(--_esp-font-body-fallback)))
43
43
  )
44
44
  );
45
- font-size: var(--esp-type-normal);
45
+ font-size: var(--esp-footer-heading-font-size, var(--esp-type-normal));
46
46
  font-weight: var(--esp-font-weight-headings);
47
47
  line-height: 1.25;
48
48
  overflow-wrap: anywhere;
@@ -214,7 +214,12 @@ import "./esp-footer-link-group.js";
214
214
  * @cssprop --esp-footer-background - Base footer color. Defaults to `var(--esp-color-layer-2)`.
215
215
  * @cssprop --esp-footer-color - Body text color. Defaults to `var(--esp-color-text)`.
216
216
  * @cssprop --esp-footer-heading-color - Heading and configured-brand color. Defaults to `var(--esp-color-headings)`.
217
+ * @cssprop --esp-footer-heading-size - Size step for link-group headings and slotted `h2` headings: `small`, `normal`, `medium`, `big`, or `large`. Defaults to `normal`.
218
+ * @cssprop --esp-footer-heading-font-size - Font size derived from the authored heading step. Defaults to `var(--esp-type-normal)`.
217
219
  * @cssprop --esp-footer-link-color - Link color. Defaults to `var(--esp-color-link)`.
220
+ * @cssprop --esp-footer-link-decoration - Resting decoration of bare footer links and the configured brand link: `none` or `underline`. Bare links default to `underline` and the brand defaults to `none`. All supported links underline on hover.
221
+ * @cssprop --esp-footer-link-underline-offset - Underline offset of supported links, from `0em` to `0.5em`. Defaults to `0.18em` for group links and brand hover, and `auto` elsewhere.
222
+ * @cssprop --esp-footer-link-underline-thickness - Underline thickness of supported links, from `0em` to `0.2em` or `auto`. Defaults to `auto`.
218
223
  * @cssprop --esp-footer-link-hover-color - Hovered link color. Defaults to `var(--esp-color-link-hover)`.
219
224
  * @cssprop --esp-footer-link-hover-bg - Hovered link background. Defaults to `var(--esp-color-link-hover-bg)`.
220
225
  * @cssprop --esp-footer-focus-outline - Focus-visible outline for footer links. Defaults to `2px solid var(--esp-footer-link-color, var(--esp-color-link))`.
@@ -1,4 +1,4 @@
1
- var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,a):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(p,e,a,r);else for(var d=p.length-1;d>=0;d--)(s=p[d])&&(l=(o<3?s(l):o>3?s(e,a,l):s(e,a))||l);return o>3&&l&&Object.defineProperty(e,a,l),l};import{FooterAlignmentController as f,footerAlignmentStyles as k}from"../shared/footer-alignment.js";import{FooterLogoGeometryController as x,footerNaturalLogoStyles as A,normalizeFooterLogoSizing as v}from"../shared/footer-logo-geometry.js";import{paintedSurface as y}from"../shared/surface-layer.js";import{css as S,html as w,nothing as B}from"lit";import{customElement as _,property as i,state as z}from"lit/decorators.js";import{styleMap as g}from"lit/directives/style-map.js";import{CONFIGURED_BRAND_LOGO_ASPECT_RATIO as T,configuredBrandLogoGeometry as W,renderConfiguredBrand as C,resolveConfiguredBrand as I}from"../shared/configured-brand.js";import{syncNormalizedAttribute as c}from"../shared/attribute-helpers.js";import{EspalierElementBase as b}from"../shared/esp-element-base.js";import{slotHasContent as m}from"../shared/slot-content.js";import{renderVisualOverlay as L,visualOverlayStyles as $}from"../shared/visual-overlay.js";import"./esp-footer-column.js";import"./esp-footer-link-group.js";const u={media:!1,brand:!1,groups:!1,aside:!1,bottom:!1};let t=class extends b{get layout(){return this.alignment.layout}constructor(){super(),this.alignment=new f(this,"footer"),this.brandLogoSizingBacker="fixed",this.slotContent={...u},this.brandText="",this.brandLogo="",this.lightBrandLogo="",this.darkBrandLogo="",this.brandHref="",this.brandAlt="",this.brandColor="",this.lightBrandColor="",this.darkBrandColor="",this.brandSpanBacker=1,this.asideSpanBacker=1,this.fullBleedContent=!1,this.landmarkLabel="",this.handleSlotChange=e=>{if(!(e.target instanceof HTMLSlotElement))return;const a=this.slotRegion(e.target);if(!a)return;const r=m(e.target);this.slotContent[a]!==r&&(this.slotContent={...this.slotContent,[a]:r})},new x(this,()=>({sizing:this.brandLogoSizing,scheme:this.scheme,lightSource:this.lightBrandLogo||this.brandLogo,darkSource:this.darkBrandLogo||this.brandLogo}))}get inlineAlign(){return this.alignment.get("inline-align")}set inlineAlign(e){this.alignment.set("inlineAlign","inline-align",e,"placement")}get inlineAlignWrapped(){return this.alignment.get("inline-align-wrapped")}set inlineAlignWrapped(e){this.alignment.set("inlineAlignWrapped","inline-align-wrapped",e,"placement")}get inlineAlignStacked(){return this.alignment.get("inline-align-stacked")}set inlineAlignStacked(e){this.alignment.set("inlineAlignStacked","inline-align-stacked",e,"placement")}get blockAlign(){return this.alignment.get("block-align")}set blockAlign(e){this.alignment.set("blockAlign","block-align",e,"placement")}get blockAlignWrapped(){return this.alignment.get("block-align-wrapped")}set blockAlignWrapped(e){this.alignment.set("blockAlignWrapped","block-align-wrapped",e,"placement")}get blockAlignStacked(){return this.alignment.get("block-align-stacked")}set blockAlignStacked(e){this.alignment.set("blockAlignStacked","block-align-stacked",e,"placement")}get textAlign(){return this.alignment.get("text-align")}set textAlign(e){this.alignment.set("textAlign","text-align",e,"text")}get textAlignWrapped(){return this.alignment.get("text-align-wrapped")}set textAlignWrapped(e){this.alignment.set("textAlignWrapped","text-align-wrapped",e,"text")}get textAlignStacked(){return this.alignment.get("text-align-stacked")}set textAlignStacked(e){this.alignment.set("textAlignStacked","text-align-stacked",e,"text")}get brandInlineAlign(){return this.alignment.get("brand-inline-align")}set brandInlineAlign(e){this.alignment.set("brandInlineAlign","brand-inline-align",e,"placement")}get brandInlineAlignWrapped(){return this.alignment.get("brand-inline-align-wrapped")}set brandInlineAlignWrapped(e){this.alignment.set("brandInlineAlignWrapped","brand-inline-align-wrapped",e,"placement")}get brandInlineAlignStacked(){return this.alignment.get("brand-inline-align-stacked")}set brandInlineAlignStacked(e){this.alignment.set("brandInlineAlignStacked","brand-inline-align-stacked",e,"placement")}get brandBlockAlign(){return this.alignment.get("brand-block-align")}set brandBlockAlign(e){this.alignment.set("brandBlockAlign","brand-block-align",e,"placement")}get brandBlockAlignWrapped(){return this.alignment.get("brand-block-align-wrapped")}set brandBlockAlignWrapped(e){this.alignment.set("brandBlockAlignWrapped","brand-block-align-wrapped",e,"placement")}get brandBlockAlignStacked(){return this.alignment.get("brand-block-align-stacked")}set brandBlockAlignStacked(e){this.alignment.set("brandBlockAlignStacked","brand-block-align-stacked",e,"placement")}get brandTextAlign(){return this.alignment.get("brand-text-align")}set brandTextAlign(e){this.alignment.set("brandTextAlign","brand-text-align",e,"text")}get brandTextAlignWrapped(){return this.alignment.get("brand-text-align-wrapped")}set brandTextAlignWrapped(e){this.alignment.set("brandTextAlignWrapped","brand-text-align-wrapped",e,"text")}get brandTextAlignStacked(){return this.alignment.get("brand-text-align-stacked")}set brandTextAlignStacked(e){this.alignment.set("brandTextAlignStacked","brand-text-align-stacked",e,"text")}get asideInlineAlign(){return this.alignment.get("aside-inline-align")}set asideInlineAlign(e){this.alignment.set("asideInlineAlign","aside-inline-align",e,"placement")}get asideInlineAlignWrapped(){return this.alignment.get("aside-inline-align-wrapped")}set asideInlineAlignWrapped(e){this.alignment.set("asideInlineAlignWrapped","aside-inline-align-wrapped",e,"placement")}get asideInlineAlignStacked(){return this.alignment.get("aside-inline-align-stacked")}set asideInlineAlignStacked(e){this.alignment.set("asideInlineAlignStacked","aside-inline-align-stacked",e,"placement")}get asideBlockAlign(){return this.alignment.get("aside-block-align")}set asideBlockAlign(e){this.alignment.set("asideBlockAlign","aside-block-align",e,"placement")}get asideBlockAlignWrapped(){return this.alignment.get("aside-block-align-wrapped")}set asideBlockAlignWrapped(e){this.alignment.set("asideBlockAlignWrapped","aside-block-align-wrapped",e,"placement")}get asideBlockAlignStacked(){return this.alignment.get("aside-block-align-stacked")}set asideBlockAlignStacked(e){this.alignment.set("asideBlockAlignStacked","aside-block-align-stacked",e,"placement")}get asideTextAlign(){return this.alignment.get("aside-text-align")}set asideTextAlign(e){this.alignment.set("asideTextAlign","aside-text-align",e,"text")}get asideTextAlignWrapped(){return this.alignment.get("aside-text-align-wrapped")}set asideTextAlignWrapped(e){this.alignment.set("asideTextAlignWrapped","aside-text-align-wrapped",e,"text")}get asideTextAlignStacked(){return this.alignment.get("aside-text-align-stacked")}set asideTextAlignStacked(e){this.alignment.set("asideTextAlignStacked","aside-text-align-stacked",e,"text")}get bottomInlineAlign(){return this.alignment.get("bottom-inline-align")}set bottomInlineAlign(e){this.alignment.set("bottomInlineAlign","bottom-inline-align",e,"placement")}get bottomInlineAlignWrapped(){return this.alignment.get("bottom-inline-align-wrapped")}set bottomInlineAlignWrapped(e){this.alignment.set("bottomInlineAlignWrapped","bottom-inline-align-wrapped",e,"placement")}get bottomInlineAlignStacked(){return this.alignment.get("bottom-inline-align-stacked")}set bottomInlineAlignStacked(e){this.alignment.set("bottomInlineAlignStacked","bottom-inline-align-stacked",e,"placement")}get bottomTextAlign(){return this.alignment.get("bottom-text-align")}set bottomTextAlign(e){this.alignment.set("bottomTextAlign","bottom-text-align",e,"text")}get bottomTextAlignWrapped(){return this.alignment.get("bottom-text-align-wrapped")}set bottomTextAlignWrapped(e){this.alignment.set("bottomTextAlignWrapped","bottom-text-align-wrapped",e,"text")}get bottomTextAlignStacked(){return this.alignment.get("bottom-text-align-stacked")}set bottomTextAlignStacked(e){this.alignment.set("bottomTextAlignStacked","bottom-text-align-stacked",e,"text")}get brandLogoSizing(){return this.brandLogoSizingBacker}set brandLogoSizing(e){const a=this.brandLogoSizingBacker;this.brandLogoSizingBacker=v(e),this.requestUpdate("brandLogoSizing",this.hasAttribute("brand-logo-sizing")?a:void 0),c(this,"brand-logo-sizing",this.brandLogoSizingBacker)}get brandSpan(){return this.brandSpanBacker}set brandSpan(e){const a=this.brandSpanBacker;this.brandSpanBacker=Number.isInteger(e)&&e>=1&&e<=3?e:1,this.requestUpdate("brandSpan",this.hasAttribute("brand-span")?a:void 0),c(this,"brand-span",String(this.brandSpanBacker))}get asideSpan(){return this.asideSpanBacker}set asideSpan(e){const a=this.asideSpanBacker;this.asideSpanBacker=Number.isInteger(e)&&e>=1&&e<=2?e:1,this.requestUpdate("asideSpan",this.hasAttribute("aside-span")?a:void 0),c(this,"aside-span",String(this.asideSpanBacker))}slotRegion(e){return e.name?["media","brand","aside","bottom"].includes(e.name)?e.name:null:"groups"}firstUpdated(e){super.firstUpdated(e);const a={...u};for(const r of this.shadowRoot?.querySelectorAll("slot")??[]){const o=this.slotRegion(r);o&&(a[o]=m(r))}Object.entries(a).some(([r,o])=>this.slotContent[r]!==o)&&(this.slotContent=a)}render(){const{media:e,brand:a,groups:r,aside:o,bottom:l}=this.slotContent,s=I({scheme:this.scheme,brandLogo:this.brandLogo,brandColor:this.brandColor,lightBrandLogo:this.lightBrandLogo,darkBrandLogo:this.darkBrandLogo,lightBrandColor:this.lightBrandColor,darkBrandColor:this.darkBrandColor}),d=a||!!(s.brandLogo||this.brandText),h=d||r||o;return w`
1
+ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,a):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(p,e,a,r);else for(var d=p.length-1;d>=0;d--)(s=p[d])&&(l=(o<3?s(l):o>3?s(e,a,l):s(e,a))||l);return o>3&&l&&Object.defineProperty(e,a,l),l};import{FooterAlignmentController as h,footerAlignmentStyles as k}from"../shared/footer-alignment.js";import{FooterLogoGeometryController as x,footerNaturalLogoStyles as A,normalizeFooterLogoSizing as v}from"../shared/footer-logo-geometry.js";import{paintedSurface as y}from"../shared/surface-layer.js";import{css as S,html as w,nothing as B}from"lit";import{customElement as _,property as i,state as z}from"lit/decorators.js";import{styleMap as g}from"lit/directives/style-map.js";import{CONFIGURED_BRAND_LOGO_ASPECT_RATIO as T,configuredBrandLogoGeometry as W,renderConfiguredBrand as C,resolveConfiguredBrand as I}from"../shared/configured-brand.js";import{syncNormalizedAttribute as c}from"../shared/attribute-helpers.js";import{EspalierElementBase as b}from"../shared/esp-element-base.js";import{slotHasContent as m}from"../shared/slot-content.js";import{renderVisualOverlay as L,visualOverlayStyles as $}from"../shared/visual-overlay.js";import"./esp-footer-column.js";import"./esp-footer-link-group.js";const u={media:!1,brand:!1,groups:!1,aside:!1,bottom:!1};let t=class extends b{get layout(){return this.alignment.layout}constructor(){super(),this.alignment=new h(this,"footer"),this.brandLogoSizingBacker="fixed",this.slotContent={...u},this.brandText="",this.brandLogo="",this.lightBrandLogo="",this.darkBrandLogo="",this.brandHref="",this.brandAlt="",this.brandColor="",this.lightBrandColor="",this.darkBrandColor="",this.brandSpanBacker=1,this.asideSpanBacker=1,this.fullBleedContent=!1,this.landmarkLabel="",this.handleSlotChange=e=>{if(!(e.target instanceof HTMLSlotElement))return;const a=this.slotRegion(e.target);if(!a)return;const r=m(e.target);this.slotContent[a]!==r&&(this.slotContent={...this.slotContent,[a]:r})},new x(this,()=>({sizing:this.brandLogoSizing,scheme:this.scheme,lightSource:this.lightBrandLogo||this.brandLogo,darkSource:this.darkBrandLogo||this.brandLogo}))}get inlineAlign(){return this.alignment.get("inline-align")}set inlineAlign(e){this.alignment.set("inlineAlign","inline-align",e,"placement")}get inlineAlignWrapped(){return this.alignment.get("inline-align-wrapped")}set inlineAlignWrapped(e){this.alignment.set("inlineAlignWrapped","inline-align-wrapped",e,"placement")}get inlineAlignStacked(){return this.alignment.get("inline-align-stacked")}set inlineAlignStacked(e){this.alignment.set("inlineAlignStacked","inline-align-stacked",e,"placement")}get blockAlign(){return this.alignment.get("block-align")}set blockAlign(e){this.alignment.set("blockAlign","block-align",e,"placement")}get blockAlignWrapped(){return this.alignment.get("block-align-wrapped")}set blockAlignWrapped(e){this.alignment.set("blockAlignWrapped","block-align-wrapped",e,"placement")}get blockAlignStacked(){return this.alignment.get("block-align-stacked")}set blockAlignStacked(e){this.alignment.set("blockAlignStacked","block-align-stacked",e,"placement")}get textAlign(){return this.alignment.get("text-align")}set textAlign(e){this.alignment.set("textAlign","text-align",e,"text")}get textAlignWrapped(){return this.alignment.get("text-align-wrapped")}set textAlignWrapped(e){this.alignment.set("textAlignWrapped","text-align-wrapped",e,"text")}get textAlignStacked(){return this.alignment.get("text-align-stacked")}set textAlignStacked(e){this.alignment.set("textAlignStacked","text-align-stacked",e,"text")}get brandInlineAlign(){return this.alignment.get("brand-inline-align")}set brandInlineAlign(e){this.alignment.set("brandInlineAlign","brand-inline-align",e,"placement")}get brandInlineAlignWrapped(){return this.alignment.get("brand-inline-align-wrapped")}set brandInlineAlignWrapped(e){this.alignment.set("brandInlineAlignWrapped","brand-inline-align-wrapped",e,"placement")}get brandInlineAlignStacked(){return this.alignment.get("brand-inline-align-stacked")}set brandInlineAlignStacked(e){this.alignment.set("brandInlineAlignStacked","brand-inline-align-stacked",e,"placement")}get brandBlockAlign(){return this.alignment.get("brand-block-align")}set brandBlockAlign(e){this.alignment.set("brandBlockAlign","brand-block-align",e,"placement")}get brandBlockAlignWrapped(){return this.alignment.get("brand-block-align-wrapped")}set brandBlockAlignWrapped(e){this.alignment.set("brandBlockAlignWrapped","brand-block-align-wrapped",e,"placement")}get brandBlockAlignStacked(){return this.alignment.get("brand-block-align-stacked")}set brandBlockAlignStacked(e){this.alignment.set("brandBlockAlignStacked","brand-block-align-stacked",e,"placement")}get brandTextAlign(){return this.alignment.get("brand-text-align")}set brandTextAlign(e){this.alignment.set("brandTextAlign","brand-text-align",e,"text")}get brandTextAlignWrapped(){return this.alignment.get("brand-text-align-wrapped")}set brandTextAlignWrapped(e){this.alignment.set("brandTextAlignWrapped","brand-text-align-wrapped",e,"text")}get brandTextAlignStacked(){return this.alignment.get("brand-text-align-stacked")}set brandTextAlignStacked(e){this.alignment.set("brandTextAlignStacked","brand-text-align-stacked",e,"text")}get asideInlineAlign(){return this.alignment.get("aside-inline-align")}set asideInlineAlign(e){this.alignment.set("asideInlineAlign","aside-inline-align",e,"placement")}get asideInlineAlignWrapped(){return this.alignment.get("aside-inline-align-wrapped")}set asideInlineAlignWrapped(e){this.alignment.set("asideInlineAlignWrapped","aside-inline-align-wrapped",e,"placement")}get asideInlineAlignStacked(){return this.alignment.get("aside-inline-align-stacked")}set asideInlineAlignStacked(e){this.alignment.set("asideInlineAlignStacked","aside-inline-align-stacked",e,"placement")}get asideBlockAlign(){return this.alignment.get("aside-block-align")}set asideBlockAlign(e){this.alignment.set("asideBlockAlign","aside-block-align",e,"placement")}get asideBlockAlignWrapped(){return this.alignment.get("aside-block-align-wrapped")}set asideBlockAlignWrapped(e){this.alignment.set("asideBlockAlignWrapped","aside-block-align-wrapped",e,"placement")}get asideBlockAlignStacked(){return this.alignment.get("aside-block-align-stacked")}set asideBlockAlignStacked(e){this.alignment.set("asideBlockAlignStacked","aside-block-align-stacked",e,"placement")}get asideTextAlign(){return this.alignment.get("aside-text-align")}set asideTextAlign(e){this.alignment.set("asideTextAlign","aside-text-align",e,"text")}get asideTextAlignWrapped(){return this.alignment.get("aside-text-align-wrapped")}set asideTextAlignWrapped(e){this.alignment.set("asideTextAlignWrapped","aside-text-align-wrapped",e,"text")}get asideTextAlignStacked(){return this.alignment.get("aside-text-align-stacked")}set asideTextAlignStacked(e){this.alignment.set("asideTextAlignStacked","aside-text-align-stacked",e,"text")}get bottomInlineAlign(){return this.alignment.get("bottom-inline-align")}set bottomInlineAlign(e){this.alignment.set("bottomInlineAlign","bottom-inline-align",e,"placement")}get bottomInlineAlignWrapped(){return this.alignment.get("bottom-inline-align-wrapped")}set bottomInlineAlignWrapped(e){this.alignment.set("bottomInlineAlignWrapped","bottom-inline-align-wrapped",e,"placement")}get bottomInlineAlignStacked(){return this.alignment.get("bottom-inline-align-stacked")}set bottomInlineAlignStacked(e){this.alignment.set("bottomInlineAlignStacked","bottom-inline-align-stacked",e,"placement")}get bottomTextAlign(){return this.alignment.get("bottom-text-align")}set bottomTextAlign(e){this.alignment.set("bottomTextAlign","bottom-text-align",e,"text")}get bottomTextAlignWrapped(){return this.alignment.get("bottom-text-align-wrapped")}set bottomTextAlignWrapped(e){this.alignment.set("bottomTextAlignWrapped","bottom-text-align-wrapped",e,"text")}get bottomTextAlignStacked(){return this.alignment.get("bottom-text-align-stacked")}set bottomTextAlignStacked(e){this.alignment.set("bottomTextAlignStacked","bottom-text-align-stacked",e,"text")}get brandLogoSizing(){return this.brandLogoSizingBacker}set brandLogoSizing(e){const a=this.brandLogoSizingBacker;this.brandLogoSizingBacker=v(e),this.requestUpdate("brandLogoSizing",this.hasAttribute("brand-logo-sizing")?a:void 0),c(this,"brand-logo-sizing",this.brandLogoSizingBacker)}get brandSpan(){return this.brandSpanBacker}set brandSpan(e){const a=this.brandSpanBacker;this.brandSpanBacker=Number.isInteger(e)&&e>=1&&e<=3?e:1,this.requestUpdate("brandSpan",this.hasAttribute("brand-span")?a:void 0),c(this,"brand-span",String(this.brandSpanBacker))}get asideSpan(){return this.asideSpanBacker}set asideSpan(e){const a=this.asideSpanBacker;this.asideSpanBacker=Number.isInteger(e)&&e>=1&&e<=2?e:1,this.requestUpdate("asideSpan",this.hasAttribute("aside-span")?a:void 0),c(this,"aside-span",String(this.asideSpanBacker))}slotRegion(e){return e.name?["media","brand","aside","bottom"].includes(e.name)?e.name:null:"groups"}firstUpdated(e){super.firstUpdated(e);const a={...u};for(const r of this.shadowRoot?.querySelectorAll("slot")??[]){const o=this.slotRegion(r);o&&(a[o]=m(r))}Object.entries(a).some(([r,o])=>this.slotContent[r]!==o)&&(this.slotContent=a)}render(){const{media:e,brand:a,groups:r,aside:o,bottom:l}=this.slotContent,s=I({scheme:this.scheme,brandLogo:this.brandLogo,brandColor:this.brandColor,lightBrandLogo:this.lightBrandLogo,darkBrandLogo:this.darkBrandLogo,lightBrandColor:this.lightBrandColor,darkBrandColor:this.darkBrandColor}),d=a||!!(s.brandLogo||this.brandText),f=d||r||o;return w`
2
2
  <footer
3
3
  part="footer"
4
4
  aria-label=${this.landmarkLabel||B}
@@ -13,7 +13,7 @@ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnP
13
13
  <slot name="media" @slotchange=${this.handleSlotChange}></slot>
14
14
  </div>
15
15
 
16
- <div part="primary" class="primary" ?hidden=${!h}>
16
+ <div part="primary" class="primary" ?hidden=${!f}>
17
17
  <div
18
18
  part="brand"
19
19
  class="brand alignment-scope"
@@ -233,11 +233,17 @@ var n=function(p,e,a,r){var o=arguments.length,l=o<3?e:r===null?r=Object.getOwnP
233
233
  text-decoration: none;
234
234
  }
235
235
 
236
+ a.configured-brand {
237
+ text-decoration-line: var(--esp-footer-link-decoration, none);
238
+ text-underline-offset: var(--esp-footer-link-underline-offset, auto);
239
+ text-decoration-thickness: var(--esp-footer-link-underline-thickness, auto);
240
+ }
241
+
236
242
  a.configured-brand:hover {
237
243
  background: var(--esp-footer-link-hover-bg, var(--esp-color-link-hover-bg));
238
244
  color: var(--esp-footer-link-hover-color, var(--esp-color-link-hover));
239
- text-decoration: underline;
240
- text-underline-offset: 0.18em;
245
+ text-decoration-line: underline;
246
+ text-underline-offset: var(--esp-footer-link-underline-offset, 0.18em);
241
247
  }
242
248
 
243
249
  a.configured-brand:focus-visible {
@@ -0,0 +1 @@
1
+ import{PAINT_INTERACTIONS as d,closestPaintElement as i,configuredBrandColor as l,isPaintFocus as c,isPaintHover as u}from"../menu/navigation-paint.js";import{TOKEN_PAIRINGS as g}from"../shared/token-pairings.js";const b=({element:e,source:o})=>{const t=i(e,".brand .configured-brand");if(!(!t||!i(t,"esp-footer"))){if(o==="outline"&&e===t&&t.matches("a[href]"))return{element:"brand-link",owner:t};if(o==="text"&&i(e,".brand-text"))return{element:"brand-text",owner:t,...t.matches("a[href]")?{}:{state:()=>"rest"},...t.matches("a[href]:hover")?{}:{brandColor:l(t,"--_esp-footer-brand-color")}}}};function k(e){const o=e.ownerDocument,t=o.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=o.createRange();for(let r=t.nextNode();r;r=t.nextNode()){const a=r.parentElement;if(!(!a||!r.textContent?.trim()||a.closest("svg, [hidden], .sr-only"))&&o.defaultView?.getComputedStyle(a).visibility==="visible"&&(n.selectNodeContents(r),Array.from(n.getClientRects()).some(({width:s,height:f})=>s>0&&f>0)))return!0}return!1}const h=({element:e,source:o})=>{if(!i(e,"esp-footer")||i(e,"esp-button"))return;const t=i(e,"a[href]");if(t&&!t.classList.contains("configured-brand")&&(o==="text"||o==="outline"&&e===t&&k(t)))return{element:"footer-link",owner:t};if(o!=="text")return;const n=i(e,"h1, h2, h3, h4, h5, h6");if(n)return{element:"footer-heading",owner:n,state:()=>"rest"};if(i(e,".aside, .bottom, esp-footer-link-group"))return{element:"footer-body",owner:e,state:()=>"rest"}},x=g.linkHover.bg,y={entriesByRole:{footer:[{element:"footer-heading",foreground:"headings",background:"layer2",state:"rest",kind:"text",flags:["footerHeadings"]},{element:"footer-body",foreground:"text",background:"layer2",state:"rest",kind:"text",flags:["footerBody"]},...d.flatMap(e=>{const o=u(e),t=c(e),n={foreground:o?"linkHover":"link",background:o?x:"layer2",state:e,kind:"text"},r=[{...n,element:"footer-link",flags:["footerLinks"]},{...n,element:"brand-text",foreground:o?"linkHover":"brand-color",flags:e==="rest"?["brandText"]:["brandText","brandLink"]}];if(t)for(const[a,s]of[["footer-link","footerLinks"],["brand-link","brandLink"]])r.push({element:a,foreground:"link",background:"layer2",state:e,kind:"ring",flags:[s]});return r})]},targets:{footer:[b,h]}};export{y as footerPaintRegistration};