@symbo.ls/scratch 3.14.774 → 3.14.776

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.
@@ -1 +1 @@
1
- "use strict";var x=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var N=(t,s)=>{for(var e in s)x(t,e,{get:s[e],enumerable:!0})},H=(t,s,e,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of G(s))!W.call(t,r)&&r!==e&&x(t,r,{get:()=>s[r],enumerable:!(c=q(s,r))||c.enumerable});return t};var Y=t=>H(x({},"__esModule",{value:!0}),t);var K={};N(K,{VALUE_TRANSFORMERS:()=>D,changeGlobalTheme:()=>B,set:()=>J,setEach:()=>j,setValue:()=>M});module.exports=Y(K);var v=require("./factory.js"),o=require("./system/index.js"),T=require("@symbo.ls/utils"),u=require("./utils/host.js");const $=(t,s)=>{const e=(0,v.getActiveConfig)(),{cssVars:c}=e,r=s.startsWith("--")?s:`--${s}`;return c[r]=t,t},f=t=>t,D={color:o.setColor,gradient:o.setGradient,font:o.setFont,fontFamily:o.setFontFamily,fontfamily:o.setFontFamily,theme:o.setTheme,icons:o.setSvgIcon,semanticIcons:f,semanticicons:f,svg:o.setSVG,svgData:f,typography:f,shadow:o.setShadow,spacing:f,media:f,grid:f,class:f,timing:f,reset:f,unit:f,animation:f,vars:$,sizes:f,shape:f},z=(t,s,e,c)=>{(0,u.parkHostObject)(t,e,s);const r={};for(const n of c)t[n]===s&&(t[n]=r);return t.verbose&&console.warn("[scratch] design-system family",e,"resolved to a host object; parked it and allocated a plain bucket"),r},M=(t,s,e)=>{const c=(0,v.getActiveConfig)(),r=(0,v.toCamel)(t),n=r.toLowerCase(),d=c[r]||c[n]||c[t],i=(0,u.isHostObject)(d)?z(c,d,n,[r,n,t]):d,m=D[r]||D[n];if(m)try{const a=m(s,e);return i&&(i[e]=a),i}catch(a){c.verbose&&console.warn("Error setting",n,"value",s,e,a)}if(!m){const a=i||(c[n]={});return a[e]=s,a}c.verbose&&console.warn("Can not find",n,"method in scratch")},j=(t,s)=>{const e=(0,v.getActiveConfig)(),c=t.toLowerCase();return(0,u.isHostObject)(s)?((0,u.parkHostObject)(e,c,s),e.verbose&&console.warn("[scratch] ignoring host object passed as the",c,"design-system family"),e[c]||e[t]):(Object.keys(s).sort((n,d)=>{const i=(0,T.isObject)(s[n])||(0,T.isArray)(s[n])?1:0,m=(0,T.isObject)(s[d])||(0,T.isArray)(s[d])?1:0;return i-m}).forEach(n=>{try{return M(c,s[n],n)}catch(d){e.verbose&&console.warn("Error setting",c,"value",s[n],n,d)}}),e[c]||e[t])},B=(t,s)=>{const e=s||(0,v.getActiveConfig)();e.globalTheme=t;const r=(0,u.resolveConfigDocument)(e)||(typeof document<"u"?document:null),n=r&&r.defaultView||(typeof window<"u"?window:null);if(r){const i=e.themeRoot||r.documentElement;if(t&&t!=="auto")i.setAttribute("data-theme",t),e.resolvedTheme=t,t==="dark"||t==="light"?i.style.colorScheme=t:i.style.colorScheme="light dark";else if(n&&n.matchMedia){const a=p=>{const S=p.matches?"dark":"light";i.setAttribute("data-theme",S),e.resolvedTheme=S},h=n.matchMedia("(prefers-color-scheme: dark)");if(a(h),i.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=a;try{h.addEventListener("change",a)}catch{h.addListener(a)}}}else i.setAttribute("data-theme","light"),e.resolvedTheme="light",i.style.colorScheme="light"}const d=e.varPrefix?`--${e.varPrefix}-theme-`:"--theme-";for(const i in e.cssVars)i.startsWith(d)&&delete e.cssVars[i];for(const i in e.cssMediaVars)delete e.cssMediaVars[i];if(r&&e.cssVars){const i=e.scopeSelector||":root",m=r.styleSheets;for(let a=0;a<m.length;a++)try{const h=m[a].cssRules;for(let p=0;p<h.length;p++)if(h[p].selectorText===i){for(const S in e.cssVars)h[p].style.setProperty(S,e.cssVars[S]);return e}}catch{}}return e},U={},J=(t,s=U)=>{let e=s.config||(0,v.getActiveConfig)();const{version:c,verbose:r,useVariable:n,useReset:d,useSvgSprite:i,useFontImport:m,useIconSprite:a,globalTheme:h,themeRoot:p,useDocumentTheme:S,useDefaultConfig:E,semanticIcons:R,hoverMedia:A,files:L,assets:F,...y}=t;s.newConfig&&(e=(0,v.setActiveConfig)(s.newConfig)),(0,u.isDomDocument)(y.document)&&(e.__domDocument=y.document,delete y.document),(0,u.isDomDocument)(e.document)&&(e.__domDocument||(e.__domDocument=e.document),e.document={}),L!==void 0&&(e.files=L),F!==void 0&&(e.assets=F),r!==void 0&&(e.verbose=r),n!==void 0&&(e.useVariable=n),d!==void 0&&(e.useReset=d),m!==void 0&&(e.useFontImport=m),i!==void 0&&(e.useSvgSprite=i),a!==void 0&&(e.useIconSprite=a),S!==void 0&&(e.useDocumentTheme=S),h!==void 0&&(e.globalTheme=h),p!==void 0&&(e.themeRoot=p),t.useThemeSuffixedVars!==void 0&&(e.useThemeSuffixedVars=t.useThemeSuffixedVars),E!==void 0&&(e.useDefaultConfig=E),R!==void 0&&(e.semanticIcons=R),A!==void 0&&(e.hoverMedia=A),e.verbose&&console.log(e);const w=(0,u.resolveConfigDocument)(e)||(typeof document<"u"?document:null),C=w&&w.defaultView||(typeof window<"u"?window:null),b=w&&(e.themeRoot||w.documentElement);if(b&&typeof b.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")b.setAttribute("data-theme",e.globalTheme),e.resolvedTheme=e.globalTheme,e.globalTheme==="dark"||e.globalTheme==="light"?b.style.colorScheme=e.globalTheme:b.style.colorScheme="light dark";else if(C&&C.matchMedia){const g=P=>{const k=P.matches?"dark":"light";b.setAttribute("data-theme",k),e.resolvedTheme=k},V=C.matchMedia("(prefers-color-scheme: dark)");if(g(V),b.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=g;try{V.addEventListener("change",g)}catch{V.addListener(g)}}}else b.setAttribute("data-theme","light"),e.resolvedTheme="light",b.style.colorScheme="light";e.__svgCache||(e.__svgCache={});const _=Object.keys(y).filter(l=>!l.startsWith("__")),I=new Set(_);if(_.forEach(l=>{const g=l.toLowerCase();g!==l&&I.has(g)&&(0,T.deepMerge)(y[g],y[l])}),_.map(l=>{const g=l.toLowerCase();if(!(g!==l&&I.has(g)))return j(l,y[l])}),e.varPrefix&&(e.typography&&(e.typography.varPrefix=e.varPrefix),e.spacing&&(e.spacing.varPrefix=e.varPrefix),e.timing&&(e.timing.varPrefix=e.varPrefix)),y.typography)try{(0,o.applyTypographySequence)()}catch(l){e.verbose&&console.warn("Error applying typography sequence",l)}if(y.spacing)try{(0,o.applySpacingSequence)()}catch(l){e.verbose&&console.warn("Error applying spacing sequence",l)}if(y.timing)try{(0,o.applyTimingSequence)()}catch(l){e.verbose&&console.warn("Error applying timing sequence",l)}(0,o.applyDocument)();const O=(0,o.applyReset)();return O&&(e.reset=O),e};
1
+ "use strict";var D=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var B=(t,s)=>{for(var e in s)D(t,e,{get:s[e],enumerable:!0})},K=(t,s,e,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of $(s))!z.call(t,r)&&r!==e&&D(t,r,{get:()=>s[r],enumerable:!(o=Y(s,r))||o.enumerable});return t};var U=t=>K(D({},"__esModule",{value:!0}),t);var N={};B(N,{VALUE_TRANSFORMERS:()=>R,changeGlobalTheme:()=>X,set:()=>G,setEach:()=>H,setValue:()=>F});module.exports=U(N);var v=require("./factory.js"),n=require("./system/index.js"),_=require("@symbo.ls/utils"),h=require("./utils/host.js");const T="__smblsThemeRootOwner",w=t=>{const s=t&&t.__prefersListener,e=t&&t.__prefersMq;if(s&&e)try{typeof e.removeEventListener=="function"?e.removeEventListener("change",s):typeof e.removeListener=="function"&&e.removeListener(s)}catch{try{e.removeListener(s)}catch{}}t&&(t.__prefersListener=null,t.__prefersMq=null)},W=(t,s,e)=>{if(!(!t||!s)){w(t),t.__prefersListener=e,t.__prefersMq=s;try{s.addEventListener("change",e)}catch{s.addListener(e)}}},J=(t,s)=>{const e=(0,v.getActiveConfig)(),{cssVars:o}=e,r=s.startsWith("--")?s:`--${s}`;return o[r]=t,t},d=t=>t,R={color:n.setColor,gradient:n.setGradient,font:n.setFont,fontFamily:n.setFontFamily,fontfamily:n.setFontFamily,theme:n.setTheme,icons:n.setSvgIcon,semanticIcons:d,semanticicons:d,svg:n.setSVG,svgData:d,typography:d,shadow:n.setShadow,spacing:d,media:d,grid:d,class:d,timing:d,reset:d,unit:d,animation:d,vars:J,sizes:d,shape:d},Q=(t,s,e,o)=>{(0,h.parkHostObject)(t,e,s);const r={};for(const i of o)t[i]===s&&(t[i]=r);return t.verbose&&console.warn("[scratch] design-system family",e,"resolved to a host object; parked it and allocated a plain bucket"),r},F=(t,s,e)=>{const o=(0,v.getActiveConfig)(),r=(0,v.toCamel)(t),i=r.toLowerCase(),m=o[r]||o[i]||o[t],c=(0,h.isHostObject)(m)?Q(o,m,i,[r,i,t]):m,u=R[r]||R[i];if(u)try{const f=u(s,e);return c&&(c[e]=f),c}catch(f){o.verbose&&console.warn("Error setting",i,"value",s,e,f)}if(!u){const f=c||(o[i]={});return f[e]=s,f}o.verbose&&console.warn("Can not find",i,"method in scratch")},H=(t,s)=>{const e=(0,v.getActiveConfig)(),o=t.toLowerCase();return(0,h.isHostObject)(s)?((0,h.parkHostObject)(e,o,s),e.verbose&&console.warn("[scratch] ignoring host object passed as the",o,"design-system family"),e[o]||e[t]):s==null?(e.verbose&&console.warn("[scratch] skipping empty design-system family",o),e[o]||e[t]):(Object.keys(s).sort((i,m)=>{const c=(0,_.isObject)(s[i])||(0,_.isArray)(s[i])?1:0,u=(0,_.isObject)(s[m])||(0,_.isArray)(s[m])?1:0;return c-u}).forEach(i=>{try{return F(o,s[i],i)}catch(m){e.verbose&&console.warn("Error setting",o,"value",s[i],i,m)}}),e[o]||e[t])},X=(t,s)=>{const e=s||(0,v.getActiveConfig)();e.globalTheme=t;const r=(0,h.resolveConfigDocument)(e)||(typeof document<"u"?document:null),i=r&&r.defaultView||(typeof window<"u"?window:null);if(r){const c=e.themeRoot||r.documentElement,u=t&&t!=="auto";if(c[T]=e,u)w(e),c.setAttribute("data-theme",t),e.resolvedTheme=t,t==="dark"||t==="light"?c.style.colorScheme=t:c.style.colorScheme="light dark";else if(i&&i.matchMedia){const f=y=>{const S=y.matches?"dark":"light";c.setAttribute("data-theme",S),e.resolvedTheme=S},g=i.matchMedia("(prefers-color-scheme: dark)");f(g),c.style.colorScheme="light dark",W(e,g,f)}else w(e),c.setAttribute("data-theme","light"),e.resolvedTheme="light",c.style.colorScheme="light"}const m=e.varPrefix?`--${e.varPrefix}-theme-`:"--theme-";for(const c in e.cssVars)c.startsWith(m)&&delete e.cssVars[c];for(const c in e.cssMediaVars)delete e.cssMediaVars[c];if(r&&e.cssVars){const c=e.scopeSelector||":root",u=r.styleSheets;for(let f=0;f<u.length;f++)try{const g=u[f].cssRules;for(let y=0;y<g.length;y++)if(g[y].selectorText===c){for(const S in e.cssVars)g[y].style.setProperty(S,e.cssVars[S]);return e}}catch{}}return e},Z={},G=(t,s=Z)=>{let e=s.config||(0,v.getActiveConfig)();const{version:o,verbose:r,useVariable:i,useReset:m,useSvgSprite:c,useFontImport:u,useIconSprite:f,globalTheme:g,themeRoot:y,useDocumentTheme:S,useDefaultConfig:L,semanticIcons:A,hoverMedia:M,files:P,assets:C,...p}=t;s.newConfig&&(e=(0,v.setActiveConfig)(s.newConfig)),(0,h.isDomDocument)(p.document)&&(e.__domDocument=p.document,delete p.document),(0,h.isDomDocument)(e.document)&&(e.__domDocument||(e.__domDocument=e.document),e.document={}),P!==void 0&&(e.files=P),C!==void 0&&(e.assets=C),r!==void 0&&(e.verbose=r),i!==void 0&&(e.useVariable=i),m!==void 0&&(e.useReset=m),u!==void 0&&(e.useFontImport=u),c!==void 0&&(e.useSvgSprite=c),f!==void 0&&(e.useIconSprite=f),S!==void 0&&(e.useDocumentTheme=S),g!==void 0&&(e.globalTheme=g),y!==void 0&&(e.themeRoot=y),t.useThemeSuffixedVars!==void 0&&(e.useThemeSuffixedVars=t.useThemeSuffixedVars),L!==void 0&&(e.useDefaultConfig=L),A!==void 0&&(e.semanticIcons=A),M!==void 0&&(e.hoverMedia=M),e.verbose&&console.log(e);const E=(0,h.resolveConfigDocument)(e)||(typeof document<"u"?document:null),V=E&&E.defaultView||(typeof window<"u"?window:null),l=E&&(e.themeRoot||E.documentElement);if(l&&typeof l.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")w(e),l.setAttribute("data-theme",e.globalTheme),e.resolvedTheme=e.globalTheme,l[T]=e,e.globalTheme==="dark"||e.globalTheme==="light"?l.style.colorScheme=e.globalTheme:l.style.colorScheme="light dark";else if(l[T]&&l[T]!==e&&l.hasAttribute("data-theme"))w(e),e.resolvedTheme=l.getAttribute("data-theme");else if(V&&V.matchMedia){const b=I=>{const O=I.matches?"dark":"light";l.setAttribute("data-theme",O),e.resolvedTheme=O},j=V.matchMedia("(prefers-color-scheme: dark)");b(j),l.style.colorScheme="light dark",l[T]=e,W(e,j,b)}else w(e),l.setAttribute("data-theme","light"),e.resolvedTheme="light",l.style.colorScheme="light",l[T]=e;e.__svgCache||(e.__svgCache={});const x=Object.keys(p).filter(a=>!a.startsWith("__")),k=new Set(x);if(x.forEach(a=>{const b=a.toLowerCase();b!==a&&k.has(b)&&(0,_.deepMerge)(p[b],p[a])}),x.map(a=>{const b=a.toLowerCase();if(!(b!==a&&k.has(b)))return H(a,p[a])}),e.varPrefix&&(e.typography&&(e.typography.varPrefix=e.varPrefix),e.spacing&&(e.spacing.varPrefix=e.varPrefix),e.timing&&(e.timing.varPrefix=e.varPrefix)),p.typography)try{(0,n.applyTypographySequence)()}catch(a){e.verbose&&console.warn("Error applying typography sequence",a)}if(p.spacing)try{(0,n.applySpacingSequence)()}catch(a){e.verbose&&console.warn("Error applying spacing sequence",a)}if(p.timing)try{(0,n.applyTimingSequence)()}catch(a){e.verbose&&console.warn("Error applying timing sequence",a)}(0,n.applyDocument)();const q=(0,n.applyReset)();return q&&(e.reset=q),e};
@@ -0,0 +1 @@
1
+ "use strict";var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},g=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a(e))!S.call(t,i)&&i!==n&&u(t,i,{get:()=>e[i],enumerable:!(o=m(e,i))||o.enumerable});return t};var C=t=>g(u({},"__esModule",{value:!0}),t);var h={};p(h,{resolveBorderValue:()=>b});module.exports=C(h);var c=require("./color.js"),l=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),b=(t,e,n)=>{const o=t+"";if(s.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,s.isCSSVar)(r))return`var(${r})`;if(R(r)||/^\d/.test(r)||r==="0")return r;const f=(0,c.getColor)(r,e);if((0,s.isResolvedColor)(f))return f;n&&n(r);const d=(0,l.getSpacingByKey)(r,"border");return d&&d.border?d.border:r}).join(" ")};
@@ -1 +1 @@
1
- "use strict";var w=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var F=(r,t)=>{for(var g in t)w(r,g,{get:t[g],enumerable:!0})},q=(r,t,g,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of O(t))!j.call(r,a)&&a!==g&&w(r,a,{get:()=>t[a],enumerable:!(e=L(t,a))||e.enumerable});return r};var _=r=>q(w({},"__esModule",{value:!0}),r);var N={};F(N,{STANDARD_SCHEME_QUERIES:()=>P,getColor:()=>A,getMediaColor:()=>H,resolveColorRgb:()=>D,setAdaptiveSchemeVar:()=>E,setColor:()=>M,setGradient:()=>T});module.exports=_(N);var d=require("@symbo.ls/utils"),S=require("../factory.js"),h=require("../utils/index.js");const P={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},A=(r,t,g)=>{const e=g||(0,S.getActiveConfig)();if(!(0,d.isString)(r)){e.verbose&&console.warn(r,"- type for color is not valid");return}if((0,h.isCSSVar)(r))return`var(${r})`;t&&r[t]&&(r=r[t]);let a,l,o;if((0,d.isArray)(r))[a,l,o]=r;else{const s=(0,h.parseColorToken)(r);if(!s){const{color:i,gradient:C}=e;let $=C[r]||i[r];return $?(t&&$[t]&&($=$[t]),e.useVariable?`var(${$.var})`:$.value):r}if(s.passthrough)return s.passthrough;if(s.cssVar)return`var(${s.cssVar})`;a=s.name,l=s.alpha,o=s.tone}const{color:b,gradient:f}=e;let n=b[a]||f[a];if(!n)return e.verbose&&console.warn("Can't find color ",a),r;if(t)if(n[t]!==void 0)n=n[t];else if((0,d.isArray)(n)){const s=t.charCodeAt(0)===64?t.slice(1):t;s==="dark"?n=n[1]!==void 0?n[1]:n[0]:(s!=="light"&&e.verbose&&console.warn(r," - array-form color tokens only support light/dark; falling back to the light slot for scheme",t),n=n[0])}else e.verbose&&console.warn(r," - does not have ",t);if((0,d.isString)(n))return A(n,null,g);let p=n.rgb;if(!p){const s=e.useVariable?`var(${n.var})`:n.value;if((l||o)&&s){const i=l!==void 0?l:1;if(!o)return`rgb(from ${s} r g b / ${i})`;if(o.charCodeAt(0)===43||o.charCodeAt(0)===45){const $=parseFloat(o),u=$<0?"-":"+",c=Math.abs($);return`rgb(from ${s} calc(r ${u} ${c}) calc(g ${u} ${c}) calc(b ${u} ${c}) / ${i})`}return`hsl(from ${s} h s ${o}% / ${i})`}return s}return o&&!n[o]&&(p=(0,h.getRgbTone)(p,o),n[o]={rgb:p,var:`${n.var}-${o}`}),n[o]&&(p=n[o].rgb),l?`rgba(${p}, ${l})`:o?`rgba(${p}, 1)`:e.useVariable?`var(${n.var})`:`rgb(${p})`},D=(r,t,g)=>{const e=t||(0,S.getActiveConfig)();if(!(0,d.isString)(r))return null;const a=(0,h.parseColorToken)(r);if(a){if(a.passthrough){const i=(0,h.colorStringToRgbaArray)(a.passthrough);return i&&i.length>=3?{rgb:[i[0],i[1],i[2]],alpha:i[3]!==void 0?i[3]:1}:null}if(a.cssVar)return null}const l=a?a.name:r,{color:o,gradient:b}=e;let f=o[l]||b[l];if(!f){const i=(0,h.colorStringToRgbaArray)(r);return!i||i.length<3||i[0]===0&&i[1]===0&&i[2]===0&&i[3]===0&&r.toLowerCase()!=="transparent"?null:{rgb:[i[0],i[1],i[2]],alpha:i[3]!==void 0?i[3]:1}}if((0,d.isString)(f))return D(f,e,g);if(f.rgb===void 0&&(0,d.isObject)(f)){const i=`@${g||"light"}`;f=f[i]!==void 0?f[i]:f["@light"]}if(!f||f.rgb===void 0)return null;let n=f.rgb;a&&a.tone&&(n=(0,h.getRgbTone)(n,a.tone));const p=(0,d.isString)(n)?n.split(",").map(i=>parseFloat(i.trim())):n,s=a&&a.alpha!==void 0?parseFloat(a.alpha):f.alpha!==void 0?f.alpha:1;return{rgb:p,alpha:s}},H=(r,t,g)=>{const e=g||(0,S.getActiveConfig)();if(t||(t=e.globalTheme==="auto"?null:e.globalTheme),!(0,d.isString)(r)){e.verbose&&console.warn(r,"- type for color is not valid");return}if((0,h.isCSSVar)(r))return`var(${r})`;let a,l,o;if((0,d.isArray)(r))a=r[0];else{const s=(0,h.parseColorToken)(r);if(s){if(s.passthrough)return s.passthrough;if(s.cssVar)return`var(${s.cssVar})`;a=s.name,l=s.alpha,o=s.tone}else a=r}const{color:b,gradient:f}=e,n=b[a]||f[a],p=(0,d.isObject)(n);if(p&&n.value)return A(r,`@${t}`,g);if(p){if(e.useVariable&&n.var)return l||o?A(r,null,g):`var(${n.var})`;if(t)return A(r,`@${t}`,g);{const s={};for(const i in n){if(i.charCodeAt(0)!==64)continue;const C=i.slice(1),$=e.media&&e.media[C]||P[C];if(!$)continue;const u="@media "+($==="print"?`${$}`:`screen and ${$}`);s[u]=A(r,i,g)}return s}}else return e.verbose&&console.warn("Can't find color",r),r},E=(r,t,g,e)=>{const l=`--${e.varPrefix?e.varPrefix+"-":""}${t}-${g}`;let o;const b={};for(const f in r){if(f.charCodeAt(0)!==64)continue;const n=f.slice(1),p=r[f],s=p&&(p.value||p);!s||typeof s!="string"||(b[n]=s,(n==="light"||o===void 0)&&(o=s))}if(o!==void 0){e.cssVars[l]=o,e.cssMediaVars||(e.cssMediaVars={});for(const f in b){const n=`[data-theme="${f}"]`;if(e.cssMediaVars[n]||(e.cssMediaVars[n]={}),e.cssMediaVars[n][l]=b[f],f==="light"||f==="dark"){const p=`@media (prefers-color-scheme: ${f})`;e.cssMediaVars[p]||(e.cssMediaVars[p]={}),e.cssMediaVars[p][l]=b[f]}}return r.var=l,l}},M=(r,t,g)=>{const e=(0,S.getActiveConfig)();if((0,d.isObject)(r)&&r.value!==void 0&&(r.rgb!==void 0||r.var!==void 0))return e.useVariable&&r.var&&(e.cssVars[r.var]=r.value),r;if((0,d.isString)(r)&&(0,h.isCSSVar)(r)){const u=r.slice(2);if(r=A(u),!(r.includes("rgb")||r.includes("var")||r.includes("#"))){const c=u.split(" ");let m=e.color[c[0]];if(m&&!m.value&&!m.rgb&&((0,d.isString)(m)||(0,d.isArray)(m)||(0,d.isObject)(m))&&(e.color[c[0]]=M(m,c[0]),m=e.color[c[0]]),m&&m.value){let V=m.rgb;const x=c[1]!==void 0?c[1]:"1",R=c[2];R&&(V=(0,h.getRgbTone)(V,R)),r=`rgba(${V}, ${x})`}else{const V=c[2],x=c[1]!==void 0?c[1]:"1";if(V)try{const R=(0,h.colorStringToRgbaArray)(c[0]);R&&R.length>=3?r=`rgba(${(0,h.getRgbTone)(R.slice(0,3).join(", "),V)}, ${x})`:r=c[0]}catch{r=c[0]}else r=c[0]}}}if((0,d.isArray)(r)&&(r={"@light":r[0],"@dark":r[1]!==void 0?r[1]:r[0]}),(0,d.isObject)(r)){const u={};for(const c in r)c!=="var"&&(u[c]=M(r[c],t,c.slice(0,1)==="@"?c.slice(1):c));return e.useVariable&&E(u,"color",t,e),u}const l=`--${e.varPrefix?e.varPrefix+"-":""}color-${t}`+(g?`-${g}`:"");let o=r.value||r;if((0,d.isString)(o)&&!o.includes("(")&&!o.startsWith("#")){const u=(0,h.parseColorToken)(o);if(u&&u.name&&!u.passthrough&&!u.cssVar){const c=e.color[u.name];c&&!c.value&&!c.rgb&&((0,d.isString)(c)||(0,d.isArray)(c)||(0,d.isObject)(c))&&(e.color[u.name]=M(c,u.name));const m=e.color[u.name];if(m&&m.rgb){let V=m.rgb;u.tone&&(V=(0,h.getRgbTone)(V,u.tone));const x=u.alpha?parseFloat(u.alpha):1;o=`rgba(${V}, ${x})`}}}const b=(0,h.colorStringToRgbaArray)(o),[f,n,p,s=1]=b,i=parseFloat(s.toFixed(2)),C=`${f}, ${n}, ${p}`,$=`rgba(${C}, ${i})`;return e.useVariable&&(e.cssVars[l]=$),{var:l,rgb:C,alpha:i,value:$}},T=(r,t,g)=>{const e=(0,S.getActiveConfig)();if((0,d.isObject)(r)&&r.value!==void 0&&r.var!==void 0)return e.useVariable&&(e.cssVars[r.var]=r.value),r;if((0,d.isString)(r)&&(0,h.isCSSVar)(r)&&(r=A(r.slice(2))),(0,d.isArray)(r)&&(r={"@light":r[0],"@dark":r[1]!==void 0?r[1]:r[0]}),(0,d.isObject)(r)){const o={};for(const b in r)b!=="var"&&(o[b]=T(r[b],t,b.slice(0,1)==="@"?b.slice(1):b));return e.useVariable&&E(o,"gradient",t,e),o}const l=`--${e.varPrefix?e.varPrefix+"-":""}gradient-${t}`+(g?`-${g}`:"");return e.useVariable&&(e.cssVars[l]=r.value||r),{var:l,value:r.value||r}};
1
+ "use strict";var M=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var s in t)M(e,s,{get:t[s],enumerable:!0})},N=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of j(t))!_.call(e,n)&&n!==s&&M(e,n,{get:()=>t[n],enumerable:!(r=T(t,n))||r.enumerable});return e};var W=e=>N(M({},"__esModule",{value:!0}),e);var U={};v(U,{STANDARD_SCHEME_QUERIES:()=>D,getColor:()=>w,getMediaColor:()=>Q,resolveColorRgb:()=>L,setAdaptiveSchemeVar:()=>E,setColor:()=>A,setGradient:()=>P});module.exports=W(U);var c=require("@symbo.ls/utils"),R=require("../factory.js"),b=require("../utils/index.js");const D={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},V=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"]),x=new Set,F=e=>{if(!e)return!1;const{color:t,gradient:s}=e;return!!((0,c.isObject)(t)&&Object.keys(t).length||(0,c.isObject)(s)&&Object.keys(s).length)},O=(e,t,s)=>{const r=(0,c.isString)(t)?t.toLowerCase():"";if(!z.has(r)||!F(s))return e;if(!x.has(r)){x.add(r);const n=s&&s.name?` (design system \`${s.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${n}. 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.`)}},w=(e,t,s)=>{const r=s||(0,R.getActiveConfig)();if(!(0,c.isString)(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if((0,b.isCSSVar)(e))return`var(${e})`;t&&e[t]&&(e=e[t]);let n,f,l;if((0,c.isArray)(e))[n,f,l]=e;else{const i=(0,b.parseColorToken)(e);if(!i){const{color:g,gradient:k}=r;let $=k[e]||g[e];return $?(t&&$[t]&&($=$[t]),r.useVariable?`var(${$.var})`:$.value):e}if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;n=i.name,f=i.alpha,l=i.tone}const{color:m,gradient:d}=r;let o=m[n]||d[n];if(!o)return O(e,n,r);if(t)if(o[t]!==void 0)o=o[t];else if((0,c.isArray)(o)){const i=t.charCodeAt(0)===64?t.slice(1):t;i==="dark"?o=o[1]!==void 0?o[1]:o[0]:(i!=="light"&&r.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",t),o=o[0])}else r.verbose&&console.warn(e," - does not have ",t);if((0,c.isString)(o)){if(V.has(n))return o;V.add(n);try{return w(o,null,s)}finally{V.delete(n)}}let h=o.rgb;if(!h){const i=r.useVariable?`var(${o.var})`:o.value;if((f||l)&&i){const g=f!==void 0?f:1;if(!l)return`rgb(from ${i} r g b / ${g})`;if(l.charCodeAt(0)===43||l.charCodeAt(0)===45){const $=parseFloat(l),u=$<0?"-":"+",a=Math.abs($);return`rgb(from ${i} calc(r ${u} ${a}) calc(g ${u} ${a}) calc(b ${u} ${a}) / ${g})`}return`hsl(from ${i} h s ${l}% / ${g})`}return i}return l&&!o[l]&&(h=(0,b.getRgbTone)(h,l),o[l]={rgb:h,var:`${o.var}-${l}`}),o[l]&&(h=o[l].rgb),f?`rgba(${h}, ${f})`:l?`rgba(${h}, 1)`:r.useVariable?`var(${o.var})`:`rgb(${h})`},q=e=>{const t=(0,b.colorStringToRgbaArray)(e);return!t||t.length<3||t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[t[0],t[1],t[2]],alpha:t[3]!==void 0?t[3]:1}},H=(e,t)=>{if(!t)return e;let s=e.rgb;if(t.tone){const n=(0,b.getRgbTone)(s,t.tone);s=(0,c.isString)(n)?n.split(",").map(f=>parseFloat(f.trim())):n}const r=t.alpha!==void 0?parseFloat(t.alpha):e.alpha;return{rgb:s,alpha:r}},L=(e,t,s)=>{const r=t||(0,R.getActiveConfig)();if(!(0,c.isString)(e))return null;const n=(0,b.parseColorToken)(e);if(n){if(n.passthrough){const g=(0,b.colorStringToRgbaArray)(n.passthrough);return g&&g.length>=3?{rgb:[g[0],g[1],g[2]],alpha:g[3]!==void 0?g[3]:1}:null}if(n.cssVar)return null}const f=n?n.name:e,{color:l,gradient:m}=r;let d=l[f]||m[f];if(!d)return q(e);if((0,c.isString)(d)){let g;if(V.has(f))g=q(d);else{V.add(f);try{g=L(d,r,s)}finally{V.delete(f)}}return g?H(g,n):null}if(d.rgb===void 0&&(0,c.isObject)(d)){const g=`@${s||"light"}`;d=d[g]!==void 0?d[g]:d["@light"]}if(!d||d.rgb===void 0)return null;let o=d.rgb;n&&n.tone&&(o=(0,b.getRgbTone)(o,n.tone));const h=(0,c.isString)(o)?o.split(",").map(g=>parseFloat(g.trim())):o,i=n&&n.alpha!==void 0?parseFloat(n.alpha):d.alpha!==void 0?d.alpha:1;return{rgb:h,alpha:i}},Q=(e,t,s)=>{const r=s||(0,R.getActiveConfig)();if(t||(t=r.globalTheme==="auto"?null:r.globalTheme),!(0,c.isString)(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if((0,b.isCSSVar)(e))return`var(${e})`;let n,f,l;if((0,c.isArray)(e))n=e[0];else{const i=(0,b.parseColorToken)(e);if(i){if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;n=i.name,f=i.alpha,l=i.tone}else n=e}const{color:m,gradient:d}=r,o=m[n]||d[n],h=(0,c.isObject)(o);if(h&&o.value)return w(e,`@${t}`,s);if(h){if(r.useVariable&&o.var)return f||l?w(e,null,s):`var(${o.var})`;if(t)return w(e,`@${t}`,s);{const i={},g=r.scopeSelector||":root",k=g===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${g}:not([data-theme])`;for(const $ in o){if($.charCodeAt(0)!==64)continue;const u=$.slice(1),a=w(e,$,s);if(a!==void 0&&(i[`[data-theme="${u}"] &`]=a,u==="light"||u==="dark")){const p=r.media&&r.media[u]||D[u];if(!p)continue;const y="@media "+(p==="print"?`${p}`:`screen and ${p}`);i[y]={[`${k} &`]:a}}}return i}}else return O(e,n,r)},E=(e,t,s,r)=>{const f=`--${r.varPrefix?r.varPrefix+"-":""}${t}-${s}`;let l;const m={};for(const d in e){if(d.charCodeAt(0)!==64)continue;const o=d.slice(1),h=e[d],i=h&&(h.value||h);!i||typeof i!="string"||(m[o]=i,(o==="light"||l===void 0)&&(l=i))}if(l!==void 0){r.cssVars[f]=l,r.cssMediaVars||(r.cssMediaVars={});for(const d in m){const o=`[data-theme="${d}"]`;if(r.cssMediaVars[o]||(r.cssMediaVars[o]={}),r.cssMediaVars[o][f]=m[d],d==="light"||d==="dark"){const h=`@media (prefers-color-scheme: ${d})`;r.cssMediaVars[h]||(r.cssMediaVars[h]={}),r.cssMediaVars[h][f]=m[d]}}return e.var=f,f}},A=(e,t,s)=>{const r=(0,R.getActiveConfig)();if((0,c.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,c.isString)(e)&&(0,b.isCSSVar)(e)){const u=e.slice(2);if(e=w(u),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const a=u.split(" ");let p=r.color[a[0]];if(p&&!p.value&&!p.rgb&&((0,c.isString)(p)||(0,c.isArray)(p)||(0,c.isObject)(p))&&!V.has(a[0])){V.add(a[0]);try{r.color[a[0]]=A(p,a[0])}finally{V.delete(a[0])}p=r.color[a[0]]}if(p&&p.value){let y=p.rgb;const C=a[1]!==void 0?a[1]:"1",S=a[2];S&&(y=(0,b.getRgbTone)(y,S)),e=`rgba(${y}, ${C})`}else{const y=a[2],C=a[1]!==void 0?a[1]:"1";if(y)try{const S=(0,b.colorStringToRgbaArray)(a[0]);S&&S.length>=3?e=`rgba(${(0,b.getRgbTone)(S.slice(0,3).join(", "),y)}, ${C})`:e=a[0]}catch{e=a[0]}else e=a[0]}}}if((0,c.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,c.isObject)(e)){const u={};for(const a in e)a!=="var"&&(u[a]=A(e[a],t,a.slice(0,1)==="@"?a.slice(1):a));return r.useVariable&&E(u,"color",t,r),u}const f=`--${r.varPrefix?r.varPrefix+"-":""}color-${t}`+(s?`-${s}`:"");let l=e.value||e;if((0,c.isString)(l)&&!l.includes("(")&&!l.startsWith("#")){const u=(0,b.parseColorToken)(l);if(u&&u.name&&!u.passthrough&&!u.cssVar){const a=r.color[u.name];if(a&&!a.value&&!a.rgb&&((0,c.isString)(a)||(0,c.isArray)(a)||(0,c.isObject)(a))&&!V.has(u.name)){V.add(u.name);try{r.color[u.name]=A(a,u.name)}finally{V.delete(u.name)}}const p=r.color[u.name];if(p&&p.rgb){let y=p.rgb;u.tone&&(y=(0,b.getRgbTone)(y,u.tone));const C=u.alpha!==void 0?parseFloat(u.alpha):p.alpha!==void 0?p.alpha:1;l=`rgba(${y}, ${C})`}}}const m=(0,b.colorStringToRgbaArray)(l),[d,o,h,i=1]=m,g=parseFloat(i.toFixed(2)),k=`${d}, ${o}, ${h}`,$=`rgba(${k}, ${g})`;return r.useVariable&&(r.cssVars[f]=$),{var:f,rgb:k,alpha:g,value:$}},P=(e,t,s)=>{const r=(0,R.getActiveConfig)();if((0,c.isObject)(e)&&e.value!==void 0&&e.var!==void 0)return r.useVariable&&(r.cssVars[e.var]=e.value),e;if((0,c.isString)(e)&&(0,b.isCSSVar)(e)&&(e=w(e.slice(2))),(0,c.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,c.isObject)(e)){const l={};for(const m in e)m!=="var"&&(l[m]=P(e[m],t,m.slice(0,1)==="@"?m.slice(1):m));return r.useVariable&&E(l,"gradient",t,r),l}const f=`--${r.varPrefix?r.varPrefix+"-":""}gradient-${t}`+(s?`-${s}`:"");return r.useVariable&&(r.cssVars[f]=e.value||e),{var:f,value:e.value||e}};
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var g=(t,o)=>{for(var r in o)l(t,r,{get:o[r],enumerable:!0})},O=(t,o,r,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of y(o))!S.call(t,s)&&s!==r&&l(t,s,{get:()=>o[s],enumerable:!(i=p(o,s))||i.enumerable});return t};var h=t=>O(l({},"__esModule",{value:!0}),t);var D={};g(D,{getFontFamily:()=>C,setFont:()=>A,setFontFamily:()=>I});module.exports=h(D);var c=require("@symbo.ls/utils"),u=require("@symbo.ls/utils"),F=require("../factory.js"),e=require("../utils/index.js");const A=(t,o)=>{const r=(0,F.getActiveConfig)(),i=`--font-${o}`;if(!t||(0,c.isArray)(t)&&!t[0])return;let s;if(t.isVariable){const n=(0,e.resolveFileUrl)(t.url,r.files)||t.url;(0,e.isGoogleFontsUrl)(n)?s=(0,e.setFontImport)(n):s=(0,e.setCustomFontMedia)(o,n,t.fontWeight,{fontStretch:t.fontStretch,fontDisplay:t.fontDisplay||"swap"})}else if(t[0])s=(0,e.getFontFaceEach)(o,t,r.files);else{const n=Array.isArray(t.url)?t.url.map(f=>(0,e.resolveFileUrl)(f,r.files)||f):(0,e.resolveFileUrl)(t.url,r.files)||t.url;s=(0,e.setCustomFontMedia)(o,n,t.fontWeight,{fontStyle:t.fontStyle,fontDisplay:t.fontDisplay,fontStretch:t.fontStretch})}return{var:i,value:t,fontFace:s}},C=(t,o)=>{const r=(0,F.getActiveConfig)(),{fontFamily:i}=r;return(0,e.getDefaultOrFirstKey)(o||i,t)},I=(t,o)=>{const r=(0,F.getActiveConfig)(),{fontFamily:i,fontFamilyTypes:s}=r;let{value:n,type:f}=t;t.isDefault&&(!t.isSystemFallback||!i.default)&&(i.default=o),(0,c.isObject)(n)&&(n=(0,u.arrayzeValue)(n));const m=`--font-family-${o}`,a=`${n.join(", ")}, ${s[f]}`;return{var:m,value:a,arr:n,type:f}};
1
+ "use strict";var c=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},O=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of p(e))!S.call(t,s)&&s!==r&&c(t,s,{get:()=>e[s],enumerable:!(i=y(e,s))||i.enumerable});return t};var h=t=>O(c({},"__esModule",{value:!0}),t);var D={};g(D,{getFontFamily:()=>C,setFont:()=>A,setFontFamily:()=>I});module.exports=h(D);var l=require("@symbo.ls/utils"),u=require("@symbo.ls/utils"),F=require("../factory.js"),o=require("../utils/index.js");const A=(t,e)=>{const r=(0,F.getActiveConfig)(),i=`--font-${e}`;if(!t||(0,l.isArray)(t)&&!t[0])return;let s;if(t.isVariable){const n=(0,o.resolveFileUrl)(t.url,r.files)||t.url;(0,o.isGoogleFontsUrl)(n)?s=(0,o.setFontImport)(n):s=(0,o.setCustomFontMedia)(e,n,t.fontWeight,{fontStretch:t.fontStretch,fontDisplay:t.fontDisplay||"swap"})}else if(t[0])s=(0,o.getFontFaceEach)(e,t,r.files);else{const n=Array.isArray(t.url)?t.url.map(f=>(0,o.resolveFileUrl)(f,r.files)||f):(0,o.resolveFileUrl)(t.url,r.files)||t.url;s=(0,o.setCustomFontMedia)(e,n,t.fontWeight,{fontStyle:t.fontStyle,fontDisplay:t.fontDisplay,fontStretch:t.fontStretch})}return{var:i,value:t,fontFace:s}},C=(t,e)=>{const r=(0,F.getActiveConfig)(),{fontFamily:i}=r;return(0,o.getDefaultOrFirstKey)(e||i,t)},I=(t,e)=>{const r=(0,F.getActiveConfig)(),{fontFamily:i,fontFamilyTypes:s}=r;let{value:n,type:f}=t;t.isDefault&&(!t.isSystemFallback||!i.default)&&(i.default=e),(0,l.isObject)(n)&&(n=(0,u.arrayzeValue)(n));const a=`--font-family-${e}`,m=`${n.join(", ")}, ${s[f]}`;return{var:a,value:m,arr:n,type:f,isSystemFallback:!!t.isSystemFallback}};
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var p=(e,t,m,x)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of i(t))!u.call(e,f)&&f!==m&&s(e,f,{get:()=>t[f],enumerable:!(x=c(t,f))||x.enumerable});return e},o=(e,t,m)=>(p(e,t,"default"),m&&p(m,t,"default"));var a=e=>p(s({},"__esModule",{value:!0}),e);var r={};module.exports=a(r);o(r,require("./color.js"),module.exports);o(r,require("./ink.js"),module.exports);o(r,require("./theme.js"),module.exports);o(r,require("./font.js"),module.exports);o(r,require("./typography.js"),module.exports);o(r,require("./spacing.js"),module.exports);o(r,require("./shape.js"),module.exports);o(r,require("./shadow.js"),module.exports);o(r,require("./timing.js"),module.exports);o(r,require("./document.js"),module.exports);o(r,require("./svg.js"),module.exports);o(r,require("./reset.js"),module.exports);
1
+ "use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var p=(e,t,m,x)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of i(t))!u.call(e,f)&&f!==m&&s(e,f,{get:()=>t[f],enumerable:!(x=c(t,f))||x.enumerable});return e},o=(e,t,m)=>(p(e,t,"default"),m&&p(m,t,"default"));var a=e=>p(s({},"__esModule",{value:!0}),e);var r={};module.exports=a(r);o(r,require("./color.js"),module.exports);o(r,require("./ink.js"),module.exports);o(r,require("./theme.js"),module.exports);o(r,require("./font.js"),module.exports);o(r,require("./typography.js"),module.exports);o(r,require("./spacing.js"),module.exports);o(r,require("./shape.js"),module.exports);o(r,require("./shadow.js"),module.exports);o(r,require("./border.js"),module.exports);o(r,require("./timing.js"),module.exports);o(r,require("./document.js"),module.exports);o(r,require("./svg.js"),module.exports);o(r,require("./reset.js"),module.exports);
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var S=(i,t)=>{for(var o in t)u(i,o,{get:t[o],enumerable:!0})},A=(i,t,o,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of x(t))!F.call(i,r)&&r!==o&&u(i,r,{get:()=>t[r],enumerable:!(e=w(t,r))||e.enumerable});return i};var k=i=>A(u({},"__esModule",{value:!0}),i);var C={};S(C,{applyReset:()=>z});module.exports=k(C);var m=require("@symbo.ls/utils"),d=require("../factory.js"),h=require("./theme.js");const z=(i={})=>{const t=(0,d.getActiveConfig)(),{reset:o,typography:e,document:r}=t;if(o){if(o[":root"]){const a=o,n=e.templates;a.body={...t.useDocumentTheme?(0,h.getMediaTheme)("document"):{},...n.body},a.h1=n.h1,a.h2=n.h2,a.h3=n.h3,a.h4=n.h4,a.h5=n.h5,a.h6=n.h6}const{body:p,...b}=e.templates,f=t.useDocumentTheme?(0,h.getMediaTheme)("document"):{};if(o.html&&(0,m.overwriteDeep)(o.html,f),e.unit){const{media:a}=t;for(const n in e){if(n.charAt(0)!=="@")continue;const s=e[n];if(!s||s.unit===e.unit||!s.unit)continue;const g=s.unit,y=s.base||e.base,D=s.browserDefault||e.browserDefault,T=n.slice(1),l=a[T];if(!l)continue;const c="@media "+(l==="print"?l:"screen and "+l);o[c]||(o[c]={}),o[c].html||(o[c].html={}),o[c].html.fontSize=y/D+g}}return(0,m.deepMerge)((0,m.merge)(o,i),{html:{position:"absolute",width:"100%",height:"100%",top:"0",left:"0",margin:"0",WebkitFontSmoothing:"subpixel-antialiased",scrollBehavior:"smooth",...f,fontSize:e.unit?e.base/e.browserDefault+e.unit:e.browserDefault+"px",fontFamily:r.fontFamily,lineHeight:r.lineHeight},body:{boxSizing:"border-box",height:"100%",margin:0,fontFamily:r.fontFamily,fontSize:e.unit?"1"+t.unit.default:e.base/e.browserDefault+t.unit.default,...b,...p},a:{color:"currentColor"},button:{color:"inherit",font:"inherit",background:"transparent",border:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none"},"input, select, textarea":{color:"inherit",font:"inherit"},fieldset:{border:0,padding:0,margin:0}})}};
1
+ "use strict";var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var S=(i,t)=>{for(var e in t)u(i,e,{get:t[e],enumerable:!0})},A=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of x(t))!F.call(i,o)&&o!==e&&u(i,o,{get:()=>t[o],enumerable:!(s=w(t,o))||s.enumerable});return i};var k=i=>A(u({},"__esModule",{value:!0}),i);var C={};S(C,{applyReset:()=>z});module.exports=k(C);var a=require("@symbo.ls/utils"),d=require("../factory.js"),h=require("./theme.js");const z=(i={})=>{const t=(0,d.getActiveConfig)(),e=t.typography||{},s=t.document||{},o=(0,a.isObject)(t.reset)?t.reset:t.reset={};if(o[":root"]){const r=o,n=e.templates||{};r.body={...t.useDocumentTheme?(0,h.getMediaTheme)("document"):{},...n.body},r.h1=n.h1,r.h2=n.h2,r.h3=n.h3,r.h4=n.h4,r.h5=n.h5,r.h6=n.h6}const{body:p,...b}=e.templates||{},f=t.useDocumentTheme?(0,h.getMediaTheme)("document"):{};if(o.html&&(0,a.overwriteDeep)(o.html,f),e.unit){const r=t.media||{};for(const n in e){if(n.charAt(0)!=="@")continue;const c=e[n];if(!c||c.unit===e.unit||!c.unit)continue;const g=c.unit,y=c.base||e.base,D=c.browserDefault||e.browserDefault,T=n.slice(1),l=r[T];if(!l)continue;const m="@media "+(l==="print"?l:"screen and "+l);o[m]||(o[m]={}),o[m].html||(o[m].html={}),o[m].html.fontSize=y/D+g}}return(0,a.deepMerge)((0,a.merge)(o,i),{html:{position:"absolute",width:"100%",height:"100%",top:"0",left:"0",margin:"0",WebkitFontSmoothing:"subpixel-antialiased",scrollBehavior:"smooth",...f,fontSize:e.unit?e.base/e.browserDefault+e.unit:e.browserDefault+"px",fontFamily:s.fontFamily,lineHeight:s.lineHeight},body:{boxSizing:"border-box",height:"100%",margin:0,fontFamily:s.fontFamily,fontSize:e.unit?"1"+t.unit.default:e.base/e.browserDefault+t.unit.default,...b,...p},a:{color:"currentColor"},button:{color:"inherit",font:"inherit",background:"transparent",border:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none"},"input, select, textarea":{color:"inherit",font:"inherit"},fieldset:{border:0,padding:0,margin:0}})};
@@ -1 +1 @@
1
- "use strict";var h=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var j=(r,n)=>{for(var i in n)h(r,i,{get:n[i],enumerable:!0})},A=(r,n,i,d)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of V(n))!g.call(r,s)&&s!==i&&h(r,s,{get:()=>n[s],enumerable:!(d=O(n,s))||d.enumerable});return r};var $=r=>A(h({},"__esModule",{value:!0}),r);var N={};j(N,{getShadow:()=>x,setShadow:()=>S});module.exports=$(N);var w=require("../factory.js"),u=require("./color.js"),l=require("./spacing.js"),f=require("../utils/color.js"),c=require("@symbo.ls/utils");const S=(r,n,i,d)=>{const s=(0,w.getActiveConfig)();if((0,c.isArray)(r)){const o={"@light":S(r[0],n,"light"),"@dark":S(r[1],n,"dark")};return s.useVariable&&(0,u.setAdaptiveSchemeVar)(o,"shadow",n,s),o}if((0,c.isObject)(r)){const o={};for(const t in r)o[t]=S(r[t],n,t.startsWith("@")?t.slice(1):t);return s.useVariable&&(0,u.setAdaptiveSchemeVar)(o,"shadow",n,s),o}(0,c.isString)(r)&&!f.CSS_NATIVE_COLOR_REGEX.test(r)&&(r=(0,f.splitTopLevelCommas)(r).map(o=>(o=o.trim(),o.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const a=(0,u.getColor)(t);if((0,f.isResolvedColor)(a))return a;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none")return t;const p=(0,l.getSpacingByKey)(t,"shadow");return p&&p.shadow?p.shadow:t}).join(" "))).join(", "));const m=`--${s.varPrefix?s.varPrefix+"-":""}shadow-${n}`+(i?`-${i}`:"");return s.useVariable&&(s.cssVars[m]=r),{var:m,value:r}},x=(r,n)=>{const i=(0,w.getActiveConfig)();if(n||(n=i.globalTheme==="auto"?null:i.globalTheme),!(0,c.isString)(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if((0,f.isCSSVar)(r))return`var(${r})`;const[d]=(0,c.isArray)(r)?r:r.split(" "),e=i.shadow[d],m=(0,c.isObject)(e);if(!e)return i.verbose&&console.warn("Can't find color ",d),r;if(n){const o=e["@"+n]||e[n];if(o)return o.value!==void 0?o.value:o;i.verbose&&console.warn(r," - does not have ",n)}if(m&&e.value)return e.value;if(m){const o={};for(const t in e){if(t.charCodeAt(0)!==64)continue;const a=i.media[t.slice(1)];if(!a)continue;const p="@media "+(a==="print"?`${a}`:`screen and ${a}`),C=e[t],b=C&&(C.value!==void 0?C.value:C);b!==void 0&&(o[p]=b)}return o}return i.verbose&&console.warn("Can't find color",r),r};
1
+ "use strict";var h=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var A=(r,i)=>{for(var n in i)h(r,n,{get:i[n],enumerable:!0})},$=(r,i,n,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of j(i))!l.call(r,t)&&t!==n&&h(r,t,{get:()=>i[t],enumerable:!(e=g(i,t))||e.enumerable});return r};var x=r=>$(h({},"__esModule",{value:!0}),r);var W={};A(W,{getShadow:()=>N,resolveShadowValue:()=>V,setShadow:()=>S});module.exports=x(W);var C=require("../factory.js"),p=require("./color.js"),b=require("./spacing.js"),d=require("../utils/color.js"),c=require("@symbo.ls/utils");const V=(r,i,n)=>!(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.getColor)(t,i);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;n&&n(t);const f=(0,b.getSpacingByKey)(t,"shadow");return f&&f.shadow?f.shadow:t}).join(" "))).join(", "),S=(r,i,n,e)=>{const t=(0,C.getActiveConfig)();if((0,c.isArray)(r)){const o={"@light":S(r[0],i,"light"),"@dark":S(r[1],i,"dark")};return t.useVariable&&(0,p.setAdaptiveSchemeVar)(o,"shadow",i,t),o}if((0,c.isObject)(r)){const o={};for(const a in r)o[a]=S(r[a],i,a.startsWith("@")?a.slice(1):a);return t.useVariable&&(0,p.setAdaptiveSchemeVar)(o,"shadow",i,t),o}(0,c.isString)(r)&&!d.CSS_NATIVE_COLOR_REGEX.test(r)&&(r=V(r));const f=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${i}`+(n?`-${n}`:"");return t.useVariable&&(t.cssVars[f]=r),{var:f,value:r}},N=(r,i)=>{const n=(0,C.getActiveConfig)();if(i||(i=n.globalTheme==="auto"?null:n.globalTheme),!(0,c.isString)(r)){n.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=n.shadow[e],f=(0,c.isObject)(s);if(!s)return n.verbose&&console.warn("Can't find color ",e),r;if(i){const o=s["@"+i]||s[i];if(o)return o.value!==void 0?o.value:o;n.verbose&&console.warn(r," - does not have ",i)}if(f&&s.value)return s.value;if(f){const o={};for(const a in s){if(a.charCodeAt(0)!==64)continue;const m=n.media[a.slice(1)];if(!m)continue;const O="@media "+(m==="print"?`${m}`:`screen and ${m}`),u=s[a],w=u&&(u.value!==void 0?u.value:u);w!==void 0&&(o[O]=w)}return o}return n.verbose&&console.warn("Can't find color",r),r};
@@ -1 +1 @@
1
- "use strict";var j=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var K=(e,r)=>{for(var o in r)j(e,o,{get:r[o],enumerable:!0})},B=(e,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of z(r))!D.call(e,n)&&n!==o&&j(e,n,{get:()=>r[n],enumerable:!(s=N(r,n))||s.enumerable});return e};var W=e=>B(j({},"__esModule",{value:!0}),e);var G={};K(G,{getMediaTheme:()=>w,getTheme:()=>A,setMediaTheme:()=>R,setTheme:()=>Y});module.exports=W(G);var S=require("./color.js"),k=require("../factory.js"),V=require("../utils/color.js"),l=require("@symbo.ls/utils");const Z=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"]),x=["color","Color","background","Background","fill","Fill","stroke","Stroke"],J=e=>{for(let r=0;r<x.length;r++)if(e.includes(x[r]))return!0;return!1},T=e=>{const r={},{state:o,media:s,helpers:n,...c}=e;return Object.keys(c).map(f=>{const i=["color","Color","background","border"].some(u=>f.includes(u));return r[f]=i?(0,S.getColor)(e[f]):e[f]}),r},y=e=>(e.value||(e.value=T(e)),e.value),A=(e,r)=>{const o=(0,k.getActiveConfig)();if(o.useVariable)return w(e,r);const s=o.theme;if((0,l.isString)(e)){const[n,c]=e.split(" "),t=s[n];if(t){if(!c&&!r)return y(t);e=[n,c||r]}}if((0,l.isObjectLike)(e)&&e[1]){const n=e[0],c=e[1],{helpers:t,media:f,state:a}=s[n];if(f&&f[c])return y(f[c]);if(t&&t[c])return y(t[c]);if(a&&a[c])return y(a[c])}else if((0,l.isObject)(e))return T(e)},Q=(e,r,o)=>{if((0,l.isObject)(r))e.variants.inverse.value=T(r);else if(r===!0){const{color:s,background:n}=o;e.variants.inverse={value:{color:n,background:s}}}},U=(e,r,o,s)=>{const n=A(o);s[`&:${r}`]=n,(0,l.isObject)(o)&&!o.value&&(o.value=n)},E=(e,r)=>{const{state:o}=e;return o?(Object.keys(o).map(n=>{const c=o[n];return U(e,n,c,r),e}),e):void 0},X=(e,r,o,s)=>{const n=A(o);s[`@media (prefers-color-scheme: ${r})`]=n,(0,l.isObject)(o)&&!o.value&&(o.value=n)},P=(e,r)=>{const{media:o}=e;return o?(Object.keys(o).map(n=>{const c=o[n];return(n==="dark"||n==="light")&&X(e,n,c,r),n==="inverse"&&Q(e,c,r),e}),e):void 0},_=(e,r)=>{const o=(0,k.getActiveConfig)(),{helpers:s}=e;return s?(Object.keys(s).map(c=>{const t=s[c];return(0,l.isString)(t)?s[c]=o.theme[t]:y(s[c]),e}),e):void 0},Y=(e,r)=>{const o=(0,k.getActiveConfig)();if(o.useVariable)return R(e,r);const{state:s,media:n,helpers:c}=e,t=T(e,r),a=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}`;return E(e,t),P(e,t),_(e,t),{var:a,value:t,state:s,media:n,helpers:c}},re={"@":(e,r)=>P(e,r),":":(e,r)=>E(e,r),".":(e,r)=>_(e,r)},v=(e,r,o)=>{const{cssVars:s}=o;o.cssMediaVars||(o.cssMediaVars={});const n=o.cssMediaVars,c=o.globalTheme!==void 0?o.globalTheme:"auto",t={},f=new Set;for(const i in e)if(e[i])for(const u of Object.keys(e[i]))f.add(u);const a=new Set;for(const i of f){const u=i.slice(0,1);if(!(u==="@"||u==="."||u===":")&&J(i))for(const m in e){if(a.has(m))continue;const h=e[m]?.[i];if(h===void 0)continue;const d=(0,S.getColor)(h,`@${m}`);d!==void 0&&(0,l.isString)(d)&&/^[a-z][a-zA-Z]+$/.test(d)&&!Z.has(d)&&a.add(m)}}for(const i of f){const u=i.slice(0,1),m=Object.values(e).some(h=>(0,l.isObjectLike)(h?.[i]));if(u==="."&&m){const h=i.slice(1),d={};for(const b in e)(0,l.isObjectLike)(e[b]?.[i])&&(d[b]=e[b][i]);t[i]=v(d,`${r}-${h}`,o)}else if(u===":"&&m){const h=i.replace(/^:+/,""),d={};for(const b in e)(0,l.isObjectLike)(e[b]?.[i])&&(d[b]=e[b][i]);t[i]=v(d,`${r}-${h}`,o)}else if(u!=="@"&&u!=="."&&u!==":"){const d=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}-${i}`,b=c&&c!=="auto"?String(c).replace(/^'|'$/g,""):null;let p;for(const g in e){if(a.has(g))continue;const q=e[g]?.[i];if(q===void 0)continue;const $=(0,S.getColor)(q,`@${g}`);if($===void 0)continue;(b&&g===b||!b&&(g==="light"||p===void 0))&&(p=$);const C=`[data-theme="${g}"]`;if(n[C]||(n[C]={}),n[C][d]=$,g==="dark"||g==="light"){const M=`@media (prefers-color-scheme: ${g})`;n[M]||(n[M]={}),n[M][d]=$}}p!==void 0&&(s[d]=p),t[i]=`var(${d})`,t[`.${i}`]={[i]:t[i]}}}return(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color}),t},R=(e,r,o,s)=>{const n=(0,k.getActiveConfig)(),{cssVars:c}=n,t={value:e},f=!o&&!s;if((0,l.isObjectLike)(e)){if(f&&n.useVariable){const a={};for(const i in e)i.startsWith("@")&&(0,l.isObjectLike)(e[i])&&(a[i.slice(1)]=e[i]);if(Object.keys(a).length){const i=v(a,r,n);Object.assign(t,i)}}for(const a in e){const i=a.slice(0,1),u=e[a];if(i==="@"||i===":"||i==="."){const m=i==="@"&&a;t[a]=R(u,r,a,s||m)}else if(!f){const m=(0,S.getColor)(u,s),h=[...new Set([s,o].filter(g=>g).map(g=>g.slice(1)))],d=h.length?"-"+h.join("-"):"",p=`--${n.varPrefix?n.varPrefix+"-":""}theme-${r}${d}-${a}`;n.useVariable?(n.useThemeSuffixedVars&&(c[p]=m),t[a]=`var(${p})`):t[a]=m,t[`.${a}`]={[a]:t[a]}}}!t[".inversed"]&&(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color})}if((0,l.isString)(e)&&(0,V.isCSSVar)(e)){const i=n.theme[e.slice(2)];return w(i,s)}return t},O=e=>{const r=(0,k.getActiveConfig)(),o={};for(const s in e){const n=s.slice(0,1);if((0,l.isObjectLike)(e[s])){if(n==="@")continue;n===":"?o[`&${s}`]=O(e[s]):n==="."&&(o[`&${s}`]=O(e[s]))}else o[s]=e[s]}return o},H=(e,r)=>{const o=r.shift();return e[o]?H(e[o],r):e},L=(e,r)=>(0,l.isArray)(r)?H(e,r):(0,l.isString)(r)&&e[r]?e[r]:e,F=(e,r)=>(0,l.isString)(e)&&(0,V.isCSSVar)(e)?w(e.slice(2)):e,I=e=>F(e,I),w=(e,r)=>{const o=(0,k.getActiveConfig)();if((0,l.isString)(e)&&(0,V.isCSSVar)(e)&&(e=w(e.slice(2))),!e||!(0,l.isString)(e)){o.verbose&&console.warn(`${e} - Theme is not a string`);return}const[s,...n]=(0,l.isArray)(e)?e:e.split(" ");let c=o.theme[s];return c&&n.length?c=L(c,n):c&&r&&(c=L(c,r)),O(c)};
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 +1 @@
1
- "use strict";var p=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var R=(t,e)=>{for(var n in e)p(t,n,{get:e[n],enumerable:!0})},O=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of B(e))!C.call(t,r)&&r!==n&&p(t,r,{get:()=>e[r],enumerable:!(i=j(e,r))||i.enumerable});return t};var T=t=>O(p({},"__esModule",{value:!0}),t);var y={};R(y,{resolveColorsInGradient:()=>x,splitTransition:()=>K,transformBackgroundImage:()=>V,transformBorder:()=>z,transformBorderRadius:()=>w,transformBoxShadow:()=>G,transformDuration:()=>D,transformShadow:()=>A,transformSize:()=>h,transformSizeRatio:()=>W,transformTextStroke:()=>$,transformTransition:()=>g,transfromGap:()=>_});module.exports=T(y);var a=require("@symbo.ls/utils"),S=require("../factory.js"),o=require("../system/index.js"),s=require("../utils/index.js");const b=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),E=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),I=t=>b.has(t),z=t=>{const e=t+"";if(s.CSS_NATIVE_COLOR_REGEX.test(e))return e;const n=e.trim();return n==="none"||n==="0"||n==="initial"||n==="inherit"||n==="unset"?e:e.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if((0,s.isCSSVar)(r))return`var(${r})`;if(I(r)||/^\d/.test(r)||r==="0")return r;const u=(0,o.getColor)(r);if((0,s.isResolvedColor)(u))return u;const c=(0,o.getSpacingByKey)(r,"border");return c&&c.border?c.border:r}).join(" ")},$=t=>s.CSS_NATIVE_COLOR_REGEX.test(t)?t:t.split(/\s+/).map(e=>{if(e=e.trim(),!e)return"";if((0,s.isCSSVar)(e))return`var(${e})`;if(/^\d/.test(e)||e.includes("px")||e==="0")return e;const n=(0,o.getColor)(e);return(0,s.isResolvedColor)(n)?n:e}).join(" "),A=(t,e)=>(0,o.getShadow)(t,e),G=(t,e)=>s.CSS_NATIVE_COLOR_REGEX.test(t)?t:(0,s.splitTopLevelCommas)(t).map(n=>(n=n.trim(),n?n.split(/\s+/).map(i=>{if(i=i.trim(),!i)return"";if((0,s.isCSSVar)(i))return`var(${i})`;if(i==="inset"||i==="none")return i;const r=(0,o.getColor)(i);if((0,s.isResolvedColor)(r)){const c=(0,o.getMediaColor)(i,e);return(0,a.isObject)(c)?Object.values(c).filter(d=>d.includes(": "+e))[0]:c}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const u=(0,o.getSpacingByKey)(i,"shadow");return u&&u.shadow?u.shadow:i}).join(" "):"")).join(", "),x=(t,e)=>{const n=t.indexOf("(");if(n===-1)return t;const i=t.slice(0,n+1),r=t.slice(n+1,t.lastIndexOf(")")),u=")",d=(0,s.splitTopLevelCommas)(r).map(l=>(l=l.trim(),l.split(/\s+/).map(f=>{if(!f||/^\d/.test(f)||f==="0"||E.has(f)||f==="transparent"||s.CSS_NATIVE_COLOR_REGEX.test(f))return f;const m=(0,o.getColor)(f);return(0,s.isResolvedColor)(m)?m:f}).join(" ")));return i+d.join(", ")+u},V=(t,e)=>{const n=(0,S.getActiveConfig)();return(0,s.splitTopLevelCommas)(t).map(i=>{const r=i.trim();if((0,s.isCSSVar)(r))return`var(${r})`;if(/^var\(/.test(r)||r.includes("url"))return r;if(n.gradient?.[r]){const u=(0,o.getMediaColor)(r,e);if((0,a.isString)(u))return u;if((0,a.isObject)(u)){for(const c in u)if((0,a.isString)(u[c]))return u[c]}return r}return r.includes("gradient")?x(r,e):r.includes("/")||r.startsWith("http")||r.includes(".")&&!(0,s.parseColorToken)(r)?`url(${r})`:r}).join(", ")},_=t=>(0,a.isString)(t)&&t.split(" ").map(e=>(0,o.getSpacingByKey)(e,"gap").gap).join(" "),g=t=>{const e=t.split(" ");return e.length?e.map(n=>(0,s.isCSSVar)(n)?`var(${n})`:n.length<3||n.includes("ms")?(0,o.getTimingByKey)(n).timing||n:(0,o.getTimingFunction)(n)?(0,o.getTimingFunction)(n):n).join(" "):t},D=(t,e,n)=>{if((0,a.isString)(t))return t.split(",").map(i=>(0,o.getTimingByKey)(i).timing||i).join(",")},K=t=>{const e=t.split(",");if(e.length)return e.map(g).join(",")};function h(t,e,n={},i={}){let r=a.exec.call(this,e||n[t]);if(r==null)return;let u;if((0,a.isString)(r)){if(/^(?:env|var)\(/.test(r.trim()))return{[t]:r};if(r.includes("(")){const l=(0,s.getFnPrefixAndValue)(r);u=l[0],r=l[1]}const c=n.scaleBoxSize,d=(0,o.checkIfBoxSize)(t);!c&&d&&!i.ratio&&(r=(0,o.splitSpacedValue)(r))}return i.ratio?(0,o.getSpacingBasedOnRatio)(n,t,r,u):(0,o.getSpacingByKey)(r,t,void 0,u)}const W=(t,e=null,n)=>h(t,e,n,{ratio:!0}),w=(t,e,n,i="borderRadius")=>{if((0,a.isString)(t))return{[i]:t.split(" ").map(r=>{const u=(0,o.getShapeByKey)(r);return u!==void 0?u:(0,o.getSpacingBasedOnRatio)(e,n,r)[n]}).join(" ")}};
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 +1 @@
1
- "use strict";var x=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var E=(t,n)=>{for(var r in n)x(t,r,{get:n[r],enumerable:!0})},F=(t,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of L(n))!k.call(t,e)&&e!==r&&x(t,e,{get:()=>n[e],enumerable:!(s=_(n,e))||s.enumerable});return t};var A=t=>F(x({},"__esModule",{value:!0}),t);var B={};E(B,{CSS_NATIVE_COLOR_REGEX:()=>R,changeLightness:()=>V,colorStringToRgbaArray:()=>m,compositeOverBackdrop:()=>W,contrastRatio:()=>K,getColorShade:()=>w,getRgbTone:()=>Y,hexToRgb:()=>H,hexToRgbArray:()=>b,hexToRgba:()=>j,hslToRgb:()=>T,isCSSVar:()=>S,isResolvedColor:()=>q,linearChannelToSrgb:()=>$,mixTwoColors:()=>G,mixTwoRgb:()=>P,mixTwoRgba:()=>C,oklabToLinearSrgb:()=>I,oklabToOklch:()=>Q,oklchToGamutSafeSrgb:()=>U,oklchToOklab:()=>O,opacify:()=>z,parseColorToken:()=>Z,relativeLuminance:()=>g,rgbArrayToHex:()=>d,rgbToHSL:()=>M,rgbToHex:()=>N,splitTopLevelCommas:()=>D,srgbChannelToLinear:()=>y,srgbToOklab:()=>J,toLinearChannel:()=>f});module.exports=A(B);var i=require("@symbo.ls/utils");const m=t=>{if(t==="")return[0,0,0,0];if(t.toLowerCase()==="transparent")return[0,0,0,0];if(t[0]==="#")return t.length<7&&(t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+(t.length>4?t[4]+t[4]:"")),[parseInt(t.substr(1,2),16),parseInt(t.substr(3,2),16),parseInt(t.substr(5,2),16),t.length>7?parseInt(t.substr(7,2),16)/255:1];if(t.indexOf("rgb")===-1&&i.document&&i.window){const n=i.document.body.appendChild(i.document.createElement("fictum")),r="rgb(1, 2, 3)";if(n.style.color=r,n.style.color!==r){i.document.body.removeChild(n);return}if(n.style.color=t,n.style.color===r||n.style.color==="")return i.document.body.removeChild(n),[0,0,0,0];t=i.window.getComputedStyle(n).color,i.document.body.removeChild(n)}return t.indexOf("rgb")===0?(t.indexOf("rgba")===-1&&(t=`${t}, 1`),t.match(/[\.\d]+/g).map(n=>+n)):[0,0,0,0]},G=(t,n,r=.5)=>(t=m(t),n=m(n),C(t,n,r)),H=(t,n=1)=>{const[r,s,e]=t.match(/\w\w/g).map(o=>parseInt(o,16));return`rgb(${r},${s},${e})`},b=(t,n=1)=>{const[r,s,e]=t.match(/\w\w/g).map(o=>parseInt(o,16));return[r,s,e]},N=(t,n,r)=>"#"+(1<<24|t<<16|n<<8|r).toString(16).slice(1),d=([t,n,r])=>((1<<24)+(t<<16)+(n<<8)+r).toString(16).slice(1),j=(t,n=1)=>{const[r,s,e]=t.match(/\w\w/g).map(o=>parseInt(o,16));return`rgba(${r},${s},${e},${n})`},P=(t,n,r=.5)=>{const s=[];for(let e=0;e<3;e++)s[e]=~~(t[e]+(n[e]-t[e])*r);return`rgb(${s})`},V=(t,n)=>{const[r,s,e]=n,o=Math.max(0,Math.min(100,e+parseFloat(t)));return[r,s,o]},M=(t,n,r)=>{const s=Math.max(t,n,r),e=s-Math.min(t,n,r),o=1-Math.abs(s+s-e-1),a=e&&(s==t?(n-r)/e:s==n?2+(r-t)/e:4+(t-n)/e);return[60*(a<0?a+6:a),o?e/o:0,(s+s-e)/2]},T=(t,n,r,s=n*Math.min(r,1-r),e=(o,a=(o+t/30)%12)=>r-s*Math.max(Math.min(a-3,9-a,1),-1))=>[e(0),e(8),e(4)],w=(t,n)=>{const r=parseInt(t,16);let s=(r>>16)+n;s>255?s=255:s<0&&(s=0);let e=(r>>8&255)+n;e>255?e=255:e<0&&(e=0);let o=(r&255)+n;return o>255?o=255:o<0&&(o=0),((o|e<<8|s<<16)+16777216).toString(16).slice(1)},C=(t,n,r=.5)=>{const s=[];for(let e=0;e<4;e++){const o=e===3?a=>a:Math.round;s[e]=o(t[e]+(n[e]-t[e])*r)}return`rgba(${s})`},z=(t,n)=>{const r=m(t);if(!r){(0,i.isNotProduction)()&&console.warn(t+" color is not rgba");return}return r[3]=n,`rgba(${r})`},S=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45,R=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,X=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,Z=t=>{if(!(0,i.isString)(t))return null;if(R.test(t))return{passthrough:t};if(S(t))return{cssVar:t};const n=t.match(X);if(!n)return null;const[,r,s,e]=n,o=s!==void 0?`0.${s}`:void 0,a=e&&e[0]==="="?e.slice(1):e;return{name:r,alpha:o,tone:a}},q=t=>(0,i.isString)(t)&&(t.includes("rgb")||t.includes("var(")||t.includes("#")),D=t=>{const n=[];let r="",s=0;for(const e of t){if(e==="("?s+=1:e===")"&&s>0&&(s-=1),e===","&&s===0){n.push(r),r="";continue}r+=e}return(r.length||!n.length)&&n.push(r),n},f=t=>(t/=255,t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)),g=t=>.2126*f(t[0])+.7152*f(t[1])+.0722*f(t[2]),K=(t,n)=>{const r=g(t)+.05,s=g(n)+.05;return r>s?r/s:s/r},y=t=>(t/=255,t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)),$=t=>(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*255,J=([t,n,r])=>{const[s,e,o]=[t,n,r].map(y),a=.4122214708*s+.5363325363*e+.0514459929*o,c=.2119034982*s+.6806995451*e+.1073969566*o,h=.0883024619*s+.2817188376*e+.6299787005*o,p=Math.cbrt(a),u=Math.cbrt(c),l=Math.cbrt(h);return[.2104542553*p+.793617785*u-.0040720468*l,1.9779984951*p-2.428592205*u+.4505937099*l,.0259040371*p+.7827717662*u-.808675766*l]},I=([t,n,r])=>{const s=t+.3963377774*n+.2158037573*r,e=t-.1055613458*n-.0638541728*r,o=t-.0894841775*n-1.291485548*r,a=s**3,c=e**3,h=o**3;return[4.0767416621*a-3.3077115913*c+.2309699292*h,-1.2684380046*a+2.6097574011*c-.3413193965*h,-.0041960863*a-.7034186147*c+1.707614701*h]},Q=([t,n,r])=>{let s=Math.atan2(r,n)*180/Math.PI;return s<0&&(s+=360),[t,Math.sqrt(n*n+r*r),s]},O=([t,n,r])=>{const s=r*Math.PI/180;return[t,n*Math.cos(s),n*Math.sin(s)]},U=(t,n,r,s=24)=>{const e=c=>I(O([t,c,r])),o=c=>c.every(h=>h>=-1e-4&&h<=1.0001);let a=e(n);if(!o(a)){let c=0,h=n;for(let p=0;p<s;p++){const u=(c+h)/2;o(e(u))?c=u:h=u}a=e(c)}return a.map(c=>$(Math.max(0,Math.min(1,c))))},W=(t,n=1,r=[255,255,255])=>n>=1?t:t.map((s,e)=>s*n+r[e]*(1-n)),Y=(t,n)=>{(0,i.isString)(t)&&t.includes("rgb")&&(t=m(t).join(", ")),(0,i.isString)(t)&&(t=t.split(",").map(e=>parseFloat(e.trim()))),(0,i.isNumber)(n)&&(n+="");const r=d(t),s=n.slice(0,1);if(s==="-"||s==="+"){const e=w(r,parseFloat(n));return b(e).join(", ")}else{const[e,o,a]=t,[c,h]=M(e/255,o/255,a/255),p=Math.max(0,Math.min(100,parseFloat(n)))/100;return T(c,h,p).map(l=>Math.round(Math.max(0,Math.min(1,l))*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,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,9 +1,9 @@
1
- "use strict";var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var j=(t,r)=>{for(var n in r)p(t,n,{get:r[n],enumerable:!0})},O=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of U(r))!b.call(t,s)&&s!==n&&p(t,s,{get:()=>r[s],enumerable:!(o=v(r,s))||o.enumerable});return t};var C=t=>O(p({},"__esModule",{value:!0}),t);var V={};j(V,{getDefaultOrFirstKey:()=>W,getFontFace:()=>E,getFontFaceEach:()=>m,getFontFaceEachString:()=>D,getFontFaceString:()=>M,getFontFormat:()=>$,isGoogleFontsUrl:()=>S,resolveFileUrl:()=>a,setCustomFont:()=>y,setCustomFontMedia:()=>i,setFontImport:()=>x,setInCustomFontMedia:()=>d});module.exports=C(V);const a=(t,r)=>{if(!t||!r)return null;try{return new URL(t),null}catch{}const n=r[t];return n?n.content&&n.content.src:null},W=(t,r)=>{if(t[r])return t[r].value;if(t.default)return t[t.default].value;const n=Object.keys(t)[0];return n&&t[n]&&t[n].value},$=t=>{if(typeof t!="string"||!t)return null;const r=t.split(/[#?]/)[0].split(".").pop().trim();return["woff2","woff","ttf","otf","eot"].includes(r)?r:null},S=t=>t&&(t.includes("fonts.googleapis.com")||t.includes("fonts.gstatic.com")),x=t=>`@import url('${t}');`,d=t=>`@font-face { ${t} }`,y=(t,r,n,o={})=>{const l=(Array.isArray(r)?r:[r]).filter(c=>typeof c=="string"&&c).map(c=>{const f=$(c),u=f?` format('${f}')`:"";return`url('${c}')${u}`}).join(`,
1
+ "use strict";var y=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var U=(t,r)=>{for(var n in r)y(t,n,{get:r[n],enumerable:!0})},k=(t,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of j(r))!O.call(t,o)&&o!==n&&y(t,o,{get:()=>r[o],enumerable:!(e=D(r,o))||e.enumerable});return t};var C=t=>k(y({},"__esModule",{value:!0}),t);var M={};U(M,{getDefaultOrFirstKey:()=>W,getFontFace:()=>E,getFontFaceEach:()=>m,getFontFaceEachString:()=>v,getFontFaceString:()=>K,getFontFormat:()=>S,isGoogleFontsUrl:()=>$,resolveFileUrl:()=>a,setCustomFont:()=>i,setCustomFontMedia:()=>p,setFontImport:()=>d,setInCustomFontMedia:()=>x});module.exports=C(M);const a=(t,r)=>{if(!t||!r)return null;try{return new URL(t),null}catch{}const n=r[t];return n?n.content&&n.content.src:null},W=(t,r)=>{if(t[r])return t[r].value;const n=()=>Object.keys(t).find(o=>o!=="default"&&t[o]&&t[o].value&&!t[o].isSystemFallback);if(t.default){const o=t[t.default];if(o&&o.isSystemFallback){const s=n();if(s)return t[s].value}if(o)return o.value}const e=n()||Object.keys(t).find(o=>o!=="default"&&t[o]&&t[o].value);return e&&t[e]&&t[e].value},S=t=>{if(typeof t!="string"||!t)return null;const r=t.split(/[#?]/)[0].split(".").pop().trim();return["woff2","woff","ttf","otf","eot"].includes(r)?r:null},$=t=>t&&(t.includes("fonts.googleapis.com")||t.includes("fonts.gstatic.com")),d=t=>`@import url('${t}');`,x=t=>`@font-face { ${t} }`,i=(t,r,n,e={})=>{const f=(Array.isArray(r)?r:[r]).filter(c=>typeof c=="string"&&c).map(c=>{const l=S(c),u=l?` format('${l}')`:"";return`url('${c}')${u}`}).join(`,
2
2
  `);return`
3
3
  font-family: '${t}';
4
- font-style: ${o.fontStyle||"normal"};${n?`
5
- font-weight: ${n};`:""}${o.fontStretch?`
6
- font-stretch: ${o.fontStretch};`:""}${o.fontDisplay?`
7
- font-display: ${o.fontDisplay};`:""}
8
- src: ${l};`},i=(t,r,n,o)=>`@font-face {${y(t,r,n,o)}
9
- }`,m=(t,r,n)=>Object.keys(r).map(s=>{const{url:e,fontWeight:l,fontStyle:c,fontDisplay:f,fontStretch:u}=r[s],k=Array.isArray(e)?e.map(F=>a(F,n)||F):a(e,n)||e;return y(t,k,l,{fontStyle:c,fontDisplay:f,fontStretch:u})}),E=t=>Object.keys(t).map(n=>m(n,t[n].value)),D=(t,r,n)=>{if(r&&r.isVariable){const e=a(r.url,n)||r.url;return S(e)?x(e):i(t,e,r.fontWeight,{fontStretch:r.fontStretch,fontDisplay:r.fontDisplay||"swap"})}if(r[0])return m(t,r,n).map(d);const s=Array.isArray(r.url)?r.url.map(e=>a(e,n)||e):a(r.url,n)||r.url;return i(t,s,r.fontWeight,{fontStyle:r.fontStyle,fontDisplay:r.fontDisplay,fontStretch:r.fontStretch})},M=(t,r)=>Object.keys(t).map(o=>D(o,t[o].value,r));
4
+ font-style: ${e.fontStyle||"normal"};${n?`
5
+ font-weight: ${n};`:""}${e.fontStretch?`
6
+ font-stretch: ${e.fontStretch};`:""}${e.fontDisplay?`
7
+ font-display: ${e.fontDisplay};`:""}
8
+ src: ${f};`},p=(t,r,n,e)=>`@font-face {${i(t,r,n,e)}
9
+ }`,m=(t,r,n)=>Object.keys(r).map(o=>{const{url:s,fontWeight:f,fontStyle:c,fontDisplay:l,fontStretch:u}=r[o],b=Array.isArray(s)?s.map(F=>a(F,n)||F):a(s,n)||s;return i(t,b,f,{fontStyle:c,fontDisplay:l,fontStretch:u})}),E=t=>Object.keys(t).map(n=>m(n,t[n].value)),v=(t,r,n)=>{if(r&&r.isVariable){const s=a(r.url,n)||r.url;return $(s)?d(s):p(t,s,r.fontWeight,{fontStretch:r.fontStretch,fontDisplay:r.fontDisplay||"swap"})}if(r[0])return m(t,r,n).map(x);const o=Array.isArray(r.url)?r.url.map(s=>a(s,n)||s):a(r.url,n)||r.url;return p(t,o,r.fontWeight,{fontStyle:r.fontStyle,fontDisplay:r.fontDisplay,fontStretch:r.fontStretch})},K=(t,r)=>Object.keys(t).map(e=>v(e,t[e].value,r));
@@ -1 +1 @@
1
- import{getActiveConfig as v,setActiveConfig as G,toCamel as W}from"./factory.js";import{setColor as N,setGradient as H,setFont as Y,setFontFamily as F,setTheme as $,setSvgIcon as z,setSVG as B,applyTypographySequence as U,applySpacingSequence as J,applyReset as K,applyTimingSequence as Q,applyDocument as X,setShadow as Z}from"./system/index.js";import{deepMerge as ee,isObject as I,isArray as O}from"@symbo.ls/utils";import{isDomDocument as P,isHostObject as k,parkHostObject as M,resolveConfigDocument as j}from"./utils/host.js";const te=(t,s)=>{const e=v(),{cssVars:n}=e,i=s.startsWith("--")?s:`--${s}`;return n[i]=t,t},l=t=>t,q={color:N,gradient:H,font:Y,fontFamily:F,fontfamily:F,theme:$,icons:z,semanticIcons:l,semanticicons:l,svg:B,svgData:l,typography:l,shadow:Z,spacing:l,media:l,grid:l,class:l,timing:l,reset:l,unit:l,animation:l,vars:te,sizes:l,shape:l},se=(t,s,e,n)=>{M(t,e,s);const i={};for(const o of n)t[o]===s&&(t[o]=i);return t.verbose&&console.warn("[scratch] design-system family",e,"resolved to a host object; parked it and allocated a plain bucket"),i},oe=(t,s,e)=>{const n=v(),i=W(t),o=i.toLowerCase(),f=n[i]||n[o]||n[t],r=k(f)?se(n,f,o,[i,o,t]):f,d=q[i]||q[o];if(d)try{const c=d(s,e);return r&&(r[e]=c),r}catch(c){n.verbose&&console.warn("Error setting",o,"value",s,e,c)}if(!d){const c=r||(n[o]={});return c[e]=s,c}n.verbose&&console.warn("Can not find",o,"method in scratch")},re=(t,s)=>{const e=v(),n=t.toLowerCase();return k(s)?(M(e,n,s),e.verbose&&console.warn("[scratch] ignoring host object passed as the",n,"design-system family"),e[n]||e[t]):(Object.keys(s).sort((o,f)=>{const r=I(s[o])||O(s[o])?1:0,d=I(s[f])||O(s[f])?1:0;return r-d}).forEach(o=>{try{return oe(n,s[o],o)}catch(f){e.verbose&&console.warn("Error setting",n,"value",s[o],o,f)}}),e[n]||e[t])},me=(t,s)=>{const e=s||v();e.globalTheme=t;const i=j(e)||(typeof document<"u"?document:null),o=i&&i.defaultView||(typeof window<"u"?window:null);if(i){const r=e.themeRoot||i.documentElement;if(t&&t!=="auto")r.setAttribute("data-theme",t),e.resolvedTheme=t,t==="dark"||t==="light"?r.style.colorScheme=t:r.style.colorScheme="light dark";else if(o&&o.matchMedia){const c=h=>{const y=h.matches?"dark":"light";r.setAttribute("data-theme",y),e.resolvedTheme=y},m=o.matchMedia("(prefers-color-scheme: dark)");if(c(m),r.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=c;try{m.addEventListener("change",c)}catch{m.addListener(c)}}}else r.setAttribute("data-theme","light"),e.resolvedTheme="light",r.style.colorScheme="light"}const f=e.varPrefix?`--${e.varPrefix}-theme-`:"--theme-";for(const r in e.cssVars)r.startsWith(f)&&delete e.cssVars[r];for(const r in e.cssMediaVars)delete e.cssMediaVars[r];if(i&&e.cssVars){const r=e.scopeSelector||":root",d=i.styleSheets;for(let c=0;c<d.length;c++)try{const m=d[c].cssRules;for(let h=0;h<m.length;h++)if(m[h].selectorText===r){for(const y in e.cssVars)m[h].style.setProperty(y,e.cssVars[y]);return e}}catch{}}return e},ne={},ue=(t,s=ne)=>{let e=s.config||v();const{version:n,verbose:i,useVariable:o,useReset:f,useSvgSprite:r,useFontImport:d,useIconSprite:c,globalTheme:m,themeRoot:h,useDocumentTheme:y,useDefaultConfig:C,semanticIcons:_,hoverMedia:V,files:x,assets:D,...g}=t;s.newConfig&&(e=G(s.newConfig)),P(g.document)&&(e.__domDocument=g.document,delete g.document),P(e.document)&&(e.__domDocument||(e.__domDocument=e.document),e.document={}),x!==void 0&&(e.files=x),D!==void 0&&(e.assets=D),i!==void 0&&(e.verbose=i),o!==void 0&&(e.useVariable=o),f!==void 0&&(e.useReset=f),d!==void 0&&(e.useFontImport=d),r!==void 0&&(e.useSvgSprite=r),c!==void 0&&(e.useIconSprite=c),y!==void 0&&(e.useDocumentTheme=y),m!==void 0&&(e.globalTheme=m),h!==void 0&&(e.themeRoot=h),t.useThemeSuffixedVars!==void 0&&(e.useThemeSuffixedVars=t.useThemeSuffixedVars),C!==void 0&&(e.useDefaultConfig=C),_!==void 0&&(e.semanticIcons=_),V!==void 0&&(e.hoverMedia=V),e.verbose&&console.log(e);const b=j(e)||(typeof document<"u"?document:null),S=b&&b.defaultView||(typeof window<"u"?window:null),p=b&&(e.themeRoot||b.documentElement);if(p&&typeof p.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")p.setAttribute("data-theme",e.globalTheme),e.resolvedTheme=e.globalTheme,e.globalTheme==="dark"||e.globalTheme==="light"?p.style.colorScheme=e.globalTheme:p.style.colorScheme="light dark";else if(S&&S.matchMedia){const u=A=>{const L=A.matches?"dark":"light";p.setAttribute("data-theme",L),e.resolvedTheme=L},w=S.matchMedia("(prefers-color-scheme: dark)");if(u(w),p.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=u;try{w.addEventListener("change",u)}catch{w.addListener(u)}}}else p.setAttribute("data-theme","light"),e.resolvedTheme="light",p.style.colorScheme="light";e.__svgCache||(e.__svgCache={});const T=Object.keys(g).filter(a=>!a.startsWith("__")),E=new Set(T);if(T.forEach(a=>{const u=a.toLowerCase();u!==a&&E.has(u)&&ee(g[u],g[a])}),T.map(a=>{const u=a.toLowerCase();if(!(u!==a&&E.has(u)))return re(a,g[a])}),e.varPrefix&&(e.typography&&(e.typography.varPrefix=e.varPrefix),e.spacing&&(e.spacing.varPrefix=e.varPrefix),e.timing&&(e.timing.varPrefix=e.varPrefix)),g.typography)try{U()}catch(a){e.verbose&&console.warn("Error applying typography sequence",a)}if(g.spacing)try{J()}catch(a){e.verbose&&console.warn("Error applying spacing sequence",a)}if(g.timing)try{Q()}catch(a){e.verbose&&console.warn("Error applying timing sequence",a)}X();const R=K();return R&&(e.reset=R),e};export{q as VALUE_TRANSFORMERS,me as changeGlobalTheme,ue as set,re as setEach,oe as setValue};
1
+ import{getActiveConfig as S,setActiveConfig as $,toCamel as z}from"./factory.js";import{setColor as B,setGradient as K,setFont as U,setFontFamily as C,setTheme as J,setSvgIcon as Q,setSVG as X,applyTypographySequence as Z,applySpacingSequence as G,applyReset as N,applyTimingSequence as ee,applyDocument as te,setShadow as se}from"./system/index.js";import{deepMerge as oe,isObject as k,isArray as q}from"@symbo.ls/utils";import{isDomDocument as j,isHostObject as O,parkHostObject as W,resolveConfigDocument as F}from"./utils/host.js";const y="__smblsThemeRootOwner",b=t=>{const s=t&&t.__prefersListener,e=t&&t.__prefersMq;if(s&&e)try{typeof e.removeEventListener=="function"?e.removeEventListener("change",s):typeof e.removeListener=="function"&&e.removeListener(s)}catch{try{e.removeListener(s)}catch{}}t&&(t.__prefersListener=null,t.__prefersMq=null)},H=(t,s,e)=>{if(!(!t||!s)){b(t),t.__prefersListener=e,t.__prefersMq=s;try{s.addEventListener("change",e)}catch{s.addListener(e)}}},re=(t,s)=>{const e=S(),{cssVars:n}=e,i=s.startsWith("--")?s:`--${s}`;return n[i]=t,t},l=t=>t,I={color:B,gradient:K,font:U,fontFamily:C,fontfamily:C,theme:J,icons:Q,semanticIcons:l,semanticicons:l,svg:X,svgData:l,typography:l,shadow:se,spacing:l,media:l,grid:l,class:l,timing:l,reset:l,unit:l,animation:l,vars:re,sizes:l,shape:l},ne=(t,s,e,n)=>{W(t,e,s);const i={};for(const o of n)t[o]===s&&(t[o]=i);return t.verbose&&console.warn("[scratch] design-system family",e,"resolved to a host object; parked it and allocated a plain bucket"),i},ie=(t,s,e)=>{const n=S(),i=z(t),o=i.toLowerCase(),d=n[i]||n[o]||n[t],r=O(d)?ne(n,d,o,[i,o,t]):d,m=I[i]||I[o];if(m)try{const a=m(s,e);return r&&(r[e]=a),r}catch(a){n.verbose&&console.warn("Error setting",o,"value",s,e,a)}if(!m){const a=r||(n[o]={});return a[e]=s,a}n.verbose&&console.warn("Can not find",o,"method in scratch")},ce=(t,s)=>{const e=S(),n=t.toLowerCase();return O(s)?(W(e,n,s),e.verbose&&console.warn("[scratch] ignoring host object passed as the",n,"design-system family"),e[n]||e[t]):s==null?(e.verbose&&console.warn("[scratch] skipping empty design-system family",n),e[n]||e[t]):(Object.keys(s).sort((o,d)=>{const r=k(s[o])||q(s[o])?1:0,m=k(s[d])||q(s[d])?1:0;return r-m}).forEach(o=>{try{return ie(n,s[o],o)}catch(d){e.verbose&&console.warn("Error setting",n,"value",s[o],o,d)}}),e[n]||e[t])},ge=(t,s)=>{const e=s||S();e.globalTheme=t;const i=F(e)||(typeof document<"u"?document:null),o=i&&i.defaultView||(typeof window<"u"?window:null);if(i){const r=e.themeRoot||i.documentElement,m=t&&t!=="auto";if(r[y]=e,m)b(e),r.setAttribute("data-theme",t),e.resolvedTheme=t,t==="dark"||t==="light"?r.style.colorScheme=t:r.style.colorScheme="light dark";else if(o&&o.matchMedia){const a=g=>{const v=g.matches?"dark":"light";r.setAttribute("data-theme",v),e.resolvedTheme=v},u=o.matchMedia("(prefers-color-scheme: dark)");a(u),r.style.colorScheme="light dark",H(e,u,a)}else b(e),r.setAttribute("data-theme","light"),e.resolvedTheme="light",r.style.colorScheme="light"}const d=e.varPrefix?`--${e.varPrefix}-theme-`:"--theme-";for(const r in e.cssVars)r.startsWith(d)&&delete e.cssVars[r];for(const r in e.cssMediaVars)delete e.cssMediaVars[r];if(i&&e.cssVars){const r=e.scopeSelector||":root",m=i.styleSheets;for(let a=0;a<m.length;a++)try{const u=m[a].cssRules;for(let g=0;g<u.length;g++)if(u[g].selectorText===r){for(const v in e.cssVars)u[g].style.setProperty(v,e.cssVars[v]);return e}}catch{}}return e},ae={},pe=(t,s=ae)=>{let e=s.config||S();const{version:n,verbose:i,useVariable:o,useReset:d,useSvgSprite:r,useFontImport:m,useIconSprite:a,globalTheme:u,themeRoot:g,useDocumentTheme:v,useDefaultConfig:E,semanticIcons:V,hoverMedia:x,files:D,assets:R,...h}=t;s.newConfig&&(e=$(s.newConfig)),j(h.document)&&(e.__domDocument=h.document,delete h.document),j(e.document)&&(e.__domDocument||(e.__domDocument=e.document),e.document={}),D!==void 0&&(e.files=D),R!==void 0&&(e.assets=R),i!==void 0&&(e.verbose=i),o!==void 0&&(e.useVariable=o),d!==void 0&&(e.useReset=d),m!==void 0&&(e.useFontImport=m),r!==void 0&&(e.useSvgSprite=r),a!==void 0&&(e.useIconSprite=a),v!==void 0&&(e.useDocumentTheme=v),u!==void 0&&(e.globalTheme=u),g!==void 0&&(e.themeRoot=g),t.useThemeSuffixedVars!==void 0&&(e.useThemeSuffixedVars=t.useThemeSuffixedVars),E!==void 0&&(e.useDefaultConfig=E),V!==void 0&&(e.semanticIcons=V),x!==void 0&&(e.hoverMedia=x),e.verbose&&console.log(e);const _=F(e)||(typeof document<"u"?document:null),T=_&&_.defaultView||(typeof window<"u"?window:null),f=_&&(e.themeRoot||_.documentElement);if(f&&typeof f.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")b(e),f.setAttribute("data-theme",e.globalTheme),e.resolvedTheme=e.globalTheme,f[y]=e,e.globalTheme==="dark"||e.globalTheme==="light"?f.style.colorScheme=e.globalTheme:f.style.colorScheme="light dark";else if(f[y]&&f[y]!==e&&f.hasAttribute("data-theme"))b(e),e.resolvedTheme=f.getAttribute("data-theme");else if(T&&T.matchMedia){const p=Y=>{const P=Y.matches?"dark":"light";f.setAttribute("data-theme",P),e.resolvedTheme=P},M=T.matchMedia("(prefers-color-scheme: dark)");p(M),f.style.colorScheme="light dark",f[y]=e,H(e,M,p)}else b(e),f.setAttribute("data-theme","light"),e.resolvedTheme="light",f.style.colorScheme="light",f[y]=e;e.__svgCache||(e.__svgCache={});const w=Object.keys(h).filter(c=>!c.startsWith("__")),L=new Set(w);if(w.forEach(c=>{const p=c.toLowerCase();p!==c&&L.has(p)&&oe(h[p],h[c])}),w.map(c=>{const p=c.toLowerCase();if(!(p!==c&&L.has(p)))return ce(c,h[c])}),e.varPrefix&&(e.typography&&(e.typography.varPrefix=e.varPrefix),e.spacing&&(e.spacing.varPrefix=e.varPrefix),e.timing&&(e.timing.varPrefix=e.varPrefix)),h.typography)try{Z()}catch(c){e.verbose&&console.warn("Error applying typography sequence",c)}if(h.spacing)try{G()}catch(c){e.verbose&&console.warn("Error applying spacing sequence",c)}if(h.timing)try{ee()}catch(c){e.verbose&&console.warn("Error applying timing sequence",c)}te();const A=N();return A&&(e.reset=A),e};export{I as VALUE_TRANSFORMERS,ge as changeGlobalTheme,pe as set,ce as setEach,ie as setValue};
@@ -0,0 +1 @@
1
+ import{getColor as u}from"./color.js";import{getSpacingByKey as f}from"./spacing.js";import{isResolvedColor as c,isCSSVar as l,CSS_NATIVE_COLOR_REGEX as m}from"../utils/color.js";const a=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),S=i=>a.has(i),E=(i,d,n)=>{const t=i+"";if(m.test(t))return t;const e=t.trim();return e==="none"||e==="0"||e==="initial"||e==="inherit"||e==="unset"?t:t.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if(l(r))return`var(${r})`;if(S(r)||/^\d/.test(r)||r==="0")return r;const s=u(r,d);if(c(s))return s;n&&n(r);const o=f(r,"border");return o&&o.border?o.border:r}).join(" ")};export{E as resolveBorderValue};
@@ -1 +1 @@
1
- import{isObject as C,isArray as R,isString as $}from"@symbo.ls/utils";import{getActiveConfig as M}from"../factory.js";import{colorStringToRgbaArray as E,getRgbTone as w,isCSSVar as P,parseColorToken as D}from"../utils/index.js";const O={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},S=(r,a,g)=>{const e=g||M();if(!$(r)){e.verbose&&console.warn(r,"- type for color is not valid");return}if(P(r))return`var(${r})`;a&&r[a]&&(r=r[a]);let f,d,s;if(R(r))[f,d,s]=r;else{const t=D(r);if(!t){const{color:o,gradient:V}=e;let h=V[r]||o[r];return h?(a&&h[a]&&(h=h[a]),e.useVariable?`var(${h.var})`:h.value):r}if(t.passthrough)return t.passthrough;if(t.cssVar)return`var(${t.cssVar})`;f=t.name,d=t.alpha,s=t.tone}const{color:p,gradient:c}=e;let n=p[f]||c[f];if(!n)return e.verbose&&console.warn("Can't find color ",f),r;if(a)if(n[a]!==void 0)n=n[a];else if(R(n)){const t=a.charCodeAt(0)===64?a.slice(1):a;t==="dark"?n=n[1]!==void 0?n[1]:n[0]:(t!=="light"&&e.verbose&&console.warn(r," - array-form color tokens only support light/dark; falling back to the light slot for scheme",a),n=n[0])}else e.verbose&&console.warn(r," - does not have ",a);if($(n))return S(n,null,g);let u=n.rgb;if(!u){const t=e.useVariable?`var(${n.var})`:n.value;if((d||s)&&t){const o=d!==void 0?d:1;if(!s)return`rgb(from ${t} r g b / ${o})`;if(s.charCodeAt(0)===43||s.charCodeAt(0)===45){const h=parseFloat(s),l=h<0?"-":"+",i=Math.abs(h);return`rgb(from ${t} calc(r ${l} ${i}) calc(g ${l} ${i}) calc(b ${l} ${i}) / ${o})`}return`hsl(from ${t} h s ${s}% / ${o})`}return t}return s&&!n[s]&&(u=w(u,s),n[s]={rgb:u,var:`${n.var}-${s}`}),n[s]&&(u=n[s].rgb),d?`rgba(${u}, ${d})`:s?`rgba(${u}, 1)`:e.useVariable?`var(${n.var})`:`rgb(${u})`},j=(r,a,g)=>{const e=a||M();if(!$(r))return null;const f=D(r);if(f){if(f.passthrough){const o=E(f.passthrough);return o&&o.length>=3?{rgb:[o[0],o[1],o[2]],alpha:o[3]!==void 0?o[3]:1}:null}if(f.cssVar)return null}const d=f?f.name:r,{color:s,gradient:p}=e;let c=s[d]||p[d];if(!c){const o=E(r);return!o||o.length<3||o[0]===0&&o[1]===0&&o[2]===0&&o[3]===0&&r.toLowerCase()!=="transparent"?null:{rgb:[o[0],o[1],o[2]],alpha:o[3]!==void 0?o[3]:1}}if($(c))return j(c,e,g);if(c.rgb===void 0&&C(c)){const o=`@${g||"light"}`;c=c[o]!==void 0?c[o]:c["@light"]}if(!c||c.rgb===void 0)return null;let n=c.rgb;f&&f.tone&&(n=w(n,f.tone));const u=$(n)?n.split(",").map(o=>parseFloat(o.trim())):n,t=f&&f.alpha!==void 0?parseFloat(f.alpha):c.alpha!==void 0?c.alpha:1;return{rgb:u,alpha:t}},Q=(r,a,g)=>{const e=g||M();if(a||(a=e.globalTheme==="auto"?null:e.globalTheme),!$(r)){e.verbose&&console.warn(r,"- type for color is not valid");return}if(P(r))return`var(${r})`;let f,d,s;if(R(r))f=r[0];else{const t=D(r);if(t){if(t.passthrough)return t.passthrough;if(t.cssVar)return`var(${t.cssVar})`;f=t.name,d=t.alpha,s=t.tone}else f=r}const{color:p,gradient:c}=e,n=p[f]||c[f],u=C(n);if(u&&n.value)return S(r,`@${a}`,g);if(u){if(e.useVariable&&n.var)return d||s?S(r,null,g):`var(${n.var})`;if(a)return S(r,`@${a}`,g);{const t={};for(const o in n){if(o.charCodeAt(0)!==64)continue;const V=o.slice(1),h=e.media&&e.media[V]||O[V];if(!h)continue;const l="@media "+(h==="print"?`${h}`:`screen and ${h}`);t[l]=S(r,o,g)}return t}}else return e.verbose&&console.warn("Can't find color",r),r},L=(r,a,g,e)=>{const d=`--${e.varPrefix?e.varPrefix+"-":""}${a}-${g}`;let s;const p={};for(const c in r){if(c.charCodeAt(0)!==64)continue;const n=c.slice(1),u=r[c],t=u&&(u.value||u);!t||typeof t!="string"||(p[n]=t,(n==="light"||s===void 0)&&(s=t))}if(s!==void 0){e.cssVars[d]=s,e.cssMediaVars||(e.cssMediaVars={});for(const c in p){const n=`[data-theme="${c}"]`;if(e.cssMediaVars[n]||(e.cssMediaVars[n]={}),e.cssMediaVars[n][d]=p[c],c==="light"||c==="dark"){const u=`@media (prefers-color-scheme: ${c})`;e.cssMediaVars[u]||(e.cssMediaVars[u]={}),e.cssMediaVars[u][d]=p[c]}}return r.var=d,d}},T=(r,a,g)=>{const e=M();if(C(r)&&r.value!==void 0&&(r.rgb!==void 0||r.var!==void 0))return e.useVariable&&r.var&&(e.cssVars[r.var]=r.value),r;if($(r)&&P(r)){const l=r.slice(2);if(r=S(l),!(r.includes("rgb")||r.includes("var")||r.includes("#"))){const i=l.split(" ");let b=e.color[i[0]];if(b&&!b.value&&!b.rgb&&($(b)||R(b)||C(b))&&(e.color[i[0]]=T(b,i[0]),b=e.color[i[0]]),b&&b.value){let m=b.rgb;const x=i[1]!==void 0?i[1]:"1",A=i[2];A&&(m=w(m,A)),r=`rgba(${m}, ${x})`}else{const m=i[2],x=i[1]!==void 0?i[1]:"1";if(m)try{const A=E(i[0]);A&&A.length>=3?r=`rgba(${w(A.slice(0,3).join(", "),m)}, ${x})`:r=i[0]}catch{r=i[0]}else r=i[0]}}}if(R(r)&&(r={"@light":r[0],"@dark":r[1]!==void 0?r[1]:r[0]}),C(r)){const l={};for(const i in r)i!=="var"&&(l[i]=T(r[i],a,i.slice(0,1)==="@"?i.slice(1):i));return e.useVariable&&L(l,"color",a,e),l}const d=`--${e.varPrefix?e.varPrefix+"-":""}color-${a}`+(g?`-${g}`:"");let s=r.value||r;if($(s)&&!s.includes("(")&&!s.startsWith("#")){const l=D(s);if(l&&l.name&&!l.passthrough&&!l.cssVar){const i=e.color[l.name];i&&!i.value&&!i.rgb&&($(i)||R(i)||C(i))&&(e.color[l.name]=T(i,l.name));const b=e.color[l.name];if(b&&b.rgb){let m=b.rgb;l.tone&&(m=w(m,l.tone));const x=l.alpha?parseFloat(l.alpha):1;s=`rgba(${m}, ${x})`}}}const p=E(s),[c,n,u,t=1]=p,o=parseFloat(t.toFixed(2)),V=`${c}, ${n}, ${u}`,h=`rgba(${V}, ${o})`;return e.useVariable&&(e.cssVars[d]=h),{var:d,rgb:V,alpha:o,value:h}},F=(r,a,g)=>{const e=M();if(C(r)&&r.value!==void 0&&r.var!==void 0)return e.useVariable&&(e.cssVars[r.var]=r.value),r;if($(r)&&P(r)&&(r=S(r.slice(2))),R(r)&&(r={"@light":r[0],"@dark":r[1]!==void 0?r[1]:r[0]}),C(r)){const s={};for(const p in r)p!=="var"&&(s[p]=F(r[p],a,p.slice(0,1)==="@"?p.slice(1):p));return e.useVariable&&L(s,"gradient",a,e),s}const d=`--${e.varPrefix?e.varPrefix+"-":""}gradient-${a}`+(g?`-${g}`:"");return e.useVariable&&(e.cssVars[d]=r.value||r),{var:d,value:r.value||r}};export{O as STANDARD_SCHEME_QUERIES,S as getColor,Q as getMediaColor,j as resolveColorRgb,L as setAdaptiveSchemeVar,T as setColor,F as setGradient};
1
+ import{isObject as V,isArray as S,isString as m}from"@symbo.ls/utils";import{getActiveConfig as M}from"../factory.js";import{colorStringToRgbaArray as E,getRgbTone as C,isCSSVar as x,parseColorToken as O}from"../utils/index.js";const j={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},y=new Set,_=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"]),D=new Set,v=e=>{if(!e)return!1;const{color:t,gradient:l}=e;return!!(V(t)&&Object.keys(t).length||V(l)&&Object.keys(l).length)},L=(e,t,l)=>{const r=m(t)?t.toLowerCase():"";if(!_.has(r)||!v(l))return e;if(!D.has(r)){D.add(r);const i=l&&l.name?` (design system \`${l.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${i}. 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,t,l)=>{const r=l||M();if(!m(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;t&&e[t]&&(e=e[t]);let i,u,s;if(S(e))[i,u,s]=e;else{const a=O(e);if(!a){const{color:f,gradient:w}=r;let b=w[e]||f[e];return b?(t&&b[t]&&(b=b[t]),r.useVariable?`var(${b.var})`:b.value):e}if(a.passthrough)return a.passthrough;if(a.cssVar)return`var(${a.cssVar})`;i=a.name,u=a.alpha,s=a.tone}const{color:p,gradient:c}=r;let n=p[i]||c[i];if(!n)return L(e,i,r);if(t)if(n[t]!==void 0)n=n[t];else if(S(n)){const a=t.charCodeAt(0)===64?t.slice(1):t;a==="dark"?n=n[1]!==void 0?n[1]:n[0]:(a!=="light"&&r.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",t),n=n[0])}else r.verbose&&console.warn(e," - does not have ",t);if(m(n)){if(y.has(i))return n;y.add(i);try{return R(n,null,l)}finally{y.delete(i)}}let g=n.rgb;if(!g){const a=r.useVariable?`var(${n.var})`:n.value;if((u||s)&&a){const f=u!==void 0?u:1;if(!s)return`rgb(from ${a} r g b / ${f})`;if(s.charCodeAt(0)===43||s.charCodeAt(0)===45){const b=parseFloat(s),d=b<0?"-":"+",o=Math.abs(b);return`rgb(from ${a} calc(r ${d} ${o}) calc(g ${d} ${o}) calc(b ${d} ${o}) / ${f})`}return`hsl(from ${a} h s ${s}% / ${f})`}return a}return s&&!n[s]&&(g=C(g,s),n[s]={rgb:g,var:`${n.var}-${s}`}),n[s]&&(g=n[s].rgb),u?`rgba(${g}, ${u})`:s?`rgba(${g}, 1)`:r.useVariable?`var(${n.var})`:`rgb(${g})`},P=e=>{const t=E(e);return!t||t.length<3||t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[t[0],t[1],t[2]],alpha:t[3]!==void 0?t[3]:1}},N=(e,t)=>{if(!t)return e;let l=e.rgb;if(t.tone){const i=C(l,t.tone);l=m(i)?i.split(",").map(u=>parseFloat(u.trim())):i}const r=t.alpha!==void 0?parseFloat(t.alpha):e.alpha;return{rgb:l,alpha:r}},W=(e,t,l)=>{const r=t||M();if(!m(e))return null;const i=O(e);if(i){if(i.passthrough){const f=E(i.passthrough);return f&&f.length>=3?{rgb:[f[0],f[1],f[2]],alpha:f[3]!==void 0?f[3]:1}:null}if(i.cssVar)return null}const u=i?i.name:e,{color:s,gradient:p}=r;let c=s[u]||p[u];if(!c)return P(e);if(m(c)){let f;if(y.has(u))f=P(c);else{y.add(u);try{f=W(c,r,l)}finally{y.delete(u)}}return f?N(f,i):null}if(c.rgb===void 0&&V(c)){const f=`@${l||"light"}`;c=c[f]!==void 0?c[f]:c["@light"]}if(!c||c.rgb===void 0)return null;let n=c.rgb;i&&i.tone&&(n=C(n,i.tone));const g=m(n)?n.split(",").map(f=>parseFloat(f.trim())):n,a=i&&i.alpha!==void 0?parseFloat(i.alpha):c.alpha!==void 0?c.alpha:1;return{rgb:g,alpha:a}},B=(e,t,l)=>{const r=l||M();if(t||(t=r.globalTheme==="auto"?null:r.globalTheme),!m(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;let i,u,s;if(S(e))i=e[0];else{const a=O(e);if(a){if(a.passthrough)return a.passthrough;if(a.cssVar)return`var(${a.cssVar})`;i=a.name,u=a.alpha,s=a.tone}else i=e}const{color:p,gradient:c}=r,n=p[i]||c[i],g=V(n);if(g&&n.value)return R(e,`@${t}`,l);if(g){if(r.useVariable&&n.var)return u||s?R(e,null,l):`var(${n.var})`;if(t)return R(e,`@${t}`,l);{const a={},f=r.scopeSelector||":root",w=f===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${f}:not([data-theme])`;for(const b in n){if(b.charCodeAt(0)!==64)continue;const d=b.slice(1),o=R(e,b,l);if(o!==void 0&&(a[`[data-theme="${d}"] &`]=o,d==="light"||d==="dark")){const h=r.media&&r.media[d]||j[d];if(!h)continue;const $="@media "+(h==="print"?`${h}`:`screen and ${h}`);a[$]={[`${w} &`]:o}}}return a}}else return L(e,i,r)},T=(e,t,l,r)=>{const u=`--${r.varPrefix?r.varPrefix+"-":""}${t}-${l}`;let s;const p={};for(const c in e){if(c.charCodeAt(0)!==64)continue;const n=c.slice(1),g=e[c],a=g&&(g.value||g);!a||typeof a!="string"||(p[n]=a,(n==="light"||s===void 0)&&(s=a))}if(s!==void 0){r.cssVars[u]=s,r.cssMediaVars||(r.cssMediaVars={});for(const c in p){const n=`[data-theme="${c}"]`;if(r.cssMediaVars[n]||(r.cssMediaVars[n]={}),r.cssMediaVars[n][u]=p[c],c==="light"||c==="dark"){const g=`@media (prefers-color-scheme: ${c})`;r.cssMediaVars[g]||(r.cssMediaVars[g]={}),r.cssMediaVars[g][u]=p[c]}}return e.var=u,u}},q=(e,t,l)=>{const r=M();if(V(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(m(e)&&x(e)){const d=e.slice(2);if(e=R(d),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const o=d.split(" ");let h=r.color[o[0]];if(h&&!h.value&&!h.rgb&&(m(h)||S(h)||V(h))&&!y.has(o[0])){y.add(o[0]);try{r.color[o[0]]=q(h,o[0])}finally{y.delete(o[0])}h=r.color[o[0]]}if(h&&h.value){let $=h.rgb;const A=o[1]!==void 0?o[1]:"1",k=o[2];k&&($=C($,k)),e=`rgba(${$}, ${A})`}else{const $=o[2],A=o[1]!==void 0?o[1]:"1";if($)try{const k=E(o[0]);k&&k.length>=3?e=`rgba(${C(k.slice(0,3).join(", "),$)}, ${A})`:e=o[0]}catch{e=o[0]}else e=o[0]}}}if(S(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),V(e)){const d={};for(const o in e)o!=="var"&&(d[o]=q(e[o],t,o.slice(0,1)==="@"?o.slice(1):o));return r.useVariable&&T(d,"color",t,r),d}const u=`--${r.varPrefix?r.varPrefix+"-":""}color-${t}`+(l?`-${l}`:"");let s=e.value||e;if(m(s)&&!s.includes("(")&&!s.startsWith("#")){const d=O(s);if(d&&d.name&&!d.passthrough&&!d.cssVar){const o=r.color[d.name];if(o&&!o.value&&!o.rgb&&(m(o)||S(o)||V(o))&&!y.has(d.name)){y.add(d.name);try{r.color[d.name]=q(o,d.name)}finally{y.delete(d.name)}}const h=r.color[d.name];if(h&&h.rgb){let $=h.rgb;d.tone&&($=C($,d.tone));const A=d.alpha!==void 0?parseFloat(d.alpha):h.alpha!==void 0?h.alpha:1;s=`rgba(${$}, ${A})`}}}const p=E(s),[c,n,g,a=1]=p,f=parseFloat(a.toFixed(2)),w=`${c}, ${n}, ${g}`,b=`rgba(${w}, ${f})`;return r.useVariable&&(r.cssVars[u]=b),{var:u,rgb:w,alpha:f,value:b}},z=(e,t,l)=>{const r=M();if(V(e)&&e.value!==void 0&&e.var!==void 0)return r.useVariable&&(r.cssVars[e.var]=e.value),e;if(m(e)&&x(e)&&(e=R(e.slice(2))),S(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),V(e)){const s={};for(const p in e)p!=="var"&&(s[p]=z(e[p],t,p.slice(0,1)==="@"?p.slice(1):p));return r.useVariable&&T(s,"gradient",t,r),s}const u=`--${r.varPrefix?r.varPrefix+"-":""}gradient-${t}`+(l?`-${l}`:"");return r.useVariable&&(r.cssVars[u]=e.value||e),{var:u,value:e.value||e}};export{j as STANDARD_SCHEME_QUERIES,R as getColor,B as getMediaColor,W as resolveColorRgb,T as setAdaptiveSchemeVar,q as setColor,z as setGradient};
@@ -1 +1 @@
1
- import{isObject as m,isArray as a}from"@symbo.ls/utils";import{arrayzeValue as p}from"@symbo.ls/utils";import{getActiveConfig as f}from"../factory.js";import{getDefaultOrFirstKey as y,getFontFaceEach as S,isGoogleFontsUrl as g,setCustomFontMedia as c,setFontImport as O,resolveFileUrl as F}from"../utils/index.js";const D=(t,e)=>{const r=f(),n=`--font-${e}`;if(!t||a(t)&&!t[0])return;let s;if(t.isVariable){const o=F(t.url,r.files)||t.url;g(o)?s=O(o):s=c(e,o,t.fontWeight,{fontStretch:t.fontStretch,fontDisplay:t.fontDisplay||"swap"})}else if(t[0])s=S(e,t,r.files);else{const o=Array.isArray(t.url)?t.url.map(i=>F(i,r.files)||i):F(t.url,r.files)||t.url;s=c(e,o,t.fontWeight,{fontStyle:t.fontStyle,fontDisplay:t.fontDisplay,fontStretch:t.fontStretch})}return{var:n,value:t,fontFace:s}},N=(t,e)=>{const r=f(),{fontFamily:n}=r;return y(e||n,t)},T=(t,e)=>{const r=f(),{fontFamily:n,fontFamilyTypes:s}=r;let{value:o,type:i}=t;t.isDefault&&(!t.isSystemFallback||!n.default)&&(n.default=e),m(o)&&(o=p(o));const l=`--font-family-${e}`,u=`${o.join(", ")}, ${s[i]}`;return{var:l,value:u,arr:o,type:i}};export{N as getFontFamily,D as setFont,T as setFontFamily};
1
+ import{isObject as a,isArray as m}from"@symbo.ls/utils";import{arrayzeValue as y}from"@symbo.ls/utils";import{getActiveConfig as f}from"../factory.js";import{getDefaultOrFirstKey as p,getFontFaceEach as S,isGoogleFontsUrl as g,setCustomFontMedia as l,setFontImport as O,resolveFileUrl as F}from"../utils/index.js";const D=(t,o)=>{const r=f(),n=`--font-${o}`;if(!t||m(t)&&!t[0])return;let s;if(t.isVariable){const e=F(t.url,r.files)||t.url;g(e)?s=O(e):s=l(o,e,t.fontWeight,{fontStretch:t.fontStretch,fontDisplay:t.fontDisplay||"swap"})}else if(t[0])s=S(o,t,r.files);else{const e=Array.isArray(t.url)?t.url.map(i=>F(i,r.files)||i):F(t.url,r.files)||t.url;s=l(o,e,t.fontWeight,{fontStyle:t.fontStyle,fontDisplay:t.fontDisplay,fontStretch:t.fontStretch})}return{var:n,value:t,fontFace:s}},N=(t,o)=>{const r=f(),{fontFamily:n}=r;return p(o||n,t)},b=(t,o)=>{const r=f(),{fontFamily:n,fontFamilyTypes:s}=r;let{value:e,type:i}=t;t.isDefault&&(!t.isSystemFallback||!n.default)&&(n.default=o),a(e)&&(e=y(e));const c=`--font-family-${o}`,u=`${e.join(", ")}, ${s[i]}`;return{var:c,value:u,arr:e,type:i,isSystemFallback:!!t.isSystemFallback}};export{N as getFontFamily,D as setFont,b as setFontFamily};
@@ -1 +1 @@
1
- export*from"./color.js";export*from"./ink.js";export*from"./theme.js";export*from"./font.js";export*from"./typography.js";export*from"./spacing.js";export*from"./shape.js";export*from"./shadow.js";export*from"./timing.js";export*from"./document.js";export*from"./svg.js";export*from"./reset.js";
1
+ export*from"./color.js";export*from"./ink.js";export*from"./theme.js";export*from"./font.js";export*from"./typography.js";export*from"./spacing.js";export*from"./shape.js";export*from"./shadow.js";export*from"./border.js";export*from"./timing.js";export*from"./document.js";export*from"./svg.js";export*from"./reset.js";
@@ -1 +1 @@
1
- import{deepMerge as y,merge as D,overwriteDeep as T}from"@symbo.ls/utils";import{getActiveConfig as w}from"../factory.js";import{getMediaTheme as l}from"./theme.js";const A=(u={})=>{const i=w(),{reset:t,typography:e,document:m}=i;if(t){if(t[":root"]){const n=t,o=e.templates;n.body={...i.useDocumentTheme?l("document"):{},...o.body},n.h1=o.h1,n.h2=o.h2,n.h3=o.h3,n.h4=o.h4,n.h5=o.h5,n.h6=o.h6}const{body:h,...f}=e.templates,c=i.useDocumentTheme?l("document"):{};if(t.html&&T(t.html,c),e.unit){const{media:n}=i;for(const o in e){if(o.charAt(0)!=="@")continue;const r=e[o];if(!r||r.unit===e.unit||!r.unit)continue;const d=r.unit,p=r.base||e.base,b=r.browserDefault||e.browserDefault,g=o.slice(1),s=n[g];if(!s)continue;const a="@media "+(s==="print"?s:"screen and "+s);t[a]||(t[a]={}),t[a].html||(t[a].html={}),t[a].html.fontSize=p/b+d}}return y(D(t,u),{html:{position:"absolute",width:"100%",height:"100%",top:"0",left:"0",margin:"0",WebkitFontSmoothing:"subpixel-antialiased",scrollBehavior:"smooth",...c,fontSize:e.unit?e.base/e.browserDefault+e.unit:e.browserDefault+"px",fontFamily:m.fontFamily,lineHeight:m.lineHeight},body:{boxSizing:"border-box",height:"100%",margin:0,fontFamily:m.fontFamily,fontSize:e.unit?"1"+i.unit.default:e.base/e.browserDefault+i.unit.default,...f,...h},a:{color:"currentColor"},button:{color:"inherit",font:"inherit",background:"transparent",border:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none"},"input, select, textarea":{color:"inherit",font:"inherit"},fieldset:{border:0,padding:0,margin:0}})}};export{A as applyReset};
1
+ import{deepMerge as y,isObject as D,merge as T,overwriteDeep as w}from"@symbo.ls/utils";import{getActiveConfig as x}from"../factory.js";import{getMediaTheme as l}from"./theme.js";const k=(u={})=>{const o=x(),e=o.typography||{},c=o.document||{},n=D(o.reset)?o.reset:o.reset={};if(n[":root"]){const i=n,t=e.templates||{};i.body={...o.useDocumentTheme?l("document"):{},...t.body},i.h1=t.h1,i.h2=t.h2,i.h3=t.h3,i.h4=t.h4,i.h5=t.h5,i.h6=t.h6}const{body:h,...f}=e.templates||{},m=o.useDocumentTheme?l("document"):{};if(n.html&&w(n.html,m),e.unit){const i=o.media||{};for(const t in e){if(t.charAt(0)!=="@")continue;const r=e[t];if(!r||r.unit===e.unit||!r.unit)continue;const d=r.unit,p=r.base||e.base,b=r.browserDefault||e.browserDefault,g=t.slice(1),s=i[g];if(!s)continue;const a="@media "+(s==="print"?s:"screen and "+s);n[a]||(n[a]={}),n[a].html||(n[a].html={}),n[a].html.fontSize=p/b+d}}return y(T(n,u),{html:{position:"absolute",width:"100%",height:"100%",top:"0",left:"0",margin:"0",WebkitFontSmoothing:"subpixel-antialiased",scrollBehavior:"smooth",...m,fontSize:e.unit?e.base/e.browserDefault+e.unit:e.browserDefault+"px",fontFamily:c.fontFamily,lineHeight:c.lineHeight},body:{boxSizing:"border-box",height:"100%",margin:0,fontFamily:c.fontFamily,fontSize:e.unit?"1"+o.unit.default:e.base/e.browserDefault+o.unit.default,...f,...h},a:{color:"currentColor"},button:{color:"inherit",font:"inherit",background:"transparent",border:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none"},"input, select, textarea":{color:"inherit",font:"inherit"},fieldset:{border:0,padding:0,margin:0}})};export{k as applyReset};
@@ -1 +1 @@
1
- import{getActiveConfig as C}from"../factory.js";import{getColor as l,setAdaptiveSchemeVar as S}from"./color.js";import{getSpacingByKey as O}from"./spacing.js";import{isResolvedColor as V,isCSSVar as g,splitTopLevelCommas as j,CSS_NATIVE_COLOR_REGEX as A}from"../utils/color.js";import{isObject as h,isString as w,isArray as b}from"@symbo.ls/utils";const p=(t,o,i,m)=>{const s=C();if(b(t)){const n={"@light":p(t[0],o,"light"),"@dark":p(t[1],o,"dark")};return s.useVariable&&S(n,"shadow",o,s),n}if(h(t)){const n={};for(const r in t)n[r]=p(t[r],o,r.startsWith("@")?r.slice(1):r);return s.useVariable&&S(n,"shadow",o,s),n}w(t)&&!A.test(t)&&(t=j(t).map(n=>(n=n.trim(),n.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if(r.startsWith("--"))return`var(${r})`;const c=l(r);if(V(c))return c;if(/^\d/.test(r)||r==="0"||r.includes("px")||r.slice(-2)==="em"||r==="inset"||r==="none")return r;const a=O(r,"shadow");return a&&a.shadow?a.shadow:r}).join(" "))).join(", "));const f=`--${s.varPrefix?s.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return s.useVariable&&(s.cssVars[f]=t),{var:f,value:t}},G=(t,o)=>{const i=C();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!w(t)){i.verbose&&console.warn(t,"- type for color is not valid");return}if(g(t))return`var(${t})`;const[m]=b(t)?t:t.split(" "),e=i.shadow[m],f=h(e);if(!e)return i.verbose&&console.warn("Can't find color ",m),t;if(o){const n=e["@"+o]||e[o];if(n)return n.value!==void 0?n.value:n;i.verbose&&console.warn(t," - does not have ",o)}if(f&&e.value)return e.value;if(f){const n={};for(const r in e){if(r.charCodeAt(0)!==64)continue;const c=i.media[r.slice(1)];if(!c)continue;const a="@media "+(c==="print"?`${c}`:`screen and ${c}`),d=e[r],u=d&&(d.value!==void 0?d.value:d);u!==void 0&&(n[a]=u)}return n}return i.verbose&&console.warn("Can't find color",t),t};export{G as getShadow,p as setShadow};
1
+ import{getActiveConfig as S}from"../factory.js";import{getColor as O,setAdaptiveSchemeVar as h}from"./color.js";import{getSpacingByKey as g}from"./spacing.js";import{isResolvedColor as j,isCSSVar as l,splitTopLevelCommas as A,CSS_NATIVE_COLOR_REGEX as C}from"../utils/color.js";import{isObject as w,isString as p,isArray as b}from"@symbo.ls/utils";const $=(r,i,n)=>!p(r)||C.test(r)?r:A(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(t,i);if(j(s))return s;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none")return t;n&&n(t);const e=g(t,"shadow");return e&&e.shadow?e.shadow:t}).join(" "))).join(", "),m=(r,i,n,f)=>{const t=S();if(b(r)){const o={"@light":m(r[0],i,"light"),"@dark":m(r[1],i,"dark")};return t.useVariable&&h(o,"shadow",i,t),o}if(w(r)){const o={};for(const c in r)o[c]=m(r[c],i,c.startsWith("@")?c.slice(1):c);return t.useVariable&&h(o,"shadow",i,t),o}p(r)&&!C.test(r)&&(r=$(r));const e=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${i}`+(n?`-${n}`:"");return t.useVariable&&(t.cssVars[e]=r),{var:e,value:r}},I=(r,i)=>{const n=S();if(i||(i=n.globalTheme==="auto"?null:n.globalTheme),!p(r)){n.verbose&&console.warn(r,"- type for color is not valid");return}if(l(r))return`var(${r})`;const[f]=b(r)?r:r.split(" "),s=n.shadow[f],e=w(s);if(!s)return n.verbose&&console.warn("Can't find color ",f),r;if(i){const o=s["@"+i]||s[i];if(o)return o.value!==void 0?o.value:o;n.verbose&&console.warn(r," - does not have ",i)}if(e&&s.value)return s.value;if(e){const o={};for(const c in s){if(c.charCodeAt(0)!==64)continue;const a=n.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&&(o[V]=u)}return o}return n.verbose&&console.warn("Can't find color",r),r};export{I as getShadow,$ as resolveShadowValue,m as setShadow};
@@ -1 +1 @@
1
- import{getColor as $}from"./color.js";import{getActiveConfig as y}from"../factory.js";import{isCSSVar as v}from"../utils/color.js";import{isObject as T,isString as b,isObjectLike as k,isArray as q}from"@symbo.ls/utils";const D=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"]),x=["color","Color","background","Background","fill","Fill","stroke","Stroke"],K=e=>{for(let r=0;r<x.length;r++)if(e.includes(x[r]))return!0;return!1},V=e=>{const r={},{state:o,media:i,helpers:n,...c}=e;return Object.keys(c).map(d=>{const s=["color","Color","background","border"].some(l=>d.includes(l));return r[d]=s?$(e[d]):e[d]}),r},S=e=>(e.value||(e.value=V(e)),e.value),E=(e,r)=>{const o=y();if(o.useVariable)return C(e,r);const i=o.theme;if(b(e)){const[n,c]=e.split(" "),t=i[n];if(t){if(!c&&!r)return S(t);e=[n,c||r]}}if(k(e)&&e[1]){const n=e[0],c=e[1],{helpers:t,media:d,state:a}=i[n];if(d&&d[c])return S(d[c]);if(t&&t[c])return S(t[c]);if(a&&a[c])return S(a[c])}else if(T(e))return V(e)},B=(e,r,o)=>{if(T(r))e.variants.inverse.value=V(r);else if(r===!0){const{color:i,background:n}=o;e.variants.inverse={value:{color:n,background:i}}}},W=(e,r,o,i)=>{const n=E(o);i[`&:${r}`]=n,T(o)&&!o.value&&(o.value=n)},P=(e,r)=>{const{state:o}=e;return o?(Object.keys(o).map(n=>{const c=o[n];return W(e,n,c,r),e}),e):void 0},Z=(e,r,o,i)=>{const n=E(o);i[`@media (prefers-color-scheme: ${r})`]=n,T(o)&&!o.value&&(o.value=n)},_=(e,r)=>{const{media:o}=e;return o?(Object.keys(o).map(n=>{const c=o[n];return(n==="dark"||n==="light")&&Z(e,n,c,r),n==="inverse"&&B(e,c,r),e}),e):void 0},H=(e,r)=>{const o=y(),{helpers:i}=e;return i?(Object.keys(i).map(c=>{const t=i[c];return b(t)?i[c]=o.theme[t]:S(i[c]),e}),e):void 0},I=(e,r)=>{const o=y();if(o.useVariable)return L(e,r);const{state:i,media:n,helpers:c}=e,t=V(e,r),a=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}`;return P(e,t),_(e,t),H(e,t),{var:a,value:t,state:i,media:n,helpers:c}},G={"@":(e,r)=>_(e,r),":":(e,r)=>P(e,r),".":(e,r)=>H(e,r)},O=(e,r,o)=>{const{cssVars:i}=o;o.cssMediaVars||(o.cssMediaVars={});const n=o.cssMediaVars,c=o.globalTheme!==void 0?o.globalTheme:"auto",t={},d=new Set;for(const s in e)if(e[s])for(const l of Object.keys(e[s]))d.add(l);const a=new Set;for(const s of d){const l=s.slice(0,1);if(!(l==="@"||l==="."||l===":")&&K(s))for(const g in e){if(a.has(g))continue;const m=e[g]?.[s];if(m===void 0)continue;const u=$(m,`@${g}`);u!==void 0&&b(u)&&/^[a-z][a-zA-Z]+$/.test(u)&&!D.has(u)&&a.add(g)}}for(const s of d){const l=s.slice(0,1),g=Object.values(e).some(m=>k(m?.[s]));if(l==="."&&g){const m=s.slice(1),u={};for(const h in e)k(e[h]?.[s])&&(u[h]=e[h][s]);t[s]=O(u,`${r}-${m}`,o)}else if(l===":"&&g){const m=s.replace(/^:+/,""),u={};for(const h in e)k(e[h]?.[s])&&(u[h]=e[h][s]);t[s]=O(u,`${r}-${m}`,o)}else if(l!=="@"&&l!=="."&&l!==":"){const u=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}-${s}`,h=c&&c!=="auto"?String(c).replace(/^'|'$/g,""):null;let p;for(const f in e){if(a.has(f))continue;const R=e[f]?.[s];if(R===void 0)continue;const w=$(R,`@${f}`);if(w===void 0)continue;(h&&f===h||!h&&(f==="light"||p===void 0))&&(p=w);const M=`[data-theme="${f}"]`;if(n[M]||(n[M]={}),n[M][u]=w,f==="dark"||f==="light"){const j=`@media (prefers-color-scheme: ${f})`;n[j]||(n[j]={}),n[j][u]=w}}p!==void 0&&(i[u]=p),t[s]=`var(${u})`,t[`.${s}`]={[s]:t[s]}}}return(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color}),t},L=(e,r,o,i)=>{const n=y(),{cssVars:c}=n,t={value:e},d=!o&&!i;if(k(e)){if(d&&n.useVariable){const a={};for(const s in e)s.startsWith("@")&&k(e[s])&&(a[s.slice(1)]=e[s]);if(Object.keys(a).length){const s=O(a,r,n);Object.assign(t,s)}}for(const a in e){const s=a.slice(0,1),l=e[a];if(s==="@"||s===":"||s==="."){const g=s==="@"&&a;t[a]=L(l,r,a,i||g)}else if(!d){const g=$(l,i),m=[...new Set([i,o].filter(f=>f).map(f=>f.slice(1)))],u=m.length?"-"+m.join("-"):"",p=`--${n.varPrefix?n.varPrefix+"-":""}theme-${r}${u}-${a}`;n.useVariable?(n.useThemeSuffixedVars&&(c[p]=g),t[a]=`var(${p})`):t[a]=g,t[`.${a}`]={[a]:t[a]}}}!t[".inversed"]&&(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color})}if(b(e)&&v(e)){const s=n.theme[e.slice(2)];return C(s,i)}return t},A=e=>{const r=y(),o={};for(const i in e){const n=i.slice(0,1);if(k(e[i])){if(n==="@")continue;n===":"?o[`&${i}`]=A(e[i]):n==="."&&(o[`&${i}`]=A(e[i]))}else o[i]=e[i]}return o},N=(e,r)=>{const o=r.shift();return e[o]?N(e[o],r):e},z=(e,r)=>q(r)?N(e,r):b(r)&&e[r]?e[r]:e,J=(e,r)=>b(e)&&v(e)?C(e.slice(2)):e,Q=e=>J(e,Q),C=(e,r)=>{const o=y();if(b(e)&&v(e)&&(e=C(e.slice(2))),!e||!b(e)){o.verbose&&console.warn(`${e} - Theme is not a string`);return}const[i,...n]=q(e)?e:e.split(" ");let c=o.theme[i];return c&&n.length?c=z(c,n):c&&r&&(c=z(c,r)),A(c)};export{C as getMediaTheme,E as getTheme,L as setMediaTheme,I as setTheme};
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 +1 @@
1
- import{isString as f,isObject as h,exec as O}from"@symbo.ls/utils";import{getActiveConfig as T}from"../factory.js";import{getSpacingByKey as d,getColor as p,getShadow as b,getShapeByKey as E,getMediaColor as j,getTimingByKey as B,getTimingFunction as C,getSpacingBasedOnRatio as R,checkIfBoxSize as I,splitSpacedValue as z}from"../system/index.js";import{getFnPrefixAndValue as $,isResolvedColor as m,isCSSVar as l,CSS_NATIVE_COLOR_REGEX as S,splitTopLevelCommas as x,parseColorToken as A}from"../utils/index.js";const G=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),V=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),_=t=>G.has(t),P=t=>{const e=t+"";if(S.test(e))return e;const n=e.trim();return n==="none"||n==="0"||n==="initial"||n==="inherit"||n==="unset"?e:e.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if(l(r))return`var(${r})`;if(_(r)||/^\d/.test(r)||r==="0")return r;const o=p(r);if(m(o))return o;const s=d(r,"border");return s&&s.border?s.border:r}).join(" ")},Y=t=>S.test(t)?t:t.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=p(e);return m(n)?n:e}).join(" "),M=(t,e)=>b(t,e),X=(t,e)=>S.test(t)?t:x(t).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 r=p(i);if(m(r)){const s=j(i,e);return h(s)?Object.values(s).filter(a=>a.includes(": "+e))[0]:s}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const o=d(i,"shadow");return o&&o.shadow?o.shadow:i}).join(" "):"")).join(", "),D=(t,e)=>{const n=t.indexOf("(");if(n===-1)return t;const i=t.slice(0,n+1),r=t.slice(n+1,t.lastIndexOf(")")),o=")",a=x(r).map(c=>(c=c.trim(),c.split(/\s+/).map(u=>{if(!u||/^\d/.test(u)||u==="0"||V.has(u)||u==="transparent"||S.test(u))return u;const g=p(u);return m(g)?g:u}).join(" ")));return i+a.join(", ")+o},H=(t,e)=>{const n=T();return x(t).map(i=>{const r=i.trim();if(l(r))return`var(${r})`;if(/^var\(/.test(r)||r.includes("url"))return r;if(n.gradient?.[r]){const o=j(r,e);if(f(o))return o;if(h(o)){for(const s in o)if(f(o[s]))return o[s]}return r}return r.includes("gradient")?D(r,e):r.includes("/")||r.startsWith("http")||r.includes(".")&&!A(r)?`url(${r})`:r}).join(", ")},J=t=>f(t)&&t.split(" ").map(e=>d(e,"gap").gap).join(" "),K=t=>{const e=t.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(" "):t},Q=(t,e,n)=>{if(f(t))return t.split(",").map(i=>B(i).timing||i).join(",")},U=t=>{const e=t.split(",");if(e.length)return e.map(K).join(",")};function W(t,e,n={},i={}){let r=O.call(this,e||n[t]);if(r==null)return;let o;if(f(r)){if(/^(?:env|var)\(/.test(r.trim()))return{[t]:r};if(r.includes("(")){const c=$(r);o=c[0],r=c[1]}const s=n.scaleBoxSize,a=I(t);!s&&a&&!i.ratio&&(r=z(r))}return i.ratio?R(n,t,r,o):d(r,t,void 0,o)}const Z=(t,e=null,n)=>W(t,e,n,{ratio:!0}),N=(t,e,n,i="borderRadius")=>{if(f(t))return{[i]:t.split(" ").map(r=>{const o=E(r);return o!==void 0?o:R(e,n,r)[n]}).join(" ")}};export{D as resolveColorsInGradient,U as splitTransition,H as transformBackgroundImage,P as transformBorder,N as transformBorderRadius,X as transformBoxShadow,Q as transformDuration,M as transformShadow,W as transformSize,Z as transformSizeRatio,Y as transformTextStroke,K as transformTransition,J as transfromGap};
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 +1 @@
1
- import{document as u,window as g,isString as m,isNumber as d,isNotProduction as M}from"@symbo.ls/utils";const f=t=>{if(t==="")return[0,0,0,0];if(t.toLowerCase()==="transparent")return[0,0,0,0];if(t[0]==="#")return t.length<7&&(t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+(t.length>4?t[4]+t[4]:"")),[parseInt(t.substr(1,2),16),parseInt(t.substr(3,2),16),parseInt(t.substr(5,2),16),t.length>7?parseInt(t.substr(7,2),16)/255:1];if(t.indexOf("rgb")===-1&&u&&g){const n=u.body.appendChild(u.createElement("fictum")),e="rgb(1, 2, 3)";if(n.style.color=e,n.style.color!==e){u.body.removeChild(n);return}if(n.style.color=t,n.style.color===e||n.style.color==="")return u.body.removeChild(n),[0,0,0,0];t=g.getComputedStyle(n).color,u.body.removeChild(n)}return t.indexOf("rgb")===0?(t.indexOf("rgba")===-1&&(t=`${t}, 1`),t.match(/[\.\d]+/g).map(n=>+n)):[0,0,0,0]},A=(t,n,e=.5)=>(t=f(t),n=f(n),y(t,n,e)),G=(t,n=1)=>{const[e,s,r]=t.match(/\w\w/g).map(o=>parseInt(o,16));return`rgb(${e},${s},${r})`},T=(t,n=1)=>{const[e,s,r]=t.match(/\w\w/g).map(o=>parseInt(o,16));return[e,s,r]},H=(t,n,e)=>"#"+(1<<24|t<<16|n<<8|e).toString(16).slice(1),w=([t,n,e])=>((1<<24)+(t<<16)+(n<<8)+e).toString(16).slice(1),N=(t,n=1)=>{const[e,s,r]=t.match(/\w\w/g).map(o=>parseInt(o,16));return`rgba(${e},${s},${r},${n})`},j=(t,n,e=.5)=>{const s=[];for(let r=0;r<3;r++)s[r]=~~(t[r]+(n[r]-t[r])*e);return`rgb(${s})`},P=(t,n)=>{const[e,s,r]=n,o=Math.max(0,Math.min(100,r+parseFloat(t)));return[e,s,o]},C=(t,n,e)=>{const s=Math.max(t,n,e),r=s-Math.min(t,n,e),o=1-Math.abs(s+s-r-1),a=r&&(s==t?(n-e)/r:s==n?2+(e-t)/r:4+(t-n)/r);return[60*(a<0?a+6:a),o?r/o:0,(s+s-r)/2]},S=(t,n,e,s=n*Math.min(e,1-e),r=(o,a=(o+t/30)%12)=>e-s*Math.max(Math.min(a-3,9-a,1),-1))=>[r(0),r(8),r(4)],R=(t,n)=>{const e=parseInt(t,16);let s=(e>>16)+n;s>255?s=255:s<0&&(s=0);let r=(e>>8&255)+n;r>255?r=255:r<0&&(r=0);let o=(e&255)+n;return o>255?o=255:o<0&&(o=0),((o|r<<8|s<<16)+16777216).toString(16).slice(1)},y=(t,n,e=.5)=>{const s=[];for(let r=0;r<4;r++){const o=r===3?a=>a:Math.round;s[r]=o(t[r]+(n[r]-t[r])*e)}return`rgba(${s})`},V=(t,n)=>{const e=f(t);if(!e){M()&&console.warn(t+" color is not rgba");return}return e[3]=n,`rgba(${e})`},$=t=>t.charCodeAt(0)===45&&t.charCodeAt(1)===45,I=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,O=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,z=t=>{if(!m(t))return null;if(I.test(t))return{passthrough:t};if($(t))return{cssVar:t};const n=t.match(O);if(!n)return null;const[,e,s,r]=n,o=s!==void 0?`0.${s}`:void 0,a=r&&r[0]==="="?r.slice(1):r;return{name:e,alpha:o,tone:a}},X=t=>m(t)&&(t.includes("rgb")||t.includes("var(")||t.includes("#")),Z=t=>{const n=[];let e="",s=0;for(const r of t){if(r==="("?s+=1:r===")"&&s>0&&(s-=1),r===","&&s===0){n.push(e),e="";continue}e+=r}return(e.length||!n.length)&&n.push(e),n},x=t=>(t/=255,t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)),b=t=>.2126*x(t[0])+.7152*x(t[1])+.0722*x(t[2]),q=(t,n)=>{const e=b(t)+.05,s=b(n)+.05;return e>s?e/s:s/e},_=t=>(t/=255,t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)),L=t=>(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*255,D=([t,n,e])=>{const[s,r,o]=[t,n,e].map(_),a=.4122214708*s+.5363325363*r+.0514459929*o,i=.2119034982*s+.6806995451*r+.1073969566*o,c=.0883024619*s+.2817188376*r+.6299787005*o,h=Math.cbrt(a),p=Math.cbrt(i),l=Math.cbrt(c);return[.2104542553*h+.793617785*p-.0040720468*l,1.9779984951*h-2.428592205*p+.4505937099*l,.0259040371*h+.7827717662*p-.808675766*l]},k=([t,n,e])=>{const s=t+.3963377774*n+.2158037573*e,r=t-.1055613458*n-.0638541728*e,o=t-.0894841775*n-1.291485548*e,a=s**3,i=r**3,c=o**3;return[4.0767416621*a-3.3077115913*i+.2309699292*c,-1.2684380046*a+2.6097574011*i-.3413193965*c,-.0041960863*a-.7034186147*i+1.707614701*c]},K=([t,n,e])=>{let s=Math.atan2(e,n)*180/Math.PI;return s<0&&(s+=360),[t,Math.sqrt(n*n+e*e),s]},E=([t,n,e])=>{const s=e*Math.PI/180;return[t,n*Math.cos(s),n*Math.sin(s)]},J=(t,n,e,s=24)=>{const r=i=>k(E([t,i,e])),o=i=>i.every(c=>c>=-1e-4&&c<=1.0001);let a=r(n);if(!o(a)){let i=0,c=n;for(let h=0;h<s;h++){const p=(i+c)/2;o(r(p))?i=p:c=p}a=r(i)}return a.map(i=>L(Math.max(0,Math.min(1,i))))},Q=(t,n=1,e=[255,255,255])=>n>=1?t:t.map((s,r)=>s*n+e[r]*(1-n)),U=(t,n)=>{m(t)&&t.includes("rgb")&&(t=f(t).join(", ")),m(t)&&(t=t.split(",").map(r=>parseFloat(r.trim()))),d(n)&&(n+="");const e=w(t),s=n.slice(0,1);if(s==="-"||s==="+"){const r=R(e,parseFloat(n));return T(r).join(", ")}else{const[r,o,a]=t,[i,c]=C(r/255,o/255,a/255),h=Math.max(0,Math.min(100,parseFloat(n)))/100;return S(i,c,h).map(l=>Math.round(Math.max(0,Math.min(1,l))*255)).join(", ")}};export{I as CSS_NATIVE_COLOR_REGEX,P as changeLightness,f as colorStringToRgbaArray,Q as compositeOverBackdrop,q as contrastRatio,R as getColorShade,U as getRgbTone,G as hexToRgb,T as hexToRgbArray,N as hexToRgba,S as hslToRgb,$ as isCSSVar,X as isResolvedColor,L as linearChannelToSrgb,A as mixTwoColors,j as mixTwoRgb,y as mixTwoRgba,k as oklabToLinearSrgb,K as oklabToOklch,J as oklchToGamutSafeSrgb,E as oklchToOklab,V as opacify,z as parseColorToken,b as relativeLuminance,w as rgbArrayToHex,C as rgbToHSL,H as rgbToHex,Z as splitTopLevelCommas,_ as srgbChannelToLinear,D as srgbToOklab,x as toLinearChannel};
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,9 +1,9 @@
1
- const c=(t,r)=>{if(!t||!r)return null;try{return new URL(t),null}catch{}const n=r[t];return n?n.content&&n.content.src:null},k=(t,r)=>{if(t[r])return t[r].value;if(t.default)return t[t.default].value;const n=Object.keys(t)[0];return n&&t[n]&&t[n].value},$=t=>{if(typeof t!="string"||!t)return null;const r=t.split(/[#?]/)[0].split(".").pop().trim();return["woff2","woff","ttf","otf","eot"].includes(r)?r:null},S=t=>t&&(t.includes("fonts.googleapis.com")||t.includes("fonts.gstatic.com")),x=t=>`@import url('${t}');`,d=t=>`@font-face { ${t} }`,y=(t,r,n,o={})=>{const l=(Array.isArray(r)?r:[r]).filter(s=>typeof s=="string"&&s).map(s=>{const f=$(s),u=f?` format('${f}')`:"";return`url('${s}')${u}`}).join(`,
1
+ const a=(t,r)=>{if(!t||!r)return null;try{return new URL(t),null}catch{}const n=r[t];return n?n.content&&n.content.src:null},b=(t,r)=>{if(t[r])return t[r].value;const n=()=>Object.keys(t).find(o=>o!=="default"&&t[o]&&t[o].value&&!t[o].isSystemFallback);if(t.default){const o=t[t.default];if(o&&o.isSystemFallback){const s=n();if(s)return t[s].value}if(o)return o.value}const e=n()||Object.keys(t).find(o=>o!=="default"&&t[o]&&t[o].value);return e&&t[e]&&t[e].value},S=t=>{if(typeof t!="string"||!t)return null;const r=t.split(/[#?]/)[0].split(".").pop().trim();return["woff2","woff","ttf","otf","eot"].includes(r)?r:null},$=t=>t&&(t.includes("fonts.googleapis.com")||t.includes("fonts.gstatic.com")),d=t=>`@import url('${t}');`,x=t=>`@font-face { ${t} }`,i=(t,r,n,e={})=>{const f=(Array.isArray(r)?r:[r]).filter(c=>typeof c=="string"&&c).map(c=>{const l=S(c),u=l?` format('${l}')`:"";return`url('${c}')${u}`}).join(`,
2
2
  `);return`
3
3
  font-family: '${t}';
4
- font-style: ${o.fontStyle||"normal"};${n?`
5
- font-weight: ${n};`:""}${o.fontStretch?`
6
- font-stretch: ${o.fontStretch};`:""}${o.fontDisplay?`
7
- font-display: ${o.fontDisplay};`:""}
8
- src: ${l};`},i=(t,r,n,o)=>`@font-face {${y(t,r,n,o)}
9
- }`,m=(t,r,n)=>Object.keys(r).map(a=>{const{url:e,fontWeight:l,fontStyle:s,fontDisplay:f,fontStretch:u}=r[a],F=Array.isArray(e)?e.map(p=>c(p,n)||p):c(e,n)||e;return y(t,F,l,{fontStyle:s,fontDisplay:f,fontStretch:u})}),v=t=>Object.keys(t).map(n=>m(n,t[n].value)),D=(t,r,n)=>{if(r&&r.isVariable){const e=c(r.url,n)||r.url;return S(e)?x(e):i(t,e,r.fontWeight,{fontStretch:r.fontStretch,fontDisplay:r.fontDisplay||"swap"})}if(r[0])return m(t,r,n).map(d);const a=Array.isArray(r.url)?r.url.map(e=>c(e,n)||e):c(r.url,n)||r.url;return i(t,a,r.fontWeight,{fontStyle:r.fontStyle,fontDisplay:r.fontDisplay,fontStretch:r.fontStretch})},U=(t,r)=>Object.keys(t).map(o=>D(o,t[o].value,r));export{k as getDefaultOrFirstKey,v as getFontFace,m as getFontFaceEach,D as getFontFaceEachString,U as getFontFaceString,$ as getFontFormat,S as isGoogleFontsUrl,c as resolveFileUrl,y as setCustomFont,i as setCustomFontMedia,x as setFontImport,d as setInCustomFontMedia};
4
+ font-style: ${e.fontStyle||"normal"};${n?`
5
+ font-weight: ${n};`:""}${e.fontStretch?`
6
+ font-stretch: ${e.fontStretch};`:""}${e.fontDisplay?`
7
+ font-display: ${e.fontDisplay};`:""}
8
+ src: ${f};`},p=(t,r,n,e)=>`@font-face {${i(t,r,n,e)}
9
+ }`,m=(t,r,n)=>Object.keys(r).map(o=>{const{url:s,fontWeight:f,fontStyle:c,fontDisplay:l,fontStretch:u}=r[o],F=Array.isArray(s)?s.map(y=>a(y,n)||y):a(s,n)||s;return i(t,F,f,{fontStyle:c,fontDisplay:l,fontStretch:u})}),D=t=>Object.keys(t).map(n=>m(n,t[n].value)),v=(t,r,n)=>{if(r&&r.isVariable){const s=a(r.url,n)||r.url;return $(s)?d(s):p(t,s,r.fontWeight,{fontStretch:r.fontStretch,fontDisplay:r.fontDisplay||"swap"})}if(r[0])return m(t,r,n).map(x);const o=Array.isArray(r.url)?r.url.map(s=>a(s,n)||s):a(r.url,n)||r.url;return p(t,o,r.fontWeight,{fontStyle:r.fontStyle,fontDisplay:r.fontDisplay,fontStretch:r.fontStretch})},j=(t,r)=>Object.keys(t).map(e=>v(e,t[e].value,r));export{b as getDefaultOrFirstKey,D as getFontFace,m as getFontFaceEach,v as getFontFaceEachString,j as getFontFaceString,S as getFontFormat,$ as isGoogleFontsUrl,a as resolveFileUrl,i as setCustomFont,p as setCustomFontMedia,d as setFontImport,x as setInCustomFontMedia};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/scratch",
3
- "description": "Φ / CSS framework and methodology.",
3
+ "description": "\u03a6 / CSS framework and methodology.",
4
4
  "author": "symbo.ls",
5
- "version": "3.14.774",
5
+ "version": "3.14.776",
6
6
  "files": [
7
7
  "dist",
8
8
  "*.js",
@@ -15,7 +15,6 @@
15
15
  "main": "./dist/cjs/index.js",
16
16
  "exports": {
17
17
  ".": {
18
- "development": "./index.js",
19
18
  "import": "./dist/esm/index.js",
20
19
  "require": "./dist/cjs/index.js",
21
20
  "default": "./dist/esm/index.js"
@@ -24,7 +23,7 @@
24
23
  },
25
24
  "source": "src/index.js",
26
25
  "publishConfig": {
27
- "access": "restricted"
26
+ "access": "public"
28
27
  },
29
28
  "scripts": {
30
29
  "build:esm": "esbuild $(find . -type f -name \"*.js\" -not -path \"*/dist/*\" -not -path \"*/node_modules/*\" -not -path \"*/__tests__/*\" -not -path \"*/test/*\" -not -path \"*/demo/*\" -not -path \"*/demos/*\" -not -path \"*/examples/*\" -not -path \"*/fixtures/*\" -not -name \"*.test.js\") --target=es2022 --format=esm --outbase=. --outdir=dist/esm --minify --log-level=warning",
@@ -37,7 +36,7 @@
37
36
  "@symbo.ls/utils": "^3.14.707",
38
37
  "color-contrast-checker": "^1.5.0"
39
38
  },
40
- "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
39
+ "gitHead": "e7fbb40d81040e265e980564d4eeb2709fa02cb0",
41
40
  "browser": "./dist/esm/index.js",
42
41
  "sideEffects": true
43
42
  }