@salty-css/react 0.0.1-alpha.203 → 0.0.1-alpha.204
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/class-name.cjs +1 -1
- package/class-name.js +1 -1
- package/keyframes.cjs +1 -1
- package/keyframes.js +1 -1
- package/package.json +2 -2
- package/parse-styles-CbFZTiNo.js +136 -0
- package/parse-styles-D_bszbUo.cjs +3 -0
- package/styled.cjs +1 -1
- package/styled.js +1 -1
- package/{styles-generator-Bf-aF7sl.cjs → styles-generator-B45twOrU.cjs} +1 -1
- package/{styles-generator-8VCE7njI.js → styles-generator-BgWEdgrf.js} +1 -1
- package/parse-styles-B4STzGjG.cjs +0 -3
- package/parse-styles-DqV7Jbst.js +0 -129
package/class-name.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./styles-generator-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./styles-generator-B45twOrU.cjs");class a extends r.StylesGenerator{constructor(e){super(e),this._params=e}}const n=s=>{const e=new a(s),t=new String(e.cssClassName);return Object.assign(t,{get isClassName(){return!0},factory:e}),t};exports.className=n;
|
package/class-name.js
CHANGED
package/keyframes.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-D_bszbUo.cjs"),w=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const e=l||i.toHash(t),r=async(n={})=>{const{duration:s="500ms",easing:o="ease-in-out",delay:c="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...n},a=`${e} ${s} ${o} ${c} ${S} ${p} ${g} ${b}`;if(!y)return a;const m=t.from||t["0%"];if(!m)return a;const j=await i.parseAndJoinStyles(m,"");return`${a};${j}`},$=Object.entries(t).map(async([n,s])=>{if(!s)return"";const o=await i.parseAndJoinStyles(s,"");return`${typeof n=="number"?`${n}%`:n}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${e} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:e,css:f,keyframes:t}),r};exports.keyframes=w;
|
package/keyframes.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salty-css/react",
|
3
|
-
"version": "0.0.1-alpha.
|
3
|
+
"version": "0.0.1-alpha.204",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -62,7 +62,7 @@
|
|
62
62
|
}
|
63
63
|
},
|
64
64
|
"dependencies": {
|
65
|
-
"@salty-css/core": "^0.0.1-alpha.
|
65
|
+
"@salty-css/core": "^0.0.1-alpha.204",
|
66
66
|
"clsx": ">=2.x",
|
67
67
|
"react": ">=19.x || >=18.3.x"
|
68
68
|
}
|
@@ -0,0 +1,136 @@
|
|
1
|
+
import { d as W, p as U } from "./parse-tokens-CdNpUjpp.js";
|
2
|
+
const H = (e) => (s) => {
|
3
|
+
if (typeof s != "string" || !e) return;
|
4
|
+
let t = s;
|
5
|
+
const i = [];
|
6
|
+
return Object.values(e).forEach((c) => {
|
7
|
+
const { pattern: b, transform: P } = c;
|
8
|
+
t = t.replace(b, (C) => {
|
9
|
+
const { value: x, css: u } = P(C);
|
10
|
+
return u && i.push(u), x;
|
11
|
+
});
|
12
|
+
}), { transformed: t, additionalCss: i };
|
13
|
+
}, A = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), J = (e, s) => {
|
14
|
+
let t = "", i;
|
15
|
+
for (i = Math.abs(e); i > 52; i = i / 52 | 0) t = A(i % 52) + t;
|
16
|
+
return t = A(i % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
|
17
|
+
}, Q = (e, s) => {
|
18
|
+
let t = s.length;
|
19
|
+
for (; t; ) e = e * 33 ^ s.charCodeAt(--t);
|
20
|
+
return e;
|
21
|
+
}, B = (e, s = 5) => {
|
22
|
+
const t = Q(5381, JSON.stringify(e)) >>> 0;
|
23
|
+
return J(t, s);
|
24
|
+
}, T = [
|
25
|
+
"top",
|
26
|
+
"right",
|
27
|
+
"bottom",
|
28
|
+
"left",
|
29
|
+
"min-width",
|
30
|
+
/.*width.*/,
|
31
|
+
/^[^line]*height.*/,
|
32
|
+
// Exclude line-height
|
33
|
+
/padding.*/,
|
34
|
+
/margin.*/,
|
35
|
+
/border.*/,
|
36
|
+
/inset.*/,
|
37
|
+
/.*radius.*/,
|
38
|
+
/.*spacing.*/,
|
39
|
+
/.*gap.*/,
|
40
|
+
/.*indent.*/,
|
41
|
+
/.*offset.*/,
|
42
|
+
/.*size.*/,
|
43
|
+
/.*thickness.*/,
|
44
|
+
/.*font-size.*/
|
45
|
+
], _ = (e, s, t) => {
|
46
|
+
if (T.some((c) => typeof c == "string" ? c === e : c.test(e))) {
|
47
|
+
const c = (t == null ? void 0 : t.defaultUnit) || "px";
|
48
|
+
return `${s}${c}`;
|
49
|
+
}
|
50
|
+
return `${s}`;
|
51
|
+
}, q = ["Webkit", "Moz", "ms", "O"], F = (e) => e.startsWith("-") ? e : q.some((s) => e.startsWith(s)) ? `-${W(e)}` : W(e), h = async (e, s = "", t) => {
|
52
|
+
if (!e) throw new Error("No styles provided to parseStyles function!");
|
53
|
+
const i = /* @__PURE__ */ new Set(), b = Object.entries(e).map(async ([$, r]) => {
|
54
|
+
var y;
|
55
|
+
const n = $.trim(), w = F(n), f = (a, d = ";") => `${w}:${a}${d}`;
|
56
|
+
if (typeof r == "function" && (r = r({ scope: s, config: t })), r instanceof Promise && (r = await r), t != null && t.templates && t.templatePaths[n]) {
|
57
|
+
const { default: a } = await import(t.templatePaths[n]);
|
58
|
+
if (typeof a.params[n] == "function") {
|
59
|
+
const d = await a.params[n](r), [o] = await h(d, "");
|
60
|
+
return o;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
if (t != null && t.templates && t.templates[n]) {
|
64
|
+
const d = r.split(".").reduce((o, p) => o[p], t.templates[n]);
|
65
|
+
if (d) {
|
66
|
+
const [o] = await h(d, "");
|
67
|
+
return o;
|
68
|
+
}
|
69
|
+
console.warn(`Template "${n}" with path of "${r}" was not found in config!`);
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
if (typeof r == "object") {
|
73
|
+
if (!r) return;
|
74
|
+
if (r.isColor) return f(r.toString());
|
75
|
+
if (n === "defaultVariants") return;
|
76
|
+
if (n === "variants") {
|
77
|
+
const o = Object.entries(r);
|
78
|
+
for (const [p, m] of o) {
|
79
|
+
if (!m) return;
|
80
|
+
const E = Object.entries(m);
|
81
|
+
for (const [S, l] of E) {
|
82
|
+
if (!l) return;
|
83
|
+
const O = `${s}.${p}-${S}`;
|
84
|
+
(await h(l, O, t)).forEach((M) => i.add(M));
|
85
|
+
}
|
86
|
+
}
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
if (n === "compoundVariants") {
|
90
|
+
for (const o of r) {
|
91
|
+
const { css: p, ...m } = o, E = Object.entries(m).reduce((l, [O, N]) => `${l}.${O}-${N}`, s);
|
92
|
+
(await h(p, E, t)).forEach((l) => i.add(l));
|
93
|
+
}
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
if (n.startsWith("@")) {
|
97
|
+
const o = ((y = t == null ? void 0 : t.mediaQueries) == null ? void 0 : y[n]) || n, p = await V(r, s, t), m = `${o} { ${p} }`;
|
98
|
+
i.add(m);
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
const a = $.includes("&") ? n.replace("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
|
102
|
+
(await h(r, a, t)).forEach((o) => i.add(o));
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
if (typeof r == "number") {
|
106
|
+
const a = _(w, r, t);
|
107
|
+
return f(a);
|
108
|
+
}
|
109
|
+
if (typeof r != "string")
|
110
|
+
if ("toString" in r) r = r.toString();
|
111
|
+
else throw new Error(`Invalid value type for property ${w}`);
|
112
|
+
return f(r);
|
113
|
+
}), { modifiers: P } = t || {}, C = [U(), H(P)], u = (await Promise.all(b).then(($) => Promise.all(
|
114
|
+
$.map((r) => C.reduce(async (n, w) => {
|
115
|
+
const f = await n;
|
116
|
+
if (!f) return f;
|
117
|
+
const j = await w(f);
|
118
|
+
if (!j) return f;
|
119
|
+
const { transformed: y, additionalCss: a } = j;
|
120
|
+
let d = "";
|
121
|
+
if (a)
|
122
|
+
for (const o of a)
|
123
|
+
d += await V(o, "");
|
124
|
+
return `${d}${y}`;
|
125
|
+
}, Promise.resolve(r)))
|
126
|
+
))).join(`
|
127
|
+
`);
|
128
|
+
if (!u.trim()) return i;
|
129
|
+
const z = s ? `${s} { ${u} }` : u;
|
130
|
+
return i.add(z), i;
|
131
|
+
}, V = async (e, s, t) => [...await h(e, s, t)].join(`
|
132
|
+
`);
|
133
|
+
export {
|
134
|
+
V as p,
|
135
|
+
B as t
|
136
|
+
};
|
@@ -0,0 +1,3 @@
|
|
1
|
+
"use strict";const S=require("./parse-tokens-CNGyn07A.cjs"),J=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const i=[];return Object.values(e).forEach(c=>{const{pattern:b,transform:P}=c;t=t.replace(b,C=>{const{value:A,css:u}=P(C);return u&&i.push(u),A})}),{transformed:t,additionalCss:i}},V=e=>String.fromCharCode(e+(e>25?39:97)),M=(e,s)=>{let t="",i;for(i=Math.abs(e);i>52;i=i/52|0)t=V(i%52)+t;return t=V(i%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},T=(e,s)=>{let t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return e},U=(e,s=5)=>{const t=T(5381,JSON.stringify(e))>>>0;return M(t,s)},q=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Q=(e,s,t)=>{if(q.some(c=>typeof c=="string"?c===e:c.test(e))){const c=(t==null?void 0:t.defaultUnit)||"px";return`${s}${c}`}return`${s}`},_=["Webkit","Moz","ms","O"],F=e=>e.startsWith("-")?e:_.some(s=>e.startsWith(s))?`-${S.dashCase(e)}`:S.dashCase(e),h=async(e,s="",t)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const i=new Set,b=Object.entries(e).map(async([$,r])=>{var y;const n=$.trim(),w=F(n),f=(a,d=";")=>`${w}:${a}${d}`;if(typeof r=="function"&&(r=r({scope:s,config:t})),r instanceof Promise&&(r=await r),t!=null&&t.templates&&t.templatePaths[n]){const{default:a}=await import(t.templatePaths[n]);if(typeof a.params[n]=="function"){const d=await a.params[n](r),[o]=await h(d,"");return o}}if(t!=null&&t.templates&&t.templates[n]){const d=r.split(".").reduce((o,p)=>o[p],t.templates[n]);if(d){const[o]=await h(d,"");return o}console.warn(`Template "${n}" with path of "${r}" was not found in config!`);return}if(typeof r=="object"){if(!r)return;if(r.isColor)return f(r.toString());if(n==="defaultVariants")return;if(n==="variants"){const o=Object.entries(r);for(const[p,l]of o){if(!l)return;const E=Object.entries(l);for(const[N,m]of E){if(!m)return;const O=`${s}.${p}-${N}`;(await h(m,O,t)).forEach(H=>i.add(H))}}return}if(n==="compoundVariants"){for(const o of r){const{css:p,...l}=o,E=Object.entries(l).reduce((m,[O,W])=>`${m}.${O}-${W}`,s);(await h(p,E,t)).forEach(m=>i.add(m))}return}if(n.startsWith("@")){const o=((y=t==null?void 0:t.mediaQueries)==null?void 0:y[n])||n,p=await x(r,s,t),l=`${o} { ${p} }`;i.add(l);return}const a=$.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await h(r,a,t)).forEach(o=>i.add(o));return}if(typeof r=="number"){const a=Q(w,r,t);return f(a)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${w}`);return f(r)}),{modifiers:P}=t||{},C=[S.parseValueTokens(),J(P)],u=(await Promise.all(b).then($=>Promise.all($.map(r=>C.reduce(async(n,w)=>{const f=await n;if(!f)return f;const j=await w(f);if(!j)return f;const{transformed:y,additionalCss:a}=j;let d="";if(a)for(const o of a)d+=await x(o,"");return`${d}${y}`},Promise.resolve(r)))))).join(`
|
2
|
+
`);if(!u.trim())return i;const z=s?`${s} { ${u} }`:u;return i.add(z),i},x=async(e,s,t)=>[...await h(e,s,t)].join(`
|
3
|
+
`);exports.parseAndJoinStyles=x;exports.toHash=U;
|
package/styled.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-B45twOrU.cjs"),g=require("./element-factory-xzOUBIyk.cjs");class h extends m.StylesGenerator{constructor(e,t){super(t),this.tagName=e,this._params=t}get priority(){var e;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((e=this.tagName.generator)==null?void 0:e.priority)||0)+1:0}get clientProps(){const{element:e,variants:t={},compoundVariants:a=[],defaultVariants:d={},defaultProps:l={},passProps:u}=this.params,{callerName:y,isProduction:f}=this.buildContext,o=new Set([]),i=s=>{const r=d[s];r!==void 0?o.add(`${s}=${String(r)}`):o.add(s)};Object.keys(t).forEach(i),a.map(s=>Object.keys(s).forEach(i));const c=new Set([]);if(this.params.base){const s=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);s&&s.forEach(r=>{const p=r.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&c.add(p)})}return{element:e,variantKeys:[...o],propValueKeys:[...c],passProps:u,defaultProps:l,attr:{"data-component-name":f?void 0:y}}}}const b=(n,e)=>{const t=new h(n,e),a=g.elementFactory(n,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(a,{generator:t}),a};exports.styled=b;
|
package/styled.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var h=Object.defineProperty;var o=(e,s,t)=>s in e?h(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var a=(e,s,t)=>o(e,typeof s!="symbol"?s+"":s,t);const r=require("./parse-styles-
|
1
|
+
"use strict";var h=Object.defineProperty;var o=(e,s,t)=>s in e?h(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var a=(e,s,t)=>o(e,typeof s!="symbol"?s+"":s,t);const r=require("./parse-styles-D_bszbUo.cjs"),l=require("./parse-tokens-CNGyn07A.cjs");class u{constructor(s){a(this,"buildContext",{});this.params=s}get hash(){return r.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=[this.hash],{className:t}=this.params;return typeof t=="string"&&s.push(t),typeof t=="object"&&s.push(...t),s.join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${l.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:i=[]}=this.params,{config:n}=this.buildContext,c={...s,variants:t,compoundVariants:i};return r.parseAndJoinStyles(c,`.${this.cssClassName}`,n)}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
var n = Object.defineProperty;
|
2
2
|
var o = (a, s, t) => s in a ? n(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
|
3
3
|
var e = (a, s, t) => o(a, typeof s != "symbol" ? s + "" : s, t);
|
4
|
-
import { t as c, p as l } from "./parse-styles-
|
4
|
+
import { t as c, p as l } from "./parse-styles-CbFZTiNo.js";
|
5
5
|
import { d as m } from "./parse-tokens-CdNpUjpp.js";
|
6
6
|
class f {
|
7
7
|
constructor(s) {
|
@@ -1,3 +0,0 @@
|
|
1
|
-
"use strict";const S=require("./parse-tokens-CNGyn07A.cjs"),J=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const n=[];return Object.values(e).forEach(d=>{const{pattern:b,transform:C}=d;t=t.replace(b,P=>{const{value:A,css:p}=C(P);return p&&n.push(p),A})}),{transformed:t,additionalCss:n}},V=e=>String.fromCharCode(e+(e>25?39:97)),M=(e,s)=>{let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=V(n%52)+t;return t=V(n%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},T=(e,s)=>{let t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return e},U=(e,s=5)=>{const t=T(5381,JSON.stringify(e))>>>0;return M(t,s)},q=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Q=(e,s,t)=>{if(q.some(d=>typeof d=="string"?d===e:d.test(e))){const d=(t==null?void 0:t.defaultUnit)||"px";return`${s}${d}`}return`${s}`},_=["Webkit","Moz","ms","O"],F=e=>e.startsWith("-")?e:_.some(s=>e.startsWith(s))?`-${S.dashCase(e)}`:S.dashCase(e),$=async(e,s="",t)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const n=new Set,b=Object.entries(e).map(async([w,r])=>{var y;const i=w.trim(),m=F(i),c=(a,f=";")=>`${m}:${a}${f}`;if(typeof r=="function"&&(r=r({scope:s,config:t})),r instanceof Promise&&(r=await r),t!=null&&t.templates&&t.templates[i]){const f=r.split(".").reduce((o,u)=>o[u],t.templates[i]);if(f){const[o]=await $(f,"");return o}console.warn(`Template "${i}" with path of "${r}" was not found in config!`);return}if(typeof r=="object"){if(!r)return;if(r.isColor)return c(r.toString());if(i==="defaultVariants")return;if(i==="variants"){const o=Object.entries(r);for(const[u,h]of o){if(!h)return;const E=Object.entries(h);for(const[N,l]of E){if(!l)return;const O=`${s}.${u}-${N}`;(await $(l,O,t)).forEach(H=>n.add(H))}}return}if(i==="compoundVariants"){for(const o of r){const{css:u,...h}=o,E=Object.entries(h).reduce((l,[O,W])=>`${l}.${O}-${W}`,s);(await $(u,E,t)).forEach(l=>n.add(l))}return}if(i.startsWith("@")){const o=((y=t==null?void 0:t.mediaQueries)==null?void 0:y[i])||i,u=await x(r,s,t),h=`${o} { ${u} }`;n.add(h);return}const a=w.includes("&")?i.replace("&",s):i.startsWith(":")?`${s}${i}`:`${s} ${i}`;(await $(r,a,t)).forEach(o=>n.add(o));return}if(typeof r=="number"){const a=Q(m,r,t);return c(a)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${m}`);return c(r)}),{modifiers:C}=t||{},P=[S.parseValueTokens(),J(C)],p=(await Promise.all(b).then(w=>Promise.all(w.map(r=>P.reduce(async(i,m)=>{const c=await i;if(!c)return c;const j=await m(c);if(!j)return c;const{transformed:y,additionalCss:a}=j;let f="";if(a)for(const o of a)f+=await x(o,"");return`${f}${y}`},Promise.resolve(r)))))).join(`
|
2
|
-
`);if(!p.trim())return n;const z=s?`${s} { ${p} }`:p;return n.add(z),n},x=async(e,s,t)=>[...await $(e,s,t)].join(`
|
3
|
-
`);exports.parseAndJoinStyles=x;exports.toHash=U;
|
package/parse-styles-DqV7Jbst.js
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
import { d as W, p as U } from "./parse-tokens-CdNpUjpp.js";
|
2
|
-
const H = (e) => (s) => {
|
3
|
-
if (typeof s != "string" || !e) return;
|
4
|
-
let t = s;
|
5
|
-
const n = [];
|
6
|
-
return Object.values(e).forEach((d) => {
|
7
|
-
const { pattern: b, transform: C } = d;
|
8
|
-
t = t.replace(b, (P) => {
|
9
|
-
const { value: x, css: u } = C(P);
|
10
|
-
return u && n.push(u), x;
|
11
|
-
});
|
12
|
-
}), { transformed: t, additionalCss: n };
|
13
|
-
}, A = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), J = (e, s) => {
|
14
|
-
let t = "", n;
|
15
|
-
for (n = Math.abs(e); n > 52; n = n / 52 | 0) t = A(n % 52) + t;
|
16
|
-
return t = A(n % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
|
17
|
-
}, Q = (e, s) => {
|
18
|
-
let t = s.length;
|
19
|
-
for (; t; ) e = e * 33 ^ s.charCodeAt(--t);
|
20
|
-
return e;
|
21
|
-
}, B = (e, s = 5) => {
|
22
|
-
const t = Q(5381, JSON.stringify(e)) >>> 0;
|
23
|
-
return J(t, s);
|
24
|
-
}, T = [
|
25
|
-
"top",
|
26
|
-
"right",
|
27
|
-
"bottom",
|
28
|
-
"left",
|
29
|
-
"min-width",
|
30
|
-
/.*width.*/,
|
31
|
-
/^[^line]*height.*/,
|
32
|
-
// Exclude line-height
|
33
|
-
/padding.*/,
|
34
|
-
/margin.*/,
|
35
|
-
/border.*/,
|
36
|
-
/inset.*/,
|
37
|
-
/.*radius.*/,
|
38
|
-
/.*spacing.*/,
|
39
|
-
/.*gap.*/,
|
40
|
-
/.*indent.*/,
|
41
|
-
/.*offset.*/,
|
42
|
-
/.*size.*/,
|
43
|
-
/.*thickness.*/,
|
44
|
-
/.*font-size.*/
|
45
|
-
], _ = (e, s, t) => {
|
46
|
-
if (T.some((d) => typeof d == "string" ? d === e : d.test(e))) {
|
47
|
-
const d = (t == null ? void 0 : t.defaultUnit) || "px";
|
48
|
-
return `${s}${d}`;
|
49
|
-
}
|
50
|
-
return `${s}`;
|
51
|
-
}, q = ["Webkit", "Moz", "ms", "O"], F = (e) => e.startsWith("-") ? e : q.some((s) => e.startsWith(s)) ? `-${W(e)}` : W(e), $ = async (e, s = "", t) => {
|
52
|
-
if (!e) throw new Error("No styles provided to parseStyles function!");
|
53
|
-
const n = /* @__PURE__ */ new Set(), b = Object.entries(e).map(async ([w, r]) => {
|
54
|
-
var y;
|
55
|
-
const i = w.trim(), l = F(i), c = (a, f = ";") => `${l}:${a}${f}`;
|
56
|
-
if (typeof r == "function" && (r = r({ scope: s, config: t })), r instanceof Promise && (r = await r), t != null && t.templates && t.templates[i]) {
|
57
|
-
const f = r.split(".").reduce((o, p) => o[p], t.templates[i]);
|
58
|
-
if (f) {
|
59
|
-
const [o] = await $(f, "");
|
60
|
-
return o;
|
61
|
-
}
|
62
|
-
console.warn(`Template "${i}" with path of "${r}" was not found in config!`);
|
63
|
-
return;
|
64
|
-
}
|
65
|
-
if (typeof r == "object") {
|
66
|
-
if (!r) return;
|
67
|
-
if (r.isColor) return c(r.toString());
|
68
|
-
if (i === "defaultVariants") return;
|
69
|
-
if (i === "variants") {
|
70
|
-
const o = Object.entries(r);
|
71
|
-
for (const [p, m] of o) {
|
72
|
-
if (!m) return;
|
73
|
-
const E = Object.entries(m);
|
74
|
-
for (const [N, h] of E) {
|
75
|
-
if (!h) return;
|
76
|
-
const O = `${s}.${p}-${N}`;
|
77
|
-
(await $(h, O, t)).forEach((M) => n.add(M));
|
78
|
-
}
|
79
|
-
}
|
80
|
-
return;
|
81
|
-
}
|
82
|
-
if (i === "compoundVariants") {
|
83
|
-
for (const o of r) {
|
84
|
-
const { css: p, ...m } = o, E = Object.entries(m).reduce((h, [O, S]) => `${h}.${O}-${S}`, s);
|
85
|
-
(await $(p, E, t)).forEach((h) => n.add(h));
|
86
|
-
}
|
87
|
-
return;
|
88
|
-
}
|
89
|
-
if (i.startsWith("@")) {
|
90
|
-
const o = ((y = t == null ? void 0 : t.mediaQueries) == null ? void 0 : y[i]) || i, p = await V(r, s, t), m = `${o} { ${p} }`;
|
91
|
-
n.add(m);
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
const a = w.includes("&") ? i.replace("&", s) : i.startsWith(":") ? `${s}${i}` : `${s} ${i}`;
|
95
|
-
(await $(r, a, t)).forEach((o) => n.add(o));
|
96
|
-
return;
|
97
|
-
}
|
98
|
-
if (typeof r == "number") {
|
99
|
-
const a = _(l, r, t);
|
100
|
-
return c(a);
|
101
|
-
}
|
102
|
-
if (typeof r != "string")
|
103
|
-
if ("toString" in r) r = r.toString();
|
104
|
-
else throw new Error(`Invalid value type for property ${l}`);
|
105
|
-
return c(r);
|
106
|
-
}), { modifiers: C } = t || {}, P = [U(), H(C)], u = (await Promise.all(b).then((w) => Promise.all(
|
107
|
-
w.map((r) => P.reduce(async (i, l) => {
|
108
|
-
const c = await i;
|
109
|
-
if (!c) return c;
|
110
|
-
const j = await l(c);
|
111
|
-
if (!j) return c;
|
112
|
-
const { transformed: y, additionalCss: a } = j;
|
113
|
-
let f = "";
|
114
|
-
if (a)
|
115
|
-
for (const o of a)
|
116
|
-
f += await V(o, "");
|
117
|
-
return `${f}${y}`;
|
118
|
-
}, Promise.resolve(r)))
|
119
|
-
))).join(`
|
120
|
-
`);
|
121
|
-
if (!u.trim()) return n;
|
122
|
-
const z = s ? `${s} { ${u} }` : u;
|
123
|
-
return n.add(z), n;
|
124
|
-
}, V = async (e, s, t) => [...await $(e, s, t)].join(`
|
125
|
-
`);
|
126
|
-
export {
|
127
|
-
V as p,
|
128
|
-
B as t
|
129
|
-
};
|