@symbo.ls/scratch 3.14.776 → 3.14.778

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.create;var m=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var o in t)m(e,o,{get:t[o],enumerable:!0})},d=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of O(t))!V.call(e,n)&&n!==o&&m(e,n,{get:()=>t[n],enumerable:!(s=A(t,n))||s.enumerable});return e};var R=(e,t,o)=>(o=e!=null?x(y(e)):{},d(t||!e||!e.__esModule?m(o,"default",{value:e,enumerable:!0}):o,e)),F=e=>d(m({},"__esModule",{value:!0}),e);var B={};P(B,{CONFIG:()=>i,FACTORY:()=>l,activateConfig:()=>j,createConfig:()=>z,cssMediaVars:()=>v,cssVars:()=>h,defineResolvedThemeSignal:()=>p,defineThemeSignal:()=>f,getActiveConfig:()=>T,getResolvedThemeSignal:()=>M,getThemeSignal:()=>I,popConfig:()=>w,pushConfig:()=>L,setActiveConfig:()=>G,toCamel:()=>C});module.exports=F(B);var r=require("@symbo.ls/utils"),b=require("@symbo.ls/signal"),D=R(require("./defaultConfig/index.js"),1);const h={},v={},g=D,_={},C=e=>e.replace(/_([a-z])/g,(t,o)=>o.toUpperCase());for(const e in g){const t=e.toLowerCase();_[t]=g[e];const o=C(t);o!==t&&(_[o]=g[e]),t!==e&&(_[e]=g[e])}const i={verbose:!1,useVariable:!0,useReset:!0,globalTheme:"auto",cssVars:h,cssMediaVars:v,CSS_VARS:h,CSS_MEDIA_VARS:v,_scratchConfig:!0,..._},f=(e,t)=>{if(!e)return null;if(e.__globalThemeSignal)return(0,r.isDefined)(t)&&e.__globalThemeSignal.set(t),e.__globalThemeSignal;const o=(0,r.isDefined)(t)?t:e.globalTheme,s=(0,b.createSignal)((0,r.isDefined)(o)?o:"auto");return Object.defineProperty(e,"globalTheme",{get(){return s.get()},set(n){s.set(n)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"__globalThemeSignal",{value:s,enumerable:!1,configurable:!0,writable:!0}),s},I=e=>e?f(e):null,p=(e,t)=>{if(!e)return null;if(e.__resolvedThemeSignal)return(0,r.isDefined)(t)&&e.__resolvedThemeSignal.set(t),e.__resolvedThemeSignal;const o=(0,r.isDefined)(t)?t:e.resolvedTheme,s=(0,b.createSignal)((0,r.isDefined)(o)?o:null);return Object.defineProperty(e,"resolvedTheme",{get(){return s.get()},set(n){s.set(n)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"__resolvedThemeSignal",{value:s,enumerable:!1,configurable:!0,writable:!0}),s},M=e=>e?p(e):null;f(i),p(i);const S=(0,r.deepClone)(i),l={active:"0",0:i},j=e=>((0,r.isDefined)(e)&&(l.active=e),l[e||l.active]),u=[],L=e=>{e&&e._scratchConfig&&u.push(e)},w=()=>{u.pop()},T=e=>u.length?u[u.length-1]:l[e||l.active]||i,G=e=>{if((0,r.isObject)(e))return l.active="1",l[1]=(0,r.deepMerge)(e,(0,r.deepClone)(S)),f(l[1]),p(l[1]),e},E=["useReset","useFontImport","useIconSprite","useSvgSprite","useDocumentTheme","useDefaultIcons","useDefaultConfig"],N=["useVariable","globalTheme","verbose"],k=[["fontfamily","fontFamily","font_family"],["fontfamilytypes","fontFamilyTypes"],["semanticicons","semanticIcons"],["svgdata","svgData"]],U=e=>{for(const t of k){let o;for(const s of t){const n=e[s];(0,r.isObject)(n)&&(o=o?(0,r.deepMerge)(n,o):n)}if(o)for(const s of t)(0,r.isObject)(e[s])&&(e[s]=o)}},z=(e,t,{cleanBase:o=!1}={})=>{const s=o?null:T(),n=(0,r.deepClone)(!o&&s&&s._scratchConfig?s:S);for(const c of E)delete n[c];for(const c of N)Object.prototype.hasOwnProperty.call(S,c)?n[c]=S[c]:delete n[c];const a=(0,r.deepMerge)(t||{},n);return a.cssVars={},a.cssMediaVars={},a.CSS_VARS=a.cssVars,a.CSS_MEDIA_VARS=a.cssMediaVars,a._scratchConfig=!0,U(a),f(a),p(a),e&&(l[e]=a),a};
1
+ "use strict";var A=Object.create;var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var o in t)m(e,o,{get:t[o],enumerable:!0})},T=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of V(t))!F.call(e,n)&&n!==o&&m(e,n,{get:()=>t[n],enumerable:!(s=y(t,n))||s.enumerable});return e};var I=(e,t,o)=>(o=e!=null?A(R(e)):{},T(t||!e||!e.__esModule?m(o,"default",{value:e,enumerable:!0}):o,e)),D=e=>T(m({},"__esModule",{value:!0}),e);var X={};P(X,{CONFIG:()=>i,CONFIG_MERGE_EXL:()=>b,FACTORY:()=>l,activateConfig:()=>G,aliasCaseVariants:()=>C,createConfig:()=>B,cssMediaVars:()=>d,cssVars:()=>v,defineResolvedThemeSignal:()=>p,defineThemeSignal:()=>f,getActiveConfig:()=>O,getResolvedThemeSignal:()=>E,getThemeSignal:()=>j,popConfig:()=>w,pushConfig:()=>L,setActiveConfig:()=>N,toCamel:()=>x});module.exports=D(X);var r=require("@symbo.ls/utils"),h=require("@symbo.ls/signal"),M=I(require("./defaultConfig/index.js"),1);const v={},d={},b=new Set,g=M,_={},x=e=>e.replace(/_([a-z])/g,(t,o)=>o.toUpperCase());for(const e in g){const t=e.toLowerCase();_[t]=g[e];const o=x(t);o!==t&&(_[o]=g[e]),t!==e&&(_[e]=g[e])}const i={verbose:!1,useVariable:!0,useReset:!0,globalTheme:"auto",cssVars:v,cssMediaVars:d,CSS_VARS:v,CSS_MEDIA_VARS:d,_scratchConfig:!0,..._},f=(e,t)=>{if(!e)return null;if(e.__globalThemeSignal)return(0,r.isDefined)(t)&&e.__globalThemeSignal.set(t),e.__globalThemeSignal;const o=(0,r.isDefined)(t)?t:e.globalTheme,s=(0,h.createSignal)((0,r.isDefined)(o)?o:"auto");return Object.defineProperty(e,"globalTheme",{get(){return s.get()},set(n){s.set(n)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"__globalThemeSignal",{value:s,enumerable:!1,configurable:!0,writable:!0}),s},j=e=>e?f(e):null,p=(e,t)=>{if(!e)return null;if(e.__resolvedThemeSignal)return(0,r.isDefined)(t)&&e.__resolvedThemeSignal.set(t),e.__resolvedThemeSignal;const o=(0,r.isDefined)(t)?t:e.resolvedTheme,s=(0,h.createSignal)((0,r.isDefined)(o)?o:null);return Object.defineProperty(e,"resolvedTheme",{get(){return s.get()},set(n){s.set(n)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"__resolvedThemeSignal",{value:s,enumerable:!1,configurable:!0,writable:!0}),s},E=e=>e?p(e):null;f(i),p(i);const S=(0,r.deepClone)(i),l={active:"0",0:i},G=e=>((0,r.isDefined)(e)&&(l.active=e),l[e||l.active]),u=[],L=e=>{e&&e._scratchConfig&&u.push(e)},w=()=>{u.pop()},O=e=>u.length?u[u.length-1]:l[e||l.active]||i,N=e=>{if((0,r.isObject)(e))return l.active="1",l[1]=(0,r.deepMerge)(e,(0,r.deepClone)(S),b),C(l[1]),f(l[1]),p(l[1]),e},k=["useReset","useFontImport","useIconSprite","useSvgSprite","useDocumentTheme","useDefaultIcons","useDefaultConfig"],U=["useVariable","globalTheme","verbose"],z=[["fontfamily","fontFamily","font_family"],["fontfamilytypes","fontFamilyTypes"],["semanticicons","semanticIcons"],["svgdata","svgData"]],C=e=>{for(const t of z){let o;for(const s of t){const n=e[s];(0,r.isObject)(n)&&(o=o?(0,r.deepMerge)(o,n,b):n)}if(o)for(const s of t)(0,r.isObject)(e[s])&&(e[s]=o)}},B=(e,t,{cleanBase:o=!1}={})=>{const s=o?null:O(),n=(0,r.deepClone)(!o&&s&&s._scratchConfig?s:S);for(const c of k)delete n[c];for(const c of U)Object.prototype.hasOwnProperty.call(S,c)?n[c]=S[c]:delete n[c];const a=(0,r.deepMerge)(t||{},n,b);return a.cssVars={},a.cssMediaVars={},a.CSS_VARS=a.cssVars,a.CSS_MEDIA_VARS=a.cssMediaVars,a._scratchConfig=!0,C(a),f(a),p(a),e&&(l[e]=a),a};
@@ -1 +1 @@
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};
1
+ "use strict";var R=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var B=(t,s)=>{for(var e in s)R(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&&R(t,r,{get:()=>s[r],enumerable:!(o=Y(s,r))||o.enumerable});return t};var U=t=>K(R({},"__esModule",{value:!0}),t);var N={};B(N,{VALUE_TRANSFORMERS:()=>D,changeGlobalTheme:()=>Q,set:()=>G,setEach:()=>I,setValue:()=>F});module.exports=U(N);var m=require("./factory.js"),n=require("./system/index.js"),_=require("@symbo.ls/utils"),g=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)}}},X=(t,s)=>{const e=(0,m.getActiveConfig)(),{cssVars:o}=e,r=s.startsWith("--")?s:`--${s}`;return o[r]=t,t},d=t=>t,D={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:X,sizes:d,shape:d},J=(t,s,e,o)=>{(0,g.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,m.getActiveConfig)(),r=(0,m.toCamel)(t),i=r.toLowerCase(),u=o[r]||o[i]||o[t],c=(0,g.isHostObject)(u)?J(o,u,i,[r,i,t]):u,h=D[r]||D[i];if(h)try{const l=h(s,e);return c&&(c[e]=l),c}catch(l){o.verbose&&console.warn("Error setting",i,"value",s,e,l)}if(!h){const l=c||(o[i]={});return l[e]=s,l}o.verbose&&console.warn("Can not find",i,"method in scratch")},I=(t,s)=>{const e=(0,m.getActiveConfig)(),o=t.toLowerCase();return(0,g.isHostObject)(s)?((0,g.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,u)=>{const c=(0,_.isObject)(s[i])||(0,_.isArray)(s[i])?1:0,h=(0,_.isObject)(s[u])||(0,_.isArray)(s[u])?1:0;return c-h}).forEach(i=>{try{return F(o,s[i],i)}catch(u){e.verbose&&console.warn("Error setting",o,"value",s[i],i,u)}}),e[o]||e[t])},Q=(t,s)=>{const e=s||(0,m.getActiveConfig)();e.globalTheme=t;const r=(0,g.resolveConfigDocument)(e)||(typeof document<"u"?document:null),i=r&&r.defaultView||(typeof window<"u"?window:null);if(r){const c=e.themeRoot||r.documentElement,h=t&&t!=="auto";if(c[T]=e,h)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 l=y=>{const S=y.matches?"dark":"light";c.setAttribute("data-theme",S),e.resolvedTheme=S},v=i.matchMedia("(prefers-color-scheme: dark)");l(v),c.style.colorScheme="light dark",W(e,v,l)}else w(e),c.setAttribute("data-theme","light"),e.resolvedTheme="light",c.style.colorScheme="light"}const u=e.varPrefix?`--${e.varPrefix}-theme-`:"--theme-";for(const c in e.cssVars)c.startsWith(u)&&delete e.cssVars[c];for(const c in e.cssMediaVars)delete e.cssMediaVars[c];if(r&&e.cssVars){const c=e.scopeSelector||":root",h=r.styleSheets;for(let l=0;l<h.length;l++)try{const v=h[l].cssRules;for(let y=0;y<v.length;y++)if(v[y].selectorText===c){for(const S in e.cssVars)v[y].style.setProperty(S,e.cssVars[S]);return e}}catch{}}return e},Z={},G=(t,s=Z)=>{let e=s.config||(0,m.getActiveConfig)();const{version:o,verbose:r,useVariable:i,useReset:u,useSvgSprite:c,useFontImport:h,useIconSprite:l,globalTheme:v,themeRoot:y,useDocumentTheme:S,useDefaultConfig:L,semanticIcons:A,hoverMedia:C,files:M,assets:P,...p}=t;s.newConfig&&(e=(0,m.setActiveConfig)(s.newConfig)),(0,g.isDomDocument)(p.document)&&(e.__domDocument=p.document,delete p.document),(0,g.isDomDocument)(e.document)&&(e.__domDocument||(e.__domDocument=e.document),e.document={}),M!==void 0&&(e.files=M),P!==void 0&&(e.assets=P),r!==void 0&&(e.verbose=r),i!==void 0&&(e.useVariable=i),u!==void 0&&(e.useReset=u),h!==void 0&&(e.useFontImport=h),c!==void 0&&(e.useSvgSprite=c),l!==void 0&&(e.useIconSprite=l),S!==void 0&&(e.useDocumentTheme=S),v!==void 0&&(e.globalTheme=v),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),C!==void 0&&(e.hoverMedia=C),e.verbose&&console.log(e);const E=(0,g.resolveConfigDocument)(e)||(typeof document<"u"?document:null),V=E&&E.defaultView||(typeof window<"u"?window:null),f=E&&(e.themeRoot||E.documentElement);if(f&&typeof f.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")w(e),f.setAttribute("data-theme",e.globalTheme),e.resolvedTheme=e.globalTheme,f[T]=e,e.globalTheme==="dark"||e.globalTheme==="light"?f.style.colorScheme=e.globalTheme:f.style.colorScheme="light dark";else if(f[T]&&f[T]!==e&&f.hasAttribute("data-theme"))w(e),e.resolvedTheme=f.getAttribute("data-theme");else if(V&&V.matchMedia){const b=H=>{const O=H.matches?"dark":"light";f.setAttribute("data-theme",O),e.resolvedTheme=O},j=V.matchMedia("(prefers-color-scheme: dark)");b(j),f.style.colorScheme="light dark",f[T]=e,W(e,j,b)}else w(e),f.setAttribute("data-theme","light"),e.resolvedTheme="light",f.style.colorScheme="light",f[T]=e;e.__svgCache||(e.__svgCache={}),(0,m.aliasCaseVariants)(p);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],m.CONFIG_MERGE_EXL)}),x.map(a=>{const b=a.toLowerCase();if(!(b!==a&&k.has(b)))return I(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};
@@ -1 +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
+ "use strict";var f=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var s in e)f(t,s,{get:e[s],enumerable:!0})},p=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c(e))!m.call(t,i)&&i!==s&&f(t,i,{get:()=>e[i],enumerable:!(o=S(e,i))||o.enumerable});return t};var g=t=>p(f({},"__esModule",{value:!0}),t);var _={};C(_,{resolveBorderValue:()=>R});module.exports=g(_);var u=require("./color.js"),a=require("./spacing.js"),n=require("../utils/color.js");const E=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),O=t=>E.has(t),R=(t,e,s)=>{if(t==null)return;const o=t+"";if(n.CSS_NATIVE_COLOR_REGEX.test(o))return o;const i=o.trim();return i==="none"||i==="0"||i==="initial"||i==="inherit"||i==="unset"?o:o.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if((0,n.isCSSVar)(r))return`var(${r})`;if(O(r)||/^\d/.test(r)||r==="0")return r;const l=(0,u.quietColorProbe)(()=>(0,u.getColor)(r,e));if((0,n.isResolvedColor)(l))return l;if(n.COMPOUND_CSS_KEYWORDS.has(r.toLowerCase()))return r;s&&s(r);const d=(0,a.getSpacingByKey)(r,"border");return d&&d.border?d.border:r}).join(" ")};
@@ -1 +1 @@
1
- "use strict";var 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
+ "use strict";var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var B=(e,r)=>{for(var t in r)M(e,t,{get:r[t],enumerable:!0})},K=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Q(r))!z.call(e,o)&&o!==t&&M(e,o,{get:()=>r[o],enumerable:!(n=H(r,o))||n.enumerable});return e};var U=e=>K(M({},"__esModule",{value:!0}),e);var I={};B(I,{STANDARD_SCHEME_QUERIES:()=>P,getColor:()=>S,getMediaColor:()=>N,quietColorProbe:()=>X,resolveColorRgb:()=>v,schemeGuardSelector:()=>j,schemeMediaQuery:()=>O,setAdaptiveSchemeVar:()=>L,setColor:()=>E,setGradient:()=>W});module.exports=U(I);var d=require("@symbo.ls/utils"),R=require("../factory.js"),g=require("../utils/index.js");const P={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},O=(e,r)=>{const t=r.media&&r.media[e]||P[e];return t?"@media "+(t==="print"?`${t}`:`screen and ${t}`):null},j=e=>{const r=e.scopeSelector||":root";return`${r===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${r}:not([data-theme])`} &`},y=new Set,J=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),C=new Set,T=e=>{if(!e)return!1;const{color:r,gradient:t}=e;return!!((0,d.isObject)(r)&&Object.keys(r).length||(0,d.isObject)(t)&&Object.keys(t).length)},_=new Set;let D=0;const X=e=>{D++;try{return e()}finally{D--}},Y=(e,r)=>{if(!(0,d.isString)(e)||e.indexOf(" ")===-1)return null;const t=e.replace(/\s+/g,""),n=(0,g.parseColorToken)(t);if(!n||n.passthrough||n.cssVar)return null;const{color:o,gradient:c}=r;return!o[n.name]&&!c[n.name]?null:t},x=(e,r,t)=>{const n=Y(e,t);if(n){if(!_.has(e)){_.add(e);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` has a space before its alpha/tone modifier${a} \u2014 did you mean \`${n}\`? The space form never resolves, so the atomic class it mints carries no CSS value and paints invisibly. Dropped rather than shipped invisible.`)}return}const o=(0,g.parseColorToken)(e);if(o&&o.name&&!o.passthrough&&!o.cssVar&&(o.alpha!==void 0||o.tone!==void 0)&&T(t)&&!t.color[o.name]&&!t.gradient[o.name]){if(!D&&!C.has(e)){C.add(e);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` does not resolve${a} \u2014 \`${o.name}\` is not in the palette. Dropped rather than emitted as a raw value, which is invalid CSS the browser discards silently. Define it in designSystem/color.js or use a palette token.`)}return}const c=(0,d.isString)(r)?r.toLowerCase():"";if(!J.has(c)||!T(t))return e;if(!C.has(c)){C.add(c);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${a}. Dropped rather than emitted as a raw browser colour, which renders theme-blind and can be unreadable ("looks designed", so it ships unnoticed). Define it in designSystem/color.js or use a palette token.`)}},S=(e,r,t)=>{const n=t||(0,R.getActiveConfig)();if(!(0,d.isString)(e)){n.verbose&&console.warn(e,"- type for color is not valid");return}if((0,g.isCSSVar)(e))return`var(${e})`;r&&e[r]&&(e=e[r]);let o,c,a;if((0,d.isArray)(e))[o,c,a]=e;else{const i=(0,g.parseColorToken)(e);if(!i){const{color:h,gradient:V}=n;let b=V[e]||h[e];return b?(r&&b[r]&&(b=b[r]),n.useVariable?`var(${b.var})`:b.value):x(e,e,n)}if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;o=i.name,c=i.alpha,a=i.tone}const{color:m,gradient:u}=n;let s=m[o]||u[o];if(!s)return x(e,o,n);if(r)if(s[r]!==void 0)s=s[r];else if((0,d.isArray)(s)){const i=r.charCodeAt(0)===64?r.slice(1):r;i==="dark"?s=s[1]!==void 0?s[1]:s[0]:(i!=="light"&&n.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",r),s=s[0])}else n.verbose&&console.warn(e," - does not have ",r);if((0,d.isString)(s)){if(y.has(o))return s;y.add(o);try{return S(s,null,t)}finally{y.delete(o)}}let p=s.rgb;if(!p){const i=n.useVariable?`var(${s.var})`:s.value;if((c||a)&&i){const h=c!==void 0?c:1;if(!a)return`rgb(from ${i} r g b / ${h})`;if(a.charCodeAt(0)===43||a.charCodeAt(0)===45){const b=parseFloat(a),f=b<0?"-":"+",l=Math.abs(b);return`rgb(from ${i} calc(r ${f} ${l}) calc(g ${f} ${l}) calc(b ${f} ${l}) / ${h})`}return`hsl(from ${i} h s ${a}% / ${h})`}return i}return a&&!s[a]&&(p=(0,g.getRgbTone)(p,a),s[a]={rgb:p,var:`${s.var}-${a}`}),s[a]&&(p=s[a].rgb),c?`rgba(${p}, ${c})`:a?`rgba(${p}, ${s.alpha!==void 0?s.alpha:1})`:n.useVariable?`var(${s.var})`:s.value!==void 0?s.value:`rgb(${p})`},q=e=>{const r=(0,g.colorStringToRgbaArray)(e);return!r||r.length<3||r[0]===0&&r[1]===0&&r[2]===0&&r[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[r[0],r[1],r[2]],alpha:r[3]!==void 0?r[3]:1}},Z=(e,r)=>{if(!r)return e;let t=e.rgb;if(r.tone){const o=(0,g.getRgbTone)(t,r.tone);t=(0,d.isString)(o)?o.split(",").map(c=>parseFloat(c.trim())):o}const n=r.alpha!==void 0?parseFloat(r.alpha):e.alpha;return{rgb:t,alpha:n}},v=(e,r,t)=>{const n=r||(0,R.getActiveConfig)();if(!(0,d.isString)(e))return null;const o=(0,g.parseColorToken)(e);if(o){if(o.passthrough){const h=(0,g.colorStringToRgbaArray)(o.passthrough);return h&&h.length>=3?{rgb:[h[0],h[1],h[2]],alpha:h[3]!==void 0?h[3]:1}:null}if(o.cssVar)return null}const c=o?o.name:e,{color:a,gradient:m}=n;let u=a[c]||m[c];if(!u)return q(e);if((0,d.isString)(u)){let h;if(y.has(c))h=q(u);else{y.add(c);try{h=v(u,n,t)}finally{y.delete(c)}}return h?Z(h,o):null}if(u.rgb===void 0&&(0,d.isObject)(u)){const h=`@${t||"light"}`;u=u[h]!==void 0?u[h]:u["@light"]}if(!u||u.rgb===void 0)return null;let s=u.rgb;o&&o.tone&&(s=(0,g.getRgbTone)(s,o.tone));const p=(0,d.isString)(s)?s.split(",").map(h=>parseFloat(h.trim())):s,i=o&&o.alpha!==void 0?parseFloat(o.alpha):u.alpha!==void 0?u.alpha:1;return{rgb:p,alpha:i}},N=(e,r,t)=>{const n=t||(0,R.getActiveConfig)();if(r||(r=n.globalTheme==="auto"?null:n.globalTheme),!(0,d.isString)(e)){n.verbose&&console.warn(e,"- type for color is not valid");return}if((0,g.isCSSVar)(e))return`var(${e})`;let o,c,a;if((0,d.isArray)(e))o=e[0];else{const i=(0,g.parseColorToken)(e);if(i){if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;o=i.name,c=i.alpha,a=i.tone}else o=e}const{color:m,gradient:u}=n,s=m[o]||u[o],p=(0,d.isObject)(s);if(p&&s.value)return S(e,`@${r}`,t);if(p){if(n.useVariable&&s.var)return c||a?S(e,null,t):`var(${s.var})`;if(r)return S(e,`@${r}`,t);{const i={},h=j(n);for(const V in s){if(V.charCodeAt(0)!==64)continue;const b=V.slice(1),f=S(e,V,t);if(f!==void 0&&(i[`[data-theme="${b}"] &`]=f,b==="light"||b==="dark")){const l=O(b,n);if(!l)continue;i[l]={[h]:f}}}return i}}else return x(e,o,n)},L=(e,r,t,n)=>{const c=`--${n.varPrefix?n.varPrefix+"-":""}${r}-${t}`;let a;const m={};for(const u in e){if(u.charCodeAt(0)!==64)continue;const s=u.slice(1),p=e[u],i=p&&(p.value||p);!i||typeof i!="string"||(m[s]=i,(s==="light"||a===void 0)&&(a=i))}if(a!==void 0){n.cssVars[c]=a,n.cssMediaVars||(n.cssMediaVars={});for(const u in m){const s=`[data-theme="${u}"]`;if(n.cssMediaVars[s]||(n.cssMediaVars[s]={}),n.cssMediaVars[s][c]=m[u],u==="light"||u==="dark"){const p=`@media (prefers-color-scheme: ${u})`;n.cssMediaVars[p]||(n.cssMediaVars[p]={}),n.cssMediaVars[p][c]=m[u]}}return e.var=c,c}},E=(e,r,t)=>{const n=(0,R.getActiveConfig)();if((0,d.isObject)(e)&&e.value!==void 0&&(e.rgb!==void 0||e.var!==void 0))return n.useVariable&&e.var&&(n.cssVars[e.var]=e.value),e;if((0,d.isString)(e)&&(0,g.isCSSVar)(e)){const f=e.slice(2);if(e=S(f),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const l=f.split(" ");let $=n.color[l[0]];if($&&!$.value&&!$.rgb&&((0,d.isString)($)||(0,d.isArray)($)||(0,d.isObject)($))&&!y.has(l[0])){y.add(l[0]);try{n.color[l[0]]=E($,l[0])}finally{y.delete(l[0])}$=n.color[l[0]]}if($&&$.value){let w=$.rgb;const A=l[1]!==void 0?l[1]:"1",k=l[2];k&&(w=(0,g.getRgbTone)(w,k)),e=`rgba(${w}, ${A})`}else{const w=l[2],A=l[1]!==void 0?l[1]:"1";if(w)try{const k=(0,g.colorStringToRgbaArray)(l[0]);k&&k.length>=3?e=`rgba(${(0,g.getRgbTone)(k.slice(0,3).join(", "),w)}, ${A})`:e=l[0]}catch{e=l[0]}else e=l[0]}}}if((0,d.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,d.isObject)(e)){const f={};for(const l in e)l!=="var"&&(f[l]=E(e[l],r,l.slice(0,1)==="@"?l.slice(1):l));return n.useVariable&&L(f,"color",r,n),f}const c=`--${n.varPrefix?n.varPrefix+"-":""}color-${r}`+(t?`-${t}`:"");let a=e.value||e;if((0,d.isString)(a)&&!a.includes("(")&&!a.startsWith("#")){const f=(0,g.parseColorToken)(a);if(f&&f.name&&!f.passthrough&&!f.cssVar){const l=n.color[f.name];if(l&&!l.value&&!l.rgb&&((0,d.isString)(l)||(0,d.isArray)(l)||(0,d.isObject)(l))&&!y.has(f.name)){y.add(f.name);try{n.color[f.name]=E(l,f.name)}finally{y.delete(f.name)}}const $=n.color[f.name];if($&&$.rgb){let w=$.rgb;f.tone&&(w=(0,g.getRgbTone)(w,f.tone));const A=f.alpha!==void 0?parseFloat(f.alpha):$.alpha!==void 0?$.alpha:1;a=`rgba(${w}, ${A})`}}}const m=(0,g.colorStringToRgbaArray)(a),[u,s,p,i=1]=m,h=parseFloat(i.toFixed(2)),V=`${u}, ${s}, ${p}`,b=`rgba(${V}, ${h})`;return n.useVariable&&(n.cssVars[c]=b),{var:c,rgb:V,alpha:h,value:b}},W=(e,r,t)=>{const n=(0,R.getActiveConfig)();if((0,d.isObject)(e)&&e.value!==void 0&&e.var!==void 0)return n.useVariable&&(n.cssVars[e.var]=e.value),e;if((0,d.isString)(e)&&(0,g.isCSSVar)(e)&&(e=S(e.slice(2))),(0,d.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,d.isObject)(e)){const a={};for(const m in e)m!=="var"&&(a[m]=W(e[m],r,m.slice(0,1)==="@"?m.slice(1):m));return n.useVariable&&L(a,"gradient",r,n),a}const c=`--${n.varPrefix?n.varPrefix+"-":""}gradient-${r}`+(t?`-${t}`:"");return n.useVariable&&(n.cssVars[c]=e.value||e),{var:c,value:e.value||e}};
@@ -1 +1 @@
1
- "use strict";var 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
+ "use strict";var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},O=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of p(e))!S.call(t,n)&&n!==r&&l(t,n,{get:()=>e[n],enumerable:!(i=y(e,n))||i.enumerable});return t};var d=t=>O(l({},"__esModule",{value:!0}),t);var I={};g(I,{getFontFamily:()=>A,setFont:()=>h,setFontFamily:()=>C});module.exports=d(I);var F=require("@symbo.ls/utils"),u=require("@symbo.ls/utils"),c=require("../factory.js"),o=require("../utils/index.js");const h=(t,e)=>{const r=(0,c.getActiveConfig)(),i=`--font-${e}`;if(!t||(0,F.isArray)(t)&&!t[0])return;let n;if(t.isVariable){const s=(0,o.resolveFileUrl)(t.url,r.files)||t.url;(0,o.isGoogleFontsUrl)(s)?n=(0,o.setFontImport)(s):n=(0,o.setCustomFontMedia)(e,s,t.fontWeight,{fontStretch:t.fontStretch,fontDisplay:t.fontDisplay||"swap",unicodeRange:t.unicodeRange})}else if(t[0])n=(0,o.getFontFaceEach)(e,t,r.files);else{const s=Array.isArray(t.url)?t.url.map(f=>(0,o.resolveFileUrl)(f,r.files)||f):(0,o.resolveFileUrl)(t.url,r.files)||t.url;n=(0,o.setCustomFontMedia)(e,s,t.fontWeight,{fontStyle:t.fontStyle,fontDisplay:t.fontDisplay,fontStretch:t.fontStretch,unicodeRange:t.unicodeRange})}return{var:i,value:t,fontFace:n}},A=(t,e)=>{const r=(0,c.getActiveConfig)(),{fontFamily:i}=r;return(0,o.getDefaultOrFirstKey)(e||i,t)},C=(t,e)=>{const r=(0,c.getActiveConfig)(),{fontFamily:i,fontFamilyTypes:n}=r;let{value:s,type:f}=t;t.isDefault&&(!t.isSystemFallback||!i.default)&&(i.default=e),(0,F.isObject)(s)&&(s=(0,u.arrayzeValue)(s));const a=`--font-family-${e}`,m=`${s.join(", ")}, ${n[f]}`;return{var:a,value:m,arr:s,type:f,isSystemFallback:!!t.isSystemFallback}};
@@ -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 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
+ "use strict";var h=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var E=(r,n)=>{for(var e in n)h(r,e,{get:n[e],enumerable:!0})},F=(r,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of w(n))!z.call(r,t)&&t!==e&&h(r,t,{get:()=>n[t],enumerable:!(a=T(n,t))||a.enumerable});return r};var x=r=>F(h({},"__esModule",{value:!0}),r);var A={};E(A,{applyReset:()=>k});module.exports=x(A);var s=require("@symbo.ls/utils"),u=require("../factory.js"),d=require("./theme.js");const k=(r={})=>{const n=(0,u.getActiveConfig)(),e=n.typography||{},a=n.document||{},t=(0,s.isObject)(n.reset)?n.reset:n.reset={};if(t[":root"]){const i=t,o=e.templates||{};i.body={...n.useDocumentTheme?(0,d.getMediaTheme)("document"):{},...o.body},i.h1=o.h1,i.h2=o.h2,i.h3=o.h3,i.h4=o.h4,i.h5=o.h5,i.h6=o.h6}const{body:b,...f}=e.templates||{},p=n.useDocumentTheme?(0,d.getMediaTheme)("document"):{};if(t.html&&(0,s.overwriteDeep)(t.html,p),e.unit)for(const i in f){if(i.slice(0,6)!=="@media")continue;const o=f[i];delete f[i],!(!o||!o.fontSize)&&(t[i]||(t[i]={}),t[i].html||(t[i].html={}),t[i].html.fontSize===void 0&&(t[i].html.fontSize=o.fontSize))}if(e.unit){const i=n.media||{};for(const o in e){if(o.charAt(0)!=="@")continue;const c=e[o];if(!c||c.unit===e.unit||!c.unit)continue;const g=c.unit,y=c.base||e.base,D=c.browserDefault||e.browserDefault,S=o.slice(1),l=i[S];if(!l)continue;const m="@media "+(l==="print"?l:"screen and "+l);t[m]||(t[m]={}),t[m].html||(t[m].html={}),t[m].html.fontSize=y/D+g}}return(0,s.deepMerge)((0,s.merge)(t,r),{html:{position:"absolute",width:"100%",height:"100%",top:"0",left:"0",margin:"0",WebkitFontSmoothing:"subpixel-antialiased",...p,fontSize:e.unit?e.base/e.browserDefault+e.unit:e.browserDefault+"px",fontFamily:a.fontFamily,lineHeight:a.lineHeight},body:{boxSizing:"border-box",height:"100%",margin:0,fontFamily:a.fontFamily,fontSize:e.unit?"1"+n.unit.default:e.base/e.browserDefault+n.unit.default,...f,...b},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}},u.CONFIG_MERGE_EXL)};
@@ -1 +1 @@
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
+ "use strict";var S=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var j=(r,o)=>{for(var i in o)S(r,i,{get:o[i],enumerable:!0})},A=(r,o,i,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of $(o))!g.call(r,t)&&t!==i&&S(r,t,{get:()=>o[t],enumerable:!(c=V(o,t))||c.enumerable});return r};var x=r=>A(S({},"__esModule",{value:!0}),r);var W={};j(W,{getShadow:()=>N,resolveShadowValue:()=>O,setShadow:()=>C});module.exports=x(W);var h=require("../factory.js"),p=require("./color.js"),b=require("./spacing.js"),s=require("../utils/color.js"),a=require("@symbo.ls/utils");const O=(r,o,i)=>!(0,a.isString)(r)||s.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,s.splitTopLevelCommas)(r).map(c=>(c=c.trim(),c.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const n=(0,p.quietColorProbe)(()=>(0,p.getColor)(t,o));if((0,s.isResolvedColor)(n))return n;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none"||s.COMPOUND_CSS_KEYWORDS.has(t.toLowerCase()))return t;i&&i(t);const f=(0,b.getSpacingByKey)(t,"shadow");return f&&f.shadow?f.shadow:t}).join(" "))).join(", "),C=(r,o,i,c)=>{const t=(0,h.getActiveConfig)();if((0,a.isArray)(r)){const e={"@light":C(r[0],o,"light"),"@dark":C(r[1],o,"dark")};return t.useVariable&&(0,p.setAdaptiveSchemeVar)(e,"shadow",o,t),e}if((0,a.isObject)(r)){const e={};for(const d in r)e[d]=C(r[d],o,d.startsWith("@")?d.slice(1):d);return t.useVariable&&(0,p.setAdaptiveSchemeVar)(e,"shadow",o,t),e}(0,a.isString)(r)&&!s.CSS_NATIVE_COLOR_REGEX.test(r)&&(r=O(r));const f=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[f]=r),{var:f,value:r}},N=(r,o)=>{const i=(0,h.getActiveConfig)();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!(0,a.isString)(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if((0,s.isCSSVar)(r))return`var(${r})`;const[c]=(0,a.isArray)(r)?r:r.split(" "),n=i.shadow[c],f=(0,a.isObject)(n);if(!n)return i.verbose&&console.warn("Can't find color ",c),r;if(f&&!n.value&&i.useVariable&&n.var)return`var(${n.var})`;if(o){const e=n["@"+o]||n[o];if(e)return e.value!==void 0?e.value:e;i.verbose&&console.warn(r," - does not have ",o)}if(f&&n.value)return n.value;if(f){const e={};for(const d in n){if(d.charCodeAt(0)!==64)continue;const m=i.media[d.slice(1)];if(!m)continue;const l="@media "+(m==="print"?`${m}`:`screen and ${m}`),u=n[d],w=u&&(u.value!==void 0?u.value:u);w!==void 0&&(e[l]=w)}return e}return i.verbose&&console.warn("Can't find color",r),r};
@@ -1 +1 @@
1
- "use strict";var R=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var Z=Object.prototype.hasOwnProperty;var F=(e,r)=>{for(var o in r)R(e,o,{get:r[o],enumerable:!0})},J=(e,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of W(r))!Z.call(e,n)&&n!==o&&R(e,n,{get:()=>r[n],enumerable:!(s=U(r,n))||s.enumerable});return e};var Q=e=>J(R({},"__esModule",{value:!0}),e);var ie={};F(ie,{getMediaTheme:()=>w,getTheme:()=>A,setMediaTheme:()=>E,setTheme:()=>ne});module.exports=Q(ie);var v=require("./color.js"),x=require("./shadow.js"),p=require("./border.js"),S=require("../factory.js"),y=require("../utils/color.js"),a=require("@symbo.ls/utils");const X=new Set(["black","white","red","green","blue","yellow","orange","purple","pink","brown","gray","grey","cyan","magenta","lime","olive","navy","teal","aqua","maroon","silver","fuchsia","transparent","currentColor","currentcolor","inherit","initial","unset","none","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple"]),q=["color","Color","background","Background","fill","Fill","stroke","Stroke"],Y=e=>{for(let r=0;r<q.length;r++)if(e.includes(q[r]))return!0;return!1},I={boxShadow:x.resolveShadowValue,textShadow:x.resolveShadowValue,border:p.resolveBorderValue,borderTop:p.resolveBorderValue,borderRight:p.resolveBorderValue,borderBottom:p.resolveBorderValue,borderLeft:p.resolveBorderValue,outline:p.resolveBorderValue,columnRule:p.resolveBorderValue},K=e=>{if(!e)return!1;const r=(0,y.parseColorToken)(e);return!r||!r.name||r.passthrough||r.cssVar?!1:r.alpha!==void 0||r.tone!==void 0},_=new Set,G=(e,r,o,s,n,i)=>{if(!(0,a.isLoudDevRuntime)())return;const t=`${e}::${r}::${o||""}::${s}`;_.has(t)||(_.add(t),console.warn(`[smbls/scratch] theme param "${r}" on "${e}"`+(o?` (${o})`:"")+` did not fully resolve: "${s}" -> "${n}" still contains the unresolved token "${i}". This is not valid CSS \u2014 the browser will drop the whole declaration. Register "${i}" as a design-system color token or fix the typo.`))},L=(e,r,o,s)=>{const n=I[r];if(!n)return(0,v.getColor)(o,s);let i=null;const t=n(o,s,u=>{!i&&K(u)&&(i=u)});return i&&G(e,r,s,o,t,i),t},V=e=>{const r={},{state:o,media:s,helpers:n,...i}=e;return Object.keys(i).map(u=>{const c=["color","Color","background","border"].some(d=>u.includes(d));return r[u]=c?(0,v.getColor)(e[u]):e[u]}),r},$=e=>(e.value||(e.value=V(e)),e.value),A=(e,r)=>{const o=(0,S.getActiveConfig)();if(o.useVariable)return w(e,r);const s=o.theme;if((0,a.isString)(e)){const[n,i]=e.split(" "),t=s[n];if(t){if(!i&&!r)return $(t);e=[n,i||r]}}if((0,a.isObjectLike)(e)&&e[1]){const n=e[0],i=e[1],{helpers:t,media:u,state:l}=s[n];if(u&&u[i])return $(u[i]);if(t&&t[i])return $(t[i]);if(l&&l[i])return $(l[i])}else if((0,a.isObject)(e))return V(e)},ee=(e,r,o)=>{if((0,a.isObject)(r))e.variants.inverse.value=V(r);else if(r===!0){const{color:s,background:n}=o;e.variants.inverse={value:{color:n,background:s}}}},re=(e,r,o,s)=>{const n=A(o);s[`&:${r}`]=n,(0,a.isObject)(o)&&!o.value&&(o.value=n)},N=(e,r)=>{const{state:o}=e;return o?(Object.keys(o).map(n=>{const i=o[n];return re(e,n,i,r),e}),e):void 0},oe=(e,r,o,s)=>{const n=A(o);s[`@media (prefers-color-scheme: ${r})`]=n,(0,a.isObject)(o)&&!o.value&&(o.value=n)},H=(e,r)=>{const{media:o}=e;return o?(Object.keys(o).map(n=>{const i=o[n];return(n==="dark"||n==="light")&&oe(e,n,i,r),n==="inverse"&&ee(e,i,r),e}),e):void 0},D=(e,r)=>{const o=(0,S.getActiveConfig)(),{helpers:s}=e;return s?(Object.keys(s).map(i=>{const t=s[i];return(0,a.isString)(t)?s[i]=o.theme[t]:$(s[i]),e}),e):void 0},ne=(e,r)=>{const o=(0,S.getActiveConfig)();if(o.useVariable)return E(e,r);const{state:s,media:n,helpers:i}=e,t=V(e,r),l=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}`;return N(e,t),H(e,t),D(e,t),{var:l,value:t,state:s,media:n,helpers:i}},le={"@":(e,r)=>H(e,r),":":(e,r)=>N(e,r),".":(e,r)=>D(e,r)},O=(e,r,o)=>{const{cssVars:s}=o;o.cssMediaVars||(o.cssMediaVars={});const n=o.cssMediaVars,i=o.globalTheme!==void 0?o.globalTheme:"auto",t={},u=new Set;for(const c in e)if(e[c])for(const d of Object.keys(e[c]))u.add(d);const l=new Set;for(const c of u){const d=c.slice(0,1);if(!(d==="@"||d==="."||d===":")&&Y(c))for(const m in e){if(l.has(m))continue;const h=e[m]?.[c];if(h===void 0)continue;const f=(0,v.getColor)(h,`@${m}`);f!==void 0&&(0,a.isString)(f)&&/^[a-z][a-zA-Z]+$/.test(f)&&!X.has(f)&&l.add(m)}}for(const c of u){const d=c.slice(0,1),m=Object.values(e).some(h=>(0,a.isObjectLike)(h?.[c]));if(d==="."&&m){const h=c.slice(1),f={};for(const b in e)(0,a.isObjectLike)(e[b]?.[c])&&(f[b]=e[b][c]);t[c]=O(f,`${r}-${h}`,o)}else if(d===":"&&m){const h=c.replace(/^:+/,""),f={};for(const b in e)(0,a.isObjectLike)(e[b]?.[c])&&(f[b]=e[b][c]);t[c]=O(f,`${r}-${h}`,o)}else if(d!=="@"&&d!=="."&&d!==":"){const f=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}-${c}`,b=i&&i!=="auto"?String(i).replace(/^'|'$/g,""):null;let k;for(const g in e){if(l.has(g))continue;const P=e[g]?.[c];if(P===void 0)continue;const T=L(r,c,P,`@${g}`);if(T===void 0)continue;(b&&g===b||!b&&(g==="light"||k===void 0))&&(k=T);const C=`[data-theme="${g}"]`;if(n[C]||(n[C]={}),n[C][f]=T,g==="dark"||g==="light"){const M=`@media (prefers-color-scheme: ${g})`;n[M]||(n[M]={}),n[M][f]=T}}k!==void 0&&(s[f]=k),t[c]=`var(${f})`,t[`.${c}`]={[c]:t[c]}}}return(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color}),t},E=(e,r,o,s)=>{const n=(0,S.getActiveConfig)(),{cssVars:i}=n,t={value:e},u=!o&&!s;if((0,a.isObjectLike)(e)){if(u&&n.useVariable){const l={};for(const c in e)c.startsWith("@")&&(0,a.isObjectLike)(e[c])&&(l[c.slice(1)]=e[c]);if(Object.keys(l).length){const c=O(l,r,n);Object.assign(t,c)}}for(const l in e){const c=l.slice(0,1),d=e[l];if(c==="@"||c===":"||c==="."){const m=c==="@"&&l;t[l]=E(d,r,l,s||m)}else if(!u){const m=L(r,l,d,s),h=[...new Set([s,o].filter(g=>g).map(g=>g.slice(1)))],f=h.length?"-"+h.join("-"):"",k=`--${n.varPrefix?n.varPrefix+"-":""}theme-${r}${f}-${l}`;n.useVariable?(n.useThemeSuffixedVars&&(i[k]=m),t[l]=`var(${k})`):t[l]=m,t[`.${l}`]={[l]:t[l]}}}!t[".inversed"]&&(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color})}if((0,a.isString)(e)&&(0,y.isCSSVar)(e)){const c=n.theme[e.slice(2)];return w(c,s)}return t},j=e=>{const r=(0,S.getActiveConfig)(),o={};for(const s in e){const n=s.slice(0,1);if((0,a.isObjectLike)(e[s])){if(n==="@")continue;n===":"?o[`&${s}`]=j(e[s]):n==="."&&(o[`&${s}`]=j(e[s]))}else o[s]=e[s]}return o},z=(e,r)=>{const o=r.shift();return e[o]?z(e[o],r):e},B=(e,r)=>(0,a.isArray)(r)?z(e,r):(0,a.isString)(r)&&e[r]?e[r]:e,te=(e,r)=>(0,a.isString)(e)&&(0,y.isCSSVar)(e)?w(e.slice(2)):e,se=e=>te(e,se),w=(e,r)=>{const o=(0,S.getActiveConfig)();if((0,a.isString)(e)&&(0,y.isCSSVar)(e)&&(e=w(e.slice(2))),!e||!(0,a.isString)(e)){o.verbose&&console.warn(`${e} - Theme is not a string`);return}const[s,...n]=(0,a.isArray)(e)?e:e.split(" ");let i=o.theme[s];return i&&n.length?i=B(i,n):i&&r&&(i=B(i,r)),j(i)};
1
+ "use strict";var j=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var Z=(e,o)=>{for(var r in o)j(e,r,{get:o[r],enumerable:!0})},J=(e,o,r,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of Q(o))!Y.call(e,i)&&i!==r&&j(e,i,{get:()=>o[i],enumerable:!(t=N(o,i))||t.enumerable});return e};var K=e=>J(j({},"__esModule",{value:!0}),e);var le={};Z(le,{getMediaTheme:()=>M,getTheme:()=>G,setMediaTheme:()=>O,setTheme:()=>ne});module.exports=K(le);var T=require("./color.js"),x=require("./shadow.js"),$=require("./border.js"),v=require("../factory.js"),V=require("../utils/color.js"),l=require("@symbo.ls/utils");const E=new Set(["black","white","red","green","blue","yellow","orange","purple","pink","brown","gray","grey","cyan","magenta","lime","olive","navy","teal","aqua","maroon","silver","fuchsia","transparent","currentColor","currentcolor","inherit","initial","unset","none","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple"]),L=["color","Color","background","Background","fill","Fill","stroke","Stroke"],q=e=>{for(let o=0;o<L.length;o++)if(e.includes(L[o]))return!0;return!1},X={boxShadow:x.resolveShadowValue,textShadow:x.resolveShadowValue,border:$.resolveBorderValue,borderTop:$.resolveBorderValue,borderRight:$.resolveBorderValue,borderBottom:$.resolveBorderValue,borderLeft:$.resolveBorderValue,outline:$.resolveBorderValue,columnRule:$.resolveBorderValue},F=e=>{if(!e)return!1;const o=(0,V.parseColorToken)(e);return!o||!o.name||o.passthrough||o.cssVar?!1:o.alpha!==void 0||o.tone!==void 0},P=new Set,I=(e,o,r,t,i,a)=>{if(!(0,l.isLoudDevRuntime)())return;const s=`${e}::${o}::${r||""}::${t}`;P.has(s)||(P.add(s),console.warn(`[smbls/scratch] theme param "${o}" on "${e}"`+(r?` (${r})`:"")+` did not fully resolve: "${t}" -> "${i}" still contains the unresolved token "${a}". This is not valid CSS \u2014 the browser will drop the whole declaration. Register "${a}" as a design-system color token or fix the typo.`))},C=(e,o,r,t)=>{const i=X[o];if(!i)return(0,T.getColor)(r,t);let a=null;const s=i(r,t,h=>{!a&&F(h)&&(a=h)});return a&&I(e,o,t,r,s,a),s},G=(e,o)=>M(e,o),ee=e=>(0,l.isObject)(e)&&(0,l.isObjectLike)(e.value),oe=e=>{for(const o in e){const r=e[o];if((0,l.isString)(r)&&r.startsWith("var(--"))return!0}return!1},ne=(e,o)=>{const r=(0,v.getActiveConfig)();return ee(e)?!r.useVariable&&oe(e)?e:O(e.value,o):O(e,o)},D=(e,o)=>{const r=new Set;for(const t of o){const i=t.slice(0,1);if(!(i==="@"||i==="."||i===":")&&q(t))for(const a in e){if(r.has(a))continue;const s=e[a]?.[t];if(s===void 0)continue;const h=(0,T.getColor)(s,`@${a}`);h!==void 0&&(0,l.isString)(h)&&/^[a-z][a-zA-Z]+$/.test(h)&&!E.has(h)&&r.add(a)}}return r},re=new Set(["none","inherit","initial","unset","revert","revert-layer"]),te=/^(?:#[0-9a-f]{3,8}$|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix)\()/i,ie=/gradient\(|url\(|image-set\(|var\(/i,W=e=>{if(!(0,l.isString)(e))return!1;const o=e.trim();return ie.test(o)?!1:te.test(o)?!0:E.has(o)&&!re.has(o)},se=e=>e.startsWith("[data-theme=")||e.startsWith("@media"),R=(e,o)=>{for(const r in o){const t=o[r];(0,l.isObject)(t)?R(e[r]||(e[r]={}),t):e[r]=t}return e},B=(e,o,r,t)=>{if(R(e,{[`[data-theme="${o}"] &`]:r}),o!=="light"&&o!=="dark")return;const i=(0,T.schemeMediaQuery)(o,t);i&&R(e,{[i]:{[(0,T.schemeGuardSelector)(t)]:r}})},U=(e,o,r,t)=>{const i=r.globalTheme!==void 0?r.globalTheme:"auto",a=i&&i!=="auto"?String(i).replace(/^'|'$/g,""):null,s=new Set(t?Object.keys(t):[]);for(const n in e)if(e[n])for(const c of Object.keys(e[n]))s.add(c);const h=D(e,s),g={};for(const n of s){const c=n.slice(0,1);if(c==="@")continue;if(c==="."||c===":"){const u={};for(const w in e)(0,l.isObjectLike)(e[w]?.[n])&&(u[w]=e[w][n]);const m=t&&(0,l.isObjectLike)(t[n])?t[n]:void 0;if(!Object.keys(u).length&&!m)continue;const b=c==="."?n.slice(1):n.replace(/^:+/,"");g[n]=U(u,`${o}-${b}`,r,m);continue}const k=t&&!(0,l.isObjectLike)(t[n])?t[n]:void 0,p=new Set(Object.keys(e));k!==void 0&&(p.add("light"),p.add("dark"),a&&p.add(a));const d={};let f;for(const u of p){if(h.has(u))continue;let m=e[u]?.[n];if((m===void 0||(0,l.isObjectLike)(m))&&(m=k),m===void 0)continue;const b=C(o,n,m,`@${u}`);b!==void 0&&(d[u]=b,(a&&u===a||!a&&(u==="light"||f===void 0))&&(f=b))}const y={},S=Object.keys(d).filter(u=>d[u]!==f);if(S.length){const u=d.light!==void 0?d.light:f,m=d.dark!==void 0?d.dark:f;if(q(n)&&W(u)&&W(m)){y[n]=u===m?u:`light-dark(${u}, ${m})`;for(const b in d)b==="light"||b==="dark"||B(y,b,{[n]:d[b]},r)}else{f!==void 0&&(y[n]=f);for(const b of S)B(y,b,{[n]:d[b]},r)}}else{if(f===void 0)continue;y[n]=f}R(g,y),g[`.${n}`]=y}return(g.background||g.color||g.backgroundColor)&&(g[".inversed"]={color:g.background||g.backgroundColor,background:g.color}),g},_=(e,o,r)=>{const{cssVars:t}=r;r.cssMediaVars||(r.cssMediaVars={});const i=r.cssMediaVars,a=r.globalTheme!==void 0?r.globalTheme:"auto",s={},h=new Set;for(const n in e)if(e[n])for(const c of Object.keys(e[n]))h.add(c);const g=D(e,h);for(const n of h){const c=n.slice(0,1),k=Object.values(e).some(p=>(0,l.isObjectLike)(p?.[n]));if(c==="."&&k){const p=n.slice(1),d={};for(const f in e)(0,l.isObjectLike)(e[f]?.[n])&&(d[f]=e[f][n]);s[n]=_(d,`${o}-${p}`,r)}else if(c===":"&&k){const p=n.replace(/^:+/,""),d={};for(const f in e)(0,l.isObjectLike)(e[f]?.[n])&&(d[f]=e[f][n]);s[n]=_(d,`${o}-${p}`,r)}else if(c!=="@"&&c!=="."&&c!==":"){const d=`--${r.varPrefix?r.varPrefix+"-":""}theme-${o}-${n}`,f=a&&a!=="auto"?String(a).replace(/^'|'$/g,""):null;let y;for(const S in e){if(g.has(S))continue;const u=e[S]?.[n];if(u===void 0)continue;const m=C(o,n,u,`@${S}`);if(m===void 0)continue;(f&&S===f||!f&&(S==="light"||y===void 0))&&(y=m);const b=`[data-theme="${S}"]`;if(i[b]||(i[b]={}),i[b][d]=m,S==="dark"||S==="light"){const w=`@media (prefers-color-scheme: ${S})`;i[w]||(i[w]={}),i[w][d]=m}}y!==void 0&&(t[d]=y),s[n]=`var(${d})`,s[`.${n}`]={[n]:s[n]}}}return(s.background||s.color||s.backgroundColor)&&(s[".inversed"]={color:s.background||s.backgroundColor,background:s.color}),s},O=(e,o,r,t)=>{const i=(0,v.getActiveConfig)(),{cssVars:a}=i,s={value:e},h=!r&&!t;let g;if((0,l.isObjectLike)(e)){if(h&&i.useVariable){const n={};for(const c in e)c.startsWith("@")&&(0,l.isObjectLike)(e[c])&&(n[c.slice(1)]=e[c]);if(Object.keys(n).length){const c=_(n,o,i);Object.assign(s,c)}}else if(h){const n={},c={};for(const k in e)k.startsWith("@")?(0,l.isObjectLike)(e[k])&&(n[k.slice(1)]=e[k]):c[k]=e[k];g=U(n,o,i,c),Object.assign(s,g)}for(const n in e){const c=n.slice(0,1),k=e[n];if(c==="@"||c===":"||c==="."){const p=c==="@"&&n;s[n]=O(k,o,n,t||p)}else if(!h){const p=C(o,n,k,t),d=[...new Set([t,r].filter(u=>u).map(u=>u.slice(1)))],f=d.length?"-"+d.join("-"):"",S=`--${i.varPrefix?i.varPrefix+"-":""}theme-${o}${f}-${n}`;i.useVariable?(i.useThemeSuffixedVars&&(a[S]=p),s[n]=`var(${S})`):s[n]=p,s[`.${n}`]={[n]:s[n]}}}if(g)for(const n in g){const c=n.slice(0,1);(c==="."||c===":")&&(0,l.isObjectLike)(e[n])&&(s[n]=g[n])}!s[".inversed"]&&(s.background||s.color||s.backgroundColor)&&(s[".inversed"]={color:s.background||s.backgroundColor,background:s.color})}if((0,l.isString)(e)&&(0,V.isCSSVar)(e)){const c=i.theme[e.slice(2)];return M(c,t)}return s},A=(e,o)=>{const r={};for(const t in e){const i=t.slice(0,1);if((0,l.isObjectLike)(e[t]))if(o&&se(t))r[t]=R({},e[t]);else{if(i==="@")continue;i===":"?r[`&${t}`]=A(e[t],o):i==="."&&(r[`&${t}`]=A(e[t],o))}else r[t]=e[t]}return r},z=(e,o)=>{const r=o.shift();return e[r]?z(e[r],o):e},H=(e,o)=>(0,l.isArray)(o)?z(e,o):(0,l.isString)(o)&&e[o]?e[o]:e,ce=(e,o)=>(0,l.isString)(e)&&(0,V.isCSSVar)(e)?M(e.slice(2)):e,ae=e=>ce(e,ae),M=(e,o)=>{const r=(0,v.getActiveConfig)();if((0,l.isString)(e)&&(0,V.isCSSVar)(e)&&(e=M(e.slice(2))),!e||!(0,l.isString)(e)){r.verbose&&console.warn(`${e} - Theme is not a string`);return}const[t,...i]=(0,l.isArray)(e)?e:e.split(" ");let a=r.theme[t];return a&&i.length?a=H(a,i):a&&o&&(a=H(a,o)),A(a,!r.useVariable)};
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var O=(r,t)=>{for(var n in t)m(r,n,{get:t[n],enumerable:!0})},R=(r,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of B(t))!C.call(r,e)&&e!==n&&m(r,e,{get:()=>t[e],enumerable:!(i=j(t,e))||i.enumerable});return r};var T=r=>R(m({},"__esModule",{value:!0}),r);var D={};O(D,{resolveColorsInGradient:()=>S,splitTransition:()=>W,transformBackgroundImage:()=>G,transformBorder:()=>z,transformBorderRadius:()=>b,transformBoxShadow:()=>E,transformDuration:()=>K,transformShadow:()=>A,transformSize:()=>h,transformSizeRatio:()=>_,transformTextStroke:()=>V,transformTransition:()=>g,transfromGap:()=>$});module.exports=T(D);var c=require("@symbo.ls/utils"),x=require("../factory.js"),s=require("../system/index.js"),o=require("../utils/index.js");const I=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),z=r=>(0,s.resolveBorderValue)(r),V=r=>o.CSS_NATIVE_COLOR_REGEX.test(r)?r:r.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if((0,o.isCSSVar)(t))return`var(${t})`;if(/^\d/.test(t)||t.includes("px")||t==="0")return t;const n=(0,s.getColor)(t);return(0,o.isResolvedColor)(n)?n:t}).join(" "),A=(r,t)=>(0,s.getShadow)(r,t),E=(r,t)=>o.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,o.splitTopLevelCommas)(r).map(n=>(n=n.trim(),n?n.split(/\s+/).map(i=>{if(i=i.trim(),!i)return"";if((0,o.isCSSVar)(i))return`var(${i})`;if(i==="inset"||i==="none")return i;const e=(0,s.getColor)(i);if((0,o.isResolvedColor)(e)){const a=(0,s.getMediaColor)(i,t);return(0,c.isObject)(a)?Object.values(a).filter(p=>p.includes(": "+t))[0]:a}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const u=(0,s.getSpacingByKey)(i,"shadow");return u&&u.shadow?u.shadow:i}).join(" "):"")).join(", "),S=(r,t)=>{const n=r.indexOf("(");if(n===-1)return r;const i=r.slice(0,n+1),e=r.slice(n+1,r.lastIndexOf(")")),u=")",p=(0,o.splitTopLevelCommas)(e).map(l=>(l=l.trim(),l.split(/\s+/).map(f=>{if(!f||/^\d/.test(f)||f==="0"||I.has(f)||f==="transparent"||o.CSS_NATIVE_COLOR_REGEX.test(f))return f;const d=(0,s.getColor)(f);return(0,o.isResolvedColor)(d)?d:f}).join(" ")));return i+p.join(", ")+u},G=(r,t)=>{const n=(0,x.getActiveConfig)();return(0,o.splitTopLevelCommas)(r).map(i=>{const e=i.trim();if((0,o.isCSSVar)(e))return`var(${e})`;if(/^var\(/.test(e)||e.includes("url"))return e;if(n.gradient?.[e]){const u=(0,s.getMediaColor)(e,t);if((0,c.isString)(u))return u;if((0,c.isObject)(u)){for(const a in u)if((0,c.isString)(u[a]))return u[a]}return e}return e.includes("gradient")?S(e,t):e.includes("/")||e.startsWith("http")||e.includes(".")&&!(0,o.parseColorToken)(e)?`url(${e})`:e}).join(", ")},$=r=>(0,c.isString)(r)&&r.split(" ").map(t=>(0,s.getSpacingByKey)(t,"gap").gap).join(" "),g=r=>{const t=r.split(" ");return t.length?t.map(n=>(0,o.isCSSVar)(n)?`var(${n})`:n.length<3||n.includes("ms")?(0,s.getTimingByKey)(n).timing||n:(0,s.getTimingFunction)(n)?(0,s.getTimingFunction)(n):n).join(" "):r},K=(r,t,n)=>{if((0,c.isString)(r))return r.split(",").map(i=>(0,s.getTimingByKey)(i).timing||i).join(",")},W=r=>{const t=r.split(",");if(t.length)return t.map(g).join(",")};function h(r,t,n={},i={}){let e=c.exec.call(this,t||n[r]);if(e==null)return;let u;if((0,c.isString)(e)){if(/^(?:env|var)\(/.test(e.trim()))return{[r]:e};if(e.includes("(")){const l=(0,o.getFnPrefixAndValue)(e);u=l[0],e=l[1]}const a=n.scaleBoxSize,p=(0,s.checkIfBoxSize)(r);!a&&p&&!i.ratio&&(e=(0,s.splitSpacedValue)(e))}return i.ratio?(0,s.getSpacingBasedOnRatio)(n,r,e,u):(0,s.getSpacingByKey)(e,r,void 0,u)}const _=(r,t=null,n)=>h(r,t,n,{ratio:!0}),b=(r,t,n,i="borderRadius")=>{if((0,c.isString)(r))return{[i]:r.split(" ").map(e=>{const u=(0,s.getShapeByKey)(e);return u!==void 0?u:(0,s.getSpacingBasedOnRatio)(t,n,e)[n]}).join(" ")}};
1
+ "use strict";var m=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var E=(r,t)=>{for(var n in t)m(r,n,{get:t[n],enumerable:!0})},R=(r,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of B(t))!C.call(r,e)&&e!==n&&m(r,e,{get:()=>t[e],enumerable:!(i=j(t,e))||i.enumerable});return r};var T=r=>R(m({},"__esModule",{value:!0}),r);var D={};E(D,{resolveColorsInGradient:()=>S,splitTransition:()=>L,transformBackgroundImage:()=>z,transformBorder:()=>G,transformBorderRadius:()=>q,transformBoxShadow:()=>_,transformDuration:()=>K,transformGridTemplate:()=>F,transformShadow:()=>V,transformSize:()=>h,transformSizeRatio:()=>W,transformTextStroke:()=>I,transformTransition:()=>g,transfromGap:()=>$});module.exports=T(D);var f=require("@symbo.ls/utils"),d=require("../factory.js"),s=require("../system/index.js"),o=require("../utils/index.js");const O=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),A=/^-?[A-Z][0-9]?$/,G=r=>(0,s.resolveBorderValue)(r),I=r=>{if((0,f.isString)(r))return o.CSS_NATIVE_COLOR_REGEX.test(r)?r:r.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if((0,o.isCSSVar)(t))return`var(${t})`;if(/^\d/.test(t)||t.includes("px")||t==="0")return t;const n=(0,s.getColor)(t);return(0,o.isResolvedColor)(n)?n:t}).join(" ")},V=(r,t)=>(0,s.getShadow)(r,t),_=(r,t)=>{if((0,f.isString)(r))return o.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,o.splitTopLevelCommas)(r).map(n=>(n=n.trim(),n?n.split(/\s+/).map(i=>{if(i=i.trim(),!i)return"";if((0,o.isCSSVar)(i))return`var(${i})`;if(i==="inset"||i==="none")return i;const e=(0,s.getColor)(i);if((0,o.isResolvedColor)(e)){const a=(0,s.getMediaColor)(i,t);return(0,f.isObject)(a)?Object.values(a).filter(p=>p.includes(": "+t))[0]:a}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const u=(0,s.getSpacingByKey)(i,"shadow");return u&&u.shadow?u.shadow:i}).join(" "):"")).join(", ")},S=(r,t)=>{const n=r.indexOf("(");if(n===-1)return r;const i=r.slice(0,n+1),e=r.slice(n+1,r.lastIndexOf(")")),u=")",p=(0,o.splitTopLevelCommas)(e).map(l=>(l=l.trim(),l.split(/\s+/).map(c=>{if(!c||/^\d/.test(c)||c==="0"||O.has(c)||c==="transparent"||o.CSS_NATIVE_COLOR_REGEX.test(c))return c;const x=(0,s.getColor)(c);return(0,o.isResolvedColor)(x)?x:c}).join(" ")));return i+p.join(", ")+u},z=(r,t)=>{if(!(0,f.isString)(r))return;const n=(0,d.getActiveConfig)();return(0,o.splitTopLevelCommas)(r).map(i=>{const e=i.trim();if((0,o.isCSSVar)(e))return`var(${e})`;if(/^var\(/.test(e)||e.includes("url"))return e;if(n.gradient?.[e]){const u=(0,s.getMediaColor)(e,t);if((0,f.isString)(u))return u;if((0,f.isObject)(u)){for(const a in u)if((0,f.isString)(u[a]))return u[a]}return e}return e.includes("gradient")?S(e,t):e.includes("/")||e.startsWith("http")||e.includes(".")&&!(0,o.parseColorToken)(e)?`url(${e})`:e}).join(", ")},$=r=>(0,f.isString)(r)&&r.split(" ").map(t=>(0,s.getSpacingByKey)(t,"gap").gap).join(" "),F=r=>{if(!(0,f.isString)(r))return r;const t=(0,d.getActiveConfig)();return(0,o.splitTopLevelSpaces)(r).map(n=>A.test(n)?(0,o.getSequenceValue)(n,t.spacing):n).join(" ")},g=r=>{if(!(0,f.isString)(r))return;const t=r.split(" ");return t.length?t.map(n=>(0,o.isCSSVar)(n)?`var(${n})`:n.length<3||n.includes("ms")?(0,s.getTimingByKey)(n).timing||n:(0,s.getTimingFunction)(n)?(0,s.getTimingFunction)(n):n).join(" "):r},K=(r,t,n)=>{if((0,f.isString)(r))return r.split(",").map(i=>(0,s.getTimingByKey)(i).timing||i).join(",")},L=r=>{if(!(0,f.isString)(r))return;const t=r.split(",");if(t.length)return t.map(g).join(",")};function h(r,t,n={},i={}){let e=f.exec.call(this,t||n[r]);if(e==null)return;let u;if((0,f.isString)(e)){if(/^(?:env|var)\(/.test(e.trim()))return{[r]:e};if(e.includes("(")){const l=(0,o.getFnPrefixAndValue)(e);u=l[0],e=l[1]}const a=n.scaleBoxSize,p=(0,s.checkIfBoxSize)(r);!a&&p&&!i.ratio&&(e=(0,s.splitSpacedValue)(e))}return i.ratio?(0,s.getSpacingBasedOnRatio)(n,r,e,u):(0,s.getSpacingByKey)(e,r,void 0,u)}const W=(r,t=null,n)=>h(r,t,n,{ratio:!0}),q=(r,t,n,i="borderRadius")=>{if((0,f.isString)(r))return{[i]:r.split(" ").map(e=>{const u=(0,s.getShapeByKey)(e);return u!==void 0?u:(0,s.getSpacingBasedOnRatio)(t,n,e)[n]}).join(" ")}};
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var E=(e,r)=>{for(var t in r)g(e,t,{get:r[t],enumerable:!0})},v=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of L(r))!q.call(e,a)&&a!==t&&g(e,a,{get:()=>r[a],enumerable:!(n=I(r,a))||n.enumerable});return e};var A=e=>v(g({},"__esModule",{value:!0}),e);var B={};E(B,{CSS_NAMED_COLOR_HEX:()=>m,CSS_NATIVE_COLOR_REGEX:()=>S,changeLightness:()=>z,colorStringToRgbaArray:()=>h,compositeOverBackdrop:()=>W,contrastRatio:()=>K,getColorShade:()=>M,getRgbTone:()=>Y,hexToRgb:()=>H,hexToRgbArray:()=>x,hexToRgba:()=>j,hslToRgb:()=>k,isCSSVar:()=>C,isResolvedColor:()=>D,linearChannelToSrgb:()=>O,mixTwoColors:()=>F,mixTwoRgb:()=>G,mixTwoRgba:()=>T,oklabToLinearSrgb:()=>_,oklabToOklch:()=>Q,oklchToGamutSafeSrgb:()=>U,oklchToOklab:()=>$,opacify:()=>P,parseColorToken:()=>X,relativeLuminance:()=>p,rgbArrayToHex:()=>y,rgbToHSL:()=>w,rgbToHex:()=>N,splitTopLevelCommas:()=>Z,srgbChannelToLinear:()=>R,srgbToOklab:()=>J,toLinearChannel:()=>u});module.exports=A(B);var s=require("@symbo.ls/utils");const m={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},h=e=>{if(e==="")return[0,0,0,0];if(e.toLowerCase()==="transparent")return[0,0,0,0];const r=m[e.toLowerCase()];if(r&&(e=r),e[0]==="#")return e.length<7&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(e.length>4?e[4]+e[4]:"")),[parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16),e.length>7?parseInt(e.substr(7,2),16)/255:1];if(e.indexOf("rgb")===-1&&s.document&&s.window){const t=s.document.body.appendChild(s.document.createElement("fictum")),n="rgb(1, 2, 3)";if(t.style.color=n,t.style.color!==n){s.document.body.removeChild(t);return}if(t.style.color=e,t.style.color===n||t.style.color==="")return s.document.body.removeChild(t),[0,0,0,0];e=s.window.getComputedStyle(t).color,s.document.body.removeChild(t)}return e.indexOf("rgb")===0?(e.indexOf("rgba")===-1&&(e=`${e}, 1`),e.match(/[\.\d]+/g).map(t=>+t)):[0,0,0,0]},F=(e,r,t=.5)=>(e=h(e),r=h(r),T(e,r,t)),H=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgb(${t},${n},${a})`},x=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return[t,n,a]},N=(e,r,t)=>"#"+(1<<24|e<<16|r<<8|t).toString(16).slice(1),y=([e,r,t])=>((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1),j=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgba(${t},${n},${a},${r})`},G=(e,r,t=.5)=>{const n=[];for(let a=0;a<3;a++)n[a]=~~(e[a]+(r[a]-e[a])*t);return`rgb(${n})`},z=(e,r)=>{const[t,n,a]=r,f=Math.max(0,Math.min(100,a+parseFloat(e)));return[t,n,f]},w=(e,r,t)=>{const n=Math.max(e,r,t),a=n-Math.min(e,r,t),f=1-Math.abs(n+n-a-1),o=a&&(n==e?(r-t)/a:n==r?2+(t-e)/a:4+(e-r)/a);return[60*(o<0?o+6:o),f?a/f:0,(n+n-a)/2]},k=(e,r,t,n=r*Math.min(t,1-t),a=(f,o=(f+e/30)%12)=>t-n*Math.max(Math.min(o-3,9-o,1),-1))=>[a(0),a(8),a(4)],M=(e,r)=>{const t=parseInt(e,16);let n=(t>>16)+r;n>255?n=255:n<0&&(n=0);let a=(t>>8&255)+r;a>255?a=255:a<0&&(a=0);let f=(t&255)+r;return f>255?f=255:f<0&&(f=0),((f|a<<8|n<<16)+16777216).toString(16).slice(1)},T=(e,r,t=.5)=>{const n=[];for(let a=0;a<4;a++){const f=a===3?o=>o:Math.round;n[a]=f(e[a]+(r[a]-e[a])*t)}return`rgba(${n})`},P=(e,r)=>{const t=h(e);if(!t){(0,s.isNotProduction)()&&console.warn(e+" color is not rgba");return}return t[3]=r,`rgba(${t})`},C=e=>e.charCodeAt(0)===45&&e.charCodeAt(1)===45,S=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,V=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,X=e=>{if(!(0,s.isString)(e))return null;if(S.test(e))return{passthrough:e};if(C(e))return{cssVar:e};const r=e.match(V);if(!r)return null;const[,t,n,a]=r,f=n!==void 0?`0.${n}`:void 0,o=a&&a[0]==="="?a.slice(1):a;return{name:t,alpha:f,tone:o}},D=e=>(0,s.isString)(e)&&(e.includes("rgb")||e.includes("var(")||e.includes("#")),Z=e=>{const r=[];let t="",n=0;for(const a of e){if(a==="("?n+=1:a===")"&&n>0&&(n-=1),a===","&&n===0){r.push(t),t="";continue}t+=a}return(t.length||!r.length)&&r.push(t),r},u=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),p=e=>.2126*u(e[0])+.7152*u(e[1])+.0722*u(e[2]),K=(e,r)=>{const t=p(e)+.05,n=p(r)+.05;return t>n?t/n:n/t},R=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),O=e=>(e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055)*255,J=([e,r,t])=>{const[n,a,f]=[e,r,t].map(R),o=.4122214708*n+.5363325363*a+.0514459929*f,i=.2119034982*n+.6806995451*a+.1073969566*f,c=.0883024619*n+.2817188376*a+.6299787005*f,d=Math.cbrt(o),l=Math.cbrt(i),b=Math.cbrt(c);return[.2104542553*d+.793617785*l-.0040720468*b,1.9779984951*d-2.428592205*l+.4505937099*b,.0259040371*d+.7827717662*l-.808675766*b]},_=([e,r,t])=>{const n=e+.3963377774*r+.2158037573*t,a=e-.1055613458*r-.0638541728*t,f=e-.0894841775*r-1.291485548*t,o=n**3,i=a**3,c=f**3;return[4.0767416621*o-3.3077115913*i+.2309699292*c,-1.2684380046*o+2.6097574011*i-.3413193965*c,-.0041960863*o-.7034186147*i+1.707614701*c]},Q=([e,r,t])=>{let n=Math.atan2(t,r)*180/Math.PI;return n<0&&(n+=360),[e,Math.sqrt(r*r+t*t),n]},$=([e,r,t])=>{const n=t*Math.PI/180;return[e,r*Math.cos(n),r*Math.sin(n)]},U=(e,r,t,n=24)=>{const a=i=>_($([e,i,t])),f=i=>i.every(c=>c>=-1e-4&&c<=1.0001);let o=a(r);if(!f(o)){let i=0,c=r;for(let d=0;d<n;d++){const l=(i+c)/2;f(a(l))?i=l:c=l}o=a(i)}return o.map(i=>O(Math.max(0,Math.min(1,i))))},W=(e,r=1,t=[255,255,255])=>r>=1?e:e.map((n,a)=>n*r+t[a]*(1-r)),Y=(e,r)=>{(0,s.isString)(e)&&e.includes("rgb")&&(e=h(e).join(", ")),(0,s.isString)(e)&&(e=e.split(",").map(a=>parseFloat(a.trim()))),(0,s.isNumber)(r)&&(r+="");const t=y(e),n=r.slice(0,1);if(n==="-"||n==="+"){const a=M(t,parseFloat(r));return x(a).join(", ")}else{const[a,f,o]=e,[i,c]=w(a/255,f/255,o/255),d=Math.max(0,Math.min(100,parseFloat(r)))/100;return k(i,c,d).map(b=>Math.round(Math.max(0,Math.min(1,b))*255)).join(", ")}};
1
+ "use strict";var g=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var E=(e,r)=>{for(var t in r)g(e,t,{get:r[t],enumerable:!0})},v=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of L(r))!q.call(e,n)&&n!==t&&g(e,n,{get:()=>r[n],enumerable:!(a=I(r,n))||a.enumerable});return e};var A=e=>v(g({},"__esModule",{value:!0}),e);var te={};E(te,{COMPOUND_CSS_KEYWORDS:()=>z,CSS_NAMED_COLOR_HEX:()=>m,CSS_NATIVE_COLOR_REGEX:()=>C,changeLightness:()=>G,colorStringToRgbaArray:()=>u,compositeOverBackdrop:()=>B,contrastRatio:()=>W,getColorShade:()=>M,getRgbTone:()=>ee,hexToRgb:()=>N,hexToRgbArray:()=>x,hexToRgba:()=>j,hslToRgb:()=>k,isCSSVar:()=>S,isResolvedColor:()=>K,linearChannelToSrgb:()=>O,mixTwoColors:()=>F,mixTwoRgb:()=>D,mixTwoRgba:()=>T,oklabToLinearSrgb:()=>_,oklabToOklch:()=>J,oklchToGamutSafeSrgb:()=>Q,oklchToOklab:()=>$,opacify:()=>P,parseColorToken:()=>X,relativeLuminance:()=>p,rgbArrayToHex:()=>y,rgbToHSL:()=>w,rgbToHex:()=>H,splitTopLevelCommas:()=>Z,splitTopLevelSpaces:()=>U,srgbChannelToLinear:()=>R,srgbToOklab:()=>Y,toLinearChannel:()=>b});module.exports=A(te);var s=require("@symbo.ls/utils");const m={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},u=e=>{if(e==="")return[0,0,0,0];if(e.toLowerCase()==="transparent")return[0,0,0,0];const r=m[e.toLowerCase()];if(r&&(e=r),e[0]==="#")return e.length<7&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(e.length>4?e[4]+e[4]:"")),[parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16),e.length>7?parseInt(e.substr(7,2),16)/255:1];if(e.indexOf("rgb")===-1&&s.document&&s.window){const t=s.document.body.appendChild(s.document.createElement("fictum")),a="rgb(1, 2, 3)";if(t.style.color=a,t.style.color!==a){s.document.body.removeChild(t);return}if(t.style.color=e,t.style.color===a||t.style.color==="")return s.document.body.removeChild(t),[0,0,0,0];e=s.window.getComputedStyle(t).color,s.document.body.removeChild(t)}return e.indexOf("rgb")===0?(e.indexOf("rgba")===-1&&(e=`${e}, 1`),e.match(/[\.\d]+/g).map(t=>+t)):[0,0,0,0]},F=(e,r,t=.5)=>(e=u(e),r=u(r),T(e,r,t)),N=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgb(${t},${a},${n})`},x=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return[t,a,n]},H=(e,r,t)=>"#"+(1<<24|e<<16|r<<8|t).toString(16).slice(1),y=([e,r,t])=>((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1),j=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgba(${t},${a},${n},${r})`},D=(e,r,t=.5)=>{const a=[];for(let n=0;n<3;n++)a[n]=~~(e[n]+(r[n]-e[n])*t);return`rgb(${a})`},G=(e,r)=>{const[t,a,n]=r,f=Math.max(0,Math.min(100,n+parseFloat(e)));return[t,a,f]},w=(e,r,t)=>{const a=Math.max(e,r,t),n=a-Math.min(e,r,t),f=1-Math.abs(a+a-n-1),o=n&&(a==e?(r-t)/n:a==r?2+(t-e)/n:4+(e-r)/n);return[60*(o<0?o+6:o),f?n/f:0,(a+a-n)/2]},k=(e,r,t,a=r*Math.min(t,1-t),n=(f,o=(f+e/30)%12)=>t-a*Math.max(Math.min(o-3,9-o,1),-1))=>[n(0),n(8),n(4)],M=(e,r)=>{const t=parseInt(e,16);let a=(t>>16)+r;a>255?a=255:a<0&&(a=0);let n=(t>>8&255)+r;n>255?n=255:n<0&&(n=0);let f=(t&255)+r;return f>255?f=255:f<0&&(f=0),((f|n<<8|a<<16)+16777216).toString(16).slice(1)},T=(e,r,t=.5)=>{const a=[];for(let n=0;n<4;n++){const f=n===3?o=>o:Math.round;a[n]=f(e[n]+(r[n]-e[n])*t)}return`rgba(${a})`},P=(e,r)=>{const t=u(e);if(!t){(0,s.isNotProduction)()&&console.warn(e+" color is not rgba");return}return t[3]=r,`rgba(${t})`},S=e=>e.charCodeAt(0)===45&&e.charCodeAt(1)===45,z=new Set(["currentcolor","transparent","thin","medium","thick"]),C=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,V=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,X=e=>{if(!(0,s.isString)(e))return null;if(C.test(e))return{passthrough:e};if(S(e))return{cssVar:e};const r=e.match(V);if(!r)return null;const[,t,a,n]=r,f=a!==void 0?`0.${a}`:void 0,o=n&&n[0]==="="?n.slice(1):n;return{name:t,alpha:f,tone:o}},K=e=>(0,s.isString)(e)&&(e.includes("rgb")||e.includes("var(")||e.includes("#")),Z=e=>{const r=[];let t="",a=0;for(const n of e){if(n==="("?a+=1:n===")"&&a>0&&(a-=1),n===","&&a===0){r.push(t),t="";continue}t+=n}return(t.length||!r.length)&&r.push(t),r},U=e=>{const r=[];let t="",a=0;for(const n of e){if(n==="("?a+=1:n===")"&&a>0&&(a-=1),a===0&&/\s/.test(n)){t.length&&r.push(t),t="";continue}t+=n}return t.length&&r.push(t),r},b=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),p=e=>.2126*b(e[0])+.7152*b(e[1])+.0722*b(e[2]),W=(e,r)=>{const t=p(e)+.05,a=p(r)+.05;return t>a?t/a:a/t},R=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),O=e=>(e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055)*255,Y=([e,r,t])=>{const[a,n,f]=[e,r,t].map(R),o=.4122214708*a+.5363325363*n+.0514459929*f,i=.2119034982*a+.6806995451*n+.1073969566*f,c=.0883024619*a+.2817188376*n+.6299787005*f,l=Math.cbrt(o),d=Math.cbrt(i),h=Math.cbrt(c);return[.2104542553*l+.793617785*d-.0040720468*h,1.9779984951*l-2.428592205*d+.4505937099*h,.0259040371*l+.7827717662*d-.808675766*h]},_=([e,r,t])=>{const a=e+.3963377774*r+.2158037573*t,n=e-.1055613458*r-.0638541728*t,f=e-.0894841775*r-1.291485548*t,o=a**3,i=n**3,c=f**3;return[4.0767416621*o-3.3077115913*i+.2309699292*c,-1.2684380046*o+2.6097574011*i-.3413193965*c,-.0041960863*o-.7034186147*i+1.707614701*c]},J=([e,r,t])=>{let a=Math.atan2(t,r)*180/Math.PI;return a<0&&(a+=360),[e,Math.sqrt(r*r+t*t),a]},$=([e,r,t])=>{const a=t*Math.PI/180;return[e,r*Math.cos(a),r*Math.sin(a)]},Q=(e,r,t,a=24)=>{const n=i=>_($([e,i,t])),f=i=>i.every(c=>c>=-1e-4&&c<=1.0001);let o=n(r);if(!f(o)){let i=0,c=r;for(let l=0;l<a;l++){const d=(i+c)/2;f(n(d))?i=d:c=d}o=n(i)}return o.map(i=>O(Math.max(0,Math.min(1,i))))},B=(e,r=1,t=[255,255,255])=>r>=1?e:e.map((a,n)=>a*r+t[n]*(1-r)),ee=(e,r)=>{(0,s.isString)(e)&&e.includes("rgb")&&(e=u(e).join(", ")),(0,s.isString)(e)&&(e=e.split(",").map(n=>parseFloat(n.trim()))),(0,s.isNumber)(r)&&(r+="");const t=y(e),a=r.slice(0,1);if(a==="-"||a==="+"){const n=M(t,parseFloat(r));return x(n).join(", ")}else{const[n,f,o]=e,[i,c]=w(n/255,f/255,o/255),l=Math.max(0,Math.min(100,parseFloat(r)))/100;return k(i,c,l).map(h=>Math.round(Math.max(0,Math.min(1,h))*255)).join(", ")}};
@@ -1,9 +1,10 @@
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(`,
1
+ "use strict";var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var U=(t,n)=>{for(var r in n)i(t,r,{get:n[r],enumerable:!0})},k=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of j(n))!O.call(t,e)&&e!==r&&i(t,e,{get:()=>n[e],enumerable:!(o=g(n,e))||o.enumerable});return t};var C=t=>k(i({},"__esModule",{value:!0}),t);var M={};U(M,{getDefaultOrFirstKey:()=>W,getFontFace:()=>E,getFontFaceEach:()=>d,getFontFaceEachString:()=>v,getFontFaceString:()=>K,getFontFormat:()=>F,isGoogleFontsUrl:()=>$,resolveFileUrl:()=>s,setCustomFont:()=>y,setCustomFontMedia:()=>p,setFontImport:()=>S,setInCustomFontMedia:()=>x});module.exports=C(M);const s=(t,n)=>{if(!t||!n)return null;try{return new URL(t),null}catch{}const r=n[t];return r?r.content&&r.content.src:null},W=(t,n)=>{if(t[n])return t[n].value;const r=()=>Object.keys(t).find(e=>e!=="default"&&t[e]&&t[e].value&&!t[e].isSystemFallback);if(t.default){const e=t[t.default];if(e&&e.isSystemFallback){const c=r();if(c)return t[c].value}if(e)return e.value}const o=r()||Object.keys(t).find(e=>e!=="default"&&t[e]&&t[e].value);return o&&t[o]&&t[o].value},F=t=>{if(typeof t!="string"||!t)return null;const n=t.split(/[#?]/)[0].split(".").pop().trim();return["woff2","woff","ttf","otf","eot"].includes(n)?n:null},$=t=>t&&(t.includes("fonts.googleapis.com")||t.includes("fonts.gstatic.com")),S=t=>`@import url('${t}');`,x=t=>`@font-face { ${t} }`,y=(t,n,r,o={})=>{const f=(Array.isArray(n)?n:[n]).filter(a=>typeof a=="string"&&a).map(a=>{const l=F(a),u=l?` format('${l}')`:"";return`url('${a}')${u}`}).join(`,
2
2
  `);return`
3
3
  font-family: '${t}';
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));
4
+ font-style: ${o.fontStyle||"normal"};${r?`
5
+ font-weight: ${r};`:""}${o.fontStretch?`
6
+ font-stretch: ${o.fontStretch};`:""}${o.fontDisplay?`
7
+ font-display: ${o.fontDisplay};`:""}${o.unicodeRange?`
8
+ unicode-range: ${o.unicodeRange};`:""}
9
+ src: ${f};`},p=(t,n,r,o)=>`@font-face {${y(t,n,r,o)}
10
+ }`,d=(t,n,r)=>Object.keys(n).map(e=>{const{url:c,fontWeight:f,fontStyle:a,fontDisplay:l,fontStretch:u,unicodeRange:b}=n[e],D=Array.isArray(c)?c.map(m=>s(m,r)||m):s(c,r)||c;return y(t,D,f,{fontStyle:a,fontDisplay:l,fontStretch:u,unicodeRange:b})}),E=t=>Object.keys(t).map(r=>d(r,t[r].value)),v=(t,n,r)=>{if(n&&n.isVariable){const c=s(n.url,r)||n.url;return $(c)?S(c):p(t,c,n.fontWeight,{fontStretch:n.fontStretch,fontDisplay:n.fontDisplay||"swap",unicodeRange:n.unicodeRange})}if(n[0])return d(t,n,r).map(x);const e=Array.isArray(n.url)?n.url.map(c=>s(c,r)||c):s(n.url,r)||n.url;return p(t,e,n.fontWeight,{fontStyle:n.fontStyle,fontDisplay:n.fontDisplay,fontStretch:n.fontStretch,unicodeRange:n.unicodeRange})},K=(t,n)=>Object.keys(t).map(o=>v(o,t[o].value,n));
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var m=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0})},x=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of h(e))!v.call(t,n)&&n!==r&&p(t,n,{get:()=>e[n],enumerable:!(s=d(e,n))||s.enumerable});return t};var S=t=>x(p({},"__esModule",{value:!0}),t);var y={};m(y,{convertSvgToSymbol:()=>R,generateSprite:()=>b});module.exports=S(y);var l=require("@symbo.ls/utils"),w=require("../factory.js");const f=(0,l.isNotProduction)(),b=t=>{const e=(0,w.getActiveConfig)();let r="";for(const s in t)e.__svgCache[s]||(e.__svgCache[s]=!0,r+=t[s]);return r},_=t=>{const e=t&&(t.default||t);if(!(0,l.isString)(e))return f&&console.warn("parseRootAttributes:",e,"is not a string"),{};const r=e.match(/<svg\s+(.*?)>/);if(!r||!r[1])return{};const n=r[1].match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);return n?n.reduce((o,c)=>{const[a,g]=c.split("=");return o[a]=g.replace(/['"]/g,""),o},{}):{}},C=(t,e)=>{const r=[];if(t.replace(/id="([^"]*)"/g,(n,o)=>(r.push(o),n)),!r.length)return t;let s=t;for(const n of r){const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=`${e}-${n}`;s=s.replace(new RegExp(`id="${o}"`,"g"),`id="${c}"`).replace(new RegExp(`url\\(#${o}\\)`,"g"),`url(#${c})`).replace(new RegExp(`xlink:href="#${o}"`,"g"),`xlink:href="#${c}"`).replace(new RegExp(`href="#${o}"`,"g"),`href="#${c}"`)}return s},$=new Set,R=(t,e)=>{const r=e&&e.default?e.default:e;if(!(0,l.isString)(r))return f&&!$.has(t)&&($.add(t),console.warn("convertSvgToSymbol:",t,"is not a string")),"";e=r;const s=e.match(/^<symbol\b[^>]*\bid="([^"]*)"/);if(s){const u=s[1];return u===t?e:e.replace(`id="${u}"`,`id="${t}"`)}const n=_(e),{width:o,height:c}=n,a=n.viewBox||`0 0 ${o||24} ${c||24}`;let i=C(e,t).replace("<svg",`<symbol id="${t}" xmlns="http://www.w3.org/2000/svg" viewBox="${a}"`);return i=i.replace(/width="[^"]*"/,""),i=i.replace(/height="[^"]*"/,""),i=i.replace("</svg","</symbol"),i=I(i),i},A="line|circle|ellipse|rect|polyline|polygon|path|stop|use|image",E=new RegExp(`<(${A})\\b([^>]*?)\\s*/>`,"g"),I=t=>t.replace(E,"<$1$2></$1>");
1
+ "use strict";var g=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},x=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of h(e))!m.call(t,n)&&n!==r&&g(t,n,{get:()=>e[n],enumerable:!(s=d(e,n))||s.enumerable});return t};var S=t=>x(g({},"__esModule",{value:!0}),t);var I={};v(I,{convertSvgToSymbol:()=>R,generateSprite:()=>b});module.exports=S(I);var l=require("@symbo.ls/utils"),w=require("../factory.js");const f=(0,l.isNotProduction)(),b=t=>{const e=(0,w.getActiveConfig)();let r="";for(const s in t)e.__svgCache[s]||(e.__svgCache[s]=!0,r+=t[s]);return r},_=t=>{const e=t&&(t.default||t);if(!(0,l.isString)(e))return f&&console.warn("parseRootAttributes:",e,"is not a string"),{};const r=e.match(/<svg\s+(.*?)>/);if(!r||!r[1])return{};const n=r[1].match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);return n?n.reduce((o,i)=>{const[p,u]=i.split("=");return o[p]=u.replace(/['"]/g,""),o},{}):{}},C=(t,e)=>{const r=[];if(t.replace(/id="([^"]*)"/g,(n,o)=>(r.push(o),n)),!r.length)return t;let s=t;for(const n of r){const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=`${e}-${n}`;s=s.replace(new RegExp(`id="${o}"`,"g"),`id="${i}"`).replace(new RegExp(`url\\(#${o}\\)`,"g"),`url(#${i})`).replace(new RegExp(`xlink:href="#${o}"`,"g"),`xlink:href="#${i}"`).replace(new RegExp(`href="#${o}"`,"g"),`href="#${i}"`)}return s},$=new Set,R=(t,e)=>{const r=e&&e.default?e.default:e;if(!(0,l.isString)(r))return f&&!$.has(t)&&($.add(t),console.warn("convertSvgToSymbol:",t,"is not a string")),"";e=r;const s=e.match(/^<symbol\b[^>]*\bid="([^"]*)"/);if(s){const a=s[1];return a===t?e:e.replace(`id="${a}"`,`id="${t}"`)}const n=_(e),{width:o,height:i}=n,p=n.viewBox||`0 0 ${o||24} ${i||24}`;let c=C(e,t).replace("<svg",`<symbol id="${t}" xmlns="http://www.w3.org/2000/svg" viewBox="${p}"`);return c=c.replace(/^<symbol\b[^>]*>/,a=>a.replace(/\s(width|height)="[^"]*"/g,"")),c=c.replace("</svg","</symbol"),c=E(c),c},y="line|circle|ellipse|rect|polyline|polygon|path|stop|use|image",A=new RegExp(`<(${y})\\b([^>]*?)\\s*/>`,"g"),E=t=>t.replace(A,"<$1$2></$1>");
@@ -1 +1 @@
1
- import{deepClone as S,deepMerge as b,isDefined as l,isObject as h}from"@symbo.ls/utils";import{createSignal as v}from"@symbo.ls/signal";import*as T from"./defaultConfig/index.js";const d={},C={},f=T,p={},x=e=>e.replace(/_([a-z])/g,(t,o)=>o.toUpperCase());for(const e in f){const t=e.toLowerCase();p[t]=f[e];const o=x(t);o!==t&&(p[o]=f[e]),t!==e&&(p[e]=f[e])}const i={verbose:!1,useVariable:!0,useReset:!0,globalTheme:"auto",cssVars:d,cssMediaVars:C,CSS_VARS:d,CSS_MEDIA_VARS:C,_scratchConfig:!0,...p},m=(e,t)=>{if(!e)return null;if(e.__globalThemeSignal)return l(t)&&e.__globalThemeSignal.set(t),e.__globalThemeSignal;const o=l(t)?t:e.globalTheme,s=v(l(o)?o:"auto");return Object.defineProperty(e,"globalTheme",{get(){return s.get()},set(r){s.set(r)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"__globalThemeSignal",{value:s,enumerable:!1,configurable:!0,writable:!0}),s},D=e=>e?m(e):null,g=(e,t)=>{if(!e)return null;if(e.__resolvedThemeSignal)return l(t)&&e.__resolvedThemeSignal.set(t),e.__resolvedThemeSignal;const o=l(t)?t:e.resolvedTheme,s=v(l(o)?o:null);return Object.defineProperty(e,"resolvedTheme",{get(){return s.get()},set(r){s.set(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"__resolvedThemeSignal",{value:s,enumerable:!1,configurable:!0,writable:!0}),s},I=e=>e?g(e):null;m(i),g(i);const _=S(i),a={active:"0",0:i},M=e=>(l(e)&&(a.active=e),a[e||a.active]),u=[],j=e=>{e&&e._scratchConfig&&u.push(e)},L=()=>{u.pop()},A=e=>u.length?u[u.length-1]:a[e||a.active]||i,w=e=>{if(h(e))return a.active="1",a[1]=b(e,S(_)),m(a[1]),g(a[1]),e},O=["useReset","useFontImport","useIconSprite","useSvgSprite","useDocumentTheme","useDefaultIcons","useDefaultConfig"],y=["useVariable","globalTheme","verbose"],V=[["fontfamily","fontFamily","font_family"],["fontfamilytypes","fontFamilyTypes"],["semanticicons","semanticIcons"],["svgdata","svgData"]],P=e=>{for(const t of V){let o;for(const s of t){const r=e[s];h(r)&&(o=o?b(r,o):r)}if(o)for(const s of t)h(e[s])&&(e[s]=o)}},G=(e,t,{cleanBase:o=!1}={})=>{const s=o?null:A(),r=S(!o&&s&&s._scratchConfig?s:_);for(const c of O)delete r[c];for(const c of y)Object.prototype.hasOwnProperty.call(_,c)?r[c]=_[c]:delete r[c];const n=b(t||{},r);return n.cssVars={},n.cssMediaVars={},n.CSS_VARS=n.cssVars,n.CSS_MEDIA_VARS=n.cssMediaVars,n._scratchConfig=!0,P(n),m(n),g(n),e&&(a[e]=n),n};export{i as CONFIG,a as FACTORY,M as activateConfig,G as createConfig,C as cssMediaVars,d as cssVars,g as defineResolvedThemeSignal,m as defineThemeSignal,A as getActiveConfig,I as getResolvedThemeSignal,D as getThemeSignal,L as popConfig,j as pushConfig,w as setActiveConfig,x as toCamel};
1
+ import{deepClone as S,deepMerge as b,isDefined as l,isObject as h}from"@symbo.ls/utils";import{createSignal as d}from"@symbo.ls/signal";import*as O from"./defaultConfig/index.js";const C={},T={},v=new Set,f=O,p={},A=e=>e.replace(/_([a-z])/g,(t,o)=>o.toUpperCase());for(const e in f){const t=e.toLowerCase();p[t]=f[e];const o=A(t);o!==t&&(p[o]=f[e]),t!==e&&(p[e]=f[e])}const i={verbose:!1,useVariable:!0,useReset:!0,globalTheme:"auto",cssVars:C,cssMediaVars:T,CSS_VARS:C,CSS_MEDIA_VARS:T,_scratchConfig:!0,...p},m=(e,t)=>{if(!e)return null;if(e.__globalThemeSignal)return l(t)&&e.__globalThemeSignal.set(t),e.__globalThemeSignal;const o=l(t)?t:e.globalTheme,s=d(l(o)?o:"auto");return Object.defineProperty(e,"globalTheme",{get(){return s.get()},set(r){s.set(r)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"__globalThemeSignal",{value:s,enumerable:!1,configurable:!0,writable:!0}),s},D=e=>e?m(e):null,g=(e,t)=>{if(!e)return null;if(e.__resolvedThemeSignal)return l(t)&&e.__resolvedThemeSignal.set(t),e.__resolvedThemeSignal;const o=l(t)?t:e.resolvedTheme,s=d(l(o)?o:null);return Object.defineProperty(e,"resolvedTheme",{get(){return s.get()},set(r){s.set(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"__resolvedThemeSignal",{value:s,enumerable:!1,configurable:!0,writable:!0}),s},M=e=>e?g(e):null;m(i),g(i);const _=S(i),a={active:"0",0:i},j=e=>(l(e)&&(a.active=e),a[e||a.active]),u=[],E=e=>{e&&e._scratchConfig&&u.push(e)},G=()=>{u.pop()},y=e=>u.length?u[u.length-1]:a[e||a.active]||i,L=e=>{if(h(e))return a.active="1",a[1]=b(e,S(_),v),x(a[1]),m(a[1]),g(a[1]),e},V=["useReset","useFontImport","useIconSprite","useSvgSprite","useDocumentTheme","useDefaultIcons","useDefaultConfig"],R=["useVariable","globalTheme","verbose"],F=[["fontfamily","fontFamily","font_family"],["fontfamilytypes","fontFamilyTypes"],["semanticicons","semanticIcons"],["svgdata","svgData"]],x=e=>{for(const t of F){let o;for(const s of t){const r=e[s];h(r)&&(o=o?b(o,r,v):r)}if(o)for(const s of t)h(e[s])&&(e[s]=o)}},w=(e,t,{cleanBase:o=!1}={})=>{const s=o?null:y(),r=S(!o&&s&&s._scratchConfig?s:_);for(const c of V)delete r[c];for(const c of R)Object.prototype.hasOwnProperty.call(_,c)?r[c]=_[c]:delete r[c];const n=b(t||{},r,v);return n.cssVars={},n.cssMediaVars={},n.CSS_VARS=n.cssVars,n.CSS_MEDIA_VARS=n.cssMediaVars,n._scratchConfig=!0,x(n),m(n),g(n),e&&(a[e]=n),n};export{i as CONFIG,v as CONFIG_MERGE_EXL,a as FACTORY,j as activateConfig,x as aliasCaseVariants,w as createConfig,T as cssMediaVars,C as cssVars,g as defineResolvedThemeSignal,m as defineThemeSignal,y as getActiveConfig,M as getResolvedThemeSignal,D as getThemeSignal,G as popConfig,E as pushConfig,L as setActiveConfig,A as toCamel};
@@ -1 +1 @@
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};
1
+ import{CONFIG_MERGE_EXL as $,aliasCaseVariants as z,getActiveConfig as S,setActiveConfig as B,toCamel as K}from"./factory.js";import{setColor as U,setGradient as X,setFont as J,setFontFamily as P,setTheme as Q,setSvgIcon as Z,setSVG as G,applyTypographySequence as N,applySpacingSequence as ee,applyReset as te,applyTimingSequence as se,applyDocument as oe,setShadow as re}from"./system/index.js";import{deepMerge as ne,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)},I=(t,s,e)=>{if(!(!t||!s)){b(t),t.__prefersListener=e,t.__prefersMq=s;try{s.addEventListener("change",e)}catch{s.addListener(e)}}},ie=(t,s)=>{const e=S(),{cssVars:n}=e,i=s.startsWith("--")?s:`--${s}`;return n[i]=t,t},f=t=>t,H={color:U,gradient:X,font:J,fontFamily:P,fontfamily:P,theme:Q,icons:Z,semanticIcons:f,semanticicons:f,svg:G,svgData:f,typography:f,shadow:re,spacing:f,media:f,grid:f,class:f,timing:f,reset:f,unit:f,animation:f,vars:ie,sizes:f,shape:f},ce=(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},ae=(t,s,e)=>{const n=S(),i=K(t),o=i.toLowerCase(),d=n[i]||n[o]||n[t],r=O(d)?ce(n,d,o,[i,o,t]):d,m=H[i]||H[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")},le=(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 ae(n,s[o],o)}catch(d){e.verbose&&console.warn("Error setting",n,"value",s[o],o,d)}}),e[n]||e[t])},ve=(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},h=o.matchMedia("(prefers-color-scheme: dark)");a(h),r.style.colorScheme="light dark",I(e,h,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 h=m[a].cssRules;for(let g=0;g<h.length;g++)if(h[g].selectorText===r){for(const v in e.cssVars)h[g].style.setProperty(v,e.cssVars[v]);return e}}catch{}}return e},fe={},ye=(t,s=fe)=>{let e=s.config||S();const{version:n,verbose:i,useVariable:o,useReset:d,useSvgSprite:r,useFontImport:m,useIconSprite:a,globalTheme:h,themeRoot:g,useDocumentTheme:v,useDefaultConfig:E,semanticIcons:V,hoverMedia:x,files:R,assets:D,...u}=t;s.newConfig&&(e=B(s.newConfig)),j(u.document)&&(e.__domDocument=u.document,delete u.document),j(e.document)&&(e.__domDocument||(e.__domDocument=e.document),e.document={}),R!==void 0&&(e.files=R),D!==void 0&&(e.assets=D),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),h!==void 0&&(e.globalTheme=h),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),l=_&&(e.themeRoot||_.documentElement);if(l&&typeof l.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")b(e),l.setAttribute("data-theme",e.globalTheme),e.resolvedTheme=e.globalTheme,l[y]=e,e.globalTheme==="dark"||e.globalTheme==="light"?l.style.colorScheme=e.globalTheme:l.style.colorScheme="light dark";else if(l[y]&&l[y]!==e&&l.hasAttribute("data-theme"))b(e),e.resolvedTheme=l.getAttribute("data-theme");else if(T&&T.matchMedia){const p=Y=>{const M=Y.matches?"dark":"light";l.setAttribute("data-theme",M),e.resolvedTheme=M},C=T.matchMedia("(prefers-color-scheme: dark)");p(C),l.style.colorScheme="light dark",l[y]=e,I(e,C,p)}else b(e),l.setAttribute("data-theme","light"),e.resolvedTheme="light",l.style.colorScheme="light",l[y]=e;e.__svgCache||(e.__svgCache={}),z(u);const w=Object.keys(u).filter(c=>!c.startsWith("__")),L=new Set(w);if(w.forEach(c=>{const p=c.toLowerCase();p!==c&&L.has(p)&&ne(u[p],u[c],$)}),w.map(c=>{const p=c.toLowerCase();if(!(p!==c&&L.has(p)))return le(c,u[c])}),e.varPrefix&&(e.typography&&(e.typography.varPrefix=e.varPrefix),e.spacing&&(e.spacing.varPrefix=e.varPrefix),e.timing&&(e.timing.varPrefix=e.varPrefix)),u.typography)try{N()}catch(c){e.verbose&&console.warn("Error applying typography sequence",c)}if(u.spacing)try{ee()}catch(c){e.verbose&&console.warn("Error applying spacing sequence",c)}if(u.timing)try{se()}catch(c){e.verbose&&console.warn("Error applying timing sequence",c)}oe();const A=te();return A&&(e.reset=A),e};export{H as VALUE_TRANSFORMERS,ve as changeGlobalTheme,ye as set,le as setEach,ae as setValue};
@@ -1 +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
+ import{getColor as d,quietColorProbe as f}from"./color.js";import{getSpacingByKey as l}from"./spacing.js";import{isResolvedColor as a,isCSSVar as S,CSS_NATIVE_COLOR_REGEX as c,COMPOUND_CSS_KEYWORDS as m}from"../utils/color.js";const C=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),p=t=>C.has(t),R=(t,u,n)=>{if(t==null)return;const e=t+"";if(c.test(e))return e;const i=e.trim();return i==="none"||i==="0"||i==="initial"||i==="inherit"||i==="unset"?e:e.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if(S(r))return`var(${r})`;if(p(r)||/^\d/.test(r)||r==="0")return r;const s=f(()=>d(r,u));if(a(s))return s;if(m.has(r.toLowerCase()))return r;n&&n(r);const o=l(r,"border");return o&&o.border?o.border:r}).join(" ")};export{R as resolveBorderValue};
@@ -1 +1 @@
1
- import{isObject as 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
+ import{isObject as w,isArray as k,isString as b}from"@symbo.ls/utils";import{getActiveConfig as M}from"../factory.js";import{colorStringToRgbaArray as D,getRgbTone as A,isCSSVar as x,parseColorToken as C}from"../utils/index.js";const W={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},H=(e,n)=>{const t=n.media&&n.media[e]||W[e];return t?"@media "+(t==="print"?`${t}`:`screen and ${t}`):null},Q=e=>{const n=e.scopeSelector||":root";return`${n===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${n}:not([data-theme])`} &`},$=new Set,z=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),L=new Set,P=e=>{if(!e)return!1;const{color:n,gradient:t}=e;return!!(w(n)&&Object.keys(n).length||w(t)&&Object.keys(t).length)},O=new Set;let T=0;const I=e=>{T++;try{return e()}finally{T--}},B=(e,n)=>{if(!b(e)||e.indexOf(" ")===-1)return null;const t=e.replace(/\s+/g,""),r=C(t);if(!r||r.passthrough||r.cssVar)return null;const{color:o,gradient:c}=n;return!o[r.name]&&!c[r.name]?null:t},_=(e,n,t)=>{const r=B(e,t);if(r){if(!O.has(e)){O.add(e);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` has a space before its alpha/tone modifier${a} \u2014 did you mean \`${r}\`? The space form never resolves, so the atomic class it mints carries no CSS value and paints invisibly. Dropped rather than shipped invisible.`)}return}const o=C(e);if(o&&o.name&&!o.passthrough&&!o.cssVar&&(o.alpha!==void 0||o.tone!==void 0)&&P(t)&&!t.color[o.name]&&!t.gradient[o.name]){if(!T&&!L.has(e)){L.add(e);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` does not resolve${a} \u2014 \`${o.name}\` is not in the palette. Dropped rather than emitted as a raw value, which is invalid CSS the browser discards silently. Define it in designSystem/color.js or use a palette token.`)}return}const c=b(n)?n.toLowerCase():"";if(!z.has(c)||!P(t))return e;if(!L.has(c)){L.add(c);const a=t&&t.name?` (design system \`${t.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${a}. Dropped rather than emitted as a raw browser colour, which renders theme-blind and can be unreadable ("looks designed", so it ships unnoticed). Define it in designSystem/color.js or use a palette token.`)}},R=(e,n,t)=>{const r=t||M();if(!b(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;n&&e[n]&&(e=e[n]);let o,c,a;if(k(e))[o,c,a]=e;else{const i=C(e);if(!i){const{color:f,gradient:V}=r;let p=V[e]||f[e];return p?(n&&p[n]&&(p=p[n]),r.useVariable?`var(${p.var})`:p.value):_(e,e,r)}if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;o=i.name,c=i.alpha,a=i.tone}const{color:g,gradient:d}=r;let s=g[o]||d[o];if(!s)return _(e,o,r);if(n)if(s[n]!==void 0)s=s[n];else if(k(s)){const i=n.charCodeAt(0)===64?n.slice(1):n;i==="dark"?s=s[1]!==void 0?s[1]:s[0]:(i!=="light"&&r.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",n),s=s[0])}else r.verbose&&console.warn(e," - does not have ",n);if(b(s)){if($.has(o))return s;$.add(o);try{return R(s,null,t)}finally{$.delete(o)}}let h=s.rgb;if(!h){const i=r.useVariable?`var(${s.var})`:s.value;if((c||a)&&i){const f=c!==void 0?c:1;if(!a)return`rgb(from ${i} r g b / ${f})`;if(a.charCodeAt(0)===43||a.charCodeAt(0)===45){const p=parseFloat(a),u=p<0?"-":"+",l=Math.abs(p);return`rgb(from ${i} calc(r ${u} ${l}) calc(g ${u} ${l}) calc(b ${u} ${l}) / ${f})`}return`hsl(from ${i} h s ${a}% / ${f})`}return i}return a&&!s[a]&&(h=A(h,a),s[a]={rgb:h,var:`${s.var}-${a}`}),s[a]&&(h=s[a].rgb),c?`rgba(${h}, ${c})`:a?`rgba(${h}, ${s.alpha!==void 0?s.alpha:1})`:r.useVariable?`var(${s.var})`:s.value!==void 0?s.value:`rgb(${h})`},j=e=>{const n=D(e);return!n||n.length<3||n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[n[0],n[1],n[2]],alpha:n[3]!==void 0?n[3]:1}},K=(e,n)=>{if(!n)return e;let t=e.rgb;if(n.tone){const o=A(t,n.tone);t=b(o)?o.split(",").map(c=>parseFloat(c.trim())):o}const r=n.alpha!==void 0?parseFloat(n.alpha):e.alpha;return{rgb:t,alpha:r}},U=(e,n,t)=>{const r=n||M();if(!b(e))return null;const o=C(e);if(o){if(o.passthrough){const f=D(o.passthrough);return f&&f.length>=3?{rgb:[f[0],f[1],f[2]],alpha:f[3]!==void 0?f[3]:1}:null}if(o.cssVar)return null}const c=o?o.name:e,{color:a,gradient:g}=r;let d=a[c]||g[c];if(!d)return j(e);if(b(d)){let f;if($.has(c))f=j(d);else{$.add(c);try{f=U(d,r,t)}finally{$.delete(c)}}return f?K(f,o):null}if(d.rgb===void 0&&w(d)){const f=`@${t||"light"}`;d=d[f]!==void 0?d[f]:d["@light"]}if(!d||d.rgb===void 0)return null;let s=d.rgb;o&&o.tone&&(s=A(s,o.tone));const h=b(s)?s.split(",").map(f=>parseFloat(f.trim())):s,i=o&&o.alpha!==void 0?parseFloat(o.alpha):d.alpha!==void 0?d.alpha:1;return{rgb:h,alpha:i}},F=(e,n,t)=>{const r=t||M();if(n||(n=r.globalTheme==="auto"?null:r.globalTheme),!b(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;let o,c,a;if(k(e))o=e[0];else{const i=C(e);if(i){if(i.passthrough)return i.passthrough;if(i.cssVar)return`var(${i.cssVar})`;o=i.name,c=i.alpha,a=i.tone}else o=e}const{color:g,gradient:d}=r,s=g[o]||d[o],h=w(s);if(h&&s.value)return R(e,`@${n}`,t);if(h){if(r.useVariable&&s.var)return c||a?R(e,null,t):`var(${s.var})`;if(n)return R(e,`@${n}`,t);{const i={},f=Q(r);for(const V in s){if(V.charCodeAt(0)!==64)continue;const p=V.slice(1),u=R(e,V,t);if(u!==void 0&&(i[`[data-theme="${p}"] &`]=u,p==="light"||p==="dark")){const l=H(p,r);if(!l)continue;i[l]={[f]:u}}}return i}}else return _(e,o,r)},v=(e,n,t,r)=>{const c=`--${r.varPrefix?r.varPrefix+"-":""}${n}-${t}`;let a;const g={};for(const d in e){if(d.charCodeAt(0)!==64)continue;const s=d.slice(1),h=e[d],i=h&&(h.value||h);!i||typeof i!="string"||(g[s]=i,(s==="light"||a===void 0)&&(a=i))}if(a!==void 0){r.cssVars[c]=a,r.cssMediaVars||(r.cssMediaVars={});for(const d in g){const s=`[data-theme="${d}"]`;if(r.cssMediaVars[s]||(r.cssMediaVars[s]={}),r.cssMediaVars[s][c]=g[d],d==="light"||d==="dark"){const h=`@media (prefers-color-scheme: ${d})`;r.cssMediaVars[h]||(r.cssMediaVars[h]={}),r.cssMediaVars[h][c]=g[d]}}return e.var=c,c}},q=(e,n,t)=>{const r=M();if(w(e)&&e.value!==void 0&&(e.rgb!==void 0||e.var!==void 0))return r.useVariable&&e.var&&(r.cssVars[e.var]=e.value),e;if(b(e)&&x(e)){const u=e.slice(2);if(e=R(u),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const l=u.split(" ");let m=r.color[l[0]];if(m&&!m.value&&!m.rgb&&(b(m)||k(m)||w(m))&&!$.has(l[0])){$.add(l[0]);try{r.color[l[0]]=q(m,l[0])}finally{$.delete(l[0])}m=r.color[l[0]]}if(m&&m.value){let y=m.rgb;const E=l[1]!==void 0?l[1]:"1",S=l[2];S&&(y=A(y,S)),e=`rgba(${y}, ${E})`}else{const y=l[2],E=l[1]!==void 0?l[1]:"1";if(y)try{const S=D(l[0]);S&&S.length>=3?e=`rgba(${A(S.slice(0,3).join(", "),y)}, ${E})`:e=l[0]}catch{e=l[0]}else e=l[0]}}}if(k(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),w(e)){const u={};for(const l in e)l!=="var"&&(u[l]=q(e[l],n,l.slice(0,1)==="@"?l.slice(1):l));return r.useVariable&&v(u,"color",n,r),u}const c=`--${r.varPrefix?r.varPrefix+"-":""}color-${n}`+(t?`-${t}`:"");let a=e.value||e;if(b(a)&&!a.includes("(")&&!a.startsWith("#")){const u=C(a);if(u&&u.name&&!u.passthrough&&!u.cssVar){const l=r.color[u.name];if(l&&!l.value&&!l.rgb&&(b(l)||k(l)||w(l))&&!$.has(u.name)){$.add(u.name);try{r.color[u.name]=q(l,u.name)}finally{$.delete(u.name)}}const m=r.color[u.name];if(m&&m.rgb){let y=m.rgb;u.tone&&(y=A(y,u.tone));const E=u.alpha!==void 0?parseFloat(u.alpha):m.alpha!==void 0?m.alpha:1;a=`rgba(${y}, ${E})`}}}const g=D(a),[d,s,h,i=1]=g,f=parseFloat(i.toFixed(2)),V=`${d}, ${s}, ${h}`,p=`rgba(${V}, ${f})`;return r.useVariable&&(r.cssVars[c]=p),{var:c,rgb:V,alpha:f,value:p}},J=(e,n,t)=>{const r=M();if(w(e)&&e.value!==void 0&&e.var!==void 0)return r.useVariable&&(r.cssVars[e.var]=e.value),e;if(b(e)&&x(e)&&(e=R(e.slice(2))),k(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),w(e)){const a={};for(const g in e)g!=="var"&&(a[g]=J(e[g],n,g.slice(0,1)==="@"?g.slice(1):g));return r.useVariable&&v(a,"gradient",n,r),a}const c=`--${r.varPrefix?r.varPrefix+"-":""}gradient-${n}`+(t?`-${t}`:"");return r.useVariable&&(r.cssVars[c]=e.value||e),{var:c,value:e.value||e}};export{W as STANDARD_SCHEME_QUERIES,R as getColor,F as getMediaColor,I as quietColorProbe,U as resolveColorRgb,Q as schemeGuardSelector,H as schemeMediaQuery,v as setAdaptiveSchemeVar,q as setColor,J as setGradient};
@@ -1 +1 @@
1
- import{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
+ 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 F,setFontImport as O,resolveFileUrl as c}from"../utils/index.js";const I=(t,o)=>{const r=f(),s=`--font-${o}`;if(!t||m(t)&&!t[0])return;let n;if(t.isVariable){const e=c(t.url,r.files)||t.url;g(e)?n=O(e):n=F(o,e,t.fontWeight,{fontStretch:t.fontStretch,fontDisplay:t.fontDisplay||"swap",unicodeRange:t.unicodeRange})}else if(t[0])n=S(o,t,r.files);else{const e=Array.isArray(t.url)?t.url.map(i=>c(i,r.files)||i):c(t.url,r.files)||t.url;n=F(o,e,t.fontWeight,{fontStyle:t.fontStyle,fontDisplay:t.fontDisplay,fontStretch:t.fontStretch,unicodeRange:t.unicodeRange})}return{var:s,value:t,fontFace:n}},D=(t,o)=>{const r=f(),{fontFamily:s}=r;return p(o||s,t)},N=(t,o)=>{const r=f(),{fontFamily:s,fontFamilyTypes:n}=r;let{value:e,type:i}=t;t.isDefault&&(!t.isSystemFallback||!s.default)&&(s.default=o),a(e)&&(e=y(e));const l=`--font-family-${o}`,u=`${e.join(", ")}, ${n[i]}`;return{var:l,value:u,arr:e,type:i,isSystemFallback:!!t.isSystemFallback}};export{D as getFontFamily,I as setFont,N as setFontFamily};
@@ -1 +1 @@
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
+ import{deepMerge as y,isObject as D,merge as S,overwriteDeep as T}from"@symbo.ls/utils";import{CONFIG_MERGE_EXL as w,getActiveConfig as z}from"../factory.js";import{getMediaTheme as l}from"./theme.js";const k=(u={})=>{const o=z(),t=o.typography||{},m=o.document||{},n=D(o.reset)?o.reset:o.reset={};if(n[":root"]){const e=n,i=t.templates||{};e.body={...o.useDocumentTheme?l("document"):{},...i.body},e.h1=i.h1,e.h2=i.h2,e.h3=i.h3,e.h4=i.h4,e.h5=i.h5,e.h6=i.h6}const{body:h,...a}=t.templates||{},f=o.useDocumentTheme?l("document"):{};if(n.html&&T(n.html,f),t.unit)for(const e in a){if(e.slice(0,6)!=="@media")continue;const i=a[e];delete a[e],!(!i||!i.fontSize)&&(n[e]||(n[e]={}),n[e].html||(n[e].html={}),n[e].html.fontSize===void 0&&(n[e].html.fontSize=i.fontSize))}if(t.unit){const e=o.media||{};for(const i in t){if(i.charAt(0)!=="@")continue;const r=t[i];if(!r||r.unit===t.unit||!r.unit)continue;const d=r.unit,p=r.base||t.base,b=r.browserDefault||t.browserDefault,g=i.slice(1),c=e[g];if(!c)continue;const s="@media "+(c==="print"?c:"screen and "+c);n[s]||(n[s]={}),n[s].html||(n[s].html={}),n[s].html.fontSize=p/b+d}}return y(S(n,u),{html:{position:"absolute",width:"100%",height:"100%",top:"0",left:"0",margin:"0",WebkitFontSmoothing:"subpixel-antialiased",...f,fontSize:t.unit?t.base/t.browserDefault+t.unit:t.browserDefault+"px",fontFamily:m.fontFamily,lineHeight:m.lineHeight},body:{boxSizing:"border-box",height:"100%",margin:0,fontFamily:m.fontFamily,fontSize:t.unit?"1"+o.unit.default:t.base/t.browserDefault+o.unit.default,...a,...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}},w)};export{k as applyReset};
@@ -1 +1 @@
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
+ import{getActiveConfig as C}from"../factory.js";import{getColor as l,quietColorProbe as V,setAdaptiveSchemeVar as S}from"./color.js";import{getSpacingByKey as $}from"./spacing.js";import{isResolvedColor as g,isCSSVar as j,splitTopLevelCommas as A,CSS_NATIVE_COLOR_REGEX as h,COMPOUND_CSS_KEYWORDS as x}from"../utils/color.js";import{isObject as w,isString as p,isArray as b}from"@symbo.ls/utils";const N=(r,o,i)=>!p(r)||h.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 n=V(()=>l(t,o));if(g(n))return n;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none"||x.has(t.toLowerCase()))return t;i&&i(t);const s=$(t,"shadow");return s&&s.shadow?s.shadow:t}).join(" "))).join(", "),m=(r,o,i,f)=>{const t=C();if(b(r)){const e={"@light":m(r[0],o,"light"),"@dark":m(r[1],o,"dark")};return t.useVariable&&S(e,"shadow",o,t),e}if(w(r)){const e={};for(const c in r)e[c]=m(r[c],o,c.startsWith("@")?c.slice(1):c);return t.useVariable&&S(e,"shadow",o,t),e}p(r)&&!h.test(r)&&(r=N(r));const s=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[s]=r),{var:s,value:r}},R=(r,o)=>{const i=C();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!p(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if(j(r))return`var(${r})`;const[f]=b(r)?r:r.split(" "),n=i.shadow[f],s=w(n);if(!n)return i.verbose&&console.warn("Can't find color ",f),r;if(s&&!n.value&&i.useVariable&&n.var)return`var(${n.var})`;if(o){const e=n["@"+o]||n[o];if(e)return e.value!==void 0?e.value:e;i.verbose&&console.warn(r," - does not have ",o)}if(s&&n.value)return n.value;if(s){const e={};for(const c in n){if(c.charCodeAt(0)!==64)continue;const a=i.media[c.slice(1)];if(!a)continue;const O="@media "+(a==="print"?`${a}`:`screen and ${a}`),d=n[c],u=d&&(d.value!==void 0?d.value:d);u!==void 0&&(e[O]=u)}return e}return i.verbose&&console.warn("Can't find color",r),r};export{R as getShadow,N as resolveShadowValue,m as setShadow};
@@ -1 +1 @@
1
- import{getColor as R}from"./color.js";import{resolveShadowValue as E}from"./shadow.js";import{resolveBorderValue as k}from"./border.js";import{getActiveConfig as y}from"../factory.js";import{isCSSVar as O,parseColorToken as Z}from"../utils/color.js";import{isObject as T,isString as b,isObjectLike as S,isArray as P,isLoudDevRuntime as F}from"@symbo.ls/utils";const J=new Set(["black","white","red","green","blue","yellow","orange","purple","pink","brown","gray","grey","cyan","magenta","lime","olive","navy","teal","aqua","maroon","silver","fuchsia","transparent","currentColor","currentcolor","inherit","initial","unset","none","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple"]),q=["color","Color","background","Background","fill","Fill","stroke","Stroke"],Q=e=>{for(let r=0;r<q.length;r++)if(e.includes(q[r]))return!0;return!1},X={boxShadow:E,textShadow:E,border:k,borderTop:k,borderRight:k,borderBottom:k,borderLeft:k,outline:k,columnRule:k},Y=e=>{if(!e)return!1;const r=Z(e);return!r||!r.name||r.passthrough||r.cssVar?!1:r.alpha!==void 0||r.tone!==void 0},_=new Set,I=(e,r,o,s,n,i)=>{if(!F())return;const t=`${e}::${r}::${o||""}::${s}`;_.has(t)||(_.add(t),console.warn(`[smbls/scratch] theme param "${r}" on "${e}"`+(o?` (${o})`:"")+` did not fully resolve: "${s}" -> "${n}" still contains the unresolved token "${i}". This is not valid CSS \u2014 the browser will drop the whole declaration. Register "${i}" as a design-system color token or fix the typo.`))},L=(e,r,o,s)=>{const n=X[r];if(!n)return R(o,s);let i=null;const t=n(o,s,a=>{!i&&Y(a)&&(i=a)});return i&&I(e,r,s,o,t,i),t},V=e=>{const r={},{state:o,media:s,helpers:n,...i}=e;return Object.keys(i).map(a=>{const c=["color","Color","background","border"].some(u=>a.includes(u));return r[a]=c?R(e[a]):e[a]}),r},$=e=>(e.value||(e.value=V(e)),e.value),N=(e,r)=>{const o=y();if(o.useVariable)return v(e,r);const s=o.theme;if(b(e)){const[n,i]=e.split(" "),t=s[n];if(t){if(!i&&!r)return $(t);e=[n,i||r]}}if(S(e)&&e[1]){const n=e[0],i=e[1],{helpers:t,media:a,state:l}=s[n];if(a&&a[i])return $(a[i]);if(t&&t[i])return $(t[i]);if(l&&l[i])return $(l[i])}else if(T(e))return V(e)},K=(e,r,o)=>{if(T(r))e.variants.inverse.value=V(r);else if(r===!0){const{color:s,background:n}=o;e.variants.inverse={value:{color:n,background:s}}}},G=(e,r,o,s)=>{const n=N(o);s[`&:${r}`]=n,T(o)&&!o.value&&(o.value=n)},H=(e,r)=>{const{state:o}=e;return o?(Object.keys(o).map(n=>{const i=o[n];return G(e,n,i,r),e}),e):void 0},ee=(e,r,o,s)=>{const n=N(o);s[`@media (prefers-color-scheme: ${r})`]=n,T(o)&&!o.value&&(o.value=n)},D=(e,r)=>{const{media:o}=e;return o?(Object.keys(o).map(n=>{const i=o[n];return(n==="dark"||n==="light")&&ee(e,n,i,r),n==="inverse"&&K(e,i,r),e}),e):void 0},z=(e,r)=>{const o=y(),{helpers:s}=e;return s?(Object.keys(s).map(i=>{const t=s[i];return b(t)?s[i]=o.theme[t]:$(s[i]),e}),e):void 0},ae=(e,r)=>{const o=y();if(o.useVariable)return B(e,r);const{state:s,media:n,helpers:i}=e,t=V(e,r),l=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}`;return H(e,t),D(e,t),z(e,t),{var:l,value:t,state:s,media:n,helpers:i}},ue={"@":(e,r)=>D(e,r),":":(e,r)=>H(e,r),".":(e,r)=>z(e,r)},j=(e,r,o)=>{const{cssVars:s}=o;o.cssMediaVars||(o.cssMediaVars={});const n=o.cssMediaVars,i=o.globalTheme!==void 0?o.globalTheme:"auto",t={},a=new Set;for(const c in e)if(e[c])for(const u of Object.keys(e[c]))a.add(u);const l=new Set;for(const c of a){const u=c.slice(0,1);if(!(u==="@"||u==="."||u===":")&&Q(c))for(const g in e){if(l.has(g))continue;const m=e[g]?.[c];if(m===void 0)continue;const d=R(m,`@${g}`);d!==void 0&&b(d)&&/^[a-z][a-zA-Z]+$/.test(d)&&!J.has(d)&&l.add(g)}}for(const c of a){const u=c.slice(0,1),g=Object.values(e).some(m=>S(m?.[c]));if(u==="."&&g){const m=c.slice(1),d={};for(const h in e)S(e[h]?.[c])&&(d[h]=e[h][c]);t[c]=j(d,`${r}-${m}`,o)}else if(u===":"&&g){const m=c.replace(/^:+/,""),d={};for(const h in e)S(e[h]?.[c])&&(d[h]=e[h][c]);t[c]=j(d,`${r}-${m}`,o)}else if(u!=="@"&&u!=="."&&u!==":"){const d=`--${o.varPrefix?o.varPrefix+"-":""}theme-${r}-${c}`,h=i&&i!=="auto"?String(i).replace(/^'|'$/g,""):null;let p;for(const f in e){if(l.has(f))continue;const A=e[f]?.[c];if(A===void 0)continue;const w=L(r,c,A,`@${f}`);if(w===void 0)continue;(h&&f===h||!h&&(f==="light"||p===void 0))&&(p=w);const C=`[data-theme="${f}"]`;if(n[C]||(n[C]={}),n[C][d]=w,f==="dark"||f==="light"){const M=`@media (prefers-color-scheme: ${f})`;n[M]||(n[M]={}),n[M][d]=w}}p!==void 0&&(s[d]=p),t[c]=`var(${d})`,t[`.${c}`]={[c]:t[c]}}}return(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color}),t},B=(e,r,o,s)=>{const n=y(),{cssVars:i}=n,t={value:e},a=!o&&!s;if(S(e)){if(a&&n.useVariable){const l={};for(const c in e)c.startsWith("@")&&S(e[c])&&(l[c.slice(1)]=e[c]);if(Object.keys(l).length){const c=j(l,r,n);Object.assign(t,c)}}for(const l in e){const c=l.slice(0,1),u=e[l];if(c==="@"||c===":"||c==="."){const g=c==="@"&&l;t[l]=B(u,r,l,s||g)}else if(!a){const g=L(r,l,u,s),m=[...new Set([s,o].filter(f=>f).map(f=>f.slice(1)))],d=m.length?"-"+m.join("-"):"",p=`--${n.varPrefix?n.varPrefix+"-":""}theme-${r}${d}-${l}`;n.useVariable?(n.useThemeSuffixedVars&&(i[p]=g),t[l]=`var(${p})`):t[l]=g,t[`.${l}`]={[l]:t[l]}}}!t[".inversed"]&&(t.background||t.color||t.backgroundColor)&&(t[".inversed"]={color:t.background||t.backgroundColor,background:t.color})}if(b(e)&&O(e)){const c=n.theme[e.slice(2)];return v(c,s)}return t},x=e=>{const r=y(),o={};for(const s in e){const n=s.slice(0,1);if(S(e[s])){if(n==="@")continue;n===":"?o[`&${s}`]=x(e[s]):n==="."&&(o[`&${s}`]=x(e[s]))}else o[s]=e[s]}return o},U=(e,r)=>{const o=r.shift();return e[o]?U(e[o],r):e},W=(e,r)=>P(r)?U(e,r):b(r)&&e[r]?e[r]:e,re=(e,r)=>b(e)&&O(e)?v(e.slice(2)):e,oe=e=>re(e,oe),v=(e,r)=>{const o=y();if(b(e)&&O(e)&&(e=v(e.slice(2))),!e||!b(e)){o.verbose&&console.warn(`${e} - Theme is not a string`);return}const[s,...n]=P(e)?e:e.split(" ");let i=o.theme[s];return i&&n.length?i=W(i,n):i&&r&&(i=W(i,r)),x(i)};export{v as getMediaTheme,N as getTheme,B as setMediaTheme,ae as setTheme};
1
+ import{getColor as A,schemeMediaQuery as Y,schemeGuardSelector as Z}from"./color.js";import{resolveShadowValue as x}from"./shadow.js";import{resolveBorderValue as T}from"./border.js";import{getActiveConfig as M}from"../factory.js";import{isCSSVar as v,parseColorToken as J}from"../utils/color.js";import{isObject as E,isString as $,isObjectLike as y,isArray as L,isLoudDevRuntime as K}from"@symbo.ls/utils";const q=new Set(["black","white","red","green","blue","yellow","orange","purple","pink","brown","gray","grey","cyan","magenta","lime","olive","navy","teal","aqua","maroon","silver","fuchsia","transparent","currentColor","currentcolor","inherit","initial","unset","none","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple"]),P=["color","Color","background","Background","fill","Fill","stroke","Stroke"],D=e=>{for(let o=0;o<P.length;o++)if(e.includes(P[o]))return!0;return!1},X={boxShadow:x,textShadow:x,border:T,borderTop:T,borderRight:T,borderBottom:T,borderLeft:T,outline:T,columnRule:T},F=e=>{if(!e)return!1;const o=J(e);return!o||!o.name||o.passthrough||o.cssVar?!1:o.alpha!==void 0||o.tone!==void 0},W=new Set,I=(e,o,r,t,s,a)=>{if(!K())return;const i=`${e}::${o}::${r||""}::${t}`;W.has(i)||(W.add(i),console.warn(`[smbls/scratch] theme param "${o}" on "${e}"`+(r?` (${r})`:"")+` did not fully resolve: "${t}" -> "${s}" still contains the unresolved token "${a}". This is not valid CSS \u2014 the browser will drop the whole declaration. Register "${a}" as a design-system color token or fix the typo.`))},O=(e,o,r,t)=>{const s=X[o];if(!s)return A(r,t);let a=null;const i=s(r,t,g=>{!a&&F(g)&&(a=g)});return a&&I(e,o,t,r,i,a),i},ge=(e,o)=>R(e,o),G=e=>E(e)&&y(e.value),ee=e=>{for(const o in e){const r=e[o];if($(r)&&r.startsWith("var(--"))return!0}return!1},he=(e,o)=>{const r=M();return G(e)?!r.useVariable&&ee(e)?e:C(e.value,o):C(e,o)},B=(e,o)=>{const r=new Set;for(const t of o){const s=t.slice(0,1);if(!(s==="@"||s==="."||s===":")&&D(t))for(const a in e){if(r.has(a))continue;const i=e[a]?.[t];if(i===void 0)continue;const g=A(i,`@${a}`);g!==void 0&&$(g)&&/^[a-z][a-zA-Z]+$/.test(g)&&!q.has(g)&&r.add(a)}}return r},oe=new Set(["none","inherit","initial","unset","revert","revert-layer"]),ne=/^(?:#[0-9a-f]{3,8}$|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix)\()/i,re=/gradient\(|url\(|image-set\(|var\(/i,U=e=>{if(!$(e))return!1;const o=e.trim();return re.test(o)?!1:ne.test(o)?!0:q.has(o)&&!oe.has(o)},te=e=>e.startsWith("[data-theme=")||e.startsWith("@media"),V=(e,o)=>{for(const r in o){const t=o[r];E(t)?V(e[r]||(e[r]={}),t):e[r]=t}return e},z=(e,o,r,t)=>{if(V(e,{[`[data-theme="${o}"] &`]:r}),o!=="light"&&o!=="dark")return;const s=Y(o,t);s&&V(e,{[s]:{[Z(t)]:r}})},H=(e,o,r,t)=>{const s=r.globalTheme!==void 0?r.globalTheme:"auto",a=s&&s!=="auto"?String(s).replace(/^'|'$/g,""):null,i=new Set(t?Object.keys(t):[]);for(const n in e)if(e[n])for(const c of Object.keys(e[n]))i.add(c);const g=B(e,i),f={};for(const n of i){const c=n.slice(0,1);if(c==="@")continue;if(c==="."||c===":"){const d={};for(const w in e)y(e[w]?.[n])&&(d[w]=e[w][n]);const h=t&&y(t[n])?t[n]:void 0;if(!Object.keys(d).length&&!h)continue;const m=c==="."?n.slice(1):n.replace(/^:+/,"");f[n]=H(d,`${o}-${m}`,r,h);continue}const b=t&&!y(t[n])?t[n]:void 0,k=new Set(Object.keys(e));b!==void 0&&(k.add("light"),k.add("dark"),a&&k.add(a));const l={};let u;for(const d of k){if(g.has(d))continue;let h=e[d]?.[n];if((h===void 0||y(h))&&(h=b),h===void 0)continue;const m=O(o,n,h,`@${d}`);m!==void 0&&(l[d]=m,(a&&d===a||!a&&(d==="light"||u===void 0))&&(u=m))}const S={},p=Object.keys(l).filter(d=>l[d]!==u);if(p.length){const d=l.light!==void 0?l.light:u,h=l.dark!==void 0?l.dark:u;if(D(n)&&U(d)&&U(h)){S[n]=d===h?d:`light-dark(${d}, ${h})`;for(const m in l)m==="light"||m==="dark"||z(S,m,{[n]:l[m]},r)}else{u!==void 0&&(S[n]=u);for(const m of p)z(S,m,{[n]:l[m]},r)}}else{if(u===void 0)continue;S[n]=u}V(f,S),f[`.${n}`]=S}return(f.background||f.color||f.backgroundColor)&&(f[".inversed"]={color:f.background||f.backgroundColor,background:f.color}),f},j=(e,o,r)=>{const{cssVars:t}=r;r.cssMediaVars||(r.cssMediaVars={});const s=r.cssMediaVars,a=r.globalTheme!==void 0?r.globalTheme:"auto",i={},g=new Set;for(const n in e)if(e[n])for(const c of Object.keys(e[n]))g.add(c);const f=B(e,g);for(const n of g){const c=n.slice(0,1),b=Object.values(e).some(k=>y(k?.[n]));if(c==="."&&b){const k=n.slice(1),l={};for(const u in e)y(e[u]?.[n])&&(l[u]=e[u][n]);i[n]=j(l,`${o}-${k}`,r)}else if(c===":"&&b){const k=n.replace(/^:+/,""),l={};for(const u in e)y(e[u]?.[n])&&(l[u]=e[u][n]);i[n]=j(l,`${o}-${k}`,r)}else if(c!=="@"&&c!=="."&&c!==":"){const l=`--${r.varPrefix?r.varPrefix+"-":""}theme-${o}-${n}`,u=a&&a!=="auto"?String(a).replace(/^'|'$/g,""):null;let S;for(const p in e){if(f.has(p))continue;const d=e[p]?.[n];if(d===void 0)continue;const h=O(o,n,d,`@${p}`);if(h===void 0)continue;(u&&p===u||!u&&(p==="light"||S===void 0))&&(S=h);const m=`[data-theme="${p}"]`;if(s[m]||(s[m]={}),s[m][l]=h,p==="dark"||p==="light"){const w=`@media (prefers-color-scheme: ${p})`;s[w]||(s[w]={}),s[w][l]=h}}S!==void 0&&(t[l]=S),i[n]=`var(${l})`,i[`.${n}`]={[n]:i[n]}}}return(i.background||i.color||i.backgroundColor)&&(i[".inversed"]={color:i.background||i.backgroundColor,background:i.color}),i},C=(e,o,r,t)=>{const s=M(),{cssVars:a}=s,i={value:e},g=!r&&!t;let f;if(y(e)){if(g&&s.useVariable){const n={};for(const c in e)c.startsWith("@")&&y(e[c])&&(n[c.slice(1)]=e[c]);if(Object.keys(n).length){const c=j(n,o,s);Object.assign(i,c)}}else if(g){const n={},c={};for(const b in e)b.startsWith("@")?y(e[b])&&(n[b.slice(1)]=e[b]):c[b]=e[b];f=H(n,o,s,c),Object.assign(i,f)}for(const n in e){const c=n.slice(0,1),b=e[n];if(c==="@"||c===":"||c==="."){const k=c==="@"&&n;i[n]=C(b,o,n,t||k)}else if(!g){const k=O(o,n,b,t),l=[...new Set([t,r].filter(d=>d).map(d=>d.slice(1)))],u=l.length?"-"+l.join("-"):"",p=`--${s.varPrefix?s.varPrefix+"-":""}theme-${o}${u}-${n}`;s.useVariable?(s.useThemeSuffixedVars&&(a[p]=k),i[n]=`var(${p})`):i[n]=k,i[`.${n}`]={[n]:i[n]}}}if(f)for(const n in f){const c=n.slice(0,1);(c==="."||c===":")&&y(e[n])&&(i[n]=f[n])}!i[".inversed"]&&(i.background||i.color||i.backgroundColor)&&(i[".inversed"]={color:i.background||i.backgroundColor,background:i.color})}if($(e)&&v(e)){const c=s.theme[e.slice(2)];return R(c,t)}return i},_=(e,o)=>{const r={};for(const t in e){const s=t.slice(0,1);if(y(e[t]))if(o&&te(t))r[t]=V({},e[t]);else{if(s==="@")continue;s===":"?r[`&${t}`]=_(e[t],o):s==="."&&(r[`&${t}`]=_(e[t],o))}else r[t]=e[t]}return r},N=(e,o)=>{const r=o.shift();return e[r]?N(e[r],o):e},Q=(e,o)=>L(o)?N(e,o):$(o)&&e[o]?e[o]:e,ie=(e,o)=>$(e)&&v(e)?R(e.slice(2)):e,se=e=>ie(e,se),R=(e,o)=>{const r=M();if($(e)&&v(e)&&(e=R(e.slice(2))),!e||!$(e)){r.verbose&&console.warn(`${e} - Theme is not a string`);return}const[t,...s]=L(e)?e:e.split(" ");let a=r.theme[t];return a&&s.length?a=Q(a,s):a&&o&&(a=Q(a,o)),_(a,!r.useVariable)};export{R as getMediaTheme,ge as getTheme,C as setMediaTheme,he as setTheme};
@@ -1 +1 @@
1
- import{isString as c,isObject as h,exec as R}from"@symbo.ls/utils";import{getActiveConfig as T}from"../factory.js";import{getSpacingByKey as p,getColor as m,getShadow as I,getShapeByKey as z,getMediaColor as j,getTimingByKey as B,getTimingFunction as C,getSpacingBasedOnRatio as O,checkIfBoxSize as V,splitSpacedValue as A,resolveBorderValue as E}from"../system/index.js";import{getFnPrefixAndValue as G,isResolvedColor as d,isCSSVar as l,CSS_NATIVE_COLOR_REGEX as x,splitTopLevelCommas as S,parseColorToken as $}from"../utils/index.js";const K=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),L=r=>E(r),P=r=>x.test(r)?r:r.split(/\s+/).map(e=>{if(e=e.trim(),!e)return"";if(l(e))return`var(${e})`;if(/^\d/.test(e)||e.includes("px")||e==="0")return e;const n=m(e);return d(n)?n:e}).join(" "),M=(r,e)=>I(r,e),X=(r,e)=>x.test(r)?r:S(r).map(n=>(n=n.trim(),n?n.split(/\s+/).map(i=>{if(i=i.trim(),!i)return"";if(l(i))return`var(${i})`;if(i==="inset"||i==="none")return i;const t=m(i);if(d(t)){const u=j(i,e);return h(u)?Object.values(u).filter(a=>a.includes(": "+e))[0]:u}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const s=p(i,"shadow");return s&&s.shadow?s.shadow:i}).join(" "):"")).join(", "),W=(r,e)=>{const n=r.indexOf("(");if(n===-1)return r;const i=r.slice(0,n+1),t=r.slice(n+1,r.lastIndexOf(")")),s=")",a=S(t).map(f=>(f=f.trim(),f.split(/\s+/).map(o=>{if(!o||/^\d/.test(o)||o==="0"||K.has(o)||o==="transparent"||x.test(o))return o;const g=m(o);return d(g)?g:o}).join(" ")));return i+a.join(", ")+s},Y=(r,e)=>{const n=T();return S(r).map(i=>{const t=i.trim();if(l(t))return`var(${t})`;if(/^var\(/.test(t)||t.includes("url"))return t;if(n.gradient?.[t]){const s=j(t,e);if(c(s))return s;if(h(s)){for(const u in s)if(c(s[u]))return s[u]}return t}return t.includes("gradient")?W(t,e):t.includes("/")||t.startsWith("http")||t.includes(".")&&!$(t)?`url(${t})`:t}).join(", ")},H=r=>c(r)&&r.split(" ").map(e=>p(e,"gap").gap).join(" "),_=r=>{const e=r.split(" ");return e.length?e.map(n=>l(n)?`var(${n})`:n.length<3||n.includes("ms")?B(n).timing||n:C(n)?C(n):n).join(" "):r},J=(r,e,n)=>{if(c(r))return r.split(",").map(i=>B(i).timing||i).join(",")},Q=r=>{const e=r.split(",");if(e.length)return e.map(_).join(",")};function b(r,e,n={},i={}){let t=R.call(this,e||n[r]);if(t==null)return;let s;if(c(t)){if(/^(?:env|var)\(/.test(t.trim()))return{[r]:t};if(t.includes("(")){const f=G(t);s=f[0],t=f[1]}const u=n.scaleBoxSize,a=V(r);!u&&a&&!i.ratio&&(t=A(t))}return i.ratio?O(n,r,t,s):p(t,r,void 0,s)}const U=(r,e=null,n)=>b(r,e,n,{ratio:!0}),Z=(r,e,n,i="borderRadius")=>{if(c(r))return{[i]:r.split(" ").map(t=>{const s=z(t);return s!==void 0?s:O(e,n,t)[n]}).join(" ")}};export{W as resolveColorsInGradient,Q as splitTransition,Y as transformBackgroundImage,L as transformBorder,Z as transformBorderRadius,X as transformBoxShadow,J as transformDuration,M as transformShadow,b as transformSize,U as transformSizeRatio,P as transformTextStroke,_ as transformTransition,H as transfromGap};
1
+ import{isString as u,isObject as h,exec as T}from"@symbo.ls/utils";import{getActiveConfig as j}from"../factory.js";import{getSpacingByKey as p,getColor as m,getShadow as O,getShapeByKey as A,getMediaColor as B,getTimingByKey as C,getTimingFunction as E,getSpacingBasedOnRatio as R,checkIfBoxSize as G,splitSpacedValue as I,resolveBorderValue as V}from"../system/index.js";import{getFnPrefixAndValue as _,isResolvedColor as d,isCSSVar as l,CSS_NATIVE_COLOR_REGEX as x,splitTopLevelCommas as S,splitTopLevelSpaces as z,parseColorToken as $,getSequenceValue as F}from"../utils/index.js";const K=new Set(["to","top","bottom","left","right","center","at","circle","ellipse","closest-side","farthest-side","closest-corner","farthest-corner"]),L=/^-?[A-Z][0-9]?$/,N=r=>V(r),Q=r=>{if(u(r))return x.test(r)?r:r.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(l(t))return`var(${t})`;if(/^\d/.test(t)||t.includes("px")||t==="0")return t;const e=m(t);return d(e)?e:t}).join(" ")},U=(r,t)=>O(r,t),X=(r,t)=>{if(u(r))return x.test(r)?r:S(r).map(e=>(e=e.trim(),e?e.split(/\s+/).map(i=>{if(i=i.trim(),!i)return"";if(l(i))return`var(${i})`;if(i==="inset"||i==="none")return i;const n=m(i);if(d(n)){const f=B(i,t);return h(f)?Object.values(f).filter(a=>a.includes(": "+t))[0]:f}if(/^\d/.test(i)||i==="0"||i.includes("px")||i.slice(-2)==="em")return i;const s=p(i,"shadow");return s&&s.shadow?s.shadow:i}).join(" "):"")).join(", ")},W=(r,t)=>{const e=r.indexOf("(");if(e===-1)return r;const i=r.slice(0,e+1),n=r.slice(e+1,r.lastIndexOf(")")),s=")",a=S(n).map(c=>(c=c.trim(),c.split(/\s+/).map(o=>{if(!o||/^\d/.test(o)||o==="0"||K.has(o)||o==="transparent"||x.test(o))return o;const g=m(o);return d(g)?g:o}).join(" ")));return i+a.join(", ")+s},Y=(r,t)=>{if(!u(r))return;const e=j();return S(r).map(i=>{const n=i.trim();if(l(n))return`var(${n})`;if(/^var\(/.test(n)||n.includes("url"))return n;if(e.gradient?.[n]){const s=B(n,t);if(u(s))return s;if(h(s)){for(const f in s)if(u(s[f]))return s[f]}return n}return n.includes("gradient")?W(n,t):n.includes("/")||n.startsWith("http")||n.includes(".")&&!$(n)?`url(${n})`:n}).join(", ")},Z=r=>u(r)&&r.split(" ").map(t=>p(t,"gap").gap).join(" "),H=r=>{if(!u(r))return r;const t=j();return z(r).map(e=>L.test(e)?F(e,t.spacing):e).join(" ")},q=r=>{if(!u(r))return;const t=r.split(" ");return t.length?t.map(e=>l(e)?`var(${e})`:e.length<3||e.includes("ms")?C(e).timing||e:E(e)?E(e):e).join(" "):r},J=(r,t,e)=>{if(u(r))return r.split(",").map(i=>C(i).timing||i).join(",")},k=r=>{if(!u(r))return;const t=r.split(",");if(t.length)return t.map(q).join(",")};function D(r,t,e={},i={}){let n=T.call(this,t||e[r]);if(n==null)return;let s;if(u(n)){if(/^(?:env|var)\(/.test(n.trim()))return{[r]:n};if(n.includes("(")){const c=_(n);s=c[0],n=c[1]}const f=e.scaleBoxSize,a=G(r);!f&&a&&!i.ratio&&(n=I(n))}return i.ratio?R(e,r,n,s):p(n,r,void 0,s)}const v=(r,t=null,e)=>D(r,t,e,{ratio:!0}),rr=(r,t,e,i="borderRadius")=>{if(u(r))return{[i]:r.split(" ").map(n=>{const s=A(n);return s!==void 0?s:R(t,e,n)[e]}).join(" ")}};export{W as resolveColorsInGradient,k as splitTransition,Y as transformBackgroundImage,N as transformBorder,rr as transformBorderRadius,X as transformBoxShadow,J as transformDuration,H as transformGridTemplate,U as transformShadow,D as transformSize,v as transformSizeRatio,Q as transformTextStroke,q as transformTransition,Z as transfromGap};
@@ -1 +1 @@
1
- import{document as l,window as p,isString as h,isNumber as x,isNotProduction as y}from"@symbo.ls/utils";const w={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},u=e=>{if(e==="")return[0,0,0,0];if(e.toLowerCase()==="transparent")return[0,0,0,0];const r=w[e.toLowerCase()];if(r&&(e=r),e[0]==="#")return e.length<7&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(e.length>4?e[4]+e[4]:"")),[parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16),e.length>7?parseInt(e.substr(7,2),16)/255:1];if(e.indexOf("rgb")===-1&&l&&p){const t=l.body.appendChild(l.createElement("fictum")),n="rgb(1, 2, 3)";if(t.style.color=n,t.style.color!==n){l.body.removeChild(t);return}if(t.style.color=e,t.style.color===n||t.style.color==="")return l.body.removeChild(t),[0,0,0,0];e=p.getComputedStyle(t).color,l.body.removeChild(t)}return e.indexOf("rgb")===0?(e.indexOf("rgba")===-1&&(e=`${e}, 1`),e.match(/[\.\d]+/g).map(t=>+t)):[0,0,0,0]},A=(e,r,t=.5)=>(e=u(e),r=u(r),R(e,r,t)),F=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgb(${t},${n},${a})`},k=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return[t,n,a]},H=(e,r,t)=>"#"+(1<<24|e<<16|r<<8|t).toString(16).slice(1),M=([e,r,t])=>((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1),N=(e,r=1)=>{const[t,n,a]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgba(${t},${n},${a},${r})`},j=(e,r,t=.5)=>{const n=[];for(let a=0;a<3;a++)n[a]=~~(e[a]+(r[a]-e[a])*t);return`rgb(${n})`},G=(e,r)=>{const[t,n,a]=r,f=Math.max(0,Math.min(100,a+parseFloat(e)));return[t,n,f]},T=(e,r,t)=>{const n=Math.max(e,r,t),a=n-Math.min(e,r,t),f=1-Math.abs(n+n-a-1),o=a&&(n==e?(r-t)/a:n==r?2+(t-e)/a:4+(e-r)/a);return[60*(o<0?o+6:o),f?a/f:0,(n+n-a)/2]},C=(e,r,t,n=r*Math.min(t,1-t),a=(f,o=(f+e/30)%12)=>t-n*Math.max(Math.min(o-3,9-o,1),-1))=>[a(0),a(8),a(4)],S=(e,r)=>{const t=parseInt(e,16);let n=(t>>16)+r;n>255?n=255:n<0&&(n=0);let a=(t>>8&255)+r;a>255?a=255:a<0&&(a=0);let f=(t&255)+r;return f>255?f=255:f<0&&(f=0),((f|a<<8|n<<16)+16777216).toString(16).slice(1)},R=(e,r,t=.5)=>{const n=[];for(let a=0;a<4;a++){const f=a===3?o=>o:Math.round;n[a]=f(e[a]+(r[a]-e[a])*t)}return`rgba(${n})`},z=(e,r)=>{const t=u(e);if(!t){y()&&console.warn(e+" color is not rgba");return}return t[3]=r,`rgba(${t})`},O=e=>e.charCodeAt(0)===45&&e.charCodeAt(1)===45,_=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,$=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,P=e=>{if(!h(e))return null;if(_.test(e))return{passthrough:e};if(O(e))return{cssVar:e};const r=e.match($);if(!r)return null;const[,t,n,a]=r,f=n!==void 0?`0.${n}`:void 0,o=a&&a[0]==="="?a.slice(1):a;return{name:t,alpha:f,tone:o}},V=e=>h(e)&&(e.includes("rgb")||e.includes("var(")||e.includes("#")),X=e=>{const r=[];let t="",n=0;for(const a of e){if(a==="("?n+=1:a===")"&&n>0&&(n-=1),a===","&&n===0){r.push(t),t="";continue}t+=a}return(t.length||!r.length)&&r.push(t),r},g=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),m=e=>.2126*g(e[0])+.7152*g(e[1])+.0722*g(e[2]),D=(e,r)=>{const t=m(e)+.05,n=m(r)+.05;return t>n?t/n:n/t},I=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),L=e=>(e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055)*255,Z=([e,r,t])=>{const[n,a,f]=[e,r,t].map(I),o=.4122214708*n+.5363325363*a+.0514459929*f,s=.2119034982*n+.6806995451*a+.1073969566*f,i=.0883024619*n+.2817188376*a+.6299787005*f,c=Math.cbrt(o),d=Math.cbrt(s),b=Math.cbrt(i);return[.2104542553*c+.793617785*d-.0040720468*b,1.9779984951*c-2.428592205*d+.4505937099*b,.0259040371*c+.7827717662*d-.808675766*b]},q=([e,r,t])=>{const n=e+.3963377774*r+.2158037573*t,a=e-.1055613458*r-.0638541728*t,f=e-.0894841775*r-1.291485548*t,o=n**3,s=a**3,i=f**3;return[4.0767416621*o-3.3077115913*s+.2309699292*i,-1.2684380046*o+2.6097574011*s-.3413193965*i,-.0041960863*o-.7034186147*s+1.707614701*i]},K=([e,r,t])=>{let n=Math.atan2(t,r)*180/Math.PI;return n<0&&(n+=360),[e,Math.sqrt(r*r+t*t),n]},E=([e,r,t])=>{const n=t*Math.PI/180;return[e,r*Math.cos(n),r*Math.sin(n)]},J=(e,r,t,n=24)=>{const a=s=>q(E([e,s,t])),f=s=>s.every(i=>i>=-1e-4&&i<=1.0001);let o=a(r);if(!f(o)){let s=0,i=r;for(let c=0;c<n;c++){const d=(s+i)/2;f(a(d))?s=d:i=d}o=a(s)}return o.map(s=>L(Math.max(0,Math.min(1,s))))},Q=(e,r=1,t=[255,255,255])=>r>=1?e:e.map((n,a)=>n*r+t[a]*(1-r)),U=(e,r)=>{h(e)&&e.includes("rgb")&&(e=u(e).join(", ")),h(e)&&(e=e.split(",").map(a=>parseFloat(a.trim()))),x(r)&&(r+="");const t=M(e),n=r.slice(0,1);if(n==="-"||n==="+"){const a=S(t,parseFloat(r));return k(a).join(", ")}else{const[a,f,o]=e,[s,i]=T(a/255,f/255,o/255),c=Math.max(0,Math.min(100,parseFloat(r)))/100;return C(s,i,c).map(b=>Math.round(Math.max(0,Math.min(1,b))*255)).join(", ")}};export{w as CSS_NAMED_COLOR_HEX,_ as CSS_NATIVE_COLOR_REGEX,G as changeLightness,u as colorStringToRgbaArray,Q as compositeOverBackdrop,D as contrastRatio,S as getColorShade,U as getRgbTone,F as hexToRgb,k as hexToRgbArray,N as hexToRgba,C as hslToRgb,O as isCSSVar,V as isResolvedColor,L as linearChannelToSrgb,A as mixTwoColors,j as mixTwoRgb,R as mixTwoRgba,q as oklabToLinearSrgb,K as oklabToOklch,J as oklchToGamutSafeSrgb,E as oklchToOklab,z as opacify,P as parseColorToken,m as relativeLuminance,M as rgbArrayToHex,T as rgbToHSL,H as rgbToHex,X as splitTopLevelCommas,I as srgbChannelToLinear,Z as srgbToOklab,g as toLinearChannel};
1
+ import{document as d,window as p,isString as u,isNumber as x,isNotProduction as y}from"@symbo.ls/utils";const w={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},b=e=>{if(e==="")return[0,0,0,0];if(e.toLowerCase()==="transparent")return[0,0,0,0];const r=w[e.toLowerCase()];if(r&&(e=r),e[0]==="#")return e.length<7&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(e.length>4?e[4]+e[4]:"")),[parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16),e.length>7?parseInt(e.substr(7,2),16)/255:1];if(e.indexOf("rgb")===-1&&d&&p){const t=d.body.appendChild(d.createElement("fictum")),a="rgb(1, 2, 3)";if(t.style.color=a,t.style.color!==a){d.body.removeChild(t);return}if(t.style.color=e,t.style.color===a||t.style.color==="")return d.body.removeChild(t),[0,0,0,0];e=p.getComputedStyle(t).color,d.body.removeChild(t)}return e.indexOf("rgb")===0?(e.indexOf("rgba")===-1&&(e=`${e}, 1`),e.match(/[\.\d]+/g).map(t=>+t)):[0,0,0,0]},A=(e,r,t=.5)=>(e=b(e),r=b(r),R(e,r,t)),F=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgb(${t},${a},${n})`},k=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return[t,a,n]},N=(e,r,t)=>"#"+(1<<24|e<<16|r<<8|t).toString(16).slice(1),M=([e,r,t])=>((1<<24)+(e<<16)+(r<<8)+t).toString(16).slice(1),H=(e,r=1)=>{const[t,a,n]=e.match(/\w\w/g).map(f=>parseInt(f,16));return`rgba(${t},${a},${n},${r})`},j=(e,r,t=.5)=>{const a=[];for(let n=0;n<3;n++)a[n]=~~(e[n]+(r[n]-e[n])*t);return`rgb(${a})`},D=(e,r)=>{const[t,a,n]=r,f=Math.max(0,Math.min(100,n+parseFloat(e)));return[t,a,f]},T=(e,r,t)=>{const a=Math.max(e,r,t),n=a-Math.min(e,r,t),f=1-Math.abs(a+a-n-1),o=n&&(a==e?(r-t)/n:a==r?2+(t-e)/n:4+(e-r)/n);return[60*(o<0?o+6:o),f?n/f:0,(a+a-n)/2]},S=(e,r,t,a=r*Math.min(t,1-t),n=(f,o=(f+e/30)%12)=>t-a*Math.max(Math.min(o-3,9-o,1),-1))=>[n(0),n(8),n(4)],C=(e,r)=>{const t=parseInt(e,16);let a=(t>>16)+r;a>255?a=255:a<0&&(a=0);let n=(t>>8&255)+r;n>255?n=255:n<0&&(n=0);let f=(t&255)+r;return f>255?f=255:f<0&&(f=0),((f|n<<8|a<<16)+16777216).toString(16).slice(1)},R=(e,r,t=.5)=>{const a=[];for(let n=0;n<4;n++){const f=n===3?o=>o:Math.round;a[n]=f(e[n]+(r[n]-e[n])*t)}return`rgba(${a})`},G=(e,r)=>{const t=b(e);if(!t){y()&&console.warn(e+" color is not rgba");return}return t[3]=r,`rgba(${t})`},O=e=>e.charCodeAt(0)===45&&e.charCodeAt(1)===45,P=new Set(["currentcolor","transparent","thin","medium","thick"]),_=/(?:rgba?\(|hsla?\(|#[0-9a-fA-F]{3,8}\b)/,$=/^([a-zA-Z]\w*(?:-[a-zA-Z]\w*)*)(?:\.(\d+))?(?:([+-]\d+|=\d+))?$/,z=e=>{if(!u(e))return null;if(_.test(e))return{passthrough:e};if(O(e))return{cssVar:e};const r=e.match($);if(!r)return null;const[,t,a,n]=r,f=a!==void 0?`0.${a}`:void 0,o=n&&n[0]==="="?n.slice(1):n;return{name:t,alpha:f,tone:o}},V=e=>u(e)&&(e.includes("rgb")||e.includes("var(")||e.includes("#")),X=e=>{const r=[];let t="",a=0;for(const n of e){if(n==="("?a+=1:n===")"&&a>0&&(a-=1),n===","&&a===0){r.push(t),t="";continue}t+=n}return(t.length||!r.length)&&r.push(t),r},K=e=>{const r=[];let t="",a=0;for(const n of e){if(n==="("?a+=1:n===")"&&a>0&&(a-=1),a===0&&/\s/.test(n)){t.length&&r.push(t),t="";continue}t+=n}return t.length&&r.push(t),r},g=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),m=e=>.2126*g(e[0])+.7152*g(e[1])+.0722*g(e[2]),Z=(e,r)=>{const t=m(e)+.05,a=m(r)+.05;return t>a?t/a:a/t},I=e=>(e/=255,e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)),L=e=>(e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055)*255,U=([e,r,t])=>{const[a,n,f]=[e,r,t].map(I),o=.4122214708*a+.5363325363*n+.0514459929*f,s=.2119034982*a+.6806995451*n+.1073969566*f,i=.0883024619*a+.2817188376*n+.6299787005*f,c=Math.cbrt(o),l=Math.cbrt(s),h=Math.cbrt(i);return[.2104542553*c+.793617785*l-.0040720468*h,1.9779984951*c-2.428592205*l+.4505937099*h,.0259040371*c+.7827717662*l-.808675766*h]},q=([e,r,t])=>{const a=e+.3963377774*r+.2158037573*t,n=e-.1055613458*r-.0638541728*t,f=e-.0894841775*r-1.291485548*t,o=a**3,s=n**3,i=f**3;return[4.0767416621*o-3.3077115913*s+.2309699292*i,-1.2684380046*o+2.6097574011*s-.3413193965*i,-.0041960863*o-.7034186147*s+1.707614701*i]},W=([e,r,t])=>{let a=Math.atan2(t,r)*180/Math.PI;return a<0&&(a+=360),[e,Math.sqrt(r*r+t*t),a]},E=([e,r,t])=>{const a=t*Math.PI/180;return[e,r*Math.cos(a),r*Math.sin(a)]},Y=(e,r,t,a=24)=>{const n=s=>q(E([e,s,t])),f=s=>s.every(i=>i>=-1e-4&&i<=1.0001);let o=n(r);if(!f(o)){let s=0,i=r;for(let c=0;c<a;c++){const l=(s+i)/2;f(n(l))?s=l:i=l}o=n(s)}return o.map(s=>L(Math.max(0,Math.min(1,s))))},J=(e,r=1,t=[255,255,255])=>r>=1?e:e.map((a,n)=>a*r+t[n]*(1-r)),Q=(e,r)=>{u(e)&&e.includes("rgb")&&(e=b(e).join(", ")),u(e)&&(e=e.split(",").map(n=>parseFloat(n.trim()))),x(r)&&(r+="");const t=M(e),a=r.slice(0,1);if(a==="-"||a==="+"){const n=C(t,parseFloat(r));return k(n).join(", ")}else{const[n,f,o]=e,[s,i]=T(n/255,f/255,o/255),c=Math.max(0,Math.min(100,parseFloat(r)))/100;return S(s,i,c).map(h=>Math.round(Math.max(0,Math.min(1,h))*255)).join(", ")}};export{P as COMPOUND_CSS_KEYWORDS,w as CSS_NAMED_COLOR_HEX,_ as CSS_NATIVE_COLOR_REGEX,D as changeLightness,b as colorStringToRgbaArray,J as compositeOverBackdrop,Z as contrastRatio,C as getColorShade,Q as getRgbTone,F as hexToRgb,k as hexToRgbArray,H as hexToRgba,S as hslToRgb,O as isCSSVar,V as isResolvedColor,L as linearChannelToSrgb,A as mixTwoColors,j as mixTwoRgb,R as mixTwoRgba,q as oklabToLinearSrgb,W as oklabToOklch,Y as oklchToGamutSafeSrgb,E as oklchToOklab,G as opacify,z as parseColorToken,m as relativeLuminance,M as rgbArrayToHex,T as rgbToHSL,N as rgbToHex,X as splitTopLevelCommas,K as splitTopLevelSpaces,I as srgbChannelToLinear,U as srgbToOklab,g as toLinearChannel};
@@ -1,9 +1,10 @@
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(`,
1
+ const s=(t,n)=>{if(!t||!n)return null;try{return new URL(t),null}catch{}const r=n[t];return r?r.content&&r.content.src:null},D=(t,n)=>{if(t[n])return t[n].value;const r=()=>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 c=r();if(c)return t[c].value}if(o)return o.value}const e=r()||Object.keys(t).find(o=>o!=="default"&&t[o]&&t[o].value);return e&&t[e]&&t[e].value},$=t=>{if(typeof t!="string"||!t)return null;const n=t.split(/[#?]/)[0].split(".").pop().trim();return["woff2","woff","ttf","otf","eot"].includes(n)?n:null},S=t=>t&&(t.includes("fonts.googleapis.com")||t.includes("fonts.gstatic.com")),x=t=>`@import url('${t}');`,v=t=>`@font-face { ${t} }`,y=(t,n,r,e={})=>{const f=(Array.isArray(n)?n:[n]).filter(a=>typeof a=="string"&&a).map(a=>{const l=$(a),u=l?` format('${l}')`:"";return`url('${a}')${u}`}).join(`,
2
2
  `);return`
3
3
  font-family: '${t}';
4
- font-style: ${e.fontStyle||"normal"};${n?`
5
- font-weight: ${n};`:""}${e.fontStretch?`
4
+ font-style: ${e.fontStyle||"normal"};${r?`
5
+ font-weight: ${r};`:""}${e.fontStretch?`
6
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};
7
+ font-display: ${e.fontDisplay};`:""}${e.unicodeRange?`
8
+ unicode-range: ${e.unicodeRange};`:""}
9
+ src: ${f};`},p=(t,n,r,e)=>`@font-face {${y(t,n,r,e)}
10
+ }`,d=(t,n,r)=>Object.keys(n).map(o=>{const{url:c,fontWeight:f,fontStyle:a,fontDisplay:l,fontStretch:u,unicodeRange:m}=n[o],F=Array.isArray(c)?c.map(i=>s(i,r)||i):s(c,r)||c;return y(t,F,f,{fontStyle:a,fontDisplay:l,fontStretch:u,unicodeRange:m})}),g=t=>Object.keys(t).map(r=>d(r,t[r].value)),b=(t,n,r)=>{if(n&&n.isVariable){const c=s(n.url,r)||n.url;return S(c)?x(c):p(t,c,n.fontWeight,{fontStretch:n.fontStretch,fontDisplay:n.fontDisplay||"swap",unicodeRange:n.unicodeRange})}if(n[0])return d(t,n,r).map(v);const o=Array.isArray(n.url)?n.url.map(c=>s(c,r)||c):s(n.url,r)||n.url;return p(t,o,n.fontWeight,{fontStyle:n.fontStyle,fontDisplay:n.fontDisplay,fontStretch:n.fontStretch,unicodeRange:n.unicodeRange})},j=(t,n)=>Object.keys(t).map(e=>b(e,t[e].value,n));export{D as getDefaultOrFirstKey,g as getFontFace,d as getFontFaceEach,b as getFontFaceEachString,j as getFontFaceString,$ as getFontFormat,S as isGoogleFontsUrl,s as resolveFileUrl,y as setCustomFont,p as setCustomFontMedia,x as setFontImport,v as setInCustomFontMedia};
@@ -1 +1 @@
1
- import{isNotProduction as $,isString as g}from"@symbo.ls/utils";import{getActiveConfig as w}from"../factory.js";const u=$(),R=e=>{const t=w();let r="";for(const n in e)t.__svgCache[n]||(t.__svgCache[n]=!0,r+=e[n]);return r},d=e=>{const t=e&&(e.default||e);if(!g(t))return u&&console.warn("parseRootAttributes:",t,"is not a string"),{};const r=t.match(/<svg\s+(.*?)>/);if(!r||!r[1])return{};const o=r[1].match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);return o?o.reduce((s,c)=>{const[l,a]=c.split("=");return s[l]=a.replace(/['"]/g,""),s},{}):{}},h=(e,t)=>{const r=[];if(e.replace(/id="([^"]*)"/g,(o,s)=>(r.push(s),o)),!r.length)return e;let n=e;for(const o of r){const s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=`${t}-${o}`;n=n.replace(new RegExp(`id="${s}"`,"g"),`id="${c}"`).replace(new RegExp(`url\\(#${s}\\)`,"g"),`url(#${c})`).replace(new RegExp(`xlink:href="#${s}"`,"g"),`xlink:href="#${c}"`).replace(new RegExp(`href="#${s}"`,"g"),`href="#${c}"`)}return n},f=new Set,A=(e,t)=>{const r=t&&t.default?t.default:t;if(!g(r))return u&&!f.has(e)&&(f.add(e),console.warn("convertSvgToSymbol:",e,"is not a string")),"";t=r;const n=t.match(/^<symbol\b[^>]*\bid="([^"]*)"/);if(n){const p=n[1];return p===e?t:t.replace(`id="${p}"`,`id="${e}"`)}const o=d(t),{width:s,height:c}=o,l=o.viewBox||`0 0 ${s||24} ${c||24}`;let i=h(t,e).replace("<svg",`<symbol id="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="${l}"`);return i=i.replace(/width="[^"]*"/,""),i=i.replace(/height="[^"]*"/,""),i=i.replace("</svg","</symbol"),i=x(i),i},v="line|circle|ellipse|rect|polyline|polygon|path|stop|use|image",m=new RegExp(`<(${v})\\b([^>]*?)\\s*/>`,"g"),x=e=>e.replace(m,"<$1$2></$1>");export{A as convertSvgToSymbol,R as generateSprite};
1
+ import{isNotProduction as $,isString as g}from"@symbo.ls/utils";import{getActiveConfig as w}from"../factory.js";const u=$(),R=e=>{const t=w();let r="";for(const n in e)t.__svgCache[n]||(t.__svgCache[n]=!0,r+=e[n]);return r},d=e=>{const t=e&&(e.default||e);if(!g(t))return u&&console.warn("parseRootAttributes:",t,"is not a string"),{};const r=t.match(/<svg\s+(.*?)>/);if(!r||!r[1])return{};const o=r[1].match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);return o?o.reduce((s,i)=>{const[a,p]=i.split("=");return s[a]=p.replace(/['"]/g,""),s},{}):{}},h=(e,t)=>{const r=[];if(e.replace(/id="([^"]*)"/g,(o,s)=>(r.push(s),o)),!r.length)return e;let n=e;for(const o of r){const s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=`${t}-${o}`;n=n.replace(new RegExp(`id="${s}"`,"g"),`id="${i}"`).replace(new RegExp(`url\\(#${s}\\)`,"g"),`url(#${i})`).replace(new RegExp(`xlink:href="#${s}"`,"g"),`xlink:href="#${i}"`).replace(new RegExp(`href="#${s}"`,"g"),`href="#${i}"`)}return n},f=new Set,y=(e,t)=>{const r=t&&t.default?t.default:t;if(!g(r))return u&&!f.has(e)&&(f.add(e),console.warn("convertSvgToSymbol:",e,"is not a string")),"";t=r;const n=t.match(/^<symbol\b[^>]*\bid="([^"]*)"/);if(n){const l=n[1];return l===e?t:t.replace(`id="${l}"`,`id="${e}"`)}const o=d(t),{width:s,height:i}=o,a=o.viewBox||`0 0 ${s||24} ${i||24}`;let c=h(t,e).replace("<svg",`<symbol id="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="${a}"`);return c=c.replace(/^<symbol\b[^>]*>/,l=>l.replace(/\s(width|height)="[^"]*"/g,"")),c=c.replace("</svg","</symbol"),c=x(c),c},m="line|circle|ellipse|rect|polyline|polygon|path|stop|use|image",v=new RegExp(`<(${m})\\b([^>]*?)\\s*/>`,"g"),x=e=>e.replace(v,"<$1$2></$1>");export{y as convertSvgToSymbol,R as generateSprite};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/scratch",
3
- "description": "\u03a6 / CSS framework and methodology.",
3
+ "description": "Φ / CSS framework and methodology.",
4
4
  "author": "symbo.ls",
5
- "version": "3.14.776",
5
+ "version": "3.14.778",
6
6
  "files": [
7
7
  "dist",
8
8
  "*.js",
@@ -36,7 +36,7 @@
36
36
  "@symbo.ls/utils": "^3.14.707",
37
37
  "color-contrast-checker": "^1.5.0"
38
38
  },
39
- "gitHead": "e7fbb40d81040e265e980564d4eeb2709fa02cb0",
39
+ "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
40
40
  "browser": "./dist/esm/index.js",
41
41
  "sideEffects": true
42
42
  }