@salty-css/core 0.0.1-alpha.285 → 0.0.1-alpha.287

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.
@@ -1,11 +1,11 @@
1
1
  var C = Object.defineProperty;
2
2
  var x = (a, t, s) => t in a ? C(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
3
- var m = (a, t, s) => x(a, typeof t != "symbol" ? t + "" : t, s);
4
- import { p as S } from "../parse-styles-C1E6ETeH.js";
3
+ var u = (a, t, s) => x(a, typeof t != "symbol" ? t + "" : t, s);
4
+ import { p as v } from "../parse-styles-DLPgVsVQ.js";
5
5
  import { t as f, d as h } from "../dash-case-DBThphLm.js";
6
6
  class y {
7
7
  constructor(t) {
8
- m(this, "buildContext", {});
8
+ u(this, "buildContext", {});
9
9
  this.params = t;
10
10
  }
11
11
  get priority() {
@@ -30,13 +30,13 @@ class y {
30
30
  return t ? `cl_${h(t)}-${this.hash}.css` : `${this.hash}.css`;
31
31
  }
32
32
  get css() {
33
- const { base: t = {}, variants: s = {}, compoundVariants: e = [] } = this.params, { config: i } = this.buildContext, n = { ...t, variants: s, compoundVariants: e };
34
- return S(n, `.${this.cssClassName}`, i, this.isRoot);
33
+ const { base: t = {}, variants: s = {}, compoundVariants: e = [] } = this.params, { config: i } = this.buildContext, o = { ...t, variants: s, compoundVariants: e };
34
+ return v(o, `.${this.cssClassName}`, i, this.isRoot);
35
35
  }
36
36
  getTemplateClasses(t = this.buildContext.config) {
37
37
  if (!(t != null && t.templates) || !this.params.base || this.priority > 0) return [];
38
38
  const s = Object.keys(t.templates);
39
- return Object.entries(this.params.base).reduce((e, [i, n]) => (s.includes(i) && e.push("t_" + f(h(`${i}-${n}`), 4)), e), []);
39
+ return Object.entries(this.params.base).reduce((e, [i, o]) => (s.includes(i) && e.push("t_" + f(h(`${i}-${o}`), 4)), e), []);
40
40
  }
41
41
  _withBuildContext(t) {
42
42
  return this.buildContext = t, this;
@@ -56,17 +56,17 @@ class E extends y {
56
56
  return this.params.priority ? this.params.priority : typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
57
57
  }
58
58
  get clientProps() {
59
- const { element: t, variants: s = {}, compoundVariants: e = [], defaultVariants: i = {}, defaultProps: n = {}, passProps: p } = this.params, { callerName: b, isProduction: g } = this.buildContext, c = /* @__PURE__ */ new Set([]), d = (r) => {
60
- const o = i[r];
61
- o !== void 0 ? c.add(`${r}=${String(o)}`) : c.add(r);
59
+ const { element: t, variants: s = {}, compoundVariants: e = [], defaultVariants: i = {}, defaultProps: o = {}, passProps: p } = this.params, { callerName: b, isProduction: g } = this.buildContext, c = /* @__PURE__ */ new Set([]), d = (r) => {
60
+ const n = i[r];
61
+ n !== void 0 ? c.add(`${r}=${String(n)}`) : c.add(r);
62
62
  };
63
63
  Object.keys(s).forEach(d), e.map((r) => Object.keys(r).forEach(d));
64
64
  const l = /* @__PURE__ */ new Set([]);
65
65
  if (this.params.base) {
66
66
  const r = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
67
- r && r.forEach((o) => {
68
- const u = o.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1"), N = h(u);
69
- u && l.add(N);
67
+ r && r.forEach((n) => {
68
+ const m = n.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1"), N = h(m);
69
+ m && l.add(N);
70
70
  });
71
71
  }
72
72
  return {
@@ -75,7 +75,7 @@ class E extends y {
75
75
  variantKeys: [...c],
76
76
  propValueKeys: [...l],
77
77
  passProps: p,
78
- defaultProps: n,
78
+ defaultProps: o,
79
79
  attr: {
80
80
  "data-component-name": g ? void 0 : b
81
81
  }
@@ -0,0 +1,10 @@
1
+ import { join as t } from "path";
2
+ const r = () => {
3
+ let { pathname: e } = new URL(import.meta.url);
4
+ for (; /core\/?(src\/)?$/.test(e) === !1; )
5
+ e = t(e, "../");
6
+ return e;
7
+ };
8
+ export {
9
+ r as g
10
+ };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("path");var t=typeof document<"u"?document.currentScript:null;const n=()=>{let{pathname:e}=new URL(typeof document>"u"?require("url").pathToFileURL(__filename).href:t&&t.tagName.toUpperCase()==="SCRIPT"&&t.src||new URL("helpers-DVANmpVz.cjs",document.baseURI).href);for(;/core\/?(src\/)?$/.test(e)===!1;)e=r.join(e,"../");return e};exports.getCorePackageRoot=n;
@@ -1,44 +1,45 @@
1
1
  import * as St from "esbuild";
2
- import { execSync as vt } from "child_process";
3
- import { t as I, d as U } from "./dash-case-DBThphLm.js";
2
+ import { execSync as Vt } from "child_process";
3
+ import { t as I, d as A } from "./dash-case-DBThphLm.js";
4
4
  import { join as i, parse as tt } from "path";
5
- import { existsSync as ft, writeFileSync as C, mkdirSync as G, readFileSync as _, statSync as Et, readdirSync as Ot } from "fs";
5
+ import { existsSync as ft, mkdirSync as G, statSync as Et, readdirSync as Ot, readFileSync as T, writeFileSync as C } from "fs";
6
6
  import { readFile as Ct } from "fs/promises";
7
- import { p as $t, a as Rt } from "./parse-styles-C1E6ETeH.js";
8
- import { parseTemplates as Mt, getTemplateTypes as Jt } from "./parsers/index.js";
9
- import { createLogger as zt, format as rt, transports as Wt } from "winston";
7
+ import { p as $t, a as Mt } from "./parse-styles-DLPgVsVQ.js";
8
+ import { parseTemplates as Rt, getTemplateTypes as Jt } from "./parsers/index.js";
9
+ import { createLogger as zt, transports as Wt, format as rt } from "winston";
10
10
  import { mergeObjects as H, mergeFactories as Gt } from "./css/merge.js";
11
11
  import { d as Ht } from "./define-templates-4A2yHcMF.js";
12
12
  import lt from "typescript";
13
+ import { g as It } from "./helpers-C1RIrlCB.js";
13
14
  const Ft = (t) => {
14
15
  if (!t || t === "/") throw new Error("Could not find package.json file");
15
16
  const e = i(t, "package.json");
16
17
  return ft(e) ? e : Ft(i(t, ".."));
17
- }, It = async (t) => {
18
+ }, Kt = async (t) => {
18
19
  const e = Ft(t);
19
20
  return await Ct(e, "utf-8").then(JSON.parse).catch(() => {
20
21
  });
21
- }, Kt = async (t) => {
22
- const e = await It(t);
22
+ }, Qt = async (t) => {
23
+ const e = await Kt(t);
23
24
  if (e)
24
25
  return e.type;
25
26
  };
26
27
  let W;
27
28
  const Pt = async (t) => {
28
29
  if (W) return W;
29
- const e = await Kt(t);
30
+ const e = await Qt(t);
30
31
  return e === "module" ? W = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (W = "cjs"), W || "esm";
31
32
  }, Z = zt({
32
33
  level: "debug",
33
34
  format: rt.combine(rt.colorize(), rt.cli()),
34
35
  transports: [new Wt.Console({})]
35
- }), fe = (t) => {
36
+ }), me = (t) => {
36
37
  Z.error(t);
37
38
  };
38
39
  function jt(t) {
39
40
  return t ? typeof t != "string" ? jt(String(t)) : t.replace(/[^\d\w]/g, ".") : "";
40
41
  }
41
- const Qt = {
42
+ const Bt = {
42
43
  /** Set box model to border-box */
43
44
  "*, *::before, *::after": {
44
45
  boxSizing: "border-box"
@@ -96,36 +97,31 @@ const Qt = {
96
97
  d.forEachChild(o);
97
98
  }
98
99
  o(r);
99
- }), Bt = () => {
100
- let { pathname: t } = new URL(import.meta.url);
101
- for (; /core\/?(src\/)?$/.test(t) === !1; )
102
- t = i(t, "../");
103
- return t;
104
- }, v = {
100
+ }), V = {
105
101
  externalModules: [],
106
102
  rcFile: void 0,
107
103
  destDir: void 0
108
104
  }, Nt = (t) => {
109
- if (v.externalModules.length > 0) return v.externalModules;
110
- const s = _(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
105
+ if (V.externalModules.length > 0) return V.externalModules;
106
+ const s = T(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
111
107
  if (!s) return [];
112
108
  const n = s[1].split(",").map((c) => c.replace(/['"`]/g, "").trim());
113
- return v.externalModules = n, n;
109
+ return V.externalModules = n, n;
114
110
  }, J = async (t) => {
115
- if (v.destDir) return v.destDir;
111
+ if (V.destDir) return V.destDir;
116
112
  const e = await pt(t), s = i(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
117
- return v.destDir = s, s;
113
+ return V.destDir = s, s;
118
114
  }, xt = ["salty", "css", "styles", "styled"], qt = (t = []) => new RegExp(`\\.(${[...xt, ...t].join("|")})\\.`), mt = (t, e = []) => qt(e).test(t), Dt = async (t) => {
119
- if (v.rcFile) return v.rcFile;
115
+ if (V.rcFile) return V.rcFile;
120
116
  if (t === "/") throw new Error("Could not find .saltyrc.json file");
121
117
  const e = i(t, ".saltyrc.json"), s = await Ct(e, "utf-8").then(JSON.parse).catch(() => {
122
118
  });
123
- return s ? (v.rcFile = s, s) : Dt(i(t, ".."));
119
+ return s ? (V.rcFile = s, s) : Dt(i(t, ".."));
124
120
  }, pt = async (t) => {
125
121
  var n, c;
126
122
  const e = await Dt(t), s = (n = e.projects) == null ? void 0 : n.find((r) => t.endsWith(r.dir || ""));
127
123
  return s || ((c = e.projects) == null ? void 0 : c.find((r) => r.dir === e.defaultProject));
128
- }, Ut = async (t) => {
124
+ }, At = async (t) => {
129
125
  const e = await pt(t), s = await J(t), n = i(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), c = i(s, "salty.config.js"), r = await Pt(t), o = Nt(n);
130
126
  await St.build({
131
127
  entryPoints: [n],
@@ -138,8 +134,8 @@ const Qt = {
138
134
  });
139
135
  const d = Date.now(), { config: w } = await import(`${c}?t=${d}`);
140
136
  return { config: w, path: c };
141
- }, At = async (t, e) => {
142
- var gt, ht;
137
+ }, Ut = async (t, e) => {
138
+ var yt, ht;
143
139
  const s = await J(t), n = {
144
140
  mediaQueries: [],
145
141
  globalStyles: [],
@@ -148,58 +144,58 @@ const Qt = {
148
144
  };
149
145
  await Promise.all(
150
146
  [...e].map(async (h) => {
151
- const { contents: S, outputFilePath: B } = await et(t, h, s);
147
+ const { contents: S, outputFilePath: L } = await et(t, h, s);
152
148
  Object.entries(S).forEach(([k, j]) => {
153
- j.isMedia ? n.mediaQueries.push([k, j]) : j.isGlobalDefine ? n.globalStyles.push(j) : j.isDefineVariables ? n.variables.push(j) : j.isDefineTemplates && n.templates.push(j._setPath(`${k};;${B}`));
149
+ j.isMedia ? n.mediaQueries.push([k, j]) : j.isGlobalDefine ? n.globalStyles.push(j) : j.isDefineVariables ? n.variables.push(j) : j.isDefineTemplates && n.templates.push(j._setPath(`${k};;${L}`));
154
150
  });
155
151
  })
156
152
  );
157
- const { config: c, path: r } = await Ut(t), o = { ...c }, { mediaQueries: d } = n;
153
+ const { config: c, path: r } = await At(t), o = { ...c }, { mediaQueries: d } = n;
158
154
  o.mediaQueries = Object.fromEntries(d.map(([h, S]) => [`@${h}`, S]));
159
155
  const w = d.map(([h]) => `'@${h}'`).join(" | "), p = /* @__PURE__ */ new Set(), a = async (h, S = []) => {
160
156
  if (!h) return [];
161
- const B = Object.entries(h).map(async ([j, M]) => {
162
- const q = async (T) => {
163
- if (!T) return;
164
- if (T instanceof Promise) return await q(await T);
165
- if (typeof T == "function") return await q(await T());
166
- if (typeof T == "object") return await a(T, [...S, j]);
167
- const at = jt(j), it = U(j), ct = [...S, at].join(".");
157
+ const L = Object.entries(h).map(async ([j, R]) => {
158
+ const q = async (v) => {
159
+ if (!v) return;
160
+ if (v instanceof Promise) return await q(await v);
161
+ if (typeof v == "function") return await q(await v());
162
+ if (typeof v == "object") return await a(v, [...S, j]);
163
+ const at = jt(j), it = A(j), ct = [...S, at].join(".");
168
164
  p.add(`"${ct}"`);
169
- const Y = [...S.map(U), it].join("-"), wt = Rt(T);
170
- return wt ? `--${Y}: ${wt.transformed};` : `--${Y}: ${T};`;
165
+ const Y = [...S.map(A), it].join("-"), wt = Mt(v);
166
+ return wt ? `--${Y}: ${wt.transformed};` : `--${Y}: ${v};`;
171
167
  };
172
- return await q(M);
168
+ return await q(R);
173
169
  });
174
- return (await Promise.all(B)).flat();
175
- }, y = async (h) => {
170
+ return (await Promise.all(L)).flat();
171
+ }, g = async (h) => {
176
172
  if (!h) return [];
177
173
  const S = Object.entries(h).map(async ([k, j]) => {
178
- const M = await a(j);
179
- return k === "base" ? M.join("") : o.mediaQueries[k] ? `${o.mediaQueries[k]} { ${M.join("")} }` : `${k} { ${M.join("")} }`;
174
+ const R = await a(j);
175
+ return k === "base" ? R.join("") : o.mediaQueries[k] ? `${o.mediaQueries[k]} { ${R.join("")} }` : `${k} { ${R.join("")} }`;
180
176
  });
181
177
  return (await Promise.all(S)).flat();
182
178
  }, u = async (h) => {
183
179
  if (!h) return [];
184
180
  const S = Object.entries(h).map(async ([k, j]) => {
185
- const M = Object.entries(j).map(async ([T, at]) => {
186
- const it = await a(at, [k]), ct = `.${k}-${T}, [data-${k}="${T}"]`, Y = it.join("");
181
+ const R = Object.entries(j).map(async ([v, at]) => {
182
+ const it = await a(at, [k]), ct = `.${k}-${v}, [data-${k}="${v}"]`, Y = it.join("");
187
183
  return `${ct} { ${Y} }`;
188
184
  });
189
- return (await Promise.all(M)).flat();
185
+ return (await Promise.all(R)).flat();
190
186
  });
191
187
  return (await Promise.all(S)).flat();
192
- }, g = (h) => ({ ...h, responsive: void 0, conditional: void 0 }), m = (h) => n.variables.map((S) => h === "static" ? g(S._current) : S._current[h]), F = H(g(c.variables), m("static")), x = await a(F), D = H((gt = c.variables) == null ? void 0 : gt.responsive, m("responsive")), E = await y(D), z = H((ht = c.variables) == null ? void 0 : ht.conditional, m("conditional")), A = await u(z), yt = i(s, "css/_variables.css"), O = `:root { ${x.join("")} ${E.join("")} } ${A.join("")}`;
193
- C(yt, O), o.staticVariables = F;
188
+ }, y = (h) => ({ ...h, responsive: void 0, conditional: void 0 }), m = (h) => n.variables.map((S) => h === "static" ? y(S._current) : S._current[h]), F = H(y(c.variables), m("static")), x = await a(F), D = H((yt = c.variables) == null ? void 0 : yt.responsive, m("responsive")), E = await g(D), z = H((ht = c.variables) == null ? void 0 : ht.conditional, m("conditional")), U = await u(z), gt = i(s, "css/_variables.css"), O = `:root { ${x.join("")} ${E.join("")} } ${U.join("")}`;
189
+ C(gt, O), o.staticVariables = F;
194
190
  const st = i(s, "css/_global.css"), f = H(c.global, n.globalStyles), $ = await $t(f, "");
195
191
  C(st, `@layer global { ${$} }`);
196
- const b = i(s, "css/_reset.css"), P = c.reset === "none" ? {} : typeof c.reset == "object" ? c.reset : Qt, N = await $t(P, "");
192
+ const b = i(s, "css/_reset.css"), P = c.reset === "none" ? {} : typeof c.reset == "object" ? c.reset : Bt, N = await $t(P, "");
197
193
  C(b, `@layer reset { ${N} }`);
198
- const V = i(s, "css/_templates.css"), R = H(c.templates, n.templates), K = await Mt(R), Q = Jt(R);
199
- C(V, `@layer templates { ${K} }`), o.templates = R;
194
+ const _ = i(s, "css/_templates.css"), M = H(c.templates, n.templates), K = await Rt(M), Q = Jt(M);
195
+ C(_, `@layer templates { ${K} }`), o.templates = M;
200
196
  const X = c.templates ? [Ht(c.templates)._setPath(`config;;${r}`)] : [], nt = Gt(n.templates, X);
201
197
  o.templatePaths = Object.fromEntries(Object.entries(nt).map(([h, S]) => [h, S._path]));
202
- const L = i(s, "types/css-tokens.d.ts"), kt = `
198
+ const B = i(s, "types/css-tokens.d.ts"), kt = `
203
199
  // Variable types
204
200
  type VariableTokens = ${[...p].join("|")};
205
201
  type PropertyValueToken = \`{\${VariableTokens}}\`;
@@ -213,11 +209,11 @@ const Qt = {
213
209
  // Media query types
214
210
  type MediaQueryKeys = ${w || "''"};
215
211
  `;
216
- C(L, kt);
217
- const Tt = i(s, "cache/config-cache.json");
218
- C(Tt, JSON.stringify(o, null, 2));
219
- const _t = Bt(), Vt = i(_t, "cache/config-cache.json");
220
- C(Vt, JSON.stringify(o, null, 2));
212
+ C(B, kt);
213
+ const vt = i(s, "cache/config-cache.json");
214
+ C(vt, JSON.stringify(o, null, 2));
215
+ const Tt = It(), _t = i(Tt, "cache/config-cache.json");
216
+ C(_t, JSON.stringify(o, null, 2));
221
217
  }, bt = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
222
218
  if (/^['"`]/.test(s)) return e;
223
219
  const c = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
@@ -230,7 +226,7 @@ const Qt = {
230
226
  return "styled('div',";
231
227
  }), Xt = (t, e) => {
232
228
  try {
233
- const s = _(i(e, "saltygen/cache/config-cache.json"), "utf8");
229
+ const s = T(i(e, "saltygen/cache/config-cache.json"), "utf8");
234
230
  return s ? `globalThis.saltyConfig = ${s};
235
231
 
236
232
  ${t}` : `globalThis.saltyConfig = {};
@@ -243,9 +239,9 @@ ${t}`;
243
239
  const n = I(e), c = i(s, "./temp");
244
240
  ft(c) || G(c);
245
241
  const r = tt(e);
246
- let o = _(e, "utf8");
242
+ let o = T(e, "utf8");
247
243
  o = bt(o), o = Xt(o, t);
248
- const d = i(s, "js", n + ".js"), w = await pt(t), p = i(t, (w == null ? void 0 : w.configDir) || "", "salty.config.ts"), a = Nt(p), y = await Pt(t);
244
+ const d = i(s, "js", n + ".js"), w = await pt(t), p = i(t, (w == null ? void 0 : w.configDir) || "", "salty.config.ts"), a = Nt(p), g = await Pt(t);
249
245
  await St.build({
250
246
  stdin: {
251
247
  contents: o,
@@ -257,7 +253,7 @@ ${t}`;
257
253
  treeShaking: !0,
258
254
  bundle: !0,
259
255
  outfile: d,
260
- format: y,
256
+ format: g,
261
257
  target: ["node20"],
262
258
  keepNames: !0,
263
259
  external: a,
@@ -267,7 +263,7 @@ ${t}`;
267
263
  name: "test",
268
264
  setup: (m) => {
269
265
  m.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (F) => {
270
- const x = _(F.path, "utf8");
266
+ const x = T(F.path, "utf8");
271
267
  return { contents: bt(x), loader: "ts" };
272
268
  });
273
269
  }
@@ -277,7 +273,7 @@ ${t}`;
277
273
  const u = Date.now();
278
274
  return { contents: await import(`${d}?t=${u}`), outputFilePath: d };
279
275
  }, Yt = async (t) => {
280
- const e = await J(t), s = i(e, "cache/config-cache.json"), n = _(s, "utf8");
276
+ const e = await J(t), s = i(e, "cache/config-cache.json"), n = T(s, "utf8");
281
277
  if (!n) throw new Error("Could not find config cache file");
282
278
  return JSON.parse(n);
283
279
  }, ut = async (t) => {
@@ -289,28 +285,28 @@ ${t}`;
289
285
  } catch {
290
286
  return !1;
291
287
  }
292
- }, me = async (t, e = dt(), s = !0) => {
288
+ }, pe = async (t, e = dt(), s = !0) => {
293
289
  try {
294
290
  const n = Date.now();
295
291
  e ? Z.info("Generating CSS in production mode! 🔥") : Z.info("Generating CSS in development mode! 🚀");
296
292
  const c = [], r = [], o = await J(t), d = i(o, "index.css");
297
293
  s && (() => {
298
- ft(o) && vt("rm -rf " + o), G(o, { recursive: !0 }), G(i(o, "css")), G(i(o, "types")), G(i(o, "js")), G(i(o, "cache"));
294
+ ft(o) && Vt("rm -rf " + o), G(o, { recursive: !0 }), G(i(o, "css")), G(i(o, "types")), G(i(o, "js")), G(i(o, "cache"));
299
295
  })();
300
296
  const p = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
301
- async function y(f) {
297
+ async function g(f) {
302
298
  const $ = ["node_modules", "saltygen"], b = Et(f);
303
299
  if (b.isDirectory()) {
304
300
  const l = Ot(f);
305
301
  if ($.some((N) => f.includes(N))) return;
306
- await Promise.all(l.map((N) => y(i(f, N))));
302
+ await Promise.all(l.map((N) => g(i(f, N))));
307
303
  } else if (b.isFile() && mt(f)) {
308
304
  p.add(f);
309
- const P = _(f, "utf8");
305
+ const P = T(f, "utf8");
310
306
  /define[\w\d]+\(/.test(P) && a.add(f);
311
307
  }
312
308
  }
313
- await y(t), await At(t, a);
309
+ await g(t), await Ut(t, a);
314
310
  const u = {
315
311
  keyframes: [],
316
312
  components: [],
@@ -335,7 +331,7 @@ ${t}`;
335
331
  });
336
332
  })
337
333
  );
338
- const g = await ut(t);
334
+ const y = await ut(t);
339
335
  for (const f of u.keyframes) {
340
336
  const { value: $ } = f, b = `a_${$.animationName}.css`, l = `css/${b}`, P = i(o, l);
341
337
  c.push(b), C(P, $.css);
@@ -347,14 +343,14 @@ ${t}`;
347
343
  const l = f.generator._withBuildContext({
348
344
  callerName: b,
349
345
  isProduction: e,
350
- config: g
346
+ config: y
351
347
  });
352
348
  r[l.priority] || (r[l.priority] = []);
353
349
  const P = await l.css;
354
350
  if (!P) continue;
355
351
  r[l.priority].push(l.cssFileName);
356
- const N = `css/${l.cssFileName}`, V = i(o, N);
357
- C(V, P), g.importStrategy === "component" && m[$].push(l.cssFileName);
352
+ const N = `css/${l.cssFileName}`, _ = i(o, N);
353
+ C(_, P), y.importStrategy === "component" && m[$].push(l.cssFileName);
358
354
  }
359
355
  for (const f of u.classNames) {
360
356
  const { src: $, name: b } = f;
@@ -362,21 +358,21 @@ ${t}`;
362
358
  const l = f.generator._withBuildContext({
363
359
  callerName: b,
364
360
  isProduction: e,
365
- config: g
361
+ config: y
366
362
  }), P = await l.css;
367
363
  if (!P) continue;
368
364
  r[l.priority] || (r[l.priority] = []), r[l.priority].push(l.cssFileName);
369
- const N = `css/${l.cssFileName}`, V = i(o, N);
370
- C(V, P), g.importStrategy === "component" && m[$].push(l.cssFileName);
365
+ const N = `css/${l.cssFileName}`, _ = i(o, N);
366
+ C(_, P), y.importStrategy === "component" && m[$].push(l.cssFileName);
371
367
  }
372
- g.importStrategy === "component" && Object.entries(m).forEach(([f, $]) => {
373
- const b = $.map((R) => `@import url('./${R}');`).join(`
374
- `), l = I(f, 6), P = tt(f), N = U(P.name), V = i(o, `css/f_${N}-${l}.css`);
375
- C(V, b || "/* Empty file */");
368
+ y.importStrategy === "component" && Object.entries(m).forEach(([f, $]) => {
369
+ const b = $.map((M) => `@import url('./${M}');`).join(`
370
+ `), l = I(f, 6), P = tt(f), N = A(P.name), _ = i(o, `css/f_${N}-${l}.css`);
371
+ C(_, b || "/* Empty file */");
376
372
  });
377
373
  const F = c.map((f) => `@import url('./css/${f}');`).join(`
378
374
  `);
379
- let A = `/*!
375
+ let U = `/*!
380
376
  * Generated with Salty CSS (https://salty-css.dev)
381
377
  * Do not edit this file directly
382
378
  */
@@ -384,7 +380,7 @@ ${t}`;
384
380
 
385
381
  ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((f) => {
386
382
  try {
387
- return _(i(o, "css", f), "utf8").length > 0;
383
+ return T(i(o, "css", f), "utf8").length > 0;
388
384
  } catch {
389
385
  return !1;
390
386
  }
@@ -393,30 +389,30 @@ ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((f) =
393
389
  `
394
390
  )}
395
391
  ${F}`;
396
- if (g.importStrategy !== "component") {
392
+ if (y.importStrategy !== "component") {
397
393
  const f = r.reduce(($, b, l) => {
398
394
  const P = b.reduce((K, Q) => {
399
395
  var ot;
400
- const X = i(o, "css", Q), nt = _(X, "utf8"), L = ((ot = /.*-([^-]+)-\d+.css/.exec(Q)) == null ? void 0 : ot.at(1)) || I(X, 6);
401
- return K.includes(L) ? K : `${K}
402
- /*start:${L}-${Q}*/
396
+ const X = i(o, "css", Q), nt = T(X, "utf8"), B = ((ot = /.*-([^-]+)-\d+.css/.exec(Q)) == null ? void 0 : ot.at(1)) || I(X, 6);
397
+ return K.includes(B) ? K : `${K}
398
+ /*start:${B}-${Q}*/
403
399
  ${nt}
404
- /*end:${L}*/
400
+ /*end:${B}*/
405
401
  `;
406
- }, ""), N = `l_${l}.css`, V = i(o, "css", N), R = `@layer l${l} { ${P}
402
+ }, ""), N = `l_${l}.css`, _ = i(o, "css", N), M = `@layer l${l} { ${P}
407
403
  }`;
408
- return C(V, R), `${$}
404
+ return C(_, M), `${$}
409
405
  @import url('./css/${N}');`;
410
406
  }, "");
411
- A += f;
407
+ U += f;
412
408
  }
413
- C(d, A);
409
+ C(d, U);
414
410
  const O = Date.now() - n, st = O < 200 ? "🔥" : O < 500 ? "🚀" : O < 1e3 ? "🎉" : O < 2e3 ? "🚗" : O < 5e3 ? "🤔" : "🥴";
415
411
  Z.info(`Generated CSS in ${O}ms! ${st}`);
416
412
  } catch (n) {
417
413
  console.error(n);
418
414
  }
419
- }, pe = async (t, e, s = dt()) => {
415
+ }, ue = async (t, e, s = dt()) => {
420
416
  try {
421
417
  const n = await J(t);
422
418
  if (mt(e)) {
@@ -444,20 +440,20 @@ ${nt}
444
440
  callerName: w,
445
441
  isProduction: s,
446
442
  config: o
447
- }), y = await a.css;
448
- if (!y) continue;
449
- const u = `css/${a.cssFileName}`, g = i(n, u);
450
- C(g, y), r[a.priority] || (r[a.priority] = []), r[a.priority].push(a.cssFileName);
443
+ }), g = await a.css;
444
+ if (!g) continue;
445
+ const u = `css/${a.cssFileName}`, y = i(n, u);
446
+ C(y, g), r[a.priority] || (r[a.priority] = []), r[a.priority].push(a.cssFileName);
451
447
  }
452
448
  if (o.importStrategy !== "component")
453
449
  r.forEach((w, p) => {
454
- const a = `l_${p}.css`, y = i(n, "css", a);
455
- let u = _(y, "utf8");
456
- w.forEach((g) => {
450
+ const a = `l_${p}.css`, g = i(n, "css", a);
451
+ let u = T(g, "utf8");
452
+ w.forEach((y) => {
457
453
  var D;
458
- const m = i(n, "css", g), F = ((D = /.*-([^-]+)-\d+.css/.exec(g)) == null ? void 0 : D.at(1)) || I(m, 6);
454
+ const m = i(n, "css", y), F = ((D = /.*-([^-]+)-\d+.css/.exec(y)) == null ? void 0 : D.at(1)) || I(m, 6);
459
455
  if (!u.includes(F)) {
460
- const E = _(m, "utf8"), z = `/*start:${F}-${g}*/
456
+ const E = T(m, "utf8"), z = `/*start:${F}-${y}*/
461
457
  ${E}
462
458
  /*end:${F}*/
463
459
  `;
@@ -465,43 +461,43 @@ ${E}
465
461
  ${z}
466
462
  }`;
467
463
  }
468
- }), C(y, u);
464
+ }), C(g, u);
469
465
  });
470
466
  else {
471
- const w = r.flat().map((g) => `@import url('./${g}');`).join(`
472
- `), p = I(e, 6), a = tt(e), y = U(a.name), u = i(n, `css/f_${y}-${p}.css`);
467
+ const w = r.flat().map((y) => `@import url('./${y}');`).join(`
468
+ `), p = I(e, 6), a = tt(e), g = A(a.name), u = i(n, `css/f_${g}-${p}.css`);
473
469
  C(u, w || "/* Empty file */");
474
470
  }
475
471
  }
476
472
  } catch (n) {
477
473
  console.error(n);
478
474
  }
479
- }, ue = async (t, e, s = dt()) => {
475
+ }, de = async (t, e, s = dt()) => {
480
476
  var n, c;
481
477
  try {
482
478
  const r = await J(t);
483
479
  if (mt(e)) {
484
- const d = _(e, "utf8"), w = await ut(t), { contents: p } = await et(t, e, r);
480
+ const d = T(e, "utf8"), w = await ut(t), { contents: p } = await et(t, e, r);
485
481
  let a = d;
486
- for (const [y, u] of Object.entries(p)) {
482
+ for (const [g, u] of Object.entries(p)) {
487
483
  if (u.isKeyframes || !u.generator) continue;
488
- const g = u.generator._withBuildContext({
489
- callerName: y,
484
+ const y = u.generator._withBuildContext({
485
+ callerName: g,
490
486
  isProduction: s,
491
487
  config: w
492
- }), [m, F] = await Lt(a, y), x = a.slice(m, F);
488
+ }), [m, F] = await Lt(a, g), x = a.slice(m, F);
493
489
  if (u.isClassName) {
494
- const D = a, E = ` ${y} = className("${g.classNames}")`;
495
- a = a.replace(x, E), D === a && console.error("Minimize file failed to change content", { name: y });
490
+ const D = a, E = ` ${g} = className("${y.classNames}")`;
491
+ a = a.replace(x, E), D === a && console.error("Minimize file failed to change content", { name: g });
496
492
  }
497
493
  if (x.includes("styled")) {
498
- const D = (c = (n = /styled\(([^,]+),/.exec(x)) == null ? void 0 : n.at(1)) == null ? void 0 : c.trim(), E = a, z = ` ${y} = styled(${D}, "${g.classNames}", ${JSON.stringify(g.clientProps)})`;
499
- a = a.replace(x, z), E === a && console.error("Minimize file failed to change content", { name: y, tagName: D });
494
+ const D = (c = (n = /styled\(([^,]+),/.exec(x)) == null ? void 0 : n.at(1)) == null ? void 0 : c.trim(), E = a, z = ` ${g} = styled(${D}, "${y.classNames}", ${JSON.stringify(y.clientProps)})`;
495
+ a = a.replace(x, z), E === a && console.error("Minimize file failed to change content", { name: g, tagName: D });
500
496
  }
501
497
  }
502
498
  if (w.importStrategy === "component") {
503
- const y = I(e, 6), u = tt(e);
504
- a = `import '../../saltygen/css/${`f_${U(u.name)}-${y}.css`}';
499
+ const g = I(e, 6), u = tt(e);
500
+ a = `import '../../saltygen/css/${`f_${A(u.name)}-${g}.css`}';
505
501
  ${a}`;
506
502
  }
507
503
  return a = a.replace("@salty-css/react/class-name", "@salty-css/react/class-name-client"), a = a.replace("{ styled }", "{ styledClient as styled }"), a = a.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), a;
@@ -511,15 +507,14 @@ ${a}`;
511
507
  }
512
508
  };
513
509
  export {
514
- fe as a,
515
- me as b,
516
- pe as c,
517
- qt as d,
518
- At as e,
519
- et as f,
520
- Bt as g,
510
+ me as a,
511
+ ue as b,
512
+ qt as c,
513
+ Ut as d,
514
+ et as e,
515
+ pe as g,
521
516
  mt as i,
522
517
  Z as l,
523
- ue as m,
518
+ de as m,
524
519
  xt as s
525
520
  };