@symbo.ls/scratch 3.14.600 → 3.14.650

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,17 @@
1
1
  # @symbo.ls/scratch
2
2
 
3
+ ## 3.14.650
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+
9
+ ## 3.14.646
10
+
11
+ ### Patch Changes
12
+
13
+ - Auto-generated cross-repo patch release.
14
+
3
15
  ## 3.14.600
4
16
 
5
17
  ### Patch Changes
@@ -1 +1 @@
1
- "use strict";var x=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var M=(t,s)=>{for(var e in s)x(t,e,{get:s[e],enumerable:!0})},k=(t,s,e,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of q(s))!G.call(t,n)&&n!==e&&x(t,n,{get:()=>s[n],enumerable:!(c=N(s,n))||c.enumerable});return t};var j=t=>k(x({},"__esModule",{value:!0}),t);var U={};M(U,{VALUE_TRANSFORMERS:()=>E,changeGlobalTheme:()=>Y,set:()=>z,setEach:()=>P,setValue:()=>D});module.exports=j(U);var p=require("./factory.js"),o=require("./system/index.js"),S=require("@symbo.ls/utils");const W=(t,s)=>{const e=(0,p.getActiveConfig)(),{cssVars:c}=e,n=s.startsWith("--")?s:`--${s}`;return c[n]=t,t},l=t=>t,E={color:o.setColor,gradient:o.setGradient,font:o.setFont,fontFamily:o.setFontFamily,fontfamily:o.setFontFamily,theme:o.setTheme,icons:o.setSvgIcon,semanticIcons:l,semanticicons:l,svg:o.setSVG,svgData:l,typography:l,shadow:o.setShadow,spacing:l,media:l,grid:l,class:l,timing:l,reset:l,unit:l,animation:l,vars:W,sizes:l},D=(t,s,e)=>{const c=(0,p.getActiveConfig)(),n=(0,p.toCamel)(t),i=n.toLowerCase(),f=c[n]||c[i]||c[t],r=E[n]||E[i];if(r)try{const d=r(s,e);return f&&(f[e]=d),f}catch(d){c.verbose&&console.warn("Error setting",i,"value",s,e,d)}c.verbose&&console.warn("Can not find",i,"method in scratch")},P=(t,s)=>{const e=(0,p.getActiveConfig)(),c=t.toLowerCase();return Object.keys(s).sort((i,f)=>{const r=(0,S.isObject)(s[i])||(0,S.isArray)(s[i])?1:0,d=(0,S.isObject)(s[f])||(0,S.isArray)(s[f])?1:0;return r-d}).forEach(i=>{try{return D(c,s[i],i)}catch(f){e.verbose&&console.warn("Error setting",c,"value",s[i],i,f)}}),e[c]||e[t]},Y=(t,s)=>{const e=s||(0,p.getActiveConfig)();e.globalTheme=t;const n=(e.document&&e.document.documentElement?e.document:null)||(typeof document<"u"?document:null),i=n&&n.defaultView||(typeof window<"u"?window:null);if(n){const r=e.themeRoot||n.documentElement;if(t&&t!=="auto")r.setAttribute("data-theme",t),t==="dark"||t==="light"?r.style.colorScheme=t:r.style.colorScheme="light dark";else if(i&&i.matchMedia){const u=g=>{r.setAttribute("data-theme",g.matches?"dark":"light")},m=i.matchMedia("(prefers-color-scheme: dark)");if(u(m),r.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=u;try{m.addEventListener("change",u)}catch{m.addListener(u)}}}else r.setAttribute("data-theme","light"),r.style.colorScheme="light"}const f=e.varPrefix?`--${e.varPrefix}-theme-`:"--theme-";for(const r in e.cssVars)r.startsWith(f)&&delete e.cssVars[r];for(const r in e.cssMediaVars)delete e.cssMediaVars[r];if(n&&e.cssVars){const r=e.scopeSelector||":root",d=n.styleSheets;for(let u=0;u<d.length;u++)try{const m=d[u].cssRules;for(let g=0;g<m.length;g++)if(m[g].selectorText===r){for(const v in e.cssVars)m[g].style.setProperty(v,e.cssVars[v]);return e}}catch{}}return e},$={},z=(t,s=$)=>{let e=s.config||(0,p.getActiveConfig)();const{version:c,verbose:n,useVariable:i,useReset:f,useSvgSprite:r,useFontImport:d,useIconSprite:u,globalTheme:m,themeRoot:g,useDocumentTheme:v,useDefaultConfig:I,semanticIcons:R,files:A,assets:F,...b}=t;s.newConfig&&(e=(0,p.setActiveConfig)(s.newConfig)),A!==void 0&&(e.files=A),F!==void 0&&(e.assets=F),n!==void 0&&(e.verbose=n),i!==void 0&&(e.useVariable=i),f!==void 0&&(e.useReset=f),d!==void 0&&(e.useFontImport=d),r!==void 0&&(e.useSvgSprite=r),u!==void 0&&(e.useIconSprite=u),v!==void 0&&(e.useDocumentTheme=v),m!==void 0&&(e.globalTheme=m),g!==void 0&&(e.themeRoot=g),t.useThemeSuffixedVars!==void 0&&(e.useThemeSuffixedVars=t.useThemeSuffixedVars),I!==void 0&&(e.useDefaultConfig=I),R!==void 0&&(e.semanticIcons=R),e.verbose&&console.log(e);const C=(e.document&&e.document.documentElement?e.document:null)||(typeof document<"u"?document:null),w=C&&C.defaultView||(typeof window<"u"?window:null),y=C&&(e.themeRoot||C.documentElement);if(y&&typeof y.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")y.setAttribute("data-theme",e.globalTheme),e.globalTheme==="dark"||e.globalTheme==="light"?y.style.colorScheme=e.globalTheme:y.style.colorScheme="light dark";else if(w&&w.matchMedia){const h=O=>{y.setAttribute("data-theme",O.matches?"dark":"light")},V=w.matchMedia("(prefers-color-scheme: dark)");if(h(V),y.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=h;try{V.addEventListener("change",h)}catch{V.addListener(h)}}}else y.setAttribute("data-theme","light"),y.style.colorScheme="light";e.__svgCache||(e.__svgCache={});const T=Object.keys(b),_=new Set(T);if(T.forEach(a=>{const h=a.toLowerCase();h!==a&&_.has(h)&&(0,S.deepMerge)(b[h],b[a])}),T.map(a=>{const h=a.toLowerCase();if(!(h!==a&&_.has(h)))return P(a,b[a])}),e.varPrefix&&(e.typography&&(e.typography.varPrefix=e.varPrefix),e.spacing&&(e.spacing.varPrefix=e.varPrefix),e.timing&&(e.timing.varPrefix=e.varPrefix)),b.typography)try{(0,o.applyTypographySequence)()}catch(a){e.verbose&&console.warn("Error applying typography sequence",a)}if(b.spacing)try{(0,o.applySpacingSequence)()}catch(a){e.verbose&&console.warn("Error applying spacing sequence",a)}if(b.timing)try{(0,o.applyTimingSequence)()}catch(a){e.verbose&&console.warn("Error applying timing sequence",a)}(0,o.applyDocument)();const L=(0,o.applyReset)();return L&&(e.reset=L),e};
1
+ "use strict";var x=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var k=(t,s)=>{for(var e in s)x(t,e,{get:s[e],enumerable:!0})},j=(t,s,e,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of q(s))!G.call(t,n)&&n!==e&&x(t,n,{get:()=>s[n],enumerable:!(c=N(s,n))||c.enumerable});return t};var W=t=>j(x({},"__esModule",{value:!0}),t);var B={};k(B,{VALUE_TRANSFORMERS:()=>E,changeGlobalTheme:()=>$,set:()=>U,setEach:()=>M,setValue:()=>P});module.exports=W(B);var p=require("./factory.js"),o=require("./system/index.js"),S=require("@symbo.ls/utils");const Y=(t,s)=>{const e=(0,p.getActiveConfig)(),{cssVars:c}=e,n=s.startsWith("--")?s:`--${s}`;return c[n]=t,t},l=t=>t,E={color:o.setColor,gradient:o.setGradient,font:o.setFont,fontFamily:o.setFontFamily,fontfamily:o.setFontFamily,theme:o.setTheme,icons:o.setSvgIcon,semanticIcons:l,semanticicons:l,svg:o.setSVG,svgData:l,typography:l,shadow:o.setShadow,spacing:l,media:l,grid:l,class:l,timing:l,reset:l,unit:l,animation:l,vars:Y,sizes:l},P=(t,s,e)=>{const c=(0,p.getActiveConfig)(),n=(0,p.toCamel)(t),i=n.toLowerCase(),f=c[n]||c[i]||c[t],r=E[n]||E[i];if(r)try{const d=r(s,e);return f&&(f[e]=d),f}catch(d){c.verbose&&console.warn("Error setting",i,"value",s,e,d)}c.verbose&&console.warn("Can not find",i,"method in scratch")},M=(t,s)=>{const e=(0,p.getActiveConfig)(),c=t.toLowerCase();return Object.keys(s).sort((i,f)=>{const r=(0,S.isObject)(s[i])||(0,S.isArray)(s[i])?1:0,d=(0,S.isObject)(s[f])||(0,S.isArray)(s[f])?1:0;return r-d}).forEach(i=>{try{return P(c,s[i],i)}catch(f){e.verbose&&console.warn("Error setting",c,"value",s[i],i,f)}}),e[c]||e[t]},$=(t,s)=>{const e=s||(0,p.getActiveConfig)();e.globalTheme=t;const n=(e.document&&e.document.documentElement?e.document:null)||(typeof document<"u"?document:null),i=n&&n.defaultView||(typeof window<"u"?window:null);if(n){const r=e.themeRoot||n.documentElement;if(t&&t!=="auto")r.setAttribute("data-theme",t),t==="dark"||t==="light"?r.style.colorScheme=t:r.style.colorScheme="light dark";else if(i&&i.matchMedia){const u=g=>{r.setAttribute("data-theme",g.matches?"dark":"light")},m=i.matchMedia("(prefers-color-scheme: dark)");if(u(m),r.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=u;try{m.addEventListener("change",u)}catch{m.addListener(u)}}}else r.setAttribute("data-theme","light"),r.style.colorScheme="light"}const f=e.varPrefix?`--${e.varPrefix}-theme-`:"--theme-";for(const r in e.cssVars)r.startsWith(f)&&delete e.cssVars[r];for(const r in e.cssMediaVars)delete e.cssMediaVars[r];if(n&&e.cssVars){const r=e.scopeSelector||":root",d=n.styleSheets;for(let u=0;u<d.length;u++)try{const m=d[u].cssRules;for(let g=0;g<m.length;g++)if(m[g].selectorText===r){for(const b in e.cssVars)m[g].style.setProperty(b,e.cssVars[b]);return e}}catch{}}return e},z={},U=(t,s=z)=>{let e=s.config||(0,p.getActiveConfig)();const{version:c,verbose:n,useVariable:i,useReset:f,useSvgSprite:r,useFontImport:d,useIconSprite:u,globalTheme:m,themeRoot:g,useDocumentTheme:b,useDefaultConfig:I,semanticIcons:R,hoverMedia:A,files:F,assets:_,...v}=t;s.newConfig&&(e=(0,p.setActiveConfig)(s.newConfig)),F!==void 0&&(e.files=F),_!==void 0&&(e.assets=_),n!==void 0&&(e.verbose=n),i!==void 0&&(e.useVariable=i),f!==void 0&&(e.useReset=f),d!==void 0&&(e.useFontImport=d),r!==void 0&&(e.useSvgSprite=r),u!==void 0&&(e.useIconSprite=u),b!==void 0&&(e.useDocumentTheme=b),m!==void 0&&(e.globalTheme=m),g!==void 0&&(e.themeRoot=g),t.useThemeSuffixedVars!==void 0&&(e.useThemeSuffixedVars=t.useThemeSuffixedVars),I!==void 0&&(e.useDefaultConfig=I),R!==void 0&&(e.semanticIcons=R),A!==void 0&&(e.hoverMedia=A),e.verbose&&console.log(e);const C=(e.document&&e.document.documentElement?e.document:null)||(typeof document<"u"?document:null),w=C&&C.defaultView||(typeof window<"u"?window:null),y=C&&(e.themeRoot||C.documentElement);if(y&&typeof y.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")y.setAttribute("data-theme",e.globalTheme),e.globalTheme==="dark"||e.globalTheme==="light"?y.style.colorScheme=e.globalTheme:y.style.colorScheme="light dark";else if(w&&w.matchMedia){const h=D=>{y.setAttribute("data-theme",D.matches?"dark":"light")},V=w.matchMedia("(prefers-color-scheme: dark)");if(h(V),y.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=h;try{V.addEventListener("change",h)}catch{V.addListener(h)}}}else y.setAttribute("data-theme","light"),y.style.colorScheme="light";e.__svgCache||(e.__svgCache={});const T=Object.keys(v),L=new Set(T);if(T.forEach(a=>{const h=a.toLowerCase();h!==a&&L.has(h)&&(0,S.deepMerge)(v[h],v[a])}),T.map(a=>{const h=a.toLowerCase();if(!(h!==a&&L.has(h)))return M(a,v[a])}),e.varPrefix&&(e.typography&&(e.typography.varPrefix=e.varPrefix),e.spacing&&(e.spacing.varPrefix=e.varPrefix),e.timing&&(e.timing.varPrefix=e.varPrefix)),v.typography)try{(0,o.applyTypographySequence)()}catch(a){e.verbose&&console.warn("Error applying typography sequence",a)}if(v.spacing)try{(0,o.applySpacingSequence)()}catch(a){e.verbose&&console.warn("Error applying spacing sequence",a)}if(v.timing)try{(0,o.applyTimingSequence)()}catch(a){e.verbose&&console.warn("Error applying timing sequence",a)}(0,o.applyDocument)();const O=(0,o.applyReset)();return O&&(e.reset=O),e};
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},B=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of f(t))!q.call(e,c)&&c!==n&&p(e,c,{get:()=>t[c],enumerable:!(s=I(t,c))||s.enumerable});return e};var C=e=>B(p({},"__esModule",{value:!0}),e);var M={};G(M,{applySpacingSequence:()=>A,checkIfBoxSize:()=>y,getSpacingBasedOnRatio:()=>N,getSpacingByKey:()=>h,splitSpacedValue:()=>F});module.exports=C(M);var m=require("@symbo.ls/utils"),u=require("@symbo.ls/utils"),g=require("../factory.js"),o=require("../utils/index.js");const b=e=>{const n=(0,g.getActiveConfig)().spacing||{},s=parseFloat(e.spacingRatio),c={...n,ratio:Number.isFinite(s)?s:n.ratio,sequence:{},scales:{}};return(0,o.generateSequence)(c),c},k=e=>{for(const t in e){const n=e[t];if(!(t.slice(0,1)==="@"))continue;const{type:c,base:r,ratio:i,range:a,subSequence:S,h1Matches:l,unit:d}=e;(0,u.merge)(n,{type:c,base:r,ratio:i,range:a,subSequence:S,h1Matches:l,unit:d,sequence:{},scales:{},templates:{},vars:{}}),(0,o.generateSequence)(n),(0,o.applyMediaSequenceVars)(e,t)}},y=e=>{const t=e.toLowerCase(),n=t.includes("width")||t.includes("height"),s=t.includes("border")||t.includes("outline");return n&&!s},A=()=>{const e=(0,g.getActiveConfig)(),{spacing:t}=e;(0,o.generateSequence)(t),(0,o.applySequenceVars)(t),k(t)},V=e=>{const t=(0,g.getActiveConfig)(),{spacing:n}=t;return!e||!e.sequence?n:Object.keys(e.sequence).length>0?e:(0,o.generateSequence)(e)},h=(e,t="padding",n,s)=>{const c=V(n);if((0,u.isString)(e)){if(/^(?:env|var)\(/.test(e.trim()))return{[t]:e};if(!s&&e.includes("(")){const i=(0,o.getFnPrefixAndValue)(e);s=i[0],e=i[1]}}const r=s?[e]:(0,m.arrayzeValue)(e);if((0,u.isArray)(r)){if(r.length>1){let i="";t==="borderWidth"&&(t="border",i="Width");const a={2:["Block","Inline"],3:["BlockStart","Inline","BlockEnd"],4:["BlockStart","InlineEnd","BlockEnd","InlineStart"]},S=(l,d)=>(0,o.getSequenceValuePropertyPair)(r[d],t+l+i,c,s);return a[r.length].map((l,d)=>S(l,d))}return(0,o.getSequenceValuePropertyPair)(e,t,c,s)}},N=(e,t,n,s)=>{const c=(0,g.getActiveConfig)(),{spacing:r}=c;let i=n||e[t];if((0,u.isString)(i)&&/^(?:env|var)\(/.test(i.trim()))return{[t]:i};if(!s&&(0,u.isString)(i)&&i.includes("(")){const a=(0,o.getFnPrefixAndValue)(i);s=a[0],i=a[1]}if(e.spacingRatio){const a=b(e);return h(i,t,a,s)}return h(i,t,r,s)},F=e=>{const t=n=>{const s=["+","-","*","/"].includes(n),c=o.CSS_UNITS.some(i=>e.includes(i));return s||c?n:n.length<3&&/[A-Z]/.test(n)?n+"_default":n};return e.split(",").map(n=>n.trim()).map(t).join(",").split(" ").map(t).join(" ")};
1
+ "use strict";var p=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var B=(t,e)=>{for(var n in e)p(t,n,{get:e[n],enumerable:!0})},C=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of q(e))!G.call(t,i)&&i!==n&&p(t,i,{get:()=>e[i],enumerable:!(s=I(e,i))||s.enumerable});return t};var f=t=>C(p({},"__esModule",{value:!0}),t);var M={};B(M,{applySpacingSequence:()=>A,checkIfBoxSize:()=>y,getSpacingBasedOnRatio:()=>N,getSpacingByKey:()=>h,splitSpacedValue:()=>F});module.exports=f(M);var m=require("@symbo.ls/utils"),u=require("@symbo.ls/utils"),g=require("../factory.js"),o=require("../utils/index.js");const b=t=>{const n=(0,g.getActiveConfig)().spacing||{},s=parseFloat(t.spacingRatio),i={...n,ratio:Number.isFinite(s)?s:n.ratio,sequence:{},scales:{}};return(0,o.generateSequence)(i),i},k=t=>{for(const e in t){const n=t[e];if(!(e.slice(0,1)==="@"))continue;const{type:i,base:r,ratio:c,range:a,subSequence:S,h1Matches:l,unit:d}=t;(0,u.merge)(n,{type:i,base:r,ratio:c,range:a,subSequence:S,h1Matches:l,unit:d,sequence:{},scales:{},templates:{},vars:{}}),(0,o.generateSequence)(n),(0,o.applyMediaSequenceVars)(t,e)}},y=t=>{const e=t.toLowerCase(),n=e.includes("width")||e.includes("height"),s=e.includes("border")||e.includes("outline");return n&&!s},A=()=>{const t=(0,g.getActiveConfig)(),{spacing:e}=t;(0,o.generateSequence)(e),(0,o.applySequenceVars)(e),k(e)},V=t=>{const e=(0,g.getActiveConfig)(),{spacing:n}=e;return!t||!t.sequence?n:Object.keys(t.sequence).length>0?t:(0,o.generateSequence)(t)},h=(t,e="padding",n,s)=>{const i=V(n);if((0,u.isString)(t)){if(!s&&/^(?:env|var)\(/.test(t.trim()))return{[e]:t};if(!s&&t.includes("(")){const c=(0,o.getFnPrefixAndValue)(t);s=c[0],t=c[1]}}const r=s?[t]:(0,m.arrayzeValue)(t);if((0,u.isArray)(r)){if(r.length>1){let c="";e==="borderWidth"&&(e="border",c="Width");const a={2:["Block","Inline"],3:["BlockStart","Inline","BlockEnd"],4:["BlockStart","InlineEnd","BlockEnd","InlineStart"]},S=(l,d)=>(0,o.getSequenceValuePropertyPair)(r[d],e+l+c,i,s);return a[r.length].map((l,d)=>S(l,d))}return(0,o.getSequenceValuePropertyPair)(t,e,i,s)}},N=(t,e,n,s)=>{const i=(0,g.getActiveConfig)(),{spacing:r}=i;let c=n||t[e];if(!s&&(0,u.isString)(c)&&/^(?:env|var)\(/.test(c.trim()))return{[e]:c};if(!s&&(0,u.isString)(c)&&c.includes("(")){const a=(0,o.getFnPrefixAndValue)(c);s=a[0],c=a[1]}if(t.spacingRatio){const a=b(t);return h(c,e,a,s)}return h(c,e,r,s)},F=t=>{const e=n=>{const s=["+","-","*","/"].includes(n),i=o.CSS_UNITS.some(c=>t.includes(c));return s||i?n:n.length<3&&/[A-Z]/.test(n)?n+"_default":n};return t.split(",").map(n=>n.trim()).map(e).join(",").split(" ").map(e).join(" ")};
@@ -1 +1 @@
1
- import{getActiveConfig as S,setActiveConfig as D,toCamel as P}from"./factory.js";import{setColor as N,setGradient as q,setFont as G,setFontFamily as F,setTheme as M,setSvgIcon as k,setSVG as j,applyTypographySequence as W,applySpacingSequence as Y,applyReset as $,applyTimingSequence as z,applyDocument as U,setShadow as B}from"./system/index.js";import{deepMerge as H,isObject as _,isArray as L}from"@symbo.ls/utils";const J=(t,o)=>{const e=S(),{cssVars:c}=e,r=o.startsWith("--")?o:`--${o}`;return c[r]=t,t},f=t=>t,O={color:N,gradient:q,font:G,fontFamily:F,fontfamily:F,theme:M,icons:k,semanticIcons:f,semanticicons:f,svg:j,svgData:f,typography:f,shadow:B,spacing:f,media:f,grid:f,class:f,timing:f,reset:f,unit:f,animation:f,vars:J,sizes:f},K=(t,o,e)=>{const c=S(),r=P(t),n=r.toLowerCase(),a=c[r]||c[n]||c[t],s=O[r]||O[n];if(s)try{const l=s(o,e);return a&&(a[e]=l),a}catch(l){c.verbose&&console.warn("Error setting",n,"value",o,e,l)}c.verbose&&console.warn("Can not find",n,"method in scratch")},Q=(t,o)=>{const e=S(),c=t.toLowerCase();return Object.keys(o).sort((n,a)=>{const s=_(o[n])||L(o[n])?1:0,l=_(o[a])||L(o[a])?1:0;return s-l}).forEach(n=>{try{return K(c,o[n],n)}catch(a){e.verbose&&console.warn("Error setting",c,"value",o[n],n,a)}}),e[c]||e[t]},ne=(t,o)=>{const e=o||S();e.globalTheme=t;const r=(e.document&&e.document.documentElement?e.document:null)||(typeof document<"u"?document:null),n=r&&r.defaultView||(typeof window<"u"?window:null);if(r){const s=e.themeRoot||r.documentElement;if(t&&t!=="auto")s.setAttribute("data-theme",t),t==="dark"||t==="light"?s.style.colorScheme=t:s.style.colorScheme="light dark";else if(n&&n.matchMedia){const d=h=>{s.setAttribute("data-theme",h.matches?"dark":"light")},u=n.matchMedia("(prefers-color-scheme: dark)");if(d(u),s.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=d;try{u.addEventListener("change",d)}catch{u.addListener(d)}}}else s.setAttribute("data-theme","light"),s.style.colorScheme="light"}const a=e.varPrefix?`--${e.varPrefix}-theme-`:"--theme-";for(const s in e.cssVars)s.startsWith(a)&&delete e.cssVars[s];for(const s in e.cssMediaVars)delete e.cssMediaVars[s];if(r&&e.cssVars){const s=e.scopeSelector||":root",l=r.styleSheets;for(let d=0;d<l.length;d++)try{const u=l[d].cssRules;for(let h=0;h<u.length;h++)if(u[h].selectorText===s){for(const y in e.cssVars)u[h].style.setProperty(y,e.cssVars[y]);return e}}catch{}}return e},X={},re=(t,o=X)=>{let e=o.config||S();const{version:c,verbose:r,useVariable:n,useReset:a,useSvgSprite:s,useFontImport:l,useIconSprite:d,globalTheme:u,themeRoot:h,useDocumentTheme:y,useDefaultConfig:T,semanticIcons:V,files:x,assets:E,...p}=t;o.newConfig&&(e=D(o.newConfig)),x!==void 0&&(e.files=x),E!==void 0&&(e.assets=E),r!==void 0&&(e.verbose=r),n!==void 0&&(e.useVariable=n),a!==void 0&&(e.useReset=a),l!==void 0&&(e.useFontImport=l),s!==void 0&&(e.useSvgSprite=s),d!==void 0&&(e.useIconSprite=d),y!==void 0&&(e.useDocumentTheme=y),u!==void 0&&(e.globalTheme=u),h!==void 0&&(e.themeRoot=h),t.useThemeSuffixedVars!==void 0&&(e.useThemeSuffixedVars=t.useThemeSuffixedVars),T!==void 0&&(e.useDefaultConfig=T),V!==void 0&&(e.semanticIcons=V),e.verbose&&console.log(e);const b=(e.document&&e.document.documentElement?e.document:null)||(typeof document<"u"?document:null),v=b&&b.defaultView||(typeof window<"u"?window:null),g=b&&(e.themeRoot||b.documentElement);if(g&&typeof g.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")g.setAttribute("data-theme",e.globalTheme),e.globalTheme==="dark"||e.globalTheme==="light"?g.style.colorScheme=e.globalTheme:g.style.colorScheme="light dark";else if(v&&v.matchMedia){const m=A=>{g.setAttribute("data-theme",A.matches?"dark":"light")},w=v.matchMedia("(prefers-color-scheme: dark)");if(m(w),g.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=m;try{w.addEventListener("change",m)}catch{w.addListener(m)}}}else g.setAttribute("data-theme","light"),g.style.colorScheme="light";e.__svgCache||(e.__svgCache={});const C=Object.keys(p),I=new Set(C);if(C.forEach(i=>{const m=i.toLowerCase();m!==i&&I.has(m)&&H(p[m],p[i])}),C.map(i=>{const m=i.toLowerCase();if(!(m!==i&&I.has(m)))return Q(i,p[i])}),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{W()}catch(i){e.verbose&&console.warn("Error applying typography sequence",i)}if(p.spacing)try{Y()}catch(i){e.verbose&&console.warn("Error applying spacing sequence",i)}if(p.timing)try{z()}catch(i){e.verbose&&console.warn("Error applying timing sequence",i)}U();const R=$();return R&&(e.reset=R),e};export{O as VALUE_TRANSFORMERS,ne as changeGlobalTheme,re as set,Q as setEach,K as setValue};
1
+ import{getActiveConfig as S,setActiveConfig as P,toCamel as M}from"./factory.js";import{setColor as N,setGradient as q,setFont as G,setFontFamily as _,setTheme as k,setSvgIcon as j,setSVG as W,applyTypographySequence as Y,applySpacingSequence as $,applyReset as z,applyTimingSequence as U,applyDocument as B,setShadow as H}from"./system/index.js";import{deepMerge as J,isObject as L,isArray as O}from"@symbo.ls/utils";const K=(t,o)=>{const e=S(),{cssVars:c}=e,r=o.startsWith("--")?o:`--${o}`;return c[r]=t,t},f=t=>t,D={color:N,gradient:q,font:G,fontFamily:_,fontfamily:_,theme:k,icons:j,semanticIcons:f,semanticicons:f,svg:W,svgData:f,typography:f,shadow:H,spacing:f,media:f,grid:f,class:f,timing:f,reset:f,unit:f,animation:f,vars:K,sizes:f},Q=(t,o,e)=>{const c=S(),r=M(t),n=r.toLowerCase(),a=c[r]||c[n]||c[t],s=D[r]||D[n];if(s)try{const l=s(o,e);return a&&(a[e]=l),a}catch(l){c.verbose&&console.warn("Error setting",n,"value",o,e,l)}c.verbose&&console.warn("Can not find",n,"method in scratch")},X=(t,o)=>{const e=S(),c=t.toLowerCase();return Object.keys(o).sort((n,a)=>{const s=L(o[n])||O(o[n])?1:0,l=L(o[a])||O(o[a])?1:0;return s-l}).forEach(n=>{try{return Q(c,o[n],n)}catch(a){e.verbose&&console.warn("Error setting",c,"value",o[n],n,a)}}),e[c]||e[t]},re=(t,o)=>{const e=o||S();e.globalTheme=t;const r=(e.document&&e.document.documentElement?e.document:null)||(typeof document<"u"?document:null),n=r&&r.defaultView||(typeof window<"u"?window:null);if(r){const s=e.themeRoot||r.documentElement;if(t&&t!=="auto")s.setAttribute("data-theme",t),t==="dark"||t==="light"?s.style.colorScheme=t:s.style.colorScheme="light dark";else if(n&&n.matchMedia){const d=h=>{s.setAttribute("data-theme",h.matches?"dark":"light")},u=n.matchMedia("(prefers-color-scheme: dark)");if(d(u),s.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=d;try{u.addEventListener("change",d)}catch{u.addListener(d)}}}else s.setAttribute("data-theme","light"),s.style.colorScheme="light"}const a=e.varPrefix?`--${e.varPrefix}-theme-`:"--theme-";for(const s in e.cssVars)s.startsWith(a)&&delete e.cssVars[s];for(const s in e.cssMediaVars)delete e.cssMediaVars[s];if(r&&e.cssVars){const s=e.scopeSelector||":root",l=r.styleSheets;for(let d=0;d<l.length;d++)try{const u=l[d].cssRules;for(let h=0;h<u.length;h++)if(u[h].selectorText===s){for(const y in e.cssVars)u[h].style.setProperty(y,e.cssVars[y]);return e}}catch{}}return e},Z={},ie=(t,o=Z)=>{let e=o.config||S();const{version:c,verbose:r,useVariable:n,useReset:a,useSvgSprite:s,useFontImport:l,useIconSprite:d,globalTheme:u,themeRoot:h,useDocumentTheme:y,useDefaultConfig:T,semanticIcons:V,hoverMedia:x,files:E,assets:I,...p}=t;o.newConfig&&(e=P(o.newConfig)),E!==void 0&&(e.files=E),I!==void 0&&(e.assets=I),r!==void 0&&(e.verbose=r),n!==void 0&&(e.useVariable=n),a!==void 0&&(e.useReset=a),l!==void 0&&(e.useFontImport=l),s!==void 0&&(e.useSvgSprite=s),d!==void 0&&(e.useIconSprite=d),y!==void 0&&(e.useDocumentTheme=y),u!==void 0&&(e.globalTheme=u),h!==void 0&&(e.themeRoot=h),t.useThemeSuffixedVars!==void 0&&(e.useThemeSuffixedVars=t.useThemeSuffixedVars),T!==void 0&&(e.useDefaultConfig=T),V!==void 0&&(e.semanticIcons=V),x!==void 0&&(e.hoverMedia=x),e.verbose&&console.log(e);const v=(e.document&&e.document.documentElement?e.document:null)||(typeof document<"u"?document:null),b=v&&v.defaultView||(typeof window<"u"?window:null),g=v&&(e.themeRoot||v.documentElement);if(g&&typeof g.setAttribute=="function")if(e.globalTheme&&e.globalTheme!=="auto")g.setAttribute("data-theme",e.globalTheme),e.globalTheme==="dark"||e.globalTheme==="light"?g.style.colorScheme=e.globalTheme:g.style.colorScheme="light dark";else if(b&&b.matchMedia){const m=F=>{g.setAttribute("data-theme",F.matches?"dark":"light")},w=b.matchMedia("(prefers-color-scheme: dark)");if(m(w),g.style.colorScheme="light dark",!e.__prefersListener){e.__prefersListener=m;try{w.addEventListener("change",m)}catch{w.addListener(m)}}}else g.setAttribute("data-theme","light"),g.style.colorScheme="light";e.__svgCache||(e.__svgCache={});const C=Object.keys(p),R=new Set(C);if(C.forEach(i=>{const m=i.toLowerCase();m!==i&&R.has(m)&&J(p[m],p[i])}),C.map(i=>{const m=i.toLowerCase();if(!(m!==i&&R.has(m)))return X(i,p[i])}),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{Y()}catch(i){e.verbose&&console.warn("Error applying typography sequence",i)}if(p.spacing)try{$()}catch(i){e.verbose&&console.warn("Error applying spacing sequence",i)}if(p.timing)try{U()}catch(i){e.verbose&&console.warn("Error applying timing sequence",i)}B();const A=z();return A&&(e.reset=A),e};export{D as VALUE_TRANSFORMERS,re as changeGlobalTheme,ie as set,X as setEach,Q as setValue};
@@ -1 +1 @@
1
- import{arrayzeValue as I}from"@symbo.ls/utils";import{isArray as f,isString as S,merge as q}from"@symbo.ls/utils";import{getActiveConfig as l}from"../factory.js";import{CSS_UNITS as G,applyMediaSequenceVars as B,applySequenceVars as C,generateSequence as d,getFnPrefixAndValue as p,getSequenceValuePropertyPair as h}from"../utils/index.js";const b=e=>{const n=l().spacing||{},s=parseFloat(e.spacingRatio),c={...n,ratio:Number.isFinite(s)?s:n.ratio,sequence:{},scales:{}};return d(c),c},k=e=>{for(const t in e){const n=e[t];if(!(t.slice(0,1)==="@"))continue;const{type:c,base:o,ratio:i,range:r,subSequence:g,h1Matches:a,unit:u}=e;q(n,{type:c,base:o,ratio:i,range:r,subSequence:g,h1Matches:a,unit:u,sequence:{},scales:{},templates:{},vars:{}}),d(n),B(e,t)}},M=e=>{const t=e.toLowerCase(),n=t.includes("width")||t.includes("height"),s=t.includes("border")||t.includes("outline");return n&&!s},O=()=>{const e=l(),{spacing:t}=e;d(t),C(t),k(t)},y=e=>{const t=l(),{spacing:n}=t;return!e||!e.sequence?n:Object.keys(e.sequence).length>0?e:d(e)},m=(e,t="padding",n,s)=>{const c=y(n);if(S(e)){if(/^(?:env|var)\(/.test(e.trim()))return{[t]:e};if(!s&&e.includes("(")){const i=p(e);s=i[0],e=i[1]}}const o=s?[e]:I(e);if(f(o)){if(o.length>1){let i="";t==="borderWidth"&&(t="border",i="Width");const r={2:["Block","Inline"],3:["BlockStart","Inline","BlockEnd"],4:["BlockStart","InlineEnd","BlockEnd","InlineStart"]},g=(a,u)=>h(o[u],t+a+i,c,s);return r[o.length].map((a,u)=>g(a,u))}return h(e,t,c,s)}},j=(e,t,n,s)=>{const c=l(),{spacing:o}=c;let i=n||e[t];if(S(i)&&/^(?:env|var)\(/.test(i.trim()))return{[t]:i};if(!s&&S(i)&&i.includes("(")){const r=p(i);s=r[0],i=r[1]}if(e.spacingRatio){const r=b(e);return m(i,t,r,s)}return m(i,t,o,s)},w=e=>{const t=n=>{const s=["+","-","*","/"].includes(n),c=G.some(i=>e.includes(i));return s||c?n:n.length<3&&/[A-Z]/.test(n)?n+"_default":n};return e.split(",").map(n=>n.trim()).map(t).join(",").split(" ").map(t).join(" ")};export{O as applySpacingSequence,M as checkIfBoxSize,j as getSpacingBasedOnRatio,m as getSpacingByKey,w as splitSpacedValue};
1
+ import{arrayzeValue as I}from"@symbo.ls/utils";import{isArray as q,isString as S,merge as G}from"@symbo.ls/utils";import{getActiveConfig as l}from"../factory.js";import{CSS_UNITS as B,applyMediaSequenceVars as C,applySequenceVars as f,generateSequence as d,getFnPrefixAndValue as p,getSequenceValuePropertyPair as h}from"../utils/index.js";const b=t=>{const n=l().spacing||{},s=parseFloat(t.spacingRatio),i={...n,ratio:Number.isFinite(s)?s:n.ratio,sequence:{},scales:{}};return d(i),i},k=t=>{for(const e in t){const n=t[e];if(!(e.slice(0,1)==="@"))continue;const{type:i,base:o,ratio:c,range:r,subSequence:g,h1Matches:a,unit:u}=t;G(n,{type:i,base:o,ratio:c,range:r,subSequence:g,h1Matches:a,unit:u,sequence:{},scales:{},templates:{},vars:{}}),d(n),C(t,e)}},M=t=>{const e=t.toLowerCase(),n=e.includes("width")||e.includes("height"),s=e.includes("border")||e.includes("outline");return n&&!s},O=()=>{const t=l(),{spacing:e}=t;d(e),f(e),k(e)},y=t=>{const e=l(),{spacing:n}=e;return!t||!t.sequence?n:Object.keys(t.sequence).length>0?t:d(t)},m=(t,e="padding",n,s)=>{const i=y(n);if(S(t)){if(!s&&/^(?:env|var)\(/.test(t.trim()))return{[e]:t};if(!s&&t.includes("(")){const c=p(t);s=c[0],t=c[1]}}const o=s?[t]:I(t);if(q(o)){if(o.length>1){let c="";e==="borderWidth"&&(e="border",c="Width");const r={2:["Block","Inline"],3:["BlockStart","Inline","BlockEnd"],4:["BlockStart","InlineEnd","BlockEnd","InlineStart"]},g=(a,u)=>h(o[u],e+a+c,i,s);return r[o.length].map((a,u)=>g(a,u))}return h(t,e,i,s)}},j=(t,e,n,s)=>{const i=l(),{spacing:o}=i;let c=n||t[e];if(!s&&S(c)&&/^(?:env|var)\(/.test(c.trim()))return{[e]:c};if(!s&&S(c)&&c.includes("(")){const r=p(c);s=r[0],c=r[1]}if(t.spacingRatio){const r=b(t);return m(c,e,r,s)}return m(c,e,o,s)},w=t=>{const e=n=>{const s=["+","-","*","/"].includes(n),i=B.some(c=>t.includes(c));return s||i?n:n.length<3&&/[A-Z]/.test(n)?n+"_default":n};return t.split(",").map(n=>n.trim()).map(e).join(",").split(" ").map(e).join(" ")};export{O as applySpacingSequence,M as checkIfBoxSize,j as getSpacingBasedOnRatio,m as getSpacingByKey,w as splitSpacedValue};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/scratch",
3
3
  "description": "Φ / CSS framework and methodology.",
4
4
  "author": "symbo.ls",
5
- "version": "3.14.600",
5
+ "version": "3.14.650",
6
6
  "files": [
7
7
  "dist",
8
8
  "*.js",