@symbo.ls/scratch 3.14.776 → 3.14.777

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @symbo.ls/scratch
2
2
 
3
+ ## 3.14.777
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated patch release for changed packages.
8
+
3
9
  ## 3.14.774
4
10
 
5
11
  ### Patch Changes
@@ -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 m=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var o in e)f(t,o,{get:e[o],enumerable:!0})},g=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a(e))!S.call(t,i)&&i!==o&&f(t,i,{get:()=>e[i],enumerable:!(n=m(e,i))||n.enumerable});return t};var C=t=>g(f({},"__esModule",{value:!0}),t);var B={};p(B,{resolveBorderValue:()=>h});module.exports=C(B);var u=require("./color.js"),c=require("./spacing.js"),s=require("../utils/color.js");const E=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),R=t=>E.has(t),h=(t,e,o)=>{if(t==null)return;const n=t+"";if(s.CSS_NATIVE_COLOR_REGEX.test(n))return n;const i=n.trim();return i==="none"||i==="0"||i==="initial"||i==="inherit"||i==="unset"?n:n.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if((0,s.isCSSVar)(r))return`var(${r})`;if(R(r)||/^\d/.test(r)||r==="0")return r;const l=(0,u.quietColorProbe)(()=>(0,u.getColor)(r,e));if((0,s.isResolvedColor)(l))return l;o&&o(r);const d=(0,c.getSpacingByKey)(r,"border");return d&&d.border?d.border:r}).join(" ")};
@@ -1 +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 D=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var z=(e,n)=>{for(var o in n)D(e,o,{get:n[o],enumerable:!0})},B=(e,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of W(n))!H.call(e,t)&&t!==o&&D(e,t,{get:()=>n[t],enumerable:!(r=v(n,t))||r.enumerable});return e};var K=e=>B(D({},"__esModule",{value:!0}),e);var Z={};z(Z,{STANDARD_SCHEME_QUERIES:()=>P,getColor:()=>V,getMediaColor:()=>Y,quietColorProbe:()=>U,resolveColorRgb:()=>O,setAdaptiveSchemeVar:()=>L,setColor:()=>E,setGradient:()=>j});module.exports=K(Z);var d=require("@symbo.ls/utils"),R=require("../factory.js"),g=require("../utils/index.js");const P={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},w=new Set,Q=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),C=new Set,T=e=>{if(!e)return!1;const{color:n,gradient:o}=e;return!!((0,d.isObject)(n)&&Object.keys(n).length||(0,d.isObject)(o)&&Object.keys(o).length)},_=new Set;let M=0;const U=e=>{M++;try{return e()}finally{M--}},J=(e,n)=>{if(!(0,d.isString)(e)||e.indexOf(" ")===-1)return null;const o=e.replace(/\s+/g,""),r=(0,g.parseColorToken)(o);if(!r||r.passthrough||r.cssVar)return null;const{color:t,gradient:c}=n;return!t[r.name]&&!c[r.name]?null:o},x=(e,n,o)=>{const r=J(e,o);if(r){if(!_.has(e)){_.add(e);const a=o&&o.name?` (design system \`${o.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` has a space before its alpha/tone modifier${a} \u2014 did you mean \`${r}\`? The space form never resolves, so the atomic class it mints carries no CSS value and paints invisibly. Dropped rather than shipped invisible.`)}return}const t=(0,g.parseColorToken)(e);if(t&&t.name&&!t.passthrough&&!t.cssVar&&(t.alpha!==void 0||t.tone!==void 0)&&T(o)&&!o.color[t.name]&&!o.gradient[t.name]){if(!M&&!C.has(e)){C.add(e);const a=o&&o.name?` (design system \`${o.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` does not resolve${a} \u2014 \`${t.name}\` is not in the palette. Dropped rather than emitted as a raw value, which is invalid CSS the browser discards silently. Define it in designSystem/color.js or use a palette token.`)}return}const c=(0,d.isString)(n)?n.toLowerCase():"";if(!Q.has(c)||!T(o))return e;if(!C.has(c)){C.add(c);const a=o&&o.name?` (design system \`${o.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${a}. Dropped rather than emitted as a raw browser colour, which renders theme-blind and can be unreadable ("looks designed", so it ships unnoticed). Define it in designSystem/color.js or use a palette token.`)}},V=(e,n,o)=>{const r=o||(0,R.getActiveConfig)();if(!(0,d.isString)(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if((0,g.isCSSVar)(e))return`var(${e})`;n&&e[n]&&(e=e[n]);let t,c,a;if((0,d.isArray)(e))[t,c,a]=e;else{const l=(0,g.parseColorToken)(e);if(!l){const{color:h,gradient:S}=r;let $=S[e]||h[e];return $?(n&&$[n]&&($=$[n]),r.useVariable?`var(${$.var})`:$.value):x(e,e,r)}if(l.passthrough)return l.passthrough;if(l.cssVar)return`var(${l.cssVar})`;t=l.name,c=l.alpha,a=l.tone}const{color:b,gradient:f}=r;let s=b[t]||f[t];if(!s)return x(e,t,r);if(n)if(s[n]!==void 0)s=s[n];else if((0,d.isArray)(s)){const l=n.charCodeAt(0)===64?n.slice(1):n;l==="dark"?s=s[1]!==void 0?s[1]:s[0]:(l!=="light"&&r.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",n),s=s[0])}else r.verbose&&console.warn(e," - does not have ",n);if((0,d.isString)(s)){if(w.has(t))return s;w.add(t);try{return V(s,null,o)}finally{w.delete(t)}}let p=s.rgb;if(!p){const l=r.useVariable?`var(${s.var})`:s.value;if((c||a)&&l){const h=c!==void 0?c:1;if(!a)return`rgb(from ${l} r g b / ${h})`;if(a.charCodeAt(0)===43||a.charCodeAt(0)===45){const $=parseFloat(a),u=$<0?"-":"+",i=Math.abs($);return`rgb(from ${l} calc(r ${u} ${i}) calc(g ${u} ${i}) calc(b ${u} ${i}) / ${h})`}return`hsl(from ${l} h s ${a}% / ${h})`}return l}return a&&!s[a]&&(p=(0,g.getRgbTone)(p,a),s[a]={rgb:p,var:`${s.var}-${a}`}),s[a]&&(p=s[a].rgb),c?`rgba(${p}, ${c})`:a?`rgba(${p}, ${s.alpha!==void 0?s.alpha:1})`:r.useVariable?`var(${s.var})`:s.value!==void 0?s.value:`rgb(${p})`},q=e=>{const n=(0,g.colorStringToRgbaArray)(e);return!n||n.length<3||n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[n[0],n[1],n[2]],alpha:n[3]!==void 0?n[3]:1}},X=(e,n)=>{if(!n)return e;let o=e.rgb;if(n.tone){const t=(0,g.getRgbTone)(o,n.tone);o=(0,d.isString)(t)?t.split(",").map(c=>parseFloat(c.trim())):t}const r=n.alpha!==void 0?parseFloat(n.alpha):e.alpha;return{rgb:o,alpha:r}},O=(e,n,o)=>{const r=n||(0,R.getActiveConfig)();if(!(0,d.isString)(e))return null;const t=(0,g.parseColorToken)(e);if(t){if(t.passthrough){const h=(0,g.colorStringToRgbaArray)(t.passthrough);return h&&h.length>=3?{rgb:[h[0],h[1],h[2]],alpha:h[3]!==void 0?h[3]:1}:null}if(t.cssVar)return null}const c=t?t.name:e,{color:a,gradient:b}=r;let f=a[c]||b[c];if(!f)return q(e);if((0,d.isString)(f)){let h;if(w.has(c))h=q(f);else{w.add(c);try{h=O(f,r,o)}finally{w.delete(c)}}return h?X(h,t):null}if(f.rgb===void 0&&(0,d.isObject)(f)){const h=`@${o||"light"}`;f=f[h]!==void 0?f[h]:f["@light"]}if(!f||f.rgb===void 0)return null;let s=f.rgb;t&&t.tone&&(s=(0,g.getRgbTone)(s,t.tone));const p=(0,d.isString)(s)?s.split(",").map(h=>parseFloat(h.trim())):s,l=t&&t.alpha!==void 0?parseFloat(t.alpha):f.alpha!==void 0?f.alpha:1;return{rgb:p,alpha:l}},Y=(e,n,o)=>{const r=o||(0,R.getActiveConfig)();if(n||(n=r.globalTheme==="auto"?null:r.globalTheme),!(0,d.isString)(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if((0,g.isCSSVar)(e))return`var(${e})`;let t,c,a;if((0,d.isArray)(e))t=e[0];else{const l=(0,g.parseColorToken)(e);if(l){if(l.passthrough)return l.passthrough;if(l.cssVar)return`var(${l.cssVar})`;t=l.name,c=l.alpha,a=l.tone}else t=e}const{color:b,gradient:f}=r,s=b[t]||f[t],p=(0,d.isObject)(s);if(p&&s.value)return V(e,`@${n}`,o);if(p){if(r.useVariable&&s.var)return c||a?V(e,null,o):`var(${s.var})`;if(n)return V(e,`@${n}`,o);{const l={},h=r.scopeSelector||":root",S=h===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${h}:not([data-theme])`;for(const $ in s){if($.charCodeAt(0)!==64)continue;const u=$.slice(1),i=V(e,$,o);if(i!==void 0&&(l[`[data-theme="${u}"] &`]=i,u==="light"||u==="dark")){const m=r.media&&r.media[u]||P[u];if(!m)continue;const y="@media "+(m==="print"?`${m}`:`screen and ${m}`);l[y]={[`${S} &`]:i}}}return l}}else return x(e,t,r)},L=(e,n,o,r)=>{const c=`--${r.varPrefix?r.varPrefix+"-":""}${n}-${o}`;let a;const b={};for(const f in e){if(f.charCodeAt(0)!==64)continue;const s=f.slice(1),p=e[f],l=p&&(p.value||p);!l||typeof l!="string"||(b[s]=l,(s==="light"||a===void 0)&&(a=l))}if(a!==void 0){r.cssVars[c]=a,r.cssMediaVars||(r.cssMediaVars={});for(const f in b){const s=`[data-theme="${f}"]`;if(r.cssMediaVars[s]||(r.cssMediaVars[s]={}),r.cssMediaVars[s][c]=b[f],f==="light"||f==="dark"){const p=`@media (prefers-color-scheme: ${f})`;r.cssMediaVars[p]||(r.cssMediaVars[p]={}),r.cssMediaVars[p][c]=b[f]}}return e.var=c,c}},E=(e,n,o)=>{const r=(0,R.getActiveConfig)();if((0,d.isObject)(e)&&e.value!==void 0&&(e.rgb!==void 0||e.var!==void 0))return r.useVariable&&e.var&&(r.cssVars[e.var]=e.value),e;if((0,d.isString)(e)&&(0,g.isCSSVar)(e)){const u=e.slice(2);if(e=V(u),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const i=u.split(" ");let m=r.color[i[0]];if(m&&!m.value&&!m.rgb&&((0,d.isString)(m)||(0,d.isArray)(m)||(0,d.isObject)(m))&&!w.has(i[0])){w.add(i[0]);try{r.color[i[0]]=E(m,i[0])}finally{w.delete(i[0])}m=r.color[i[0]]}if(m&&m.value){let y=m.rgb;const A=i[1]!==void 0?i[1]:"1",k=i[2];k&&(y=(0,g.getRgbTone)(y,k)),e=`rgba(${y}, ${A})`}else{const y=i[2],A=i[1]!==void 0?i[1]:"1";if(y)try{const k=(0,g.colorStringToRgbaArray)(i[0]);k&&k.length>=3?e=`rgba(${(0,g.getRgbTone)(k.slice(0,3).join(", "),y)}, ${A})`:e=i[0]}catch{e=i[0]}else e=i[0]}}}if((0,d.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,d.isObject)(e)){const u={};for(const i in e)i!=="var"&&(u[i]=E(e[i],n,i.slice(0,1)==="@"?i.slice(1):i));return r.useVariable&&L(u,"color",n,r),u}const c=`--${r.varPrefix?r.varPrefix+"-":""}color-${n}`+(o?`-${o}`:"");let a=e.value||e;if((0,d.isString)(a)&&!a.includes("(")&&!a.startsWith("#")){const u=(0,g.parseColorToken)(a);if(u&&u.name&&!u.passthrough&&!u.cssVar){const i=r.color[u.name];if(i&&!i.value&&!i.rgb&&((0,d.isString)(i)||(0,d.isArray)(i)||(0,d.isObject)(i))&&!w.has(u.name)){w.add(u.name);try{r.color[u.name]=E(i,u.name)}finally{w.delete(u.name)}}const m=r.color[u.name];if(m&&m.rgb){let y=m.rgb;u.tone&&(y=(0,g.getRgbTone)(y,u.tone));const A=u.alpha!==void 0?parseFloat(u.alpha):m.alpha!==void 0?m.alpha:1;a=`rgba(${y}, ${A})`}}}const b=(0,g.colorStringToRgbaArray)(a),[f,s,p,l=1]=b,h=parseFloat(l.toFixed(2)),S=`${f}, ${s}, ${p}`,$=`rgba(${S}, ${h})`;return r.useVariable&&(r.cssVars[c]=$),{var:c,rgb:S,alpha:h,value:$}},j=(e,n,o)=>{const r=(0,R.getActiveConfig)();if((0,d.isObject)(e)&&e.value!==void 0&&e.var!==void 0)return r.useVariable&&(r.cssVars[e.var]=e.value),e;if((0,d.isString)(e)&&(0,g.isCSSVar)(e)&&(e=V(e.slice(2))),(0,d.isArray)(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),(0,d.isObject)(e)){const a={};for(const b in e)b!=="var"&&(a[b]=j(e[b],n,b.slice(0,1)==="@"?b.slice(1):b));return r.useVariable&&L(a,"gradient",n,r),a}const c=`--${r.varPrefix?r.varPrefix+"-":""}gradient-${n}`+(o?`-${o}`:"");return r.useVariable&&(r.cssVars[c]=e.value||e),{var:c,value:e.value||e}};
@@ -1 +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 O=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var A=(r,o)=>{for(var i in o)S(r,i,{get:o[i],enumerable:!0})},$=(r,o,i,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of g(o))!j.call(r,t)&&t!==i&&S(r,t,{get:()=>o[t],enumerable:!(e=O(o,t))||e.enumerable});return r};var x=r=>$(S({},"__esModule",{value:!0}),r);var W={};A(W,{getShadow:()=>N,resolveShadowValue:()=>V,setShadow:()=>C});module.exports=x(W);var h=require("../factory.js"),p=require("./color.js"),b=require("./spacing.js"),d=require("../utils/color.js"),c=require("@symbo.ls/utils");const V=(r,o,i)=>!(0,c.isString)(r)||d.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,d.splitTopLevelCommas)(r).map(e=>(e=e.trim(),e.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const s=(0,p.quietColorProbe)(()=>(0,p.getColor)(t,o));if((0,d.isResolvedColor)(s))return s;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none")return t;i&&i(t);const f=(0,b.getSpacingByKey)(t,"shadow");return f&&f.shadow?f.shadow:t}).join(" "))).join(", "),C=(r,o,i,e)=>{const t=(0,h.getActiveConfig)();if((0,c.isArray)(r)){const n={"@light":C(r[0],o,"light"),"@dark":C(r[1],o,"dark")};return t.useVariable&&(0,p.setAdaptiveSchemeVar)(n,"shadow",o,t),n}if((0,c.isObject)(r)){const n={};for(const a in r)n[a]=C(r[a],o,a.startsWith("@")?a.slice(1):a);return t.useVariable&&(0,p.setAdaptiveSchemeVar)(n,"shadow",o,t),n}(0,c.isString)(r)&&!d.CSS_NATIVE_COLOR_REGEX.test(r)&&(r=V(r));const f=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[f]=r),{var:f,value:r}},N=(r,o)=>{const i=(0,h.getActiveConfig)();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!(0,c.isString)(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if((0,d.isCSSVar)(r))return`var(${r})`;const[e]=(0,c.isArray)(r)?r:r.split(" "),s=i.shadow[e],f=(0,c.isObject)(s);if(!s)return i.verbose&&console.warn("Can't find color ",e),r;if(o){const n=s["@"+o]||s[o];if(n)return n.value!==void 0?n.value:n;i.verbose&&console.warn(r," - does not have ",o)}if(f&&s.value)return s.value;if(f){const n={};for(const a in s){if(a.charCodeAt(0)!==64)continue;const m=i.media[a.slice(1)];if(!m)continue;const l="@media "+(m==="print"?`${m}`:`screen and ${m}`),u=s[a],w=u&&(u.value!==void 0?u.value:u);w!==void 0&&(n[l]=w)}return n}return i.verbose&&console.warn("Can't find color",r),r};
@@ -1,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
- 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 c,isCSSVar as m,CSS_NATIVE_COLOR_REGEX as a}from"../utils/color.js";const S=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","initial"]),p=t=>S.has(t),R=(t,u,o)=>{if(t==null)return;const e=t+"";if(a.test(e))return e;const i=e.trim();return i==="none"||i==="0"||i==="initial"||i==="inherit"||i==="unset"?e:e.split(/\s+/).map(r=>{if(r=r.trim(),!r)return"";if(m(r))return`var(${r})`;if(p(r)||/^\d/.test(r)||r==="0")return r;const s=f(()=>d(r,u));if(c(s))return s;o&&o(r);const n=l(r,"border");return n&&n.border?n.border:r}).join(" ")};export{R as resolveBorderValue};
@@ -1 +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 D}from"../factory.js";import{colorStringToRgbaArray as M,getRgbTone as A,isCSSVar as x,parseColorToken as C}from"../utils/index.js";const W={light:"(prefers-color-scheme: light)",dark:"(prefers-color-scheme: dark)"},y=new Set,H=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),L=new Set,P=e=>{if(!e)return!1;const{color:n,gradient:s}=e;return!!(w(n)&&Object.keys(n).length||w(s)&&Object.keys(s).length)},O=new Set;let T=0;const Z=e=>{T++;try{return e()}finally{T--}},z=(e,n)=>{if(!b(e)||e.indexOf(" ")===-1)return null;const s=e.replace(/\s+/g,""),r=C(s);if(!r||r.passthrough||r.cssVar)return null;const{color:t,gradient:c}=n;return!t[r.name]&&!c[r.name]?null:s},_=(e,n,s)=>{const r=z(e,s);if(r){if(!O.has(e)){O.add(e);const a=s&&s.name?` (design system \`${s.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` has a space before its alpha/tone modifier${a} \u2014 did you mean \`${r}\`? The space form never resolves, so the atomic class it mints carries no CSS value and paints invisibly. Dropped rather than shipped invisible.`)}return}const t=C(e);if(t&&t.name&&!t.passthrough&&!t.cssVar&&(t.alpha!==void 0||t.tone!==void 0)&&P(s)&&!s.color[t.name]&&!s.gradient[t.name]){if(!T&&!L.has(e)){L.add(e);const a=s&&s.name?` (design system \`${s.name}\`)`:"";console.warn(`[scratch] color token \`${e}\` does not resolve${a} \u2014 \`${t.name}\` is not in the palette. Dropped rather than emitted as a raw value, which is invalid CSS the browser discards silently. Define it in designSystem/color.js or use a palette token.`)}return}const c=b(n)?n.toLowerCase():"";if(!H.has(c)||!P(s))return e;if(!L.has(c)){L.add(c);const a=s&&s.name?` (design system \`${s.name}\`)`:"";console.warn(`[scratch] color \`${e}\` is a CSS named colour that is not in the palette${a}. Dropped rather than emitted as a raw browser colour, which renders theme-blind and can be unreadable ("looks designed", so it ships unnoticed). Define it in designSystem/color.js or use a palette token.`)}},R=(e,n,s)=>{const r=s||D();if(!b(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;n&&e[n]&&(e=e[n]);let t,c,a;if(k(e))[t,c,a]=e;else{const l=C(e);if(!l){const{color:u,gradient:V}=r;let m=V[e]||u[e];return m?(n&&m[n]&&(m=m[n]),r.useVariable?`var(${m.var})`:m.value):_(e,e,r)}if(l.passthrough)return l.passthrough;if(l.cssVar)return`var(${l.cssVar})`;t=l.name,c=l.alpha,a=l.tone}const{color:p,gradient:d}=r;let o=p[t]||d[t];if(!o)return _(e,t,r);if(n)if(o[n]!==void 0)o=o[n];else if(k(o)){const l=n.charCodeAt(0)===64?n.slice(1):n;l==="dark"?o=o[1]!==void 0?o[1]:o[0]:(l!=="light"&&r.verbose&&console.warn(e," - array-form color tokens only support light/dark; falling back to the light slot for scheme",n),o=o[0])}else r.verbose&&console.warn(e," - does not have ",n);if(b(o)){if(y.has(t))return o;y.add(t);try{return R(o,null,s)}finally{y.delete(t)}}let h=o.rgb;if(!h){const l=r.useVariable?`var(${o.var})`:o.value;if((c||a)&&l){const u=c!==void 0?c:1;if(!a)return`rgb(from ${l} r g b / ${u})`;if(a.charCodeAt(0)===43||a.charCodeAt(0)===45){const m=parseFloat(a),f=m<0?"-":"+",i=Math.abs(m);return`rgb(from ${l} calc(r ${f} ${i}) calc(g ${f} ${i}) calc(b ${f} ${i}) / ${u})`}return`hsl(from ${l} h s ${a}% / ${u})`}return l}return a&&!o[a]&&(h=A(h,a),o[a]={rgb:h,var:`${o.var}-${a}`}),o[a]&&(h=o[a].rgb),c?`rgba(${h}, ${c})`:a?`rgba(${h}, ${o.alpha!==void 0?o.alpha:1})`:r.useVariable?`var(${o.var})`:o.value!==void 0?o.value:`rgb(${h})`},j=e=>{const n=M(e);return!n||n.length<3||n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0&&e.toLowerCase()!=="transparent"?null:{rgb:[n[0],n[1],n[2]],alpha:n[3]!==void 0?n[3]:1}},B=(e,n)=>{if(!n)return e;let s=e.rgb;if(n.tone){const t=A(s,n.tone);s=b(t)?t.split(",").map(c=>parseFloat(c.trim())):t}const r=n.alpha!==void 0?parseFloat(n.alpha):e.alpha;return{rgb:s,alpha:r}},K=(e,n,s)=>{const r=n||D();if(!b(e))return null;const t=C(e);if(t){if(t.passthrough){const u=M(t.passthrough);return u&&u.length>=3?{rgb:[u[0],u[1],u[2]],alpha:u[3]!==void 0?u[3]:1}:null}if(t.cssVar)return null}const c=t?t.name:e,{color:a,gradient:p}=r;let d=a[c]||p[c];if(!d)return j(e);if(b(d)){let u;if(y.has(c))u=j(d);else{y.add(c);try{u=K(d,r,s)}finally{y.delete(c)}}return u?B(u,t):null}if(d.rgb===void 0&&w(d)){const u=`@${s||"light"}`;d=d[u]!==void 0?d[u]:d["@light"]}if(!d||d.rgb===void 0)return null;let o=d.rgb;t&&t.tone&&(o=A(o,t.tone));const h=b(o)?o.split(",").map(u=>parseFloat(u.trim())):o,l=t&&t.alpha!==void 0?parseFloat(t.alpha):d.alpha!==void 0?d.alpha:1;return{rgb:h,alpha:l}},N=(e,n,s)=>{const r=s||D();if(n||(n=r.globalTheme==="auto"?null:r.globalTheme),!b(e)){r.verbose&&console.warn(e,"- type for color is not valid");return}if(x(e))return`var(${e})`;let t,c,a;if(k(e))t=e[0];else{const l=C(e);if(l){if(l.passthrough)return l.passthrough;if(l.cssVar)return`var(${l.cssVar})`;t=l.name,c=l.alpha,a=l.tone}else t=e}const{color:p,gradient:d}=r,o=p[t]||d[t],h=w(o);if(h&&o.value)return R(e,`@${n}`,s);if(h){if(r.useVariable&&o.var)return c||a?R(e,null,s):`var(${o.var})`;if(n)return R(e,`@${n}`,s);{const l={},u=r.scopeSelector||":root",V=u===":root"?":root:not([data-theme])":`:root:not([data-theme]) ${u}:not([data-theme])`;for(const m in o){if(m.charCodeAt(0)!==64)continue;const f=m.slice(1),i=R(e,m,s);if(i!==void 0&&(l[`[data-theme="${f}"] &`]=i,f==="light"||f==="dark")){const g=r.media&&r.media[f]||W[f];if(!g)continue;const $="@media "+(g==="print"?`${g}`:`screen and ${g}`);l[$]={[`${V} &`]:i}}}return l}}else return _(e,t,r)},v=(e,n,s,r)=>{const c=`--${r.varPrefix?r.varPrefix+"-":""}${n}-${s}`;let a;const p={};for(const d in e){if(d.charCodeAt(0)!==64)continue;const o=d.slice(1),h=e[d],l=h&&(h.value||h);!l||typeof l!="string"||(p[o]=l,(o==="light"||a===void 0)&&(a=l))}if(a!==void 0){r.cssVars[c]=a,r.cssMediaVars||(r.cssMediaVars={});for(const d in p){const o=`[data-theme="${d}"]`;if(r.cssMediaVars[o]||(r.cssMediaVars[o]={}),r.cssMediaVars[o][c]=p[d],d==="light"||d==="dark"){const h=`@media (prefers-color-scheme: ${d})`;r.cssMediaVars[h]||(r.cssMediaVars[h]={}),r.cssMediaVars[h][c]=p[d]}}return e.var=c,c}},q=(e,n,s)=>{const r=D();if(w(e)&&e.value!==void 0&&(e.rgb!==void 0||e.var!==void 0))return r.useVariable&&e.var&&(r.cssVars[e.var]=e.value),e;if(b(e)&&x(e)){const f=e.slice(2);if(e=R(f),!(e.includes("rgb")||e.includes("var")||e.includes("#"))){const i=f.split(" ");let g=r.color[i[0]];if(g&&!g.value&&!g.rgb&&(b(g)||k(g)||w(g))&&!y.has(i[0])){y.add(i[0]);try{r.color[i[0]]=q(g,i[0])}finally{y.delete(i[0])}g=r.color[i[0]]}if(g&&g.value){let $=g.rgb;const E=i[1]!==void 0?i[1]:"1",S=i[2];S&&($=A($,S)),e=`rgba(${$}, ${E})`}else{const $=i[2],E=i[1]!==void 0?i[1]:"1";if($)try{const S=M(i[0]);S&&S.length>=3?e=`rgba(${A(S.slice(0,3).join(", "),$)}, ${E})`:e=i[0]}catch{e=i[0]}else e=i[0]}}}if(k(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),w(e)){const f={};for(const i in e)i!=="var"&&(f[i]=q(e[i],n,i.slice(0,1)==="@"?i.slice(1):i));return r.useVariable&&v(f,"color",n,r),f}const c=`--${r.varPrefix?r.varPrefix+"-":""}color-${n}`+(s?`-${s}`:"");let a=e.value||e;if(b(a)&&!a.includes("(")&&!a.startsWith("#")){const f=C(a);if(f&&f.name&&!f.passthrough&&!f.cssVar){const i=r.color[f.name];if(i&&!i.value&&!i.rgb&&(b(i)||k(i)||w(i))&&!y.has(f.name)){y.add(f.name);try{r.color[f.name]=q(i,f.name)}finally{y.delete(f.name)}}const g=r.color[f.name];if(g&&g.rgb){let $=g.rgb;f.tone&&($=A($,f.tone));const E=f.alpha!==void 0?parseFloat(f.alpha):g.alpha!==void 0?g.alpha:1;a=`rgba(${$}, ${E})`}}}const p=M(a),[d,o,h,l=1]=p,u=parseFloat(l.toFixed(2)),V=`${d}, ${o}, ${h}`,m=`rgba(${V}, ${u})`;return r.useVariable&&(r.cssVars[c]=m),{var:c,rgb:V,alpha:u,value:m}},Q=(e,n,s)=>{const r=D();if(w(e)&&e.value!==void 0&&e.var!==void 0)return r.useVariable&&(r.cssVars[e.var]=e.value),e;if(b(e)&&x(e)&&(e=R(e.slice(2))),k(e)&&(e={"@light":e[0],"@dark":e[1]!==void 0?e[1]:e[0]}),w(e)){const a={};for(const p in e)p!=="var"&&(a[p]=Q(e[p],n,p.slice(0,1)==="@"?p.slice(1):p));return r.useVariable&&v(a,"gradient",n,r),a}const c=`--${r.varPrefix?r.varPrefix+"-":""}gradient-${n}`+(s?`-${s}`:"");return r.useVariable&&(r.cssVars[c]=e.value||e),{var:c,value:e.value||e}};export{W as STANDARD_SCHEME_QUERIES,R as getColor,N as getMediaColor,Z as quietColorProbe,K as resolveColorRgb,v as setAdaptiveSchemeVar,q as setColor,Q as setGradient};
@@ -1 +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 O,setAdaptiveSchemeVar as S}from"./color.js";import{getSpacingByKey as g}from"./spacing.js";import{isResolvedColor as j,isCSSVar as A,splitTopLevelCommas as $,CSS_NATIVE_COLOR_REGEX as h}from"../utils/color.js";import{isObject as w,isString as p,isArray as b}from"@symbo.ls/utils";const x=(r,o,i)=>!p(r)||h.test(r)?r:$(r).map(f=>(f=f.trim(),f.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const s=O(()=>l(t,o));if(j(s))return s;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none")return t;i&&i(t);const e=g(t,"shadow");return e&&e.shadow?e.shadow:t}).join(" "))).join(", "),m=(r,o,i,f)=>{const t=C();if(b(r)){const n={"@light":m(r[0],o,"light"),"@dark":m(r[1],o,"dark")};return t.useVariable&&S(n,"shadow",o,t),n}if(w(r)){const n={};for(const c in r)n[c]=m(r[c],o,c.startsWith("@")?c.slice(1):c);return t.useVariable&&S(n,"shadow",o,t),n}p(r)&&!h.test(r)&&(r=x(r));const e=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[e]=r),{var:e,value:r}},P=(r,o)=>{const i=C();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!p(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if(A(r))return`var(${r})`;const[f]=b(r)?r:r.split(" "),s=i.shadow[f],e=w(s);if(!s)return i.verbose&&console.warn("Can't find color ",f),r;if(o){const n=s["@"+o]||s[o];if(n)return n.value!==void 0?n.value:n;i.verbose&&console.warn(r," - does not have ",o)}if(e&&s.value)return s.value;if(e){const n={};for(const c in s){if(c.charCodeAt(0)!==64)continue;const a=i.media[c.slice(1)];if(!a)continue;const V="@media "+(a==="print"?`${a}`:`screen and ${a}`),d=s[c],u=d&&(d.value!==void 0?d.value:d);u!==void 0&&(n[V]=u)}return n}return i.verbose&&console.warn("Can't find color",r),r};export{P as getShadow,x as resolveShadowValue,m as setShadow};
@@ -1,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};
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.777",
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
  }