@salty-css/react 0.0.1-alpha.218 → 0.0.1-alpha.219
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-E95SeoXv.cjs +5 -0
- package/parse-styles-WRUkAmCD.js +145 -0
- package/styled.cjs +1 -1
- package/styled.js +1 -1
- package/{styles-generator-J1w0wyWR.cjs → styles-generator-CD8r4Qz6.cjs} +1 -1
- package/{styles-generator-UIShikE6.js → styles-generator-CFUD8Yyz.js} +1 -1
- package/parse-styles-CETi3uSg.cjs +0 -5
- package/parse-styles-DsGZQRg0.js +0 -143
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-CD8r4Qz6.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-E95SeoXv.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.219",
|
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.219",
|
66
66
|
"clsx": ">=2.x",
|
67
67
|
"react": ">=19.x || >=18.3.x"
|
68
68
|
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";const N=require("./parse-tokens-DfRKmjt1.cjs"),M=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const i=[];return Object.values(e).forEach(o=>{const{pattern:S,transform:$}=o;t=t.replace(S,j=>{const{value:A,css:b}=$(j);return b&&i.push(b),A})}),{transformed:t,additionalCss:i}},H=e=>String.fromCharCode(e+(e>25?39:97)),T=(e,s)=>{let t="",i;for(i=Math.abs(e);i>52;i=i/52|0)t=H(i%52)+t;return t=H(i%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(o=>typeof o=="string"?o===e:o.test(e))){const o=(t==null?void 0:t.defaultUnit)||"px";return`${s}${o}`}return`${s}`},F=["Webkit","Moz","ms","O"],I=e=>e.startsWith("-")?e:F.some(s=>e.startsWith(s))?`-${N.dashCase(e)}`:N.dashCase(e),y=async(e,s="",t,i=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const o=new Set,S=Object.entries(e),$=async([p,r])=>{var C;const n=p.trim(),w=I(n),l=(d,c=";")=>`${w}:${d}${c}`,P={scope:s,config:t};if(typeof r=="function")return $([p,r(P)]);if(r instanceof Promise)return $([p,await r]);if(t!=null&&t.templates&&t.templatePaths[n])try{const[d,c]=t.templatePaths[n].split(";;"),a=await import(c),f=c.includes("salty.config"),u=f?a[d].templates:a[d],h=f?u[n]:u.params[n];if(u&&typeof h=="function"){const E=await h(r),[m]=await y(E,"");return m}}catch(d){console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`,d);return}if(t!=null&&t.templates&&t.templates[n]){if(i)return;const c=r.split(".").reduce((a,f)=>a[f],t.templates[n]);if(c){const[a]=await y(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 l(r.toString());if(n==="defaultVariants")return;if(n==="variants"){const a=Object.entries(r);for(const[f,u]of a){if(!u)return;const h=Object.entries(u);for(const[E,m]of h){if(!m)return;const x=`${s}.${f}-${E}`;(await y(m,x,t)).forEach(J=>o.add(J))}}return}if(n==="compoundVariants"){for(const a of r){const{css:f,...u}=a,h=Object.entries(u).reduce((m,[x,z])=>`${m}.${x}-${z}`,s);(await y(f,h,t)).forEach(m=>o.add(m))}return}if(n.startsWith("@")){const a=((C=t==null?void 0:t.mediaQueries)==null?void 0:C[n])||n,f=await W(r,s,t),u=`${a} { ${f} }`;o.add(u);return}const d=p.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await y(r,d,t)).forEach(a=>o.add(a));return}if(typeof r=="number"){const d=_(w,r,t);return l(d)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${w}`);return l(r)},j=S.map($),{modifiers:A}=t||{},b=[N.parseValueTokens(),M(A)],O=(await Promise.all(j).then(p=>Promise.all(p.map(r=>b.reduce(async(n,w)=>{const l=await n;if(!l)return l;const P=await w(l);if(!P)return l;const{transformed:C,additionalCss:d}=P;let c="";if(d)for(const a of d)c+=await W(a,"");return`${c}${C}`},Promise.resolve(r)))))).filter(p=>p!==void 0).join(`
|
2
|
+
`);if(!O.trim())return Array.from(o);const V=s?`${s} {
|
3
|
+
${O}
|
4
|
+
}`:O;return o.has(V)?Array.from(o):[V,...o]},W=async(e,s,t,i=!1)=>(await y(e,s,t,i)).join(`
|
5
|
+
`);exports.parseAndJoinStyles=W;exports.toHash=q;
|
@@ -0,0 +1,145 @@
|
|
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 i = [];
|
6
|
+
return Object.values(e).forEach((o) => {
|
7
|
+
const { pattern: j, transform: y } = o;
|
8
|
+
t = t.replace(j, (S) => {
|
9
|
+
const { value: x, css: b } = y(S);
|
10
|
+
return b && i.push(b), x;
|
11
|
+
});
|
12
|
+
}), { transformed: t, additionalCss: i };
|
13
|
+
}, z = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), Q = (e, s) => {
|
14
|
+
let t = "", i;
|
15
|
+
for (i = Math.abs(e); i > 52; i = i / 52 | 0) t = z(i % 52) + t;
|
16
|
+
return t = z(i % 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
|
+
}, K = (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((o) => typeof o == "string" ? o === e : o.test(e))) {
|
47
|
+
const o = (t == null ? void 0 : t.defaultUnit) || "px";
|
48
|
+
return `${s}${o}`;
|
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), $ = async (e, s = "", t, i = !1) => {
|
52
|
+
if (!e) throw new Error("No styles provided to parseStyles function!");
|
53
|
+
const o = /* @__PURE__ */ new Set(), j = Object.entries(e), y = async ([u, r]) => {
|
54
|
+
var E;
|
55
|
+
const n = u.trim(), w = I(n), l = (d, c = ";") => `${w}:${d}${c}`, P = { scope: s, config: t };
|
56
|
+
if (typeof r == "function") return y([u, r(P)]);
|
57
|
+
if (r instanceof Promise) return y([u, await r]);
|
58
|
+
if (t != null && t.templates && t.templatePaths[n])
|
59
|
+
try {
|
60
|
+
const [d, c] = t.templatePaths[n].split(";;"), a = await import(c), f = c.includes("salty.config"), p = f ? a[d].templates : a[d], h = f ? p[n] : p.params[n];
|
61
|
+
if (p && typeof h == "function") {
|
62
|
+
const C = await h(r), [m] = await $(C, "");
|
63
|
+
return m;
|
64
|
+
}
|
65
|
+
} catch (d) {
|
66
|
+
console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`, d);
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
if (t != null && t.templates && t.templates[n]) {
|
70
|
+
if (i) return;
|
71
|
+
const c = r.split(".").reduce((a, f) => a[f], t.templates[n]);
|
72
|
+
if (c) {
|
73
|
+
const [a] = await $(c, "");
|
74
|
+
return a;
|
75
|
+
}
|
76
|
+
console.warn(`Template "${n}" with path of "${r}" was not found in config!`);
|
77
|
+
return;
|
78
|
+
}
|
79
|
+
if (typeof r == "object") {
|
80
|
+
if (!r) return;
|
81
|
+
if (r.isColor) return l(r.toString());
|
82
|
+
if (n === "defaultVariants") return;
|
83
|
+
if (n === "variants") {
|
84
|
+
const a = Object.entries(r);
|
85
|
+
for (const [f, p] of a) {
|
86
|
+
if (!p) return;
|
87
|
+
const h = Object.entries(p);
|
88
|
+
for (const [C, m] of h) {
|
89
|
+
if (!m) return;
|
90
|
+
const A = `${s}.${f}-${C}`;
|
91
|
+
(await $(m, A, t)).forEach((U) => o.add(U));
|
92
|
+
}
|
93
|
+
}
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
if (n === "compoundVariants") {
|
97
|
+
for (const a of r) {
|
98
|
+
const { css: f, ...p } = a, h = Object.entries(p).reduce((m, [A, W]) => `${m}.${A}-${W}`, s);
|
99
|
+
(await $(f, h, t)).forEach((m) => o.add(m));
|
100
|
+
}
|
101
|
+
return;
|
102
|
+
}
|
103
|
+
if (n.startsWith("@")) {
|
104
|
+
const a = ((E = t == null ? void 0 : t.mediaQueries) == null ? void 0 : E[n]) || n, f = await M(r, s, t), p = `${a} { ${f} }`;
|
105
|
+
o.add(p);
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
const d = u.includes("&") ? n.replace("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
|
109
|
+
(await $(r, d, t)).forEach((a) => o.add(a));
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
if (typeof r == "number") {
|
113
|
+
const d = q(w, r, t);
|
114
|
+
return l(d);
|
115
|
+
}
|
116
|
+
if (typeof r != "string")
|
117
|
+
if ("toString" in r) r = r.toString();
|
118
|
+
else throw new Error(`Invalid value type for property ${w}`);
|
119
|
+
return l(r);
|
120
|
+
}, S = j.map(y), { modifiers: x } = t || {}, b = [H(), J(x)], O = (await Promise.all(S).then((u) => Promise.all(
|
121
|
+
u.map((r) => b.reduce(async (n, w) => {
|
122
|
+
const l = await n;
|
123
|
+
if (!l) return l;
|
124
|
+
const P = await w(l);
|
125
|
+
if (!P) return l;
|
126
|
+
const { transformed: E, additionalCss: d } = P;
|
127
|
+
let c = "";
|
128
|
+
if (d)
|
129
|
+
for (const a of d)
|
130
|
+
c += await M(a, "");
|
131
|
+
return `${c}${E}`;
|
132
|
+
}, Promise.resolve(r)))
|
133
|
+
))).filter((u) => u !== void 0).join(`
|
134
|
+
`);
|
135
|
+
if (!O.trim()) return Array.from(o);
|
136
|
+
const N = s ? `${s} {
|
137
|
+
${O}
|
138
|
+
}` : O;
|
139
|
+
return o.has(N) ? Array.from(o) : [N, ...o];
|
140
|
+
}, M = async (e, s, t, i = !1) => (await $(e, s, t, i)).join(`
|
141
|
+
`);
|
142
|
+
export {
|
143
|
+
M as p,
|
144
|
+
K as t
|
145
|
+
};
|
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-CD8r4Qz6.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 +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-E95SeoXv.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,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-WRUkAmCD.js";
|
5
5
|
import { d as n } from "./parse-tokens-CssTiO78.js";
|
6
6
|
class C {
|
7
7
|
constructor(s) {
|
@@ -1,5 +0,0 @@
|
|
1
|
-
"use strict";const O=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:W,transform:P}=i;t=t.replace(W,C=>{const{value:E,css:j}=P(C);return j&&a.push(j),E})}),{transformed:t,additionalCss:a}},H=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=H(a%52)+t;return t=H(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))?`-${O.dashCase(e)}`:O.dashCase(e),y=async(e,s="",t,a=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const i=new Set,P=Object.entries(e).map(async([m,r])=>{var w;const n=m.trim(),$=I(n),u=(d,c=";")=>`${$}:${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])try{const[d,c]=t.templatePaths[n].split(";;"),o=await import(c),f=c.includes("salty.config"),p=f?o[d].templates:o[d],h=f?p[n]:p.params[n];if(p&&typeof h=="function"){const b=await h(r),[l]=await y(b,"");return l}}catch(d){console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`,d);return}if(t!=null&&t.templates&&t.templates[n]){if(a)return;const c=r.split(".").reduce((o,f)=>o[f],t.templates[n]);if(c){const[o]=await y(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 u(r.toString());if(n==="defaultVariants")return;if(n==="variants"){const o=Object.entries(r);for(const[f,p]of o){if(!p)return;const h=Object.entries(p);for(const[b,l]of h){if(!l)return;const A=`${s}.${f}-${b}`;(await y(l,A,t)).forEach(J=>i.add(J))}}return}if(n==="compoundVariants"){for(const o of r){const{css:f,...p}=o,h=Object.entries(p).reduce((l,[A,z])=>`${l}.${A}-${z}`,s);(await y(f,h,t)).forEach(l=>i.add(l))}return}if(n.startsWith("@")){const o=((w=t==null?void 0:t.mediaQueries)==null?void 0:w[n])||n,f=await N(r,s,t),p=`${o} { ${f} }`;i.add(p);return}const d=m.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await y(r,d,t)).forEach(o=>i.add(o));return}if(typeof r=="number"){const d=_($,r,t);return u(d)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${$}`);return u(r)}),{modifiers:C}=t||{},E=[O.parseValueTokens(),M(C)],S=(await Promise.all(P).then(m=>Promise.all(m.map(r=>E.reduce(async(n,$)=>{const u=await n;if(!u)return u;const x=await $(u);if(!x)return u;const{transformed:w,additionalCss:d}=x;let c="";if(d)for(const o of d)c+=await N(o,"");return`${c}${w}`},Promise.resolve(r)))))).filter(m=>m!==void 0).join(`
|
2
|
-
`);if(!S.trim())return Array.from(i);const V=s?`${s} {
|
3
|
-
${S}
|
4
|
-
}`:S;return i.has(V)?Array.from(i):[V,...i]},N=async(e,s,t,a=!1)=>(await y(e,s,t,a)).join(`
|
5
|
-
`);exports.parseAndJoinStyles=N;exports.toHash=q;
|
package/parse-styles-DsGZQRg0.js
DELETED
@@ -1,143 +0,0 @@
|
|
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 a = [];
|
6
|
-
return Object.values(e).forEach((o) => {
|
7
|
-
const { pattern: A, transform: P } = o;
|
8
|
-
t = t.replace(A, (C) => {
|
9
|
-
const { value: E, css: j } = P(C);
|
10
|
-
return j && a.push(j), E;
|
11
|
-
});
|
12
|
-
}), { transformed: t, additionalCss: a };
|
13
|
-
}, z = (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 = z(a % 52) + t;
|
16
|
-
return t = z(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
|
-
}, 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((o) => typeof o == "string" ? o === e : o.test(e))) {
|
47
|
-
const o = (t == null ? void 0 : t.defaultUnit) || "px";
|
48
|
-
return `${s}${o}`;
|
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), $ = async (e, s = "", t, a = !1) => {
|
52
|
-
if (!e) throw new Error("No styles provided to parseStyles function!");
|
53
|
-
const o = /* @__PURE__ */ new Set(), P = Object.entries(e).map(async ([m, r]) => {
|
54
|
-
var w;
|
55
|
-
const n = m.trim(), y = I(n), u = (d, c = ";") => `${y}:${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
|
-
try {
|
58
|
-
const [d, c] = t.templatePaths[n].split(";;"), i = await import(c), f = c.includes("salty.config"), p = f ? i[d].templates : i[d], h = f ? p[n] : p.params[n];
|
59
|
-
if (p && typeof h == "function") {
|
60
|
-
const b = await h(r), [l] = await $(b, "");
|
61
|
-
return l;
|
62
|
-
}
|
63
|
-
} catch (d) {
|
64
|
-
console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`, d);
|
65
|
-
return;
|
66
|
-
}
|
67
|
-
if (t != null && t.templates && t.templates[n]) {
|
68
|
-
if (a) return;
|
69
|
-
const c = r.split(".").reduce((i, f) => i[f], t.templates[n]);
|
70
|
-
if (c) {
|
71
|
-
const [i] = await $(c, "");
|
72
|
-
return i;
|
73
|
-
}
|
74
|
-
console.warn(`Template "${n}" with path of "${r}" was not found in config!`);
|
75
|
-
return;
|
76
|
-
}
|
77
|
-
if (typeof r == "object") {
|
78
|
-
if (!r) return;
|
79
|
-
if (r.isColor) return u(r.toString());
|
80
|
-
if (n === "defaultVariants") return;
|
81
|
-
if (n === "variants") {
|
82
|
-
const i = Object.entries(r);
|
83
|
-
for (const [f, p] of i) {
|
84
|
-
if (!p) return;
|
85
|
-
const h = Object.entries(p);
|
86
|
-
for (const [b, l] of h) {
|
87
|
-
if (!l) return;
|
88
|
-
const S = `${s}.${f}-${b}`;
|
89
|
-
(await $(l, S, t)).forEach((U) => o.add(U));
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
if (n === "compoundVariants") {
|
95
|
-
for (const i of r) {
|
96
|
-
const { css: f, ...p } = i, h = Object.entries(p).reduce((l, [S, W]) => `${l}.${S}-${W}`, s);
|
97
|
-
(await $(f, h, t)).forEach((l) => o.add(l));
|
98
|
-
}
|
99
|
-
return;
|
100
|
-
}
|
101
|
-
if (n.startsWith("@")) {
|
102
|
-
const i = ((w = t == null ? void 0 : t.mediaQueries) == null ? void 0 : w[n]) || n, f = await M(r, s, t), p = `${i} { ${f} }`;
|
103
|
-
o.add(p);
|
104
|
-
return;
|
105
|
-
}
|
106
|
-
const d = m.includes("&") ? n.replace("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
|
107
|
-
(await $(r, d, t)).forEach((i) => o.add(i));
|
108
|
-
return;
|
109
|
-
}
|
110
|
-
if (typeof r == "number") {
|
111
|
-
const d = q(y, r, t);
|
112
|
-
return u(d);
|
113
|
-
}
|
114
|
-
if (typeof r != "string")
|
115
|
-
if ("toString" in r) r = r.toString();
|
116
|
-
else throw new Error(`Invalid value type for property ${y}`);
|
117
|
-
return u(r);
|
118
|
-
}), { modifiers: C } = t || {}, E = [H(), J(C)], x = (await Promise.all(P).then((m) => Promise.all(
|
119
|
-
m.map((r) => E.reduce(async (n, y) => {
|
120
|
-
const u = await n;
|
121
|
-
if (!u) return u;
|
122
|
-
const O = await y(u);
|
123
|
-
if (!O) return u;
|
124
|
-
const { transformed: w, additionalCss: d } = O;
|
125
|
-
let c = "";
|
126
|
-
if (d)
|
127
|
-
for (const i of d)
|
128
|
-
c += await M(i, "");
|
129
|
-
return `${c}${w}`;
|
130
|
-
}, Promise.resolve(r)))
|
131
|
-
))).filter((m) => m !== void 0).join(`
|
132
|
-
`);
|
133
|
-
if (!x.trim()) return Array.from(o);
|
134
|
-
const N = s ? `${s} {
|
135
|
-
${x}
|
136
|
-
}` : x;
|
137
|
-
return o.has(N) ? Array.from(o) : [N, ...o];
|
138
|
-
}, M = async (e, s, t, a = !1) => (await $(e, s, t, a)).join(`
|
139
|
-
`);
|
140
|
-
export {
|
141
|
-
M as p,
|
142
|
-
G as t
|
143
|
-
};
|