@salty-css/core 0.0.1-alpha.253 → 0.0.1-alpha.255

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