@salty-css/react 0.0.1-alpha.207 → 0.0.1-alpha.209
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-BJ7Coj_x.js +139 -0
- package/parse-styles-Chqrd-Ic.cjs +5 -0
- package/styled.cjs +1 -1
- package/styled.js +1 -1
- package/{styles-generator-u7zuyRNK.js → styles-generator-DLj4QdG_.js} +1 -1
- package/{styles-generator-RdL74aZ6.cjs → styles-generator-DlpxCPs6.cjs} +1 -1
- package/parse-styles-DJxMVgvl.cjs +0 -3
- package/parse-styles-Dytk8Vyz.js +0 -137
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-DlpxCPs6.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},generator: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-Chqrd-Ic.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.209",
|
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.209",
|
66
66
|
"clsx": ">=2.x",
|
67
67
|
"react": ">=19.x || >=18.3.x"
|
68
68
|
}
|
@@ -0,0 +1,139 @@
|
|
1
|
+
import { d as V, a as H } from "./parse-tokens-CssTiO78.js";
|
2
|
+
const J = (e) => (s) => {
|
3
|
+
if (typeof s != "string" || !e) return;
|
4
|
+
let t = s;
|
5
|
+
const o = [];
|
6
|
+
return Object.values(e).forEach((i) => {
|
7
|
+
const { pattern: A, transform: y } = i;
|
8
|
+
t = t.replace(A, (b) => {
|
9
|
+
const { value: P, css: C } = y(b);
|
10
|
+
return C && o.push(C), P;
|
11
|
+
});
|
12
|
+
}), { transformed: t, additionalCss: o };
|
13
|
+
}, z = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), Q = (e, s) => {
|
14
|
+
let t = "", o;
|
15
|
+
for (o = Math.abs(e); o > 52; o = o / 52 | 0) t = z(o % 52) + t;
|
16
|
+
return t = z(o % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
|
17
|
+
}, T = (e, s) => {
|
18
|
+
let t = s.length;
|
19
|
+
for (; t; ) e = e * 33 ^ s.charCodeAt(--t);
|
20
|
+
return e;
|
21
|
+
}, G = (e, s = 5) => {
|
22
|
+
const t = T(5381, JSON.stringify(e)) >>> 0;
|
23
|
+
return Q(t, s);
|
24
|
+
}, _ = [
|
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
|
+
], q = (e, s, t) => {
|
46
|
+
if (_.some((i) => typeof i == "string" ? i === e : i.test(e))) {
|
47
|
+
const i = (t == null ? void 0 : t.defaultUnit) || "px";
|
48
|
+
return `${s}${i}`;
|
49
|
+
}
|
50
|
+
return `${s}`;
|
51
|
+
}, F = ["Webkit", "Moz", "ms", "O"], I = (e) => e.startsWith("-") ? e : F.some((s) => e.startsWith(s)) ? `-${V(e)}` : V(e), h = async (e, s = "", t, o = !1) => {
|
52
|
+
if (!e) throw new Error("No styles provided to parseStyles function!");
|
53
|
+
const i = /* @__PURE__ */ new Set(), y = Object.entries(e).map(async ([u, r]) => {
|
54
|
+
var $;
|
55
|
+
const n = u.trim(), w = I(n), c = (d, f = ";") => `${w}:${d}${f}`;
|
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: d } = await import(t.templatePaths[n]);
|
58
|
+
if (typeof d.params[n] == "function") {
|
59
|
+
const f = await d.params[n](r), [a] = await h(f, "");
|
60
|
+
return a;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
if (t != null && t.templates && t.templates[n]) {
|
64
|
+
if (o) return;
|
65
|
+
const f = r.split(".").reduce((a, p) => a[p], t.templates[n]);
|
66
|
+
if (f) {
|
67
|
+
const [a] = await h(f, "");
|
68
|
+
return a;
|
69
|
+
}
|
70
|
+
console.warn(`Template "${n}" with path of "${r}" was not found in config!`);
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
if (typeof r == "object") {
|
74
|
+
if (!r) return;
|
75
|
+
if (r.isColor) return c(r.toString());
|
76
|
+
if (n === "defaultVariants") return;
|
77
|
+
if (n === "variants") {
|
78
|
+
const a = Object.entries(r);
|
79
|
+
for (const [p, l] of a) {
|
80
|
+
if (!l) return;
|
81
|
+
const x = Object.entries(l);
|
82
|
+
for (const [N, m] of x) {
|
83
|
+
if (!m) return;
|
84
|
+
const O = `${s}.${p}-${N}`;
|
85
|
+
(await h(m, O, t)).forEach((U) => i.add(U));
|
86
|
+
}
|
87
|
+
}
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
if (n === "compoundVariants") {
|
91
|
+
for (const a of r) {
|
92
|
+
const { css: p, ...l } = a, x = Object.entries(l).reduce((m, [O, W]) => `${m}.${O}-${W}`, s);
|
93
|
+
(await h(p, x, t)).forEach((m) => i.add(m));
|
94
|
+
}
|
95
|
+
return;
|
96
|
+
}
|
97
|
+
if (n.startsWith("@")) {
|
98
|
+
const a = (($ = t == null ? void 0 : t.mediaQueries) == null ? void 0 : $[n]) || n, p = await M(r, s, t), l = `${a} { ${p} }`;
|
99
|
+
i.add(l);
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
const d = u.includes("&") ? n.replace("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
|
103
|
+
(await h(r, d, t)).forEach((a) => i.add(a));
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
if (typeof r == "number") {
|
107
|
+
const d = q(w, r, t);
|
108
|
+
return c(d);
|
109
|
+
}
|
110
|
+
if (typeof r != "string")
|
111
|
+
if ("toString" in r) r = r.toString();
|
112
|
+
else throw new Error(`Invalid value type for property ${w}`);
|
113
|
+
return c(r);
|
114
|
+
}), { modifiers: b } = t || {}, P = [H(), J(b)], E = (await Promise.all(y).then((u) => Promise.all(
|
115
|
+
u.map((r) => P.reduce(async (n, w) => {
|
116
|
+
const c = await n;
|
117
|
+
if (!c) return c;
|
118
|
+
const j = await w(c);
|
119
|
+
if (!j) return c;
|
120
|
+
const { transformed: $, additionalCss: d } = j;
|
121
|
+
let f = "";
|
122
|
+
if (d)
|
123
|
+
for (const a of d)
|
124
|
+
f += await M(a, "");
|
125
|
+
return `${f}${$}`;
|
126
|
+
}, Promise.resolve(r)))
|
127
|
+
))).filter((u) => u !== void 0).join(`
|
128
|
+
`);
|
129
|
+
if (!E.trim()) return Array.from(i);
|
130
|
+
const S = s ? `${s} {
|
131
|
+
${E}
|
132
|
+
}` : E;
|
133
|
+
return i.has(S) ? Array.from(i) : [S, ...i];
|
134
|
+
}, M = async (e, s, t, o = !1) => (await h(e, s, t, o)).join(`
|
135
|
+
`);
|
136
|
+
export {
|
137
|
+
M as p,
|
138
|
+
G as t
|
139
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";const O=require("./parse-tokens-DfRKmjt1.cjs"),M=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const o=[];return Object.values(e).forEach(i=>{const{pattern:N,transform:y}=i;t=t.replace(N,b=>{const{value:P,css:C}=y(b);return C&&o.push(C),P})}),{transformed:t,additionalCss:o}},H=e=>String.fromCharCode(e+(e>25?39:97)),T=(e,s)=>{let t="",o;for(o=Math.abs(e);o>52;o=o/52|0)t=H(o%52)+t;return t=H(o%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},U=(e,s)=>{let t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return e},q=(e,s=5)=>{const t=U(5381,JSON.stringify(e))>>>0;return T(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.*/],_=(e,s,t)=>{if(Q.some(i=>typeof i=="string"?i===e:i.test(e))){const i=(t==null?void 0:t.defaultUnit)||"px";return`${s}${i}`}return`${s}`},F=["Webkit","Moz","ms","O"],I=e=>e.startsWith("-")?e:F.some(s=>e.startsWith(s))?`-${O.dashCase(e)}`:O.dashCase(e),h=async(e,s="",t,o=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const i=new Set,y=Object.entries(e).map(async([p,r])=>{var $;const n=p.trim(),w=I(n),f=(d,c=";")=>`${w}:${d}${c}`;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:d}=await import(t.templatePaths[n]);if(typeof d.params[n]=="function"){const c=await d.params[n](r),[a]=await h(c,"");return a}}if(t!=null&&t.templates&&t.templates[n]){if(o)return;const c=r.split(".").reduce((a,u)=>a[u],t.templates[n]);if(c){const[a]=await h(c,"");return a}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 a=Object.entries(r);for(const[u,l]of a){if(!l)return;const x=Object.entries(l);for(const[V,m]of x){if(!m)return;const A=`${s}.${u}-${V}`;(await h(m,A,t)).forEach(J=>i.add(J))}}return}if(n==="compoundVariants"){for(const a of r){const{css:u,...l}=a,x=Object.entries(l).reduce((m,[A,z])=>`${m}.${A}-${z}`,s);(await h(u,x,t)).forEach(m=>i.add(m))}return}if(n.startsWith("@")){const a=(($=t==null?void 0:t.mediaQueries)==null?void 0:$[n])||n,u=await S(r,s,t),l=`${a} { ${u} }`;i.add(l);return}const d=p.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await h(r,d,t)).forEach(a=>i.add(a));return}if(typeof r=="number"){const d=_(w,r,t);return f(d)}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:b}=t||{},P=[O.parseValueTokens(),M(b)],E=(await Promise.all(y).then(p=>Promise.all(p.map(r=>P.reduce(async(n,w)=>{const f=await n;if(!f)return f;const j=await w(f);if(!j)return f;const{transformed:$,additionalCss:d}=j;let c="";if(d)for(const a of d)c+=await S(a,"");return`${c}${$}`},Promise.resolve(r)))))).filter(p=>p!==void 0).join(`
|
2
|
+
`);if(!E.trim())return Array.from(i);const W=s?`${s} {
|
3
|
+
${E}
|
4
|
+
}`:E;return i.has(W)?Array.from(i):[W,...i]},S=async(e,s,t,o=!1)=>(await h(e,s,t,o)).join(`
|
5
|
+
`);exports.parseAndJoinStyles=S;exports.toHash=q;
|
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-DlpxCPs6.cjs"),g=require("./element-factory-DjYdX8Jd.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,7 +1,7 @@
|
|
1
1
|
var c = Object.defineProperty;
|
2
2
|
var l = (a, s, t) => s in a ? c(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
|
3
3
|
var o = (a, s, t) => l(a, typeof s != "symbol" ? s + "" : s, t);
|
4
|
-
import { t as h, p as m } from "./parse-styles-
|
4
|
+
import { t as h, p as m } from "./parse-styles-BJ7Coj_x.js";
|
5
5
|
import { d as n } from "./parse-tokens-CssTiO78.js";
|
6
6
|
class C {
|
7
7
|
constructor(s) {
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var c=Object.defineProperty;var l=(a,s,t)=>s in a?c(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var h=(a,s,t)=>l(a,typeof s!="symbol"?s+"":s,t);const n=require("./parse-styles-
|
1
|
+
"use strict";var c=Object.defineProperty;var l=(a,s,t)=>s in a?c(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var h=(a,s,t)=>l(a,typeof s!="symbol"?s+"":s,t);const n=require("./parse-styles-Chqrd-Ic.cjs"),o=require("./parse-tokens-DfRKmjt1.cjs");class u{constructor(s){h(this,"buildContext",{});this.params=s}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){return n.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=new Set([this.cssClassName]),{className:t}=this.params;return typeof t=="string"&&s.add(t),typeof t=="object"&&t.forEach(e=>s.add(e)),this.getTemplateClasses().forEach(e=>s.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>s.add(e)),[...s].join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${o.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:e=[]}=this.params,{config:r}=this.buildContext,i={...s,variants:t,compoundVariants:e};return n.parseAndJoinStyles(i,`.${this.cssClassName}`,r,this.isRoot)}getTemplateClasses(s=this.buildContext.config){if(!(s!=null&&s.templates)||!this.params.base||this.priority>0)return[];const t=Object.keys(s.templates);return Object.entries(this.params.base).reduce((e,[r,i])=>(t.includes(r)&&e.push("t_"+n.toHash(o.dashCase(`${r}-${i}`),4)),e),[])}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
|
@@ -1,3 +0,0 @@
|
|
1
|
-
"use strict";const x=require("./parse-tokens-DfRKmjt1.cjs"),M=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const a=[];return Object.values(e).forEach(i=>{const{pattern:N,transform:y}=i;t=t.replace(N,b=>{const{value:P,css:C}=y(b);return C&&a.push(C),P})}),{transformed:t,additionalCss:a}},z=e=>String.fromCharCode(e+(e>25?39:97)),T=(e,s)=>{let t="",a;for(a=Math.abs(e);a>52;a=a/52|0)t=z(a%52)+t;return t=z(a%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},U=(e,s)=>{let t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return e},q=(e,s=5)=>{const t=U(5381,JSON.stringify(e))>>>0;return T(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.*/],_=(e,s,t)=>{if(Q.some(i=>typeof i=="string"?i===e:i.test(e))){const i=(t==null?void 0:t.defaultUnit)||"px";return`${s}${i}`}return`${s}`},F=["Webkit","Moz","ms","O"],I=e=>e.startsWith("-")?e:F.some(s=>e.startsWith(s))?`-${x.dashCase(e)}`:x.dashCase(e),m=async(e,s="",t,a=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const i=new Set,y=Object.entries(e).map(async([w,r])=>{var $;const n=w.trim(),h=I(n),f=(d,c=";")=>`${h}:${d}${c}`;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:d}=await import(t.templatePaths[n]);if(typeof d.params[n]=="function"){const c=await d.params[n](r),[o]=await m(c,"");return o}}if(t!=null&&t.templates&&t.templates[n]){if(a)return;const c=r.split(".").reduce((o,u)=>o[u],t.templates[n]);if(c){const[o]=await m(c,"");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[u,p]of o){if(!p)return;const O=Object.entries(p);for(const[W,l]of O){if(!l)return;const S=`${s}.${u}-${W}`;(await m(l,S,t)).forEach(J=>i.add(J))}}return}if(n==="compoundVariants"){for(const o of r){const{css:u,...p}=o,O=Object.entries(p).reduce((l,[S,V])=>`${l}.${S}-${V}`,s);(await m(u,O,t)).forEach(l=>i.add(l))}return}if(n.startsWith("@")){const o=(($=t==null?void 0:t.mediaQueries)==null?void 0:$[n])||n,u=await A(r,s,t),p=`${o} { ${u} }`;i.add(p);return}const d=w.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await m(r,d,t)).forEach(o=>i.add(o));return}if(typeof r=="number"){const d=_(h,r,t);return f(d)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${h}`);return f(r)}),{modifiers:b}=t||{},P=[x.parseValueTokens(),M(b)],j=(await Promise.all(y).then(w=>Promise.all(w.map(r=>P.reduce(async(n,h)=>{const f=await n;if(!f)return f;const E=await h(f);if(!E)return f;const{transformed:$,additionalCss:d}=E;let c="";if(d)for(const o of d)c+=await A(o,"");return`${c}${$}`},Promise.resolve(r)))))).join(`
|
2
|
-
`);if(!j.trim())return i;const H=s?`${s} { ${j} }`:j;return i.add(H),i},A=async(e,s,t,a=!1)=>[...await m(e,s,t,a)].join(`
|
3
|
-
`);exports.parseAndJoinStyles=A;exports.toHash=q;
|
package/parse-styles-Dytk8Vyz.js
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
import { d as A, a as H } from "./parse-tokens-CssTiO78.js";
|
2
|
-
const J = (e) => (s) => {
|
3
|
-
if (typeof s != "string" || !e) return;
|
4
|
-
let t = s;
|
5
|
-
const a = [];
|
6
|
-
return Object.values(e).forEach((i) => {
|
7
|
-
const { pattern: S, transform: y } = i;
|
8
|
-
t = t.replace(S, (b) => {
|
9
|
-
const { value: P, css: C } = y(b);
|
10
|
-
return C && a.push(C), P;
|
11
|
-
});
|
12
|
-
}), { transformed: t, additionalCss: a };
|
13
|
-
}, V = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), Q = (e, s) => {
|
14
|
-
let t = "", a;
|
15
|
-
for (a = Math.abs(e); a > 52; a = a / 52 | 0) t = V(a % 52) + t;
|
16
|
-
return t = V(a % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
|
17
|
-
}, T = (e, s) => {
|
18
|
-
let t = s.length;
|
19
|
-
for (; t; ) e = e * 33 ^ s.charCodeAt(--t);
|
20
|
-
return e;
|
21
|
-
}, D = (e, s = 5) => {
|
22
|
-
const t = T(5381, JSON.stringify(e)) >>> 0;
|
23
|
-
return Q(t, s);
|
24
|
-
}, _ = [
|
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
|
-
], q = (e, s, t) => {
|
46
|
-
if (_.some((i) => typeof i == "string" ? i === e : i.test(e))) {
|
47
|
-
const i = (t == null ? void 0 : t.defaultUnit) || "px";
|
48
|
-
return `${s}${i}`;
|
49
|
-
}
|
50
|
-
return `${s}`;
|
51
|
-
}, F = ["Webkit", "Moz", "ms", "O"], I = (e) => e.startsWith("-") ? e : F.some((s) => e.startsWith(s)) ? `-${A(e)}` : A(e), m = async (e, s = "", t, a = !1) => {
|
52
|
-
if (!e) throw new Error("No styles provided to parseStyles function!");
|
53
|
-
const i = /* @__PURE__ */ new Set(), y = Object.entries(e).map(async ([w, r]) => {
|
54
|
-
var $;
|
55
|
-
const n = w.trim(), h = I(n), f = (d, c = ";") => `${h}:${d}${c}`;
|
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: d } = await import(t.templatePaths[n]);
|
58
|
-
if (typeof d.params[n] == "function") {
|
59
|
-
const c = await d.params[n](r), [o] = await m(c, "");
|
60
|
-
return o;
|
61
|
-
}
|
62
|
-
}
|
63
|
-
if (t != null && t.templates && t.templates[n]) {
|
64
|
-
if (a) return;
|
65
|
-
const c = r.split(".").reduce((o, p) => o[p], t.templates[n]);
|
66
|
-
if (c) {
|
67
|
-
const [o] = await m(c, "");
|
68
|
-
return o;
|
69
|
-
}
|
70
|
-
console.warn(`Template "${n}" with path of "${r}" was not found in config!`);
|
71
|
-
return;
|
72
|
-
}
|
73
|
-
if (typeof r == "object") {
|
74
|
-
if (!r) return;
|
75
|
-
if (r.isColor) return f(r.toString());
|
76
|
-
if (n === "defaultVariants") return;
|
77
|
-
if (n === "variants") {
|
78
|
-
const o = Object.entries(r);
|
79
|
-
for (const [p, u] of o) {
|
80
|
-
if (!u) return;
|
81
|
-
const O = Object.entries(u);
|
82
|
-
for (const [N, l] of O) {
|
83
|
-
if (!l) return;
|
84
|
-
const x = `${s}.${p}-${N}`;
|
85
|
-
(await m(l, x, t)).forEach((U) => i.add(U));
|
86
|
-
}
|
87
|
-
}
|
88
|
-
return;
|
89
|
-
}
|
90
|
-
if (n === "compoundVariants") {
|
91
|
-
for (const o of r) {
|
92
|
-
const { css: p, ...u } = o, O = Object.entries(u).reduce((l, [x, W]) => `${l}.${x}-${W}`, s);
|
93
|
-
(await m(p, O, t)).forEach((l) => i.add(l));
|
94
|
-
}
|
95
|
-
return;
|
96
|
-
}
|
97
|
-
if (n.startsWith("@")) {
|
98
|
-
const o = (($ = t == null ? void 0 : t.mediaQueries) == null ? void 0 : $[n]) || n, p = await z(r, s, t), u = `${o} { ${p} }`;
|
99
|
-
i.add(u);
|
100
|
-
return;
|
101
|
-
}
|
102
|
-
const d = w.includes("&") ? n.replace("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
|
103
|
-
(await m(r, d, t)).forEach((o) => i.add(o));
|
104
|
-
return;
|
105
|
-
}
|
106
|
-
if (typeof r == "number") {
|
107
|
-
const d = q(h, r, t);
|
108
|
-
return f(d);
|
109
|
-
}
|
110
|
-
if (typeof r != "string")
|
111
|
-
if ("toString" in r) r = r.toString();
|
112
|
-
else throw new Error(`Invalid value type for property ${h}`);
|
113
|
-
return f(r);
|
114
|
-
}), { modifiers: b } = t || {}, P = [H(), J(b)], j = (await Promise.all(y).then((w) => Promise.all(
|
115
|
-
w.map((r) => P.reduce(async (n, h) => {
|
116
|
-
const f = await n;
|
117
|
-
if (!f) return f;
|
118
|
-
const E = await h(f);
|
119
|
-
if (!E) return f;
|
120
|
-
const { transformed: $, additionalCss: d } = E;
|
121
|
-
let c = "";
|
122
|
-
if (d)
|
123
|
-
for (const o of d)
|
124
|
-
c += await z(o, "");
|
125
|
-
return `${c}${$}`;
|
126
|
-
}, Promise.resolve(r)))
|
127
|
-
))).join(`
|
128
|
-
`);
|
129
|
-
if (!j.trim()) return i;
|
130
|
-
const M = s ? `${s} { ${j} }` : j;
|
131
|
-
return i.add(M), i;
|
132
|
-
}, z = async (e, s, t, a = !1) => [...await m(e, s, t, a)].join(`
|
133
|
-
`);
|
134
|
-
export {
|
135
|
-
z as p,
|
136
|
-
D as t
|
137
|
-
};
|