@salty-css/core 0.0.1-alpha.210 → 0.0.1-alpha.211
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/bin/main.cjs +1 -1
- package/bin/main.js +1 -1
- package/compiler/index.cjs +1 -1
- package/compiler/index.js +11 -10
- package/config/index.cjs +1 -1
- package/config/index.js +10 -9
- package/css/keyframes.cjs +1 -1
- package/css/keyframes.js +1 -1
- package/define-templates-4A2yHcMF.js +52 -0
- package/define-templates-Cunsb_Tr.cjs +1 -0
- package/generators/index.cjs +1 -1
- package/generators/index.js +1 -1
- package/index-B6M9WK93.cjs +38 -0
- package/index-B_bv7TCc.js +503 -0
- package/package.json +1 -1
- package/parse-styles-C6OYNcYI.cjs +5 -0
- package/parse-styles-Cc_Ir3PV.js +132 -0
- package/parsers/index.cjs +1 -1
- package/parsers/index.js +18 -64
- package/server/index.cjs +1 -1
- package/server/index.js +1 -1
- package/index-B9PS8nEw.cjs +0 -38
- package/index-BzhU5E_2.js +0 -502
- package/parse-styles-B4adoYza.cjs +0 -5
- package/parse-styles-Bi-5cRYF.js +0 -128
@@ -1,5 +0,0 @@
|
|
1
|
-
"use strict";const V=require("./dash-case-BJEkFEGQ.cjs"),U=i=>e=>{if(typeof e!="string"||!i)return;let t=e;const f=[];return Object.values(i).forEach(n=>{const{pattern:b,transform:P}=n;t=t.replace(b,E=>{const{value:j,css:C}=P(E);return C&&f.push(C),j})}),{transformed:t,additionalCss:f}},S=i=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V.dashCase(n[1].replaceAll(".","-"))})`)},q=S(),J=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],M=(i,e,t)=>{if(J.some(n=>typeof n=="string"?n===i:n.test(i))){const n=(t==null?void 0:t.defaultUnit)||"px";return`${e}${n}`}return`${e}`},Q=["Webkit","Moz","ms","O"],_=i=>i.startsWith("-")?i:Q.some(e=>i.startsWith(e))?`-${V.dashCase(i)}`:V.dashCase(i),h=async(i,e="",t,f=!1)=>{if(!i)throw new Error("No styles provided to parseStyles function!");const n=new Set,P=Object.entries(i).map(async([l,s])=>{var y;const r=l.trim(),$=_(r),u=(o,c=";")=>`${$}:${o}${c}`;if(typeof s=="function"&&(s=s({scope:e,config:t})),s instanceof Promise&&(s=await s),t!=null&&t.templates&&t.templatePaths[r]){const[o,c]=t.templatePaths[r].split(";;"),d=(await import(c))[o];if(d&&typeof d.params[r]=="function"){const p=await d.params[r](s),[w]=await h(p,"");return w}}if(t!=null&&t.templates&&t.templates[r]){if(f)return;const c=s.split(".").reduce((a,d)=>a[d],t.templates[r]);if(c){const[a]=await h(c,"");return a}console.warn(`Template "${r}" with path of "${s}" was not found in config!`);return}if(typeof s=="object"){if(!s)return;if(s.isColor)return u(s.toString());if(r==="defaultVariants")return;if(r==="variants"){const a=Object.entries(s);for(const[d,p]of a){if(!p)return;const w=Object.entries(p);for(const[k,m]of w){if(!m)return;const T=`${e}.${d}-${k}`;(await h(m,T,t)).forEach(z=>n.add(z))}}return}if(r==="compoundVariants"){for(const a of s){const{css:d,...p}=a,w=Object.entries(p).reduce((m,[T,N])=>`${m}.${T}-${N}`,e);(await h(d,w,t)).forEach(m=>n.add(m))}return}if(r.startsWith("@")){const a=((y=t==null?void 0:t.mediaQueries)==null?void 0:y[r])||r,d=await A(s,e,t),p=`${a} { ${d} }`;n.add(p);return}const o=l.includes("&")?r.replace("&",e):r.startsWith(":")?`${e}${r}`:`${e} ${r}`;(await h(s,o,t)).forEach(a=>n.add(a));return}if(typeof s=="number"){const o=M($,s,t);return u(o)}if(typeof s!="string")if("toString"in s)s=s.toString();else throw new Error(`Invalid value type for property ${$}`);return u(s)}),{modifiers:E}=t||{},j=[S(),U(E)],x=(await Promise.all(P).then(l=>Promise.all(l.map(s=>j.reduce(async(r,$)=>{const u=await r;if(!u)return u;const O=await $(u);if(!O)return u;const{transformed:y,additionalCss:o}=O;let c="";if(o)for(const a of o)c+=await A(a,"");return`${c}${y}`},Promise.resolve(s)))))).filter(l=>l!==void 0).join(`
|
2
|
-
`);if(!x.trim())return Array.from(n);const W=e?`${e} {
|
3
|
-
${x}
|
4
|
-
}`:x;return n.has(W)?Array.from(n):[W,...n]},A=async(i,e,t,f=!1)=>(await h(i,e,t,f)).join(`
|
5
|
-
`);exports.parseAndJoinStyles=A;exports.parseVariableTokens=q;
|
package/parse-styles-Bi-5cRYF.js
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
import { d as V } from "./dash-case-DBThphLm.js";
|
2
|
-
const U = (i) => (e) => {
|
3
|
-
if (typeof e != "string" || !i) return;
|
4
|
-
let t = e;
|
5
|
-
const c = [];
|
6
|
-
return Object.values(i).forEach((n) => {
|
7
|
-
const { pattern: b, transform: P } = n;
|
8
|
-
t = t.replace(b, (E) => {
|
9
|
-
const { value: j, css: x } = P(E);
|
10
|
-
return x && c.push(x), j;
|
11
|
-
});
|
12
|
-
}), { transformed: t, additionalCss: c };
|
13
|
-
}, z = (i) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...n) => `var(--${V(n[1].replaceAll(".", "-"))})`) }, J = z(), M = [
|
14
|
-
"top",
|
15
|
-
"right",
|
16
|
-
"bottom",
|
17
|
-
"left",
|
18
|
-
"min-width",
|
19
|
-
/.*width.*/,
|
20
|
-
/^[^line]*height.*/,
|
21
|
-
// Exclude line-height
|
22
|
-
/padding.*/,
|
23
|
-
/margin.*/,
|
24
|
-
/border.*/,
|
25
|
-
/inset.*/,
|
26
|
-
/.*radius.*/,
|
27
|
-
/.*spacing.*/,
|
28
|
-
/.*gap.*/,
|
29
|
-
/.*indent.*/,
|
30
|
-
/.*offset.*/,
|
31
|
-
/.*size.*/,
|
32
|
-
/.*thickness.*/,
|
33
|
-
/.*font-size.*/
|
34
|
-
], Q = (i, e, t) => {
|
35
|
-
if (M.some((n) => typeof n == "string" ? n === i : n.test(i))) {
|
36
|
-
const n = (t == null ? void 0 : t.defaultUnit) || "px";
|
37
|
-
return `${e}${n}`;
|
38
|
-
}
|
39
|
-
return `${e}`;
|
40
|
-
}, _ = ["Webkit", "Moz", "ms", "O"], q = (i) => i.startsWith("-") ? i : _.some((e) => i.startsWith(e)) ? `-${V(i)}` : V(i), h = async (i, e = "", t, c = !1) => {
|
41
|
-
if (!i) throw new Error("No styles provided to parseStyles function!");
|
42
|
-
const n = /* @__PURE__ */ new Set(), P = Object.entries(i).map(async ([m, s]) => {
|
43
|
-
var y;
|
44
|
-
const r = m.trim(), $ = q(r), p = (a, f = ";") => `${$}:${a}${f}`;
|
45
|
-
if (typeof s == "function" && (s = s({ scope: e, config: t })), s instanceof Promise && (s = await s), t != null && t.templates && t.templatePaths[r]) {
|
46
|
-
const [a, f] = t.templatePaths[r].split(";;"), d = (await import(f))[a];
|
47
|
-
if (d && typeof d.params[r] == "function") {
|
48
|
-
const u = await d.params[r](s), [w] = await h(u, "");
|
49
|
-
return w;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
if (t != null && t.templates && t.templates[r]) {
|
53
|
-
if (c) return;
|
54
|
-
const f = s.split(".").reduce((o, d) => o[d], t.templates[r]);
|
55
|
-
if (f) {
|
56
|
-
const [o] = await h(f, "");
|
57
|
-
return o;
|
58
|
-
}
|
59
|
-
console.warn(`Template "${r}" with path of "${s}" was not found in config!`);
|
60
|
-
return;
|
61
|
-
}
|
62
|
-
if (typeof s == "object") {
|
63
|
-
if (!s) return;
|
64
|
-
if (s.isColor) return p(s.toString());
|
65
|
-
if (r === "defaultVariants") return;
|
66
|
-
if (r === "variants") {
|
67
|
-
const o = Object.entries(s);
|
68
|
-
for (const [d, u] of o) {
|
69
|
-
if (!u) return;
|
70
|
-
const w = Object.entries(u);
|
71
|
-
for (const [A, l] of w) {
|
72
|
-
if (!l) return;
|
73
|
-
const T = `${e}.${d}-${A}`;
|
74
|
-
(await h(l, T, t)).forEach((S) => n.add(S));
|
75
|
-
}
|
76
|
-
}
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
if (r === "compoundVariants") {
|
80
|
-
for (const o of s) {
|
81
|
-
const { css: d, ...u } = o, w = Object.entries(u).reduce((l, [T, N]) => `${l}.${T}-${N}`, e);
|
82
|
-
(await h(d, w, t)).forEach((l) => n.add(l));
|
83
|
-
}
|
84
|
-
return;
|
85
|
-
}
|
86
|
-
if (r.startsWith("@")) {
|
87
|
-
const o = ((y = t == null ? void 0 : t.mediaQueries) == null ? void 0 : y[r]) || r, d = await k(s, e, t), u = `${o} { ${d} }`;
|
88
|
-
n.add(u);
|
89
|
-
return;
|
90
|
-
}
|
91
|
-
const a = m.includes("&") ? r.replace("&", e) : r.startsWith(":") ? `${e}${r}` : `${e} ${r}`;
|
92
|
-
(await h(s, a, t)).forEach((o) => n.add(o));
|
93
|
-
return;
|
94
|
-
}
|
95
|
-
if (typeof s == "number") {
|
96
|
-
const a = Q($, s, t);
|
97
|
-
return p(a);
|
98
|
-
}
|
99
|
-
if (typeof s != "string")
|
100
|
-
if ("toString" in s) s = s.toString();
|
101
|
-
else throw new Error(`Invalid value type for property ${$}`);
|
102
|
-
return p(s);
|
103
|
-
}), { modifiers: E } = t || {}, j = [z(), U(E)], O = (await Promise.all(P).then((m) => Promise.all(
|
104
|
-
m.map((s) => j.reduce(async (r, $) => {
|
105
|
-
const p = await r;
|
106
|
-
if (!p) return p;
|
107
|
-
const C = await $(p);
|
108
|
-
if (!C) return p;
|
109
|
-
const { transformed: y, additionalCss: a } = C;
|
110
|
-
let f = "";
|
111
|
-
if (a)
|
112
|
-
for (const o of a)
|
113
|
-
f += await k(o, "");
|
114
|
-
return `${f}${y}`;
|
115
|
-
}, Promise.resolve(s)))
|
116
|
-
))).filter((m) => m !== void 0).join(`
|
117
|
-
`);
|
118
|
-
if (!O.trim()) return Array.from(n);
|
119
|
-
const W = e ? `${e} {
|
120
|
-
${O}
|
121
|
-
}` : O;
|
122
|
-
return n.has(W) ? Array.from(n) : [W, ...n];
|
123
|
-
}, k = async (i, e, t, c = !1) => (await h(i, e, t, c)).join(`
|
124
|
-
`);
|
125
|
-
export {
|
126
|
-
J as a,
|
127
|
-
k as p
|
128
|
-
};
|