@taprootio/espalier 7.3.0 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/custom-elements.json +323 -15
  3. package/dist/badge/esp-badge.d.ts +39 -0
  4. package/dist/badge/esp-badge.js +35 -6
  5. package/dist/box/esp-box.d.ts +4 -2
  6. package/dist/box/esp-box.js +6 -6
  7. package/dist/breadcrumbs/esp-breadcrumb.d.ts +1 -0
  8. package/dist/breadcrumbs/esp-breadcrumb.js +11 -3
  9. package/dist/breadcrumbs/esp-breadcrumbs.js +6 -6
  10. package/dist/button/esp-button-group.js +8 -3
  11. package/dist/button/esp-button.d.ts +3 -0
  12. package/dist/button/esp-button.js +47 -13
  13. package/dist/cli/theme-check.js +2 -2
  14. package/dist/footer/esp-footer-link-group.js +11 -8
  15. package/dist/footer/esp-footer.d.ts +5 -3
  16. package/dist/footer/esp-footer.js +25 -10
  17. package/dist/footer/paint-registration.js +1 -1
  18. package/dist/menu/paint-registration.js +1 -1
  19. package/dist/root/esp-root.d.ts +13 -0
  20. package/dist/root/esp-root.js +69 -10
  21. package/dist/root/helpers/compute-semantic-properties.js +1 -1
  22. package/dist/root/helpers/compute-theme-properties.js +1 -1
  23. package/dist/section/esp-section.d.ts +5 -4
  24. package/dist/section/esp-section.js +1 -1
  25. package/dist/shared/blockquote-styles.d.ts +5 -1
  26. package/dist/shared/blockquote-styles.js +8 -4
  27. package/dist/shared/color-engine.js +1 -1
  28. package/dist/shared/component-property-compiler.js +1 -1
  29. package/dist/shared/component-property-diagnostics.js +1 -1
  30. package/dist/shared/component-property-normalizer.js +1 -1
  31. package/dist/shared/esp-element-base.js +2 -2
  32. package/dist/shared/footer-ink-styles.js +18 -0
  33. package/dist/shared/footer-ink.js +1 -0
  34. package/dist/shared/paint-catalog.js +1 -1
  35. package/dist/shared/paint-fit.js +1 -1
  36. package/dist/shared/paint-types.d.ts +9 -0
  37. package/dist/shared/public-token-catalog.generated.js +1 -1
  38. package/dist/shared/scale-engine.js +1 -1
  39. package/dist/shared/semantic-color-names.js +1 -1
  40. package/dist/shared/settable-component-properties.js +1 -1
  41. package/dist/shared/theme-fit-report.d.ts +6 -4
  42. package/dist/shared/theme-fit-report.js +1 -1
  43. package/dist/testing/observe-paint.iife.js +2 -2
  44. package/dist/testing/observe-paint.js +3 -3
  45. package/espalier.css-data.json +139 -7
  46. package/espalier.token-manifest.json +1038 -62
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- import{parseCssColor as m,serializeOklch as b,gamutMapToSRGB as S}from"../../shared/color-engine.js";import{compileComponentProperties as O}from"../../shared/component-property-compiler.js";import{generateScaleProperties as k}from"../../shared/scale-engine.js";import{DATA_SERIES_KEYS as y,DEFAULT_DATA_PALETTE as B,generateDivergingRamp as R,generateSequentialRamp as w}from"../../shared/data-colors.js";import{DEFAULT_BODY_FONT_FAMILY as E,DEFAULT_MONOSPACE_FONT_FAMILY as I,resolveDataColorSource as P}from"../../shared/theme-core.js";import{dataCompanionProperties as $}from"./data-companion-properties.js";import{lightnessRampProperties as M}from"./lightness-ramp-properties.js";import{surfacePolarityProperty as T}from"./surface-polarity-property.js";import{computeVariants as x}from"./compute-variants.js";import{computeSemanticProperties as A}from"./compute-semantic-properties.js";function C(o){return{rootFontSize:o.rootFontSize,typeRatio:o.typeRatio,spaceRatio:o.spaceRatio,borderRadius:o.borderRadius,viewportMin:o.viewportMin,viewportMax:o.viewportMax}}function _(o,g,l){const d={},s=o.dataPalette??B;for(let r=0;r<y.length;r+=1){const a=y[r],i=m(l(s[a],`dataPalette.${a}`))??g;d[`--esp-color-series-${r+1}`]=b(S(i))}return d}function q(o,g,l,d={},s){const r=m(o.seedColor);if(!r)return{};const a={};a["--esp-scheme"]=g,a["--esp-seed-color"]=o.seedColor;const i=x(r,o);for(const[e,n]of Object.entries(i))a[`--esp-color-${e}`]=b(S(n));const f=new Set,p=(e,n)=>{const t=typeof e=="string"?P(e,o.anchors):null;if(t)return t;const c=typeof e=="string"?e:String(e);return f.has(c)||(f.add(c),console.warn(`Espalier theme: ${n} color source "${c}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared data colors.`)),o.seedColor};Object.assign(a,_(o,r,p));for(const[e,n]of Object.entries(o.dataRamps??{}))try{(n.type==="sequential"?w(p(n.source,`dataRamps.${e}.source`),{steps:n.steps,lightnessStart:n.lightnessStart,lightnessEnd:n.lightnessEnd}):R(p(n.start,`dataRamps.${e}.start`),p(n.end,`dataRamps.${e}.end`),{steps:n.steps,neutral:n.neutral===void 0?void 0:p(n.neutral,`dataRamps.${e}.neutral`)})).forEach((c,v)=>{a[`--esp-color-ramp-${e}-${v+1}`]=c})}catch(t){console.warn(`Espalier theme: dataRamps.${e} cannot be generated \u2014 ${t instanceof Error?t.message:String(t)}`)}Object.assign(a,M(o));const u=new Set;return Object.assign(a,A(o,i,{trace:l,onUnresolvedSource:e=>{u.has(e)||(u.add(e),console.warn(`Espalier theme: color source "${e}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared anchors.`))}})),s&&Object.assign(a,O(s.surface,{theme:o,variants:i,semanticProperties:a},s.trace)),Object.assign(a,T(a)),Object.assign(a,$(a)),Object.assign(a,k(C(o),d.viewportWidth)),a["--esp-font-body"]=o.fontBody||E,o.fontHeadings&&(a["--esp-font-headings"]=o.fontHeadings),o.fontBrand&&(a["--esp-font-brand"]=o.fontBrand),o.fontMenu&&(a["--esp-font-menu"]=o.fontMenu),a["--esp-font-monospace"]=o.fontMonospace||I,a["--esp-font-weight-body"]=o.fontWeightBody,a["--esp-font-weight-headings"]=o.fontWeightHeadings,a["--esp-font-weight-brand"]=o.fontWeightBrand,a["--esp-font-weight-menu"]=o.fontWeightMenu,a["--esp-font-weight-monospace"]=o.fontWeightMonospace,o.pageBackgroundImage&&(a["--esp-page-background-image"]=o.pageBackgroundImage),o.pageBackgroundImageOpacity!==void 0&&(a["--esp-page-background-image-opacity"]=o.pageBackgroundImageOpacity.toString()),o.boxBackgroundImage&&(a["--esp-box-background-image"]=o.boxBackgroundImage),o.boxBackgroundImageOpacity!==void 0&&(a["--esp-box-background-image-opacity"]=o.boxBackgroundImageOpacity.toString()),o.vellumOpacity!==void 0&&(a["--esp-vellum-opacity"]=o.vellumOpacity.toString()),o.vellumBackgroundImage&&(a["--esp-vellum-background-image"]=o.vellumBackgroundImage),o.vellumBackgroundImageOpacity!==void 0&&(a["--esp-vellum-background-image-opacity"]=o.vellumBackgroundImageOpacity.toString()),a}export{q as computeThemeProperties,_ as dataSeriesProperties};
1
+ import{parseCssColor as b,serializeOklch as S,gamutMapToSRGB as y}from"../../shared/color-engine.js";import{compileComponentProperties as k}from"../../shared/component-property-compiler.js";import{generateScaleProperties as B}from"../../shared/scale-engine.js";import{DATA_SERIES_KEYS as v,DEFAULT_DATA_PALETTE as R,generateDivergingRamp as w,generateSequentialRamp as E}from"../../shared/data-colors.js";import{DEFAULT_BODY_FONT_FAMILY as I,DEFAULT_MONOSPACE_FONT_FAMILY as P,resolveDataColorSource as $}from"../../shared/theme-core.js";import{dataCompanionProperties as M}from"./data-companion-properties.js";import{lightnessRampProperties as T}from"./lightness-ramp-properties.js";import{surfacePolarityProperty as x}from"./surface-polarity-property.js";import{computeVariants as A}from"./compute-variants.js";import{computeSemanticProperties as C}from"./compute-semantic-properties.js";function _(o){return{rootFontSize:o.rootFontSize,typeRatio:o.typeRatio,spaceRatio:o.spaceRatio,borderRadius:o.borderRadius,viewportMin:o.viewportMin,viewportMax:o.viewportMax}}function j(o,g,l){const d={},i=o.dataPalette??R;for(let t=0;t<v.length;t+=1){const s=v[t],a=b(l(i[s],`dataPalette.${s}`))??g;d[`--esp-color-series-${t+1}`]=S(y(a))}return d}function G(o,g,l,d={},i,t){const s=b(o.seedColor);if(!s)return{};const a={};a["--esp-scheme"]=g,a["--esp-seed-color"]=o.seedColor;const f=A(s,o);for(const[e,n]of Object.entries(f))a[`--esp-color-${e}`]=S(y(n));const u=new Set,p=(e,n)=>{const r=typeof e=="string"?$(e,o.anchors):null;if(r)return r;const c=typeof e=="string"?e:String(e);return u.has(c)||(u.add(c),console.warn(`Espalier theme: ${n} color source "${c}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared data colors.`)),o.seedColor};Object.assign(a,j(o,s,p));for(const[e,n]of Object.entries(o.dataRamps??{}))try{(n.type==="sequential"?E(p(n.source,`dataRamps.${e}.source`),{steps:n.steps,lightnessStart:n.lightnessStart,lightnessEnd:n.lightnessEnd}):w(p(n.start,`dataRamps.${e}.start`),p(n.end,`dataRamps.${e}.end`),{steps:n.steps,neutral:n.neutral===void 0?void 0:p(n.neutral,`dataRamps.${e}.neutral`)})).forEach((c,O)=>{a[`--esp-color-ramp-${e}-${O+1}`]=c})}catch(r){console.warn(`Espalier theme: dataRamps.${e} cannot be generated \u2014 ${r instanceof Error?r.message:String(r)}`)}Object.assign(a,T(o));const m=new Set;return Object.assign(a,C(o,f,{trace:l,footerTrace:t,onUnresolvedSource:e=>{m.has(e)||(m.add(e),console.warn(`Espalier theme: color source "${e}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared anchors.`))}})),i&&Object.assign(a,k(i.surface,{theme:o,variants:f,semanticProperties:a},i.trace)),Object.assign(a,x(a)),Object.assign(a,M(a)),Object.assign(a,B(_(o),d.viewportWidth)),a["--esp-font-body"]=o.fontBody||I,o.fontHeadings&&(a["--esp-font-headings"]=o.fontHeadings),o.fontBrand&&(a["--esp-font-brand"]=o.fontBrand),o.fontMenu&&(a["--esp-font-menu"]=o.fontMenu),a["--esp-font-monospace"]=o.fontMonospace||P,a["--esp-font-weight-body"]=o.fontWeightBody,a["--esp-font-weight-headings"]=o.fontWeightHeadings,a["--esp-font-weight-brand"]=o.fontWeightBrand,a["--esp-font-weight-menu"]=o.fontWeightMenu,a["--esp-font-weight-monospace"]=o.fontWeightMonospace,o.pageBackgroundImage&&(a["--esp-page-background-image"]=o.pageBackgroundImage),o.pageBackgroundImageOpacity!==void 0&&(a["--esp-page-background-image-opacity"]=o.pageBackgroundImageOpacity.toString()),o.boxBackgroundImage&&(a["--esp-box-background-image"]=o.boxBackgroundImage),o.boxBackgroundImageOpacity!==void 0&&(a["--esp-box-background-image-opacity"]=o.boxBackgroundImageOpacity.toString()),o.vellumOpacity!==void 0&&(a["--esp-vellum-opacity"]=o.vellumOpacity.toString()),o.vellumBackgroundImage&&(a["--esp-vellum-background-image"]=o.vellumBackgroundImage),o.vellumBackgroundImageOpacity!==void 0&&(a["--esp-vellum-background-image-opacity"]=o.vellumBackgroundImageOpacity.toString()),a}export{G as computeThemeProperties,j as dataSeriesProperties};
@@ -32,10 +32,10 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
32
32
  * meet the band's edges; the band's zone behavior is unaffected.
33
33
  *
34
34
  * A section may also tint one raster alpha mask behind its content.
35
- * The component owns clipping, no-repeat mask behavior, stacking, and
36
- * interaction isolation; consumers opt in with the `decoration`
37
- * attribute and supply only the image, semantic tint, position, size, and
38
- * opacity:
35
+ * The component owns clipping, stacking, and interaction isolation, and the
36
+ * mask does not repeat unless the consumer sets `--esp-section-decoration-repeat`.
37
+ * Consumers opt in with the `decoration` attribute and supply only the image,
38
+ * semantic tint, position, size, repeat, and opacity:
39
39
  *
40
40
  * ```html
41
41
  * <esp-section
@@ -75,6 +75,7 @@ import { EspalierElementBase } from "../shared/esp-element-base.js";
75
75
  * @cssprop --esp-section-decoration-image - Raster alpha mask painted behind the well when `decoration` is set. Defaults to `none`.
76
76
  * @cssprop --esp-section-decoration-color - Semantic tint applied through the mask. Defaults to the local `--esp-color-headings`.
77
77
  * @cssprop --esp-section-decoration-position - Mask position, including responsive or bleeding values. Defaults to `center`.
78
+ * @cssprop --esp-section-decoration-repeat - Mask repeat: `no-repeat`, `repeat`, `repeat-x` or `repeat-y`. Defaults to `no-repeat`; the others tile a pattern mask across the band.
78
79
  * @cssprop --esp-section-decoration-size - Mask size. Defaults to `contain`.
79
80
  * @cssprop --esp-section-decoration-opacity - Decoration opacity from `0` through `1`. Defaults to `1`.
80
81
  * @docPageTitle Section
@@ -30,7 +30,7 @@ var p=function(r,t,o,a){var n=arguments.length,e=n<3?t:a===null?a=Object.getOwnP
30
30
  --_esp-overlay-texture-mask:
31
31
  var(--esp-section-decoration-image, none), linear-gradient(transparent, transparent);
32
32
  --_esp-overlay-texture-mask-position: var(--esp-section-decoration-position, center);
33
- --_esp-overlay-texture-mask-repeat: no-repeat;
33
+ --_esp-overlay-texture-mask-repeat: var(--esp-section-decoration-repeat, no-repeat);
34
34
  --_esp-overlay-texture-mask-size: var(--esp-section-decoration-size, contain);
35
35
  --_esp-overlay-texture-opacity: var(--esp-section-decoration-opacity, 1);
36
36
  }
@@ -19,9 +19,13 @@ import { type CSSResult } from "lit";
19
19
  *
20
20
  * Base and child rules have zero specificity. A selected light-DOM paragraph
21
21
  * receives a color-only bridge over `esp-root`'s native paragraph ink. The
22
- * consumer keeps ownership of outer block rhythm, prose measure and font family.
22
+ * consumer keeps ownership of outer block rhythm and prose measure, and of the
23
+ * font family unless `--esp-blockquote-font-family` is set.
23
24
  *
24
25
  * @cssprop --esp-blockquote-bar-color - Color of the quote's inline-start border. Defaults to `var(--esp-color-border)`.
26
+ * @cssprop --esp-blockquote-bar-width - Width of the quote's inline-start border, from `0` to `1em`. Defaults to `0.3em`.
27
+ * @cssprop --esp-blockquote-shadow - The quote's shadow: `none`, `1`, `2` or `3` as a theme elevation step. Defaults to `none`.
28
+ * @cssprop --esp-blockquote-font-family - The quote's font family: `body`, `heading` or `monospace`. Unset by default, so the quote keeps the surrounding text's family. Takes effect only through a theme's `componentProperties`, which maps the keyword; a raw CSS declaration alone does nothing.
25
29
  * @cssprop --esp-blockquote-glyph-color - Ink of the opening quote mark. Defaults to `var(--esp-blockquote-bar-color, var(--esp-color-border))`.
26
30
  */
27
31
  export declare function blockquoteStyles(selector?: string, options?: {
@@ -1,4 +1,4 @@
1
- import{css as o,unsafeCSS as i}from"lit";function h(n="blockquote",s){const a=n.trim();if(!a)throw new RangeError("A blockquote selector must not be empty.");const t=s?.figureSelector?.trim();if(t==="")throw new RangeError("A figure selector must not be empty.");const e=i(a),l=i('url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2032%2032%27%3E%3Cpath%20d%3D%27M3%2025V15C3%208%207%204%2014%203v5c-4%201-6%203-6%206h6v11H3zm15%200V15c0-7%204-11%2011-12v5c-4%201-6%203-6%206h6v11H18z%27%2F%3E%3C%2Fsvg%3E")'),r=i(t??""),p=t===void 0?o``:o`
1
+ import{css as t,unsafeCSS as i}from"lit";function h(s="blockquote",n){const a=s.trim();if(!a)throw new RangeError("A blockquote selector must not be empty.");const o=n?.figureSelector?.trim();if(o==="")throw new RangeError("A figure selector must not be empty.");const e=i(a),l=i('url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2032%2032%27%3E%3Cpath%20d%3D%27M3%2025V15C3%208%207%204%2014%203v5c-4%201-6%203-6%206h6v11H3zm15%200V15c0-7%204-11%2011-12v5c-4%201-6%203-6%206h6v11H18z%27%2F%3E%3C%2Fsvg%3E")'),r=i(o??""),c=o===void 0?t``:t`
2
2
  :where(${r}) {
3
3
  margin-inline: 0;
4
4
  min-inline-size: 0;
@@ -23,11 +23,15 @@ import{css as o,unsafeCSS as i}from"lit";function h(n="blockquote",s){const a=n.
23
23
  letter-spacing: inherit;
24
24
  color: inherit;
25
25
  }
26
- `;return o`
26
+ `;return t`
27
27
  :where(${e}) {
28
28
  position: relative;
29
29
  background: var(--esp-color-layer-1, var(--esp-color-background));
30
- border-inline-start: 0.3em solid var(--esp-blockquote-bar-color, var(--esp-color-border));
30
+ border-inline-start: var(--esp-blockquote-bar-width, 0.3em) solid var(--esp-blockquote-bar-color, var(--esp-color-border));
31
+
32
+ box-shadow: var(--esp-blockquote-shadow, none);
33
+
34
+ font-family: var(--_esp-blockquote-font-family);
31
35
  padding-block: var(--esp-size-small);
32
36
  padding-inline-end: var(--esp-size-small);
33
37
  padding-inline-start: calc(var(--esp-size-small) + 1.6em + var(--esp-size-tiny));
@@ -84,5 +88,5 @@ import{css as o,unsafeCSS as i}from"lit";function h(n="blockquote",s){const a=n.
84
88
  margin-block-end: 0;
85
89
  }
86
90
 
87
- ${p}
91
+ ${c}
88
92
  `}export{h as blockquoteStyles};
