@salty-css/core 0.0.1-alpha.18 → 0.0.1-alpha.181

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.
Files changed (64) hide show
  1. package/.saltyrc.schema.json +48 -0
  2. package/README.md +143 -26
  3. package/bin/index.cjs +1 -8
  4. package/bin/index.js +2 -129
  5. package/bin/logger.d.ts +1 -0
  6. package/bin/main.cjs +11 -0
  7. package/bin/main.d.ts +1 -0
  8. package/bin/main.js +260 -0
  9. package/compiler/get-files.d.ts +3 -0
  10. package/compiler/index.cjs +1 -11
  11. package/compiler/index.d.ts +28 -4
  12. package/compiler/index.js +18 -172
  13. package/config/define-config.d.ts +1 -1
  14. package/config/index.cjs +1 -1
  15. package/config/index.d.ts +2 -1
  16. package/config/index.js +12 -2
  17. package/css/index.cjs +1 -1
  18. package/css/index.d.ts +4 -1
  19. package/css/index.js +121 -2
  20. package/css/keyframes.d.ts +22 -0
  21. package/css/media.d.ts +87 -0
  22. package/css/merge.d.ts +6 -0
  23. package/css/token.d.ts +1 -0
  24. package/{dash-case-DKzpenwY.cjs → dash-case-BJEkFEGQ.cjs} +1 -1
  25. package/{dash-case-DMQMcCO6.js → dash-case-DBThphLm.js} +2 -2
  26. package/factories/define-global-styles.d.ts +7 -0
  27. package/factories/define-templates.d.ts +10 -0
  28. package/factories/define-variables.d.ts +15 -0
  29. package/factories/index.cjs +1 -0
  30. package/factories/index.d.ts +3 -0
  31. package/factories/index.js +38 -0
  32. package/generator/index.cjs +1 -1
  33. package/generator/index.js +50 -35
  34. package/generator/parse-modifiers.d.ts +1 -1
  35. package/generator/parse-styles.d.ts +2 -2
  36. package/generator/parse-templates.d.ts +2 -0
  37. package/generator/style-generator.d.ts +8 -0
  38. package/index-BjclEscx.js +404 -0
  39. package/index-zPXqhZf1.cjs +29 -0
  40. package/merge-BVm9us1A.js +4 -0
  41. package/merge-DxGoJDHv.cjs +1 -0
  42. package/package.json +12 -2
  43. package/parse-styles-3zK35muR.cjs +7 -0
  44. package/parse-styles-DrLhKtqW.js +75 -0
  45. package/parse-templates-DRKlN-pP.js +27 -0
  46. package/parse-templates-VIvmVb52.cjs +2 -0
  47. package/react-vanilla-file-CCXbsjIb.js +18 -0
  48. package/react-vanilla-file-CG_WJLam.cjs +15 -0
  49. package/{salty.config-D9ANEDiH.js → salty.config-BhBY_oOk.js} +1 -0
  50. package/{salty.config-BupieCfE.cjs → salty.config-Dk6ZcCxI.cjs} +3 -2
  51. package/server/index.cjs +1 -0
  52. package/server/index.d.ts +1 -0
  53. package/server/index.js +12 -0
  54. package/server/should-restart.d.ts +1 -0
  55. package/templates/salty-reset.d.ts +2 -0
  56. package/types/cli-types.d.ts +10 -0
  57. package/{config → types}/config-types.d.ts +15 -5
  58. package/types/index.d.ts +46 -19
  59. package/util/dot-case.d.ts +1 -0
  60. package/util/index.cjs +1 -1
  61. package/util/index.js +1 -1
  62. package/util/module-type.d.ts +1 -0
  63. package/parse-templates-D4p3pgQR.js +0 -92
  64. package/parse-templates-W0YfTmOT.cjs +0 -8
