@symbo.ls/scratch 3.14.777 → 3.14.779

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 CHANGED
@@ -1,10 +1,20 @@
1
1
  # @symbo.ls/scratch
2
2
 
3
- ## 3.14.777
3
+ ## 3.14.779
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Auto-generated patch release for changed packages.
7
+ - shadow: add the `setShadow` idempotency guard that `setColor`/`setGradient` already had
8
+
9
+ An already-processed `{ var, value }` leaf re-entering `setShadow` now passes
10
+ through untouched instead of being wrapped a second time. Without the guard,
11
+ a re-`set()` pass (HMR, livesync, an iframe re-processing an
12
+ already-configured CONFIG) double-wraps the leaf, `getShadow` leaks the
13
+ wrapper object into a `boxShadow` slot, and the atomic engine reads its
14
+ `var`/`value` keys as nested selectors — a stray `.<class> value { box-shadow:
15
+ ... }` rule that can never match.
16
+
17
+ Reference: RELMAN-PUBLISH-SCRATCH-SHADOW-IDEMPOTENCY-GUARD-1.
8
18
 
9
19
  ## 3.14.774
10
20
 
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var o in e)f(t,o,{get:e[o],enumerable:!0})},g=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a(e))!S.call(t,i)&&i!==o&&f(t,i,{get:()=>e[i],enumerable:!(n=m(e,i))||n.enumerable});return t};var C=t=>g(f({},"__esModule",{value:!0}),t);var B={};p(B,{resolveBorderValue:()=>h});module.exports=C(B);var u=require("./color.js"),c=require("./spacing.js"),s=require("../utils/color.js");const E=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),R=t=>E.has(t),h=(t,e,o)=>{if(t==null)return;const n=t+"";if(s.CSS_NATIVE_COLOR_REGEX.test(n))return n;const i=n.trim();return i==="none"||i==="0"||i==="initial"||i==="inherit"||i==="unset"?n:n.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if((0,s.isCSSVar)(r))return`var(${r})`;if(R(r)||/^\d/.test(r)||r==="0")return r;const l=(0,u.quietColorProbe)(()=>(0,u.getColor)(r,e));if((0,s.isResolvedColor)(l))return l;o&&o(r);const d=(0,c.getSpacingByKey)(r,"border");return d&&d.border?d.border:r}).join(" ")};
1
+ "use strict";var f=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var s in e)f(t,s,{get:e[s],enumerable:!0})},p=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c(e))!m.call(t,i)&&i!==s&&f(t,i,{get:()=>e[i],enumerable:!(o=S(e,i))||o.enumerable});return t};var g=t=>p(f({},"__esModule",{value:!0}),t);var _={};C(_,{resolveBorderValue:()=>R});module.exports=g(_);var u=require("./color.js"),a=require("./spacing.js"),n=require("../utils/color.js");const E=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),O=t=>E.has(t),R=(t,e,s)=>{if(t==null)return;const o=t+"";if(n.CSS_NATIVE_COLOR_REGEX.test(o))return o;const i=o.trim();return i==="none"||i==="0"||i==="initial"||i==="inherit"||i==="unset"?o:o.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if((0,n.isCSSVar)(r))return`var(${r})`;if(O(r)||/^\d/.test(r)||r==="0")return r;const l=(0,u.quietColorProbe)(()=>(0,u.getColor)(r,e));if((0,n.isResolvedColor)(l))return l;if(n.COMPOUND_CSS_KEYWORDS.has(r.toLowerCase()))return r;s&&s(r);const d=(0,a.getSpacingByKey)(r,"border");return d&&d.border?d.border:r}).join(" ")};
@@ -1 +1 @@
1
- "use strict";var D=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var z=(e,n)=>{for(var o in n)D(e,o,{get:n[o],enumerable:!0})},B=(e,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of W(n))!H.call(e,t)&&t!==o&&D(e,t,{get:()=>n[t],enumerable:!(r=v(n,t))||r.enumerable});return e};var K=e=>B(D({},"__esModule",{value:!0}),e);var Z={};z(Z,{STANDARD_SCHEME_QUERIES:()=>P,getColor:()=>V,getMediaColor:()=>Y,quietColorProbe:()=>U,resolveColorRgb:()=>O,setAdaptiveSchemeVar:()=>L,setColor:()=>E,setGradient:()=>j});module.exports=K(Z);var d=require("@symbo.ls/utils"),R=require("../factory.js"),g=require("../utils/index.js");const P={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},w=new Set,Q=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),C=new Set,T=e=>{if(!e)return!1;const{color:n,gradient:o}=e;return!!((0,d.isObject)(n)&&Object.keys(n).length||(0,d.isObject)(o)&&Object.keys(o).length)},_=new Set;let M=0;const U=e=>{M++;try{return e()}finally{M--}},J=(e,n)=>{if(!(0,d.isString)(e)||e.indexOf(" ")===-1)return null;const o=e.replace(/\s+/g,""),r=(0,g.parseColorToken)(o);if(!r||r.passthrough||r.cssVar)return null;const{color:t,gradient:c}=n;return!t[r.name]&&!c[r.name]?null:o},x=(e,n,o)=>{const r=J(e,o);if(r){if(!_.has(e)){_.add(e);const a=o&&o.name?` (design system \`${o.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` has a space before its alpha/tone modifier${a} \u2014 did you mean \`${r}\`? The space form never resolves, so the atomic class it mints carries no CSS value and paints invisibly. Dropped rather than shipped invisible.`)}return}const t=(0,g.parseColorToken)(e);if(t&&t.name&&!t.passthrough&&!t.cssVar&&(t.alpha!==void 0||t.tone!==void 0)&&T(o)&&!o.color[t.name]&&!o.gradient[t.name]){if(!M&&!C.has(e)){C.add(e);const a=o&&o.name?` (design system \`${o.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` does not resolve${a} \u2014 \`${t.name}\` is not in the palette. Dropped rather than emitted as a raw value, which is invalid CSS the browser discards silently. Define it in designSystem/color.js or use a palette token.`)}return}const c=(0,d.isString)(n)?n.toLowerCase():"";if(!Q.has(c)||!T(o))return e;if(!C.has(c)){C.add(c);const a=o&&o.name?` (design system \`${o.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${a}. Dropped rather than emitted as a raw browser colour, which renders theme-blind and can be unreadable ("looks designed", so it ships unnoticed). Define it in designSystem/color.js or use a palette token.`)}},V=(e,n,o)=>{const r=o||(0,R.getActiveConfig)();if(!(0,d.isString)(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if((0,g.isCSSVar)(e))return`var(${e})`;n&&e[n]&&(e=e[n]);let t,c,a;if((0,d.isArray)(e))[t,c,a]=e;else{const l=(0,g.parseColorToken)(e);if(!l){const{color:h,gradient:S}=r;let $=S[e]||h[e];return $?(n&&$[n]&&($=$[n]),r.useVariable?`var(${$.var})`:$.value):x(e,e,r)}if(l.passthrough)return l.passthrough;if(l.cssVar)return`var(${l.cssVar})`;t=l.name,c=l.alpha,a=l.tone}const{color:b,gradient:f}=r;let s=b[t]||f[t];if(!s)return x(e,t,r);if(n)if(s[n]!==void 0)s=s[n];else if((0,d.isArray)(s)){const l=n.charCodeAt(0)===64?n.slice(1):n;l==="dark"?s=s[1]!==void 0?s[1]:s[0]:(l!=="light"&&r.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",n),s=s[0])}else r.verbose&&console.warn(e," - does not have ",n);if((0,d.isString)(s)){if(w.has(t))return s;w.add(t);try{return V(s,null,o)}finally{w.delete(t)}}let p=s.rgb;if(!p){const l=r.useVariable?`var(${s.var})`:s.value;if((c||a)&&l){const h=c!==void 0?c:1;if(!a)return`rgb(from ${l} r g b / ${h})`;if(a.charCodeAt(0)===43||a.charCodeAt(0)===45){const $=parseFloat(a),u=$<0?"-":"+",i=Math.abs($);return`rgb(from ${l} calc(r ${u} ${i}) calc(g ${u} ${i}) calc(b ${u} ${i}) / ${h})`}return`hsl(from ${l} h s ${a}% / ${h})`}return l}return a&&!s[a]&&(p=(0,g.getRgbTone)(p,a),s[a]={rgb:p,var:`${s.var}-${a}`}),s[a]&&(p=s[a].rgb),c?`rgba(${p}, ${c})`:a?`rgba(${p}, ${s.alpha!==void 0?s.alpha:1})`:r.useVariable?`var(${s.var})`:s.value!==void 0?s.value:`rgb(${p})`},q=e=>{const n=(0,g.colorStringToRgbaArray)(e);return!n||n.length<3||n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[n[0],n[1],n[2]],alpha:n[3]!==void 0?n[3]:1}},X=(e,n)=>{if(!n)return e;let o=e.rgb;if(n.tone){const t=(0,g.getRgbTone)(o,n.tone);o=(0,d.isString)(t)?t.split(",").map(c=>parseFloat(c.trim())):t}const r=n.alpha!==void 0?parseFloat(n.alpha):e.alpha;return{rgb:o,alpha:r}},O=(e,n,o)=>{const r=n||(0,R.getActiveConfig)();if(!(0,d.isString)(e))return null;const t=(0,g.parseColorToken)(e);if(t){if(t.passthrough){const h=(0,g.colorStringToRgbaArray)(t.passthrough);return h&&h.length>=3?{rgb:[h[0],h[1],h[2]],alpha:h[3]!==void 0?h[3]:1}:null}if(t.cssVar)return null}const c=t?t.name:e,{color:a,gradient:b}=r;let f=a[c]||b[c];if(!f)return q(e);if((0,d.isString)(f)){let h;if(w.has(c))h=q(f);else{w.add(c);try{h=O(f,r,o)}finally{w.delete(c)}}return h?X(h,t):null}if(f.rgb===void 0&&(0,d.isObject)(f)){const h=`@${o||"light"}`;f=f[h]!==void 0?f[h]:f["@light"]}if(!f||f.rgb===void 0)return null;let s=f.rgb;t&&t.tone&&(s=(0,g.getRgbTone)(s,t.tone));const p=(0,d.isString)(s)?s.split(",").map(h=>parseFloat(h.trim())):s,l=t&&t.alpha!==void 0?parseFloat(t.alpha):f.alpha!==void 0?f.alpha:1;return{rgb:p,alpha:l}},Y=(e,n,o)=>{const r=o||(0,R.getActiveConfig)();if(n||(n=r.globalTheme==="auto"?null:r.globalTheme),!(0,d.isString)(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if((0,g.isCSSVar)(e))return`var(${e})`;let t,c,a;if((0,d.isArray)(e))t=e[0];else{const l=(0,g.parseColorToken)(e);if(l){if(l.passthrough)return l.passthrough;if(l.cssVar)return`var(${l.cssVar})`;t=l.name,c=l.alpha,a=l.tone}else t=e}const{color:b,gradient:f}=r,s=b[t]||f[t],p=(0,d.isObject)(s);if(p&&s.value)return V(e,`@${n}`,o);if(p){if(r.useVariable&&s.var)return c||a?V(e,null,o):`var(${s.var})`;if(n)return V(e,`@${n}`,o);{const l={},h=r.scopeSelector||":root",S=h===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${h}:not([data-theme])`;for(const $ in s){if($.charCodeAt(0)!==64)continue;const u=$.slice(1),i=V(e,$,o);if(i!==void 0&&(l[`[data-theme="${u}"] &`]=i,u==="light"||u==="dark")){const m=r.media&&r.media[u]||P[u];if(!m)continue;const y="@media "+(m==="print"?`${m}`:`screen and ${m}`);l[y]={[`${S} &`]:i}}}return l}}else return x(e,t,r)},L=(e,n,o,r)=>{const c=`--${r.varPrefix?r.varPrefix+"-":""}${n}-${o}`;let a;const b={};for(const f in e){if(f.charCodeAt(0)!==64)continue;const s=f.slice(1),p=e[f],l=p&&(p.value||p);!l||typeof l!="string"||(b[s]=l,(s==="light"||a===void 0)&&(a=l))}if(a!==void 0){r.cssVars[c]=a,r.cssMediaVars||(r.cssMediaVars={});for(const f in b){const s=`[data-theme="${f}"]`;if(r.cssMediaVars[s]||(r.cssMediaVars[s]={}),r.cssMediaVars[s][c]=b[f],f==="light"||f==="dark"){const p=`@media (prefers-color-scheme: ${f})`;r.cssMediaVars[p]||(r.cssMediaVars[p]={}),r.cssMediaVars[p][c]=b[f]}}return e.var=c,c}},E=(e,n,o)=>{const r=(0,R.getActiveConfig)();if((0,d.isObject)(e)&&e.value!==void 0&&(e.rgb!==void 0||e.var!==void 0))return r.useVariable&&e.var&&(r.cssVars[e.var]=e.value),e;if((0,d.isString)(e)&&(0,g.isCSSVar)(e)){const u=e.slice(2);if(e=V(u),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const i=u.split(" ");let m=r.color[i[0]];if(m&&!m.value&&!m.rgb&&((0,d.isString)(m)||(0,d.isArray)(m)||(0,d.isObject)(m))&&!w.has(i[0])){w.add(i[0]);try{r.color[i[0]]=E(m,i[0])}finally{w.delete(i[0])}m=r.color[i[0]]}if(m&&m.value){let y=m.rgb;const A=i[1]!==void 0?i[1]:"1",k=i[2];k&&(y=(0,g.getRgbTone)(y,k)),e=`rgba(${y}, ${A})`}else{const y=i[2],A=i[1]!==void 0?i[1]:"1";if(y)try{const k=(0,g.colorStringToRgbaArray)(i[0]);k&&k.length>=3?e=`rgba(${(0,g.getRgbTone)(k.slice(0,3).join(", "),y)}, ${A})`:e=i[0]}catch{e=i[0]}else e=i[0]}}}if((0,d.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,d.isObject)(e)){const u={};for(const i in e)i!=="var"&&(u[i]=E(e[i],n,i.slice(0,1)==="@"?i.slice(1):i));return r.useVariable&&L(u,"color",n,r),u}const c=`--${r.varPrefix?r.varPrefix+"-":""}color-${n}`+(o?`-${o}`:"");let a=e.value||e;if((0,d.isString)(a)&&!a.includes("(")&&!a.startsWith("#")){const u=(0,g.parseColorToken)(a);if(u&&u.name&&!u.passthrough&&!u.cssVar){const i=r.color[u.name];if(i&&!i.value&&!i.rgb&&((0,d.isString)(i)||(0,d.isArray)(i)||(0,d.isObject)(i))&&!w.has(u.name)){w.add(u.name);try{r.color[u.name]=E(i,u.name)}finally{w.delete(u.name)}}const m=r.color[u.name];if(m&&m.rgb){let y=m.rgb;u.tone&&(y=(0,g.getRgbTone)(y,u.tone));const A=u.alpha!==void 0?parseFloat(u.alpha):m.alpha!==void 0?m.alpha:1;a=`rgba(${y}, ${A})`}}}const b=(0,g.colorStringToRgbaArray)(a),[f,s,p,l=1]=b,h=parseFloat(l.toFixed(2)),S=`${f}, ${s}, ${p}`,$=`rgba(${S}, ${h})`;return r.useVariable&&(r.cssVars[c]=$),{var:c,rgb:S,alpha:h,value:$}},j=(e,n,o)=>{const r=(0,R.getActiveConfig)();if((0,d.isObject)(e)&&e.value!==void 0&&e.var!==void 0)return r.useVariable&&(r.cssVars[e.var]=e.value),e;if((0,d.isString)(e)&&(0,g.isCSSVar)(e)&&(e=V(e.slice(2))),(0,d.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,d.isObject)(e)){const a={};for(const b in e)b!=="var"&&(a[b]=j(e[b],n,b.slice(0,1)==="@"?b.slice(1):b));return r.useVariable&&L(a,"gradient",n,r),a}const c=`--${r.varPrefix?r.varPrefix+"-":""}gradient-${n}`+(o?`-${o}`:"");return r.useVariable&&(r.cssVars[c]=e.value||e),{var:c,value:e.value||e}};
1
+ "use strict";var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var B=(e,r)=>{for(var t in r)M(e,t,{get:r[t],enumerable:!0})},K=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Q(r))!z.call(e,o)&&o!==t&&M(e,o,{get:()=>r[o],enumerable:!(n=H(r,o))||n.enumerable});return e};var U=e=>K(M({},"__esModule",{value:!0}),e);var I={};B(I,{STANDARD_SCHEME_QUERIES:()=>P,getColor:()=>S,getMediaColor:()=>N,quietColorProbe:()=>X,resolveColorRgb:()=>v,schemeGuardSelector:()=>j,schemeMediaQuery:()=>O,setAdaptiveSchemeVar:()=>L,setColor:()=>E,setGradient:()=>W});module.exports=U(I);var d=require("@symbo.ls/utils"),R=require("../factory.js"),g=require("../utils/index.js");const P={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},O=(e,r)=>{const t=r.media&&r.media[e]||P[e];return t?"@media "+(t==="print"?`${t}`:`screen and ${t}`):null},j=e=>{const r=e.scopeSelector||":root";return`${r===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${r}:not([data-theme])`} &`},y=new Set,J=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),C=new Set,T=e=>{if(!e)return!1;const{color:r,gradient:t}=e;return!!((0,d.isObject)(r)&&Object.keys(r).length||(0,d.isObject)(t)&&Object.keys(t).length)},_=new Set;let D=0;const X=e=>{D++;try{return e()}finally{D--}},Y=(e,r)=>{if(!(0,d.isString)(e)||e.indexOf(" ")===-1)return null;const t=e.replace(/\s+/g,""),n=(0,g.parseColorToken)(t);if(!n||n.passthrough||n.cssVar)return null;const{color:o,gradient:c}=r;return!o[n.name]&&!c[n.name]?null:t},x=(e,r,t)=>{const n=Y(e,t);if(n){if(!_.has(e)){_.add(e);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` has a space before its alpha/tone modifier${a} \u2014 did you mean \`${n}\`? The space form never resolves, so the atomic class it mints carries no CSS value and paints invisibly. Dropped rather than shipped invisible.`)}return}const o=(0,g.parseColorToken)(e);if(o&&o.name&&!o.passthrough&&!o.cssVar&&(o.alpha!==void 0||o.tone!==void 0)&&T(t)&&!t.color[o.name]&&!t.gradient[o.name]){if(!D&&!C.has(e)){C.add(e);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` does not resolve${a} \u2014 \`${o.name}\` is not in the palette. Dropped rather than emitted as a raw value, which is invalid CSS the browser discards silently. Define it in designSystem/color.js or use a palette token.`)}return}const c=(0,d.isString)(r)?r.toLowerCase():"";if(!J.has(c)||!T(t))return e;if(!C.has(c)){C.add(c);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${a}. Dropped rather than emitted as a raw browser colour, which renders theme-blind and can be unreadable ("looks designed", so it ships unnoticed). Define it in designSystem/color.js or use a palette token.`)}},S=(e,r,t)=>{const n=t||(0,R.getActiveConfig)();if(!(0,d.isString)(e)){n.verbose&&console.warn(e,"- type for color is not valid");return}if((0,g.isCSSVar)(e))return`var(${e})`;r&&e[r]&&(e=e[r]);let o,c,a;if((0,d.isArray)(e))[o,c,a]=e;else{const i=(0,g.parseColorToken)(e);if(!i){const{color:h,gradient:V}=n;let b=V[e]||h[e];return b?(r&&b[r]&&(b=b[r]),n.useVariable?`var(${b.var})`:b.value):x(e,e,n)}if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;o=i.name,c=i.alpha,a=i.tone}const{color:m,gradient:u}=n;let s=m[o]||u[o];if(!s)return x(e,o,n);if(r)if(s[r]!==void 0)s=s[r];else if((0,d.isArray)(s)){const i=r.charCodeAt(0)===64?r.slice(1):r;i==="dark"?s=s[1]!==void 0?s[1]:s[0]:(i!=="light"&&n.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",r),s=s[0])}else n.verbose&&console.warn(e," - does not have ",r);if((0,d.isString)(s)){if(y.has(o))return s;y.add(o);try{return S(s,null,t)}finally{y.delete(o)}}let p=s.rgb;if(!p){const i=n.useVariable?`var(${s.var})`:s.value;if((c||a)&&i){const h=c!==void 0?c:1;if(!a)return`rgb(from ${i} r g b / ${h})`;if(a.charCodeAt(0)===43||a.charCodeAt(0)===45){const b=parseFloat(a),f=b<0?"-":"+",l=Math.abs(b);return`rgb(from ${i} calc(r ${f} ${l}) calc(g ${f} ${l}) calc(b ${f} ${l}) / ${h})`}return`hsl(from ${i} h s ${a}% / ${h})`}return i}return a&&!s[a]&&(p=(0,g.getRgbTone)(p,a),s[a]={rgb:p,var:`${s.var}-${a}`}),s[a]&&(p=s[a].rgb),c?`rgba(${p}, ${c})`:a?`rgba(${p}, ${s.alpha!==void 0?s.alpha:1})`:n.useVariable?`var(${s.var})`:s.value!==void 0?s.value:`rgb(${p})`},q=e=>{const r=(0,g.colorStringToRgbaArray)(e);return!r||r.length<3||r[0]===0&&r[1]===0&&r[2]===0&&r[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[r[0],r[1],r[2]],alpha:r[3]!==void 0?r[3]:1}},Z=(e,r)=>{if(!r)return e;let t=e.rgb;if(r.tone){const o=(0,g.getRgbTone)(t,r.tone);t=(0,d.isString)(o)?o.split(",").map(c=>parseFloat(c.trim())):o}const n=r.alpha!==void 0?parseFloat(r.alpha):e.alpha;return{rgb:t,alpha:n}},v=(e,r,t)=>{const n=r||(0,R.getActiveConfig)();if(!(0,d.isString)(e))return null;const o=(0,g.parseColorToken)(e);if(o){if(o.passthrough){const h=(0,g.colorStringToRgbaArray)(o.passthrough);return h&&h.length>=3?{rgb:[h[0],h[1],h[2]],alpha:h[3]!==void 0?h[3]:1}:null}if(o.cssVar)return null}const c=o?o.name:e,{color:a,gradient:m}=n;let u=a[c]||m[c];if(!u)return q(e);if((0,d.isString)(u)){let h;if(y.has(c))h=q(u);else{y.add(c);try{h=v(u,n,t)}finally{y.delete(c)}}return h?Z(h,o):null}if(u.rgb===void 0&&(0,d.isObject)(u)){const h=`@${t||"light"}`;u=u[h]!==void 0?u[h]:u["@light"]}if(!u||u.rgb===void 0)return null;let s=u.rgb;o&&o.tone&&(s=(0,g.getRgbTone)(s,o.tone));const p=(0,d.isString)(s)?s.split(",").map(h=>parseFloat(h.trim())):s,i=o&&o.alpha!==void 0?parseFloat(o.alpha):u.alpha!==void 0?u.alpha:1;return{rgb:p,alpha:i}},N=(e,r,t)=>{const n=t||(0,R.getActiveConfig)();if(r||(r=n.globalTheme==="auto"?null:n.globalTheme),!(0,d.isString)(e)){n.verbose&&console.warn(e,"- type for color is not valid");return}if((0,g.isCSSVar)(e))return`var(${e})`;let o,c,a;if((0,d.isArray)(e))o=e[0];else{const i=(0,g.parseColorToken)(e);if(i){if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;o=i.name,c=i.alpha,a=i.tone}else o=e}const{color:m,gradient:u}=n,s=m[o]||u[o],p=(0,d.isObject)(s);if(p&&s.value)return S(e,`@${r}`,t);if(p){if(n.useVariable&&s.var)return c||a?S(e,null,t):`var(${s.var})`;if(r)return S(e,`@${r}`,t);{const i={},h=j(n);for(const V in s){if(V.charCodeAt(0)!==64)continue;const b=V.slice(1),f=S(e,V,t);if(f!==void 0&&(i[`[data-theme="${b}"] &`]=f,b==="light"||b==="dark")){const l=O(b,n);if(!l)continue;i[l]={[h]:f}}}return i}}else return x(e,o,n)},L=(e,r,t,n)=>{const c=`--${n.varPrefix?n.varPrefix+"-":""}${r}-${t}`;let a;const m={};for(const u in e){if(u.charCodeAt(0)!==64)continue;const s=u.slice(1),p=e[u],i=p&&(p.value||p);!i||typeof i!="string"||(m[s]=i,(s==="light"||a===void 0)&&(a=i))}if(a!==void 0){n.cssVars[c]=a,n.cssMediaVars||(n.cssMediaVars={});for(const u in m){const s=`[data-theme="${u}"]`;if(n.cssMediaVars[s]||(n.cssMediaVars[s]={}),n.cssMediaVars[s][c]=m[u],u==="light"||u==="dark"){const p=`@media (prefers-color-scheme: ${u})`;n.cssMediaVars[p]||(n.cssMediaVars[p]={}),n.cssMediaVars[p][c]=m[u]}}return e.var=c,c}},E=(e,r,t)=>{const n=(0,R.getActiveConfig)();if((0,d.isObject)(e)&&e.value!==void 0&&(e.rgb!==void 0||e.var!==void 0))return n.useVariable&&e.var&&(n.cssVars[e.var]=e.value),e;if((0,d.isString)(e)&&(0,g.isCSSVar)(e)){const f=e.slice(2);if(e=S(f),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const l=f.split(" ");let $=n.color[l[0]];if($&&!$.value&&!$.rgb&&((0,d.isString)($)||(0,d.isArray)($)||(0,d.isObject)($))&&!y.has(l[0])){y.add(l[0]);try{n.color[l[0]]=E($,l[0])}finally{y.delete(l[0])}$=n.color[l[0]]}if($&&$.value){let w=$.rgb;const A=l[1]!==void 0?l[1]:"1",k=l[2];k&&(w=(0,g.getRgbTone)(w,k)),e=`rgba(${w}, ${A})`}else{const w=l[2],A=l[1]!==void 0?l[1]:"1";if(w)try{const k=(0,g.colorStringToRgbaArray)(l[0]);k&&k.length>=3?e=`rgba(${(0,g.getRgbTone)(k.slice(0,3).join(", "),w)}, ${A})`:e=l[0]}catch{e=l[0]}else e=l[0]}}}if((0,d.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,d.isObject)(e)){const f={};for(const l in e)l!=="var"&&(f[l]=E(e[l],r,l.slice(0,1)==="@"?l.slice(1):l));return n.useVariable&&L(f,"color",r,n),f}const c=`--${n.varPrefix?n.varPrefix+"-":""}color-${r}`+(t?`-${t}`:"");let a=e.value||e;if((0,d.isString)(a)&&!a.includes("(")&&!a.startsWith("#")){const f=(0,g.parseColorToken)(a);if(f&&f.name&&!f.passthrough&&!f.cssVar){const l=n.color[f.name];if(l&&!l.value&&!l.rgb&&((0,d.isString)(l)||(0,d.isArray)(l)||(0,d.isObject)(l))&&!y.has(f.name)){y.add(f.name);try{n.color[f.name]=E(l,f.name)}finally{y.delete(f.name)}}const $=n.color[f.name];if($&&$.rgb){let w=$.rgb;f.tone&&(w=(0,g.getRgbTone)(w,f.tone));const A=f.alpha!==void 0?parseFloat(f.alpha):$.alpha!==void 0?$.alpha:1;a=`rgba(${w}, ${A})`}}}const m=(0,g.colorStringToRgbaArray)(a),[u,s,p,i=1]=m,h=parseFloat(i.toFixed(2)),V=`${u}, ${s}, ${p}`,b=`rgba(${V}, ${h})`;return n.useVariable&&(n.cssVars[c]=b),{var:c,rgb:V,alpha:h,value:b}},W=(e,r,t)=>{const n=(0,R.getActiveConfig)();if((0,d.isObject)(e)&&e.value!==void 0&&e.var!==void 0)return n.useVariable&&(n.cssVars[e.var]=e.value),e;if((0,d.isString)(e)&&(0,g.isCSSVar)(e)&&(e=S(e.slice(2))),(0,d.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,d.isObject)(e)){const a={};for(const m in e)m!=="var"&&(a[m]=W(e[m],r,m.slice(0,1)==="@"?m.slice(1):m));return n.useVariable&&L(a,"gradient",r,n),a}const c=`--${n.varPrefix?n.varPrefix+"-":""}gradient-${r}`+(t?`-${t}`:"");return n.useVariable&&(n.cssVars[c]=e.value||e),{var:c,value:e.value||e}};
@@ -1 +1 @@
1
- "use strict";var S=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var A=(r,o)=>{for(var i in o)S(r,i,{get:o[i],enumerable:!0})},$=(r,o,i,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of g(o))!j.call(r,t)&&t!==i&&S(r,t,{get:()=>o[t],enumerable:!(e=O(o,t))||e.enumerable});return r};var x=r=>$(S({},"__esModule",{value:!0}),r);var W={};A(W,{getShadow:()=>N,resolveShadowValue:()=>V,setShadow:()=>C});module.exports=x(W);var h=require("../factory.js"),p=require("./color.js"),b=require("./spacing.js"),d=require("../utils/color.js"),c=require("@symbo.ls/utils");const V=(r,o,i)=>!(0,c.isString)(r)||d.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,d.splitTopLevelCommas)(r).map(e=>(e=e.trim(),e.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const s=(0,p.quietColorProbe)(()=>(0,p.getColor)(t,o));if((0,d.isResolvedColor)(s))return s;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none")return t;i&&i(t);const f=(0,b.getSpacingByKey)(t,"shadow");return f&&f.shadow?f.shadow:t}).join(" "))).join(", "),C=(r,o,i,e)=>{const t=(0,h.getActiveConfig)();if((0,c.isArray)(r)){const n={"@light":C(r[0],o,"light"),"@dark":C(r[1],o,"dark")};return t.useVariable&&(0,p.setAdaptiveSchemeVar)(n,"shadow",o,t),n}if((0,c.isObject)(r)){const n={};for(const a in r)n[a]=C(r[a],o,a.startsWith("@")?a.slice(1):a);return t.useVariable&&(0,p.setAdaptiveSchemeVar)(n,"shadow",o,t),n}(0,c.isString)(r)&&!d.CSS_NATIVE_COLOR_REGEX.test(r)&&(r=V(r));const f=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[f]=r),{var:f,value:r}},N=(r,o)=>{const i=(0,h.getActiveConfig)();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!(0,c.isString)(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if((0,d.isCSSVar)(r))return`var(${r})`;const[e]=(0,c.isArray)(r)?r:r.split(" "),s=i.shadow[e],f=(0,c.isObject)(s);if(!s)return i.verbose&&console.warn("Can't find color ",e),r;if(o){const n=s["@"+o]||s[o];if(n)return n.value!==void 0?n.value:n;i.verbose&&console.warn(r," - does not have ",o)}if(f&&s.value)return s.value;if(f){const n={};for(const a in s){if(a.charCodeAt(0)!==64)continue;const m=i.media[a.slice(1)];if(!m)continue;const l="@media "+(m==="print"?`${m}`:`screen and ${m}`),u=s[a],w=u&&(u.value!==void 0?u.value:u);w!==void 0&&(n[l]=w)}return n}return i.verbose&&console.warn("Can't find color",r),r};
1
+ "use strict";var w=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var $=(r,i)=>{for(var o in i)w(r,o,{get:i[o],enumerable:!0})},x=(r,i,o,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of j(i))!A.call(r,t)&&t!==o&&w(r,t,{get:()=>i[t],enumerable:!(a=l(i,t))||a.enumerable});return r};var N=r=>x(w({},"__esModule",{value:!0}),r);var _={};$(_,{getShadow:()=>W,resolveShadowValue:()=>g,setShadow:()=>h});module.exports=N(_);var b=require("../factory.js"),c=require("./color.js"),O=require("./spacing.js"),f=require("../utils/color.js"),s=require("@symbo.ls/utils");const g=(r,i,o)=>!(0,s.isString)(r)||f.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,f.splitTopLevelCommas)(r).map(a=>(a=a.trim(),a.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const e=(0,c.quietColorProbe)(()=>(0,c.getColor)(t,i));if((0,f.isResolvedColor)(e))return e;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none"||f.COMPOUND_CSS_KEYWORDS.has(t.toLowerCase()))return t;o&&o(t);const d=(0,O.getSpacingByKey)(t,"shadow");return d&&d.shadow?d.shadow:t}).join(" "))).join(", "),h=(r,i,o,a)=>{const t=(0,b.getActiveConfig)();if((0,s.isObject)(r)&&r.value!==void 0&&r.var!==void 0)return t.useVariable&&(t.cssVars[r.var]=r.value),r;if((0,s.isArray)(r)){const n={"@light":h(r[0],i,"light"),"@dark":h(r[1],i,"dark")};return t.useVariable&&(0,c.setAdaptiveSchemeVar)(n,"shadow",i,t),n}if((0,s.isObject)(r)){const n={};for(const m in r)n[m]=h(r[m],i,m.startsWith("@")?m.slice(1):m);return t.useVariable&&(0,c.setAdaptiveSchemeVar)(n,"shadow",i,t),n}(0,s.isString)(r)&&!f.CSS_NATIVE_COLOR_REGEX.test(r)&&(r=g(r));const d=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${i}`+(o?`-${o}`:"");return t.useVariable&&(t.cssVars[d]=r),{var:d,value:r}},W=(r,i)=>{const o=(0,b.getActiveConfig)();if(i||(i=o.globalTheme==="auto"?null:o.globalTheme),!(0,s.isString)(r)){o.verbose&&console.warn(r,"- type for color is not valid");return}if((0,f.isCSSVar)(r))return`var(${r})`;const[a]=(0,s.isArray)(r)?r:r.split(" "),e=o.shadow[a],d=(0,s.isObject)(e);if(!e)return o.verbose&&console.warn("Can't find color ",a),r;if(d&&!e.value&&o.useVariable&&e.var)return`var(${e.var})`;if(i){const n=e["@"+i]||e[i];if(n)return n.value!==void 0?n.value:n;o.verbose&&console.warn(r," - does not have ",i)}if(d&&e.value)return e.value;if(d){const n={},m=(0,c.schemeGuardSelector)(o);for(const S in e){if(S.charCodeAt(0)!==64)continue;const u=S.slice(1),p=e[S],C=p&&(p.value!==void 0?p.value:p);if(C!==void 0&&(n[`[data-theme="${u}"] &`]=C,u==="light"||u==="dark")){const V=(0,c.schemeMediaQuery)(u,o);if(!V)continue;n[V]={[m]:C}}}return n}return o.verbose&&console.warn("Can't find color",r),r};
@@ -1 +1 @@
1
- "use strict";var R=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var Z=Object.prototype.hasOwnProperty;var F=(e,r)=>{for(var o in r)R(e,o,{get:r[o],enumerable:!0})},J=(e,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of W(r))!Z.call(e,n)&&n!==o&&R(e,n,{get:()=>r[n],enumerable:!(s=U(r,n))||s.enumerable});return e};var Q=e=>J(R({},"__esModule",{value:!0}),e);var ie={};F(ie,{getMediaTheme:()=>w,getTheme:()=>A,setMediaTheme:()=>E,setTheme:()=>ne});module.exports=Q(ie);var v=require("./color.js"),x=require("./shadow.js"),p=require("./border.js"),S=require("../factory.js"),y=require("../utils/color.js"),a=require("@symbo.ls/utils");const X=new Set(["black","white","red","green","blue","yellow","orange","purple","pink","brown","gray","grey","cyan","magenta","lime","olive","navy","teal","aqua","maroon","silver","fuchsia","transparent","currentColor","currentcolor","inherit","initial","unset","none","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple"]),q=["color","Color","background","Background","fill","Fill","stroke","Stroke"],Y=e=>{for(let r=0;r<q.length;r++)if(e.includes(q[r]))return!0;return!1},I={boxShadow:x.resolveShadowValue,textShadow:x.resolveShadowValue,border:p.resolveBorderValue,borderTop:p.resolveBorderValue,borderRight:p.resolveBorderValue,borderBottom:p.resolveBorderValue,borderLeft:p.resolveBorderValue,outline:p.resolveBorderValue,columnRule:p.resolveBorderValue},K=e=>{if(!e)return!1;const r=(0,y.parseColorToken)(e);return!r||!r.name||r.passthrough||r.cssVar?!1:r.alpha!==void 0||r.tone!==void 0},_=new Set,G=(e,r,o,s,n,i)=>{if(!(0,a.isLoudDevRuntime)())return;const t=`${e}::${r}::${o||""}::${s}`;_.has(t)||(_.add(t),console.warn(`[smbls/scratch] theme param "${r}" on "${e}"`+(o?` (${o})`:"")+` did not fully resolve: "${s}" -> "${n}" still contains the unresolved token "${i}". This is not valid CSS \u2014 the browser will drop the whole declaration. Register "${i}" as a design-system color token or fix the typo.`))},L=(e,r,o,s)=>{const n=I[r];if(!n)return(0,v.getColor)(o,s);let i=null;const t=n(o,s,u=>{!i&&K(u)&&(i=u)});return i&&G(e,r,s,o,t,i),t},V=e=>{const r={},{state:o,media:s,helpers:n,...i}=e;return Object.keys(i).map(u=>{const c=["color","Color","background","border"].some(d=>u.includes(d));return r[u]=c?(0,v.getColor)(e[u]):e[u]}),r},$=e=>(e.value||(e.value=V(e)),e.value),A=(e,r)=>{const o=(0,S.getActiveConfig)();if(o.useVariable)return w(e,r);const s=o.theme;if((0,a.isString)(e)){const[n,i]=e.split(" "),t=s[n];if(t){if(!i&&!r)return $(t);e=[n,i||r]}}if((0,a.isObjectLike)(e)&&e[1]){const n=e[0],i=e[1],{helpers:t,media:u,state:l}=s[n];if(u&&u[i])return $(u[i]);if(t&&t[i])return $(t[i]);if(l&&l[i])return $(l[i])}else if((0,a.isObject)(e))return V(e)},ee=(e,r,o)=>{if((0,a.isObject)(r))e.variants.inverse.value=V(r);else if(r===!0){const{color:s,background:n}=o;e.variants.inverse={value:{color:n,background:s}}}},re=(e,r,o,s)=>{const n=A(o);s[`&:${r}`]=n,(0,a.isObject)(o)&&!o.value&&(o.value=n)},N=(e,r)=>{const{state:o}=e;return o?(Object.keys(o).map(n=>{const i=o[n];return re(e,n,i,r),e}),e):void 0},oe=(e,r,o,s)=>{const n=A(o);s[`@media (prefers-color-scheme: ${r})`]=n,(0,a.isObject)(o)&&!o.value&&(o.value=n)},H=(e,r)=>{const{media:o}=e;return o?(Object.keys(o).map(n=>{const i=o[n];return(n==="dark"||n==="light")&&oe(e,n,i,r),n==="inverse"&&ee(e,i,r),e}),e):void 0},D=(e,r)=>{const o=(0,S.getActiveConfig)(),{helpers:s}=e;return s?(Object.keys(s).map(i=>{const t=s[i];return(0,a.isString)(t)?s[i]=o.theme[t]:$(s[i]),e}),e):void 0},ne=(e,r)=>{const o=(0,S.getActiveConfig)();if(o.useVariable)return E(e,r);const{state:s,media:n,helpers:i}=e,t=V(e,r),l=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}`;return N(e,t),H(e,t),D(e,t),{var:l,value:t,state:s,media:n,helpers:i}},le={"@":(e,r)=>H(e,r),":":(e,r)=>N(e,r),".":(e,r)=>D(e,r)},O=(e,r,o)=>{const{cssVars:s}=o;o.cssMediaVars||(o.cssMediaVars={});const n=o.cssMediaVars,i=o.globalTheme!==void 0?o.globalTheme:"auto",t={},u=new Set;for(const c in e)if(e[c])for(const d of Object.keys(e[c]))u.add(d);const l=new Set;for(const c of u){const d=c.slice(0,1);if(!(d==="@"||d==="."||d===":")&&Y(c))for(const m in e){if(l.has(m))continue;const h=e[m]?.[c];if(h===void 0)continue;const f=(0,v.getColor)(h,`@${m}`);f!==void 0&&(0,a.isString)(f)&&/^[a-z][a-zA-Z]+$/.test(f)&&!X.has(f)&&l.add(m)}}for(const c of u){const d=c.slice(0,1),m=Object.values(e).some(h=>(0,a.isObjectLike)(h?.[c]));if(d==="."&&m){const h=c.slice(1),f={};for(const b in e)(0,a.isObjectLike)(e[b]?.[c])&&(f[b]=e[b][c]);t[c]=O(f,`${r}-${h}`,o)}else if(d===":"&&m){const h=c.replace(/^:+/,""),f={};for(const b in e)(0,a.isObjectLike)(e[b]?.[c])&&(f[b]=e[b][c]);t[c]=O(f,`${r}-${h}`,o)}else if(d!=="@"&&d!=="."&&d!==":"){const f=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}-${c}`,b=i&&i!=="auto"?String(i).replace(/^'|'$/g,""):null;let k;for(const g in e){if(l.has(g))continue;const P=e[g]?.[c];if(P===void 0)continue;const T=L(r,c,P,`@${g}`);if(T===void 0)continue;(b&&g===b||!b&&(g==="light"||k===void 0))&&(k=T);const C=`[data-theme="${g}"]`;if(n[C]||(n[C]={}),n[C][f]=T,g==="dark"||g==="light"){const M=`@media (prefers-color-scheme: ${g})`;n[M]||(n[M]={}),n[M][f]=T}}k!==void 0&&(s[f]=k),t[c]=`var(${f})`,t[`.${c}`]={[c]:t[c]}}}return(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color}),t},E=(e,r,o,s)=>{const n=(0,S.getActiveConfig)(),{cssVars:i}=n,t={value:e},u=!o&&!s;if((0,a.isObjectLike)(e)){if(u&&n.useVariable){const l={};for(const c in e)c.startsWith("@")&&(0,a.isObjectLike)(e[c])&&(l[c.slice(1)]=e[c]);if(Object.keys(l).length){const c=O(l,r,n);Object.assign(t,c)}}for(const l in e){const c=l.slice(0,1),d=e[l];if(c==="@"||c===":"||c==="."){const m=c==="@"&&l;t[l]=E(d,r,l,s||m)}else if(!u){const m=L(r,l,d,s),h=[...new Set([s,o].filter(g=>g).map(g=>g.slice(1)))],f=h.length?"-"+h.join("-"):"",k=`--${n.varPrefix?n.varPrefix+"-":""}theme-${r}${f}-${l}`;n.useVariable?(n.useThemeSuffixedVars&&(i[k]=m),t[l]=`var(${k})`):t[l]=m,t[`.${l}`]={[l]:t[l]}}}!t[".inversed"]&&(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color})}if((0,a.isString)(e)&&(0,y.isCSSVar)(e)){const c=n.theme[e.slice(2)];return w(c,s)}return t},j=e=>{const r=(0,S.getActiveConfig)(),o={};for(const s in e){const n=s.slice(0,1);if((0,a.isObjectLike)(e[s])){if(n==="@")continue;n===":"?o[`&${s}`]=j(e[s]):n==="."&&(o[`&${s}`]=j(e[s]))}else o[s]=e[s]}return o},z=(e,r)=>{const o=r.shift();return e[o]?z(e[o],r):e},B=(e,r)=>(0,a.isArray)(r)?z(e,r):(0,a.isString)(r)&&e[r]?e[r]:e,te=(e,r)=>(0,a.isString)(e)&&(0,y.isCSSVar)(e)?w(e.slice(2)):e,se=e=>te(e,se),w=(e,r)=>{const o=(0,S.getActiveConfig)();if((0,a.isString)(e)&&(0,y.isCSSVar)(e)&&(e=w(e.slice(2))),!e||!(0,a.isString)(e)){o.verbose&&console.warn(`${e} - Theme is not a string`);return}const[s,...n]=(0,a.isArray)(e)?e:e.split(" ");let i=o.theme[s];return i&&n.length?i=B(i,n):i&&r&&(i=B(i,r)),j(i)};
1
+ "use strict";var j=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var Z=(e,o)=>{for(var r in o)j(e,r,{get:o[r],enumerable:!0})},J=(e,o,r,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of Q(o))!Y.call(e,i)&&i!==r&&j(e,i,{get:()=>o[i],enumerable:!(t=N(o,i))||t.enumerable});return e};var K=e=>J(j({},"__esModule",{value:!0}),e);var le={};Z(le,{getMediaTheme:()=>M,getTheme:()=>G,setMediaTheme:()=>O,setTheme:()=>ne});module.exports=K(le);var T=require("./color.js"),x=require("./shadow.js"),$=require("./border.js"),v=require("../factory.js"),V=require("../utils/color.js"),l=require("@symbo.ls/utils");const E=new Set(["black","white","red","green","blue","yellow","orange","purple","pink","brown","gray","grey","cyan","magenta","lime","olive","navy","teal","aqua","maroon","silver","fuchsia","transparent","currentColor","currentcolor","inherit","initial","unset","none","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple"]),L=["color","Color","background","Background","fill","Fill","stroke","Stroke"],q=e=>{for(let o=0;o<L.length;o++)if(e.includes(L[o]))return!0;return!1},X={boxShadow:x.resolveShadowValue,textShadow:x.resolveShadowValue,border:$.resolveBorderValue,borderTop:$.resolveBorderValue,borderRight:$.resolveBorderValue,borderBottom:$.resolveBorderValue,borderLeft:$.resolveBorderValue,outline:$.resolveBorderValue,columnRule:$.resolveBorderValue},F=e=>{if(!e)return!1;const o=(0,V.parseColorToken)(e);return!o||!o.name||o.passthrough||o.cssVar?!1:o.alpha!==void 0||o.tone!==void 0},P=new Set,I=(e,o,r,t,i,a)=>{if(!(0,l.isLoudDevRuntime)())return;const s=`${e}::${o}::${r||""}::${t}`;P.has(s)||(P.add(s),console.warn(`[smbls/scratch] theme param "${o}" on "${e}"`+(r?` (${r})`:"")+` did not fully resolve: "${t}" -> "${i}" still contains the unresolved token "${a}". This is not valid CSS \u2014 the browser will drop the whole declaration. Register "${a}" as a design-system color token or fix the typo.`))},C=(e,o,r,t)=>{const i=X[o];if(!i)return(0,T.getColor)(r,t);let a=null;const s=i(r,t,h=>{!a&&F(h)&&(a=h)});return a&&I(e,o,t,r,s,a),s},G=(e,o)=>M(e,o),ee=e=>(0,l.isObject)(e)&&(0,l.isObjectLike)(e.value),oe=e=>{for(const o in e){const r=e[o];if((0,l.isString)(r)&&r.startsWith("var(--"))return!0}return!1},ne=(e,o)=>{const r=(0,v.getActiveConfig)();return ee(e)?!r.useVariable&&oe(e)?e:O(e.value,o):O(e,o)},D=(e,o)=>{const r=new Set;for(const t of o){const i=t.slice(0,1);if(!(i==="@"||i==="."||i===":")&&q(t))for(const a in e){if(r.has(a))continue;const s=e[a]?.[t];if(s===void 0)continue;const h=(0,T.getColor)(s,`@${a}`);h!==void 0&&(0,l.isString)(h)&&/^[a-z][a-zA-Z]+$/.test(h)&&!E.has(h)&&r.add(a)}}return r},re=new Set(["none","inherit","initial","unset","revert","revert-layer"]),te=/^(?:#[0-9a-f]{3,8}$|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix)\()/i,ie=/gradient\(|url\(|image-set\(|var\(/i,W=e=>{if(!(0,l.isString)(e))return!1;const o=e.trim();return ie.test(o)?!1:te.test(o)?!0:E.has(o)&&!re.has(o)},se=e=>e.startsWith("[data-theme=")||e.startsWith("@media"),R=(e,o)=>{for(const r in o){const t=o[r];(0,l.isObject)(t)?R(e[r]||(e[r]={}),t):e[r]=t}return e},B=(e,o,r,t)=>{if(R(e,{[`[data-theme="${o}"] &`]:r}),o!=="light"&&o!=="dark")return;const i=(0,T.schemeMediaQuery)(o,t);i&&R(e,{[i]:{[(0,T.schemeGuardSelector)(t)]:r}})},U=(e,o,r,t)=>{const i=r.globalTheme!==void 0?r.globalTheme:"auto",a=i&&i!=="auto"?String(i).replace(/^'|'$/g,""):null,s=new Set(t?Object.keys(t):[]);for(const n in e)if(e[n])for(const c of Object.keys(e[n]))s.add(c);const h=D(e,s),g={};for(const n of s){const c=n.slice(0,1);if(c==="@")continue;if(c==="."||c===":"){const u={};for(const w in e)(0,l.isObjectLike)(e[w]?.[n])&&(u[w]=e[w][n]);const m=t&&(0,l.isObjectLike)(t[n])?t[n]:void 0;if(!Object.keys(u).length&&!m)continue;const b=c==="."?n.slice(1):n.replace(/^:+/,"");g[n]=U(u,`${o}-${b}`,r,m);continue}const k=t&&!(0,l.isObjectLike)(t[n])?t[n]:void 0,p=new Set(Object.keys(e));k!==void 0&&(p.add("light"),p.add("dark"),a&&p.add(a));const d={};let f;for(const u of p){if(h.has(u))continue;let m=e[u]?.[n];if((m===void 0||(0,l.isObjectLike)(m))&&(m=k),m===void 0)continue;const b=C(o,n,m,`@${u}`);b!==void 0&&(d[u]=b,(a&&u===a||!a&&(u==="light"||f===void 0))&&(f=b))}const y={},S=Object.keys(d).filter(u=>d[u]!==f);if(S.length){const u=d.light!==void 0?d.light:f,m=d.dark!==void 0?d.dark:f;if(q(n)&&W(u)&&W(m)){y[n]=u===m?u:`light-dark(${u}, ${m})`;for(const b in d)b==="light"||b==="dark"||B(y,b,{[n]:d[b]},r)}else{f!==void 0&&(y[n]=f);for(const b of S)B(y,b,{[n]:d[b]},r)}}else{if(f===void 0)continue;y[n]=f}R(g,y),g[`.${n}`]=y}return(g.background||g.color||g.backgroundColor)&&(g[".inversed"]={color:g.background||g.backgroundColor,background:g.color}),g},_=(e,o,r)=>{const{cssVars:t}=r;r.cssMediaVars||(r.cssMediaVars={});const i=r.cssMediaVars,a=r.globalTheme!==void 0?r.globalTheme:"auto",s={},h=new Set;for(const n in e)if(e[n])for(const c of Object.keys(e[n]))h.add(c);const g=D(e,h);for(const n of h){const c=n.slice(0,1),k=Object.values(e).some(p=>(0,l.isObjectLike)(p?.[n]));if(c==="."&&k){const p=n.slice(1),d={};for(const f in e)(0,l.isObjectLike)(e[f]?.[n])&&(d[f]=e[f][n]);s[n]=_(d,`${o}-${p}`,r)}else if(c===":"&&k){const p=n.replace(/^:+/,""),d={};for(const f in e)(0,l.isObjectLike)(e[f]?.[n])&&(d[f]=e[f][n]);s[n]=_(d,`${o}-${p}`,r)}else if(c!=="@"&&c!=="."&&c!==":"){const d=`--${r.varPrefix?r.varPrefix+"-":""}theme-${o}-${n}`,f=a&&a!=="auto"?String(a).replace(/^'|'$/g,""):null;let y;for(const S in e){if(g.has(S))continue;const u=e[S]?.[n];if(u===void 0)continue;const m=C(o,n,u,`@${S}`);if(m===void 0)continue;(f&&S===f||!f&&(S==="light"||y===void 0))&&(y=m);const b=`[data-theme="${S}"]`;if(i[b]||(i[b]={}),i[b][d]=m,S==="dark"||S==="light"){const w=`@media (prefers-color-scheme: ${S})`;i[w]||(i[w]={}),i[w][d]=m}}y!==void 0&&(t[d]=y),s[n]=`var(${d})`,s[`.${n}`]={[n]:s[n]}}}return(s.background||s.color||s.backgroundColor)&&(s[".inversed"]={color:s.background||s.backgroundColor,background:s.color}),s},O=(e,o,r,t)=>{const i=(0,v.getActiveConfig)(),{cssVars:a}=i,s={value:e},h=!r&&!t;let g;if((0,l.isObjectLike)(e)){if(h&&i.useVariable){const n={};for(const c in e)c.startsWith("@")&&(0,l.isObjectLike)(e[c])&&(n[c.slice(1)]=e[c]);if(Object.keys(n).length){const c=_(n,o,i);Object.assign(s,c)}}else if(h){const n={},c={};for(const k in e)k.startsWith("@")?(0,l.isObjectLike)(e[k])&&(n[k.slice(1)]=e[k]):c[k]=e[k];g=U(n,o,i,c),Object.assign(s,g)}for(const n in e){const c=n.slice(0,1),k=e[n];if(c==="@"||c===":"||c==="."){const p=c==="@"&&n;s[n]=O(k,o,n,t||p)}else if(!h){const p=C(o,n,k,t),d=[...new Set([t,r].filter(u=>u).map(u=>u.slice(1)))],f=d.length?"-"+d.join("-"):"",S=`--${i.varPrefix?i.varPrefix+"-":""}theme-${o}${f}-${n}`;i.useVariable?(i.useThemeSuffixedVars&&(a[S]=p),s[n]=`var(${S})`):s[n]=p,s[`.${n}`]={[n]:s[n]}}}if(g)for(const n in g){const c=n.slice(0,1);(c==="."||c===":")&&(0,l.isObjectLike)(e[n])&&(s[n]=g[n])}!s[".inversed"]&&(s.background||s.color||s.backgroundColor)&&(s[".inversed"]={color:s.background||s.backgroundColor,background:s.color})}if((0,l.isString)(e)&&(0,V.isCSSVar)(e)){const c=i.theme[e.slice(2)];return M(c,t)}return s},A=(e,o)=>{const r={};for(const t in e){const i=t.slice(0,1);if((0,l.isObjectLike)(e[t]))if(o&&se(t))r[t]=R({},e[t]);else{if(i==="@")continue;i===":"?r[`&${t}`]=A(e[t],o):i==="."&&(r[`&${t}`]=A(e[t],o))}else r[t]=e[t]}return r},z=(e,o)=>{const r=o.shift();return e[r]?z(e[r],o):e},H=(e,o)=>(0,l.isArray)(o)?z(e,o):(0,l.isString)(o)&&e[o]?e[o]:e,ce=(e,o)=>(0,l.isString)(e)&&(0,V.isCSSVar)(e)?M(e.slice(2)):e,ae=e=>ce(e,ae),M=(e,o)=>{const r=(0,v.getActiveConfig)();if((0,l.isString)(e)&&(0,V.isCSSVar)(e)&&(e=M(e.slice(2))),!e||!(0,l.isString)(e)){r.verbose&&console.warn(`${e} - Theme is not a string`);return}const[t,...i]=(0,l.isArray)(e)?e:e.split(" ");let a=r.theme[t];return a&&i.length?a=H(a,i):a&&o&&(a=H(a,o)),A(a,!r.useVariable)};
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var O=(r,t)=>{for(var n in t)m(r,n,{get:t[n],enumerable:!0})},R=(r,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of B(t))!C.call(r,e)&&e!==n&&m(r,e,{get:()=>t[e],enumerable:!(i=j(t,e))||i.enumerable});return r};var T=r=>R(m({},"__esModule",{value:!0}),r);var D={};O(D,{resolveColorsInGradient:()=>S,splitTransition:()=>W,transformBackgroundImage:()=>G,transformBorder:()=>z,transformBorderRadius:()=>b,transformBoxShadow:()=>E,transformDuration:()=>K,transformShadow:()=>A,transformSize:()=>h,transformSizeRatio:()=>_,transformTextStroke:()=>V,transformTransition:()=>g,transfromGap:()=>$});module.exports=T(D);var c=require("@symbo.ls/utils"),x=require("../factory.js"),s=require("../system/index.js"),o=require("../utils/index.js");const I=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),z=r=>(0,s.resolveBorderValue)(r),V=r=>o.CSS_NATIVE_COLOR_REGEX.test(r)?r:r.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if((0,o.isCSSVar)(t))return`var(${t})`;if(/^\d/.test(t)||t.includes("px")||t==="0")return t;const n=(0,s.getColor)(t);return(0,o.isResolvedColor)(n)?n:t}).join(" "),A=(r,t)=>(0,s.getShadow)(r,t),E=(r,t)=>o.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,o.splitTopLevelCommas)(r).map(n=>(n=n.trim(),n?n.split(/\s+/).map(i=>{if(i=i.trim(),!i)return"";if((0,o.isCSSVar)(i))return`var(${i})`;if(i==="inset"||i==="none")return i;const e=(0,s.getColor)(i);if((0,o.isResolvedColor)(e)){const a=(0,s.getMediaColor)(i,t);return(0,c.isObject)(a)?Object.values(a).filter(p=>p.includes(": "+t))[0]:a}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const u=(0,s.getSpacingByKey)(i,"shadow");return u&&u.shadow?u.shadow:i}).join(" "):"")).join(", "),S=(r,t)=>{const n=r.indexOf("(");if(n===-1)return r;const i=r.slice(0,n+1),e=r.slice(n+1,r.lastIndexOf(")")),u=")",p=(0,o.splitTopLevelCommas)(e).map(l=>(l=l.trim(),l.split(/\s+/).map(f=>{if(!f||/^\d/.test(f)||f==="0"||I.has(f)||f==="transparent"||o.CSS_NATIVE_COLOR_REGEX.test(f))return f;const d=(0,s.getColor)(f);return(0,o.isResolvedColor)(d)?d:f}).join(" ")));return i+p.join(", ")+u},G=(r,t)=>{const n=(0,x.getActiveConfig)();return(0,o.splitTopLevelCommas)(r).map(i=>{const e=i.trim();if((0,o.isCSSVar)(e))return`var(${e})`;if(/^var\(/.test(e)||e.includes("url"))return e;if(n.gradient?.[e]){const u=(0,s.getMediaColor)(e,t);if((0,c.isString)(u))return u;if((0,c.isObject)(u)){for(const a in u)if((0,c.isString)(u[a]))return u[a]}return e}return e.includes("gradient")?S(e,t):e.includes("/")||e.startsWith("http")||e.includes(".")&&!(0,o.parseColorToken)(e)?`url(${e})`:e}).join(", ")},$=r=>(0,c.isString)(r)&&r.split(" ").map(t=>(0,s.getSpacingByKey)(t,"gap").gap).join(" "),g=r=>{const t=r.split(" ");return t.length?t.map(n=>(0,o.isCSSVar)(n)?`var(${n})`:n.length<3||n.includes("ms")?(0,s.getTimingByKey)(n).timing||n:(0,s.getTimingFunction)(n)?(0,s.getTimingFunction)(n):n).join(" "):r},K=(r,t,n)=>{if((0,c.isString)(r))return r.split(",").map(i=>(0,s.getTimingByKey)(i).timing||i).join(",")},W=r=>{const t=r.split(",");if(t.length)return t.map(g).join(",")};function h(r,t,n={},i={}){let e=c.exec.call(this,t||n[r]);if(e==null)return;let u;if((0,c.isString)(e)){if(/^(?:env|var)\(/.test(e.trim()))return{[r]:e};if(e.includes("(")){const l=(0,o.getFnPrefixAndValue)(e);u=l[0],e=l[1]}const a=n.scaleBoxSize,p=(0,s.checkIfBoxSize)(r);!a&&p&&!i.ratio&&(e=(0,s.splitSpacedValue)(e))}return i.ratio?(0,s.getSpacingBasedOnRatio)(n,r,e,u):(0,s.getSpacingByKey)(e,r,void 0,u)}const _=(r,t=null,n)=>h(r,t,n,{ratio:!0}),b=(r,t,n,i="borderRadius")=>{if((0,c.isString)(r))return{[i]:r.split(" ").map(e=>{const u=(0,s.getShapeByKey)(e);return u!==void 0?u:(0,s.getSpacingBasedOnRatio)(t,n,e)[n]}).join(" ")}};
1
+ "use strict";var m=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var E=(r,t)=>{for(var n in t)m(r,n,{get:t[n],enumerable:!0})},R=(r,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of B(t))!C.call(r,e)&&e!==n&&m(r,e,{get:()=>t[e],enumerable:!(i=j(t,e))||i.enumerable});return r};var T=r=>R(m({},"__esModule",{value:!0}),r);var D={};E(D,{resolveColorsInGradient:()=>S,splitTransition:()=>L,transformBackgroundImage:()=>z,transformBorder:()=>G,transformBorderRadius:()=>q,transformBoxShadow:()=>_,transformDuration:()=>K,transformGridTemplate:()=>F,transformShadow:()=>V,transformSize:()=>h,transformSizeRatio:()=>W,transformTextStroke:()=>I,transformTransition:()=>g,transfromGap:()=>$});module.exports=T(D);var f=require("@symbo.ls/utils"),d=require("../factory.js"),s=require("../system/index.js"),o=require("../utils/index.js");const O=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),A=/^-?[A-Z][0-9]?$/,G=r=>(0,s.resolveBorderValue)(r),I=r=>{if((0,f.isString)(r))return o.CSS_NATIVE_COLOR_REGEX.test(r)?r:r.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if((0,o.isCSSVar)(t))return`var(${t})`;if(/^\d/.test(t)||t.includes("px")||t==="0")return t;const n=(0,s.getColor)(t);return(0,o.isResolvedColor)(n)?n:t}).join(" ")},V=(r,t)=>(0,s.getShadow)(r,t),_=(r,t)=>{if((0,f.isString)(r))return o.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,o.splitTopLevelCommas)(r).map(n=>(n=n.trim(),n?n.split(/\s+/).map(i=>{if(i=i.trim(),!i)return"";if((0,o.isCSSVar)(i))return`var(${i})`;if(i==="inset"||i==="none")return i;const e=(0,s.getColor)(i);if((0,o.isResolvedColor)(e)){const a=(0,s.getMediaColor)(i,t);return(0,f.isObject)(a)?Object.values(a).filter(p=>p.includes(": "+t))[0]:a}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const u=(0,s.getSpacingByKey)(i,"shadow");return u&&u.shadow?u.shadow:i}).join(" "):"")).join(", ")},S=(r,t)=>{const n=r.indexOf("(");if(n===-1)return r;const i=r.slice(0,n+1),e=r.slice(n+1,r.lastIndexOf(")")),u=")",p=(0,o.splitTopLevelCommas)(e).map(l=>(l=l.trim(),l.split(/\s+/).map(c=>{if(!c||/^\d/.test(c)||c==="0"||O.has(c)||c==="transparent"||o.CSS_NATIVE_COLOR_REGEX.test(c))return c;const x=(0,s.getColor)(c);return(0,o.isResolvedColor)(x)?x:c}).join(" ")));return i+p.join(", ")+u},z=(r,t)=>{if(!(0,f.isString)(r))return;const n=(0,d.getActiveConfig)();return(0,o.splitTopLevelCommas)(r).map(i=>{const e=i.trim();if((0,o.isCSSVar)(e))return`var(${e})`;if(/^var\(/.test(e)||e.includes("url"))return e;if(n.gradient?.[e]){const u=(0,s.getMediaColor)(e,t);if((0,f.isString)(u))return u;if((0,f.isObject)(u)){for(const a in u)if((0,f.isString)(u[a]))return u[a]}return e}return e.includes("gradient")?S(e,t):e.includes("/")||e.startsWith("http")||e.includes(".")&&!(0,o.parseColorToken)(e)?`url(${e})`:e}).join(", ")},$=r=>(0,f.isString)(r)&&r.split(" ").map(t=>(0,s.getSpacingByKey)(t,"gap").gap).join(" "),F=r=>{if(!(0,f.isString)(r))return r;const t=(0,d.getActiveConfig)();return(0,o.splitTopLevelSpaces)(r).map(n=>A.test(n)?(0,o.getSequenceValue)(n,t.spacing):n).join(" ")},g=r=>{if(!(0,f.isString)(r))return;const t=r.split(" ");return t.length?t.map(n=>(0,o.isCSSVar)(n)?`var(${n})`:n.length<3||n.includes("ms")?(0,s.getTimingByKey)(n).timing||n:(0,s.getTimingFunction)(n)?(0,s.getTimingFunction)(n):n).join(" "):r},K=(r,t,n)=>{if((0,f.isString)(r))return r.split(",").map(i=>(0,s.getTimingByKey)(i).timing||i).join(",")},L=r=>{if(!(0,f.isString)(r))return;const t=r.split(",");if(t.length)return t.map(g).join(",")};function h(r,t,n={},i={}){let e=f.exec.call(this,t||n[r]);if(e==null)return;let u;if((0,f.isString)(e)){if(/^(?:env|var)\(/.test(e.trim()))return{[r]:e};if(e.includes("(")){const l=(0,o.getFnPrefixAndValue)(e);u=l[0],e=l[1]}const a=n.scaleBoxSize,p=(0,s.checkIfBoxSize)(r);!a&&p&&!i.ratio&&(e=(0,s.splitSpacedValue)(e))}return i.ratio?(0,s.getSpacingBasedOnRatio)(n,r,e,u):(0,s.getSpacingByKey)(e,r,void 0,u)}const W=(r,t=null,n)=>h(r,t,n,{ratio:!0}),q=(r,t,n,i="borderRadius")=>{if((0,f.isString)(r))return{[i]:r.split(" ").map(e=>{const u=(0,s.getShapeByKey)(e);return u!==void 0?u:(0,s.getSpacingBasedOnRatio)(t,n,e)[n]}).join(" ")}};
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var E=(e,r)=>{for(var t in r)g(e,t,{get:r[t],enumerable:!0})},v=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of L(r))!q.call(e,a)&&a!==t&&g(e,a,{get:()=>r[a],enumerable:!(n=I(r,a))||n.enumerable});return e};var A=e=>v(g({},"__esModule",{value:!0}),e);var B={};E(B,{CSS_NAMED_COLOR_HEX:()=>m,CSS_NATIVE_COLOR_REGEX:()=>S,changeLightness:()=>z,colorStringToRgbaArray:()=>h,compositeOverBackdrop:()=>W,contrastRatio:()=>K,getColorShade:()=>M,getRgbTone:()=>Y,hexToRgb:()=>H,hexToRgbArray:()=>x,hexToRgba:()=>j,hslToRgb:()=>k,isCSSVar:()=>C,isResolvedColor:()=>D,linearChannelToSrgb:()=>O,mixTwoColors:()=>F,mixTwoRgb:()=>G,mixTwoRgba:()=>T,oklabToLinearSrgb:()=>_,oklabToOklch:()=>Q,oklchToGamutSafeSrgb:()=>U,oklchToOklab:()=>$,opacify:()=>P,parseColorToken:()=>X,relativeLuminance:()=>p,rgbArrayToHex:()=>y,rgbToHSL:()=>w,rgbToHex:()=>N,splitTopLevelCommas:()=>Z,srgbChannelToLinear:()=>R,srgbToOklab:()=>J,toLinearChannel:()=>u});module.exports=A(B);var s=require("@symbo.ls/utils");const m={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},h=e=>{if(e==="")return[0,0,0,0];if(e.toLowerCase()==="transparent")return[0,0,0,0];const r=m[e.toLowerCase()];if(r&&(e=r),e[0]==="#")return e.length<7&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(e.length>4?e[4]+e[4]:"")),[parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16),e.length>7?parseInt(e.substr(7,2),16)/255:1];if(e.indexOf("rgb")===-1&&s.document&&s.window){const t=s.document.body.appendChild(s.document.createElement("fictum")),n="rgb(1, 2, 3)";if(t.style.color=n,t.style.color!==n){s.document.body.removeChild(t);return}if(t.style.color=e,t.style.color===n||t.style.color==="")return s.document.body.removeChild(t),[0,0,0,0];e=s.window.getComputedStyle(t).color,s.document.body.removeChild(t)}return e.indexOf("rgb")===0?(e.indexOf("rgba")===-1&&(e=`${e}, 1`),e.match(/[\.\d]+/g).map(t=>+t)):[0,0,0,0]},F=(e,r,t=.5)=>(e=h(e),r=h(r),T(e,r,t)),H=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgb(${t},${n},${a})`},x=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return[t,n,a]},N=(e,r,t)=>"#"+(1<<24|e<<16|r<<8|t).toString(16).slice(1),y=([e,r,t])=>((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1),j=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgba(${t},${n},${a},${r})`},G=(e,r,t=.5)=>{const n=[];for(let a=0;a<3;a++)n[a]=~~(e[a]+(r[a]-e[a])*t);return`rgb(${n})`},z=(e,r)=>{const[t,n,a]=r,f=Math.max(0,Math.min(100,a+parseFloat(e)));return[t,n,f]},w=(e,r,t)=>{const n=Math.max(e,r,t),a=n-Math.min(e,r,t),f=1-Math.abs(n+n-a-1),o=a&&(n==e?(r-t)/a:n==r?2+(t-e)/a:4+(e-r)/a);return[60*(o<0?o+6:o),f?a/f:0,(n+n-a)/2]},k=(e,r,t,n=r*Math.min(t,1-t),a=(f,o=(f+e/30)%12)=>t-n*Math.max(Math.min(o-3,9-o,1),-1))=>[a(0),a(8),a(4)],M=(e,r)=>{const t=parseInt(e,16);let n=(t>>16)+r;n>255?n=255:n<0&&(n=0);let a=(t>>8&255)+r;a>255?a=255:a<0&&(a=0);let f=(t&255)+r;return f>255?f=255:f<0&&(f=0),((f|a<<8|n<<16)+16777216).toString(16).slice(1)},T=(e,r,t=.5)=>{const n=[];for(let a=0;a<4;a++){const f=a===3?o=>o:Math.round;n[a]=f(e[a]+(r[a]-e[a])*t)}return`rgba(${n})`},P=(e,r)=>{const t=h(e);if(!t){(0,s.isNotProduction)()&&console.warn(e+" color is not rgba");return}return t[3]=r,`rgba(${t})`},C=e=>e.charCodeAt(0)===45&&e.charCodeAt(1)===45,S=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,V=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,X=e=>{if(!(0,s.isString)(e))return null;if(S.test(e))return{passthrough:e};if(C(e))return{cssVar:e};const r=e.match(V);if(!r)return null;const[,t,n,a]=r,f=n!==void 0?`0.${n}`:void 0,o=a&&a[0]==="="?a.slice(1):a;return{name:t,alpha:f,tone:o}},D=e=>(0,s.isString)(e)&&(e.includes("rgb")||e.includes("var(")||e.includes("#")),Z=e=>{const r=[];let t="",n=0;for(const a of e){if(a==="("?n+=1:a===")"&&n>0&&(n-=1),a===","&&n===0){r.push(t),t="";continue}t+=a}return(t.length||!r.length)&&r.push(t),r},u=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),p=e=>.2126*u(e[0])+.7152*u(e[1])+.0722*u(e[2]),K=(e,r)=>{const t=p(e)+.05,n=p(r)+.05;return t>n?t/n:n/t},R=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),O=e=>(e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055)*255,J=([e,r,t])=>{const[n,a,f]=[e,r,t].map(R),o=.4122214708*n+.5363325363*a+.0514459929*f,i=.2119034982*n+.6806995451*a+.1073969566*f,c=.0883024619*n+.2817188376*a+.6299787005*f,d=Math.cbrt(o),l=Math.cbrt(i),b=Math.cbrt(c);return[.2104542553*d+.793617785*l-.0040720468*b,1.9779984951*d-2.428592205*l+.4505937099*b,.0259040371*d+.7827717662*l-.808675766*b]},_=([e,r,t])=>{const n=e+.3963377774*r+.2158037573*t,a=e-.1055613458*r-.0638541728*t,f=e-.0894841775*r-1.291485548*t,o=n**3,i=a**3,c=f**3;return[4.0767416621*o-3.3077115913*i+.2309699292*c,-1.2684380046*o+2.6097574011*i-.3413193965*c,-.0041960863*o-.7034186147*i+1.707614701*c]},Q=([e,r,t])=>{let n=Math.atan2(t,r)*180/Math.PI;return n<0&&(n+=360),[e,Math.sqrt(r*r+t*t),n]},$=([e,r,t])=>{const n=t*Math.PI/180;return[e,r*Math.cos(n),r*Math.sin(n)]},U=(e,r,t,n=24)=>{const a=i=>_($([e,i,t])),f=i=>i.every(c=>c>=-1e-4&&c<=1.0001);let o=a(r);if(!f(o)){let i=0,c=r;for(let d=0;d<n;d++){const l=(i+c)/2;f(a(l))?i=l:c=l}o=a(i)}return o.map(i=>O(Math.max(0,Math.min(1,i))))},W=(e,r=1,t=[255,255,255])=>r>=1?e:e.map((n,a)=>n*r+t[a]*(1-r)),Y=(e,r)=>{(0,s.isString)(e)&&e.includes("rgb")&&(e=h(e).join(", ")),(0,s.isString)(e)&&(e=e.split(",").map(a=>parseFloat(a.trim()))),(0,s.isNumber)(r)&&(r+="");const t=y(e),n=r.slice(0,1);if(n==="-"||n==="+"){const a=M(t,parseFloat(r));return x(a).join(", ")}else{const[a,f,o]=e,[i,c]=w(a/255,f/255,o/255),d=Math.max(0,Math.min(100,parseFloat(r)))/100;return k(i,c,d).map(b=>Math.round(Math.max(0,Math.min(1,b))*255)).join(", ")}};
1
+ "use strict";var g=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var E=(e,r)=>{for(var t in r)g(e,t,{get:r[t],enumerable:!0})},v=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of L(r))!q.call(e,n)&&n!==t&&g(e,n,{get:()=>r[n],enumerable:!(a=I(r,n))||a.enumerable});return e};var A=e=>v(g({},"__esModule",{value:!0}),e);var te={};E(te,{COMPOUND_CSS_KEYWORDS:()=>z,CSS_NAMED_COLOR_HEX:()=>m,CSS_NATIVE_COLOR_REGEX:()=>C,changeLightness:()=>G,colorStringToRgbaArray:()=>u,compositeOverBackdrop:()=>B,contrastRatio:()=>W,getColorShade:()=>M,getRgbTone:()=>ee,hexToRgb:()=>N,hexToRgbArray:()=>x,hexToRgba:()=>j,hslToRgb:()=>k,isCSSVar:()=>S,isResolvedColor:()=>K,linearChannelToSrgb:()=>O,mixTwoColors:()=>F,mixTwoRgb:()=>D,mixTwoRgba:()=>T,oklabToLinearSrgb:()=>_,oklabToOklch:()=>J,oklchToGamutSafeSrgb:()=>Q,oklchToOklab:()=>$,opacify:()=>P,parseColorToken:()=>X,relativeLuminance:()=>p,rgbArrayToHex:()=>y,rgbToHSL:()=>w,rgbToHex:()=>H,splitTopLevelCommas:()=>Z,splitTopLevelSpaces:()=>U,srgbChannelToLinear:()=>R,srgbToOklab:()=>Y,toLinearChannel:()=>b});module.exports=A(te);var s=require("@symbo.ls/utils");const m={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},u=e=>{if(e==="")return[0,0,0,0];if(e.toLowerCase()==="transparent")return[0,0,0,0];const r=m[e.toLowerCase()];if(r&&(e=r),e[0]==="#")return e.length<7&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(e.length>4?e[4]+e[4]:"")),[parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16),e.length>7?parseInt(e.substr(7,2),16)/255:1];if(e.indexOf("rgb")===-1&&s.document&&s.window){const t=s.document.body.appendChild(s.document.createElement("fictum")),a="rgb(1, 2, 3)";if(t.style.color=a,t.style.color!==a){s.document.body.removeChild(t);return}if(t.style.color=e,t.style.color===a||t.style.color==="")return s.document.body.removeChild(t),[0,0,0,0];e=s.window.getComputedStyle(t).color,s.document.body.removeChild(t)}return e.indexOf("rgb")===0?(e.indexOf("rgba")===-1&&(e=`${e}, 1`),e.match(/[\.\d]+/g).map(t=>+t)):[0,0,0,0]},F=(e,r,t=.5)=>(e=u(e),r=u(r),T(e,r,t)),N=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgb(${t},${a},${n})`},x=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return[t,a,n]},H=(e,r,t)=>"#"+(1<<24|e<<16|r<<8|t).toString(16).slice(1),y=([e,r,t])=>((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1),j=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgba(${t},${a},${n},${r})`},D=(e,r,t=.5)=>{const a=[];for(let n=0;n<3;n++)a[n]=~~(e[n]+(r[n]-e[n])*t);return`rgb(${a})`},G=(e,r)=>{const[t,a,n]=r,f=Math.max(0,Math.min(100,n+parseFloat(e)));return[t,a,f]},w=(e,r,t)=>{const a=Math.max(e,r,t),n=a-Math.min(e,r,t),f=1-Math.abs(a+a-n-1),o=n&&(a==e?(r-t)/n:a==r?2+(t-e)/n:4+(e-r)/n);return[60*(o<0?o+6:o),f?n/f:0,(a+a-n)/2]},k=(e,r,t,a=r*Math.min(t,1-t),n=(f,o=(f+e/30)%12)=>t-a*Math.max(Math.min(o-3,9-o,1),-1))=>[n(0),n(8),n(4)],M=(e,r)=>{const t=parseInt(e,16);let a=(t>>16)+r;a>255?a=255:a<0&&(a=0);let n=(t>>8&255)+r;n>255?n=255:n<0&&(n=0);let f=(t&255)+r;return f>255?f=255:f<0&&(f=0),((f|n<<8|a<<16)+16777216).toString(16).slice(1)},T=(e,r,t=.5)=>{const a=[];for(let n=0;n<4;n++){const f=n===3?o=>o:Math.round;a[n]=f(e[n]+(r[n]-e[n])*t)}return`rgba(${a})`},P=(e,r)=>{const t=u(e);if(!t){(0,s.isNotProduction)()&&console.warn(e+" color is not rgba");return}return t[3]=r,`rgba(${t})`},S=e=>e.charCodeAt(0)===45&&e.charCodeAt(1)===45,z=new Set(["currentcolor","transparent","thin","medium","thick"]),C=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,V=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,X=e=>{if(!(0,s.isString)(e))return null;if(C.test(e))return{passthrough:e};if(S(e))return{cssVar:e};const r=e.match(V);if(!r)return null;const[,t,a,n]=r,f=a!==void 0?`0.${a}`:void 0,o=n&&n[0]==="="?n.slice(1):n;return{name:t,alpha:f,tone:o}},K=e=>(0,s.isString)(e)&&(e.includes("rgb")||e.includes("var(")||e.includes("#")),Z=e=>{const r=[];let t="",a=0;for(const n of e){if(n==="("?a+=1:n===")"&&a>0&&(a-=1),n===","&&a===0){r.push(t),t="";continue}t+=n}return(t.length||!r.length)&&r.push(t),r},U=e=>{const r=[];let t="",a=0;for(const n of e){if(n==="("?a+=1:n===")"&&a>0&&(a-=1),a===0&&/\s/.test(n)){t.length&&r.push(t),t="";continue}t+=n}return t.length&&r.push(t),r},b=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),p=e=>.2126*b(e[0])+.7152*b(e[1])+.0722*b(e[2]),W=(e,r)=>{const t=p(e)+.05,a=p(r)+.05;return t>a?t/a:a/t},R=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),O=e=>(e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055)*255,Y=([e,r,t])=>{const[a,n,f]=[e,r,t].map(R),o=.4122214708*a+.5363325363*n+.0514459929*f,i=.2119034982*a+.6806995451*n+.1073969566*f,c=.0883024619*a+.2817188376*n+.6299787005*f,l=Math.cbrt(o),d=Math.cbrt(i),h=Math.cbrt(c);return[.2104542553*l+.793617785*d-.0040720468*h,1.9779984951*l-2.428592205*d+.4505937099*h,.0259040371*l+.7827717662*d-.808675766*h]},_=([e,r,t])=>{const a=e+.3963377774*r+.2158037573*t,n=e-.1055613458*r-.0638541728*t,f=e-.0894841775*r-1.291485548*t,o=a**3,i=n**3,c=f**3;return[4.0767416621*o-3.3077115913*i+.2309699292*c,-1.2684380046*o+2.6097574011*i-.3413193965*c,-.0041960863*o-.7034186147*i+1.707614701*c]},J=([e,r,t])=>{let a=Math.atan2(t,r)*180/Math.PI;return a<0&&(a+=360),[e,Math.sqrt(r*r+t*t),a]},$=([e,r,t])=>{const a=t*Math.PI/180;return[e,r*Math.cos(a),r*Math.sin(a)]},Q=(e,r,t,a=24)=>{const n=i=>_($([e,i,t])),f=i=>i.every(c=>c>=-1e-4&&c<=1.0001);let o=n(r);if(!f(o)){let i=0,c=r;for(let l=0;l<a;l++){const d=(i+c)/2;f(n(d))?i=d:c=d}o=n(i)}return o.map(i=>O(Math.max(0,Math.min(1,i))))},B=(e,r=1,t=[255,255,255])=>r>=1?e:e.map((a,n)=>a*r+t[n]*(1-r)),ee=(e,r)=>{(0,s.isString)(e)&&e.includes("rgb")&&(e=u(e).join(", ")),(0,s.isString)(e)&&(e=e.split(",").map(n=>parseFloat(n.trim()))),(0,s.isNumber)(r)&&(r+="");const t=y(e),a=r.slice(0,1);if(a==="-"||a==="+"){const n=M(t,parseFloat(r));return x(n).join(", ")}else{const[n,f,o]=e,[i,c]=w(n/255,f/255,o/255),l=Math.max(0,Math.min(100,parseFloat(r)))/100;return k(i,c,l).map(h=>Math.round(Math.max(0,Math.min(1,h))*255)).join(", ")}};
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var m=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0})},x=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of h(e))!v.call(t,n)&&n!==r&&p(t,n,{get:()=>e[n],enumerable:!(s=d(e,n))||s.enumerable});return t};var S=t=>x(p({},"__esModule",{value:!0}),t);var y={};m(y,{convertSvgToSymbol:()=>R,generateSprite:()=>b});module.exports=S(y);var l=require("@symbo.ls/utils"),w=require("../factory.js");const f=(0,l.isNotProduction)(),b=t=>{const e=(0,w.getActiveConfig)();let r="";for(const s in t)e.__svgCache[s]||(e.__svgCache[s]=!0,r+=t[s]);return r},_=t=>{const e=t&&(t.default||t);if(!(0,l.isString)(e))return f&&console.warn("parseRootAttributes:",e,"is not a string"),{};const r=e.match(/<svg\s+(.*?)>/);if(!r||!r[1])return{};const n=r[1].match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);return n?n.reduce((o,c)=>{const[a,g]=c.split("=");return o[a]=g.replace(/['"]/g,""),o},{}):{}},C=(t,e)=>{const r=[];if(t.replace(/id="([^"]*)"/g,(n,o)=>(r.push(o),n)),!r.length)return t;let s=t;for(const n of r){const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=`${e}-${n}`;s=s.replace(new RegExp(`id="${o}"`,"g"),`id="${c}"`).replace(new RegExp(`url\\(#${o}\\)`,"g"),`url(#${c})`).replace(new RegExp(`xlink:href="#${o}"`,"g"),`xlink:href="#${c}"`).replace(new RegExp(`href="#${o}"`,"g"),`href="#${c}"`)}return s},$=new Set,R=(t,e)=>{const r=e&&e.default?e.default:e;if(!(0,l.isString)(r))return f&&!$.has(t)&&($.add(t),console.warn("convertSvgToSymbol:",t,"is not a string")),"";e=r;const s=e.match(/^<symbol\b[^>]*\bid="([^"]*)"/);if(s){const u=s[1];return u===t?e:e.replace(`id="${u}"`,`id="${t}"`)}const n=_(e),{width:o,height:c}=n,a=n.viewBox||`0 0 ${o||24} ${c||24}`;let i=C(e,t).replace("<svg",`<symbol id="${t}" xmlns="http://www.w3.org/2000/svg" viewBox="${a}"`);return i=i.replace(/width="[^"]*"/,""),i=i.replace(/height="[^"]*"/,""),i=i.replace("</svg","</symbol"),i=I(i),i},A="line|circle|ellipse|rect|polyline|polygon|path|stop|use|image",E=new RegExp(`<(${A})\\b([^>]*?)\\s*/>`,"g"),I=t=>t.replace(E,"<$1$2></$1>");
1
+ "use strict";var g=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},x=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of h(e))!m.call(t,n)&&n!==r&&g(t,n,{get:()=>e[n],enumerable:!(s=d(e,n))||s.enumerable});return t};var S=t=>x(g({},"__esModule",{value:!0}),t);var I={};v(I,{convertSvgToSymbol:()=>R,generateSprite:()=>b});module.exports=S(I);var l=require("@symbo.ls/utils"),w=require("../factory.js");const f=(0,l.isNotProduction)(),b=t=>{const e=(0,w.getActiveConfig)();let r="";for(const s in t)e.__svgCache[s]||(e.__svgCache[s]=!0,r+=t[s]);return r},_=t=>{const e=t&&(t.default||t);if(!(0,l.isString)(e))return f&&console.warn("parseRootAttributes:",e,"is not a string"),{};const r=e.match(/<svg\s+(.*?)>/);if(!r||!r[1])return{};const n=r[1].match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);return n?n.reduce((o,i)=>{const[p,u]=i.split("=");return o[p]=u.replace(/['"]/g,""),o},{}):{}},C=(t,e)=>{const r=[];if(t.replace(/id="([^"]*)"/g,(n,o)=>(r.push(o),n)),!r.length)return t;let s=t;for(const n of r){const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=`${e}-${n}`;s=s.replace(new RegExp(`id="${o}"`,"g"),`id="${i}"`).replace(new RegExp(`url\\(#${o}\\)`,"g"),`url(#${i})`).replace(new RegExp(`xlink:href="#${o}"`,"g"),`xlink:href="#${i}"`).replace(new RegExp(`href="#${o}"`,"g"),`href="#${i}"`)}return s},$=new Set,R=(t,e)=>{const r=e&&e.default?e.default:e;if(!(0,l.isString)(r))return f&&!$.has(t)&&($.add(t),console.warn("convertSvgToSymbol:",t,"is not a string")),"";e=r;const s=e.match(/^<symbol\b[^>]*\bid="([^"]*)"/);if(s){const a=s[1];return a===t?e:e.replace(`id="${a}"`,`id="${t}"`)}const n=_(e),{width:o,height:i}=n,p=n.viewBox||`0 0 ${o||24} ${i||24}`;let c=C(e,t).replace("<svg",`<symbol id="${t}" xmlns="http://www.w3.org/2000/svg" viewBox="${p}"`);return c=c.replace(/^<symbol\b[^>]*>/,a=>a.replace(/\s(width|height)="[^"]*"/g,"")),c=c.replace("</svg","</symbol"),c=E(c),c},y="line|circle|ellipse|rect|polyline|polygon|path|stop|use|image",A=new RegExp(`<(${y})\\b([^>]*?)\\s*/>`,"g"),E=t=>t.replace(A,"<$1$2></$1>");
@@ -1 +1 @@
1
- import{getColor as d,quietColorProbe as f}from"./color.js";import{getSpacingByKey as l}from"./spacing.js";import{isResolvedColor as c,isCSSVar as m,CSS_NATIVE_COLOR_REGEX as a}from"../utils/color.js";const S=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),p=t=>S.has(t),R=(t,u,o)=>{if(t==null)return;const e=t+"";if(a.test(e))return e;const i=e.trim();return i==="none"||i==="0"||i==="initial"||i==="inherit"||i==="unset"?e:e.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if(m(r))return`var(${r})`;if(p(r)||/^\d/.test(r)||r==="0")return r;const s=f(()=>d(r,u));if(c(s))return s;o&&o(r);const n=l(r,"border");return n&&n.border?n.border:r}).join(" ")};export{R as resolveBorderValue};
1
+ import{getColor as d,quietColorProbe as f}from"./color.js";import{getSpacingByKey as l}from"./spacing.js";import{isResolvedColor as a,isCSSVar as S,CSS_NATIVE_COLOR_REGEX as c,COMPOUND_CSS_KEYWORDS as m}from"../utils/color.js";const C=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),p=t=>C.has(t),R=(t,u,n)=>{if(t==null)return;const e=t+"";if(c.test(e))return e;const i=e.trim();return i==="none"||i==="0"||i==="initial"||i==="inherit"||i==="unset"?e:e.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if(S(r))return`var(${r})`;if(p(r)||/^\d/.test(r)||r==="0")return r;const s=f(()=>d(r,u));if(a(s))return s;if(m.has(r.toLowerCase()))return r;n&&n(r);const o=l(r,"border");return o&&o.border?o.border:r}).join(" ")};export{R as resolveBorderValue};
@@ -1 +1 @@
1
- import{isObject as w,isArray as k,isString as b}from"@symbo.ls/utils";import{getActiveConfig as D}from"../factory.js";import{colorStringToRgbaArray as M,getRgbTone as A,isCSSVar as x,parseColorToken as C}from"../utils/index.js";const W={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},y=new Set,H=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),L=new Set,P=e=>{if(!e)return!1;const{color:n,gradient:s}=e;return!!(w(n)&&Object.keys(n).length||w(s)&&Object.keys(s).length)},O=new Set;let T=0;const Z=e=>{T++;try{return e()}finally{T--}},z=(e,n)=>{if(!b(e)||e.indexOf(" ")===-1)return null;const s=e.replace(/\s+/g,""),r=C(s);if(!r||r.passthrough||r.cssVar)return null;const{color:t,gradient:c}=n;return!t[r.name]&&!c[r.name]?null:s},_=(e,n,s)=>{const r=z(e,s);if(r){if(!O.has(e)){O.add(e);const a=s&&s.name?` (design system \`${s.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` has a space before its alpha/tone modifier${a} \u2014 did you mean \`${r}\`? The space form never resolves, so the atomic class it mints carries no CSS value and paints invisibly. Dropped rather than shipped invisible.`)}return}const t=C(e);if(t&&t.name&&!t.passthrough&&!t.cssVar&&(t.alpha!==void 0||t.tone!==void 0)&&P(s)&&!s.color[t.name]&&!s.gradient[t.name]){if(!T&&!L.has(e)){L.add(e);const a=s&&s.name?` (design system \`${s.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` does not resolve${a} \u2014 \`${t.name}\` is not in the palette. Dropped rather than emitted as a raw value, which is invalid CSS the browser discards silently. Define it in designSystem/color.js or use a palette token.`)}return}const c=b(n)?n.toLowerCase():"";if(!H.has(c)||!P(s))return e;if(!L.has(c)){L.add(c);const a=s&&s.name?` (design system \`${s.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${a}. Dropped rather than emitted as a raw browser colour, which renders theme-blind and can be unreadable ("looks designed", so it ships unnoticed). Define it in designSystem/color.js or use a palette token.`)}},R=(e,n,s)=>{const r=s||D();if(!b(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;n&&e[n]&&(e=e[n]);let t,c,a;if(k(e))[t,c,a]=e;else{const l=C(e);if(!l){const{color:u,gradient:V}=r;let m=V[e]||u[e];return m?(n&&m[n]&&(m=m[n]),r.useVariable?`var(${m.var})`:m.value):_(e,e,r)}if(l.passthrough)return l.passthrough;if(l.cssVar)return`var(${l.cssVar})`;t=l.name,c=l.alpha,a=l.tone}const{color:p,gradient:d}=r;let o=p[t]||d[t];if(!o)return _(e,t,r);if(n)if(o[n]!==void 0)o=o[n];else if(k(o)){const l=n.charCodeAt(0)===64?n.slice(1):n;l==="dark"?o=o[1]!==void 0?o[1]:o[0]:(l!=="light"&&r.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",n),o=o[0])}else r.verbose&&console.warn(e," - does not have ",n);if(b(o)){if(y.has(t))return o;y.add(t);try{return R(o,null,s)}finally{y.delete(t)}}let h=o.rgb;if(!h){const l=r.useVariable?`var(${o.var})`:o.value;if((c||a)&&l){const u=c!==void 0?c:1;if(!a)return`rgb(from ${l} r g b / ${u})`;if(a.charCodeAt(0)===43||a.charCodeAt(0)===45){const m=parseFloat(a),f=m<0?"-":"+",i=Math.abs(m);return`rgb(from ${l} calc(r ${f} ${i}) calc(g ${f} ${i}) calc(b ${f} ${i}) / ${u})`}return`hsl(from ${l} h s ${a}% / ${u})`}return l}return a&&!o[a]&&(h=A(h,a),o[a]={rgb:h,var:`${o.var}-${a}`}),o[a]&&(h=o[a].rgb),c?`rgba(${h}, ${c})`:a?`rgba(${h}, ${o.alpha!==void 0?o.alpha:1})`:r.useVariable?`var(${o.var})`:o.value!==void 0?o.value:`rgb(${h})`},j=e=>{const n=M(e);return!n||n.length<3||n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[n[0],n[1],n[2]],alpha:n[3]!==void 0?n[3]:1}},B=(e,n)=>{if(!n)return e;let s=e.rgb;if(n.tone){const t=A(s,n.tone);s=b(t)?t.split(",").map(c=>parseFloat(c.trim())):t}const r=n.alpha!==void 0?parseFloat(n.alpha):e.alpha;return{rgb:s,alpha:r}},K=(e,n,s)=>{const r=n||D();if(!b(e))return null;const t=C(e);if(t){if(t.passthrough){const u=M(t.passthrough);return u&&u.length>=3?{rgb:[u[0],u[1],u[2]],alpha:u[3]!==void 0?u[3]:1}:null}if(t.cssVar)return null}const c=t?t.name:e,{color:a,gradient:p}=r;let d=a[c]||p[c];if(!d)return j(e);if(b(d)){let u;if(y.has(c))u=j(d);else{y.add(c);try{u=K(d,r,s)}finally{y.delete(c)}}return u?B(u,t):null}if(d.rgb===void 0&&w(d)){const u=`@${s||"light"}`;d=d[u]!==void 0?d[u]:d["@light"]}if(!d||d.rgb===void 0)return null;let o=d.rgb;t&&t.tone&&(o=A(o,t.tone));const h=b(o)?o.split(",").map(u=>parseFloat(u.trim())):o,l=t&&t.alpha!==void 0?parseFloat(t.alpha):d.alpha!==void 0?d.alpha:1;return{rgb:h,alpha:l}},N=(e,n,s)=>{const r=s||D();if(n||(n=r.globalTheme==="auto"?null:r.globalTheme),!b(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;let t,c,a;if(k(e))t=e[0];else{const l=C(e);if(l){if(l.passthrough)return l.passthrough;if(l.cssVar)return`var(${l.cssVar})`;t=l.name,c=l.alpha,a=l.tone}else t=e}const{color:p,gradient:d}=r,o=p[t]||d[t],h=w(o);if(h&&o.value)return R(e,`@${n}`,s);if(h){if(r.useVariable&&o.var)return c||a?R(e,null,s):`var(${o.var})`;if(n)return R(e,`@${n}`,s);{const l={},u=r.scopeSelector||":root",V=u===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${u}:not([data-theme])`;for(const m in o){if(m.charCodeAt(0)!==64)continue;const f=m.slice(1),i=R(e,m,s);if(i!==void 0&&(l[`[data-theme="${f}"] &`]=i,f==="light"||f==="dark")){const g=r.media&&r.media[f]||W[f];if(!g)continue;const $="@media "+(g==="print"?`${g}`:`screen and ${g}`);l[$]={[`${V} &`]:i}}}return l}}else return _(e,t,r)},v=(e,n,s,r)=>{const c=`--${r.varPrefix?r.varPrefix+"-":""}${n}-${s}`;let a;const p={};for(const d in e){if(d.charCodeAt(0)!==64)continue;const o=d.slice(1),h=e[d],l=h&&(h.value||h);!l||typeof l!="string"||(p[o]=l,(o==="light"||a===void 0)&&(a=l))}if(a!==void 0){r.cssVars[c]=a,r.cssMediaVars||(r.cssMediaVars={});for(const d in p){const o=`[data-theme="${d}"]`;if(r.cssMediaVars[o]||(r.cssMediaVars[o]={}),r.cssMediaVars[o][c]=p[d],d==="light"||d==="dark"){const h=`@media (prefers-color-scheme: ${d})`;r.cssMediaVars[h]||(r.cssMediaVars[h]={}),r.cssMediaVars[h][c]=p[d]}}return e.var=c,c}},q=(e,n,s)=>{const r=D();if(w(e)&&e.value!==void 0&&(e.rgb!==void 0||e.var!==void 0))return r.useVariable&&e.var&&(r.cssVars[e.var]=e.value),e;if(b(e)&&x(e)){const f=e.slice(2);if(e=R(f),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const i=f.split(" ");let g=r.color[i[0]];if(g&&!g.value&&!g.rgb&&(b(g)||k(g)||w(g))&&!y.has(i[0])){y.add(i[0]);try{r.color[i[0]]=q(g,i[0])}finally{y.delete(i[0])}g=r.color[i[0]]}if(g&&g.value){let $=g.rgb;const E=i[1]!==void 0?i[1]:"1",S=i[2];S&&($=A($,S)),e=`rgba(${$}, ${E})`}else{const $=i[2],E=i[1]!==void 0?i[1]:"1";if($)try{const S=M(i[0]);S&&S.length>=3?e=`rgba(${A(S.slice(0,3).join(", "),$)}, ${E})`:e=i[0]}catch{e=i[0]}else e=i[0]}}}if(k(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),w(e)){const f={};for(const i in e)i!=="var"&&(f[i]=q(e[i],n,i.slice(0,1)==="@"?i.slice(1):i));return r.useVariable&&v(f,"color",n,r),f}const c=`--${r.varPrefix?r.varPrefix+"-":""}color-${n}`+(s?`-${s}`:"");let a=e.value||e;if(b(a)&&!a.includes("(")&&!a.startsWith("#")){const f=C(a);if(f&&f.name&&!f.passthrough&&!f.cssVar){const i=r.color[f.name];if(i&&!i.value&&!i.rgb&&(b(i)||k(i)||w(i))&&!y.has(f.name)){y.add(f.name);try{r.color[f.name]=q(i,f.name)}finally{y.delete(f.name)}}const g=r.color[f.name];if(g&&g.rgb){let $=g.rgb;f.tone&&($=A($,f.tone));const E=f.alpha!==void 0?parseFloat(f.alpha):g.alpha!==void 0?g.alpha:1;a=`rgba(${$}, ${E})`}}}const p=M(a),[d,o,h,l=1]=p,u=parseFloat(l.toFixed(2)),V=`${d}, ${o}, ${h}`,m=`rgba(${V}, ${u})`;return r.useVariable&&(r.cssVars[c]=m),{var:c,rgb:V,alpha:u,value:m}},Q=(e,n,s)=>{const r=D();if(w(e)&&e.value!==void 0&&e.var!==void 0)return r.useVariable&&(r.cssVars[e.var]=e.value),e;if(b(e)&&x(e)&&(e=R(e.slice(2))),k(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),w(e)){const a={};for(const p in e)p!=="var"&&(a[p]=Q(e[p],n,p.slice(0,1)==="@"?p.slice(1):p));return r.useVariable&&v(a,"gradient",n,r),a}const c=`--${r.varPrefix?r.varPrefix+"-":""}gradient-${n}`+(s?`-${s}`:"");return r.useVariable&&(r.cssVars[c]=e.value||e),{var:c,value:e.value||e}};export{W as STANDARD_SCHEME_QUERIES,R as getColor,N as getMediaColor,Z as quietColorProbe,K as resolveColorRgb,v as setAdaptiveSchemeVar,q as setColor,Q as setGradient};
1
+ import{isObject as w,isArray as k,isString as b}from"@symbo.ls/utils";import{getActiveConfig as M}from"../factory.js";import{colorStringToRgbaArray as D,getRgbTone as A,isCSSVar as x,parseColorToken as C}from"../utils/index.js";const W={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},H=(e,n)=>{const t=n.media&&n.media[e]||W[e];return t?"@media "+(t==="print"?`${t}`:`screen and ${t}`):null},Q=e=>{const n=e.scopeSelector||":root";return`${n===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${n}:not([data-theme])`} &`},$=new Set,z=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),L=new Set,P=e=>{if(!e)return!1;const{color:n,gradient:t}=e;return!!(w(n)&&Object.keys(n).length||w(t)&&Object.keys(t).length)},O=new Set;let T=0;const I=e=>{T++;try{return e()}finally{T--}},B=(e,n)=>{if(!b(e)||e.indexOf(" ")===-1)return null;const t=e.replace(/\s+/g,""),r=C(t);if(!r||r.passthrough||r.cssVar)return null;const{color:o,gradient:c}=n;return!o[r.name]&&!c[r.name]?null:t},_=(e,n,t)=>{const r=B(e,t);if(r){if(!O.has(e)){O.add(e);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` has a space before its alpha/tone modifier${a} \u2014 did you mean \`${r}\`? The space form never resolves, so the atomic class it mints carries no CSS value and paints invisibly. Dropped rather than shipped invisible.`)}return}const o=C(e);if(o&&o.name&&!o.passthrough&&!o.cssVar&&(o.alpha!==void 0||o.tone!==void 0)&&P(t)&&!t.color[o.name]&&!t.gradient[o.name]){if(!T&&!L.has(e)){L.add(e);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` does not resolve${a} \u2014 \`${o.name}\` is not in the palette. Dropped rather than emitted as a raw value, which is invalid CSS the browser discards silently. Define it in designSystem/color.js or use a palette token.`)}return}const c=b(n)?n.toLowerCase():"";if(!z.has(c)||!P(t))return e;if(!L.has(c)){L.add(c);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${a}. Dropped rather than emitted as a raw browser colour, which renders theme-blind and can be unreadable ("looks designed", so it ships unnoticed). Define it in designSystem/color.js or use a palette token.`)}},R=(e,n,t)=>{const r=t||M();if(!b(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;n&&e[n]&&(e=e[n]);let o,c,a;if(k(e))[o,c,a]=e;else{const i=C(e);if(!i){const{color:f,gradient:V}=r;let p=V[e]||f[e];return p?(n&&p[n]&&(p=p[n]),r.useVariable?`var(${p.var})`:p.value):_(e,e,r)}if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;o=i.name,c=i.alpha,a=i.tone}const{color:g,gradient:d}=r;let s=g[o]||d[o];if(!s)return _(e,o,r);if(n)if(s[n]!==void 0)s=s[n];else if(k(s)){const i=n.charCodeAt(0)===64?n.slice(1):n;i==="dark"?s=s[1]!==void 0?s[1]:s[0]:(i!=="light"&&r.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",n),s=s[0])}else r.verbose&&console.warn(e," - does not have ",n);if(b(s)){if($.has(o))return s;$.add(o);try{return R(s,null,t)}finally{$.delete(o)}}let h=s.rgb;if(!h){const i=r.useVariable?`var(${s.var})`:s.value;if((c||a)&&i){const f=c!==void 0?c:1;if(!a)return`rgb(from ${i} r g b / ${f})`;if(a.charCodeAt(0)===43||a.charCodeAt(0)===45){const p=parseFloat(a),u=p<0?"-":"+",l=Math.abs(p);return`rgb(from ${i} calc(r ${u} ${l}) calc(g ${u} ${l}) calc(b ${u} ${l}) / ${f})`}return`hsl(from ${i} h s ${a}% / ${f})`}return i}return a&&!s[a]&&(h=A(h,a),s[a]={rgb:h,var:`${s.var}-${a}`}),s[a]&&(h=s[a].rgb),c?`rgba(${h}, ${c})`:a?`rgba(${h}, ${s.alpha!==void 0?s.alpha:1})`:r.useVariable?`var(${s.var})`:s.value!==void 0?s.value:`rgb(${h})`},j=e=>{const n=D(e);return!n||n.length<3||n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[n[0],n[1],n[2]],alpha:n[3]!==void 0?n[3]:1}},K=(e,n)=>{if(!n)return e;let t=e.rgb;if(n.tone){const o=A(t,n.tone);t=b(o)?o.split(",").map(c=>parseFloat(c.trim())):o}const r=n.alpha!==void 0?parseFloat(n.alpha):e.alpha;return{rgb:t,alpha:r}},U=(e,n,t)=>{const r=n||M();if(!b(e))return null;const o=C(e);if(o){if(o.passthrough){const f=D(o.passthrough);return f&&f.length>=3?{rgb:[f[0],f[1],f[2]],alpha:f[3]!==void 0?f[3]:1}:null}if(o.cssVar)return null}const c=o?o.name:e,{color:a,gradient:g}=r;let d=a[c]||g[c];if(!d)return j(e);if(b(d)){let f;if($.has(c))f=j(d);else{$.add(c);try{f=U(d,r,t)}finally{$.delete(c)}}return f?K(f,o):null}if(d.rgb===void 0&&w(d)){const f=`@${t||"light"}`;d=d[f]!==void 0?d[f]:d["@light"]}if(!d||d.rgb===void 0)return null;let s=d.rgb;o&&o.tone&&(s=A(s,o.tone));const h=b(s)?s.split(",").map(f=>parseFloat(f.trim())):s,i=o&&o.alpha!==void 0?parseFloat(o.alpha):d.alpha!==void 0?d.alpha:1;return{rgb:h,alpha:i}},F=(e,n,t)=>{const r=t||M();if(n||(n=r.globalTheme==="auto"?null:r.globalTheme),!b(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;let o,c,a;if(k(e))o=e[0];else{const i=C(e);if(i){if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;o=i.name,c=i.alpha,a=i.tone}else o=e}const{color:g,gradient:d}=r,s=g[o]||d[o],h=w(s);if(h&&s.value)return R(e,`@${n}`,t);if(h){if(r.useVariable&&s.var)return c||a?R(e,null,t):`var(${s.var})`;if(n)return R(e,`@${n}`,t);{const i={},f=Q(r);for(const V in s){if(V.charCodeAt(0)!==64)continue;const p=V.slice(1),u=R(e,V,t);if(u!==void 0&&(i[`[data-theme="${p}"] &`]=u,p==="light"||p==="dark")){const l=H(p,r);if(!l)continue;i[l]={[f]:u}}}return i}}else return _(e,o,r)},v=(e,n,t,r)=>{const c=`--${r.varPrefix?r.varPrefix+"-":""}${n}-${t}`;let a;const g={};for(const d in e){if(d.charCodeAt(0)!==64)continue;const s=d.slice(1),h=e[d],i=h&&(h.value||h);!i||typeof i!="string"||(g[s]=i,(s==="light"||a===void 0)&&(a=i))}if(a!==void 0){r.cssVars[c]=a,r.cssMediaVars||(r.cssMediaVars={});for(const d in g){const s=`[data-theme="${d}"]`;if(r.cssMediaVars[s]||(r.cssMediaVars[s]={}),r.cssMediaVars[s][c]=g[d],d==="light"||d==="dark"){const h=`@media (prefers-color-scheme: ${d})`;r.cssMediaVars[h]||(r.cssMediaVars[h]={}),r.cssMediaVars[h][c]=g[d]}}return e.var=c,c}},q=(e,n,t)=>{const r=M();if(w(e)&&e.value!==void 0&&(e.rgb!==void 0||e.var!==void 0))return r.useVariable&&e.var&&(r.cssVars[e.var]=e.value),e;if(b(e)&&x(e)){const u=e.slice(2);if(e=R(u),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const l=u.split(" ");let m=r.color[l[0]];if(m&&!m.value&&!m.rgb&&(b(m)||k(m)||w(m))&&!$.has(l[0])){$.add(l[0]);try{r.color[l[0]]=q(m,l[0])}finally{$.delete(l[0])}m=r.color[l[0]]}if(m&&m.value){let y=m.rgb;const E=l[1]!==void 0?l[1]:"1",S=l[2];S&&(y=A(y,S)),e=`rgba(${y}, ${E})`}else{const y=l[2],E=l[1]!==void 0?l[1]:"1";if(y)try{const S=D(l[0]);S&&S.length>=3?e=`rgba(${A(S.slice(0,3).join(", "),y)}, ${E})`:e=l[0]}catch{e=l[0]}else e=l[0]}}}if(k(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),w(e)){const u={};for(const l in e)l!=="var"&&(u[l]=q(e[l],n,l.slice(0,1)==="@"?l.slice(1):l));return r.useVariable&&v(u,"color",n,r),u}const c=`--${r.varPrefix?r.varPrefix+"-":""}color-${n}`+(t?`-${t}`:"");let a=e.value||e;if(b(a)&&!a.includes("(")&&!a.startsWith("#")){const u=C(a);if(u&&u.name&&!u.passthrough&&!u.cssVar){const l=r.color[u.name];if(l&&!l.value&&!l.rgb&&(b(l)||k(l)||w(l))&&!$.has(u.name)){$.add(u.name);try{r.color[u.name]=q(l,u.name)}finally{$.delete(u.name)}}const m=r.color[u.name];if(m&&m.rgb){let y=m.rgb;u.tone&&(y=A(y,u.tone));const E=u.alpha!==void 0?parseFloat(u.alpha):m.alpha!==void 0?m.alpha:1;a=`rgba(${y}, ${E})`}}}const g=D(a),[d,s,h,i=1]=g,f=parseFloat(i.toFixed(2)),V=`${d}, ${s}, ${h}`,p=`rgba(${V}, ${f})`;return r.useVariable&&(r.cssVars[c]=p),{var:c,rgb:V,alpha:f,value:p}},J=(e,n,t)=>{const r=M();if(w(e)&&e.value!==void 0&&e.var!==void 0)return r.useVariable&&(r.cssVars[e.var]=e.value),e;if(b(e)&&x(e)&&(e=R(e.slice(2))),k(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),w(e)){const a={};for(const g in e)g!=="var"&&(a[g]=J(e[g],n,g.slice(0,1)==="@"?g.slice(1):g));return r.useVariable&&v(a,"gradient",n,r),a}const c=`--${r.varPrefix?r.varPrefix+"-":""}gradient-${n}`+(t?`-${t}`:"");return r.useVariable&&(r.cssVars[c]=e.value||e),{var:c,value:e.value||e}};export{W as STANDARD_SCHEME_QUERIES,R as getColor,F as getMediaColor,I as quietColorProbe,U as resolveColorRgb,Q as schemeGuardSelector,H as schemeMediaQuery,v as setAdaptiveSchemeVar,q as setColor,J as setGradient};
@@ -1 +1 @@
1
- import{getActiveConfig as C}from"../factory.js";import{getColor as l,quietColorProbe as O,setAdaptiveSchemeVar as S}from"./color.js";import{getSpacingByKey as g}from"./spacing.js";import{isResolvedColor as j,isCSSVar as A,splitTopLevelCommas as $,CSS_NATIVE_COLOR_REGEX as h}from"../utils/color.js";import{isObject as w,isString as p,isArray as b}from"@symbo.ls/utils";const x=(r,o,i)=>!p(r)||h.test(r)?r:$(r).map(f=>(f=f.trim(),f.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const s=O(()=>l(t,o));if(j(s))return s;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none")return t;i&&i(t);const e=g(t,"shadow");return e&&e.shadow?e.shadow:t}).join(" "))).join(", "),m=(r,o,i,f)=>{const t=C();if(b(r)){const n={"@light":m(r[0],o,"light"),"@dark":m(r[1],o,"dark")};return t.useVariable&&S(n,"shadow",o,t),n}if(w(r)){const n={};for(const c in r)n[c]=m(r[c],o,c.startsWith("@")?c.slice(1):c);return t.useVariable&&S(n,"shadow",o,t),n}p(r)&&!h.test(r)&&(r=x(r));const e=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[e]=r),{var:e,value:r}},P=(r,o)=>{const i=C();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!p(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if(A(r))return`var(${r})`;const[f]=b(r)?r:r.split(" "),s=i.shadow[f],e=w(s);if(!s)return i.verbose&&console.warn("Can't find color ",f),r;if(o){const n=s["@"+o]||s[o];if(n)return n.value!==void 0?n.value:n;i.verbose&&console.warn(r," - does not have ",o)}if(e&&s.value)return s.value;if(e){const n={};for(const c in s){if(c.charCodeAt(0)!==64)continue;const a=i.media[c.slice(1)];if(!a)continue;const V="@media "+(a==="print"?`${a}`:`screen and ${a}`),d=s[c],u=d&&(d.value!==void 0?d.value:d);u!==void 0&&(n[V]=u)}return n}return i.verbose&&console.warn("Can't find color",r),r};export{P as getShadow,x as resolveShadowValue,m as setShadow};
1
+ import{getActiveConfig as w}from"../factory.js";import{getColor as g,quietColorProbe as l,setAdaptiveSchemeVar as b,schemeMediaQuery as j,schemeGuardSelector as A}from"./color.js";import{getSpacingByKey as $}from"./spacing.js";import{isResolvedColor as x,isCSSVar as N,splitTopLevelCommas as W,CSS_NATIVE_COLOR_REGEX as V,COMPOUND_CSS_KEYWORDS as _}from"../utils/color.js";import{isObject as p,isString as h,isArray as O}from"@symbo.ls/utils";const D=(r,o,i)=>!h(r)||V.test(r)?r:W(r).map(c=>(c=c.trim(),c.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const e=l(()=>g(t,o));if(x(e))return e;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none"||_.has(t.toLowerCase()))return t;i&&i(t);const s=$(t,"shadow");return s&&s.shadow?s.shadow:t}).join(" "))).join(", "),S=(r,o,i,c)=>{const t=w();if(p(r)&&r.value!==void 0&&r.var!==void 0)return t.useVariable&&(t.cssVars[r.var]=r.value),r;if(O(r)){const n={"@light":S(r[0],o,"light"),"@dark":S(r[1],o,"dark")};return t.useVariable&&b(n,"shadow",o,t),n}if(p(r)){const n={};for(const f in r)n[f]=S(r[f],o,f.startsWith("@")?f.slice(1):f);return t.useVariable&&b(n,"shadow",o,t),n}h(r)&&!V.test(r)&&(r=D(r));const s=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[s]=r),{var:s,value:r}},L=(r,o)=>{const i=w();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!h(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if(N(r))return`var(${r})`;const[c]=O(r)?r:r.split(" "),e=i.shadow[c],s=p(e);if(!e)return i.verbose&&console.warn("Can't find color ",c),r;if(s&&!e.value&&i.useVariable&&e.var)return`var(${e.var})`;if(o){const n=e["@"+o]||e[o];if(n)return n.value!==void 0?n.value:n;i.verbose&&console.warn(r," - does not have ",o)}if(s&&e.value)return e.value;if(s){const n={},f=A(i);for(const m in e){if(m.charCodeAt(0)!==64)continue;const a=m.slice(1),d=e[m],u=d&&(d.value!==void 0?d.value:d);if(u!==void 0&&(n[`[data-theme="${a}"] &`]=u,a==="light"||a==="dark")){const C=j(a,i);if(!C)continue;n[C]={[f]:u}}}return n}return i.verbose&&console.warn("Can't find color",r),r};export{L as getShadow,D as resolveShadowValue,S as setShadow};
@@ -1 +1 @@
1
- import{getColor as R}from"./color.js";import{resolveShadowValue as E}from"./shadow.js";import{resolveBorderValue as k}from"./border.js";import{getActiveConfig as y}from"../factory.js";import{isCSSVar as O,parseColorToken as Z}from"../utils/color.js";import{isObject as T,isString as b,isObjectLike as S,isArray as P,isLoudDevRuntime as F}from"@symbo.ls/utils";const J=new Set(["black","white","red","green","blue","yellow","orange","purple","pink","brown","gray","grey","cyan","magenta","lime","olive","navy","teal","aqua","maroon","silver","fuchsia","transparent","currentColor","currentcolor","inherit","initial","unset","none","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple"]),q=["color","Color","background","Background","fill","Fill","stroke","Stroke"],Q=e=>{for(let r=0;r<q.length;r++)if(e.includes(q[r]))return!0;return!1},X={boxShadow:E,textShadow:E,border:k,borderTop:k,borderRight:k,borderBottom:k,borderLeft:k,outline:k,columnRule:k},Y=e=>{if(!e)return!1;const r=Z(e);return!r||!r.name||r.passthrough||r.cssVar?!1:r.alpha!==void 0||r.tone!==void 0},_=new Set,I=(e,r,o,s,n,i)=>{if(!F())return;const t=`${e}::${r}::${o||""}::${s}`;_.has(t)||(_.add(t),console.warn(`[smbls/scratch] theme param "${r}" on "${e}"`+(o?` (${o})`:"")+` did not fully resolve: "${s}" -> "${n}" still contains the unresolved token "${i}". This is not valid CSS \u2014 the browser will drop the whole declaration. Register "${i}" as a design-system color token or fix the typo.`))},L=(e,r,o,s)=>{const n=X[r];if(!n)return R(o,s);let i=null;const t=n(o,s,a=>{!i&&Y(a)&&(i=a)});return i&&I(e,r,s,o,t,i),t},V=e=>{const r={},{state:o,media:s,helpers:n,...i}=e;return Object.keys(i).map(a=>{const c=["color","Color","background","border"].some(u=>a.includes(u));return r[a]=c?R(e[a]):e[a]}),r},$=e=>(e.value||(e.value=V(e)),e.value),N=(e,r)=>{const o=y();if(o.useVariable)return v(e,r);const s=o.theme;if(b(e)){const[n,i]=e.split(" "),t=s[n];if(t){if(!i&&!r)return $(t);e=[n,i||r]}}if(S(e)&&e[1]){const n=e[0],i=e[1],{helpers:t,media:a,state:l}=s[n];if(a&&a[i])return $(a[i]);if(t&&t[i])return $(t[i]);if(l&&l[i])return $(l[i])}else if(T(e))return V(e)},K=(e,r,o)=>{if(T(r))e.variants.inverse.value=V(r);else if(r===!0){const{color:s,background:n}=o;e.variants.inverse={value:{color:n,background:s}}}},G=(e,r,o,s)=>{const n=N(o);s[`&:${r}`]=n,T(o)&&!o.value&&(o.value=n)},H=(e,r)=>{const{state:o}=e;return o?(Object.keys(o).map(n=>{const i=o[n];return G(e,n,i,r),e}),e):void 0},ee=(e,r,o,s)=>{const n=N(o);s[`@media (prefers-color-scheme: ${r})`]=n,T(o)&&!o.value&&(o.value=n)},D=(e,r)=>{const{media:o}=e;return o?(Object.keys(o).map(n=>{const i=o[n];return(n==="dark"||n==="light")&&ee(e,n,i,r),n==="inverse"&&K(e,i,r),e}),e):void 0},z=(e,r)=>{const o=y(),{helpers:s}=e;return s?(Object.keys(s).map(i=>{const t=s[i];return b(t)?s[i]=o.theme[t]:$(s[i]),e}),e):void 0},ae=(e,r)=>{const o=y();if(o.useVariable)return B(e,r);const{state:s,media:n,helpers:i}=e,t=V(e,r),l=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}`;return H(e,t),D(e,t),z(e,t),{var:l,value:t,state:s,media:n,helpers:i}},ue={"@":(e,r)=>D(e,r),":":(e,r)=>H(e,r),".":(e,r)=>z(e,r)},j=(e,r,o)=>{const{cssVars:s}=o;o.cssMediaVars||(o.cssMediaVars={});const n=o.cssMediaVars,i=o.globalTheme!==void 0?o.globalTheme:"auto",t={},a=new Set;for(const c in e)if(e[c])for(const u of Object.keys(e[c]))a.add(u);const l=new Set;for(const c of a){const u=c.slice(0,1);if(!(u==="@"||u==="."||u===":")&&Q(c))for(const g in e){if(l.has(g))continue;const m=e[g]?.[c];if(m===void 0)continue;const d=R(m,`@${g}`);d!==void 0&&b(d)&&/^[a-z][a-zA-Z]+$/.test(d)&&!J.has(d)&&l.add(g)}}for(const c of a){const u=c.slice(0,1),g=Object.values(e).some(m=>S(m?.[c]));if(u==="."&&g){const m=c.slice(1),d={};for(const h in e)S(e[h]?.[c])&&(d[h]=e[h][c]);t[c]=j(d,`${r}-${m}`,o)}else if(u===":"&&g){const m=c.replace(/^:+/,""),d={};for(const h in e)S(e[h]?.[c])&&(d[h]=e[h][c]);t[c]=j(d,`${r}-${m}`,o)}else if(u!=="@"&&u!=="."&&u!==":"){const d=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}-${c}`,h=i&&i!=="auto"?String(i).replace(/^'|'$/g,""):null;let p;for(const f in e){if(l.has(f))continue;const A=e[f]?.[c];if(A===void 0)continue;const w=L(r,c,A,`@${f}`);if(w===void 0)continue;(h&&f===h||!h&&(f==="light"||p===void 0))&&(p=w);const C=`[data-theme="${f}"]`;if(n[C]||(n[C]={}),n[C][d]=w,f==="dark"||f==="light"){const M=`@media (prefers-color-scheme: ${f})`;n[M]||(n[M]={}),n[M][d]=w}}p!==void 0&&(s[d]=p),t[c]=`var(${d})`,t[`.${c}`]={[c]:t[c]}}}return(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color}),t},B=(e,r,o,s)=>{const n=y(),{cssVars:i}=n,t={value:e},a=!o&&!s;if(S(e)){if(a&&n.useVariable){const l={};for(const c in e)c.startsWith("@")&&S(e[c])&&(l[c.slice(1)]=e[c]);if(Object.keys(l).length){const c=j(l,r,n);Object.assign(t,c)}}for(const l in e){const c=l.slice(0,1),u=e[l];if(c==="@"||c===":"||c==="."){const g=c==="@"&&l;t[l]=B(u,r,l,s||g)}else if(!a){const g=L(r,l,u,s),m=[...new Set([s,o].filter(f=>f).map(f=>f.slice(1)))],d=m.length?"-"+m.join("-"):"",p=`--${n.varPrefix?n.varPrefix+"-":""}theme-${r}${d}-${l}`;n.useVariable?(n.useThemeSuffixedVars&&(i[p]=g),t[l]=`var(${p})`):t[l]=g,t[`.${l}`]={[l]:t[l]}}}!t[".inversed"]&&(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color})}if(b(e)&&O(e)){const c=n.theme[e.slice(2)];return v(c,s)}return t},x=e=>{const r=y(),o={};for(const s in e){const n=s.slice(0,1);if(S(e[s])){if(n==="@")continue;n===":"?o[`&${s}`]=x(e[s]):n==="."&&(o[`&${s}`]=x(e[s]))}else o[s]=e[s]}return o},U=(e,r)=>{const o=r.shift();return e[o]?U(e[o],r):e},W=(e,r)=>P(r)?U(e,r):b(r)&&e[r]?e[r]:e,re=(e,r)=>b(e)&&O(e)?v(e.slice(2)):e,oe=e=>re(e,oe),v=(e,r)=>{const o=y();if(b(e)&&O(e)&&(e=v(e.slice(2))),!e||!b(e)){o.verbose&&console.warn(`${e} - Theme is not a string`);return}const[s,...n]=P(e)?e:e.split(" ");let i=o.theme[s];return i&&n.length?i=W(i,n):i&&r&&(i=W(i,r)),x(i)};export{v as getMediaTheme,N as getTheme,B as setMediaTheme,ae as setTheme};
1
+ import{getColor as A,schemeMediaQuery as Y,schemeGuardSelector as Z}from"./color.js";import{resolveShadowValue as x}from"./shadow.js";import{resolveBorderValue as T}from"./border.js";import{getActiveConfig as M}from"../factory.js";import{isCSSVar as v,parseColorToken as J}from"../utils/color.js";import{isObject as E,isString as $,isObjectLike as y,isArray as L,isLoudDevRuntime as K}from"@symbo.ls/utils";const q=new Set(["black","white","red","green","blue","yellow","orange","purple","pink","brown","gray","grey","cyan","magenta","lime","olive","navy","teal","aqua","maroon","silver","fuchsia","transparent","currentColor","currentcolor","inherit","initial","unset","none","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple"]),P=["color","Color","background","Background","fill","Fill","stroke","Stroke"],D=e=>{for(let o=0;o<P.length;o++)if(e.includes(P[o]))return!0;return!1},X={boxShadow:x,textShadow:x,border:T,borderTop:T,borderRight:T,borderBottom:T,borderLeft:T,outline:T,columnRule:T},F=e=>{if(!e)return!1;const o=J(e);return!o||!o.name||o.passthrough||o.cssVar?!1:o.alpha!==void 0||o.tone!==void 0},W=new Set,I=(e,o,r,t,s,a)=>{if(!K())return;const i=`${e}::${o}::${r||""}::${t}`;W.has(i)||(W.add(i),console.warn(`[smbls/scratch] theme param "${o}" on "${e}"`+(r?` (${r})`:"")+` did not fully resolve: "${t}" -> "${s}" still contains the unresolved token "${a}". This is not valid CSS \u2014 the browser will drop the whole declaration. Register "${a}" as a design-system color token or fix the typo.`))},O=(e,o,r,t)=>{const s=X[o];if(!s)return A(r,t);let a=null;const i=s(r,t,g=>{!a&&F(g)&&(a=g)});return a&&I(e,o,t,r,i,a),i},ge=(e,o)=>R(e,o),G=e=>E(e)&&y(e.value),ee=e=>{for(const o in e){const r=e[o];if($(r)&&r.startsWith("var(--"))return!0}return!1},he=(e,o)=>{const r=M();return G(e)?!r.useVariable&&ee(e)?e:C(e.value,o):C(e,o)},B=(e,o)=>{const r=new Set;for(const t of o){const s=t.slice(0,1);if(!(s==="@"||s==="."||s===":")&&D(t))for(const a in e){if(r.has(a))continue;const i=e[a]?.[t];if(i===void 0)continue;const g=A(i,`@${a}`);g!==void 0&&$(g)&&/^[a-z][a-zA-Z]+$/.test(g)&&!q.has(g)&&r.add(a)}}return r},oe=new Set(["none","inherit","initial","unset","revert","revert-layer"]),ne=/^(?:#[0-9a-f]{3,8}$|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix)\()/i,re=/gradient\(|url\(|image-set\(|var\(/i,U=e=>{if(!$(e))return!1;const o=e.trim();return re.test(o)?!1:ne.test(o)?!0:q.has(o)&&!oe.has(o)},te=e=>e.startsWith("[data-theme=")||e.startsWith("@media"),V=(e,o)=>{for(const r in o){const t=o[r];E(t)?V(e[r]||(e[r]={}),t):e[r]=t}return e},z=(e,o,r,t)=>{if(V(e,{[`[data-theme="${o}"] &`]:r}),o!=="light"&&o!=="dark")return;const s=Y(o,t);s&&V(e,{[s]:{[Z(t)]:r}})},H=(e,o,r,t)=>{const s=r.globalTheme!==void 0?r.globalTheme:"auto",a=s&&s!=="auto"?String(s).replace(/^'|'$/g,""):null,i=new Set(t?Object.keys(t):[]);for(const n in e)if(e[n])for(const c of Object.keys(e[n]))i.add(c);const g=B(e,i),f={};for(const n of i){const c=n.slice(0,1);if(c==="@")continue;if(c==="."||c===":"){const d={};for(const w in e)y(e[w]?.[n])&&(d[w]=e[w][n]);const h=t&&y(t[n])?t[n]:void 0;if(!Object.keys(d).length&&!h)continue;const m=c==="."?n.slice(1):n.replace(/^:+/,"");f[n]=H(d,`${o}-${m}`,r,h);continue}const b=t&&!y(t[n])?t[n]:void 0,k=new Set(Object.keys(e));b!==void 0&&(k.add("light"),k.add("dark"),a&&k.add(a));const l={};let u;for(const d of k){if(g.has(d))continue;let h=e[d]?.[n];if((h===void 0||y(h))&&(h=b),h===void 0)continue;const m=O(o,n,h,`@${d}`);m!==void 0&&(l[d]=m,(a&&d===a||!a&&(d==="light"||u===void 0))&&(u=m))}const S={},p=Object.keys(l).filter(d=>l[d]!==u);if(p.length){const d=l.light!==void 0?l.light:u,h=l.dark!==void 0?l.dark:u;if(D(n)&&U(d)&&U(h)){S[n]=d===h?d:`light-dark(${d}, ${h})`;for(const m in l)m==="light"||m==="dark"||z(S,m,{[n]:l[m]},r)}else{u!==void 0&&(S[n]=u);for(const m of p)z(S,m,{[n]:l[m]},r)}}else{if(u===void 0)continue;S[n]=u}V(f,S),f[`.${n}`]=S}return(f.background||f.color||f.backgroundColor)&&(f[".inversed"]={color:f.background||f.backgroundColor,background:f.color}),f},j=(e,o,r)=>{const{cssVars:t}=r;r.cssMediaVars||(r.cssMediaVars={});const s=r.cssMediaVars,a=r.globalTheme!==void 0?r.globalTheme:"auto",i={},g=new Set;for(const n in e)if(e[n])for(const c of Object.keys(e[n]))g.add(c);const f=B(e,g);for(const n of g){const c=n.slice(0,1),b=Object.values(e).some(k=>y(k?.[n]));if(c==="."&&b){const k=n.slice(1),l={};for(const u in e)y(e[u]?.[n])&&(l[u]=e[u][n]);i[n]=j(l,`${o}-${k}`,r)}else if(c===":"&&b){const k=n.replace(/^:+/,""),l={};for(const u in e)y(e[u]?.[n])&&(l[u]=e[u][n]);i[n]=j(l,`${o}-${k}`,r)}else if(c!=="@"&&c!=="."&&c!==":"){const l=`--${r.varPrefix?r.varPrefix+"-":""}theme-${o}-${n}`,u=a&&a!=="auto"?String(a).replace(/^'|'$/g,""):null;let S;for(const p in e){if(f.has(p))continue;const d=e[p]?.[n];if(d===void 0)continue;const h=O(o,n,d,`@${p}`);if(h===void 0)continue;(u&&p===u||!u&&(p==="light"||S===void 0))&&(S=h);const m=`[data-theme="${p}"]`;if(s[m]||(s[m]={}),s[m][l]=h,p==="dark"||p==="light"){const w=`@media (prefers-color-scheme: ${p})`;s[w]||(s[w]={}),s[w][l]=h}}S!==void 0&&(t[l]=S),i[n]=`var(${l})`,i[`.${n}`]={[n]:i[n]}}}return(i.background||i.color||i.backgroundColor)&&(i[".inversed"]={color:i.background||i.backgroundColor,background:i.color}),i},C=(e,o,r,t)=>{const s=M(),{cssVars:a}=s,i={value:e},g=!r&&!t;let f;if(y(e)){if(g&&s.useVariable){const n={};for(const c in e)c.startsWith("@")&&y(e[c])&&(n[c.slice(1)]=e[c]);if(Object.keys(n).length){const c=j(n,o,s);Object.assign(i,c)}}else if(g){const n={},c={};for(const b in e)b.startsWith("@")?y(e[b])&&(n[b.slice(1)]=e[b]):c[b]=e[b];f=H(n,o,s,c),Object.assign(i,f)}for(const n in e){const c=n.slice(0,1),b=e[n];if(c==="@"||c===":"||c==="."){const k=c==="@"&&n;i[n]=C(b,o,n,t||k)}else if(!g){const k=O(o,n,b,t),l=[...new Set([t,r].filter(d=>d).map(d=>d.slice(1)))],u=l.length?"-"+l.join("-"):"",p=`--${s.varPrefix?s.varPrefix+"-":""}theme-${o}${u}-${n}`;s.useVariable?(s.useThemeSuffixedVars&&(a[p]=k),i[n]=`var(${p})`):i[n]=k,i[`.${n}`]={[n]:i[n]}}}if(f)for(const n in f){const c=n.slice(0,1);(c==="."||c===":")&&y(e[n])&&(i[n]=f[n])}!i[".inversed"]&&(i.background||i.color||i.backgroundColor)&&(i[".inversed"]={color:i.background||i.backgroundColor,background:i.color})}if($(e)&&v(e)){const c=s.theme[e.slice(2)];return R(c,t)}return i},_=(e,o)=>{const r={};for(const t in e){const s=t.slice(0,1);if(y(e[t]))if(o&&te(t))r[t]=V({},e[t]);else{if(s==="@")continue;s===":"?r[`&${t}`]=_(e[t],o):s==="."&&(r[`&${t}`]=_(e[t],o))}else r[t]=e[t]}return r},N=(e,o)=>{const r=o.shift();return e[r]?N(e[r],o):e},Q=(e,o)=>L(o)?N(e,o):$(o)&&e[o]?e[o]:e,ie=(e,o)=>$(e)&&v(e)?R(e.slice(2)):e,se=e=>ie(e,se),R=(e,o)=>{const r=M();if($(e)&&v(e)&&(e=R(e.slice(2))),!e||!$(e)){r.verbose&&console.warn(`${e} - Theme is not a string`);return}const[t,...s]=L(e)?e:e.split(" ");let a=r.theme[t];return a&&s.length?a=Q(a,s):a&&o&&(a=Q(a,o)),_(a,!r.useVariable)};export{R as getMediaTheme,ge as getTheme,C as setMediaTheme,he as setTheme};
@@ -1 +1 @@
1
- import{isString as c,isObject as h,exec as R}from"@symbo.ls/utils";import{getActiveConfig as T}from"../factory.js";import{getSpacingByKey as p,getColor as m,getShadow as I,getShapeByKey as z,getMediaColor as j,getTimingByKey as B,getTimingFunction as C,getSpacingBasedOnRatio as O,checkIfBoxSize as V,splitSpacedValue as A,resolveBorderValue as E}from"../system/index.js";import{getFnPrefixAndValue as G,isResolvedColor as d,isCSSVar as l,CSS_NATIVE_COLOR_REGEX as x,splitTopLevelCommas as S,parseColorToken as $}from"../utils/index.js";const K=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),L=r=>E(r),P=r=>x.test(r)?r:r.split(/\s+/).map(e=>{if(e=e.trim(),!e)return"";if(l(e))return`var(${e})`;if(/^\d/.test(e)||e.includes("px")||e==="0")return e;const n=m(e);return d(n)?n:e}).join(" "),M=(r,e)=>I(r,e),X=(r,e)=>x.test(r)?r:S(r).map(n=>(n=n.trim(),n?n.split(/\s+/).map(i=>{if(i=i.trim(),!i)return"";if(l(i))return`var(${i})`;if(i==="inset"||i==="none")return i;const t=m(i);if(d(t)){const u=j(i,e);return h(u)?Object.values(u).filter(a=>a.includes(": "+e))[0]:u}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const s=p(i,"shadow");return s&&s.shadow?s.shadow:i}).join(" "):"")).join(", "),W=(r,e)=>{const n=r.indexOf("(");if(n===-1)return r;const i=r.slice(0,n+1),t=r.slice(n+1,r.lastIndexOf(")")),s=")",a=S(t).map(f=>(f=f.trim(),f.split(/\s+/).map(o=>{if(!o||/^\d/.test(o)||o==="0"||K.has(o)||o==="transparent"||x.test(o))return o;const g=m(o);return d(g)?g:o}).join(" ")));return i+a.join(", ")+s},Y=(r,e)=>{const n=T();return S(r).map(i=>{const t=i.trim();if(l(t))return`var(${t})`;if(/^var\(/.test(t)||t.includes("url"))return t;if(n.gradient?.[t]){const s=j(t,e);if(c(s))return s;if(h(s)){for(const u in s)if(c(s[u]))return s[u]}return t}return t.includes("gradient")?W(t,e):t.includes("/")||t.startsWith("http")||t.includes(".")&&!$(t)?`url(${t})`:t}).join(", ")},H=r=>c(r)&&r.split(" ").map(e=>p(e,"gap").gap).join(" "),_=r=>{const e=r.split(" ");return e.length?e.map(n=>l(n)?`var(${n})`:n.length<3||n.includes("ms")?B(n).timing||n:C(n)?C(n):n).join(" "):r},J=(r,e,n)=>{if(c(r))return r.split(",").map(i=>B(i).timing||i).join(",")},Q=r=>{const e=r.split(",");if(e.length)return e.map(_).join(",")};function b(r,e,n={},i={}){let t=R.call(this,e||n[r]);if(t==null)return;let s;if(c(t)){if(/^(?:env|var)\(/.test(t.trim()))return{[r]:t};if(t.includes("(")){const f=G(t);s=f[0],t=f[1]}const u=n.scaleBoxSize,a=V(r);!u&&a&&!i.ratio&&(t=A(t))}return i.ratio?O(n,r,t,s):p(t,r,void 0,s)}const U=(r,e=null,n)=>b(r,e,n,{ratio:!0}),Z=(r,e,n,i="borderRadius")=>{if(c(r))return{[i]:r.split(" ").map(t=>{const s=z(t);return s!==void 0?s:O(e,n,t)[n]}).join(" ")}};export{W as resolveColorsInGradient,Q as splitTransition,Y as transformBackgroundImage,L as transformBorder,Z as transformBorderRadius,X as transformBoxShadow,J as transformDuration,M as transformShadow,b as transformSize,U as transformSizeRatio,P as transformTextStroke,_ as transformTransition,H as transfromGap};
1
+ import{isString as u,isObject as h,exec as T}from"@symbo.ls/utils";import{getActiveConfig as j}from"../factory.js";import{getSpacingByKey as p,getColor as m,getShadow as O,getShapeByKey as A,getMediaColor as B,getTimingByKey as C,getTimingFunction as E,getSpacingBasedOnRatio as R,checkIfBoxSize as G,splitSpacedValue as I,resolveBorderValue as V}from"../system/index.js";import{getFnPrefixAndValue as _,isResolvedColor as d,isCSSVar as l,CSS_NATIVE_COLOR_REGEX as x,splitTopLevelCommas as S,splitTopLevelSpaces as z,parseColorToken as $,getSequenceValue as F}from"../utils/index.js";const K=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),L=/^-?[A-Z][0-9]?$/,N=r=>V(r),Q=r=>{if(u(r))return x.test(r)?r:r.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(l(t))return`var(${t})`;if(/^\d/.test(t)||t.includes("px")||t==="0")return t;const e=m(t);return d(e)?e:t}).join(" ")},U=(r,t)=>O(r,t),X=(r,t)=>{if(u(r))return x.test(r)?r:S(r).map(e=>(e=e.trim(),e?e.split(/\s+/).map(i=>{if(i=i.trim(),!i)return"";if(l(i))return`var(${i})`;if(i==="inset"||i==="none")return i;const n=m(i);if(d(n)){const f=B(i,t);return h(f)?Object.values(f).filter(a=>a.includes(": "+t))[0]:f}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const s=p(i,"shadow");return s&&s.shadow?s.shadow:i}).join(" "):"")).join(", ")},W=(r,t)=>{const e=r.indexOf("(");if(e===-1)return r;const i=r.slice(0,e+1),n=r.slice(e+1,r.lastIndexOf(")")),s=")",a=S(n).map(c=>(c=c.trim(),c.split(/\s+/).map(o=>{if(!o||/^\d/.test(o)||o==="0"||K.has(o)||o==="transparent"||x.test(o))return o;const g=m(o);return d(g)?g:o}).join(" ")));return i+a.join(", ")+s},Y=(r,t)=>{if(!u(r))return;const e=j();return S(r).map(i=>{const n=i.trim();if(l(n))return`var(${n})`;if(/^var\(/.test(n)||n.includes("url"))return n;if(e.gradient?.[n]){const s=B(n,t);if(u(s))return s;if(h(s)){for(const f in s)if(u(s[f]))return s[f]}return n}return n.includes("gradient")?W(n,t):n.includes("/")||n.startsWith("http")||n.includes(".")&&!$(n)?`url(${n})`:n}).join(", ")},Z=r=>u(r)&&r.split(" ").map(t=>p(t,"gap").gap).join(" "),H=r=>{if(!u(r))return r;const t=j();return z(r).map(e=>L.test(e)?F(e,t.spacing):e).join(" ")},q=r=>{if(!u(r))return;const t=r.split(" ");return t.length?t.map(e=>l(e)?`var(${e})`:e.length<3||e.includes("ms")?C(e).timing||e:E(e)?E(e):e).join(" "):r},J=(r,t,e)=>{if(u(r))return r.split(",").map(i=>C(i).timing||i).join(",")},k=r=>{if(!u(r))return;const t=r.split(",");if(t.length)return t.map(q).join(",")};function D(r,t,e={},i={}){let n=T.call(this,t||e[r]);if(n==null)return;let s;if(u(n)){if(/^(?:env|var)\(/.test(n.trim()))return{[r]:n};if(n.includes("(")){const c=_(n);s=c[0],n=c[1]}const f=e.scaleBoxSize,a=G(r);!f&&a&&!i.ratio&&(n=I(n))}return i.ratio?R(e,r,n,s):p(n,r,void 0,s)}const v=(r,t=null,e)=>D(r,t,e,{ratio:!0}),rr=(r,t,e,i="borderRadius")=>{if(u(r))return{[i]:r.split(" ").map(n=>{const s=A(n);return s!==void 0?s:R(t,e,n)[e]}).join(" ")}};export{W as resolveColorsInGradient,k as splitTransition,Y as transformBackgroundImage,N as transformBorder,rr as transformBorderRadius,X as transformBoxShadow,J as transformDuration,H as transformGridTemplate,U as transformShadow,D as transformSize,v as transformSizeRatio,Q as transformTextStroke,q as transformTransition,Z as transfromGap};
@@ -1 +1 @@
1
- import{document as l,window as p,isString as h,isNumber as x,isNotProduction as y}from"@symbo.ls/utils";const w={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},u=e=>{if(e==="")return[0,0,0,0];if(e.toLowerCase()==="transparent")return[0,0,0,0];const r=w[e.toLowerCase()];if(r&&(e=r),e[0]==="#")return e.length<7&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(e.length>4?e[4]+e[4]:"")),[parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16),e.length>7?parseInt(e.substr(7,2),16)/255:1];if(e.indexOf("rgb")===-1&&l&&p){const t=l.body.appendChild(l.createElement("fictum")),n="rgb(1, 2, 3)";if(t.style.color=n,t.style.color!==n){l.body.removeChild(t);return}if(t.style.color=e,t.style.color===n||t.style.color==="")return l.body.removeChild(t),[0,0,0,0];e=p.getComputedStyle(t).color,l.body.removeChild(t)}return e.indexOf("rgb")===0?(e.indexOf("rgba")===-1&&(e=`${e}, 1`),e.match(/[\.\d]+/g).map(t=>+t)):[0,0,0,0]},A=(e,r,t=.5)=>(e=u(e),r=u(r),R(e,r,t)),F=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgb(${t},${n},${a})`},k=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return[t,n,a]},H=(e,r,t)=>"#"+(1<<24|e<<16|r<<8|t).toString(16).slice(1),M=([e,r,t])=>((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1),N=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgba(${t},${n},${a},${r})`},j=(e,r,t=.5)=>{const n=[];for(let a=0;a<3;a++)n[a]=~~(e[a]+(r[a]-e[a])*t);return`rgb(${n})`},G=(e,r)=>{const[t,n,a]=r,f=Math.max(0,Math.min(100,a+parseFloat(e)));return[t,n,f]},T=(e,r,t)=>{const n=Math.max(e,r,t),a=n-Math.min(e,r,t),f=1-Math.abs(n+n-a-1),o=a&&(n==e?(r-t)/a:n==r?2+(t-e)/a:4+(e-r)/a);return[60*(o<0?o+6:o),f?a/f:0,(n+n-a)/2]},C=(e,r,t,n=r*Math.min(t,1-t),a=(f,o=(f+e/30)%12)=>t-n*Math.max(Math.min(o-3,9-o,1),-1))=>[a(0),a(8),a(4)],S=(e,r)=>{const t=parseInt(e,16);let n=(t>>16)+r;n>255?n=255:n<0&&(n=0);let a=(t>>8&255)+r;a>255?a=255:a<0&&(a=0);let f=(t&255)+r;return f>255?f=255:f<0&&(f=0),((f|a<<8|n<<16)+16777216).toString(16).slice(1)},R=(e,r,t=.5)=>{const n=[];for(let a=0;a<4;a++){const f=a===3?o=>o:Math.round;n[a]=f(e[a]+(r[a]-e[a])*t)}return`rgba(${n})`},z=(e,r)=>{const t=u(e);if(!t){y()&&console.warn(e+" color is not rgba");return}return t[3]=r,`rgba(${t})`},O=e=>e.charCodeAt(0)===45&&e.charCodeAt(1)===45,_=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,$=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,P=e=>{if(!h(e))return null;if(_.test(e))return{passthrough:e};if(O(e))return{cssVar:e};const r=e.match($);if(!r)return null;const[,t,n,a]=r,f=n!==void 0?`0.${n}`:void 0,o=a&&a[0]==="="?a.slice(1):a;return{name:t,alpha:f,tone:o}},V=e=>h(e)&&(e.includes("rgb")||e.includes("var(")||e.includes("#")),X=e=>{const r=[];let t="",n=0;for(const a of e){if(a==="("?n+=1:a===")"&&n>0&&(n-=1),a===","&&n===0){r.push(t),t="";continue}t+=a}return(t.length||!r.length)&&r.push(t),r},g=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),m=e=>.2126*g(e[0])+.7152*g(e[1])+.0722*g(e[2]),D=(e,r)=>{const t=m(e)+.05,n=m(r)+.05;return t>n?t/n:n/t},I=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),L=e=>(e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055)*255,Z=([e,r,t])=>{const[n,a,f]=[e,r,t].map(I),o=.4122214708*n+.5363325363*a+.0514459929*f,s=.2119034982*n+.6806995451*a+.1073969566*f,i=.0883024619*n+.2817188376*a+.6299787005*f,c=Math.cbrt(o),d=Math.cbrt(s),b=Math.cbrt(i);return[.2104542553*c+.793617785*d-.0040720468*b,1.9779984951*c-2.428592205*d+.4505937099*b,.0259040371*c+.7827717662*d-.808675766*b]},q=([e,r,t])=>{const n=e+.3963377774*r+.2158037573*t,a=e-.1055613458*r-.0638541728*t,f=e-.0894841775*r-1.291485548*t,o=n**3,s=a**3,i=f**3;return[4.0767416621*o-3.3077115913*s+.2309699292*i,-1.2684380046*o+2.6097574011*s-.3413193965*i,-.0041960863*o-.7034186147*s+1.707614701*i]},K=([e,r,t])=>{let n=Math.atan2(t,r)*180/Math.PI;return n<0&&(n+=360),[e,Math.sqrt(r*r+t*t),n]},E=([e,r,t])=>{const n=t*Math.PI/180;return[e,r*Math.cos(n),r*Math.sin(n)]},J=(e,r,t,n=24)=>{const a=s=>q(E([e,s,t])),f=s=>s.every(i=>i>=-1e-4&&i<=1.0001);let o=a(r);if(!f(o)){let s=0,i=r;for(let c=0;c<n;c++){const d=(s+i)/2;f(a(d))?s=d:i=d}o=a(s)}return o.map(s=>L(Math.max(0,Math.min(1,s))))},Q=(e,r=1,t=[255,255,255])=>r>=1?e:e.map((n,a)=>n*r+t[a]*(1-r)),U=(e,r)=>{h(e)&&e.includes("rgb")&&(e=u(e).join(", ")),h(e)&&(e=e.split(",").map(a=>parseFloat(a.trim()))),x(r)&&(r+="");const t=M(e),n=r.slice(0,1);if(n==="-"||n==="+"){const a=S(t,parseFloat(r));return k(a).join(", ")}else{const[a,f,o]=e,[s,i]=T(a/255,f/255,o/255),c=Math.max(0,Math.min(100,parseFloat(r)))/100;return C(s,i,c).map(b=>Math.round(Math.max(0,Math.min(1,b))*255)).join(", ")}};export{w as CSS_NAMED_COLOR_HEX,_ as CSS_NATIVE_COLOR_REGEX,G as changeLightness,u as colorStringToRgbaArray,Q as compositeOverBackdrop,D as contrastRatio,S as getColorShade,U as getRgbTone,F as hexToRgb,k as hexToRgbArray,N as hexToRgba,C as hslToRgb,O as isCSSVar,V as isResolvedColor,L as linearChannelToSrgb,A as mixTwoColors,j as mixTwoRgb,R as mixTwoRgba,q as oklabToLinearSrgb,K as oklabToOklch,J as oklchToGamutSafeSrgb,E as oklchToOklab,z as opacify,P as parseColorToken,m as relativeLuminance,M as rgbArrayToHex,T as rgbToHSL,H as rgbToHex,X as splitTopLevelCommas,I as srgbChannelToLinear,Z as srgbToOklab,g as toLinearChannel};
1
+ import{document as d,window as p,isString as u,isNumber as x,isNotProduction as y}from"@symbo.ls/utils";const w={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},b=e=>{if(e==="")return[0,0,0,0];if(e.toLowerCase()==="transparent")return[0,0,0,0];const r=w[e.toLowerCase()];if(r&&(e=r),e[0]==="#")return e.length<7&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(e.length>4?e[4]+e[4]:"")),[parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16),e.length>7?parseInt(e.substr(7,2),16)/255:1];if(e.indexOf("rgb")===-1&&d&&p){const t=d.body.appendChild(d.createElement("fictum")),a="rgb(1, 2, 3)";if(t.style.color=a,t.style.color!==a){d.body.removeChild(t);return}if(t.style.color=e,t.style.color===a||t.style.color==="")return d.body.removeChild(t),[0,0,0,0];e=p.getComputedStyle(t).color,d.body.removeChild(t)}return e.indexOf("rgb")===0?(e.indexOf("rgba")===-1&&(e=`${e}, 1`),e.match(/[\.\d]+/g).map(t=>+t)):[0,0,0,0]},A=(e,r,t=.5)=>(e=b(e),r=b(r),R(e,r,t)),F=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgb(${t},${a},${n})`},k=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return[t,a,n]},N=(e,r,t)=>"#"+(1<<24|e<<16|r<<8|t).toString(16).slice(1),M=([e,r,t])=>((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1),H=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgba(${t},${a},${n},${r})`},j=(e,r,t=.5)=>{const a=[];for(let n=0;n<3;n++)a[n]=~~(e[n]+(r[n]-e[n])*t);return`rgb(${a})`},D=(e,r)=>{const[t,a,n]=r,f=Math.max(0,Math.min(100,n+parseFloat(e)));return[t,a,f]},T=(e,r,t)=>{const a=Math.max(e,r,t),n=a-Math.min(e,r,t),f=1-Math.abs(a+a-n-1),o=n&&(a==e?(r-t)/n:a==r?2+(t-e)/n:4+(e-r)/n);return[60*(o<0?o+6:o),f?n/f:0,(a+a-n)/2]},S=(e,r,t,a=r*Math.min(t,1-t),n=(f,o=(f+e/30)%12)=>t-a*Math.max(Math.min(o-3,9-o,1),-1))=>[n(0),n(8),n(4)],C=(e,r)=>{const t=parseInt(e,16);let a=(t>>16)+r;a>255?a=255:a<0&&(a=0);let n=(t>>8&255)+r;n>255?n=255:n<0&&(n=0);let f=(t&255)+r;return f>255?f=255:f<0&&(f=0),((f|n<<8|a<<16)+16777216).toString(16).slice(1)},R=(e,r,t=.5)=>{const a=[];for(let n=0;n<4;n++){const f=n===3?o=>o:Math.round;a[n]=f(e[n]+(r[n]-e[n])*t)}return`rgba(${a})`},G=(e,r)=>{const t=b(e);if(!t){y()&&console.warn(e+" color is not rgba");return}return t[3]=r,`rgba(${t})`},O=e=>e.charCodeAt(0)===45&&e.charCodeAt(1)===45,P=new Set(["currentcolor","transparent","thin","medium","thick"]),_=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,$=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,z=e=>{if(!u(e))return null;if(_.test(e))return{passthrough:e};if(O(e))return{cssVar:e};const r=e.match($);if(!r)return null;const[,t,a,n]=r,f=a!==void 0?`0.${a}`:void 0,o=n&&n[0]==="="?n.slice(1):n;return{name:t,alpha:f,tone:o}},V=e=>u(e)&&(e.includes("rgb")||e.includes("var(")||e.includes("#")),X=e=>{const r=[];let t="",a=0;for(const n of e){if(n==="("?a+=1:n===")"&&a>0&&(a-=1),n===","&&a===0){r.push(t),t="";continue}t+=n}return(t.length||!r.length)&&r.push(t),r},K=e=>{const r=[];let t="",a=0;for(const n of e){if(n==="("?a+=1:n===")"&&a>0&&(a-=1),a===0&&/\s/.test(n)){t.length&&r.push(t),t="";continue}t+=n}return t.length&&r.push(t),r},g=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),m=e=>.2126*g(e[0])+.7152*g(e[1])+.0722*g(e[2]),Z=(e,r)=>{const t=m(e)+.05,a=m(r)+.05;return t>a?t/a:a/t},I=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),L=e=>(e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055)*255,U=([e,r,t])=>{const[a,n,f]=[e,r,t].map(I),o=.4122214708*a+.5363325363*n+.0514459929*f,s=.2119034982*a+.6806995451*n+.1073969566*f,i=.0883024619*a+.2817188376*n+.6299787005*f,c=Math.cbrt(o),l=Math.cbrt(s),h=Math.cbrt(i);return[.2104542553*c+.793617785*l-.0040720468*h,1.9779984951*c-2.428592205*l+.4505937099*h,.0259040371*c+.7827717662*l-.808675766*h]},q=([e,r,t])=>{const a=e+.3963377774*r+.2158037573*t,n=e-.1055613458*r-.0638541728*t,f=e-.0894841775*r-1.291485548*t,o=a**3,s=n**3,i=f**3;return[4.0767416621*o-3.3077115913*s+.2309699292*i,-1.2684380046*o+2.6097574011*s-.3413193965*i,-.0041960863*o-.7034186147*s+1.707614701*i]},W=([e,r,t])=>{let a=Math.atan2(t,r)*180/Math.PI;return a<0&&(a+=360),[e,Math.sqrt(r*r+t*t),a]},E=([e,r,t])=>{const a=t*Math.PI/180;return[e,r*Math.cos(a),r*Math.sin(a)]},Y=(e,r,t,a=24)=>{const n=s=>q(E([e,s,t])),f=s=>s.every(i=>i>=-1e-4&&i<=1.0001);let o=n(r);if(!f(o)){let s=0,i=r;for(let c=0;c<a;c++){const l=(s+i)/2;f(n(l))?s=l:i=l}o=n(s)}return o.map(s=>L(Math.max(0,Math.min(1,s))))},J=(e,r=1,t=[255,255,255])=>r>=1?e:e.map((a,n)=>a*r+t[n]*(1-r)),Q=(e,r)=>{u(e)&&e.includes("rgb")&&(e=b(e).join(", ")),u(e)&&(e=e.split(",").map(n=>parseFloat(n.trim()))),x(r)&&(r+="");const t=M(e),a=r.slice(0,1);if(a==="-"||a==="+"){const n=C(t,parseFloat(r));return k(n).join(", ")}else{const[n,f,o]=e,[s,i]=T(n/255,f/255,o/255),c=Math.max(0,Math.min(100,parseFloat(r)))/100;return S(s,i,c).map(h=>Math.round(Math.max(0,Math.min(1,h))*255)).join(", ")}};export{P as COMPOUND_CSS_KEYWORDS,w as CSS_NAMED_COLOR_HEX,_ as CSS_NATIVE_COLOR_REGEX,D as changeLightness,b as colorStringToRgbaArray,J as compositeOverBackdrop,Z as contrastRatio,C as getColorShade,Q as getRgbTone,F as hexToRgb,k as hexToRgbArray,H as hexToRgba,S as hslToRgb,O as isCSSVar,V as isResolvedColor,L as linearChannelToSrgb,A as mixTwoColors,j as mixTwoRgb,R as mixTwoRgba,q as oklabToLinearSrgb,W as oklabToOklch,Y as oklchToGamutSafeSrgb,E as oklchToOklab,G as opacify,z as parseColorToken,m as relativeLuminance,M as rgbArrayToHex,T as rgbToHSL,N as rgbToHex,X as splitTopLevelCommas,K as splitTopLevelSpaces,I as srgbChannelToLinear,U as srgbToOklab,g as toLinearChannel};
@@ -1 +1 @@
1
- import{isNotProduction as $,isString as g}from"@symbo.ls/utils";import{getActiveConfig as w}from"../factory.js";const u=$(),R=e=>{const t=w();let r="";for(const n in e)t.__svgCache[n]||(t.__svgCache[n]=!0,r+=e[n]);return r},d=e=>{const t=e&&(e.default||e);if(!g(t))return u&&console.warn("parseRootAttributes:",t,"is not a string"),{};const r=t.match(/<svg\s+(.*?)>/);if(!r||!r[1])return{};const o=r[1].match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);return o?o.reduce((s,c)=>{const[l,a]=c.split("=");return s[l]=a.replace(/['"]/g,""),s},{}):{}},h=(e,t)=>{const r=[];if(e.replace(/id="([^"]*)"/g,(o,s)=>(r.push(s),o)),!r.length)return e;let n=e;for(const o of r){const s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=`${t}-${o}`;n=n.replace(new RegExp(`id="${s}"`,"g"),`id="${c}"`).replace(new RegExp(`url\\(#${s}\\)`,"g"),`url(#${c})`).replace(new RegExp(`xlink:href="#${s}"`,"g"),`xlink:href="#${c}"`).replace(new RegExp(`href="#${s}"`,"g"),`href="#${c}"`)}return n},f=new Set,A=(e,t)=>{const r=t&&t.default?t.default:t;if(!g(r))return u&&!f.has(e)&&(f.add(e),console.warn("convertSvgToSymbol:",e,"is not a string")),"";t=r;const n=t.match(/^<symbol\b[^>]*\bid="([^"]*)"/);if(n){const p=n[1];return p===e?t:t.replace(`id="${p}"`,`id="${e}"`)}const o=d(t),{width:s,height:c}=o,l=o.viewBox||`0 0 ${s||24} ${c||24}`;let i=h(t,e).replace("<svg",`<symbol id="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="${l}"`);return i=i.replace(/width="[^"]*"/,""),i=i.replace(/height="[^"]*"/,""),i=i.replace("</svg","</symbol"),i=x(i),i},v="line|circle|ellipse|rect|polyline|polygon|path|stop|use|image",m=new RegExp(`<(${v})\\b([^>]*?)\\s*/>`,"g"),x=e=>e.replace(m,"<$1$2></$1>");export{A as convertSvgToSymbol,R as generateSprite};
1
+ import{isNotProduction as $,isString as g}from"@symbo.ls/utils";import{getActiveConfig as w}from"../factory.js";const u=$(),R=e=>{const t=w();let r="";for(const n in e)t.__svgCache[n]||(t.__svgCache[n]=!0,r+=e[n]);return r},d=e=>{const t=e&&(e.default||e);if(!g(t))return u&&console.warn("parseRootAttributes:",t,"is not a string"),{};const r=t.match(/<svg\s+(.*?)>/);if(!r||!r[1])return{};const o=r[1].match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);return o?o.reduce((s,i)=>{const[a,p]=i.split("=");return s[a]=p.replace(/['"]/g,""),s},{}):{}},h=(e,t)=>{const r=[];if(e.replace(/id="([^"]*)"/g,(o,s)=>(r.push(s),o)),!r.length)return e;let n=e;for(const o of r){const s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=`${t}-${o}`;n=n.replace(new RegExp(`id="${s}"`,"g"),`id="${i}"`).replace(new RegExp(`url\\(#${s}\\)`,"g"),`url(#${i})`).replace(new RegExp(`xlink:href="#${s}"`,"g"),`xlink:href="#${i}"`).replace(new RegExp(`href="#${s}"`,"g"),`href="#${i}"`)}return n},f=new Set,y=(e,t)=>{const r=t&&t.default?t.default:t;if(!g(r))return u&&!f.has(e)&&(f.add(e),console.warn("convertSvgToSymbol:",e,"is not a string")),"";t=r;const n=t.match(/^<symbol\b[^>]*\bid="([^"]*)"/);if(n){const l=n[1];return l===e?t:t.replace(`id="${l}"`,`id="${e}"`)}const o=d(t),{width:s,height:i}=o,a=o.viewBox||`0 0 ${s||24} ${i||24}`;let c=h(t,e).replace("<svg",`<symbol id="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="${a}"`);return c=c.replace(/^<symbol\b[^>]*>/,l=>l.replace(/\s(width|height)="[^"]*"/g,"")),c=c.replace("</svg","</symbol"),c=x(c),c},m="line|circle|ellipse|rect|polyline|polygon|path|stop|use|image",v=new RegExp(`<(${m})\\b([^>]*?)\\s*/>`,"g"),x=e=>e.replace(v,"<$1$2></$1>");export{y as convertSvgToSymbol,R as generateSprite};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/scratch",
3
3
  "description": "Φ / CSS framework and methodology.",
4
4
  "author": "symbo.ls",
5
- "version": "3.14.777",
5
+ "version": "3.14.779",
6
6
  "files": [
7
7
  "dist",
8
8
  "*.js",