@taprootio/espalier 7.2.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/custom-elements.json +4621 -15535
- package/dist/badge/esp-badge.d.ts +7 -0
- package/dist/badge/esp-badge.js +11 -5
- package/dist/breadcrumbs/breadcrumb-separators.d.ts +4 -0
- package/dist/breadcrumbs/breadcrumb-separators.js +1 -0
- package/dist/breadcrumbs/esp-breadcrumb.d.ts +13 -14
- package/dist/breadcrumbs/esp-breadcrumb.js +6 -7
- package/dist/breadcrumbs/esp-breadcrumbs.d.ts +16 -9
- package/dist/breadcrumbs/esp-breadcrumbs.js +9 -6
- package/dist/cli/theme-check.js +2 -2
- package/dist/font-picker/esp-font-picker.d.ts +11 -14
- package/dist/font-picker/esp-font-picker.js +5 -5
- package/dist/footer/esp-footer-link-group.js +1 -1
- package/dist/footer/esp-footer.d.ts +5 -0
- package/dist/footer/esp-footer.js +10 -4
- package/dist/header/esp-header-button.js +3 -3
- package/dist/header/esp-header.js +9 -9
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/pickers/esp-picker-item.js +1 -1
- package/dist/root/esp-root.d.ts +8 -1
- package/dist/root/esp-root.js +47 -10
- package/dist/root/helpers/compute-semantic-properties.js +1 -1
- package/dist/root/helpers/compute-theme-properties.js +1 -1
- package/dist/root/helpers/data-companion-properties.js +1 -1
- package/dist/root/helpers/lightness-ramp-properties.js +1 -1
- package/dist/shared/blockquote-styles.d.ts +3 -0
- package/dist/shared/blockquote-styles.js +4 -4
- package/dist/shared/color-engine.js +1 -1
- package/dist/shared/component-property-compiler.js +1 -0
- package/dist/shared/component-property-diagnostics.js +1 -0
- package/dist/shared/component-property-normalizer.js +1 -0
- package/dist/shared/component-property-resets.js +1 -0
- package/dist/shared/document-sprite.js +1 -1
- package/dist/shared/esp-element-base.d.ts +3 -0
- package/dist/shared/esp-element-base.js +3 -3
- package/dist/shared/font-helpers.d.ts +3 -3
- package/dist/shared/font-helpers.js +1 -1
- package/dist/shared/font-plan.d.ts +1 -1
- package/dist/shared/governing-root.d.ts +24 -0
- package/dist/shared/governing-root.js +1 -0
- package/dist/shared/intent-values.js +1 -1
- package/dist/shared/paint-fit.js +1 -1
- package/dist/shared/public-token-catalog.generated.js +1 -0
- package/dist/shared/root-event-subscription.d.ts +11 -0
- package/dist/shared/scoped-style-declarations.js +1 -0
- package/dist/shared/semantic-color-names.d.ts +16 -0
- package/dist/shared/semantic-color-names.js +1 -0
- package/dist/shared/settable-component-properties.js +1 -0
- package/dist/shared/theme-core.d.ts +808 -0
- package/dist/shared/theme-core.js +1 -0
- package/dist/shared/theme-fit-report.d.ts +30 -4
- package/dist/shared/theme-fit-report.js +1 -1
- package/dist/shared/theme-mapping-grammar.d.ts +16 -0
- package/dist/shared/theme-mapping-grammar.js +1 -0
- package/dist/shared/theme-properties.d.ts +3 -1
- package/dist/shared/theme-properties.js +1 -1
- package/dist/shared/theme-validation.d.ts +52 -0
- package/dist/shared/theme-validation.js +1 -0
- package/dist/shared/theme.d.ts +4 -876
- package/dist/shared/theme.js +1 -1
- package/dist/shared/token-pairings.d.ts +1 -1
- package/dist/testing/observe-paint.iife.js +1 -1
- package/espalier.css-data.json +62 -2
- package/espalier.token-manifest.json +5724 -29
- package/package.json +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LIGHTNESS_KEYS as s}from"../../shared/theme.js";import{lightnessKeyToCSS as e}from"./lightness-key-to-css.js";function p(t){const o={};for(const r of s)o[e(r)]=`${Math.round(t.lightness[r]*100)}%`;return o}export{p as lightnessRampProperties};
|
|
1
|
+
import{LIGHTNESS_KEYS as s}from"../../shared/theme-core.js";import{lightnessKeyToCSS as e}from"./lightness-key-to-css.js";function p(t){const o={};for(const r of s)o[e(r)]=`${Math.round(t.lightness[r]*100)}%`;return o}export{p as lightnessRampProperties};
|
|
@@ -20,6 +20,9 @@ import { type CSSResult } from "lit";
|
|
|
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
22
|
* consumer keeps ownership of outer block rhythm, prose measure and font family.
|
|
23
|
+
*
|
|
24
|
+
* @cssprop --esp-blockquote-bar-color - Color of the quote's inline-start border. Defaults to `var(--esp-color-border)`.
|
|
25
|
+
* @cssprop --esp-blockquote-glyph-color - Ink of the opening quote mark. Defaults to `var(--esp-blockquote-bar-color, var(--esp-color-border))`.
|
|
23
26
|
*/
|
|
24
27
|
export declare function blockquoteStyles(selector?: string, options?: {
|
|
25
28
|
figureSelector?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{css as
|
|
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`
|
|
2
2
|
:where(${r}) {
|
|
3
3
|
margin-inline: 0;
|
|
4
4
|
min-inline-size: 0;
|
|
@@ -23,11 +23,11 @@ import{css as i,unsafeCSS as o}from"lit";function h(a="blockquote",s){const n=a.
|
|
|
23
23
|
letter-spacing: inherit;
|
|
24
24
|
color: inherit;
|
|
25
25
|
}
|
|
26
|
-
`;return
|
|
26
|
+
`;return o`
|
|
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-color-border);
|
|
30
|
+
border-inline-start: 0.3em solid var(--esp-blockquote-bar-color, var(--esp-color-border));
|
|
31
31
|
padding-block: var(--esp-size-small);
|
|
32
32
|
padding-inline-end: var(--esp-size-small);
|
|
33
33
|
padding-inline-start: calc(var(--esp-size-small) + 1.6em + var(--esp-size-tiny));
|
|
@@ -49,7 +49,7 @@ import{css as i,unsafeCSS as o}from"lit";function h(a="blockquote",s){const n=a.
|
|
|
49
49
|
inset-inline-start: var(--esp-size-small);
|
|
50
50
|
width: 1.6em;
|
|
51
51
|
height: 1.6em;
|
|
52
|
-
background: var(--esp-color-border);
|
|
52
|
+
background: var(--esp-blockquote-glyph-color, var(--esp-blockquote-bar-color, var(--esp-color-border)));
|
|
53
53
|
mask-image: ${l};
|
|
54
54
|
mask-size: contain;
|
|
55
55
|
mask-position: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CSS_NAMED_COLORS as w}from"./css-named-colors.js";const B=Math.PI/180,p=1e-4,
|
|
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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(o,n){for(const t of n)Object.prototype.hasOwnProperty.call(o,t)||(o[t]="initial")}export{e as addComponentPropertyResets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{classifyIconSpriteValue as
|
|
1
|
+
import{classifyIconSpriteValue as W}from"./intent-values.js";import{GoverningRootObserver as D}from"./governing-root.js";const E="data-esp-adopted-icons",A="http://www.w3.org/2000/svg",N=new Set;function Q(){N.clear()}function C(e,t){N.has(e)||(N.add(e),console.warn(t))}const y=new Map,g=new WeakMap;function P(e,t){const n=g.get(t);if(n===e)return;n&&$(n,t),g.set(t,e);let o=y.get(e);if(!o){const s=new Set,c=new MutationObserver(a=>{if(a.some(f=>f.target===e||e.contains(f.target)||[...f.removedNodes].some(i=>i===e||i.contains(e))||[...f.addedNodes].some(i=>i===e||i.contains(e))))for(const f of s)f.requestUpdate()});c.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0});const u=e.ownerDocument?.documentElement;u&&c.observe(u,{childList:!0,subtree:!0}),o={hosts:s,observer:c},y.set(e,o)}o.hosts.add(t)}function $(e,t){const n=y.get(e);n&&(n.hosts.delete(t),n.hosts.size===0&&(n.observer.disconnect(),y.delete(e)))}function w(e){const t=g.get(e);t&&($(t,e),g.delete(e)),U(e)}const O=new WeakMap,v=new WeakMap;function V(e,t,n){const o=v.get(n);o&&(o.document!==e||o.spriteId!==t)&&U(n);let s=O.get(e);s||(s=new Map,O.set(e,s));let c=s.get(t);if(!c){const u=new Set,a=new MutationObserver(()=>{if(e.getElementById(t)){a.disconnect(),s.delete(t);for(const p of u)v.delete(p),p.requestUpdate()}});a.observe(e.documentElement,{childList:!0,subtree:!0}),c={hosts:u,observer:a},s.set(t,c)}c.hosts.add(n),v.set(n,{document:e,spriteId:t})}function U(e){const t=v.get(e);if(!t)return;v.delete(e);const n=O.get(t.document),o=n?.get(t.spriteId);o&&(o.hosts.delete(e),o.hosts.size===0&&(o.observer.disconnect(),n.delete(t.spriteId)))}function z(e,t,n){if(!t)return;const o=W(e?e.iconSpriteUrl:null);let s=t.querySelector(`svg[${E}]`);if(o.kind!=="document"){s?.remove(),n&&w(n);return}const c=new Set;for(const i of t.querySelectorAll("use")){if(s&&s.contains(i))continue;const l=_(i);l&&c.add(l)}if(c.size===0&&!s){n&&w(n);return}const u=e?.ownerDocument??document,a=u.getElementById(o.spriteId);if(!a){if(C(o.spriteId,`Espalier icons: icon-sprite-url references "#${o.spriteId}" but no element with that id is in the document. Inline the sprite before setting icon-sprite-url (or set it again after), and icons will render.`),s?.remove(),n){const i=g.get(n);i&&($(i,n),g.delete(n)),V(u,o.spriteId,n)}return}if(n&&U(n),a.namespaceURI!==A||a.localName!=="svg"){C(o.spriteId,`Espalier icons: icon-sprite-url references "#${o.spriteId}", but that element is a <${a.localName}>, not an inline SVG sprite. Icons stay empty until the id names an <svg> containing <symbol>s.`),s?.remove(),n&&w(n);return}n&&P(a,n);{const i=new Set,l=[...c];for(;l.length>0;){const r=l.pop();if(i.has(r))continue;i.add(r);const d=M(a,r);if(d)for(const m of X(d))i.has(m)||(c.add(m),l.push(m))}}s&&s.getAttribute(E)!==o.spriteId&&(s.remove(),s=null);const p=new Map,f=i=>{const l=M(a,i);return l?{clone:j(l,a,o.spriteId,p)?l.cloneNode(!0):null,source:l}:{clone:null,source:null}};if(s){for(const i of[...s.children]){const l=i.getAttribute("id")??"",{clone:r,source:d}=c.has(l)?f(l):{clone:null,source:null};!r||!d?i.remove():i.isEqualNode(d)||s.replaceChild(r,i)}s.children.length===0&&c.size===0&&(s.remove(),s=null)}for(const i of c){if(s?.querySelector(`#${R(i)}`))continue;const{clone:l}=f(i);if(l){if(!s){s=t.ownerDocument.createElementNS(A,"svg"),s.setAttribute(E,o.spriteId),s.setAttribute("aria-hidden","true");const r=s.style;r.position="absolute",r.width="0",r.height="0",r.overflow="hidden",t.appendChild(s)}s.appendChild(l)}}}const q="http://www.w3.org/1999/xlink",B=new Set(["a","animate","animatemotion","animatetransform","discard","foreignobject","script","set","style"]),F=["href","xlink:href"],G=/url\(/giu,H=/url\(\s*(?:"#([^"\\]*)"|'#([^'\\]*)'|#([^\s)"'\\]*))\s*\)/giu;function I(e){let t=!1;const n=e.replace(/(%[0-9A-Fa-f]{2})+/gu,o=>{try{return decodeURIComponent(o)}catch{return t=!0,o}});return t?null:n}function L(e){const t=[...e.matchAll(G)].length,n=[];for(const o of e.matchAll(H)){const s=o[1]??o[2]??o[3]??"";if(s.length===0)continue;const c=I(s);c!==null&&n.push(c)}return{ids:n,ok:n.length===t}}function _(e){const t=x(e);return t===null?null:I(t)}function x(e){if(e.localName!=="use")return null;const t=e.getAttribute("href")??e.getAttribute("xlink:href")??e.getAttributeNS(q,"href");if(!t)return null;const n=t.trim();return n.startsWith("#")&&n.length>1?n.slice(1):null}function j(e,t,n,o){const s=o.get(e);if(s!==void 0)return s;const c=new Map,u=[],a=new Map,p=r=>(a.has(r)||a.set(r,M(t,r)),a.get(r)??null),f=[e];for(;f.length>0;){const r=f.pop();if(c.has(r))continue;const d=o.get(r);if(d!==void 0){c.set(r,{dependencies:[],localOk:d,missing:[]}),u.push(r);continue}const m=K(r,n),b=[],S=[];for(const T of m.dependencyIds){const k=p(T);k?(b.push(k),f.push(k)):S.push(T)}c.set(r,{dependencies:b,localOk:m.ok,missing:S}),u.push(r)}const i=new Set;for(const r of u){const d=c.get(r);(!d.localOk||d.missing.length>0)&&i.add(r)}let l=!0;for(;l;){l=!1;for(const r of u)i.has(r)||c.get(r).dependencies.some(d=>i.has(d))&&(i.add(r),l=!0)}for(const r of u){const d=c.get(r),m=!i.has(r);if(!m&&d.localOk){const b=d.missing[0]??d.dependencies.find(S=>i.has(S))?.getAttribute("id")??"?";h(r,n,d.missing.length>0?`composes or paints through #${b}, which is not in the sprite`:`composes or paints through the refused member #${b}`)}o.set(r,m)}return o.get(e)}function K(e,t){const n=[],o=[e,...e.querySelectorAll("*")];for(const s of o){if(s.namespaceURI!==A)return h(e,t,`contains the non-SVG element <${s.localName}>`),{dependencyIds:n,ok:!1};if(B.has(s.localName.toLowerCase()))return h(e,t,`contains <${s.localName}>`),{dependencyIds:n,ok:!1};let c=s.getAttributeNS(q,"href")!==null;for(const p of s.getAttributeNames()){const f=p.toLowerCase();if(f.startsWith("on"))return h(e,t,`carries the event-handler attribute ${p}`),{dependencyIds:n,ok:!1};if(F.includes(f)&&(c=!0),f==="src")return h(e,t,"carries a src attribute"),{dependencyIds:n,ok:!1};if(f==="style")return h(e,t,"carries an inline style attribute \u2014 use presentation attributes"),{dependencyIds:n,ok:!1};const i=s.getAttribute(p)??"";if(i.includes("\\"))return h(e,t,`carries a CSS escape sequence in ${p}`),{dependencyIds:n,ok:!1};const l=L(i);if(!l.ok)return h(e,t,`carries an unparseable or external url() reference in ${p}`),{dependencyIds:n,ok:!1};n.push(...l.ids)}const u=x(s),a=u===null?null:I(u);if(u!==null&&a===null)return h(e,t,`composes <use href="#${u}">, an undecodable fragment the browser resolves to nothing`),{dependencyIds:n,ok:!1};if(c&&a===null)return h(e,t,"carries an href outside a local-fragment <use> reference"),{dependencyIds:n,ok:!1};a!==null&&n.push(a)}return{dependencyIds:n,ok:!0}}function h(e,t,n){const o=e.getAttribute("id")??"(unnamed)";C(`${t}#${o}`,`Espalier icons: symbol "${o}" in "#${t}" ${n} and was not adopted \u2014 sprite symbols must be passive SVG (shapes, paths, local <use> composition).`)}function M(e,t){if(!t)return null;const o=e.querySelector(`symbol#${R(t)}`)??e.querySelector(`#${R(t)}`);return o&&o.namespaceURI===A?o:null}function X(e){const t=new Set,n=[e,...e.querySelectorAll("*")];for(const o of n){const s=_(o);s&&t.add(s);for(const c of o.getAttributeNames())for(const u of L(o.getAttribute(c)??"").ids)t.add(u)}return t}function R(e){const t=globalThis.CSS?.escape;return t?t(e):e.replace(/[^A-Za-z0-9_-]/gu,"\\$&")}class Y{constructor(t,n){this.host=t,this.sharedRootObserver=n,this.rootObserver=n??new D(t,(o,s)=>{o!==s&&(w(t),t.requestUpdate())}),n||this.rootObserver.subscribe("icon-sprite-url-changed",()=>t.requestUpdate()),t.addController(this)}hostConnected(){this.sharedRootObserver||this.rootObserver.connect()}hostDisconnected(){this.sharedRootObserver||this.rootObserver.disconnect(),w(this.host)}hostUpdated(){const t=this.rootObserver.refresh();z(t,this.host.shadowRoot,this.host)}}export{Y as DocumentSpriteController,z as adoptDocumentSpriteSymbols,I as decodeFragmentId,Q as resetWarnedMissingSprites};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, type PropertyValues } from "lit";
|
|
2
2
|
import { type SeedColorRoot } from "./bus-events.js";
|
|
3
|
+
import { type EspalierRoot } from "../root/esp-root.js";
|
|
3
4
|
import { type EspalierIntentVariant } from "./intent-values.js";
|
|
4
5
|
/**
|
|
5
6
|
* Shared base class for Espalier elements.
|
|
@@ -69,6 +70,8 @@ export declare class EspalierElementBase extends LitElement implements SeedColor
|
|
|
69
70
|
connectedCallback(): void;
|
|
70
71
|
disconnectedCallback(): void;
|
|
71
72
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
73
|
+
/** Called when this host gains, loses or changes its nearest root. */
|
|
74
|
+
protected governingRootChanged(_root: EspalierRoot | null): void;
|
|
72
75
|
constructor();
|
|
73
76
|
/**
|
|
74
77
|
* Traverse up the DOM tree to find the closest element that
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
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`
|
|
2
2
|
:host {
|
|
3
3
|
|
|
4
4
|
--_esp-font-body-fallback: system-ui, sans-serif;
|
|
@@ -42,7 +42,7 @@ var c=function(f,e,t,r){var o=arguments.length,s=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, ${
|
|
45
|
+
--_esp-field-resolved-background: var(--esp-field-background, ${Y(2)});
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
--_esp-field-polarity: var(--_esp-surface-polarity, 1);
|
|
@@ -139,4 +139,4 @@ var c=function(f,e,t,r){var o=arguments.length,s=o<3?e:r===null?r=Object.getOwnP
|
|
|
139
139
|
.esp-field:has(textarea:disabled):hover {
|
|
140
140
|
background-color: var(--_esp-field-resolved-background);
|
|
141
141
|
}
|
|
142
|
-
`],
|
|
142
|
+
`],d([T()],i.prototype,"seedColor",null),d([u({attribute:!1})],i.prototype,"correlationId",void 0),d([u({type:String,reflect:!0})],i.prototype,"scheme",void 0),d([u({type:String,attribute:"intent",reflect:!0,useDefault:!0})],i.prototype,"intent",null),d([u({type:String,attribute:"context",reflect:!0})],i.prototype,"context",null);export{i as EspalierElementBase};
|
|
@@ -106,8 +106,8 @@ export declare function googleFontStylesheetUrl(family: string, weight?: string)
|
|
|
106
106
|
* The caller owns only its stable key, so unrelated roots and picker instances
|
|
107
107
|
* cannot replace or clean up one another's links.
|
|
108
108
|
*/
|
|
109
|
-
export declare function syncRuntimeGoogleFontLink(options: RuntimeGoogleFontLinkOptions): HTMLLinkElement | null;
|
|
109
|
+
export declare function syncRuntimeGoogleFontLink(options: RuntimeGoogleFontLinkOptions, doc?: Document): HTMLLinkElement | null;
|
|
110
110
|
/** Remove one shared runtime font link by its exact owner key. */
|
|
111
|
-
export declare function removeRuntimeGoogleFontLink(owner: string): void;
|
|
111
|
+
export declare function removeRuntimeGoogleFontLink(owner: string, doc?: Document): void;
|
|
112
112
|
/** Remove all shared runtime font links whose owner begins with `ownerPrefix`. */
|
|
113
|
-
export declare function removeRuntimeGoogleFontLinks(ownerPrefix: string): void;
|
|
113
|
+
export declare function removeRuntimeGoogleFontLinks(ownerPrefix: string, doc?: Document): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{webSafeFontWeights as
|
|
1
|
+
import{webSafeFontWeights as c}from"./font-stacks.js";const g={100:"100 Thin",200:"200 Extra Light",300:"300 Light",400:"400 Regular",500:"500 Medium",600:"600 Semi Bold",700:"700 Bold",800:"800 Extra Bold",900:"900 Black"},f=e=>e.kind==="web-safe";function p(e){if(!e)return["400"];if(f(e))return c(e);const t=new Set;for(const r of e.variants)r.includes("italic")||t.add(r==="regular"?"400":r);const n=[...t].sort((r,i)=>Number(r)-Number(i));return n.length>0?n:["400"]}function b(e,t){return e?e==="bold"?"700":e==="normal"?"400":e:t}function u(e,t){const n=e===void 0||e===""?t:e;if(n===void 0)return null;if(typeof n=="number")return Number.isInteger(n)&&n>=1&&n<=1e3?n:null;const r=n.trim().toLowerCase();if(r==="normal")return 400;if(r==="bold")return 700;if(!/^\d{1,4}$/.test(r))return null;const i=Number(r);return Number.isInteger(i)&&i>=1&&i<=1e3?i:null}function x(e,t){if(t.length===0)return"400";if(t.includes(e))return e;const n=Number(e);let r=t[0],i=Math.abs(Number(r)-n);for(const o of t){const s=Math.abs(Number(o)-n);s<i&&(r=o,i=s)}return r}function y(e){let t="",n="",r=!1,i=0;for(const s of e.trim()){if(r){t+=s,r=!1;continue}if(s==="\\"){t+=s,r=!0;continue}if(n){t+=s,s===n&&(n="");continue}if(s==='"'||s==="'"){t+=s,n=s;continue}if(s==="("&&(i+=1),s===")"&&(i=Math.max(0,i-1)),s===","&&i===0)break;t+=s}const o=t.trim();return o.length>=2&&(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))?o.slice(1,-1).replace(/\\([\\"'])/g,"$1"):o}const m=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","fangsong","-apple-system","blinkmacsystemfont","arial","helvetica","helvetica neue","liberation sans","liberation serif","liberation mono","verdana","tahoma","trebuchet ms","georgia","times new roman","courier new","segoe ui"].map(e=>e.toLowerCase()));function F(e){return m.has(e.trim().toLowerCase())}function W(e){switch(e){case"serif":return"serif";case"monospace":return"monospace";case"handwriting":return"cursive";default:return"sans-serif"}}const a="data-esp-google-font-owner";function d(e,t){const n=u(t,400)??400,r=n!==400?`:wght@${n}`:"";return`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e)}${r}&display=swap`}function l(e,t){return t.head.querySelector(`link[${a}="${CSS.escape(e)}"]`)}function w(e,t=document){const n=l(e.owner,t),r=e.family.trim(),i=String(u(e.weight,400)??400);if(e.enabled===!1||!r)return n?.remove(),null;if(n?.dataset.espFamily===r&&n.dataset.espWeight===i)return n;n?.remove();const o=t.createElement("link");return o.rel="stylesheet",o.href=d(r,i),o.setAttribute(a,e.owner),o.dataset.espFamily=r,o.dataset.espWeight=i,t.head.appendChild(o),o}function L(e,t=document){l(e,t)?.remove()}function k(e,t=document){for(const n of t.head.querySelectorAll(`link[${a}]`))n.getAttribute(a)?.startsWith(e)&&n.remove()}export{a as RUNTIME_GOOGLE_FONT_OWNER_ATTR,g as WEIGHT_LABELS,x as bestAvailableWeight,y as extractFamily,p as extractWeights,W as getFallbackFont,d as googleFontStylesheetUrl,F as isLocalFontFamily,u as normalizeFontFaceWeight,b as normalizeWeight,L as removeRuntimeGoogleFontLink,k as removeRuntimeGoogleFontLinks,w as syncRuntimeGoogleFontLink};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* the exact requested faces, resolve only those WOFF2 sources, and embed the
|
|
6
6
|
* resulting CSS in the document head before `<esp-root>` can paint.
|
|
7
7
|
*/
|
|
8
|
-
import type { EspalierTheme } from "./theme.js";
|
|
8
|
+
import type { EspalierTheme } from "./theme-core.js";
|
|
9
9
|
export type FontPlanTheme = Pick<EspalierTheme, "fontBody" | "fontHeadings" | "fontBrand" | "fontMenu" | "fontMonospace" | "fontWeightBody" | "fontWeightHeadings" | "fontWeightBrand" | "fontWeightMenu" | "fontWeightMonospace">;
|
|
10
10
|
export type FontPlanSlot = "body" | "headings" | "brand" | "menu" | "monospace";
|
|
11
11
|
/**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { EspalierRoot } from "../root/esp-root.js";
|
|
2
|
+
import { type RootEventHandler, type RootEventName } from "./root-event-subscription.js";
|
|
3
|
+
/** Follow the ancestry that carries inherited styles across slots and shadow boundaries. */
|
|
4
|
+
export declare function flattenedParent(node: Node): Node | null;
|
|
5
|
+
/** Find the nearest esp-root ancestor, including through assigned slots. */
|
|
6
|
+
export declare function governingRoot(node: Node): EspalierRoot | null;
|
|
7
|
+
type RootCallback = (root: EspalierRoot) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Follow a connected host's root and the slots that can change it without a
|
|
10
|
+
* disconnect. Clients still own what they derive from that root.
|
|
11
|
+
*/
|
|
12
|
+
export declare class GoverningRootObserver {
|
|
13
|
+
constructor(host: Element, placementChanged?: ((root: EspalierRoot | null, previousRoot: EspalierRoot | null) => void) | undefined);
|
|
14
|
+
get root(): EspalierRoot | null;
|
|
15
|
+
connect(): void;
|
|
16
|
+
disconnect(): void;
|
|
17
|
+
refresh(): EspalierRoot | null;
|
|
18
|
+
subscribe<K extends RootEventName>(event: K, handler: RootEventHandler<K>): () => void;
|
|
19
|
+
/** Guard a delayed callback against leaving this particular binding. */
|
|
20
|
+
guard(callback: RootCallback): () => void;
|
|
21
|
+
/** Deliver live root state after its pending Lit update, once per callback. */
|
|
22
|
+
whenReady(callback: RootCallback): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isShadowRoot as l}from"./composed-dom.js";import{subscribeToRootEvent as f}from"./root-event-subscription.js";function d(n){return n.nodeType===Node.ELEMENT_NODE}function c(n){return d(n)||n.nodeType===Node.TEXT_NODE}function a(n){return c(n)&&n.assignedSlot?n.assignedSlot:l(n)?n.host:n.parentNode}function g(n){for(let t=a(n);t;t=a(t))if(d(t)&&t.localName==="esp-root")return t;return null}class S{constructor(t,e){this.host=t,this.placementChanged=e,this.active=!1,this.path=[],this.slotTargets=new Set,this.binding=null,this.rebindSubscriptions=new Set,this.onSlotChange=()=>{this.refresh()}}get root(){return this.binding?.root??null}connect(){this.active=!0,this.refresh()}disconnect(){this.active=!1,this.refresh()}refresh(){const t=this.active&&this.host.isConnected,e=t?g(this.host):null,o=this.root,i=[],r=new Set;if(t)for(let s=this.host;s&&s!==e;s=a(s))i.push(s),(l(s)||d(s)&&s.localName==="slot")&&r.add(s),d(s)&&s.parentElement?.shadowRoot&&r.add(s.parentElement.shadowRoot);const h=i.length!==this.path.length||i.some((s,u)=>s!==this.path[u]);if(this.path=i,this.syncSlotTargets(r),e!==o){this.binding=e?{root:e,pending:new Set}:null;for(const s of this.rebindSubscriptions)s(this.binding)}return(e!==o||h)&&this.placementChanged?.(e,o),this.root}syncSlotTargets(t){for(const e of this.slotTargets)t.has(e)||e.removeEventListener("slotchange",this.onSlotChange);for(const e of t)this.slotTargets.has(e)||e.addEventListener("slotchange",this.onSlotChange);this.slotTargets=t}subscribe(t,e){let o;const i=r=>{o?.(),o=r?f(r.root,t,h=>{this.refresh(),this.binding===r&&e(h)}):void 0};return this.rebindSubscriptions.add(i),i(this.binding),()=>{this.rebindSubscriptions.delete(i),i(null)}}guard(t){const e=this.binding;return()=>{this.refresh(),e&&this.binding===e&&t(e.root)}}whenReady(t){const e=this.binding;if(!e)return;const{root:o,pending:i}=e;if(o.hasUpdated&&!o.isUpdatePending){t(o);return}if(i.has(t))return;const r=o.updateComplete;if(!r){t(o);return}i.add(t),r.then(this.guard(h=>{i.delete(t),t(h)}))}}export{S as GoverningRootObserver,a as flattenedParent,g as governingRoot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{governingRoot as c}from"./governing-root.js";const u="/assets/icons.svg",p="0 0 24 24",a=/^[A-Za-z0-9][A-Za-z0-9_-]*$/u,l=100,o=new Set,s=[],d=["neutral","success","warning","danger","info"];function N(n){return d.includes(n)?n:"neutral"}function _(n,e=null){const t=n?.trim()??"";if(!a.test(t))return t.length>0&&f(t)&&console.warn(`Invalid Espalier icon name "${t}". Icon names must start with a letter or number and may only contain letters, numbers, dashes, and underscores.`),"";const r=i(e);switch(r.kind){case"url":return`${r.url}#${t}`;case"document":return`#${t}`;default:return""}}function i(n){const e=n?c(n):null;return I(e?e.iconSpriteUrl:u)}function I(n){const e=(n??"").trim();if(e.startsWith("#")){const r=e.slice(1).trim();return r?{kind:"document",spriteId:r}:{kind:"none"}}const t=e.split("#")[0]?.trim()||"";return t?{kind:"url",url:t}:{kind:"none"}}function g(n){const e=i(n);return e.kind==="url"?e.url:""}function f(n){if(o.has(n))return!1;if(o.add(n),s.push(n),s.length>l){const e=s.shift();e&&o.delete(e)}return!0}function A(){o.clear(),s.length=0}export{u as DEFAULT_ICON_SPRITE_URL,p as DEFAULT_ICON_VIEW_BOX,d as INTENT_VARIANTS,I as classifyIconSpriteValue,_ as getIconHrefForHost,i as getIconSpriteReference,g as getIconSpriteUrl,N as normalizeIntentVariant,A as resetWarnedInvalidIconNames};
|
package/dist/shared/paint-fit.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveConfiguredBrandColor as
|
|
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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SchemeEvents, type SeedColorRoot } from "./bus-events.js";
|
|
2
|
+
export type RootEventName = keyof SchemeEvents;
|
|
3
|
+
export type RootEventHandler<K extends RootEventName> = (payload: SchemeEvents[K]) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Subscribe to one root-scoped theme event and discard payloads published by
|
|
6
|
+
* every other root sharing the global Espalier bus.
|
|
7
|
+
*
|
|
8
|
+
* This is the single filtering primitive behind both `esp-root`'s public
|
|
9
|
+
* subscription API and `EspalierElementBase`'s internal theme coordination.
|
|
10
|
+
*/
|
|
11
|
+
export declare function subscribeToRootEvent<K extends RootEventName>(root: SeedColorRoot, event: K, handler: RootEventHandler<K>): () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class l{constructor(e){this.host=e,this.originalValues=new Map}apply(e){for(const t of this.originalValues.keys())Object.prototype.hasOwnProperty.call(e,t)||this.restoreScopedTokenProperty(t);for(const[t,r]of Object.entries(e))this.setScopedTokenProperty(t,r)}setScopedTokenProperty(e,t){const r=this.originalValues.get(e);if(r){const o=this.host.style.getPropertyValue(e),i=this.host.style.getPropertyPriority(e);(o!==r.generatedValue||i!==r.generatedPriority)&&(r.originalValue=o.length?o:null,r.originalPriority=i),r.generatedValue=t,r.generatedPriority=""}else{const o=this.host.style.getPropertyValue(e);this.originalValues.set(e,{generatedPriority:"",generatedValue:t,originalPriority:this.host.style.getPropertyPriority(e),originalValue:o.length?o:null})}this.host.style.setProperty(e,t)}restoreScopedTokenProperty(e){const t=this.originalValues.get(e);if(!t)return;const r=this.host.style.getPropertyValue(e),o=this.host.style.getPropertyPriority(e);(r!==t.generatedValue||o!==t.generatedPriority)&&(t.originalValue=r.length?r:null,t.originalPriority=o),t.originalValue===null?this.host.style.removeProperty(e):this.host.style.setProperty(e,t.originalValue,t.originalPriority),this.originalValues.delete(e)}clear(){for(const e of[...this.originalValues.keys()])this.restoreScopedTokenProperty(e)}}export{l as ScopedStyleDeclarations};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Every semantic color token the system computes. */
|
|
2
|
+
export type SemanticColorName = "background" | "layer1" | "layer2" | "layer3" | "layer4" | "actionBackground" | "actionText" | "border" | "shadow" | "text" | "typeOverline" | "typeLabel" | "typeLead" | "typeCaption" | "dangerText" | "headings" | "headingsHover" | "link" | "linkHover" | "linkHoverBg" | "inputCaret" | "inputSelection" | "inputSelectionBg";
|
|
3
|
+
/** Ordered list of all semantic color token names. */
|
|
4
|
+
export declare const SEMANTIC_COLOR_NAMES: readonly SemanticColorName[];
|
|
5
|
+
/** `true` when `value` is one of the stable semantic color token names. */
|
|
6
|
+
export declare function isSemanticColorName(value: unknown): value is SemanticColorName;
|
|
7
|
+
/**
|
|
8
|
+
* Convert a {@link SemanticColorName} (camelCase) to its CSS
|
|
9
|
+
* custom-property name (kebab-case with `--esp-color-` prefix).
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* linkHoverBg → --esp-color-link-hover-bg
|
|
13
|
+
* layer1 → --esp-color-layer-1
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function semanticToCSS(name: SemanticColorName): string;
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +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};
|