@@ -0,0 +1,404 @@
1
+ import * as ot from "esbuild";
2
+ import { execSync as mt } from "child_process";
3
+ import { t as H, d as K } from "./dash-case-DBThphLm.js";
4
+ import { join as o, parse as q } from "path";
5
+ import { existsSync as U, writeFileSync as x, mkdirSync as z, readFileSync as v, statSync as gt, readdirSync as yt } from "fs";
6
+ import { readFile as rt, writeFile as ht } from "fs/promises";
7
+ import { p as st, a as bt } from "./parse-styles-DrLhKtqW.js";
8
+ import { p as $t, a as wt } from "./parse-templates-DRKlN-pP.js";
9
+ import { createLogger as St, format as Q, transports as Ct } from "winston";
10
+ import { m as W } from "./merge-BVm9us1A.js";
11
+ const at = (t) => {
12
+ if (!t || t === "/") throw new Error("Could not find package.json file");
13
+ const e = o(t, "package.json");
14
+ return U(e) ? e : at(o(t, ".."));
15
+ }, Ft = async (t) => {
16
+ const e = at(t);
17
+ return await rt(e, "utf-8").then(JSON.parse).catch(() => {
18
+ });
19
+ }, xt = async (t) => {
20
+ const e = await Ft(t);
21
+ if (e)
22
+ return e.type;
23
+ };
24
+ let R;
25
+ const it = async (t) => {
26
+ if (R) return R;
27
+ const e = await xt(t);
28
+ return e === "module" ? R = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (R = "cjs"), R || "esm";
29
+ }, B = St({
30
+ level: "debug",
31
+ format: Q.combine(Q.colorize(), Q.cli()),
32
+ transports: [new Ct.Console({})]
33
+ }), zt = (t) => {
34
+ B.error(t);
35
+ };
36
+ function ct(t) {
37
+ return t ? typeof t != "string" ? ct(String(t)) : t.replace(/[\s-]/g, ".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (e, s) => (s > 0 ? "." : "") + e.toLowerCase()) : "";
38
+ }
39
+ const jt = {
40
+ /** Set box model to border-box */
41
+ "*, *::before, *::after": {
42
+ boxSizing: "border-box"
43
+ },
44
+ /** Remove default margin and padding */
45
+ "*": {
46
+ margin: 0
47
+ },
48
+ /** Remove adjust font properties */
49
+ html: {
50
+ lineHeight: 1.15,
51
+ textSizeAdjust: "100%",
52
+ WebkitFontSmoothing: "antialiased"
53
+ },
54
+ /** Make media elements responsive */
55
+ "img, picture, video, canvas, svg": {
56
+ display: "block",
57
+ maxWidth: "100%"
58
+ },
59
+ /** Avoid overflow of text */
60
+ "p, h1, h2, h3, h4, h5, h6": {
61
+ overflowWrap: "break-word"
62
+ },
63
+ /** Improve text wrapping */
64
+ p: {
65
+ textWrap: "pretty"
66
+ },
67
+ "h1, h2, h3, h4, h5, h6": {
68
+ textWrap: "balance"
69
+ },
70
+ /** Improve link color */
71
+ a: {
72
+ color: "currentColor"
73
+ },
74
+ /** Improve button line height */
75
+ button: {
76
+ lineHeight: "1em",
77
+ color: "currentColor"
78
+ },
79
+ /** Improve form elements */
80
+ "input, optgroup, select, textarea": {
81
+ fontFamily: "inherit",
82
+ fontSize: "100%",
83
+ lineHeight: "1.15em"
84
+ }
85
+ }, E = {
86
+ externalModules: [],
87
+ rcFile: void 0,
88
+ destDir: void 0
89
+ }, lt = (t) => {
90
+ if (E.externalModules.length > 0) return E.externalModules;
91
+ const s = v(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
92
+ if (!s) return [];
93
+ const c = s[1].split(",").map((l) => l.replace(/['"`]/g, "").trim());
94
+ return E.externalModules = c, c;
95
+ }, _ = async (t) => {
96
+ if (E.destDir) return E.destDir;
97
+ const e = await Y(t), s = o(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
98
+ return E.destDir = s, s;
99
+ }, ft = ["salty", "css", "styles", "styled"], kt = (t = []) => new RegExp(`\\.(${[...ft, ...t].join("|")})\\.`), X = (t, e = []) => kt(e).test(t), pt = async (t) => {
100
+ if (E.rcFile) return E.rcFile;
101
+ if (t === "/") throw new Error("Could not find .saltyrc.json file");
102
+ const e = o(t, ".saltyrc.json"), s = await rt(e, "utf-8").then(JSON.parse).catch(() => {
103
+ });
104
+ return s ? (E.rcFile = s, s) : pt(o(t, ".."));
105
+ }, Y = async (t) => {
106
+ var c, l;
107
+ const e = await pt(t), s = (c = e.projects) == null ? void 0 : c.find((r) => t.endsWith(r.dir || ""));
108
+ return s || ((l = e.projects) == null ? void 0 : l.find((r) => r.dir === e.defaultProject));
109
+ }, Dt = async (t) => {
110
+ const e = await Y(t), s = await _(t), c = o(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), l = o(s, "salty.config.js"), r = await it(t), a = lt(c);
111
+ await ot.build({
112
+ entryPoints: [c],
113
+ minify: !0,
114
+ treeShaking: !0,
115
+ bundle: !0,
116
+ outfile: l,
117
+ format: r,
118
+ external: a
119
+ });
120
+ const y = Date.now(), { config: p } = await import(`${l}?t=${y}`);
121
+ return p;
122
+ }, Nt = async (t, e) => {
123
+ const s = await Dt(t), c = { ...s }, l = /* @__PURE__ */ new Set(), r = (C, w = []) => C ? Object.entries(C).flatMap(([T, F]) => {
124
+ if (!F) return;
125
+ if (typeof F == "object") return r(F, [...w, T]);
126
+ const J = ct(T), L = K(T), Z = [...w, J].join(".");
127
+ l.add(`"${Z}"`);
128
+ const A = [...w.map(K), L].join("-"), { result: ut } = bt(F);
129
+ return `--${A}: ${ut};`;
130
+ }) : [], a = (C) => C ? Object.entries(C).flatMap(([w, T]) => {
131
+ const F = r(T);
132
+ return w === "base" ? F.join("") : `${w} { ${F.join("")} }`;
133
+ }) : [], y = (C) => C ? Object.entries(C).flatMap(([w, T]) => Object.entries(T).flatMap(([F, J]) => {
134
+ const L = r(J, [w]), Z = `.${w}-${F}, [data-${w}="${F}"]`, A = L.join("");
135
+ return `${Z} { ${A} }`;
136
+ })) : [], p = (C) => e.variables.map((w) => w._current[C]), n = r(W(s.variables, p("variables"))), d = a(W(s.responsiveVariables, p("responsiveVariables"))), u = y(W(s.conditionalVariables, p("conditionalVariables"))), m = await _(t), j = o(m, "css/_variables.css"), k = `:root { ${n.join("")} ${d.join("")} } ${u.join("")}`;
137
+ x(j, k);
138
+ const V = o(m, "css/_global.css"), P = W(s.global, e.globalStyles), D = st(P, "");
139
+ x(V, `@layer global { ${D} }`);
140
+ const M = o(m, "css/_reset.css"), O = s.reset === "none" ? {} : typeof s.reset == "object" ? s.reset : jt, i = st(O, "");
141
+ x(M, `@layer reset { ${i} }`);
142
+ const S = o(m, "css/_templates.css"), b = W(s.templates, e.templates), $ = $t(b), g = wt(b);
143
+ x(S, $), c.templates = b;
144
+ const h = o(m, "types/css-tokens.d.ts"), I = `
145
+ // Variable types
146
+ type VariableTokens = ${[...l].join("|")};
147
+ type PropertyValueToken = \`{\${VariableTokens}}\`;
148
+
149
+ // Template types
150
+ type TemplateTokens = {
151
+ ${Object.entries(g).map(([C, w]) => `${C}?: ${w}`).join(`
152
+ `)}
153
+ }
154
+ `;
155
+ x(h, I);
156
+ const G = o(m, "cache/config-cache.json");
157
+ x(G, JSON.stringify(c, null, 2));
158
+ }, nt = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
159
+ if (/^['"`]/.test(s)) return e;
160
+ const l = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
161
+ if (!l.test(t)) return e;
162
+ const a = l.exec(t);
163
+ if (a) {
164
+ const y = a.at(1);
165
+ if (ft.some((n) => y == null ? void 0 : y.includes(n))) return e;
166
+ }
167
+ return "styled('div',";
168
+ }), tt = async (t, e, s) => {
169
+ const c = H(e), l = o(s, "./temp");
170
+ U(l) || z(l);
171
+ const r = q(e);
172
+ let a = v(e, "utf8");
173
+ a = nt(a);
174
+ const y = o(s, "js", c + ".js"), p = await Y(t), n = o(t, (p == null ? void 0 : p.configDir) || "", "salty.config.ts"), d = lt(n), u = await it(t);
175
+ await ot.build({
176
+ stdin: {
177
+ contents: a,
178
+ sourcefile: r.base,
179
+ resolveDir: r.dir,
180
+ loader: "tsx"
181
+ },
182
+ minify: !1,
183
+ treeShaking: !0,
184
+ bundle: !0,
185
+ outfile: y,
186
+ format: u,
187
+ target: ["node20"],
188
+ keepNames: !0,
189
+ external: d,
190
+ packages: "external",
191
+ plugins: [
192
+ {
193
+ name: "test",
194
+ setup: (k) => {
195
+ k.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (V) => {
196
+ const P = v(V.path, "utf8");
197
+ return { contents: nt(P), loader: "ts" };
198
+ });
199
+ }
200
+ }
201
+ ]
202
+ });
203
+ const m = Date.now();
204
+ return await import(`${y}?t=${m}`);
205
+ }, Pt = async (t) => {
206
+ const e = await _(t), s = o(e, "cache/config-cache.json"), c = v(s, "utf8");
207
+ if (!c) throw new Error("Could not find config cache file");
208
+ return JSON.parse(c);
209
+ }, et = async (t) => {
210
+ const e = await Pt(t), s = await _(t), c = o(s, "salty.config.js"), l = Date.now(), { config: r } = await import(`${c}?t=${l}`);
211
+ return W(r, e);
212
+ }, dt = () => {
213
+ try {
214
+ return process.env.NODE_ENV === "production";
215
+ } catch {
216
+ return !1;
217
+ }
218
+ }, Wt = async (t, e = dt(), s = !0) => {
219
+ try {
220
+ const c = Date.now();
221
+ e ? B.info("Generating CSS in production mode! 🔥") : B.info("Generating CSS in development mode! 🚀");
222
+ const l = [], r = [], a = await _(t), y = o(a, "index.css");
223
+ s && (() => {
224
+ U(a) && mt("rm -rf " + a), z(a, { recursive: !0 }), z(o(a, "css")), z(o(a, "types")), z(o(a, "js")), z(o(a, "cache"));
225
+ })();
226
+ const n = {
227
+ keyframes: [],
228
+ mediaQueries: [],
229
+ globalStyles: [],
230
+ variables: [],
231
+ components: [],
232
+ templates: []
233
+ };
234
+ async function d(i) {
235
+ const S = ["node_modules", "saltygen"], b = gt(i);
236
+ if (b.isDirectory()) {
237
+ const $ = yt(i);
238
+ if (S.some((h) => i.includes(h))) return;
239
+ await Promise.all($.map((h) => d(o(i, h))));
240
+ } else if (b.isFile() && X(i)) {
241
+ const g = await tt(t, i, a);
242
+ Object.entries(g).forEach(([h, f]) => {
243
+ f.isKeyframes ? n.keyframes.push({
244
+ value: f,
245
+ src: i,
246
+ name: h
247
+ }) : f.isMedia ? n.mediaQueries.push(f) : f.isGlobalDefine ? n.globalStyles.push(f) : f.isDefineVariables ? n.variables.push(f) : f.isDefineTemplates ? n.templates.push(f) : f.generator && n.components.push({
248
+ value: f.generator,
249
+ src: i,
250
+ name: h
251
+ });
252
+ });
253
+ }
254
+ }
255
+ await d(t), await Nt(t, n);
256
+ const u = await et(t);
257
+ for (const i of n.keyframes) {
258
+ const { value: S } = i, b = `a_${S.animationName}.css`, $ = `css/${b}`, g = o(a, $);
259
+ l.push(b), x(g, S.css);
260
+ }
261
+ const m = {};
262
+ for (const i of n.components) {
263
+ const { value: S, name: b, src: $ } = i, g = S._withBuildContext({
264
+ name: b,
265
+ config: u,
266
+ prod: e
267
+ });
268
+ r[g.priority] || (r[g.priority] = []), r[g.priority].push(g.cssFileName), u.importStrategy === "component" && (m[$] ? m[$].push(g.cssFileName) : m[$] = [g.cssFileName]);
269
+ const h = `css/${g.cssFileName}`, f = o(a, h);
270
+ x(f, g.css);
271
+ }
272
+ u.importStrategy === "component" && Object.entries(m).forEach(([i, S]) => {
273
+ const b = S.map((I) => `@import url('./${I}');`).join(`
274
+ `), $ = H(i, 6), g = q(i), h = K(g.name), f = o(a, `css/f_${h}-${$}.css`);
275
+ x(f, b);
276
+ });
277
+ const j = l.map((i) => `@import url('./css/${i}');`).join(`
278
+ `);
279
+ let D = `@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
280
+
281
+ ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((i) => {
282
+ try {
283
+ return v(o(a, "css", i), "utf8").length > 0;
284
+ } catch {
285
+ return !1;
286
+ }
287
+ }).map((i) => `@import url('./css/${i}');`).join(`
288
+ `)}
289
+ ${j}`;
290
+ if (u.importStrategy !== "component") {
291
+ const i = r.reduce((S, b, $) => {
292
+ const g = b.reduce((G, C) => {
293
+ var J;
294
+ const w = o(a, "css", C), T = v(w, "utf8"), F = ((J = /.*-([^-]+)-\d+.css/.exec(C)) == null ? void 0 : J.at(1)) || H(w, 6);
295
+ return G.includes(F) ? G : `${G}
296
+ /*start:${F}*/
297
+ ${T}
298
+ /*end:${F}*/
299
+ `;
300
+ }, ""), h = `l_${$}.css`, f = o(a, "css", h), I = `@layer l${$} { ${g}
301
+ }`;
302
+ return x(f, I), `${S}
303
+ @import url('./css/${h}');`;
304
+ }, "");
305
+ D += i;
306
+ }
307
+ x(y, D);
308
+ const N = Date.now() - c, O = N < 200 ? "🔥" : N < 500 ? "🚀" : N < 1e3 ? "🎉" : N < 2e3 ? "🚗" : N < 5e3 ? "🤔" : "🥴";
309
+ B.info(`Generated CSS in ${N}ms! ${O}`);
310
+ } catch (c) {
311
+ console.error(c);
312
+ }
313
+ }, It = async (t, e) => {
314
+ try {
315
+ const s = await _(t);
316
+ if (X(e)) {
317
+ const l = [], r = await et(t), a = await tt(t, e, s);
318
+ Object.entries(a).forEach(([y, p]) => {
319
+ if (p.isKeyframes && p.css) {
320
+ const j = `css/${`a_${p.animationName}.css`}`, k = o(s, j);
321
+ x(k, p.css);
322
+ return;
323
+ }
324
+ if (!p.generator) return;
325
+ const n = p.generator._withBuildContext({
326
+ name: y,
327
+ config: r
328
+ }), d = `css/${n.cssFileName}`, u = o(s, d);
329
+ x(u, n.css), l[n.priority] || (l[n.priority] = []), l[n.priority].push(n.cssFileName);
330
+ }), r.importStrategy !== "component" && l.forEach((y, p) => {
331
+ const n = `l_${p}.css`, d = o(s, "css", n);
332
+ let u = v(d, "utf8");
333
+ y.forEach((m) => {
334
+ var P;
335
+ const j = o(s, "css", m), k = ((P = /.*-([^-]+)-\d+.css/.exec(m)) == null ? void 0 : P.at(1)) || H(j, 6);
336
+ if (!u.includes(k)) {
337
+ const D = v(j, "utf8"), M = `/*start:${k}*/
338
+ ${D}
339
+ /*end:${k}*/
340
+ `;
341
+ u = `${u.replace(/\}$/, "")}
342
+ ${M}
343
+ }`;
344
+ }
345
+ }), x(d, u);
346
+ });
347
+ }
348
+ } catch (s) {
349
+ console.error(s);
350
+ }
351
+ }, Gt = async (t, e, s = dt()) => {
352
+ try {
353
+ const c = await _(t);
354
+ if (X(e)) {
355
+ const r = v(e, "utf8");
356
+ r.replace(/^(?!export\s)const\s.*/gm, (d) => `export ${d}`) !== r && await ht(e, r);
357
+ const y = await et(t), p = await tt(t, e, c);
358
+ let n = r;
359
+ if (Object.entries(p).forEach(([d, u]) => {
360
+ var h;
361
+ if (u.isKeyframes || !u.generator) return;
362
+ const m = u.generator._withBuildContext({
363
+ name: d,
364
+ config: y,
365
+ prod: s
366
+ }), j = new RegExp(`\\s${d}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(r);
367
+ if (!j) return console.error("Could not find the original declaration");
368
+ const k = (h = j.at(1)) == null ? void 0 : h.trim(), V = new RegExp(`\\s${d}[=\\s]+styled\\(`, "g").exec(n);
369
+ if (!V) return console.error("Could not find the original declaration");
370
+ const { index: P } = V;
371
+ let D = !1;
372
+ const M = setTimeout(() => D = !0, 5e3);
373
+ let N = 0, O = !1, i = 0;
374
+ for (; !O && !D; ) {
375
+ const f = n[P + N];
376
+ f === "(" && i++, f === ")" && i--, i === 0 && f === ")" && (O = !0), N > n.length && (D = !0), N++;
377
+ }
378
+ if (!D) clearTimeout(M);
379
+ else throw new Error("Failed to find the end of the styled call and timed out");
380
+ const S = P + N, b = n.slice(P, S), $ = n, g = ` ${d} = styled(${k}, "${m.classNames}", ${JSON.stringify(m.props)});`;
381
+ n = n.replace(b, g), $ === n && console.error("Minimize file failed to change content", { name: d, tagName: k });
382
+ }), y.importStrategy === "component") {
383
+ const d = H(e, 6), u = q(e);
384
+ n = `import '../../saltygen/css/${`f_${K(u.name)}-${d}.css`}';
385
+ ${n}`;
386
+ }
387
+ return n = n.replace("{ styled }", "{ styledClient as styled }"), n = n.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), n;
388
+ }
389
+ } catch (c) {
390
+ console.error("Error in minimizeFile:", c);
391
+ }
392
+ };
393
+ export {
394
+ zt as a,
395
+ kt as b,
396
+ Nt as c,
397
+ tt as d,
398
+ It as e,
399
+ Wt as g,
400
+ X as i,
401
+ B as l,
402
+ Gt as m,
403
+ ft as s
404
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";const ue=require("esbuild"),ye=require("child_process"),_=require("./dash-case-BJEkFEGQ.cjs"),o=require("path"),i=require("fs"),Q=require("fs/promises"),A=require("./parse-styles-3zK35muR.cjs"),te=require("./parse-templates-VIvmVb52.cjs"),I=require("winston"),z=require("./merge-DxGoJDHv.cjs");var U=typeof document<"u"?document.currentScript:null;function ge(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const ne=ge(ue),oe=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=o.join(e,"package.json");return i.existsSync(t)?t:oe(o.join(e,".."))},me=async e=>{const t=oe(e);return await Q.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},he=async e=>{const t=await me(e);if(t)return t.type};let J;const ie=async e=>{if(J)return J;const t=await he(e);return t==="module"?J="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:U&&U.tagName.toUpperCase()==="SCRIPT"&&U.src||new URL("index-zPXqhZf1.cjs",document.baseURI).href).endsWith(".cjs"))&&(J="cjs"),J||"esm"},W=I.createLogger({level:"debug",format:I.format.combine(I.format.colorize(),I.format.cli()),transports:[new I.transports.Console({})]}),Se=e=>{W.error(e)};function re(e){return e?typeof e!="string"?re(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const be={"*, *::before, *::after":{boxSizing:"border-box"},"*":{margin:0},html:{lineHeight:1.15,textSizeAdjust:"100%",WebkitFontSmoothing:"antialiased"},"img, picture, video, canvas, svg":{display:"block",maxWidth:"100%"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},p:{textWrap:"pretty"},"h1, h2, h3, h4, h5, h6":{textWrap:"balance"},a:{color:"currentColor"},button:{lineHeight:"1em",color:"currentColor"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},E={externalModules:[],rcFile:void 0,destDir:void 0},ce=e=>{if(E.externalModules.length>0)return E.externalModules;const s=i.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const r=s[1].split(",").map(f=>f.replace(/['"`]/g,"").trim());return E.externalModules=r,r},M=async e=>{if(E.destDir)return E.destDir;const t=await Y(e),s=o.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return E.destDir=s,s},X=["salty","css","styles","styled"],ae=(e=[])=>new RegExp(`\\.(${[...X,...e].join("|")})\\.`),G=(e,t=[])=>ae(t).test(e),le=async e=>{if(E.rcFile)return E.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=o.join(e,".saltyrc.json"),s=await Q.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(E.rcFile=s,s):le(o.join(e,".."))},Y=async e=>{var r,f;const t=await le(e),s=(r=t.projects)==null?void 0:r.find(c=>e.endsWith(c.dir||""));return s||((f=t.projects)==null?void 0:f.find(c=>c.dir===t.defaultProject))},we=async e=>{const t=await Y(e),s=await M(e),r=o.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),f=o.join(s,"salty.config.js"),c=await ie(e),a=ce(r);await ne.build({entryPoints:[r],minify:!0,treeShaking:!0,bundle:!0,outfile:f,format:c,external:a});const h=Date.now(),{config:p}=await import(`${f}?t=${h}`);return p},fe=async(e,t)=>{const s=await we(e),r={...s},f=new Set,c=($,j=[])=>$?Object.entries($).flatMap(([T,C])=>{if(!C)return;if(typeof C=="object")return c(C,[...j,T]);const R=re(T),B=_.dashCase(T),K=[...j,R].join(".");f.add(`"${K}"`);const Z=[...j.map(_.dashCase),B].join("-"),{result:pe}=A.parseValueTokens(C);return`--${Z}: ${pe};`}):[],a=$=>$?Object.entries($).flatMap(([j,T])=>{const C=c(T);return j==="base"?C.join(""):`${j} { ${C.join("")} }`}):[],h=$=>$?Object.entries($).flatMap(([j,T])=>Object.entries(T).flatMap(([C,R])=>{const B=c(R,[j]),K=`.${j}-${C}, [data-${j}="${C}"]`,Z=B.join("");return`${K} { ${Z} }`})):[],p=$=>t.variables.map(j=>j._current[$]),n=c(z.mergeStyles(s.variables,p("variables"))),u=a(z.mergeStyles(s.responsiveVariables,p("responsiveVariables"))),y=h(z.mergeStyles(s.conditionalVariables,p("conditionalVariables"))),g=await M(e),x=o.join(g,"css/_variables.css"),k=`:root { ${n.join("")} ${u.join("")} } ${y.join("")}`;i.writeFileSync(x,k);const v=o.join(g,"css/_global.css"),P=z.mergeStyles(s.global,t.globalStyles),D=A.parseStyles(P,"");i.writeFileSync(v,`@layer global { ${D} }`);const O=o.join(g,"css/_reset.css"),V=s.reset==="none"?{}:typeof s.reset=="object"?s.reset:be,l=A.parseStyles(V,"");i.writeFileSync(O,`@layer reset { ${l} }`);const F=o.join(g,"css/_templates.css"),b=z.mergeStyles(s.templates,t.templates),w=te.parseTemplates(b),m=te.getTemplateTypes(b);i.writeFileSync(F,w),r.templates=b;const S=o.join(g,"types/css-tokens.d.ts"),q=`
2
+ // Variable types
3
+ type VariableTokens = ${[...f].join("|")};
4
+ type PropertyValueToken = \`{\${VariableTokens}}\`;
5
+
6
+ // Template types
7
+ type TemplateTokens = {
8
+ ${Object.entries(m).map(([$,j])=>`${$}?: ${j}`).join(`
9
+ `)}
10
+ }
11
+ `;i.writeFileSync(S,q);const H=o.join(g,"cache/config-cache.json");i.writeFileSync(H,JSON.stringify(r,null,2))},se=e=>e.replace(/styled\(([^"'`{,]+),/g,(t,s)=>{if(/^['"`]/.test(s))return t;const f=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!f.test(e))return t;const a=f.exec(e);if(a){const h=a.at(1);if(X.some(n=>h==null?void 0:h.includes(n)))return t}return"styled('div',"}),L=async(e,t,s)=>{const r=_.toHash(t),f=o.join(s,"./temp");i.existsSync(f)||i.mkdirSync(f);const c=o.parse(t);let a=i.readFileSync(t,"utf8");a=se(a);const h=o.join(s,"js",r+".js"),p=await Y(e),n=o.join(e,(p==null?void 0:p.configDir)||"","salty.config.ts"),u=ce(n),y=await ie(e);await ne.build({stdin:{contents:a,sourcefile:c.base,resolveDir:c.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:h,format:y,target:["node20"],keepNames:!0,external:u,packages:"external",plugins:[{name:"test",setup:k=>{k.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},v=>{const P=i.readFileSync(v.path,"utf8");return{contents:se(P),loader:"ts"}})}}]});const g=Date.now();return await import(`${h}?t=${g}`)},je=async e=>{const t=await M(e),s=o.join(t,"cache/config-cache.json"),r=i.readFileSync(s,"utf8");if(!r)throw new Error("Could not find config cache file");return JSON.parse(r)},ee=async e=>{const t=await je(e),s=await M(e),r=o.join(s,"salty.config.js"),f=Date.now(),{config:c}=await import(`${r}?t=${f}`);return z.mergeStyles(c,t)},de=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Fe=async(e,t=de(),s=!0)=>{try{const r=Date.now();t?W.info("Generating CSS in production mode! 🔥"):W.info("Generating CSS in development mode! 🚀");const f=[],c=[],a=await M(e),h=o.join(a,"index.css");s&&(()=>{i.existsSync(a)&&ye.execSync("rm -rf "+a),i.mkdirSync(a,{recursive:!0}),i.mkdirSync(o.join(a,"css")),i.mkdirSync(o.join(a,"types")),i.mkdirSync(o.join(a,"js")),i.mkdirSync(o.join(a,"cache"))})();const n={keyframes:[],mediaQueries:[],globalStyles:[],variables:[],components:[],templates:[]};async function u(l){const F=["node_modules","saltygen"],b=i.statSync(l);if(b.isDirectory()){const w=i.readdirSync(l);if(F.some(S=>l.includes(S)))return;await Promise.all(w.map(S=>u(o.join(l,S))))}else if(b.isFile()&&G(l)){const m=await L(e,l,a);Object.entries(m).forEach(([S,d])=>{d.isKeyframes?n.keyframes.push({value:d,src:l,name:S}):d.isMedia?n.mediaQueries.push(d):d.isGlobalDefine?n.globalStyles.push(d):d.isDefineVariables?n.variables.push(d):d.isDefineTemplates?n.templates.push(d):d.generator&&n.components.push({value:d.generator,src:l,name:S})})}}await u(e),await fe(e,n);const y=await ee(e);for(const l of n.keyframes){const{value:F}=l,b=`a_${F.animationName}.css`,w=`css/${b}`,m=o.join(a,w);f.push(b),i.writeFileSync(m,F.css)}const g={};for(const l of n.components){const{value:F,name:b,src:w}=l,m=F._withBuildContext({name:b,config:y,prod:t});c[m.priority]||(c[m.priority]=[]),c[m.priority].push(m.cssFileName),y.importStrategy==="component"&&(g[w]?g[w].push(m.cssFileName):g[w]=[m.cssFileName]);const S=`css/${m.cssFileName}`,d=o.join(a,S);i.writeFileSync(d,m.css)}y.importStrategy==="component"&&Object.entries(g).forEach(([l,F])=>{const b=F.map(q=>`@import url('./${q}');`).join(`
12
+ `),w=_.toHash(l,6),m=o.parse(l),S=_.dashCase(m.name),d=o.join(a,`css/f_${S}-${w}.css`);i.writeFileSync(d,b)});const x=f.map(l=>`@import url('./css/${l}');`).join(`
13
+ `);let D=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
14
+
15
+ ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(l=>{try{return i.readFileSync(o.join(a,"css",l),"utf8").length>0}catch{return!1}}).map(l=>`@import url('./css/${l}');`).join(`
16
+ `)}
17
+ ${x}`;if(y.importStrategy!=="component"){const l=c.reduce((F,b,w)=>{const m=b.reduce((H,$)=>{var R;const j=o.join(a,"css",$),T=i.readFileSync(j,"utf8"),C=((R=/.*-([^-]+)-\d+.css/.exec($))==null?void 0:R.at(1))||_.toHash(j,6);return H.includes(C)?H:`${H}
18
+ /*start:${C}*/
19
+ ${T}
20
+ /*end:${C}*/
21
+ `},""),S=`l_${w}.css`,d=o.join(a,"css",S),q=`@layer l${w} { ${m}
22
+ }`;return i.writeFileSync(d,q),`${F}
23
+ @import url('./css/${S}');`},"");D+=l}i.writeFileSync(h,D);const N=Date.now()-r,V=N<200?"🔥":N<500?"🚀":N<1e3?"🎉":N<2e3?"🚗":N<5e3?"🤔":"🥴";W.info(`Generated CSS in ${N}ms! ${V}`)}catch(r){console.error(r)}},$e=async(e,t)=>{try{const s=await M(e);if(G(t)){const f=[],c=await ee(e),a=await L(e,t,s);Object.entries(a).forEach(([h,p])=>{if(p.isKeyframes&&p.css){const x=`css/${`a_${p.animationName}.css`}`,k=o.join(s,x);i.writeFileSync(k,p.css);return}if(!p.generator)return;const n=p.generator._withBuildContext({name:h,config:c}),u=`css/${n.cssFileName}`,y=o.join(s,u);i.writeFileSync(y,n.css),f[n.priority]||(f[n.priority]=[]),f[n.priority].push(n.cssFileName)}),c.importStrategy!=="component"&&f.forEach((h,p)=>{const n=`l_${p}.css`,u=o.join(s,"css",n);let y=i.readFileSync(u,"utf8");h.forEach(g=>{var P;const x=o.join(s,"css",g),k=((P=/.*-([^-]+)-\d+.css/.exec(g))==null?void 0:P.at(1))||_.toHash(x,6);if(!y.includes(k)){const D=i.readFileSync(x,"utf8"),O=`/*start:${k}*/
24
+ ${D}
25
+ /*end:${k}*/
26
+ `;y=`${y.replace(/\}$/,"")}
27
+ ${O}
28
+ }`}}),i.writeFileSync(u,y)})}}catch(s){console.error(s)}},Ce=async(e,t,s=de())=>{try{const r=await M(e);if(G(t)){const c=i.readFileSync(t,"utf8");c.replace(/^(?!export\s)const\s.*/gm,u=>`export ${u}`)!==c&&await Q.writeFile(t,c);const h=await ee(e),p=await L(e,t,r);let n=c;if(Object.entries(p).forEach(([u,y])=>{var S;if(y.isKeyframes||!y.generator)return;const g=y.generator._withBuildContext({name:u,config:h,prod:s}),x=new RegExp(`\\s${u}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(c);if(!x)return console.error("Could not find the original declaration");const k=(S=x.at(1))==null?void 0:S.trim(),v=new RegExp(`\\s${u}[=\\s]+styled\\(`,"g").exec(n);if(!v)return console.error("Could not find the original declaration");const{index:P}=v;let D=!1;const O=setTimeout(()=>D=!0,5e3);let N=0,V=!1,l=0;for(;!V&&!D;){const d=n[P+N];d==="("&&l++,d===")"&&l--,l===0&&d===")"&&(V=!0),N>n.length&&(D=!0),N++}if(!D)clearTimeout(O);else throw new Error("Failed to find the end of the styled call and timed out");const F=P+N,b=n.slice(P,F),w=n,m=` ${u} = styled(${k}, "${g.classNames}", ${JSON.stringify(g.props)});`;n=n.replace(b,m),w===n&&console.error("Minimize file failed to change content",{name:u,tagName:k})}),h.importStrategy==="component"){const u=_.toHash(t,6),y=o.parse(t);n=`import '../../saltygen/css/${`f_${_.dashCase(y.name)}-${u}.css`}';
29
+ ${n}`}return n=n.replace("{ styled }","{ styledClient as styled }"),n=n.replace("@salty-css/react/styled","@salty-css/react/styled-client"),n}}catch(r){console.error("Error in minimizeFile:",r)}};exports.compileSaltyFile=L;exports.generateConfigStyles=fe;exports.generateCss=Fe;exports.generateFile=$e;exports.isSaltyFile=G;exports.logError=Se;exports.logger=W;exports.minimizeFile=Ce;exports.saltyFileExtensions=X;exports.saltyFileRegExp=ae;
@@ -0,0 +1,4 @@
1
+ const e = (...u) => u.flat().reduce((n, r) => r != null && r._current ? { ...n, ...r._current } : { ...n, ...r }, {});
2
+ export {
3
+ e as m
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";const n=(...u)=>u.flat().reduce((e,r)=>r!=null&&r._current?{...e,...r._current}:{...e,...r},{});exports.mergeStyles=n;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.18",
3
+ "version": "0.0.1-alpha.181",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -10,7 +10,12 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "homepage": "https://github.com/margarita-form/salty-css",
13
+ "description": "Core library for Salty CSS. Will be used by other Salty CSS libraries and plugins.",
14
+ "homepage": "https://salty-css.dev/",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/margarita-form/salty-css.git"
18
+ },
14
19
  "bugs": {
15
20
  "url": "https://github.com/margarita-form/salty-css/issues"
16
21
  },
@@ -26,10 +31,15 @@
26
31
  "commander": ">=12.x",
27
32
  "ejs": ">=3.x",
28
33
  "esbuild": ">=0.21.x",
34
+ "ora": ">=8.x",
29
35
  "react": ">=18.x || >=19.x",
30
36
  "winston": ">=3.x"
31
37
  },
32
38
  "exports": {
39
+ "./bin/main": {
40
+ "import": "./bin/main.js",
41
+ "require": "./bin/main.cjs"
42
+ },
33
43
  "./compiler": {
34
44
  "import": "./compiler/index.js",
35
45
  "require": "./compiler/index.cjs"
@@ -0,0 +1,7 @@
1
+ "use strict";const V=require("./dash-case-BJEkFEGQ.cjs"),q=(r,o)=>{if(typeof r!="string")return{result:r};if(!o)return{result:r};const e=[];return Object.values(o).forEach(p=>{const{pattern:h,transform:b}=p;r=r.replace(h,n=>{const{value:a,css:t}=b(n);return t&&e.push(t),a})}),{result:r,additionalCss:e}},E=r=>typeof r!="string"?{result:r}:/\{[^{}]+\}/g.test(r)?{result:r.replace(/\{([^{}]+)\}/g,(...p)=>`var(--${V.dashCase(p[1].replaceAll(".","-"))})`)}:{result:r},$=(r,o,e)=>{if(!r)return"";const p=[],h=Object.entries(r).reduce((n,[a,t])=>{const s=a.trim();if(typeof t=="function"&&(t=t()),typeof t=="object"){if(!t)return n;if(s==="variants")return Object.entries(t).forEach(([i,f])=>{f&&Object.entries(f).forEach(([y,d])=>{if(!d)return;const l=`${o}.${i}-${y}`,m=$(d,l,e);p.push(m)})}),n;if(s==="defaultVariants")return n;if(s==="compoundVariants")return t.forEach(i=>{const{css:f,...y}=i,d=Object.entries(y).reduce((m,[w,W])=>`${m}.${w}-${W}`,o),l=$(f,d,e);p.push(l)}),n;if(s.startsWith("@")){const i=$(t,o,e),f=`${s} {
2
+ ${i.replace(`
3
+ `,`
4
+ `)}
5
+ }`;return p.push(f),n}const u=a.includes("&")?s.replace("&",o):s.startsWith(":")?`${o}${s}`:`${o} ${s}`,c=$(t,u,e);return p.push(c),n}if(e!=null&&e.templates&&e.templates[s]){const c=t.split(".").reduce((i,f)=>i[f],e.templates[s]);if(c){const i=$(c,"");return`${n}${i}`}return console.warn(`Template "${s}" with path of "${t}" was not found in config!`),n}const O=s.startsWith("-")?s:V.dashCase(s),j=(u,c=";")=>n=`${n}${u}${c}`,S=u=>j(`${O}:${u}`);if(typeof t=="number")return S(t);if(typeof t!="string")if("toString"in t)t=t.toString();else return n;const{modifiers:T}=e||{},k=function*(){yield E(t),yield q(t,T)}();for(const{result:u,additionalCss:c=[]}of k)t=u,c.forEach(i=>{const f=$(i,"");j(f,"")});return S(t)},"");return h?o?[`${o} { ${h} }`,...p].join(`
6
+ `):h:p.join(`
7
+ `)};exports.parseStyles=$;exports.parseValueTokens=E;
@@ -0,0 +1,75 @@
1
+ import { d as O } from "./dash-case-DBThphLm.js";
2
+ const W = (r, o) => {
3
+ if (typeof r != "string") return { result: r };
4
+ if (!o) return { result: r };
5
+ const e = [];
6
+ return Object.values(o).forEach((p) => {
7
+ const { pattern: $, transform: j } = p;
8
+ r = r.replace($, (n) => {
9
+ const { value: a, css: t } = j(n);
10
+ return t && e.push(t), a;
11
+ });
12
+ }), { result: r, additionalCss: e };
13
+ }, P = (r) => typeof r != "string" ? { result: r } : /\{[^{}]+\}/g.test(r) ? { result: r.replace(/\{([^{}]+)\}/g, (...p) => `var(--${O(p[1].replaceAll(".", "-"))})`) } : { result: r }, h = (r, o, e) => {
14
+ if (!r) return "";
15
+ const p = [], $ = Object.entries(r).reduce((n, [a, t]) => {
16
+ const s = a.trim();
17
+ if (typeof t == "function" && (t = t()), typeof t == "object") {
18
+ if (!t) return n;
19
+ if (s === "variants")
20
+ return Object.entries(t).forEach(([i, f]) => {
21
+ f && Object.entries(f).forEach(([m, d]) => {
22
+ if (!d) return;
23
+ const y = `${o}.${i}-${m}`, b = h(d, y, e);
24
+ p.push(b);
25
+ });
26
+ }), n;
27
+ if (s === "defaultVariants")
28
+ return n;
29
+ if (s === "compoundVariants")
30
+ return t.forEach((i) => {
31
+ const { css: f, ...m } = i, d = Object.entries(m).reduce((b, [k, w]) => `${b}.${k}-${w}`, o), y = h(f, d, e);
32
+ p.push(y);
33
+ }), n;
34
+ if (s.startsWith("@")) {
35
+ const i = h(t, o, e), f = `${s} {
36
+ ${i.replace(`
37
+ `, `
38
+ `)}
39
+ }`;
40
+ return p.push(f), n;
41
+ }
42
+ const c = a.includes("&") ? s.replace("&", o) : s.startsWith(":") ? `${o}${s}` : `${o} ${s}`, u = h(t, c, e);
43
+ return p.push(u), n;
44
+ }
45
+ if (e != null && e.templates && e.templates[s]) {
46
+ const u = t.split(".").reduce((i, f) => i[f], e.templates[s]);
47
+ if (u) {
48
+ const i = h(u, "");
49
+ return `${n}${i}`;
50
+ }
51
+ return console.warn(`Template "${s}" with path of "${t}" was not found in config!`), n;
52
+ }
53
+ const S = s.startsWith("-") ? s : O(s), l = (c, u = ";") => n = `${n}${c}${u}`, E = (c) => l(`${S}:${c}`);
54
+ if (typeof t == "number") return E(t);
55
+ if (typeof t != "string")
56
+ if ("toString" in t) t = t.toString();
57
+ else return n;
58
+ const { modifiers: V } = e || {}, T = function* () {
59
+ yield P(t), yield W(t, V);
60
+ }();
61
+ for (const { result: c, additionalCss: u = [] } of T)
62
+ t = c, u.forEach((i) => {
63
+ const f = h(i, "");
64
+ l(f, "");
65
+ });
66
+ return E(t);
67
+ }, "");
68
+ return $ ? o ? [`${o} { ${$} }`, ...p].join(`
69
+ `) : $ : p.join(`
70
+ `);
71
+ };
72
+ export {
73
+ P as a,
74
+ h as p
75
+ };
@@ -0,0 +1,27 @@
1
+ import { d as p } from "./dash-case-DBThphLm.js";
2
+ import { p as u } from "./parse-styles-DrLhKtqW.js";
3
+ const a = (e, t = []) => {
4
+ if (!e) return "";
5
+ const s = [], r = {};
6
+ if (Object.entries(e).forEach(([n, o]) => {
7
+ if (typeof o == "object") {
8
+ if (!o) return;
9
+ const i = n.trim(), f = a(o, [...t, i]);
10
+ s.push(f);
11
+ } else
12
+ r[n] = o;
13
+ }), Object.keys(r).length) {
14
+ const n = t.map(p).join("-"), o = u(r, `.${n}`);
15
+ s.push(o);
16
+ }
17
+ return s.join(`
18
+ `);
19
+ }, m = (e) => Object.keys(e), b = (e) => e ? Object.entries(e).reduce((t, [s, r]) => (typeof r == "object" && (t[s] = c(r).map((n) => `"${n}"`).join(" | ")), t), {}) : {}, c = (e, t = "", s = /* @__PURE__ */ new Set()) => e ? (Object.entries(e).forEach(([r, n]) => {
20
+ const o = t ? `${t}.${r}` : r;
21
+ return typeof n == "object" ? c(n, o, s) : s.add(t);
22
+ }), [...s]) : [];
23
+ export {
24
+ b as a,
25
+ m as g,
26
+ a as p
27
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";const p=require("./dash-case-BJEkFEGQ.cjs"),y=require("./parse-styles-3zK35muR.cjs"),o=(e,t=[])=>{if(!e)return"";const s=[],r={};if(Object.entries(e).forEach(([n,c])=>{if(typeof c=="object"){if(!c)return;const u=n.trim(),f=o(c,[...t,u]);s.push(f)}else r[n]=c}),Object.keys(r).length){const n=t.map(p.dashCase).join("-"),c=y.parseStyles(r,`.${n}`);s.push(c)}return s.join(`
2
+ `)},a=e=>Object.keys(e),j=e=>e?Object.entries(e).reduce((t,[s,r])=>(typeof r=="object"&&(t[s]=i(r).map(n=>`"${n}"`).join(" | ")),t),{}):{},i=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([r,n])=>{const c=t?`${t}.${r}`:r;return typeof n=="object"?i(n,c,s):s.add(t)}),[...s]):[];exports.getTemplateKeys=a;exports.getTemplateTypes=j;exports.parseTemplates=o;
@@ -0,0 +1,18 @@
1
+ const n = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
2
+
3
+ interface <%- componentName %>Props {
4
+ text?: string;
5
+ }
6
+
7
+ export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName %>Props) => {
8
+ return (
9
+ <<%- styledComponentName %>>
10
+ {text}
11
+ </<%- styledComponentName %>>
12
+ );
13
+ };
14
+
15
+ export default <%- componentName %>;`;
16
+ export {
17
+ n as default
18
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { <%- styledComponentName %> } from "./<%- fileName %>.css";
2
+
3
+ interface <%- componentName %>Props {
4
+ text?: string;
5
+ }
6
+
7
+ export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName %>Props) => {
8
+ return (
9
+ <<%- styledComponentName %>>
10
+ {text}
11
+ </<%- styledComponentName %>>
12
+ );
13
+ };
14
+
15
+ export default <%- componentName %>;`;exports.default=e;
@@ -2,6 +2,7 @@ const n = `import { defineConfig } from '@salty-css/core/config';
2
2
 
3
3
  export const config = defineConfig({
4
4
  // Add your custom config here
5
+ externalModules: ['react', 'react-dom']
5
6
  });
6
7
  `;
7
8
  export {