@styleframe/core 2.2.0 → 2.4.0
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 +12 -0
- package/dist/styleframe.d.ts +259 -15
- package/dist/styleframe.js +494 -328
- package/dist/styleframe.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/styleframe.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(a,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(a=typeof globalThis<"u"?globalThis:a||self,p(a.styleframe={}))})(this,(function(a){"use strict";function p(e,r){return function(t,...i){return{type:"css",value:t.reduce((c,u,o)=>(c.push(u),o<i.length&&c.push(i[o]),c),[])}}}function M(e){return typeof e=="object"&&e!==null}function h(e,r){return M(e)&&"type"in e&&e.type===r}function v(e){return h(e,"variable")}function O(e){return h(e,"reference")}function Z(e){return h(e,"selector")}function x(e){return h(e,"at-rule")}function ee(e){return h(e,"utility")}function te(e){return h(e,"modifier")}function C(e){return h(e,"css")}function ne(e){return h(e,"theme")}function w(e){return h(e,"root")}function S(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null}function V(e){return S(e)||O(e)||C(e)||Array.isArray(e)&&e.every(V)}function B(e){return M(e)&&"children"in e&&"declarations"in e&&"variables"in e}function R(e,r){return function(t,i,s){const c={type:"at-rule",identifier:t,rule:i,declarations:{},variables:[],children:[]},u=g(c,r);return typeof s=="function"?c.declarations=s(u)??{}:s&&(c.declarations=s),j(c.declarations,u),e.children.push(c),c}}function _(e,r){const n=R(e,r);return function(i,s){return n("media",i,s)}}function P(e,r){const n=R(e,r);return function(i,s){return n("keyframes",i,s)}}function U(e,r){return function(t,i){return v(t)?{type:"reference",name:t.name,fallback:i}:{type:"reference",name:t,fallback:i}}}function D(e,r){return function(t,i){const s={type:"selector",query:t,declarations:{},variables:[],children:[]},c=g(s,r);return typeof i=="function"?s.declarations=i(c)??{}:B(i)?(s.variables=i.variables,s.declarations=i.declarations,s.children=i.children):s.declarations=i,j(s.declarations,c),e.children.push(s),s}}function E(e,r){return function(t,i,s={default:!1}){const c=typeof t=="string"?t:t.name,u=e.variables.find(f=>f.name===c);if(s.default&&u)return u;if(u)return u.value=i,u;const o={type:"variable",name:c,value:i};return e.variables.push(o),o}}function g(e,r){const n=E(e),t=D(e,r),i=R(e,r),s=P(r,r),c=_(e,r),u=U(),o=p();return{variable:n,selector:t,keyframes:s,atRule:i,media:c,ref:u,css:o}}function j(e,r){for(const n in e)if(n.startsWith("@")){const t=e[n];if(typeof t=="object"&&t!==null&&!V(t)){const i=n.replace(/^@(\w+).*/,"$1"),s=n.replace(`@${i}`,"").trim();r.atRule(i,s,t),delete e[n]}}else if(/^[.&:]/.test(n)){const t=e[n];typeof t=="object"&&(r.selector(n,t),delete e[n])}return e}function re(e){return e.charAt(0).toUpperCase()+e.slice(1)}function A(e){if(e instanceof Buffer)return Buffer.from(e);const r=e.constructor;return new r(e.buffer.slice(0),e.byteOffset,e.byteLength/e.BYTES_PER_ELEMENT||1)}function K(e){if(e=e||{},e.circular)return ie(e);const r=new Map;if(r.set(Date,c=>new Date(c)),r.set(Map,(c,u)=>new Map(t(Array.from(c),u))),r.set(Set,(c,u)=>new Set(t(Array.from(c),u))),e.constructorHandlers)for(const c of e.constructorHandlers)r.set(c[0],c[1]);let n;return e.proto?s:i;function t(c,u){const o=Object.keys(c),f=Array.from({length:o.length});for(let d=0;d<o.length;d++){const l=o[d],y=c[l];typeof y!="object"||y===null?f[l]=y:y.constructor!==Object&&(n=r.get(y.constructor))?f[l]=n(y,u):ArrayBuffer.isView(y)?f[l]=A(y):f[l]=u(y)}return f}function i(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return t(c,i);if(c.constructor!==Object&&(n=r.get(c.constructor)))return n(c,i);const u={};for(const o in c){if(Object.hasOwnProperty.call(c,o)===!1)continue;const f=c[o];typeof f!="object"||f===null?u[o]=f:f.constructor!==Object&&(n=r.get(f.constructor))?u[o]=n(f,i):ArrayBuffer.isView(f)?u[o]=A(f):u[o]=i(f)}return u}function s(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return t(c,s);if(c.constructor!==Object&&(n=r.get(c.constructor)))return n(c,s);const u={};for(const o in c){const f=c[o];typeof f!="object"||f===null?u[o]=f:f.constructor!==Object&&(n=r.get(f.constructor))?u[o]=n(f,s):ArrayBuffer.isView(f)?u[o]=A(f):u[o]=s(f)}return u}}function ie(e){const r=[],n=[],t=new Map;if(t.set(Date,o=>new Date(o)),t.set(Map,(o,f)=>new Map(s(Array.from(o),f))),t.set(Set,(o,f)=>new Set(s(Array.from(o),f))),e.constructorHandlers)for(const o of e.constructorHandlers)t.set(o[0],o[1]);let i;return e.proto?u:c;function s(o,f){const d=Object.keys(o),l=Array.from({length:d.length});for(let y=0;y<d.length;y++){const b=d[y],m=o[b];if(typeof m!="object"||m===null)l[b]=m;else if(m.constructor!==Object&&(i=t.get(m.constructor)))l[b]=i(m,f);else if(ArrayBuffer.isView(m))l[b]=A(m);else{const X=r.indexOf(m);X!==-1?l[b]=n[X]:l[b]=f(m)}}return l}function c(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return s(o,c);if(o.constructor!==Object&&(i=t.get(o.constructor)))return i(o,c);const f={};r.push(o),n.push(f);for(const d in o){if(Object.hasOwnProperty.call(o,d)===!1)continue;const l=o[d];if(typeof l!="object"||l===null)f[d]=l;else if(l.constructor!==Object&&(i=t.get(l.constructor)))f[d]=i(l,c);else if(ArrayBuffer.isView(l))f[d]=A(l);else{const y=r.indexOf(l);y!==-1?f[d]=n[y]:f[d]=c(l)}}return r.pop(),n.pop(),f}function u(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return s(o,u);if(o.constructor!==Object&&(i=t.get(o.constructor)))return i(o,u);const f={};r.push(o),n.push(f);for(const d in o){const l=o[d];if(typeof l!="object"||l===null)f[d]=l;else if(l.constructor!==Object&&(i=t.get(l.constructor)))f[d]=i(l,u);else if(ArrayBuffer.isView(l))f[d]=A(l);else{const y=r.indexOf(l);y!==-1?f[d]=n[y]:f[d]=u(l)}}return r.pop(),n.pop(),f}}const F=K();function H(e,r=8){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let i=0;i<r;i++){const s=Math.floor(Math.random()*n.length);t+=n[s]}return e?`${e}${t}`:t}function ce(e,r){const n=e.variables.find(t=>t.name===r);if(!n)throw new Error(`Variable "${r}" not found`);return n}function oe(e,r){const n=e.utilities.find(t=>t.name===r);if(!n)throw new Error(`Utility "${r}" not found`);return n}function se(e,r){const n=e.modifiers.find(t=>t.key.includes(r));if(!n)throw new Error(`Modifier "${r}" not found`);return n}const $="__licenseRequired";function fe(e){T(e)||Object.defineProperty(e,$,{value:!0,writable:!1,configurable:!1,enumerable:!0})}function T(e){return Object.prototype.hasOwnProperty.call(e,$)}function I(e,r){const n=[...e];for(const t of r){const i=n.find(s=>s.name===t.name);i?i.value=t.value:n.push(t)}return n}function z(e,r){const n=[...e];for(const t of r){const i=n.find(s=>s.name===t.name);i?Object.assign(i,k(i,t)):n.push(t)}return n}function k(e,r){return Object.keys(e).reduce((n,t)=>(t==="variables"?n.variables=I(e.variables,r.variables):t==="declarations"?n.declarations={...e.declarations,...r.declarations}:t==="themes"&&w(n)&&w(e)&&w(r)?n.themes=z(e.themes,r.themes):Array.isArray(e[t])&&(n[t]=e[t].concat(r[t])),n),{...e,...r})}function ue(e,...r){return r.reduce((n,t)=>{const i={...n,root:k(n.root,t.root)};return(T(n)||T(t))&&fe(i),i},e)}function L(e){const r=[];function n(t,i){i.length>0&&r.push([...i].sort());for(let s=t;s<e.length;s++){const c=e[s];if(c)if(c.length===1&&c[0])n(s+1,[...i,c[0]]);else for(const u of c)n(s+1,[...i,u])}}return n(0,[]),r.sort((t,i)=>t.length!==i.length?t.length-i.length:t.join(",").localeCompare(i.join(",")))}function N(e,r,n){const t={...e,modifiers:[...n.keys()]},i=g(t,r);for(const s of n.values())s.factory({...i,declarations:F(t.declarations),variables:F(t.variables),children:F(t.children)}),j(t.declarations,i);return t}function q(e,r){return function(t,i){const s={type:"modifier",key:Array.isArray(t)?t:[t],factory:i};return r.modifiers.push(s),s}}function W(){return{type:"root",declarations:{},utilities:[],modifiers:[],recipes:[],variables:[],children:[],themes:[]}}function Y(e,r,n){const t=r.map(s=>s.key);return L(t).map(s=>{const c=new Map;for(const u of s){const o=r.find(f=>f.key.includes(u));o&&c.set(u,o)}return N(e,n,c)})}function G(e,r){return function(t,i){const s={type:"utility",name:t,factory:i};return r.utilities.push(s),(c,u=[])=>{for(const[o,f]of Object.entries(c)){const d={type:"utility",name:t,value:o,declarations:{},variables:[],children:[],modifiers:[]},l=g(d,r);d.declarations=i({...l,value:f})??{},j(d.declarations,l),e.children.push(d),u.length>0&&e.children.push(...Y(d,u,r))}}}}function J(e,r){return function(t,i){const s=r.themes.find(o=>o.name===t),c=s??{type:"theme",name:t,declarations:{},variables:[],children:[]};s||r.themes.push(c);const u=g(c,r);return i&&i(u),c}}function Q(e,r){return function(t,i,s,c){const u={type:"recipe",name:t,defaults:i,variants:s,...c};return r.recipes.push(u),u}}function ae(e){const r=H("sf-"),n=W(),t={...e},i=G(n,n),s=q(n,n),c=Q(n,n),u=J(n,n),{variable:o,selector:f,atRule:d,keyframes:l,media:y,ref:b,css:m}=g(n,n);return{id:r,root:n,variable:o,selector:f,utility:i,modifier:s,recipe:c,theme:u,atRule:d,keyframes:l,media:y,ref:b,css:m,options:t}}a.applyModifiers=N,a.capitalizeFirst=re,a.combineKeys=L,a.createAtRuleFunction=R,a.createCssFunction=p,a.createDeclarationsCallbackContext=g,a.createKeyframesFunction=P,a.createMediaFunction=_,a.createModifiedUtilityInstances=Y,a.createModifierFunction=q,a.createRecipeFunction=Q,a.createRefFunction=U,a.createRoot=W,a.createSelectorFunction=D,a.createThemeFunction=J,a.createUtilityFunction=G,a.createVariableFunction=E,a.deepClone=F,a.generateRandomId=H,a.getModifier=se,a.getUtility=oe,a.getVariable=ce,a.isAtRule=x,a.isCSS=C,a.isContainer=B,a.isModifier=te,a.isObject=M,a.isPrimitiveTokenValue=S,a.isRef=O,a.isRoot=w,a.isSelector=Z,a.isTheme=ne,a.isToken=h,a.isTokenValue=V,a.isUtility=ee,a.isVariable=v,a.merge=ue,a.mergeContainers=k,a.mergeThemesArray=z,a.mergeVariablesArray=I,a.parseDeclarationsBlock=j,a.rfdc=K,a.styleframe=ae,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(a,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(a=typeof globalThis<"u"?globalThis:a||self,b(a.styleframe={}))})(this,(function(a){"use strict";function b(e){return typeof e=="object"&&e!==null}function p(e,r){return b(e)&&"type"in e&&e.type===r}function P(e){return p(e,"variable")}function A(e){return p(e,"reference")}function ye(e){return p(e,"selector")}function de(e){return p(e,"at-rule")}function me(e){return p(e,"utility")}function $(e){return p(e,"modifier")}function k(e){return p(e,"css")}function he(e){return p(e,"theme")}function F(e){return p(e,"root")}function pe(e){return p(e,"recipe")}function H(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null}function S(e){return H(e)||A(e)||k(e)||Array.isArray(e)&&e.every(S)}function N(e){return b(e)&&"children"in e&&"declarations"in e&&"variables"in e}function q(e=r=>r){return r=>{let t=r,n;if(typeof t=="string"&&t[0]==="@"){const i=t.slice(1);n=e(i),t={type:"reference",name:i}}else A(t)?n=e(t.name):n=`[${r}]`;return{[n]:t}}}function I(e,r){return function(n,...i){return{type:"css",value:n.reduce((o,u,s)=>(o.push(u),s<i.length&&o.push(i[s]),o),[])}}}function O(e,r){return function(n,i,c){const o={type:"at-rule",identifier:n,rule:i,declarations:{},variables:[],children:[]},u=g(o,r);return typeof c=="function"?o.declarations=c(u)??{}:c&&(o.declarations=c),w(o.declarations,u),e.children.push(o),o}}function z(e,r){const t=O(e,r);return function(i,c){return t("media",i,c)}}function G(e,r){const t=O(e,r);return function(i,c){return t("keyframes",i,c)}}function L(e,r){return function(n,i){return P(n)?{type:"reference",name:n.name,fallback:i}:{type:"reference",name:n,fallback:i}}}function W(e,r){return function(n,i){const c={type:"selector",query:n,declarations:{},variables:[],children:[]},o=g(c,r);return typeof i=="function"?c.declarations=i(o)??{}:N(i)?(c.variables=i.variables,c.declarations=i.declarations,c.children=i.children):c.declarations=i,w(c.declarations,o),e.children.push(c),c}}function Y(e,r){return function(n,i,c={default:!1}){const o=typeof n=="string"?n:n.name,u=e.variables.find(f=>f.name===o);if(c.default&&u)return u;if(u)return u.value=i,u;const s={type:"variable",name:o,value:i};return e.variables.push(s),s}}function g(e,r){const t=Y(e),n=W(e,r),i=O(e,r),c=G(r,r),o=z(e,r),u=L(),s=I();return{variable:t,selector:n,keyframes:c,atRule:i,media:o,ref:u,css:s}}function w(e,r){for(const t in e)if(t.startsWith("@")){const n=e[t];if(typeof n=="object"&&n!==null&&!S(n)){const i=t.replace(/^@(\w+).*/,"$1"),c=t.replace(`@${i}`,"").trim();r.atRule(i,c,n),delete e[t]}}else if(/^[.&:]/.test(t)){const n=e[t];typeof n=="object"&&(r.selector(t,n),delete e[t])}return e}function be(e){return e.charAt(0).toUpperCase()+e.slice(1)}function R(e){if(e instanceof Buffer)return Buffer.from(e);const r=e.constructor;return new r(e.buffer.slice(0),e.byteOffset,e.byteLength/e.BYTES_PER_ELEMENT||1)}function J(e){if(e=e||{},e.circular)return ge(e);const r=new Map;if(r.set(Date,o=>new Date(o)),r.set(Map,(o,u)=>new Map(n(Array.from(o),u))),r.set(Set,(o,u)=>new Set(n(Array.from(o),u))),e.constructorHandlers)for(const o of e.constructorHandlers)r.set(o[0],o[1]);let t;return e.proto?c:i;function n(o,u){const s=Object.keys(o),f=Array.from({length:s.length});for(let y=0;y<s.length;y++){const l=s[y],d=o[l];typeof d!="object"||d===null?f[l]=d:d.constructor!==Object&&(t=r.get(d.constructor))?f[l]=t(d,u):ArrayBuffer.isView(d)?f[l]=R(d):f[l]=u(d)}return f}function i(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,i);if(o.constructor!==Object&&(t=r.get(o.constructor)))return t(o,i);const u={};for(const s in o){if(Object.hasOwnProperty.call(o,s)===!1)continue;const f=o[s];typeof f!="object"||f===null?u[s]=f:f.constructor!==Object&&(t=r.get(f.constructor))?u[s]=t(f,i):ArrayBuffer.isView(f)?u[s]=R(f):u[s]=i(f)}return u}function c(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,c);if(o.constructor!==Object&&(t=r.get(o.constructor)))return t(o,c);const u={};for(const s in o){const f=o[s];typeof f!="object"||f===null?u[s]=f:f.constructor!==Object&&(t=r.get(f.constructor))?u[s]=t(f,c):ArrayBuffer.isView(f)?u[s]=R(f):u[s]=c(f)}return u}}function ge(e){const r=[],t=[],n=new Map;if(n.set(Date,s=>new Date(s)),n.set(Map,(s,f)=>new Map(c(Array.from(s),f))),n.set(Set,(s,f)=>new Set(c(Array.from(s),f))),e.constructorHandlers)for(const s of e.constructorHandlers)n.set(s[0],s[1]);let i;return e.proto?u:o;function c(s,f){const y=Object.keys(s),l=Array.from({length:y.length});for(let d=0;d<y.length;d++){const h=y[d],m=s[h];if(typeof m!="object"||m===null)l[h]=m;else if(m.constructor!==Object&&(i=n.get(m.constructor)))l[h]=i(m,f);else if(ArrayBuffer.isView(m))l[h]=R(m);else{const j=r.indexOf(m);j!==-1?l[h]=t[j]:l[h]=f(m)}}return l}function o(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return c(s,o);if(s.constructor!==Object&&(i=n.get(s.constructor)))return i(s,o);const f={};r.push(s),t.push(f);for(const y in s){if(Object.hasOwnProperty.call(s,y)===!1)continue;const l=s[y];if(typeof l!="object"||l===null)f[y]=l;else if(l.constructor!==Object&&(i=n.get(l.constructor)))f[y]=i(l,o);else if(ArrayBuffer.isView(l))f[y]=R(l);else{const d=r.indexOf(l);d!==-1?f[y]=t[d]:f[y]=o(l)}}return r.pop(),t.pop(),f}function u(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return c(s,u);if(s.constructor!==Object&&(i=n.get(s.constructor)))return i(s,u);const f={};r.push(s),t.push(f);for(const y in s){const l=s[y];if(typeof l!="object"||l===null)f[y]=l;else if(l.constructor!==Object&&(i=n.get(l.constructor)))f[y]=i(l,u);else if(ArrayBuffer.isView(l))f[y]=R(l);else{const d=r.indexOf(l);d!==-1?f[y]=t[d]:f[y]=u(l)}}return r.pop(),t.pop(),f}}const M=J();function Q(e,r=8){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let i=0;i<r;i++){const c=Math.floor(Math.random()*t.length);n+=t[c]}return e?`${e}${n}`:n}function je(e,r){const t=e.variables.find(n=>n.name===r);if(!t)throw new Error(`Variable "${r}" not found`);return t}function ve(e,r){const t=e.utilities.find(n=>n.name===r);if(!t)throw new Error(`Utility "${r}" not found`);return t}function X(e,r){const t=e.modifiers.find(n=>n.key.includes(r));if(!t)throw new Error(`Modifier "${r}" not found`);return t}function T(e,r){if(e===r)return!0;if(typeof e!=typeof r)return!1;if(e===null||r===null)return e===r;if(typeof e!="object"||typeof r!="object")return!1;if(Array.isArray(e)&&Array.isArray(r))return e.length!==r.length?!1:e.every((t,n)=>T(t,r[n]));if("type"in e&&"type"in r){if(e.type!==r.type)return!1;if(A(e)&&A(r))return e.name===r.name&&T(e.fallback,r.fallback);if(k(e)&&k(r))return T(e.value,r.value)}return!1}const Z="__licenseRequired";function Ae(e){E(e)||Object.defineProperty(e,Z,{value:!0,writable:!1,configurable:!1,enumerable:!0})}function E(e){return Object.prototype.hasOwnProperty.call(e,Z)}function x(e,r){const t=[...e];for(const n of r){const i=t.find(c=>c.name===n.name);i?i.value=n.value:t.push(n)}return t}function ee(e,r){const t=[...e];for(const n of r){const i=t.find(c=>c.name===n.name);i?Object.assign(i,B(i,n)):t.push(n)}return t}function B(e,r){return Object.keys(e).reduce((t,n)=>(n==="variables"?t.variables=x(e.variables,r.variables):n==="declarations"?t.declarations={...e.declarations,...r.declarations}:n==="themes"&&F(t)&&F(e)&&F(r)?t.themes=ee(e.themes,r.themes):Array.isArray(e[n])&&(t[n]=e[n].concat(r[n])),t),{...e,...r})}function Re(e,...r){return r.reduce((t,n)=>{const i={...t,root:B(t.root,n.root)};return(E(t)||E(n))&&Ae(i),i},e)}function te(e){const r=[];function t(n,i){i.length>0&&r.push([...i].sort());for(let c=n;c<e.length;c++){const o=e[c];if(o)if(o.length===1&&o[0])t(c+1,[...i,o[0]]);else for(const u of o)t(c+1,[...i,u])}}return t(0,[]),r.sort((n,i)=>n.length!==i.length?n.length-i.length:n.join(",").localeCompare(i.join(",")))}function ne(e,r,t){const n={...e,modifiers:[...t.keys()]},i=g(n,r);for(const c of t.values())c.factory({...i,declarations:M(n.declarations),variables:M(n.variables),children:M(n.children)}),w(n.declarations,i);return n}function re(e,r){return function(n,i){const c={type:"modifier",key:Array.isArray(n)?n:[n],factory:i};return r.modifiers.push(c),c}}function ie(){return{type:"root",declarations:{},utilities:[],modifiers:[],recipes:[],variables:[],children:[],themes:[]}}function oe(e,r){return function(n,i,c={}){const o={type:"utility",name:n,factory:i,values:[],autogenerate:c.autogenerate??q(),create:(u,s=[])=>{let f=u;if(Array.isArray(u)){f={};for(const y of u){const l=o.autogenerate(y);f={...f,...l}}}for(const[y,l]of Object.entries(f)){const d=o.values.find(j=>j.key===y&&j.modifiers.length===0),h={type:"utility",name:n,value:y,declarations:{},variables:[],children:[],modifiers:[]},m=g(h,r);if(h.declarations=i({...m,value:l})??{},w(h.declarations,m),d||(o.values.push({key:y,value:l,modifiers:[]}),e.children.push(h)),s&&s.length>0){const j=s.map(v=>v.key),ke=te(j).filter(v=>!o.values.find(V=>V.key===y&&V.modifiers.length===v.length&&V.modifiers.every(C=>v.includes(C)))).reduce((v,V)=>{const C=new Map;for(const le of V){const _=s.find(Fe=>Fe.key.includes(le));_&&$(_)&&C.set(le,_)}return o.values.push({key:y,value:l,modifiers:V}),v.push(ne(h,r,C)),v},[]);e.children.push(...ke)}}}};return r.utilities.push(o),o.create}}function se(e,r){return function(n,i){const c=r.themes.find(s=>s.name===n),o=c??{type:"theme",name:n,declarations:{},variables:[],children:[]};c||r.themes.push(o);const u=g(o,r);return i&&i(u),o}}function ce(e,r){return function(n){const i={type:"recipe",...n};return i._runtime=ue(i,r),r.recipes.push(i),i}}function fe(e,r){const t=e.autogenerate(r);return Object.keys(t)[0]??"default"}function K(e,r){const t={};for(const[n,i]of Object.entries(e))if(ae(i)){const c={};for(const[o,u]of Object.entries(i)){const s=D(r,o);s&&(c[o]=fe(s,u))}t[n]=c}else if(typeof i=="boolean")t[n]=i;else{const c=D(r,n);c&&(t[n]=fe(c,i))}return t}function ue(e,r){const t={};if(e.base&&(t.base=K(e.base,r)),e.variants){const n={};for(const[i,c]of Object.entries(e.variants)){const o={};for(const[u,s]of Object.entries(c))s==null?o[u]=null:o[u]=K(s,r);n[i]=o}t.variants=n}return e.defaultVariants&&(t.defaultVariants={...e.defaultVariants}),e.compoundVariants&&(t.compoundVariants=e.compoundVariants.map(n=>({match:{...n.match},css:K(n.css,r)}))),t}function ae(e){return!A(e)&&typeof e=="object"&&e!==null}function U(e,r){const t=(n,i,c)=>{let o=r.get(n);o||(o=[],r.set(n,o)),o.push({value:i,modifiers:c})};for(const[n,i]of Object.entries(e))if(ae(i)){const c=n.split(":");for(const[o,u]of Object.entries(i))t(o,u,c)}else t(n,i,[])}function D(e,r){return e.utilities.find(t=>t.name===r)}function Ve(e,r){const t=new Map;if(e.base&&U(e.base,t),e.variants)for(const i of Object.values(e.variants))for(const c of Object.values(i))U(c,t);if(e.compoundVariants)for(const i of e.compoundVariants)i.css&&U(i.css,t);const n=new Map;for(const[i,c]of t){const o=D(r,i);if(!o){console.warn(`[styleframe] Utility "${i}" not found in registry. Skipping.`);continue}for(const u of c){const s=[];for(const f of u.modifiers){if(!n.has(f))try{n.set(f,X(r,f))}catch{console.warn(`[styleframe] Modifier "${f}" not found in registry. Skipping modifier for utility "${i}".`),n.set(f,null)}const y=n.get(f);y&&s.push(y)}o.create([u.value],s.length>0?s:void 0)}}}function we(e){const r=Q("sf-"),t=ie(),n={...e},i=oe(t,t),c=re(t,t),o=ce(t,t),u=se(t,t),{variable:s,selector:f,atRule:y,keyframes:l,media:d,ref:h,css:m}=g(t,t);return{id:r,root:t,variable:s,selector:f,utility:i,modifier:c,recipe:o,theme:u,atRule:y,keyframes:l,media:d,ref:h,css:m,options:n}}a.applyModifiers=ne,a.capitalizeFirst=be,a.combineKeys=te,a.createAtRuleFunction=O,a.createCssFunction=I,a.createDeclarationsCallbackContext=g,a.createKeyframesFunction=G,a.createMediaFunction=z,a.createModifierFunction=re,a.createRecipeFunction=ce,a.createRefFunction=L,a.createRoot=ie,a.createSelectorFunction=W,a.createThemeFunction=se,a.createUtilityFunction=oe,a.createVariableFunction=Y,a.deepClone=M,a.generateRandomId=Q,a.generateRecipeRuntime=ue,a.getModifier=X,a.getUtility=ve,a.getVariable=je,a.isAtRule=de,a.isCSS=k,a.isContainer=N,a.isModifier=$,a.isObject=b,a.isPrimitiveTokenValue=H,a.isRecipe=pe,a.isRef=A,a.isRoot=F,a.isSelector=ye,a.isTheme=he,a.isToken=p,a.isTokenEqual=T,a.isTokenValue=S,a.isUtility=me,a.isVariable=P,a.merge=Re,a.mergeContainers=B,a.mergeThemesArray=ee,a.mergeVariablesArray=x,a.parseDeclarationsBlock=w,a.processRecipeUtilities=Ve,a.rfdc=J,a.styleframe=we,a.transformUtilityKey=q,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|