@@ -1 +1 @@
1
- import{CSS_NAMED_COLORS as w}from"./css-named-colors.js";const mt={l:0,c:0,h:0},Mt={l:1,c:0,h:0},B=Math.PI/180,p=1e-4,K=50,_="[+-]?(?:\\d+|\\d*\\.\\d+)(?:[eE][+-]?\\d+)?",h="[\\t\\n\\f\\r ]",U=new RegExp(h+"*,"+h+"*"),z=new RegExp(h+"+");function d(t){return t.replace(/\/\*[\s\S]*?(?:\*\/|$)/g," ").replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g,"")}const P={"":1,deg:1,grad:.9,rad:180/Math.PI,turn:360},Y=.4,j=new RegExp("^oklch\\("+h+"*("+_+")(%?)"+h+"+("+_+")(%?)"+h+"+("+_+")(deg|grad|rad|turn)?"+h+"*\\)$","i");function k(t){const n=t.h*B;return{L:t.l,a:t.c*Math.cos(n),b:t.c*Math.sin(n)}}function q(t){const n=t.L+.3963377774*t.a+.2158037573*t.b,e=t.L-.1055613458*t.a-.0638541728*t.b,r=t.L-.0894841775*t.a-1.291485548*t.b,o=n*n*n,c=e*e*e,s=r*r*r;return{r:4.0767416621*o-3.3077115913*c+.2309699292*s,g:-1.2684380046*o+2.6097574011*c-.3413193965*s,b:-.0041960863*o-.7034186147*c+1.707614701*s}}function A(t){return t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055}function J(t){return{r:A(t.r),g:A(t.g),b:A(t.b)}}function Q(t){return t.r>=-p&&t.r<=1+p&&t.g>=-p&&t.g<=1+p&&t.b>=-p&&t.b<=1+p}function f(t){return Math.max(0,Math.min(1,t))}function Z(t){const n=d(t).match(j);if(!n)return null;let e=parseFloat(n[1]);n[2]==="%"&&(e/=100);let r=parseFloat(n[3]);n[4]==="%"&&(r=r/100*Y);const o=parseFloat(n[5])*P[(n[6]??"").toLowerCase()];return!isFinite(e)||!isFinite(r)||!isFinite(o)?null:{l:Math.max(0,Math.min(1,e)),c:Math.max(0,r),h:(o%360+360)%360}}function gt(t){const n=M(t.l,6),e=M(t.c,6),r=M((t.h%360+360)%360,4);return`oklch(${n} ${e} ${r})`}function R(t){return J(q(k(t)))}function S(t){return Q(R(t))}function x(t){if(t.c<=p||S(t))return{...t};let n=0,e=t.c,r={...t};for(let o=0;o<K;o++){const c=(n+e)/2;if(r={l:t.l,c,h:t.h},S(r)?n=c:e=c,e-n<p)break}return{l:t.l,c:n,h:t.h}}function tt(t,n,e){const r={l:t.l,c:Math.max(n,Math.min(e,t.c)),h:t.h};return x(r)}const L=.022,I=.012,v=.022,F=.57,N=.56,y=1.14,O=.001,b=.027;function D(t){const n=Math.pow(f(t.r),2.4),e=Math.pow(f(t.g),2.4),r=Math.pow(f(t.b),2.4);return .2126729*n+.7151522*e+.072175*r}function $(t,n){const e=R(x(t)),r=R(x(n));let o=D(e),c=D(r);if(o=o>L?o:o+Math.pow(L-o,1.414),c=c>L?c:c+Math.pow(L-c,1.414),Math.abs(c-o)<O)return 0;let s;if(c>o){const u=Math.pow(c,N),l=Math.pow(o,F);if(s=(u-l)*y,s<O)return 0;s=s<b?s-s*v*b:s-v}else{const u=Math.pow(c,N),l=Math.pow(o,F);if(s=(u-l)*y,s>-O)return 0;s=s>-b?s-s*I*b:s+I}return s*100}function nt(t,n,e=60){let r=x({...t}),o=Math.abs($(r,n));if(o>=e)return r;const c=n.l>.5,s=.01,u=c?0:1;for(let l=0;l<100;l++){if(c?r.l=Math.max(u,r.l-s):r.l=Math.min(u,r.l+s),r=x(r),o=Math.abs($(r,n)),o>=e)return r;if(r.l<=0||r.l>=1)break}return r}function xt(t,n){return((t+n)%360+360)%360}function Ct(t,n){const e=k(t),r=k(n),o=e.L-r.L,c=e.a-r.a,s=e.b-r.b;return Math.sqrt(o*o+c*c+s*s)}function rt(t,n,e,r){return tt({l:n,c:t.c,h:t.h},e,r)}function _t(t,n,e,r,o,c=60,s){const u=rt(t,n,e,r);return s?.(u),nt(u,o,c)}function G(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function et(t){return{r:G(t.r),g:G(t.g),b:G(t.b)}}function ot({r:t,g:n,b:e}){const r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*e),o=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*e),c=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*e);return{L:.2104542553*r+.793617785*o-.0040720468*c,a:1.9779984951*r-2.428592205*o+.4505937099*c,b:.0259040371*r+.7827717662*o-.808675766*c}}function ct(t){return ot(et(t))}function H(t){const n=Math.sqrt(t.a*t.a+t.b*t.b),e=n<1e-12?0:(Math.atan2(t.b,t.a)/B%360+360)%360;return{l:t.L,c:n,h:e}}function st(t){const n=M(t.c,4);return{l:M(t.l,3),c:n,h:n===0?0:M(t.h,1)}}function m(t){return Math.round(f(t)*255)}function ut(t){const n=H(ct(t)),e=t.r===t.g&&t.g===t.b?{l:n.l,c:0,h:0}:n,r=st(e);if(S(r)){const o=R(r);if(m(o.r)===m(t.r)&&m(o.g)===m(t.g)&&m(o.b)===m(t.b))return r}return e}function V(t,n){const e=t.slice(1),r=e.length;if(!/^[0-9a-f]+$/i.test(e)||r!==3&&r!==6&&!(n&&(r===4||r===8)))return null;const o=r<=4?1:2,c=s=>{const u=e.slice(s*o,(s+1)*o);return parseInt(o===1?u.repeat(2):u,16)/255};return{space:"srgb",color:{r:c(0),g:c(1),b:c(2)},alpha:r===4||r===8?c(3):1}}function C(t,n,e){const r=t.match(new RegExp("^"+n+"\\("+h+"*([^)]*?)"+h+"*\\)$","i"));if(!r)return null;const o=r[1],c=o.includes(","),s=o.split("/");if(s.length>2||s.length===2&&(c||!e))return null;const l=d(s[0]).split(c?U:z),i=c&&l.length===4&&e?l.pop():s[1];if(l.length!==3||l.some(g=>g.length===0))return null;const a=i===void 0?1:W(d(i));return a===null?null:{args:l,legacy:c,alpha:a}}const at=new RegExp("^("+_+")([a-z%]*)$","i");function T(t){const n=t.match(at);if(!n)return null;const e=parseFloat(n[1]);return isFinite(e)?{value:e,unit:n[2].toLowerCase()}:null}function W(t){if(t.toLowerCase()==="none")return 0;const n=T(t);return!n||n.unit!==""&&n.unit!=="%"?null:f(n.unit==="%"?n.value/100:n.value)}function lt(t){if(t.unit!==""&&t.unit!=="%")return null;const n=t.unit==="%"?t.value/100:t.value/255;return Math.max(0,Math.min(1,n))}function it(t){const n=P[t.unit];return n===void 0?null:t.value*n}function X(t){return t.unit!==""&&t.unit!=="%"?null:Math.max(0,Math.min(1,t.value/100))}function ht(t,n,e){const r=(t%360+360)%360,o=c=>{const s=(c+r/30)%12,u=n*Math.min(e,1-e);return e-u*Math.max(-1,Math.min(s-3,9-s,1))};return{r:o(0),g:o(8),b:o(4)}}const dt='"#rrggbb", "#rgb", "rgb(\u2026)", "hsl(\u2026)", "oklch(\u2026)"';function Rt(t){const n=pt(t,!1);return n?n.space==="oklch"?n.color:ut(n.color):null}function pt(t,n){const e=d(t);if(e.startsWith("#"))return V(e,n);if(/^oklch\(/i.test(e)){const r=n?C(e,"oklch",!0):null;if(n&&(!r||r.legacy))return null;const o=Z(r?`oklch(${r.args.map(c=>c.toLowerCase()==="none"?"0":c).join(" ")})`:e);return o?{space:"oklch",color:o,alpha:r?.alpha??1}:null}if(/^rgba?\(/i.test(e)){const r=C(e,"rgba?",n);if(!r)return null;const o=r.args.map(T);if(o.some(a=>a===null))return null;const c=o;if(r.legacy&&new Set(c.map(a=>a.unit)).size>1)return null;const s=c.map(lt);if(s.some(a=>a===null))return null;const[u,l,i]=s;return{space:"srgb",color:{r:u,g:l,b:i},alpha:r.alpha}}if(/^hsla?\(/i.test(e)){const r=C(e,"hsla?",n);if(!r)return null;const o=r.args.map(T);if(o.some(g=>g===null))return null;const[c,s,u]=o;if(r.legacy&&(s.unit!=="%"||u.unit!=="%"))return null;const l=it(c),i=X(s),a=X(u);return l===null||i===null||a===null?null:{space:"srgb",color:ht(l,i,a),alpha:r.alpha}}if(n){if(/^oklab\(/i.test(e)){const c=C(e,"oklab",!0);if(!c||c.legacy)return null;const s=c.args.map(a=>T(a.toLowerCase()==="none"?"0":a));if(s.some(a=>!a||a.unit!==""&&a.unit!=="%"))return null;const[u,l,i]=s.map((a,g)=>{const E=a;return E.unit!=="%"?E.value:E.value/100*(g===0?1:.4)});return{space:"oklch",color:H({L:f(u),a:l,b:i}),alpha:c.alpha}}const r=e.toLowerCase();if(Object.prototype.hasOwnProperty.call(w,r))return V(w[r],n);if(r==="transparent")return{space:"srgb",color:{r:0,g:0,b:0},alpha:0};const o=e.match(new RegExp("^color\\("+h+"*srgb"+h+"+","i"));if(o){const c=C(`color(${e.slice(o[0].length)}`,"color",!0);if(!c||c.legacy)return null;const s=c.args.map(W);if(s.some(a=>a===null))return null;const[u,l,i]=s;return{space:"srgb",color:{r:u,g:l,b:i},alpha:c.alpha}}}return null}function M(t,n){const e=Math.pow(10,n);return Math.round(t*e)/e}export{dt as ACCEPTED_COLOR_FORMS,mt as BLACK_INK,Mt as WHITE_INK,$ as apcaContrast,f as clampChannel,tt as clampChromaAndGamutMap,Ct as deltaEOK,rt as deriveSemantic,_t as deriveSemanticWithContrast,nt as ensureContrast,G as gammaToLinear,x as gamutMapToSRGB,S as isInSRGBGamut,ot as linearRgbToOklab,H as oklabToOklch,k as oklchToOklab,R as oklchToSRGB,Rt as parseCssColor,pt as parseCssColorValue,Z as parseOklch,xt as rotateHue,gt as serializeOklch,et as srgbToLinearRGB,ct as srgbToOklab};
1
+ import{CSS_NAMED_COLORS as P}from"./css-named-colors.js";const U={l:0,c:0,h:0},z={l:1,c:0,h:0},v=Math.PI/180,m=1e-4,q=50,_="[+-]?(?:\\d+|\\d*\\.\\d+)(?:[eE][+-]?\\d+)?",p="[\\t\\n\\f\\r ]",Y=new RegExp(p+"*,"+p+"*"),j=new RegExp(p+"+");function R(t){return t.replace(/\/\*[\s\S]*?(?:\*\/|$)/g," ").replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g,"")}const F={"":1,deg:1,grad:.9,rad:180/Math.PI,turn:360},J=.4,Q=new RegExp("^oklch\\("+p+"*("+_+")(%?)"+p+"+("+_+")(%?)"+p+"+("+_+")(deg|grad|rad|turn)?"+p+"*\\)$","i");function k(t){const n=t.h*v;return{L:t.l,a:t.c*Math.cos(n),b:t.c*Math.sin(n)}}function Z(t){const n=t.L+.3963377774*t.a+.2158037573*t.b,r=t.L-.1055613458*t.a-.0638541728*t.b,e=t.L-.0894841775*t.a-1.291485548*t.b,c=n*n*n,o=r*r*r,s=e*e*e;return{r:4.0767416621*c-3.3077115913*o+.2309699292*s,g:-1.2684380046*c+2.6097574011*o-.3413193965*s,b:-.0041960863*c-.7034186147*o+1.707614701*s}}function A(t){return t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055}function tt(t){return{r:A(t.r),g:A(t.g),b:A(t.b)}}function nt(t){return t.r>=-m&&t.r<=1+m&&t.g>=-m&&t.g<=1+m&&t.b>=-m&&t.b<=1+m}function M(t){return Math.max(0,Math.min(1,t))}function rt(t){const n=R(t).match(Q);if(!n)return null;let r=parseFloat(n[1]);n[2]==="%"&&(r/=100);let e=parseFloat(n[3]);n[4]==="%"&&(e=e/100*J);const c=parseFloat(n[5])*F[(n[6]??"").toLowerCase()];return!isFinite(r)||!isFinite(e)||!isFinite(c)?null:{l:Math.max(0,Math.min(1,r)),c:Math.max(0,e),h:(c%360+360)%360}}function xt(t){const n=x(t.l,6),r=x(t.c,6),e=x((t.h%360+360)%360,4);return`oklch(${n} ${r} ${e})`}function T(t){return tt(Z(k(t)))}function S(t){return nt(T(t))}function C(t){if(t.c<=m||S(t))return{...t};let n=0,r=t.c,e={...t};for(let c=0;c<q;c++){const o=(n+r)/2;if(e={l:t.l,c:o,h:t.h},S(e)?n=o:r=o,r-n<m)break}return{l:t.l,c:n,h:t.h}}function et(t,n,r){const e={l:t.l,c:Math.max(n,Math.min(r,t.c)),h:t.h};return C(e)}const L=.022,I=.012,N=.022,D=.57,y=.56,$=1.14,O=.001,b=.027;function H(t){const n=Math.pow(M(t.r),2.4),r=Math.pow(M(t.g),2.4),e=Math.pow(M(t.b),2.4);return .2126729*n+.7151522*r+.072175*e}function G(t,n){const r=T(C(t)),e=T(C(n));let c=H(r),o=H(e);if(c=c>L?c:c+Math.pow(L-c,1.414),o=o>L?o:o+Math.pow(L-o,1.414),Math.abs(o-c)<O)return 0;let s;if(o>c){const l=Math.pow(o,y),a=Math.pow(c,D);if(s=(l-a)*$,s<O)return 0;s=s<b?s-s*N*b:s-N}else{const l=Math.pow(o,y),a=Math.pow(c,D);if(s=(l-a)*$,s>-O)return 0;s=s>-b?s-s*I*b:s+I}return s*100}function ot(t,n,r=60,e=!1){const c=C({...t}),o=f=>Math.abs(G(f,n))>=r;if(o(c))return c;const s=f=>{let h={...c};for(let B=0;B<100&&(h.l=f?Math.max(0,h.l-.01):Math.min(1,h.l+.01),h=C(h),!(o(h)||h.l<=0||h.l>=1));B++);return h},l=n.l>.5,a=s(l);if(!e||o(a))return a;const i=l?z:U;if(!o(i))return Math.abs(G(i,n))>Math.abs(G(a,n))?{...i}:a;const u=s(!l);return o(u)?u:{...i}}function Ct(t,n){return((t+n)%360+360)%360}function dt(t,n){const r=k(t),e=k(n),c=r.L-e.L,o=r.a-e.a,s=r.b-e.b;return Math.sqrt(c*c+o*o+s*s)}function ct(t,n,r,e){return et({l:n,c:t.c,h:t.h},r,e)}function _t(t,n,r,e,c,o=60,s,l=!1){const a=ct(t,n,r,e);return s?.(a),ot(a,c,o,l)}function w(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function st(t){return{r:w(t.r),g:w(t.g),b:w(t.b)}}function at({r:t,g:n,b:r}){const e=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),c=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return{L:.2104542553*e+.793617785*c-.0040720468*o,a:1.9779984951*e-2.428592205*c+.4505937099*o,b:.0259040371*e+.7827717662*c-.808675766*o}}function ut(t){return at(st(t))}function V(t){const n=Math.sqrt(t.a*t.a+t.b*t.b),r=n<1e-12?0:(Math.atan2(t.b,t.a)/v%360+360)%360;return{l:t.L,c:n,h:r}}function lt(t){const n=x(t.c,4);return{l:x(t.l,3),c:n,h:n===0?0:x(t.h,1)}}function g(t){return Math.round(M(t)*255)}function it(t){const n=V(ut(t)),r=t.r===t.g&&t.g===t.b?{l:n.l,c:0,h:0}:n,e=lt(r);if(S(e)){const c=T(e);if(g(c.r)===g(t.r)&&g(c.g)===g(t.g)&&g(c.b)===g(t.b))return e}return r}function W(t,n){const r=t.slice(1),e=r.length;if(!/^[0-9a-f]+$/i.test(r)||e!==3&&e!==6&&!(n&&(e===4||e===8)))return null;const c=e<=4?1:2,o=s=>{const l=r.slice(s*c,(s+1)*c);return parseInt(c===1?l.repeat(2):l,16)/255};return{space:"srgb",color:{r:o(0),g:o(1),b:o(2)},alpha:e===4||e===8?o(3):1}}function d(t,n,r){const e=t.match(new RegExp("^"+n+"\\("+p+"*([^)]*?)"+p+"*\\)$","i"));if(!e)return null;const c=e[1],o=c.includes(","),s=c.split("/");if(s.length>2||s.length===2&&(o||!r))return null;const a=R(s[0]).split(o?Y:j),i=o&&a.length===4&&r?a.pop():s[1];if(a.length!==3||a.some(f=>f.length===0))return null;const u=i===void 0?1:X(R(i));return u===null?null:{args:a,legacy:o,alpha:u}}const ht=new RegExp("^("+_+")([a-z%]*)$","i");function E(t){const n=t.match(ht);if(!n)return null;const r=parseFloat(n[1]);return isFinite(r)?{value:r,unit:n[2].toLowerCase()}:null}function X(t){if(t.toLowerCase()==="none")return 0;const n=E(t);return!n||n.unit!==""&&n.unit!=="%"?null:M(n.unit==="%"?n.value/100:n.value)}function pt(t){if(t.unit!==""&&t.unit!=="%")return null;const n=t.unit==="%"?t.value/100:t.value/255;return Math.max(0,Math.min(1,n))}function ft(t){const n=F[t.unit];return n===void 0?null:t.value*n}function K(t){return t.unit!==""&&t.unit!=="%"?null:Math.max(0,Math.min(1,t.value/100))}function mt(t,n,r){const e=(t%360+360)%360,c=o=>{const s=(o+e/30)%12,l=n*Math.min(r,1-r);return r-l*Math.max(-1,Math.min(s-3,9-s,1))};return{r:c(0),g:c(8),b:c(4)}}const Rt='"#rrggbb", "#rgb", "rgb(\u2026)", "hsl(\u2026)", "oklch(\u2026)"';function Tt(t){const n=Mt(t,!1);return n?n.space==="oklch"?n.color:it(n.color):null}function Mt(t,n){const r=R(t);if(r.startsWith("#"))return W(r,n);if(/^oklch\(/i.test(r)){const e=n?d(r,"oklch",!0):null;if(n&&(!e||e.legacy))return null;const c=rt(e?`oklch(${e.args.map(o=>o.toLowerCase()==="none"?"0":o).join(" ")})`:r);return c?{space:"oklch",color:c,alpha:e?.alpha??1}:null}if(/^rgba?\(/i.test(r)){const e=d(r,"rgba?",n);if(!e)return null;const c=e.args.map(E);if(c.some(u=>u===null))return null;const o=c;if(e.legacy&&new Set(o.map(u=>u.unit)).size>1)return null;const s=o.map(pt);if(s.some(u=>u===null))return null;const[l,a,i]=s;return{space:"srgb",color:{r:l,g:a,b:i},alpha:e.alpha}}if(/^hsla?\(/i.test(r)){const e=d(r,"hsla?",n);if(!e)return null;const c=e.args.map(E);if(c.some(f=>f===null))return null;const[o,s,l]=c;if(e.legacy&&(s.unit!=="%"||l.unit!=="%"))return null;const a=ft(o),i=K(s),u=K(l);return a===null||i===null||u===null?null:{space:"srgb",color:mt(a,i,u),alpha:e.alpha}}if(n){if(/^oklab\(/i.test(r)){const o=d(r,"oklab",!0);if(!o||o.legacy)return null;const s=o.args.map(u=>E(u.toLowerCase()==="none"?"0":u));if(s.some(u=>!u||u.unit!==""&&u.unit!=="%"))return null;const[l,a,i]=s.map((u,f)=>{const h=u;return h.unit!=="%"?h.value:h.value/100*(f===0?1:.4)});return{space:"oklch",color:V({L:M(l),a,b:i}),alpha:o.alpha}}const e=r.toLowerCase();if(Object.prototype.hasOwnProperty.call(P,e))return W(P[e],n);if(e==="transparent")return{space:"srgb",color:{r:0,g:0,b:0},alpha:0};const c=r.match(new RegExp("^color\\("+p+"*srgb"+p+"+","i"));if(c){const o=d(`color(${r.slice(c[0].length)}`,"color",!0);if(!o||o.legacy)return null;const s=o.args.map(X);if(s.some(u=>u===null))return null;const[l,a,i]=s;return{space:"srgb",color:{r:l,g:a,b:i},alpha:o.alpha}}}return null}function x(t,n){const r=Math.pow(10,n);return Math.round(t*r)/r}export{Rt as ACCEPTED_COLOR_FORMS,U as BLACK_INK,z as WHITE_INK,G as apcaContrast,M as clampChannel,et as clampChromaAndGamutMap,dt as deltaEOK,ct as deriveSemantic,_t as deriveSemanticWithContrast,ot as ensureContrast,w as gammaToLinear,C as gamutMapToSRGB,S as isInSRGBGamut,at as linearRgbToOklab,V as oklabToOklch,k as oklchToOklab,T as oklchToSRGB,Tt as parseCssColor,Mt as parseCssColorValue,rt as parseOklch,Ct as rotateHue,xt as serializeOklch,st as srgbToLinearRGB,ut as srgbToOklab};
@@ -1 +1 @@
1
- import{apcaContrast as k,BLACK_INK as I,deriveSemantic as T,ensureContrast as y,parseOklch as O,serializeOklch as h,WHITE_INK as S}from"./color-engine.js";import{SEMANTIC_COLOR_PROPERTIES as _,SETTABLE_COMPONENT_PROPERTIES as N}from"./settable-component-properties.js";import{resolveLightnessReference as j}from"./theme-core.js";import{resolveMappingSource as x}from"./variant-engine.js";function E(e,{theme:i,variants:d,semanticProperties:r}){if(typeof e=="string")return _.has(e)?r[e]:e;const o=x(e.source,d,i.anchors);if(!o)return;const l=j(i.lightness,i.tones,e.lightness);return h(T(o,l,0,o.c))}function M(e,i,d){const r=t=>Math.abs(k(t,i)),o=r(e);if(o>=d)return{resolved:h(e),fromLc:o,toLc:o};let l=h(y(e,i,d)),u=r(O(l));if(u<d)for(const t of[I,S]){const n=r(t);n>u&&(l=h(t),u=n)}return{resolved:l,fromLc:o,toLc:u}}function w(e,i,d,r=N){const o={},l=Object.entries(e.values);if(l.length===0)return o;const u=(t,n,s,c)=>{o[t]=s,d?.push({name:t,context:e.context,authored:n,resolved:s,overridesRoot:n!==null&&(e.winners.get(t)?.overridesRoot??!1),...c})};for(const[t,n]of l){const s=r[t];if(s.pairsWith!==void 0)continue;let c;if(s.syntax==="color"?c=E(n,i):typeof n=="string"&&(c=n),c===void 0)continue;u(t,n,c);const f=s.derives;f&&typeof n=="string"&&Object.prototype.hasOwnProperty.call(f.values,n)&&(o[f.property]=f.values[n])}for(const[t,{pairsWith:n,targetLc:s,fitFallback:c}]of Object.entries(r)){if(n===void 0||s===void 0||c===void 0)continue;const f=e.values[t],g=o[n];if(f===void 0&&g===void 0)continue;const{semanticProperties:m}=i,b=r[n]?.fitFallback??n,p=g??m[b],a=f===void 0?m[c]:E(f,i),v=p===void 0?null:O(p),L=a===void 0?null:O(a);if(p===void 0||a===void 0||!v||!L)continue;const{resolved:C,fromLc:P,toLc:R}=M(L,v,s);u(t,f??null,C,d?{requested:a,adjusted:a!==C,apca:{against:n,againstColor:p,fromLc:P,toLc:R},targetLc:s}:void 0)}return o}export{w as compileComponentProperties};
1
+ import{apcaContrast as b,BLACK_INK as R,deriveSemantic as T,ensureContrast as k,parseOklch as h,serializeOklch as g,WHITE_INK as _}from"./color-engine.js";import{SEMANTIC_COLOR_PROPERTIES as x,SETTABLE_COMPONENT_PROPERTIES as N}from"./settable-component-properties.js";import{resolveLightnessReference as S}from"./theme-core.js";import{resolveMappingSource as w}from"./variant-engine.js";const M={none:"none",1:"var(--esp-shadow-1)",2:"var(--esp-shadow-2)",3:"var(--esp-shadow-3)"};function C(o,{theme:i,variants:l,semanticProperties:c}){if(typeof o=="string")return x.has(o)?c[o]:o;const t=w(o.source,l,i.anchors);if(!t)return;const d=S(i.lightness,i.tones,o.lightness);return g(T(t,d,0,t.c))}function j(o,i,l){const c=s=>Math.abs(b(s,i)),t=c(o);if(t>=l)return{resolved:g(o),fromLc:t,toLc:t};let d=g(k(o,i,l)),u=c(h(d));if(u<l)for(const s of[R,_]){const n=c(s);n>u&&(d=g(s),u=n)}return{resolved:d,fromLc:t,toLc:u}}function B(o,i,l,c=N){const t={},d=Object.entries(o.values);if(d.length===0)return t;const u=(s,n,e,r)=>{t[s]=e,l?.push({name:s,context:o.context,authored:n,resolved:e,overridesRoot:n!==null&&(o.winners.get(s)?.overridesRoot??!1),...r})};for(const[s,n]of d){const e=c[s];if(e.pairsWith!==void 0)continue;let r;if(e.syntax==="color"?r=C(n,i):e.syntax==="elevation"&&typeof n=="string"?r=M[n]:typeof n=="string"&&(r=n==="0"&&e.unit&&e.syntax.includes("length")?`0${e.unit}`:n),r===void 0)continue;u(s,n,r),e.toggle&&(t[e.toggle]=" ");const f=e.derives;f&&typeof n=="string"&&Object.prototype.hasOwnProperty.call(f.values,n)&&(t[f.property]=f.values[n])}for(const[s,{pairsWith:n,targetLc:e,fitFallback:r}]of Object.entries(c)){if(n===void 0||e===void 0||r===void 0)continue;const f=o.values[s],v=t[n];if(f===void 0&&v===void 0)continue;const{semanticProperties:O}=i,y=c[n]?.fitFallback??n,p=v??O[y],a=f===void 0?O[r]:C(f,i),E=p===void 0?null:h(p),L=a===void 0?null:h(a);if(p===void 0||a===void 0||!E||!L)continue;const{resolved:m,fromLc:I,toLc:P}=j(L,E,e);u(s,f??null,m,l?{requested:a,adjusted:a!==m,apca:{against:n,againstColor:p,fromLc:I,toLc:P},targetLc:e}:void 0)}return t}export{B as compileComponentProperties};
@@ -1 +1 @@
1
- import{PUBLIC_TOKEN_NAMES as a,PUBLIC_TOKEN_PATTERNS as i}from"./public-token-catalog.generated.js";import{isSettableComponentPropertyName as l,PRIVATE_COMPONENT_PROPERTY_PREFIX as c,SETTABLE_COMPONENT_PROPERTIES as u}from"./settable-component-properties.js";import{PUBLIC_TOKEN_NAMES as h,PUBLIC_TOKEN_PATTERNS as C}from"./public-token-catalog.generated.js";const p=new Set(a),f=i.map(e=>new RegExp(e)),m=Object.keys(u);function T(e){return e.startsWith(c)?"private":l(e)?"settable":p.has(e)||f.some(t=>t.test(e))?"not_settable":"unknown"}function P(e,t){let o=Array.from({length:t.length+1},(n,s)=>s);for(let n=0;n<e.length;n+=1){const s=[n+1];for(let r=0;r<t.length;r+=1)s.push(Math.min(o[r+1]+1,s[r]+1,o[r]+ +(e[n]!==t[r])));o=s}return o[t.length]}function _(e,t=m){let o,n=1/0;for(const s of t){const r=P(e,s);(o===void 0||r<n||r===n&&s<o)&&(o=s,n=r)}return o}function d(e){if(!e)return"a JSON object of settable component property names and values";if(e.syntax==="color")return`${e.allowedValues?.join(", ")??"a semantic color token"} or a { source, lightness } mapping`;const t=e.allowedValues?.join(", ");if(e.syntax==="keyword")return`one of ${t}`;const o=`a length from ${e.min}${e.unit} to ${e.max}${e.unit}, or 0`;return t?`${o}, or one of ${t}`:o}export{h as PUBLIC_TOKEN_NAMES,C as PUBLIC_TOKEN_PATTERNS,T as classifyComponentPropertyName,d as describeAcceptedComponentPropertyValue,_ as nearestSettableComponentProperty};
1
+ import{PUBLIC_TOKEN_NAMES as a,PUBLIC_TOKEN_PATTERNS as i}from"./public-token-catalog.generated.js";import{isSettableComponentPropertyName as l,PRIVATE_COMPONENT_PROPERTY_PREFIX as u,SETTABLE_COMPONENT_PROPERTIES as f}from"./settable-component-properties.js";import{PUBLIC_TOKEN_NAMES as O,PUBLIC_TOKEN_PATTERNS as h}from"./public-token-catalog.generated.js";const m=new Set(a),c=i.map(e=>new RegExp(e)),p=Object.keys(f);function b(e){return e.startsWith(u)?"private":l(e)?"settable":m.has(e)||c.some(t=>t.test(e))?"not_settable":"unknown"}function N(e,t){let o=Array.from({length:t.length+1},(n,s)=>s);for(let n=0;n<e.length;n+=1){const s=[n+1];for(let r=0;r<t.length;r+=1)s.push(Math.min(o[r+1]+1,s[r]+1,o[r]+ +(e[n]!==t[r])));o=s}return o[t.length]}function d(e,t=p){let o,n=1/0;for(const s of t){const r=N(e,s);(o===void 0||r<n||r===n&&s<o)&&(o=s,n=r)}return o}function T(e){if(!e)return"a JSON object of settable component property names and values";if(e.syntax==="color")return`${e.allowedValues?.join(", ")??"a semantic color token"} or a { source, lightness } mapping`;if(e.syntax==="elevation")return"one of none, 1, 2, 3";if(e.syntax==="shadow-geometry")return`an inline offset, a block offset and an optional blur in px, rem or em, within ${e.max}rem`;if(e.syntax==="number")return`a unitless number from ${e.min} to ${e.max} in a JSON string`;const t=e.allowedValues?.join(", ");if(e.syntax==="keyword")return`one of ${t}`;const o=`a length from ${e.min}${e.unit} to ${e.max}${e.unit}, or 0`;return t?`${o}, or one of ${t}`:o}export{O as PUBLIC_TOKEN_NAMES,h as PUBLIC_TOKEN_PATTERNS,b as classifyComponentPropertyName,T as describeAcceptedComponentPropertyValue,d as nearestSettableComponentProperty};
@@ -1 +1 @@
1
- import{parseCssColor as P}from"./color-engine.js";import{SEMANTIC_COLOR_PROPERTIES as y,SETTABLE_COMPONENT_PROPERTIES as p}from"./settable-component-properties.js";import{isColorSource as g,isLightnessKey as b,isObjectRecord as u,isThemeSlug as m,isThemeTone as S,toneReferenceName as T}from"./theme-mapping-grammar.js";import{parseAnchorSource as E}from"./variant-engine.js";const C=/[;{}]|!\s*important|(?:var|calc|url)\s*\(/i,R=/^(-?(?:\d+(?:\.\d+)?|\.\d+))(em|rem)$/,h=new WeakMap;function l(e,n){return u(e)&&Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0}function j(e,n){if(g(e))return!0;if(typeof e!="string")return!1;const t=E(e);if(!t||!m(t.name))return!1;const{name:o,slot:r}=t;if(r!==void 0&&!m(r))return!1;const i=l(n,o),s=typeof i=="string"&&r===void 0?i:l(i,r??"color");return typeof s=="string"&&P(s)!==null}function N(e,n){if(b(e))return!0;const t=T(e);return t!==null&&n.has(t)}function M(e,n,t){if(typeof e=="string")return(n.allowedValues?n.allowedValues.includes(e):y.has(e))?e:void 0;if(!u(e)||Reflect.ownKeys(e).length!==2)return;const o=l(e,"source"),r=l(e,"lightness");if(!(!j(o,t.anchors)||!N(r,t.tones)))return{source:o,lightness:r}}function L(e,n){if(e==="0")return!0;const t=R.exec(e);if(!t||t[0]!==e||t[2]!==n.unit)return!1;const o=Number(t[1]);return Number.isFinite(o)&&o>=n.min&&o<=n.max}function V(e,n,t){if(!(typeof e=="string"&&C.test(e))){if(n.syntax==="color")return M(e,n,t);if(typeof e=="string"&&(n.syntax!=="keyword"&&L(e,n)||n.syntax!=="length"&&n.allowedValues?.includes(e)))return e}}function w(e,n){const t=new Set(n);if(u(e))for(const[o,r]of Object.entries(e))S(o,r)&&t.add(o);return t}function _(e,n,t){const o=new Map,{map:r,context:i}=e;if(r===void 0)return o;if(!u(r))return t.push({context:i,property:null,code:"bad_value"}),o;for(const[s,f]of Object.entries(r)){if(!Object.prototype.hasOwnProperty.call(n,s)){t.push({context:i,property:s,code:"unregistered"}),o.set(s,{valid:!1,authored:f});continue}const c=V(f,n[s],e);c===void 0?(t.push({context:i,property:s,code:"bad_value"}),o.set(s,{valid:!1,authored:f})):o.set(s,{valid:!0,authored:c})}return o}function O(e,n,t,o,r){const i=_(e,n,o),s=new Map(r?.winners),f={...r?.values};for(const[c,a]of i)if(s.set(c,{...a,context:e.context,overridesRoot:a.valid&&(r?.declarations.has(c)??!1)}),a.valid){f[c]=a.authored,t.add(c);const{derives:d}=n[c];d&&typeof a.authored=="string"&&Object.prototype.hasOwnProperty.call(d.values,a.authored)&&t.add(d.property)}else delete f[c];return{context:e.context,supplied:e.map!==void 0||(r?.supplied??!1),declarations:i,winners:s,values:f}}function x(e,n){const t=[],o=new Set,r=e.anchors,i=w(e.tones),s=O({map:e.componentProperties,context:null,anchors:r,tones:i},n,o,t),f=new Map;if(u(e.contexts))for(const[c,a]of Object.entries(e.contexts)){if(!u(a))continue;const d={map:a.componentProperties,context:c,anchors:r,tones:w(a.tones,i)};f.set(c,O(d,n,o,t,s))}for(const[c,{pairsWith:a}]of Object.entries(n))a!==void 0&&Object.prototype.hasOwnProperty.call(n,a)&&o.has(a)&&o.add(c);return{root:s,contexts:f,findings:t,candidates:o}}function K(e,n,t=p){return{...x(e,t),scheme:n}}function W(e){let n=h.get(e);return n||(n=x(e,p),h.set(e,n)),n}export{W as getComponentPropertyAnalysis,K as normalizeComponentProperties};
1
+ import{parseCssColor as E}from"./color-engine.js";import{ELEVATION_VALUES as P,SEMANTIC_COLOR_PROPERTIES as g,SETTABLE_COMPONENT_PROPERTIES as m}from"./settable-component-properties.js";import{isColorSource as S,isLightnessKey as y,isObjectRecord as u,isThemeSlug as h,isThemeTone as R,toneReferenceName as T}from"./theme-mapping-grammar.js";import{parseAnchorSource as N}from"./variant-engine.js";const M=/[;{}]|!\s*important|(?:var|calc|url)\s*\(/i,_=/^(-?(?:\d+(?:\.\d+)?|\.\d+))(em|rem)$/,C=/^(0|-?(?:\d+(?:\.\d+)?|\.\d+)(?:px|em|rem))$/,L=16,j=/^(?:\d+(?:\.\d+)?|\.\d+)$/,x=new WeakMap;function l(e,n){return u(e)&&Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0}function V(e,n){if(S(e))return!0;if(typeof e!="string")return!1;const t=N(e);if(!t||!h(t.name))return!1;const{name:o,slot:r}=t;if(r!==void 0&&!h(r))return!1;const i=l(n,o),s=typeof i=="string"&&r===void 0?i:l(i,r??"color");return typeof s=="string"&&E(s)!==null}function A(e,n){if(y(e))return!0;const t=T(e);return t!==null&&n.has(t)}function z(e,n,t){if(typeof e=="string")return(n.allowedValues?n.allowedValues.includes(e):g.has(e))?e:void 0;if(!u(e)||Reflect.ownKeys(e).length!==2)return;const o=l(e,"source"),r=l(e,"lightness");if(!(!V(o,t.anchors)||!A(r,t.tones)))return{source:o,lightness:r}}function U(e,n){const t=_.exec(e);if(e==="0")return!0;if(!t||t[0]!==e||t[2]!==n.unit)return!1;const o=Number(t[1]);return Number.isFinite(o)&&o>=n.min&&o<=n.max}function W(e){const n=e.endsWith("px")?"px":e.endsWith("rem")?"rem":e.endsWith("em")?"em":"",t=Number.parseFloat(e);return n==="px"?t/L:t}function G(e,n){const t=e.split(" ");if(t.length<2||t.length>3||!t.every(s=>C.test(s)))return!1;const[o,r,i]=t.map(W);return[o,r].every(s=>Math.abs(s)<=n.max)&&(i===void 0||i>=0&&i<=n.max)}function I(e,n,t){if(!(typeof e=="string"&&M.test(e))){if(n.syntax==="color")return z(e,n,t);if(typeof e=="string"){if(n.syntax==="elevation")return P.includes(e)?e:void 0;if(n.syntax==="shadow-geometry")return G(e,n)?e:void 0;if(n.syntax==="number"){const o=Number(e);return j.exec(e)?.[0]===e&&o>=n.min&&o<=n.max?e:void 0}if(n.syntax!=="keyword"&&U(e,n)||n.syntax!=="length"&&n.allowedValues?.includes(e))return e}}}function w(e,n){const t=new Set(n);if(u(e))for(const[o,r]of Object.entries(e))R(o,r)&&t.add(o);return t}function $(e,n,t){const o=new Map,{map:r,context:i}=e;if(r===void 0)return o;if(!u(r))return t.push({context:i,property:null,code:"bad_value"}),o;for(const[s,f]of Object.entries(r)){if(!Object.prototype.hasOwnProperty.call(n,s)){t.push({context:i,property:s,code:"unregistered"}),o.set(s,{valid:!1,authored:f});continue}const c=I(f,n[s],e);c===void 0?(t.push({context:i,property:s,code:"bad_value"}),o.set(s,{valid:!1,authored:f})):o.set(s,{valid:!0,authored:c})}return o}function O(e,n,t,o,r){const i=$(e,n,o),s=new Map(r?.winners),f={...r?.values};for(const[c,a]of i)if(s.set(c,{...a,context:e.context,overridesRoot:a.valid&&(r?.declarations.has(c)??!1)}),a.valid){f[c]=a.authored,t.add(c);const{derives:d,toggle:p}=n[c];p&&t.add(p),d&&typeof a.authored=="string"&&Object.prototype.hasOwnProperty.call(d.values,a.authored)&&t.add(d.property)}else delete f[c];return{context:e.context,supplied:e.map!==void 0||(r?.supplied??!1),declarations:i,winners:s,values:f}}function b(e,n){const t=[],o=new Set,r=e.anchors,i=w(e.tones),s=O({map:e.componentProperties,context:null,anchors:r,tones:i},n,o,t),f=new Map;if(u(e.contexts))for(const[c,a]of Object.entries(e.contexts)){if(!u(a))continue;const d={map:a.componentProperties,context:c,anchors:r,tones:w(a.tones,i)};f.set(c,O(d,n,o,t,s))}for(const[c,{pairsWith:a}]of Object.entries(n))a!==void 0&&Object.prototype.hasOwnProperty.call(n,a)&&o.has(a)&&o.add(c);return{root:s,contexts:f,findings:t,candidates:o}}function K(e,n,t=m){return{...b(e,t),scheme:n}}function D(e){let n=x.get(e);return n||(n=b(e,m),x.set(e,n)),n}export{D as getComponentPropertyAnalysis,K as normalizeComponentProperties};
@@ -1,4 +1,4 @@
1
- var d=function(v,e,t,r){var o=arguments.length,n=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(v,e,t,r);else for(var s=v.length-1;s>=0;s--)(c=v[s])&&(n=(o<3?c(n):o>3?c(e,t,n):c(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n};import{css as R,LitElement as C}from"lit";import{property as u,state as T}from"lit/decorators.js";import{flattenedParent as b,GoverningRootObserver as x}from"./governing-root.js";import{compileComponentProperties as S}from"./component-property-compiler.js";import{getComponentPropertyAnalysis as O}from"./component-property-normalizer.js";import{addComponentPropertyResets as _}from"./component-property-resets.js";import{ScopedStyleDeclarations as P}from"./scoped-style-declarations.js";import{traverseToClosest as E}from"./utilities.js";import{parseCssColor as U,serializeOklch as A,gamutMapToSRGB as z}from"./color-engine.js";import{computeVariants as m}from"../root/helpers/compute-variants.js";import{computeSemanticProperties as g}from"../root/helpers/compute-semantic-properties.js";import{DocumentSpriteController as I}from"./document-sprite.js";import{dataCompanionProperties as N}from"../root/helpers/data-companion-properties.js";import{dataSeriesProperties as j}from"../root/helpers/compute-theme-properties.js";import{lightnessRampProperties as B}from"../root/helpers/lightness-ramp-properties.js";import{surfacePolarityProperty as D}from"../root/helpers/surface-polarity-property.js";import{ELEVATION_PROPERTIES as V,TYPE_ROLE_COLOR_PROPERTIES as L}from"./scale-engine.js";import{resolveContextTheme as y,resolveDataColorSource as M,semanticToCSS as W}from"./theme-core.js";import{alignAttributeTextInheritance as q,focusRing as $}from"./style-fragments.js";import{syncNormalizedAttribute as G}from"./attribute-helpers.js";import{INTENT_VARIANTS as k,normalizeIntentVariant as H}from"./intent-values.js";import{ESP_EVENTS as Z}from"./events.js";import{surfaceLayerAttributes as w,surfaceLayerColor as Y}from"./surface-layer.js";class i extends C{get espRoot(){return this.rootObserver.root}get seedColor(){return this.seedColorBacker}set seedColor(e){this.seedColorBacker=e}focusResolvedElementAfterUpdate(e,t){const r=()=>{const o=e();return o?(o.focus(t),!0):!1};r()||this.updateComplete.then(()=>{r()})}focusShadowElementAfterUpdate(e,t){this.focusResolvedElementAfterUpdate(()=>this.shadowRoot?.querySelector(e),t)}emitValueChanged(e){this.dispatchEvent(new CustomEvent(Z.VALUE_CHANGED,{detail:e,bubbles:!0,composed:!0}))}get intent(){return this.intentBacker}set intent(e){const t=typeof e=="string"?e.trim():"";t!==""&&!k.includes(t)&&!this.warnedUnknownIntents.has(t)&&(this.warnedUnknownIntents.add(t),console.warn(`Espalier intent: "${t}" is not an intent; expected one of ${k.join(", ")}. Treating it as "neutral".`));const r=this.intentBacker,o=H(e);G(this,"intent",o),o!==r&&(this.intentBacker=o,this.requestUpdate("intent",r),this.applyTokensWhenRootReady())}get context(){return this.contextBacker}set context(e){const t=e??"";t!==this.contextBacker&&(this.contextBacker=t,this.applyTokensWhenRootReady(),this.refreshDescendantIntentDerivations())}refreshDescendantIntentDerivations(){const e=new Set,t=o=>{for(const n of Array.from(o.children))r(n)},r=o=>{if(!e.has(o)){if(e.add(o),o instanceof i&&o.applyTokensWhenRootReady(),o.shadowRoot&&t(o.shadowRoot),o instanceof HTMLSlotElement)for(const n of o.assignedElements({flatten:!0}))r(n);t(o)}};t(this),this.shadowRoot&&t(this.shadowRoot)}resolveAncestorZoneTheme(e){let t=b(this);for(;t;){if(t instanceof Element&&t.localName==="esp-root")return null;if(t instanceof i){const r=t.contextBacker.trim();if(r){const o=this.resolveNamedContextTheme(e,r);if(o)return o}}t=b(t)}return null}connectedCallback(){super.connectedCallback(),this.rootObserver.connect()}disconnectedCallback(){super.disconnectedCallback(),this.rootObserver.disconnect()}firstUpdated(e){if(this.isConnected&&!this.rootObserver.refresh())throw new Error("No esp-root ancestor found. Espalier components must be placed inside an <esp-root> element.");this.rootObserver.whenReady(this.applyReadyRoot)}governingRootChanged(e){}syncRootMetadata(e){this.scheme=e.scheme==="dark"?"dark":"light",this.seedColor=e.seedColor}applyTokensWhenRootReady(){this.rootObserver.refresh(),this.rootObserver.whenReady(this.applyReadyRoot)}constructor(){super(),this.seedColorBacker="oklch(0.7 0.125 216)",this.rootObserver=new x(this,(e,t)=>{e!==t&&(this.scopedTokens.clear(),this.governingRootChanged(e),this.isConnected&&this.requestUpdate()),e&&(this.syncRootMetadata(e),this.rootObserver.whenReady(this.applyReadyRoot))}),this.contextBacker="",this.scopedTokens=new P(this),this.warnedUnknownContexts=new Set,this.intentBacker="neutral",this.intentEmitsTokens=!0,this.warnedUnknownIntents=new Set,this.correlationId=globalThis.crypto?.randomUUID?.()??Math.random().toString(36),this.scheme="light",this.applyReadyRoot=e=>{this.syncRootMetadata(e),this.applyScopedColorTokens()},this.rootObserver.subscribe("scheme-changed",()=>{const e=this.espRoot;!e||this.scheme===e.scheme||(this.syncRootMetadata(e),this.rootObserver.whenReady(this.applyReadyRoot))}),this.rootObserver.subscribe("seed-color-changed",({seedColor:e})=>{this.seedColor=e,this.applyScopedColorTokens()}),this.rootObserver.subscribe("theme-changed",()=>{const e=this.espRoot;e&&this.syncRootMetadata(e),this.applyScopedColorTokens()}),this.rootObserver.subscribe("icon-sprite-url-changed",()=>this.requestUpdate()),new I(this,this.rootObserver)}traverseToClosest(e){return E(this,e)}applyScopedColorTokens(){if(!this.espRoot)return;const e=this.intentEmitsTokens?i.intentColorSources[this.intentBacker]:"";if(!e&&!this.context.trim()){this.scopedTokens.clear();return}const t=this.espRoot.activeTheme;if(!t){this.scopedTokens.clear();return}const r=this.resolveContextTheme(t),o=r.theme,n=U(o.seedColor);if(!n)return;const c=m(n,o),s={};if(r.applied){Object.assign(s,g(o,c));const{candidates:l,contexts:h}=O(t),p=h.get(r.name);if(p&&l.size>0){const a=S(p,{theme:o,variants:c,semanticProperties:s});_(a,l),Object.assign(s,a)}s["--_esp-context-shadow"]="var(--esp-color-shadow)",Object.assign(s,D(s)),Object.assign(s,B(o)),Object.assign(s,V),Object.assign(s,L),Object.assign(s,N(s,j(o,n,a=>(typeof a=="string"?M(a,o.anchors):null)??o.seedColor)))}if(e){let l=o;r.applied||(l=this.resolveAncestorZoneTheme(t)??o);const h=l===o?c:m(n,l),p=g(l,h,{effectiveSource:(a,f)=>i.semanticActionTokens.has(a)?e:f});s["--esp-color-primary"]=A(z(h[e]));for(const a of i.semanticActionTokens){const f=W(a);s[f]=p[f]}}this.scopedTokens.apply(s)}resolveContextTheme(e){const t=this.context.trim();if(!t)return{applied:!1,theme:e};const r=this.resolveNamedContextTheme(e,t);return r?{applied:!0,name:t,theme:r}:(this.warnUnknownContextWhenSettled(t),{applied:!1,theme:e})}warnUnknownContextWhenSettled(e){if(this.warnedUnknownContexts.has(e))return;const t=this.espRoot;if(t&&!t.themeSettled){t.whenThemeSettled().then(this.rootObserver.guard(r=>{if(this.context.trim()!==e)return;const o=r.activeTheme;o&&y(o,e)||this.warnUnknownContextWhenSettled(e)}));return}this.warnedUnknownContexts.add(e),console.warn(`Espalier context: "${e}" is not defined by the active theme; inheriting root tokens.`)}resolveNamedContextTheme(e,t){return y(e,t)}}i.intentColorSources={danger:"danger",info:"info",neutral:"",success:"success",warning:"warning"},i.semanticActionTokens=new Set(["actionBackground","actionText"]),i.styles=[w(":host"),w("[surface-layer]"),$(".esp-field:focus-within","--esp-field-focus-shadow"),q,R`
1
+ var d=function(v,e,t,r){var o=arguments.length,n=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(v,e,t,r);else for(var s=v.length-1;s>=0;s--)(c=v[s])&&(n=(o<3?c(n):o>3?c(e,t,n):c(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n};import{css as R,LitElement as C}from"lit";import{property as u,state as T}from"lit/decorators.js";import{flattenedParent as b,GoverningRootObserver as x}from"./governing-root.js";import{compileComponentProperties as S}from"./component-property-compiler.js";import{getComponentPropertyAnalysis as O}from"./component-property-normalizer.js";import{addComponentPropertyResets as _}from"./component-property-resets.js";import{ScopedStyleDeclarations as P}from"./scoped-style-declarations.js";import{traverseToClosest as E}from"./utilities.js";import{parseCssColor as U,serializeOklch as A,gamutMapToSRGB as z}from"./color-engine.js";import{computeVariants as m}from"../root/helpers/compute-variants.js";import{computeSemanticProperties as g}from"../root/helpers/compute-semantic-properties.js";import{DocumentSpriteController as I}from"./document-sprite.js";import{dataCompanionProperties as N}from"../root/helpers/data-companion-properties.js";import{dataSeriesProperties as j}from"../root/helpers/compute-theme-properties.js";import{lightnessRampProperties as B}from"../root/helpers/lightness-ramp-properties.js";import{surfacePolarityProperty as D}from"../root/helpers/surface-polarity-property.js";import{ELEVATION_PROPERTIES as V,TYPE_ROLE_COLOR_PROPERTIES as L}from"./scale-engine.js";import{resolveContextTheme as y,resolveDataColorSource as M,semanticToCSS as W}from"./theme-core.js";import{alignAttributeTextInheritance as q,focusRing as $}from"./style-fragments.js";import{syncNormalizedAttribute as G}from"./attribute-helpers.js";import{INTENT_VARIANTS as k,normalizeIntentVariant as H}from"./intent-values.js";import{ESP_EVENTS as Z}from"./events.js";import{surfaceLayerAttributes as w,surfaceLayerColor as F}from"./surface-layer.js";class i extends C{get espRoot(){return this.rootObserver.root}get seedColor(){return this.seedColorBacker}set seedColor(e){this.seedColorBacker=e}focusResolvedElementAfterUpdate(e,t){const r=()=>{const o=e();return o?(o.focus(t),!0):!1};r()||this.updateComplete.then(()=>{r()})}focusShadowElementAfterUpdate(e,t){this.focusResolvedElementAfterUpdate(()=>this.shadowRoot?.querySelector(e),t)}emitValueChanged(e){this.dispatchEvent(new CustomEvent(Z.VALUE_CHANGED,{detail:e,bubbles:!0,composed:!0}))}get intent(){return this.intentBacker}set intent(e){const t=typeof e=="string"?e.trim():"";t!==""&&!k.includes(t)&&!this.warnedUnknownIntents.has(t)&&(this.warnedUnknownIntents.add(t),console.warn(`Espalier intent: "${t}" is not an intent; expected one of ${k.join(", ")}. Treating it as "neutral".`));const r=this.intentBacker,o=H(e);G(this,"intent",o),o!==r&&(this.intentBacker=o,this.requestUpdate("intent",r),this.applyTokensWhenRootReady())}get context(){return this.contextBacker}set context(e){const t=e??"";t!==this.contextBacker&&(this.contextBacker=t,this.applyTokensWhenRootReady(),this.refreshDescendantIntentDerivations())}refreshDescendantIntentDerivations(){const e=new Set,t=o=>{for(const n of Array.from(o.children))r(n)},r=o=>{if(!e.has(o)){if(e.add(o),o instanceof i&&o.applyTokensWhenRootReady(),o.shadowRoot&&t(o.shadowRoot),o instanceof HTMLSlotElement)for(const n of o.assignedElements({flatten:!0}))r(n);t(o)}};t(this),this.shadowRoot&&t(this.shadowRoot)}resolveAncestorZoneTheme(e){let t=b(this);for(;t;){if(t instanceof Element&&t.localName==="esp-root")return null;if(t instanceof i){const r=t.contextBacker.trim();if(r){const o=this.resolveNamedContextTheme(e,r);if(o)return o}}t=b(t)}return null}connectedCallback(){super.connectedCallback(),this.rootObserver.connect()}disconnectedCallback(){super.disconnectedCallback(),this.rootObserver.disconnect()}firstUpdated(e){if(this.isConnected&&!this.rootObserver.refresh())throw new Error("No esp-root ancestor found. Espalier components must be placed inside an <esp-root> element.");this.rootObserver.whenReady(this.applyReadyRoot)}governingRootChanged(e){}syncRootMetadata(e){this.scheme=e.scheme==="dark"?"dark":"light",this.seedColor=e.seedColor}applyTokensWhenRootReady(){this.rootObserver.refresh(),this.rootObserver.whenReady(this.applyReadyRoot)}constructor(){super(),this.seedColorBacker="oklch(0.7 0.125 216)",this.rootObserver=new x(this,(e,t)=>{e!==t&&(this.scopedTokens.clear(),this.governingRootChanged(e),this.isConnected&&this.requestUpdate()),e&&(this.syncRootMetadata(e),this.rootObserver.whenReady(this.applyReadyRoot))}),this.contextBacker="",this.scopedTokens=new P(this),this.warnedUnknownContexts=new Set,this.intentBacker="neutral",this.intentEmitsTokens=!0,this.warnedUnknownIntents=new Set,this.correlationId=globalThis.crypto?.randomUUID?.()??Math.random().toString(36),this.scheme="light",this.applyReadyRoot=e=>{this.syncRootMetadata(e),this.applyScopedColorTokens()},this.rootObserver.subscribe("scheme-changed",()=>{const e=this.espRoot;!e||this.scheme===e.scheme||(this.syncRootMetadata(e),this.rootObserver.whenReady(this.applyReadyRoot))}),this.rootObserver.subscribe("seed-color-changed",({seedColor:e})=>{this.seedColor=e,this.applyScopedColorTokens()}),this.rootObserver.subscribe("theme-changed",()=>{const e=this.espRoot;e&&this.syncRootMetadata(e),this.applyScopedColorTokens()}),this.rootObserver.subscribe("icon-sprite-url-changed",()=>this.requestUpdate()),new I(this,this.rootObserver)}traverseToClosest(e){return E(this,e)}applyScopedColorTokens(){if(!this.espRoot)return;const e=this.intentEmitsTokens?i.intentColorSources[this.intentBacker]:"";if(!e&&!this.context.trim()){this.scopedTokens.clear();return}const t=this.espRoot.activeTheme;if(!t){this.scopedTokens.clear();return}const r=this.resolveContextTheme(t),o=r.theme,n=U(o.seedColor);if(!n)return;const c=m(n,o),s={};if(r.applied){Object.assign(s,g(o,c));const{candidates:l,contexts:h}=O(t),p=h.get(r.name);if(p&&l.size>0){const a=S(p,{theme:o,variants:c,semanticProperties:s});_(a,l),Object.assign(s,a)}s["--_esp-context-shadow"]="var(--esp-color-shadow)",Object.assign(s,D(s)),Object.assign(s,B(o)),Object.assign(s,V),Object.assign(s,L),Object.assign(s,N(s,j(o,n,a=>(typeof a=="string"?M(a,o.anchors):null)??o.seedColor)))}if(e){let l=o;r.applied||(l=this.resolveAncestorZoneTheme(t)??o);const h=l===o?c:m(n,l),p=g(l,h,{includeFooterInk:!1,effectiveSource:(a,f)=>i.semanticActionTokens.has(a)?e:f});s["--esp-color-primary"]=A(z(h[e]));for(const a of i.semanticActionTokens){const f=W(a);s[f]=p[f]}}this.scopedTokens.apply(s)}resolveContextTheme(e){const t=this.context.trim();if(!t)return{applied:!1,theme:e};const r=this.resolveNamedContextTheme(e,t);return r?{applied:!0,name:t,theme:r}:(this.warnUnknownContextWhenSettled(t),{applied:!1,theme:e})}warnUnknownContextWhenSettled(e){if(this.warnedUnknownContexts.has(e))return;const t=this.espRoot;if(t&&!t.themeSettled){t.whenThemeSettled().then(this.rootObserver.guard(r=>{if(this.context.trim()!==e)return;const o=r.activeTheme;o&&y(o,e)||this.warnUnknownContextWhenSettled(e)}));return}this.warnedUnknownContexts.add(e),console.warn(`Espalier context: "${e}" is not defined by the active theme; inheriting root tokens.`)}resolveNamedContextTheme(e,t){return y(e,t)}}i.intentColorSources={danger:"danger",info:"info",neutral:"",success:"success",warning:"warning"},i.semanticActionTokens=new Set(["actionBackground","actionText"]),i.styles=[w(":host"),w("[surface-layer]"),$(".esp-field:focus-within","--esp-field-focus-shadow"),q,R`
2
2
  :host {
3
3
 
4
4
  --_esp-font-body-fallback: system-ui, sans-serif;
@@ -42,7 +42,7 @@ var d=function(v,e,t,r){var o=arguments.length,n=o<3?e:r===null?r=Object.getOwnP
42
42
  }
43
43
 
44
44
  .esp-field {
45
- --_esp-field-resolved-background: var(--esp-field-background, ${Y(2)});
45
+ --_esp-field-resolved-background: var(--esp-field-background, ${F(2)});
46
46
 
47
47
 
48
48
  --_esp-field-polarity: var(--_esp-surface-polarity, 1);
@@ -0,0 +1,18 @@
1
+ import{css as o}from"lit";const t=o`
2
+ :host {
3
+ --_esp-footer-fit-prefix: ;
4
+ --_esp-footer-ink-mode: fitted;
5
+ }
6
+ :host([surface-layer="1"]),
7
+ :host([surface-layer="3"]),
8
+ :host([surface-layer="4"]) {
9
+ --_esp-footer-fit-prefix: initial;
10
+ --_esp-footer-ink-mode: semantic;
11
+ }
12
+ `,r=o`
13
+ --_esp-footer-local-fitted-heading-color: var(--_esp-footer-fit-prefix)
14
+ var(--_esp-footer-fitted-heading-color);
15
+ `,f=o`
16
+ --_esp-footer-local-fitted-link-color: var(--_esp-footer-fit-prefix)
17
+ var(--_esp-footer-fitted-link-color);
18
+ `;export{r as footerHeadingFit,t as footerInkLayerStyles,f as footerLinkFit};
@@ -0,0 +1 @@
1
+ const o={headings:"--_esp-footer-fitted-heading-color",link:"--_esp-footer-fitted-link-color"},e="--_esp-footer-ink-mode",t="footer-heading-ink",n="footer-link-ink";export{t as FOOTER_HEADING_INK,e as FOOTER_INK_MODE,o as FOOTER_INK_PROPERTIES,n as FOOTER_LINK_INK};
@@ -1 +1 @@
1
- import{buttonPaintRegistration as y}from"../button/paint-registration.js";import{footerPaintRegistration as w}from"../footer/paint-registration.js";import{headerPaintRegistration as T}from"../header/paint-registration.js";import{menuPaintRegistration as j}from"../menu/paint-registration.js";import{resolveConfiguredBrandColor as v}from"./configured-brand-color.js";import{parsePaintColor as x}from"./paint-color.js";import{COLOR_SOURCES as A,SEMANTIC_COLOR_NAMES as E,isObjectRecord as p,semanticToCSS as R}from"./theme.js";const u=new Map([...E.map(t=>[t,R(t)]),...A.map(t=>[t,`--esp-color-${t}`])]),U=Object.freeze([...u.keys()]),l="brand-color";function f(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function V(t){return u.get(t)}function c(t){return typeof t=="string"&&t.trim()!==""}function N(t){return c(t)&&t===t.trim()}function C(t){return t==="text"||t==="graphic"||t==="ring"}function $(t){return Array.isArray(t)&&Array.from(t).every(c)}const g={depth:t=>t==="top-level"||t==="nested",kind:t=>t==="button"||t==="plain"||t==="group",anchor:t=>typeof t=="boolean",canBeCurrent:t=>typeof t=="boolean",icon:t=>t===void 0||typeof t=="boolean"};function H(t){return p(t)&&Object.entries(g).every(([e,n])=>n(t[e]))}const k={element:!0,foreground:!0,background:!0,state:!0,kind:!0,flags:!0,navigation:!0,indicator:!0,paintOpacity:!0};function S(t){return p(t)&&Object.entries(t).every(([e,n])=>f(g,e)&&g[e](n))}function I(t,e,n){if(!p(t)||!Object.keys(t).every(o=>f(k,o))||!c(t.element)||!c(t.state)||!C(t.kind)||!$(t.flags))throw new TypeError(`${e} is not a paint entry.`);for(const o of["foreground","background"]){const r=t[o];if(!c(r)||!(u.has(r)||f(n,r)||o==="foreground"&&r===l))throw new TypeError(`${e} has an unknown ${o} paint identifier "${String(r)}".`)}if(t.paintOpacity!==void 0&&(typeof t.paintOpacity!="number"||!Number.isFinite(t.paintOpacity)||t.paintOpacity<0||t.paintOpacity>1))throw new TypeError(`${e} has an invalid paint opacity.`);if(t.navigation!==void 0&&!S(t.navigation))throw new TypeError(`${e} has an invalid navigation predicate.`);if(t.indicator!==void 0&&(t.indicator!=="blurred-shadow"||t.kind==="text"))throw new TypeError(`${e} has an invalid indicator.`)}function _(t,e=O){if(!p(t))throw new TypeError("Paint entries must be grouped by role.");for(const[n,o]of Object.entries(t)){if(!N(n)||!Array.isArray(o))throw new TypeError(`Paint entries for role "${n}" must be an array on a nonempty role without outer whitespace.`);for(let r=0;r<o.length;r+=1)I(o[r],`Paint entry for "${n}" at index ${r}`,e)}}function z(t){const e=Object.create(null),n=Object.create(null),o=Object.create(null);for(const r of t)for(const[i,a]of Object.entries(r.derivations??{})){if(!c(i)||i===l||u.has(i)||i in o)throw new TypeError(`Paint derivation "${i}" must have a unique identifier.`);o[i]=a}for(const r of t){_(r.entriesByRole,o);for(const[i,a]of Object.entries(r.entriesByRole))(e[i]??=[]).push(...a);for(const[i,a]of Object.entries(r.targets))(n[i]??=[]).push(...a)}for(const r of Object.values(e))Object.freeze(r);for(const r of Object.values(n))Object.freeze(r);return{entriesByRole:Object.freeze(e),targets:Object.freeze(n),derivations:Object.freeze(o)}}const b=z([T,w,j,y]),B=b.entriesByRole,J=b.targets,O=b.derivations;function Q(t,e,n=B,{brandColor:o}={}){const r=f(n,t)?n[t]:[],i=new Set(e.flags),a=r.filter(s=>{if(!s.flags.every(d=>i.has(d)))return!1;if(s.navigation===void 0)return!0;const m=Object.entries(s.navigation);return e.navigation.some(d=>m.every(([P,h])=>d[P]===h))});return v(o)?a:a.map(s=>s.foreground===l?{...s,foreground:"headings"}:s)}function W(t,e,n=O){if(f(n,t))return n[t](e);const o=e.readColor(t);return o?x(o):null}export{l as BRAND_PAINT_ID,B as PAINT_CATALOG,O as PAINT_DERIVATIONS,J as PAINT_TARGETS,U as PAINT_TOKEN_IDS,z as createPaintCatalog,Q as enabledPaintEntries,$ as isPaintFlags,C as isPaintKind,c as isPaintName,H as isPaintNavigationFact,N as isPaintRole,V as paintTokenProperty,W as resolvePaintColor,_ as validatePaintEntries};
1
+ import{buttonPaintRegistration as y}from"../button/paint-registration.js";import{footerPaintRegistration as w}from"../footer/paint-registration.js";import{headerPaintRegistration as T}from"../header/paint-registration.js";import{menuPaintRegistration as j}from"../menu/paint-registration.js";import{resolveConfiguredBrandColor as v}from"./configured-brand-color.js";import{FOOTER_HEADING_INK as x}from"./footer-ink.js";import{parsePaintColor as E}from"./paint-color.js";import{COLOR_SOURCES as A,SEMANTIC_COLOR_NAMES as N,isObjectRecord as p,semanticToCSS as R}from"./theme.js";const u=new Map([...N.map(t=>[t,R(t)]),...A.map(t=>[t,`--esp-color-${t}`])]),V=Object.freeze([...u.keys()]),l="brand-color";function f(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function J(t){return u.get(t)}function c(t){return typeof t=="string"&&t.trim()!==""}function C(t){return c(t)&&t===t.trim()}function I(t){return t==="text"||t==="graphic"||t==="ring"}function _(t){return Array.isArray(t)&&Array.from(t).every(c)}const g={depth:t=>t==="top-level"||t==="nested",kind:t=>t==="button"||t==="plain"||t==="group",anchor:t=>typeof t=="boolean",canBeCurrent:t=>typeof t=="boolean",icon:t=>t===void 0||typeof t=="boolean"};function Q(t){return p(t)&&Object.entries(g).every(([e,n])=>n(t[e]))}const $={element:!0,foreground:!0,background:!0,state:!0,kind:!0,flags:!0,navigation:!0,indicator:!0,paintOpacity:!0};function k(t){return p(t)&&Object.entries(t).every(([e,n])=>f(g,e)&&g[e](n))}function S(t,e,n){if(!p(t)||!Object.keys(t).every(o=>f($,o))||!c(t.element)||!c(t.state)||!I(t.kind)||!_(t.flags))throw new TypeError(`${e} is not a paint entry.`);for(const o of["foreground","background"]){const r=t[o];if(!c(r)||!(u.has(r)||f(n,r)||o==="foreground"&&r===l))throw new TypeError(`${e} has an unknown ${o} paint identifier "${String(r)}".`)}if(t.paintOpacity!==void 0&&(typeof t.paintOpacity!="number"||!Number.isFinite(t.paintOpacity)||t.paintOpacity<0||t.paintOpacity>1))throw new TypeError(`${e} has an invalid paint opacity.`);if(t.navigation!==void 0&&!k(t.navigation))throw new TypeError(`${e} has an invalid navigation predicate.`);if(t.indicator!==void 0&&(t.indicator!=="blurred-shadow"||t.kind==="text"))throw new TypeError(`${e} has an invalid indicator.`)}function z(t,e=b){if(!p(t))throw new TypeError("Paint entries must be grouped by role.");for(const[n,o]of Object.entries(t)){if(!C(n)||!Array.isArray(o))throw new TypeError(`Paint entries for role "${n}" must be an array on a nonempty role without outer whitespace.`);for(let r=0;r<o.length;r+=1)S(o[r],`Paint entry for "${n}" at index ${r}`,e)}}function B(t){const e=Object.create(null),n=Object.create(null),o=Object.create(null);for(const r of t)for(const[i,a]of Object.entries(r.derivations??{})){if(!c(i)||i===l||u.has(i)||i in o)throw new TypeError(`Paint derivation "${i}" must have a unique identifier.`);o[i]=a}for(const r of t){z(r.entriesByRole,o);for(const[i,a]of Object.entries(r.entriesByRole))(e[i]??=[]).push(...a);for(const[i,a]of Object.entries(r.targets))(n[i]??=[]).push(...a)}for(const r of Object.values(e))Object.freeze(r);for(const r of Object.values(n))Object.freeze(r);return{entriesByRole:Object.freeze(e),targets:Object.freeze(n),derivations:Object.freeze(o)}}const O=B([T,w,j,y]),D=O.entriesByRole,W=O.targets,b=O.derivations;function X(t,e,n=D,{brandColor:o}={}){const r=f(n,t)?n[t]:[],i=new Set(e.flags),a=r.filter(s=>{if(!s.flags.every(d=>i.has(d)))return!1;if(s.navigation===void 0)return!0;const m=Object.entries(s.navigation);return e.navigation.some(d=>m.every(([P,h])=>d[P]===h))});return v(o)?a:a.map(s=>s.foreground===l?{...s,foreground:t==="footer"?x:"headings"}:s)}function Y(t,e,n=b){if(f(n,t))return n[t](e);const o=e.readColor(t);return o?E(o):null}export{l as BRAND_PAINT_ID,D as PAINT_CATALOG,b as PAINT_DERIVATIONS,W as PAINT_TARGETS,V as PAINT_TOKEN_IDS,B as createPaintCatalog,X as enabledPaintEntries,_ as isPaintFlags,I as isPaintKind,c as isPaintName,Q as isPaintNavigationFact,C as isPaintRole,J as paintTokenProperty,Y as resolvePaintColor,z as validatePaintEntries};
@@ -1 +1 @@
1
- import{resolveConfiguredBrandColor as N}from"./configured-brand-color.js";import{BRAND_PAINT_ID as k,PAINT_CATALOG as B,PAINT_DERIVATIONS as q,enabledPaintEntries as O,isPaintFlags as D,isPaintName as j,isPaintNavigationFact as x,isPaintRole as M,paintTokenProperty as L,resolvePaintColor as S,validatePaintEntries as F}from"./paint-catalog.js";import{compositePaint as W,MIN_SHADOW_INDICATOR_BLUR as H,paintRequiredRatio as G,shadowIndicatorAlpha as U}from"./paint-color.js";import{firstPaintByIdentity as V,paintIdentity as z}from"./paint-identity.js";import{SEMANTIC_COLOR_PROPERTIES as J,SETTABLE_COMPONENT_PROPERTIES as K}from"./settable-component-properties.js";import{isObjectRecord as p,semanticToCSS as Q}from"./theme-core.js";import{wcagRatio as X}from"./wcag-contrast.js";const Y=["light","dark"],Z=new Set(Object.entries(K).flatMap(([t,{derives:e}])=>e?[t,e.property]:[t]));function rr(t){return p(t)&&D(t.flags)&&Array.isArray(t.navigation)&&Array.from(t.navigation).every(x)}function tr(t){if(!Array.isArray(t))throw new TypeError("Paint surfaces must be an array.");const e=new Set;for(const a of t){if(!p(a)||!M(a.role))throw new TypeError("Each paint surface requires a nonempty role without outer whitespace.");const{role:o,context:l,brandColors:s,features:i}=a;if(e.has(o))throw new TypeError(`Duplicate paint surface role "${o}".`);if(e.add(o),l!=null&&!j(l))throw new TypeError(`Paint surface "${o}" has an invalid context.`);if(s!==void 0&&(!p(s)||Object.entries(s).some(([r,c])=>!["light","dark","generic"].includes(r)||c!==void 0&&typeof c!="string")))throw new TypeError(`Paint surface "${o}" has invalid brand colors.`);if(!p(i)||!Y.every(r=>rr(i[r])))throw new TypeError(`Paint surface "${o}" requires light and dark feature facts.`)}}function er(t,e,a,o,l,s){const{role:i}=t,r=t.context??null,c=a.get(null),h=a.get(r);if(!c||!h)throw new Error(`Paint surface "${i}" requests undefined ${e} context "${r}".`);const d=N(t.brandColors?.[e],t.brandColors?.generic),P=n=>n==="--_esp-context-shadow"?r===null?void 0:h[Q("shadow")]:J.has(n)||Z.has(n)||n.startsWith("--esp-l-")||n==="--_esp-surface-polarity"?h[n]:c[n],E={scheme:e,context:r,readProperty:P,readColor:n=>{if(n===k)return d?.startsWith("--esp-color-")?P(d):d;const f=L(n);return f&&P(f)}},T=t.features[e],g={brandColor:d},b=[...O(i,T,o.entriesByRole,g),...O(i,T,l,g)],I=[...V(b).values()].map(n=>{const{element:f,foreground:w,background:m,kind:R,state:A}=n,y=S(w,E,o.derivations),u=S(m,E,o.derivations);if(!y||!u||u.alpha!==1)throw new Error(`Paint surface "${i}" (${e}) cannot resolve "${f}" ${A}: ${w} on opaque ${m}.`);const $=y.alpha*(n.paintOpacity??1),v=U({alpha:$,blur:n.indicator==="blurred-shadow"?H:0}),_=W({...y,alpha:v},u),C={element:f,foreground:w,background:m,state:A,kind:R,ratio:X(_,u),required:G(R)};return s?.(e,z({role:i,...n}),C),C});return{role:i,context:r,pairs:I}}function fr(t,e,a={},o={entriesByRole:B,derivations:q},l){tr(e),F(a,o.derivations);const s=new Set([...Object.entries(o.entriesByRole),...Object.entries(a)].filter(([,r])=>r.length>0).map(([r])=>r));for(const{role:r}of e)if(!s.has(r))throw new TypeError(`Paint surface "${r}" has no registered paint entries.`);const i=r=>e.map(c=>er(c,r,t[r],o,a,l));return{light:i("light"),dark:i("dark")}}export{fr as measurePaintSurfaces};
1
+ import{FOOTER_INK_PROPERTIES as N}from"./footer-ink.js";import{resolveConfiguredBrandColor as k}from"./configured-brand-color.js";import{BRAND_PAINT_ID as B,PAINT_CATALOG as j,PAINT_DERIVATIONS as q,enabledPaintEntries as I,isPaintFlags as D,isPaintName as x,isPaintNavigationFact as M,isPaintRole as F,paintTokenProperty as L,resolvePaintColor as S,validatePaintEntries as W}from"./paint-catalog.js";import{compositePaint as H,MIN_SHADOW_INDICATOR_BLUR as G,paintRequiredRatio as K,shadowIndicatorAlpha as U}from"./paint-color.js";import{firstPaintByIdentity as V,paintIdentity as z}from"./paint-identity.js";import{SEMANTIC_COLOR_PROPERTIES as J,SETTABLE_COMPONENT_PROPERTIES as Q}from"./settable-component-properties.js";import{isObjectRecord as p,semanticToCSS as X}from"./theme-core.js";import{wcagRatio as Y}from"./wcag-contrast.js";const Z=["light","dark"],rr=new Set([...Object.values(N),...Object.entries(Q).flatMap(([t,{derives:e}])=>e?[t,e.property]:[t])]);function tr(t){return p(t)&&D(t.flags)&&Array.isArray(t.navigation)&&Array.from(t.navigation).every(M)}function er(t){if(!Array.isArray(t))throw new TypeError("Paint surfaces must be an array.");const e=new Set;for(const a of t){if(!p(a)||!F(a.role))throw new TypeError("Each paint surface requires a nonempty role without outer whitespace.");const{role:o,context:l,brandColors:s,features:i}=a;if(e.has(o))throw new TypeError(`Duplicate paint surface role "${o}".`);if(e.add(o),l!=null&&!x(l))throw new TypeError(`Paint surface "${o}" has an invalid context.`);if(s!==void 0&&(!p(s)||Object.entries(s).some(([r,c])=>!["light","dark","generic"].includes(r)||c!==void 0&&typeof c!="string")))throw new TypeError(`Paint surface "${o}" has invalid brand colors.`);if(!p(i)||!Z.every(r=>tr(i[r])))throw new TypeError(`Paint surface "${o}" requires light and dark feature facts.`)}}function nr(t,e,a,o,l,s){const{role:i}=t,r=t.context??null,c=a.get(null),P=a.get(r);if(!c||!P)throw new Error(`Paint surface "${i}" requests undefined ${e} context "${r}".`);const u=k(t.brandColors?.[e],t.brandColors?.generic),h=n=>n==="--_esp-context-shadow"?r===null?void 0:P[X("shadow")]:J.has(n)||rr.has(n)||n.startsWith("--esp-l-")||n==="--_esp-surface-polarity"?P[n]:c[n],T={scheme:e,context:r,readProperty:h,readColor:n=>{if(n===B)return u?.startsWith("--esp-color-")?h(u):u;const f=L(n);return f&&h(f)}},y=t.features[e],R={brandColor:u},b=[...I(i,y,o.entriesByRole,R),...I(i,y,l,R)],C=[...V(b).values()].map(n=>{const{element:f,foreground:w,background:m,kind:O,state:g}=n,E=S(w,T,o.derivations),d=S(m,T,o.derivations);if(!E||!d||d.alpha!==1)throw new Error(`Paint surface "${i}" (${e}) cannot resolve "${f}" ${g}: ${w} on opaque ${m}.`);const _=E.alpha*(n.paintOpacity??1),v=U({alpha:_,blur:n.indicator==="blurred-shadow"?G:0}),$=H({...E,alpha:v},d),A={element:f,foreground:w,background:m,state:g,kind:O,ratio:Y($,d),required:K(O)};return s?.(e,z({role:i,...n}),A),A});return{role:i,context:r,pairs:C}}function dr(t,e,a={},o={entriesByRole:j,derivations:q},l){er(e),W(a,o.derivations);const s=new Set([...Object.entries(o.entriesByRole),...Object.entries(a)].filter(([,r])=>r.length>0).map(([r])=>r));for(const{role:r}of e)if(!s.has(r))throw new TypeError(`Paint surface "${r}" has no registered paint entries.`);const i=r=>e.map(c=>nr(c,r,t[r],o,a,l));return{light:i("light"),dark:i("dark")}}export{dr as measurePaintSurfaces};
@@ -70,6 +70,15 @@ export interface PaintAttribution {
70
70
  owner: Element;
71
71
  state?: (interaction: PaintInteraction) => string;
72
72
  brandColor?: string;
73
+ /**
74
+ * Leave out backdrop samples within `depth` pixels of this edge of the owner. A
75
+ * focus ring shares that strip with a bar drawn inside the same control, and
76
+ * the ring is measured against the item itself (ESP0273).
77
+ */
78
+ excludeBackdropEdge?: {
79
+ edge: "bottom";
80
+ depth: number;
81
+ };
73
82
  foregroundDerivations?: readonly string[];
74
83
  backgroundDerivations?: readonly string[];
75
84
  /** Semantic identifiers that are equivalent to a named foreground derivation here. */
@@ -1 +1 @@
1
- const e=Object.freeze(["--esp-action-menu-background","--esp-action-menu-border","--esp-action-menu-item-focus-shadow","--esp-action-menu-item-gap","--esp-action-menu-item-hover-background","--esp-action-menu-item-icon-background","--esp-action-menu-item-icon-border-color","--esp-action-menu-item-icon-hover-background","--esp-action-menu-item-padding","--esp-action-menu-min-width","--esp-action-menu-shadow","--esp-avatar-border-radius","--esp-avatar-size","--esp-badge-background","--esp-badge-border-color","--esp-badge-border-radius","--esp-badge-color","--esp-blockquote-bar-color","--esp-blockquote-glyph-color","--esp-box-background","--esp-box-background-image","--esp-box-background-image-opacity","--esp-box-background-opacity","--esp-box-shadow","--esp-breadcrumb-color","--esp-breadcrumb-current-color","--esp-breadcrumb-hover-background","--esp-breadcrumb-hover-color","--esp-breadcrumb-separator-color","--esp-breadcrumb-separator-size","--esp-button-group-divider","--esp-button-incognito-padding","--esp-button-padding","--esp-card-min","--esp-checkbox-focus-shadow","--esp-checkbox-icon-color","--esp-checkbox-size","--esp-color-action-background","--esp-color-action-text","--esp-color-analogous-left","--esp-color-analogous-right","--esp-color-background","--esp-color-border","--esp-color-box-background","--esp-color-burger","--esp-color-burger-hover","--esp-color-burger-opened","--esp-color-burger-opened-hover","--esp-color-complementary","--esp-color-danger","--esp-color-danger-text","--esp-color-dialog-bg","--esp-color-headings","--esp-color-headings-hover","--esp-color-info","--esp-color-input-caret","--esp-color-input-selection","--esp-color-input-selection-bg","--esp-color-layer-1","--esp-color-layer-2","--esp-color-layer-3","--esp-color-layer-4","--esp-color-link","--esp-color-link-hover","--esp-color-link-hover-bg","--esp-color-picker-bg","--esp-color-picker-bg-alt","--esp-color-picker-bg-alt-hover","--esp-color-picker-bg-hover","--esp-color-primary","--esp-color-series-1","--esp-color-series-1-ink","--esp-color-series-1-tint","--esp-color-series-1-wash","--esp-color-series-2","--esp-color-series-2-ink","--esp-color-series-2-tint","--esp-color-series-2-wash","--esp-color-series-3","--esp-color-series-3-ink","--esp-color-series-3-tint","--esp-color-series-3-wash","--esp-color-series-4","--esp-color-series-4-ink","--esp-color-series-4-tint","--esp-color-series-4-wash","--esp-color-series-5","--esp-color-series-5-ink","--esp-color-series-5-tint","--esp-color-series-5-wash","--esp-color-series-6","--esp-color-series-6-ink","--esp-color-series-6-tint","--esp-color-series-6-wash","--esp-color-series-7","--esp-color-series-7-ink","--esp-color-series-7-tint","--esp-color-series-7-wash","--esp-color-series-8","--esp-color-series-8-ink","--esp-color-series-8-tint","--esp-color-series-8-wash","--esp-color-shadow","--esp-color-split-complementary-left","--esp-color-split-complementary-right","--esp-color-success","--esp-color-text","--esp-color-triadic-left","--esp-color-triadic-right","--esp-color-type-caption","--esp-color-type-label","--esp-color-type-lead","--esp-color-type-overline","--esp-color-warning","--esp-columns-gap","--esp-details-color-background","--esp-details-color-border","--esp-details-color-indicator","--esp-details-color-summary-background","--esp-details-color-summary-background-active","--esp-details-color-summary-hover-background","--esp-details-group-color-border","--esp-details-size-padding","--esp-dialog-bg-opacity","--esp-dialog-inset-block-end","--esp-dialog-inset-block-start","--esp-dialog-inset-inline-end","--esp-dialog-inset-inline-start","--esp-field-background","--esp-field-border-color","--esp-field-border-width","--esp-field-focus-bg","--esp-field-focus-shadow","--esp-field-hover-bg","--esp-field-text-color","--esp-flyout-background","--esp-flyout-border","--esp-flyout-padding","--esp-flyout-radius","--esp-flyout-shadow","--esp-flyout-z-index","--esp-focus-picker-focus-outline","--esp-focus-picker-gap","--esp-focus-picker-marker-border","--esp-focus-picker-marker-color","--esp-focus-picker-marker-shadow","--esp-focus-picker-marker-size","--esp-focus-picker-stage-background","--esp-font-body","--esp-font-brand","--esp-font-headings","--esp-font-menu","--esp-font-monospace","--esp-font-weight-body","--esp-font-weight-brand","--esp-font-weight-headings","--esp-font-weight-menu","--esp-font-weight-monospace","--esp-footer-background","--esp-footer-background-blend-mode","--esp-footer-background-image","--esp-footer-background-image-opacity","--esp-footer-background-position","--esp-footer-background-repeat","--esp-footer-background-size","--esp-footer-border","--esp-footer-brand-logo-aspect-ratio","--esp-footer-brand-logo-max-width","--esp-footer-brand-logo-max-width-compact","--esp-footer-brand-logo-size","--esp-footer-brand-logo-size-compact","--esp-footer-brand-text-size","--esp-footer-brand-text-size-compact","--esp-footer-color","--esp-footer-column-gap","--esp-footer-content-lead","--esp-footer-content-max-width","--esp-footer-current-block-align","--esp-footer-current-inline-align","--esp-footer-current-prose-align","--esp-footer-current-text-align","--esp-footer-dark-brand-logo-aspect-ratio","--esp-footer-focus-outline","--esp-footer-heading-color","--esp-footer-heading-font-size","--esp-footer-heading-size","--esp-footer-light-brand-logo-aspect-ratio","--esp-footer-link-color","--esp-footer-link-decoration","--esp-footer-link-group-gap","--esp-footer-link-hover-bg","--esp-footer-link-hover-color","--esp-footer-link-underline-offset","--esp-footer-link-underline-thickness","--esp-footer-padding-block","--esp-footer-padding-inline","--esp-footer-row-gap","--esp-footer-section-gap","--esp-form-item-error-background","--esp-form-item-error-color","--esp-form-item-error-field-background","--esp-form-item-error-field-border-color","--esp-form-item-error-field-focus-shadow","--esp-form-item-error-field-text-color","--esp-form-item-font","--esp-form-item-font-size","--esp-form-item-hint-color","--esp-form-item-hint-font-size","--esp-form-item-label-color","--esp-form-item-warning-background","--esp-form-item-warning-color","--esp-form-item-warning-field-background","--esp-form-item-warning-field-border-color","--esp-form-item-warning-field-focus-shadow","--esp-form-item-warning-field-text-color","--esp-grid-background","--esp-grid-border-inner","--esp-grid-border-outer","--esp-grid-cell-border-color","--esp-grid-header-active-background","--esp-grid-header-background","--esp-grid-link-color","--esp-grid-link-hover-color","--esp-grid-row-background-even","--esp-grid-row-background-odd","--esp-grid-row-hover-background","--esp-grid-row-hover-border-color","--esp-grid-text-color","--esp-header-background","--esp-header-border","--esp-header-border-width","--esp-header-brand-color","--esp-header-brand-font-family","--esp-header-brand-font-size","--esp-header-brand-font-weight","--esp-header-brand-gap","--esp-header-brand-hover-background","--esp-header-brand-hover-color","--esp-header-brand-hover-decoration","--esp-header-brand-hover-transform","--esp-header-brand-inline-placement","--esp-header-brand-logo-aspect-ratio","--esp-header-brand-logo-max-width","--esp-header-brand-logo-size","--esp-header-brand-max-width","--esp-header-brand-padding-inline","--esp-header-brand-placement","--esp-header-button-background","--esp-header-button-background-hover","--esp-header-button-border-left","--esp-header-button-box-shadow","--esp-header-button-closed-color","--esp-header-button-closed-hover-color","--esp-header-button-color","--esp-header-button-open-color","--esp-header-button-open-hover-color","--esp-header-button-stroke-width","--esp-header-color","--esp-header-compact-brand-logo-aspect-ratio","--esp-header-compact-height","--esp-header-content-lead","--esp-header-content-max-width","--esp-header-extended-menu-border","--esp-header-extended-menu-height","--esp-header-height","--esp-header-progress-background","--esp-header-progress-height","--esp-header-progress-track-background","--esp-header-scrolled-shadow","--esp-header-shadow","--esp-header-topbar-height","--esp-header-transparent-background","--esp-header-transparent-color","--esp-header-z-index","--esp-heading-1-color","--esp-heading-2-color","--esp-heading-3-color","--esp-heading-4-color","--esp-image-banner-block-size","--esp-image-banner-max-block-size","--esp-image-border","--esp-image-border-radius","--esp-image-compact-width","--esp-image-duotone-highlight-color","--esp-image-duotone-shadow-color","--esp-image-object-position","--esp-image-overlay-color","--esp-image-overlay-gap","--esp-image-overlay-measure","--esp-image-overlay-padding","--esp-image-overlay-text-shadow","--esp-image-picker-option-height","--esp-image-picker-option-width","--esp-image-picker-preview-height","--esp-image-preview-border-color","--esp-image-preview-overlay-text","--esp-image-preview-remove-color","--esp-image-scrim-color","--esp-image-scrim-edge-depth","--esp-image-scrim-edge-image","--esp-image-scrim-edge-size","--esp-image-scrim-opacity","--esp-image-static-compact-ratio","--esp-image-static-ratio","--esp-image-texture-blend-mode","--esp-image-texture-color","--esp-image-texture-image","--esp-image-texture-image-opacity","--esp-image-texture-opacity","--esp-image-texture-position","--esp-image-texture-repeat","--esp-image-texture-scale","--esp-image-texture-size","--esp-image-upload-preview-background","--esp-info-color-background","--esp-info-color-border","--esp-info-color-text","--esp-l-accent","--esp-l-border","--esp-l-ink","--esp-l-muted","--esp-l-raised-1","--esp-l-raised-2","--esp-l-raised-3","--esp-l-raised-4","--esp-l-shadow","--esp-l-surface","--esp-l-text","--esp-lightbox-bg","--esp-lightbox-bg-opacity","--esp-measure","--esp-measure-wide","--esp-menu-background","--esp-menu-border-color","--esp-menu-drawer-brand-color","--esp-menu-drawer-brand-logo-size","--esp-menu-drawer-item-font-size","--esp-menu-drawer-nested-item-max-font-size","--esp-menu-drawer-nested-item-min-font-size","--esp-menu-drawer-shadow","--esp-menu-drawer-transition-duration","--esp-menu-drawer-width","--esp-menu-group-background","--esp-menu-group-border-color","--esp-menu-group-color","--esp-menu-group-hover-background","--esp-menu-group-icon-background","--esp-menu-group-icon-min-width","--esp-menu-group-icon-padding","--esp-menu-group-icon-size","--esp-menu-group-indicator-color","--esp-menu-group-panel-background","--esp-menu-group-panel-shadow","--esp-menu-horizontal-justify-content","--esp-menu-item-active-background","--esp-menu-item-active-color","--esp-menu-item-active-font-weight","--esp-menu-item-active-indicator-color","--esp-menu-item-background","--esp-menu-item-border-color","--esp-menu-item-color","--esp-menu-item-font-family","--esp-menu-item-font-size","--esp-menu-item-font-weight","--esp-menu-item-hover-background","--esp-menu-item-hover-color","--esp-menu-item-hover-decoration","--esp-menu-item-hover-indicator-color","--esp-menu-item-icon-background","--esp-menu-item-icon-min-width","--esp-menu-item-icon-padding","--esp-menu-item-icon-size","--esp-menu-item-padding","--esp-menu-item-transition-duration","--esp-menu-scrim-color","--esp-menu-top-offset","--esp-page-background","--esp-page-background-image","--esp-page-background-image-opacity","--esp-page-canvas-background","--esp-page-canvas-background-attachment","--esp-page-canvas-background-image","--esp-page-canvas-background-image-opacity","--esp-page-fixed-header-offset","--esp-page-flyout-default-width","--esp-page-flyout-max-width","--esp-page-flyout-min-width","--esp-page-header-expanded-size","--esp-page-header-z-index","--esp-page-main-background","--esp-page-main-max-width","--esp-page-main-min-width","--esp-page-preview-background","--esp-page-preview-border","--esp-page-preview-default-width","--esp-page-preview-max-width","--esp-page-preview-min-width","--esp-page-preview-shadow","--esp-page-resize-focus-outline","--esp-page-resize-focus-shadow","--esp-page-resize-handle-hit-size","--esp-page-resize-large-step","--esp-page-resize-step","--esp-page-sticky-header-top","--esp-page-surface-border","--esp-page-surface-shadow","--esp-page-visible-header-offset","--esp-page-well-max-width","--esp-progress-border-color","--esp-progress-border-radius","--esp-progress-circle-size","--esp-progress-fill-color","--esp-progress-font-size","--esp-progress-height","--esp-progress-text-color","--esp-radio-button-focus-shadow","--esp-radio-button-icon-color","--esp-radio-button-size","--esp-repeater-background","--esp-repeater-border","--esp-repeater-border-radius","--esp-repeater-content-padding","--esp-repeater-gap","--esp-repeater-grid-column-gap","--esp-repeater-grid-columns","--esp-repeater-grid-row-gap","--esp-repeater-padding","--esp-row-gap","--esp-scheme","--esp-search-active-background","--esp-search-backdrop","--esp-search-border-color","--esp-search-highlight-background","--esp-search-loading-indicator-color","--esp-search-loading-indicator-track-color","--esp-search-max-height","--esp-search-max-width","--esp-search-muted-color","--esp-search-panel-background","--esp-search-panel-shadow","--esp-search-text-color","--esp-search-title-color","--esp-section-background","--esp-section-decoration-color","--esp-section-decoration-image","--esp-section-decoration-opacity","--esp-section-decoration-position","--esp-section-decoration-size","--esp-section-max-width","--esp-section-padding-block","--esp-section-padding-inline","--esp-seed-color","--esp-shadow-1","--esp-shadow-2","--esp-shadow-3","--esp-size-big","--esp-size-big-to-large","--esp-size-border-radius","--esp-size-box-padding","--esp-size-burger-stroke","--esp-size-color-picker-border-width","--esp-size-font","--esp-size-huge","--esp-size-large","--esp-size-large-to-huge","--esp-size-medium","--esp-size-medium-to-big","--esp-size-normal","--esp-size-normal-to-medium","--esp-size-padding","--esp-size-padding-page","--esp-size-section","--esp-size-small","--esp-size-small-to-normal","--esp-size-tiny","--esp-size-tiny-to-small","--esp-slider-focus-shadow","--esp-slider-thumb-border-color","--esp-slider-thumb-color","--esp-slider-thumb-shadow","--esp-slider-thumb-size","--esp-slider-track-border-radius","--esp-slider-track-color","--esp-slider-track-fill-color","--esp-slider-track-height","--esp-stack-gap","--esp-status-indicator-border-radius","--esp-status-indicator-height","--esp-status-indicator-popover-max-width","--esp-status-indicator-width","--esp-switch-focus-shadow","--esp-switch-height","--esp-switch-text-active-color","--esp-switch-text-font-size","--esp-switch-text-highlight-color","--esp-switch-text-inactive-color","--esp-switch-text-padding","--esp-switch-thumb-color","--esp-switch-thumb-size","--esp-switch-track-color","--esp-switch-track-color-on","--esp-switch-width","--esp-tab-color-background","--esp-tab-color-border","--esp-tab-color-button-active","--esp-tab-color-button-hover","--esp-tab-color-strip-background","--esp-tab-color-text","--esp-tab-size-padding","--esp-toaster-gap","--esp-toaster-padding","--esp-toaster-z-index","--esp-tooltip-background","--esp-tooltip-border","--esp-tooltip-border-radius","--esp-tooltip-color","--esp-tooltip-focus-outline","--esp-tooltip-font-size","--esp-tooltip-max-width","--esp-tooltip-padding","--esp-tooltip-shadow","--esp-tree-action-bg","--esp-tree-action-hover-bg","--esp-tree-action-size","--esp-tree-guide-color","--esp-tree-hover-bg","--esp-tree-icon-color","--esp-tree-indent-step","--esp-tree-node-padding","--esp-tree-row-bg","--esp-tree-row-border-color","--esp-tree-selected-bg","--esp-type-big","--esp-type-caption-color","--esp-type-caption-font-size","--esp-type-caption-font-weight","--esp-type-caption-letter-spacing","--esp-type-display-color","--esp-type-display-font-family","--esp-type-display-font-size","--esp-type-display-font-weight","--esp-type-display-letter-spacing","--esp-type-display-line-height","--esp-type-huge","--esp-type-label-color","--esp-type-label-font-size","--esp-type-label-font-weight","--esp-type-label-letter-spacing","--esp-type-large","--esp-type-lead-color","--esp-type-lead-font-size","--esp-type-lead-font-weight","--esp-type-lead-letter-spacing","--esp-type-medium","--esp-type-normal","--esp-type-overline-color","--esp-type-overline-font-size","--esp-type-overline-font-weight","--esp-type-overline-letter-spacing","--esp-type-overline-text-transform","--esp-type-small","--esp-type-tiny","--esp-vellum-background","--esp-vellum-background-image","--esp-vellum-background-image-opacity","--esp-vellum-opacity","--esp-video-accent","--esp-video-border-radius","--esp-video-focus-outline","--esp-video-message-background","--esp-video-message-color","--esp-video-object-fit","--esp-video-play-background","--esp-video-play-color","--esp-video-play-size","--esp-video-surface"]),o=Object.freeze(["^--esp-color-ramp-[a-z][a-z0-9-]*-(?:[1-9]|1[01])$"]);export{e as PUBLIC_TOKEN_NAMES,o as PUBLIC_TOKEN_PATTERNS};
1
+ const e=Object.freeze(["--esp-action-menu-background","--esp-action-menu-border","--esp-action-menu-item-focus-shadow","--esp-action-menu-item-gap","--esp-action-menu-item-hover-background","--esp-action-menu-item-icon-background","--esp-action-menu-item-icon-border-color","--esp-action-menu-item-icon-hover-background","--esp-action-menu-item-padding","--esp-action-menu-min-width","--esp-action-menu-shadow","--esp-avatar-border-radius","--esp-avatar-size","--esp-badge-background","--esp-badge-border-color","--esp-badge-border-radius","--esp-badge-color","--esp-badge-link-background","--esp-badge-link-border-color","--esp-badge-link-color","--esp-badge-link-focus-background","--esp-badge-link-focus-border-color","--esp-badge-link-focus-color","--esp-badge-link-focus-ring-color","--esp-badge-link-hover-background","--esp-badge-link-hover-border-color","--esp-badge-link-hover-color","--esp-blockquote-bar-color","--esp-blockquote-bar-width","--esp-blockquote-font-family","--esp-blockquote-glyph-color","--esp-blockquote-shadow","--esp-box-background","--esp-box-background-image","--esp-box-background-image-opacity","--esp-box-background-opacity","--esp-box-shadow","--esp-breadcrumb-color","--esp-breadcrumb-current-color","--esp-breadcrumb-hover-background","--esp-breadcrumb-hover-color","--esp-breadcrumb-separator-color","--esp-breadcrumb-separator-size","--esp-breadcrumb-separator-stroke-width","--esp-button-border-width","--esp-button-group-divider","--esp-button-incognito-padding","--esp-button-padding","--esp-button-press-offset","--esp-button-shadow","--esp-card-min","--esp-checkbox-focus-shadow","--esp-checkbox-icon-color","--esp-checkbox-size","--esp-code-background","--esp-code-border-color","--esp-code-border-style","--esp-color-action-background","--esp-color-action-text","--esp-color-analogous-left","--esp-color-analogous-right","--esp-color-background","--esp-color-border","--esp-color-box-background","--esp-color-burger","--esp-color-burger-hover","--esp-color-burger-opened","--esp-color-burger-opened-hover","--esp-color-complementary","--esp-color-danger","--esp-color-danger-text","--esp-color-dialog-bg","--esp-color-headings","--esp-color-headings-hover","--esp-color-info","--esp-color-input-caret","--esp-color-input-selection","--esp-color-input-selection-bg","--esp-color-layer-1","--esp-color-layer-2","--esp-color-layer-3","--esp-color-layer-4","--esp-color-link","--esp-color-link-hover","--esp-color-link-hover-bg","--esp-color-picker-bg","--esp-color-picker-bg-alt","--esp-color-picker-bg-alt-hover","--esp-color-picker-bg-hover","--esp-color-primary","--esp-color-series-1","--esp-color-series-1-ink","--esp-color-series-1-tint","--esp-color-series-1-wash","--esp-color-series-2","--esp-color-series-2-ink","--esp-color-series-2-tint","--esp-color-series-2-wash","--esp-color-series-3","--esp-color-series-3-ink","--esp-color-series-3-tint","--esp-color-series-3-wash","--esp-color-series-4","--esp-color-series-4-ink","--esp-color-series-4-tint","--esp-color-series-4-wash","--esp-color-series-5","--esp-color-series-5-ink","--esp-color-series-5-tint","--esp-color-series-5-wash","--esp-color-series-6","--esp-color-series-6-ink","--esp-color-series-6-tint","--esp-color-series-6-wash","--esp-color-series-7","--esp-color-series-7-ink","--esp-color-series-7-tint","--esp-color-series-7-wash","--esp-color-series-8","--esp-color-series-8-ink","--esp-color-series-8-tint","--esp-color-series-8-wash","--esp-color-shadow","--esp-color-split-complementary-left","--esp-color-split-complementary-right","--esp-color-success","--esp-color-text","--esp-color-triadic-left","--esp-color-triadic-right","--esp-color-type-caption","--esp-color-type-label","--esp-color-type-lead","--esp-color-type-overline","--esp-color-warning","--esp-columns-gap","--esp-details-color-background","--esp-details-color-border","--esp-details-color-indicator","--esp-details-color-summary-background","--esp-details-color-summary-background-active","--esp-details-color-summary-hover-background","--esp-details-group-color-border","--esp-details-size-padding","--esp-dialog-bg-opacity","--esp-dialog-inset-block-end","--esp-dialog-inset-block-start","--esp-dialog-inset-inline-end","--esp-dialog-inset-inline-start","--esp-field-background","--esp-field-border-color","--esp-field-border-width","--esp-field-focus-bg","--esp-field-focus-shadow","--esp-field-hover-bg","--esp-field-text-color","--esp-flyout-background","--esp-flyout-border","--esp-flyout-padding","--esp-flyout-radius","--esp-flyout-shadow","--esp-flyout-z-index","--esp-focus-picker-focus-outline","--esp-focus-picker-gap","--esp-focus-picker-marker-border","--esp-focus-picker-marker-color","--esp-focus-picker-marker-shadow","--esp-focus-picker-marker-size","--esp-focus-picker-stage-background","--esp-font-body","--esp-font-brand","--esp-font-headings","--esp-font-menu","--esp-font-monospace","--esp-font-weight-body","--esp-font-weight-brand","--esp-font-weight-headings","--esp-font-weight-menu","--esp-font-weight-monospace","--esp-footer-background","--esp-footer-background-blend-mode","--esp-footer-background-image","--esp-footer-background-image-opacity","--esp-footer-background-position","--esp-footer-background-repeat","--esp-footer-background-size","--esp-footer-border","--esp-footer-brand-hover-background","--esp-footer-brand-hover-transform","--esp-footer-brand-logo-aspect-ratio","--esp-footer-brand-logo-max-width","--esp-footer-brand-logo-max-width-compact","--esp-footer-brand-logo-size","--esp-footer-brand-logo-size-compact","--esp-footer-brand-text-size","--esp-footer-brand-text-size-compact","--esp-footer-color","--esp-footer-column-gap","--esp-footer-content-lead","--esp-footer-content-max-width","--esp-footer-current-block-align","--esp-footer-current-inline-align","--esp-footer-current-prose-align","--esp-footer-current-text-align","--esp-footer-dark-brand-logo-aspect-ratio","--esp-footer-focus-outline","--esp-footer-heading-color","--esp-footer-heading-font-size","--esp-footer-heading-size","--esp-footer-light-brand-logo-aspect-ratio","--esp-footer-link-color","--esp-footer-link-decoration","--esp-footer-link-group-gap","--esp-footer-link-hover-bg","--esp-footer-link-hover-color","--esp-footer-link-underline-offset","--esp-footer-link-underline-thickness","--esp-footer-padding-block","--esp-footer-padding-inline","--esp-footer-row-gap","--esp-footer-section-gap","--esp-form-item-error-background","--esp-form-item-error-color","--esp-form-item-error-field-background","--esp-form-item-error-field-border-color","--esp-form-item-error-field-focus-shadow","--esp-form-item-error-field-text-color","--esp-form-item-font","--esp-form-item-font-size","--esp-form-item-hint-color","--esp-form-item-hint-font-size","--esp-form-item-label-color","--esp-form-item-warning-background","--esp-form-item-warning-color","--esp-form-item-warning-field-background","--esp-form-item-warning-field-border-color","--esp-form-item-warning-field-focus-shadow","--esp-form-item-warning-field-text-color","--esp-grid-background","--esp-grid-border-inner","--esp-grid-border-outer","--esp-grid-cell-border-color","--esp-grid-header-active-background","--esp-grid-header-background","--esp-grid-link-color","--esp-grid-link-hover-color","--esp-grid-row-background-even","--esp-grid-row-background-odd","--esp-grid-row-hover-background","--esp-grid-row-hover-border-color","--esp-grid-text-color","--esp-header-background","--esp-header-border","--esp-header-border-width","--esp-header-brand-color","--esp-header-brand-font-family","--esp-header-brand-font-size","--esp-header-brand-font-weight","--esp-header-brand-gap","--esp-header-brand-hover-background","--esp-header-brand-hover-color","--esp-header-brand-hover-decoration","--esp-header-brand-hover-transform","--esp-header-brand-inline-placement","--esp-header-brand-logo-aspect-ratio","--esp-header-brand-logo-max-width","--esp-header-brand-logo-size","--esp-header-brand-max-width","--esp-header-brand-padding-inline","--esp-header-brand-placement","--esp-header-button-background","--esp-header-button-background-hover","--esp-header-button-border-left","--esp-header-button-box-shadow","--esp-header-button-closed-color","--esp-header-button-closed-hover-color","--esp-header-button-color","--esp-header-button-open-color","--esp-header-button-open-hover-color","--esp-header-button-stroke-width","--esp-header-color","--esp-header-compact-brand-logo-aspect-ratio","--esp-header-compact-height","--esp-header-content-lead","--esp-header-content-max-width","--esp-header-extended-menu-border","--esp-header-extended-menu-height","--esp-header-height","--esp-header-progress-background","--esp-header-progress-height","--esp-header-progress-track-background","--esp-header-scrolled-shadow","--esp-header-shadow","--esp-header-topbar-height","--esp-header-transparent-background","--esp-header-transparent-color","--esp-header-z-index","--esp-heading-1-color","--esp-heading-1-mark-color","--esp-heading-2-color","--esp-heading-2-mark-color","--esp-heading-3-color","--esp-heading-3-mark-color","--esp-heading-4-color","--esp-heading-4-mark-color","--esp-heading-mark-height","--esp-image-banner-block-size","--esp-image-banner-max-block-size","--esp-image-border","--esp-image-border-radius","--esp-image-compact-width","--esp-image-duotone-highlight-color","--esp-image-duotone-shadow-color","--esp-image-object-position","--esp-image-overlay-color","--esp-image-overlay-gap","--esp-image-overlay-measure","--esp-image-overlay-padding","--esp-image-overlay-text-shadow","--esp-image-picker-option-height","--esp-image-picker-option-width","--esp-image-picker-preview-height","--esp-image-preview-border-color","--esp-image-preview-overlay-text","--esp-image-preview-remove-color","--esp-image-scrim-color","--esp-image-scrim-edge-depth","--esp-image-scrim-edge-image","--esp-image-scrim-edge-size","--esp-image-scrim-opacity","--esp-image-static-compact-ratio","--esp-image-static-ratio","--esp-image-texture-blend-mode","--esp-image-texture-color","--esp-image-texture-image","--esp-image-texture-image-opacity","--esp-image-texture-opacity","--esp-image-texture-position","--esp-image-texture-repeat","--esp-image-texture-scale","--esp-image-texture-size","--esp-image-upload-preview-background","--esp-info-color-background","--esp-info-color-border","--esp-info-color-text","--esp-l-accent","--esp-l-border","--esp-l-ink","--esp-l-muted","--esp-l-raised-1","--esp-l-raised-2","--esp-l-raised-3","--esp-l-raised-4","--esp-l-shadow","--esp-l-surface","--esp-l-text","--esp-lightbox-bg","--esp-lightbox-bg-opacity","--esp-list-marker-color","--esp-measure","--esp-measure-wide","--esp-menu-background","--esp-menu-border-color","--esp-menu-drawer-brand-color","--esp-menu-drawer-brand-logo-size","--esp-menu-drawer-item-font-size","--esp-menu-drawer-nested-item-max-font-size","--esp-menu-drawer-nested-item-min-font-size","--esp-menu-drawer-shadow","--esp-menu-drawer-transition-duration","--esp-menu-drawer-width","--esp-menu-group-background","--esp-menu-group-border-color","--esp-menu-group-color","--esp-menu-group-hover-background","--esp-menu-group-icon-background","--esp-menu-group-icon-min-width","--esp-menu-group-icon-padding","--esp-menu-group-icon-size","--esp-menu-group-indicator-color","--esp-menu-group-panel-background","--esp-menu-group-panel-shadow","--esp-menu-horizontal-justify-content","--esp-menu-item-active-background","--esp-menu-item-active-color","--esp-menu-item-active-font-weight","--esp-menu-item-active-indicator-color","--esp-menu-item-background","--esp-menu-item-border-color","--esp-menu-item-color","--esp-menu-item-font-family","--esp-menu-item-font-size","--esp-menu-item-font-weight","--esp-menu-item-hover-background","--esp-menu-item-hover-color","--esp-menu-item-hover-decoration","--esp-menu-item-hover-indicator-color","--esp-menu-item-icon-background","--esp-menu-item-icon-min-width","--esp-menu-item-icon-padding","--esp-menu-item-icon-size","--esp-menu-item-padding","--esp-menu-item-transition-duration","--esp-menu-scrim-color","--esp-menu-top-offset","--esp-ordered-list-marker-style","--esp-page-background","--esp-page-background-image","--esp-page-background-image-opacity","--esp-page-canvas-background","--esp-page-canvas-background-attachment","--esp-page-canvas-background-image","--esp-page-canvas-background-image-opacity","--esp-page-fixed-header-offset","--esp-page-flyout-default-width","--esp-page-flyout-max-width","--esp-page-flyout-min-width","--esp-page-header-expanded-size","--esp-page-header-z-index","--esp-page-main-background","--esp-page-main-max-width","--esp-page-main-min-width","--esp-page-preview-background","--esp-page-preview-border","--esp-page-preview-default-width","--esp-page-preview-max-width","--esp-page-preview-min-width","--esp-page-preview-shadow","--esp-page-resize-focus-outline","--esp-page-resize-focus-shadow","--esp-page-resize-handle-hit-size","--esp-page-resize-large-step","--esp-page-resize-step","--esp-page-sticky-header-top","--esp-page-surface-border","--esp-page-surface-shadow","--esp-page-visible-header-offset","--esp-page-well-max-width","--esp-progress-border-color","--esp-progress-border-radius","--esp-progress-circle-size","--esp-progress-fill-color","--esp-progress-font-size","--esp-progress-height","--esp-progress-text-color","--esp-radio-button-focus-shadow","--esp-radio-button-icon-color","--esp-radio-button-size","--esp-repeater-background","--esp-repeater-border","--esp-repeater-border-radius","--esp-repeater-content-padding","--esp-repeater-gap","--esp-repeater-grid-column-gap","--esp-repeater-grid-columns","--esp-repeater-grid-row-gap","--esp-repeater-padding","--esp-row-gap","--esp-scheme","--esp-search-active-background","--esp-search-backdrop","--esp-search-border-color","--esp-search-highlight-background","--esp-search-loading-indicator-color","--esp-search-loading-indicator-track-color","--esp-search-max-height","--esp-search-max-width","--esp-search-muted-color","--esp-search-panel-background","--esp-search-panel-shadow","--esp-search-text-color","--esp-search-title-color","--esp-section-background","--esp-section-decoration-color","--esp-section-decoration-image","--esp-section-decoration-opacity","--esp-section-decoration-position","--esp-section-decoration-repeat","--esp-section-decoration-size","--esp-section-max-width","--esp-section-padding-block","--esp-section-padding-inline","--esp-seed-color","--esp-shadow-1","--esp-shadow-1-geometry","--esp-shadow-2","--esp-shadow-2-geometry","--esp-shadow-3","--esp-shadow-3-geometry","--esp-size-big","--esp-size-big-to-large","--esp-size-border-radius","--esp-size-box-padding","--esp-size-burger-stroke","--esp-size-color-picker-border-width","--esp-size-font","--esp-size-huge","--esp-size-large","--esp-size-large-to-huge","--esp-size-medium","--esp-size-medium-to-big","--esp-size-normal","--esp-size-normal-to-medium","--esp-size-padding","--esp-size-padding-page","--esp-size-section","--esp-size-small","--esp-size-small-to-normal","--esp-size-tiny","--esp-size-tiny-to-small","--esp-slider-focus-shadow","--esp-slider-thumb-border-color","--esp-slider-thumb-color","--esp-slider-thumb-shadow","--esp-slider-thumb-size","--esp-slider-track-border-radius","--esp-slider-track-color","--esp-slider-track-fill-color","--esp-slider-track-height","--esp-stack-gap","--esp-status-indicator-border-radius","--esp-status-indicator-height","--esp-status-indicator-popover-max-width","--esp-status-indicator-width","--esp-switch-focus-shadow","--esp-switch-height","--esp-switch-text-active-color","--esp-switch-text-font-size","--esp-switch-text-highlight-color","--esp-switch-text-inactive-color","--esp-switch-text-padding","--esp-switch-thumb-color","--esp-switch-thumb-size","--esp-switch-track-color","--esp-switch-track-color-on","--esp-switch-width","--esp-tab-color-background","--esp-tab-color-border","--esp-tab-color-button-active","--esp-tab-color-button-hover","--esp-tab-color-strip-background","--esp-tab-color-text","--esp-tab-size-padding","--esp-toaster-gap","--esp-toaster-padding","--esp-toaster-z-index","--esp-tooltip-background","--esp-tooltip-border","--esp-tooltip-border-radius","--esp-tooltip-color","--esp-tooltip-focus-outline","--esp-tooltip-font-size","--esp-tooltip-max-width","--esp-tooltip-padding","--esp-tooltip-shadow","--esp-tree-action-bg","--esp-tree-action-hover-bg","--esp-tree-action-size","--esp-tree-guide-color","--esp-tree-hover-bg","--esp-tree-icon-color","--esp-tree-indent-step","--esp-tree-node-padding","--esp-tree-row-bg","--esp-tree-row-border-color","--esp-tree-selected-bg","--esp-type-big","--esp-type-caption-color","--esp-type-caption-font-size","--esp-type-caption-font-weight","--esp-type-caption-letter-spacing","--esp-type-display-color","--esp-type-display-font-family","--esp-type-display-font-size","--esp-type-display-font-weight","--esp-type-display-letter-spacing","--esp-type-display-line-height","--esp-type-huge","--esp-type-label-color","--esp-type-label-font-size","--esp-type-label-font-weight","--esp-type-label-letter-spacing","--esp-type-large","--esp-type-lead-color","--esp-type-lead-font-size","--esp-type-lead-font-weight","--esp-type-lead-letter-spacing","--esp-type-medium","--esp-type-normal","--esp-type-overline-color","--esp-type-overline-font-size","--esp-type-overline-font-weight","--esp-type-overline-letter-spacing","--esp-type-overline-text-transform","--esp-type-small","--esp-type-tiny","--esp-vellum-background","--esp-vellum-background-image","--esp-vellum-background-image-opacity","--esp-vellum-opacity","--esp-video-accent","--esp-video-border-radius","--esp-video-focus-outline","--esp-video-message-background","--esp-video-message-color","--esp-video-object-fit","--esp-video-play-background","--esp-video-play-color","--esp-video-play-size","--esp-video-surface"]),o=Object.freeze(["^--esp-color-ramp-[a-z][a-z0-9-]*-(?:[1-9]|1[01])$"]);export{e as PUBLIC_TOKEN_NAMES,o as PUBLIC_TOKEN_PATTERNS};
@@ -1 +1 @@
1
- const y=["tiny","small","normal","medium","big","large","huge"],T=2,R=1.125,v=1.3333333333333333,b=[["tiny","small"],["small","normal"],["normal","medium"],["medium","big"],["big","large"],["large","huge"]],h=.375,N={rootFontSize:16,typeRatio:1.25,spaceRatio:1.618,borderRadius:.2,viewportMin:320,viewportMax:1200};function l(t,s=4){const e=10**s;return Math.round(t*e)/e}function x(t,s){const e=t*s;if(Number.isFinite(e))return e/100;const o=t*(s/100);return Number.isFinite(o)?o:Math.sign(t)*Number.MAX_VALUE}function f(t,s,e,o,n,a){if(Math.abs(s-t)<1e-4)return`${l(t)}rem`;const m=(s-t)*e*100/(n-o),i=t-m*o/(100*e),p=a===void 0?`${l(m)}vw`:`${x(l(m),a)}px`;return`clamp(${l(t)}rem, ${l(i)}rem + ${p}, ${l(s)}rem)`}function _(t){const s={};for(let e=0;e<y.length;e++){const o=e-2,n=1.125*t.typeRatio**o;s[y[e]]={min:n,max:n*v}}return s}function S(t){const s={};for(let e=0;e<y.length;e++){const o=h*t.spaceRatio**e;s[y[e]]={min:o,max:o*v}}return s}const O={"--esp-shadow-1":"1px 1px 4px var(--esp-color-shadow)","--esp-shadow-2":"0 2px 8px var(--esp-color-shadow)","--esp-shadow-3":"0 6px 20px var(--esp-color-shadow)"},z={"--esp-type-overline-color":"var(--esp-color-type-overline, var(--esp-color-text))","--esp-type-label-color":"var(--esp-color-type-label, var(--esp-color-text))","--esp-type-lead-color":"var(--esp-color-type-lead, var(--esp-color-text))","--esp-type-caption-color":"var(--esp-color-type-caption, var(--esp-color-text))","--esp-type-display-color":"var(--esp-color-headings, var(--esp-color-text))"},P={"--esp-type-overline-font-size":"var(--esp-type-tiny)","--esp-type-overline-font-weight":"var(--esp-font-weight-headings)","--esp-type-overline-letter-spacing":"0.08em","--esp-type-overline-text-transform":"uppercase","--esp-type-label-font-size":"var(--esp-type-normal)","--esp-type-label-font-weight":"var(--esp-font-weight-headings)","--esp-type-label-letter-spacing":"0.01em","--esp-type-lead-font-size":"var(--esp-type-medium)","--esp-type-lead-font-weight":"var(--esp-font-weight-body)","--esp-type-lead-letter-spacing":"normal","--esp-type-caption-font-size":"var(--esp-type-small)","--esp-type-caption-font-weight":"var(--esp-font-weight-body)","--esp-type-caption-letter-spacing":"normal","--esp-type-display-font-family":"var(--_esp-font-headings-effective, var(--esp-font-headings, var(--_esp-font-body-effective, var(--esp-font-body, system-ui, sans-serif))))","--esp-type-display-font-weight":"var(--esp-font-weight-headings)","--esp-type-display-line-height":"1.1","--esp-type-display-letter-spacing":"normal",...z};function $(t,s){s=typeof s=="number"&&Number.isFinite(s)&&s>0?s:void 0;const e={},{rootFontSize:o,viewportMin:n,viewportMax:a,borderRadius:m}=t,i=16,p=o/i,u=_(t);for(const r of y){const{min:c,max:d}=u[r];e[`--esp-type-${r}`]=f(c*p,d*p,i,n,a,s)}e["--esp-type-display-font-size"]=f(u.large.min*p,u.huge.max*p,i,n,a,s),Object.assign(e,P);const g=S(t);for(const r of y){const{min:c,max:d}=g[r];e[`--esp-size-${r}`]=f(c*p,d*p,i,n,a,s)}for(const[r,c]of b)e[`--esp-size-${r}-to-${c}`]=f(g[r].min*p,g[c].max*p,i,n,a,s);e["--esp-size-font"]="var(--esp-type-normal)",e["--esp-size-padding"]="var(--esp-size-tiny-to-small)",e["--esp-size-padding-page"]="var(--esp-size-small-to-normal)",e["--esp-size-border-radius"]=`${l(m*p)}rem`,e["--esp-measure"]="66ch",e["--esp-measure-wide"]="90ch";const E=s===void 0?"7vw":`${x(7,s)}px`;return e["--esp-size-section"]=`clamp(var(--esp-size-big), ${E}, var(--esp-size-huge))`,Object.assign(e,O),e["--esp-card-min"]="16rem",e}export{N as DEFAULT_SCALE_CONFIG,O as ELEVATION_PROPERTIES,y as STEP_NAMES,z as TYPE_ROLE_COLOR_PROPERTIES,P as TYPE_ROLE_PROPERTIES,$ as generateScaleProperties};
1
+ const y=["tiny","small","normal","medium","big","large","huge"],T=2,w=1.125,v=1.3333333333333333,h=[["tiny","small"],["small","normal"],["normal","medium"],["medium","big"],["big","large"],["large","huge"]],b=.375,R={rootFontSize:16,typeRatio:1.25,spaceRatio:1.618,borderRadius:.2,viewportMin:320,viewportMax:1200};function l(t,s=4){const e=10**s;return Math.round(t*e)/e}function x(t,s){const e=t*s;if(Number.isFinite(e))return e/100;const o=t*(s/100);return Number.isFinite(o)?o:Math.sign(t)*Number.MAX_VALUE}function f(t,s,e,o,r,a){if(Math.abs(s-t)<1e-4)return`${l(t)}rem`;const m=(s-t)*e*100/(r-o),i=t-m*o/(100*e),p=a===void 0?`${l(m)}vw`:`${x(l(m),a)}px`;return`clamp(${l(t)}rem, ${l(i)}rem + ${p}, ${l(s)}rem)`}function _(t){const s={};for(let e=0;e<y.length;e++){const o=e-2,r=1.125*t.typeRatio**o;s[y[e]]={min:r,max:r*v}}return s}function S(t){const s={};for(let e=0;e<y.length;e++){const o=b*t.spaceRatio**e;s[y[e]]={min:o,max:o*v}}return s}const O={"--esp-shadow-1":"var(--esp-shadow-1-geometry, 1px 1px 4px) var(--esp-color-shadow)","--esp-shadow-2":"var(--esp-shadow-2-geometry, 0 2px 8px) var(--esp-color-shadow)","--esp-shadow-3":"var(--esp-shadow-3-geometry, 0 6px 20px) var(--esp-color-shadow)"},z={"--esp-type-overline-color":"var(--esp-color-type-overline, var(--esp-color-text))","--esp-type-label-color":"var(--esp-color-type-label, var(--esp-color-text))","--esp-type-lead-color":"var(--esp-color-type-lead, var(--esp-color-text))","--esp-type-caption-color":"var(--esp-color-type-caption, var(--esp-color-text))","--esp-type-display-color":"var(--esp-color-headings, var(--esp-color-text))"},P={"--esp-type-overline-font-size":"var(--esp-type-tiny)","--esp-type-overline-font-weight":"var(--esp-font-weight-headings)","--esp-type-overline-letter-spacing":"0.08em","--esp-type-overline-text-transform":"uppercase","--esp-type-label-font-size":"var(--esp-type-normal)","--esp-type-label-font-weight":"var(--esp-font-weight-headings)","--esp-type-label-letter-spacing":"0.01em","--esp-type-lead-font-size":"var(--esp-type-medium)","--esp-type-lead-font-weight":"var(--esp-font-weight-body)","--esp-type-lead-letter-spacing":"normal","--esp-type-caption-font-size":"var(--esp-type-small)","--esp-type-caption-font-weight":"var(--esp-font-weight-body)","--esp-type-caption-letter-spacing":"normal","--esp-type-display-font-family":"var(--_esp-font-headings-effective, var(--esp-font-headings, var(--_esp-font-body-effective, var(--esp-font-body, system-ui, sans-serif))))","--esp-type-display-font-weight":"var(--esp-font-weight-headings)","--esp-type-display-line-height":"1.1","--esp-type-display-letter-spacing":"normal",...z};function N(t,s){s=typeof s=="number"&&Number.isFinite(s)&&s>0?s:void 0;const e={},{rootFontSize:o,viewportMin:r,viewportMax:a,borderRadius:m}=t,i=16,p=o/i,g=_(t);for(const n of y){const{min:c,max:d}=g[n];e[`--esp-type-${n}`]=f(c*p,d*p,i,r,a,s)}e["--esp-type-display-font-size"]=f(g.large.min*p,g.huge.max*p,i,r,a,s),Object.assign(e,P);const u=S(t);for(const n of y){const{min:c,max:d}=u[n];e[`--esp-size-${n}`]=f(c*p,d*p,i,r,a,s)}for(const[n,c]of h)e[`--esp-size-${n}-to-${c}`]=f(u[n].min*p,u[c].max*p,i,r,a,s);e["--esp-size-font"]="var(--esp-type-normal)",e["--esp-size-padding"]="var(--esp-size-tiny-to-small)",e["--esp-size-padding-page"]="var(--esp-size-small-to-normal)",e["--esp-size-border-radius"]=`${l(m*p)}rem`,e["--esp-measure"]="66ch",e["--esp-measure-wide"]="90ch";const E=s===void 0?"7vw":`${x(7,s)}px`;return e["--esp-size-section"]=`clamp(var(--esp-size-big), ${E}, var(--esp-size-huge))`,Object.assign(e,O),e["--esp-card-min"]="16rem",e}export{R as DEFAULT_SCALE_CONFIG,O as ELEVATION_PROPERTIES,y as STEP_NAMES,z as TYPE_ROLE_COLOR_PROPERTIES,P as TYPE_ROLE_PROPERTIES,N as generateScaleProperties};
@@ -1 +1 @@
1
- const t=["background","layer1","layer2","layer3","layer4","actionBackground","actionText","border","shadow","text","typeOverline","typeLabel","typeLead","typeCaption","dangerText","headings","headingsHover","link","linkHover","linkHoverBg","inputCaret","inputSelection","inputSelectionBg"];function o(e){return typeof e=="string"&&t.includes(e)}function r(e){return`--esp-color-${e.replace(/([A-Z])/g,"-$1").replace(/(\d)/g,"-$1").toLowerCase()}`}export{t as SEMANTIC_COLOR_NAMES,o as isSemanticColorName,r as semanticToCSS};
1
+ const o=["background","layer1","layer2","layer3","layer4","actionBackground","actionText","border","shadow","text","typeOverline","typeLabel","typeLead","typeCaption","dangerText","headings","headingsHover","link","linkHover","linkHoverBg","inputCaret","inputSelection","inputSelectionBg"];function a(e){return typeof e=="string"&&o.includes(e)}function n(e){return`--esp-color-${e.replace(/([A-Z])/g,"-$1").replace(/(\d)/g,"-$1").toLowerCase()}`}const r=["--esp-color-danger","--esp-color-warning","--esp-color-success","--esp-color-info"],c=[...o.map(n),...r];export{c as PAINT_REACH_COLOR_CSS_NAMES,o as SEMANTIC_COLOR_NAMES,r as STATUS_COLOR_CSS_NAMES,a as isSemanticColorName,n as semanticToCSS};
@@ -1 +1 @@
1
- import{SEMANTIC_COLOR_NAMES as h,semanticToCSS as g}from"./semantic-color-names.js";const s=Object.freeze({component:"esp-root",syntax:"color",default:"var(--esp-color-headings)",pairsWith:"--esp-color-background",targetLc:60,fitFallback:"--esp-color-headings"}),w=Object.freeze({"--esp-badge-background":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-layer-2)",fitFallback:"--esp-color-layer-2"}),"--esp-badge-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-text)",pairsWith:"--esp-badge-background",targetLc:75,fitFallback:"--esp-color-text"}),"--esp-badge-border-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-border)"}),"--esp-blockquote-bar-color":Object.freeze({syntax:"color",default:"var(--esp-color-border)"}),"--esp-blockquote-glyph-color":Object.freeze({syntax:"color",default:"var(--esp-blockquote-bar-color, var(--esp-color-border))"}),"--esp-breadcrumb-color":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"var(--esp-color-link)",pairsWith:"--esp-color-background",targetLc:75,fitFallback:"--esp-color-link"}),"--esp-breadcrumb-hover-color":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"var(--esp-color-link-hover)",pairsWith:"--esp-breadcrumb-hover-background",targetLc:75,fitFallback:"--esp-color-link-hover"}),"--esp-breadcrumb-hover-background":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"var(--esp-color-link-hover-bg)",fitFallback:"--esp-color-link-hover-bg"}),"--esp-breadcrumb-current-color":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"var(--esp-breadcrumb-color, var(--esp-color-headings))",pairsWith:"--esp-color-background",targetLc:60,fitFallback:"--esp-color-headings"}),"--esp-breadcrumb-separator-color":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"color-mix(in oklch, var(--esp-breadcrumb-color, var(--esp-color-link)) 70%, transparent)"}),"--esp-breadcrumb-separator-size":Object.freeze({component:"esp-breadcrumb",syntax:"length",default:"var(--esp-size-normal-to-medium)",unit:"rem",min:.5,max:2}),"--esp-footer-heading-size":Object.freeze({component:"esp-footer",syntax:"keyword",default:"normal",allowedValues:["small","normal","medium","big","large"],derives:{property:"--esp-footer-heading-font-size",values:{small:"var(--esp-type-small)",normal:"var(--esp-type-normal)",medium:"var(--esp-type-medium)",big:"var(--esp-type-big)",large:"var(--esp-type-large)"}}}),"--esp-footer-link-decoration":Object.freeze({component:"esp-footer",syntax:"keyword",default:"underline",allowedValues:["none","underline"]}),"--esp-footer-link-underline-offset":Object.freeze({component:"esp-footer",syntax:"length",default:"0.18em",unit:"em",min:0,max:.5}),"--esp-footer-link-underline-thickness":Object.freeze({component:"esp-footer",syntax:"length | keyword",default:"auto",unit:"em",min:0,max:.2,allowedValues:["auto"]}),"--esp-header-brand-logo-max-width":Object.freeze({component:"esp-header",syntax:"length",default:"12rem",unit:"rem",min:4,max:32}),"--esp-heading-1-color":s,"--esp-heading-2-color":s,"--esp-heading-3-color":s,"--esp-heading-4-color":s});function x(a){return typeof a=="string"&&Object.prototype.hasOwnProperty.call(w,a)}const O="--_esp-",c=/^--esp-[a-z0-9-]+$/,y=/^--_esp-[a-z0-9-]+$/,k=/^[a-z][a-z0-9-]*$/,l=new Set(h.map(g));function u(a,t){if(t.syntax!=="color"||!l.has(t.fitFallback??"")||t.allowedValues?.some(n=>!l.has(n)))throw new Error(`${a} must use an opaque semantic fit fallback and opaque pair values.`)}function E(a,t){const n=new Map(Object.entries(a)),i=new Set;for(const[r,e]of n){if(!c.test(r))throw new Error(`${r} must be a public --esp- property.`);if(t){const o=t.get(r);if(!o)throw new Error(`${r} is missing @cssprop documentation.`);if(e.component===void 0){if(o.category!=="shared-hook")throw new Error(`${r} has no component owner and must be documented as a shared hook.`)}else if(o.category!=="component"||o.component!==e.component)throw new Error(`${r} is documented for ${o.component??o.category}, not ${e.component}.`)}const m=e.syntax==="length"||e.syntax==="length | keyword",p=e.syntax==="keyword"||e.syntax==="length | keyword";if(m&&(e.unit!=="rem"&&e.unit!=="em"||e.min===void 0||e.max===void 0||!Number.isFinite(e.min)||!Number.isFinite(e.max)||e.min>e.max))throw new Error(`${r} must have a supported unit and finite, ordered length bounds.`);if(p&&(!e.allowedValues?.length||!e.allowedValues.every(o=>k.test(o))))throw new Error(`${r} must declare its allowed keywords.`);if(e.pairsWith!==void 0){if(!(e.targetLc!==void 0&&Number.isFinite(e.targetLc)&&e.targetLc>0))throw new Error(`${r} must have a positive, finite contrast target.`);if(u(r,e),!l.has(e.pairsWith)){const o=n.get(e.pairsWith);if(!o||e.pairsWith===r||e.component===void 0||o.component!==e.component||o.pairsWith!==void 0)throw new Error(`${r} must pair with a semantic color or a same-component unpaired color.`);u(e.pairsWith,o)}}else if(e.targetLc!==void 0)throw new Error(`${r} declares a contrast target without a pair.`);if(e.derives){const{property:o,values:b}=e.derives,d=Object.keys(b);if(!p||!d.length||d.some(f=>!e.allowedValues?.includes(f)))throw new Error(`${r} may derive values only from its allowed keywords.`);if(n.has(o)||i.has(o))throw new Error(`${r} must derive a unique, non-settable output: ${o}.`);if(!c.test(o)&&!y.test(o))throw new Error(`${r} must derive a public --esp- or private --_esp- output.`);if(t&&c.test(o)&&!t.has(o))throw new Error(`${r} derives ${o}, which is missing @cssprop documentation.`);i.add(o)}}}export{O as PRIVATE_COMPONENT_PROPERTY_PREFIX,l as SEMANTIC_COLOR_PROPERTIES,w as SETTABLE_COMPONENT_PROPERTIES,E as assertRegistryInvariants,x as isSettableComponentPropertyName};
1
+ import{SEMANTIC_COLOR_NAMES as x,semanticToCSS as w}from"./semantic-color-names.js";const l=Object.freeze(["none","1","2","3"]),f="var(--_esp-font-body-effective, var(--esp-font-body, system-ui, sans-serif))",O=`var(--_esp-font-headings-effective, var(--esp-font-headings, ${f}))`,z="var(--_esp-font-monospace-effective, var(--esp-font-monospace, monospace))",c=t=>Object.freeze({component:"esp-root",syntax:"color",default:"transparent",toggle:`--_esp-heading-${t}-mark-on`}),i=t=>Object.freeze({component:"esp-root",syntax:"shadow-geometry",default:t,unit:"rem",min:-3,max:3}),p=Object.freeze({component:"esp-root",syntax:"color",default:"var(--esp-color-headings)",pairsWith:"--esp-color-background",targetLc:60,fitFallback:"--esp-color-headings"}),j=Object.freeze({"--esp-badge-background":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-layer-2)",fitFallback:"--esp-color-layer-2"}),"--esp-badge-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-text)",pairsWith:"--esp-badge-background",targetLc:75,fitFallback:"--esp-color-text"}),"--esp-badge-border-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-border)"}),"--esp-badge-link-background":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-background)",fitFallback:"--esp-color-background"}),"--esp-badge-link-border-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-link)"}),"--esp-badge-link-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-link)",pairsWith:"--esp-badge-link-background",targetLc:75,fitFallback:"--esp-color-link"}),"--esp-badge-link-hover-background":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-link-hover-bg)",fitFallback:"--esp-color-link-hover-bg"}),"--esp-badge-link-hover-border-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-link-hover)"}),"--esp-badge-link-hover-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-link-hover)",pairsWith:"--esp-badge-link-hover-background",targetLc:75,fitFallback:"--esp-color-link-hover"}),"--esp-badge-link-focus-background":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-link-hover-bg)",fitFallback:"--esp-color-link-hover-bg"}),"--esp-badge-link-focus-border-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-link-hover)"}),"--esp-badge-link-focus-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-link-hover)",pairsWith:"--esp-badge-link-focus-background",targetLc:75,fitFallback:"--esp-color-link-hover"}),"--esp-badge-link-focus-ring-color":Object.freeze({component:"esp-badge",syntax:"color",default:"var(--esp-color-link)"}),"--esp-blockquote-bar-color":Object.freeze({syntax:"color",default:"var(--esp-color-border)"}),"--esp-blockquote-glyph-color":Object.freeze({syntax:"color",default:"var(--esp-blockquote-bar-color, var(--esp-color-border))"}),"--esp-breadcrumb-color":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"var(--esp-color-link)",pairsWith:"--esp-color-background",targetLc:75,fitFallback:"--esp-color-link"}),"--esp-breadcrumb-hover-color":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"var(--esp-color-link-hover)",pairsWith:"--esp-breadcrumb-hover-background",targetLc:75,fitFallback:"--esp-color-link-hover"}),"--esp-breadcrumb-hover-background":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"var(--esp-color-link-hover-bg)",fitFallback:"--esp-color-link-hover-bg"}),"--esp-breadcrumb-current-color":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"var(--esp-breadcrumb-color, var(--esp-color-headings))",pairsWith:"--esp-color-background",targetLc:60,fitFallback:"--esp-color-headings"}),"--esp-breadcrumb-separator-color":Object.freeze({component:"esp-breadcrumb",syntax:"color",default:"color-mix(in oklch, var(--esp-breadcrumb-color, var(--esp-color-link)) 70%, transparent)"}),"--esp-breadcrumb-separator-size":Object.freeze({component:"esp-breadcrumb",syntax:"length",default:"var(--esp-size-normal-to-medium)",unit:"rem",min:.5,max:2}),"--esp-breadcrumb-separator-stroke-width":Object.freeze({component:"esp-breadcrumb",syntax:"number",default:"2",min:.5,max:6}),"--esp-footer-heading-size":Object.freeze({component:"esp-footer",syntax:"keyword",default:"normal",allowedValues:["small","normal","medium","big","large"],derives:{property:"--esp-footer-heading-font-size",values:{small:"var(--esp-type-small)",normal:"var(--esp-type-normal)",medium:"var(--esp-type-medium)",big:"var(--esp-type-big)",large:"var(--esp-type-large)"}}}),"--esp-footer-link-decoration":Object.freeze({component:"esp-footer",syntax:"keyword",default:"underline",allowedValues:["none","underline"]}),"--esp-footer-link-underline-offset":Object.freeze({component:"esp-footer",syntax:"length",default:"0.18em",unit:"em",min:0,max:.5}),"--esp-footer-link-underline-thickness":Object.freeze({component:"esp-footer",syntax:"length | keyword",default:"auto",unit:"em",min:0,max:.2,allowedValues:["auto"]}),"--esp-header-brand-logo-max-width":Object.freeze({component:"esp-header",syntax:"length",default:"12rem",unit:"rem",min:4,max:32}),"--esp-blockquote-bar-width":Object.freeze({syntax:"length",default:"0.3em",unit:"em",min:0,max:1}),"--esp-blockquote-shadow":Object.freeze({syntax:"elevation",default:"none",allowedValues:l}),"--esp-blockquote-font-family":Object.freeze({syntax:"keyword",allowedValues:["body","heading","monospace"],derives:{property:"--_esp-blockquote-font-family",values:{body:f,heading:O,monospace:z}}}),"--esp-box-shadow":Object.freeze({component:"esp-box",syntax:"elevation",default:"1",allowedValues:l}),"--esp-button-border-width":Object.freeze({component:"esp-button",syntax:"length",default:"var(--esp-field-border-width, 1px)",unit:"rem",min:0,max:.5}),"--esp-button-shadow":Object.freeze({component:"esp-button",syntax:"elevation",default:"none",allowedValues:l}),"--esp-button-press-offset":Object.freeze({component:"esp-button",syntax:"length",default:"0",unit:"rem",min:0,max:.5}),"--esp-code-background":Object.freeze({component:"esp-root",syntax:"color",default:"var(--esp-color-layer-1)"}),"--esp-code-border-color":Object.freeze({component:"esp-root",syntax:"color",default:"var(--esp-color-border)"}),"--esp-code-border-style":Object.freeze({component:"esp-root",syntax:"keyword",default:"dotted",allowedValues:["dotted","dashed","solid","none"]}),"--esp-footer-brand-hover-background":Object.freeze({component:"esp-footer",syntax:"color",default:"var(--esp-footer-link-hover-bg, var(--esp-color-link-hover-bg))"}),"--esp-footer-link-hover-bg":Object.freeze({component:"esp-footer",syntax:"color",default:"var(--esp-color-link-hover-bg)"}),"--esp-heading-1-mark-color":c(1),"--esp-heading-2-mark-color":c(2),"--esp-heading-3-mark-color":c(3),"--esp-heading-4-mark-color":c(4),"--esp-heading-mark-height":Object.freeze({component:"esp-root",syntax:"length",default:"0.35em",unit:"em",min:0,max:.6}),"--esp-list-marker-color":Object.freeze({component:"esp-root",syntax:"color",default:"currentcolor"}),"--esp-menu-item-active-indicator-color":Object.freeze({component:"esp-menu-item",syntax:"color",default:"var(--esp-menu-item-active-color, var(--esp-color-link))",pairsWith:"--esp-color-layer-2",targetLc:60,fitFallback:"--esp-color-link"}),"--esp-menu-item-hover-indicator-color":Object.freeze({component:"esp-menu-item",syntax:"color",default:"var(--esp-menu-item-hover-color, var(--esp-color-headings-hover))",pairsWith:"--esp-color-layer-2",targetLc:60,fitFallback:"--esp-color-headings-hover"}),"--esp-ordered-list-marker-style":Object.freeze({component:"esp-root",syntax:"keyword",default:"decimal",allowedValues:["decimal","decimal-leading-zero","lower-alpha","upper-alpha","lower-roman","upper-roman"]}),"--esp-section-decoration-repeat":Object.freeze({component:"esp-section",syntax:"keyword",default:"no-repeat",allowedValues:["no-repeat","repeat","repeat-x","repeat-y"]}),"--esp-shadow-1-geometry":i("1px 1px 4px"),"--esp-shadow-2-geometry":i("0 2px 8px"),"--esp-shadow-3-geometry":i("0 6px 20px"),"--esp-heading-1-color":p,"--esp-heading-2-color":p,"--esp-heading-3-color":p,"--esp-heading-4-color":p});function F(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(j,t)}const L="--_esp-",d=/^--esp-[a-z0-9-]+$/,g=/^--_esp-[a-z0-9-]+$/,E=/^[a-z][a-z0-9-]*$/,b=new Set(x.map(w));function h(t,a){if(a.syntax!=="color"||!b.has(a.fitFallback??"")||a.allowedValues?.some(n=>!b.has(n)))throw new Error(`${t} must use an opaque semantic fit fallback and opaque pair values.`)}function _(t,a){const n=new Map(Object.entries(t)),s=new Set;for(const[r,e]of n){if(!d.test(r))throw new Error(`${r} must be a public --esp- property.`);if(a){const o=a.get(r);if(!o)throw new Error(`${r} is missing @cssprop documentation.`);if(e.component===void 0){if(o.category!=="shared-hook")throw new Error(`${r} has no component owner and must be documented as a shared hook.`)}else if(o.category!=="component"||o.component!==e.component)throw new Error(`${r} is documented for ${o.component??o.category}, not ${e.component}.`)}const y=e.syntax==="length"||e.syntax==="length | keyword"||e.syntax==="shadow-geometry",m=e.syntax==="keyword"||e.syntax==="length | keyword";if(y&&(e.unit!=="rem"&&e.unit!=="em"||e.min===void 0||e.max===void 0||!Number.isFinite(e.min)||!Number.isFinite(e.max)||e.min>e.max))throw new Error(`${r} must have a supported unit and finite, ordered length bounds.`);if(e.syntax==="number"&&(e.min===void 0||e.max===void 0||!Number.isFinite(e.min)||!Number.isFinite(e.max)||e.min>e.max))throw new Error(`${r} must have finite, ordered number bounds.`);if(m&&(!e.allowedValues?.length||!e.allowedValues.every(o=>E.test(o))))throw new Error(`${r} must declare its allowed keywords.`);if(e.syntax==="elevation"&&e.allowedValues?.join()!==l.join())throw new Error(`${r} must allow exactly the elevation steps.`);if(e.pairsWith!==void 0){if(!(e.targetLc!==void 0&&Number.isFinite(e.targetLc)&&e.targetLc>0))throw new Error(`${r} must have a positive, finite contrast target.`);if(h(r,e),!b.has(e.pairsWith)){const o=n.get(e.pairsWith);if(!o||e.pairsWith===r||e.component===void 0||o.component!==e.component||o.pairsWith!==void 0)throw new Error(`${r} must pair with a semantic color or a same-component unpaired color.`);h(e.pairsWith,o)}}else if(e.targetLc!==void 0)throw new Error(`${r} declares a contrast target without a pair.`);if(e.toggle!==void 0){if(!g.test(e.toggle)||s.has(e.toggle)||n.has(e.toggle))throw new Error(`${r} must toggle a unique private --_esp- property.`);s.add(e.toggle)}if(e.derives){const{property:o,values:k}=e.derives,u=Object.keys(k);if(!m||!u.length||u.some(v=>!e.allowedValues?.includes(v)))throw new Error(`${r} may derive values only from its allowed keywords.`);if(n.has(o)||s.has(o))throw new Error(`${r} must derive a unique, non-settable output: ${o}.`);if(!d.test(o)&&!g.test(o))throw new Error(`${r} must derive a public --esp- or private --_esp- output.`);if(a&&d.test(o)&&!a.has(o))throw new Error(`${r} derives ${o}, which is missing @cssprop documentation.`);s.add(o)}}}export{l as ELEVATION_VALUES,L as PRIVATE_COMPONENT_PROPERTY_PREFIX,b as SEMANTIC_COLOR_PROPERTIES,j as SETTABLE_COMPONENT_PROPERTIES,_ as assertRegistryInvariants,F as isSettableComponentPropertyName};