@salty-css/core 0.0.1-alpha.99 → 0.1.0-alpha.0
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/.saltyrc.schema.json +11 -3
- package/README.md +415 -47
- package/bin/index.cjs +3 -1
- package/bin/index.js +2 -2
- package/bin/main.cjs +448 -11
- package/bin/main.js +411 -209
- package/cache/resolve-dynamic-config-cache.cjs +24 -0
- package/cache/resolve-dynamic-config-cache.d.ts +1 -0
- package/cache/resolve-dynamic-config-cache.js +24 -0
- package/class-name-generator-B2Pb2obX.cjs +74 -0
- package/class-name-generator-YeSQe_Ik.js +75 -0
- package/compiler/get-files.cjs +25 -0
- package/compiler/get-files.js +25 -0
- package/compiler/get-function-range.cjs +22 -0
- package/compiler/get-function-range.d.ts +1 -0
- package/compiler/get-function-range.js +22 -0
- package/compiler/helpers.cjs +25 -0
- package/compiler/helpers.d.ts +5 -0
- package/compiler/helpers.js +24 -0
- package/compiler/salty-compiler.cjs +707 -0
- package/compiler/salty-compiler.d.ts +57 -0
- package/compiler/salty-compiler.js +689 -0
- package/config/define-config.d.ts +1 -1
- package/config/index.cjs +16 -1
- package/config/index.d.ts +2 -1
- package/config/index.js +14 -2
- package/css/index.cjs +12 -1
- package/css/index.d.ts +4 -1
- package/css/index.js +10 -2
- package/css/keyframes.cjs +49 -0
- package/css/keyframes.d.ts +22 -0
- package/css/keyframes.js +49 -0
- package/css/media.cjs +93 -0
- package/css/media.d.ts +87 -0
- package/css/media.js +93 -0
- package/css/merge.cjs +15 -0
- package/css/merge.d.ts +7 -0
- package/css/merge.js +15 -0
- package/css/token.cjs +4 -0
- package/css/token.d.ts +1 -0
- package/css/token.js +4 -0
- package/dash-case-DIwKaYgE.cjs +9 -0
- package/dash-case-DblXvymC.js +10 -0
- package/define-templates-CVhhgPnd.js +60 -0
- package/define-templates-Deq1aCbN.cjs +59 -0
- package/factories/define-global-styles.d.ts +7 -0
- package/factories/define-media-query.d.ts +8 -0
- package/factories/define-templates.d.ts +27 -0
- package/factories/define-variables.d.ts +12 -0
- package/factories/index.cjs +37 -0
- package/factories/index.d.ts +4 -0
- package/factories/index.js +37 -0
- package/generators/class-name-generator.d.ts +7 -0
- package/generators/index.cjs +57 -0
- package/generators/index.d.ts +2 -0
- package/generators/index.js +58 -0
- package/generators/styled-generator.d.ts +20 -0
- package/generators/styles-generator.d.ts +22 -0
- package/helpers/color.d.ts +18 -0
- package/helpers/index.cjs +53 -0
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +53 -0
- package/helpers/viewport-clamp.d.ts +9 -0
- package/index-ByR0nfaf.cjs +4 -0
- package/index-DKz1QXqs.js +4 -0
- package/instances/classname-instance.cjs +31 -0
- package/instances/classname-instance.d.ts +10 -0
- package/instances/classname-instance.js +31 -0
- package/package.json +71 -8
- package/parse-styles-BTIoYnBr.js +232 -0
- package/parse-styles-CA3TP5n1.cjs +231 -0
- package/parsers/index.cjs +58 -0
- package/parsers/index.d.ts +5 -0
- package/parsers/index.js +59 -0
- package/parsers/parse-modifiers.d.ts +3 -0
- package/parsers/parse-styles.d.ts +13 -0
- package/parsers/parse-templates.d.ts +4 -0
- package/parsers/parse-tokens.d.ts +3 -0
- package/parsers/parser-types.d.ts +8 -0
- package/parsers/property-name-check.d.ts +1 -0
- package/parsers/unit-check.d.ts +7 -0
- package/pascal-case-By_l58S-.cjs +7 -0
- package/pascal-case-F3Usi5Wf.js +8 -0
- package/{react-styled-file-CGVf5n1B.js → react-styled-file-B99mwk0w.js} +2 -2
- package/react-styled-file-U02jek-B.cjs +11 -0
- package/react-vanilla-file-Bj6XC8GS.cjs +18 -0
- package/{react-vanilla-file-CCXbsjIb.js → react-vanilla-file-D9px70iK.js} +2 -2
- package/runtime/index.cjs +11 -0
- package/runtime/index.d.ts +7 -0
- package/runtime/index.js +11 -0
- package/salty.config-DjosWdPw.js +4 -0
- package/salty.config-cqavVm2t.cjs +4 -0
- package/server/index.cjs +4 -0
- package/server/index.d.ts +1 -0
- package/server/index.js +4 -0
- package/server/should-restart.d.ts +1 -0
- package/should-restart-CQsyHls3.cjs +17 -0
- package/should-restart-CXIO0jxY.js +18 -0
- package/templates/salty-reset.d.ts +2 -0
- package/to-hash-C05Y906F.cjs +24 -0
- package/to-hash-DAN2LcHK.js +25 -0
- package/types/cli-types.d.ts +10 -0
- package/types/config-types.d.ts +85 -0
- package/types/index.d.ts +44 -23
- package/util/dot-case.d.ts +1 -0
- package/util/index.cjs +14 -1
- package/util/index.js +11 -8
- package/viewport-clamp-CEmzmcSj.cjs +10 -0
- package/viewport-clamp-K553uXu3.js +11 -0
- package/compiler/index.cjs +0 -1
- package/compiler/index.d.ts +0 -16
- package/compiler/index.js +0 -18
- package/config/config-types.d.ts +0 -65
- package/dash-case-DKzpenwY.cjs +0 -1
- package/dash-case-DMQMcCO6.js +0 -19
- package/generator/index.cjs +0 -1
- package/generator/index.d.ts +0 -1
- package/generator/index.js +0 -65
- package/generator/parse-modifiers.d.ts +0 -3
- package/generator/parse-styles.d.ts +0 -2
- package/generator/parse-templates.d.ts +0 -2
- package/generator/parse-tokens.d.ts +0 -2
- package/generator/parser-types.d.ts +0 -4
- package/generator/style-generator.d.ts +0 -33
- package/index-84Wroia-.cjs +0 -1
- package/index-BGaLvshf.js +0 -232
- package/index-BKoD9apd.cjs +0 -11
- package/index-D_732b92.js +0 -4
- package/parse-templates-DUUSaubj.js +0 -96
- package/parse-templates-DVK3iZIl.cjs +0 -8
- package/pascal-case-BQpR5PdN.js +0 -6
- package/pascal-case-iWoaJWwT.cjs +0 -1
- package/react-styled-file-Dkubsz-U.cjs +0 -8
- package/react-vanilla-file-CG_WJLam.cjs +0 -15
- package/salty.config-BhBY_oOk.js +0 -10
- package/salty.config-Dk6ZcCxI.cjs +0 -7
package/generator/index.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var p = Object.defineProperty;
|
|
2
|
-
var m = (e, t, s) => t in e ? p(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
-
var n = (e, t, s) => m(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
-
import { t as l } from "../dash-case-DMQMcCO6.js";
|
|
5
|
-
import { g, p as u } from "../parse-templates-DUUSaubj.js";
|
|
6
|
-
class N {
|
|
7
|
-
constructor(t, s) {
|
|
8
|
-
n(this, "_isProd");
|
|
9
|
-
n(this, "_callerName");
|
|
10
|
-
n(this, "_context");
|
|
11
|
-
this.tagName = t, this.params = s;
|
|
12
|
-
}
|
|
13
|
-
get hash() {
|
|
14
|
-
return l(this.params.base || this.params);
|
|
15
|
-
}
|
|
16
|
-
get priority() {
|
|
17
|
-
var t;
|
|
18
|
-
return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
|
|
19
|
-
}
|
|
20
|
-
get classNames() {
|
|
21
|
-
const t = [this.hash], { className: s } = this.params;
|
|
22
|
-
return s && t.push(s), t.join(" ");
|
|
23
|
-
}
|
|
24
|
-
get cssClassName() {
|
|
25
|
-
return this.hash;
|
|
26
|
-
}
|
|
27
|
-
get cssDisplayNameVar() {
|
|
28
|
-
return `--${this.hash}-display-name: ${this._callerName};`;
|
|
29
|
-
}
|
|
30
|
-
get templateKeys() {
|
|
31
|
-
var t;
|
|
32
|
-
return (t = this._context) != null && t.config.templates ? g(this._context.config.templates) : [];
|
|
33
|
-
}
|
|
34
|
-
get css() {
|
|
35
|
-
var a;
|
|
36
|
-
const { base: t = {}, variants: s = {}, compoundVariants: i = [] } = this.params, r = { ...t, variants: s, compoundVariants: i };
|
|
37
|
-
return u(r, `.${this.cssClassName}`, this.priority, (a = this._context) == null ? void 0 : a.config);
|
|
38
|
-
}
|
|
39
|
-
get props() {
|
|
40
|
-
const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((a) => {
|
|
41
|
-
var o;
|
|
42
|
-
const c = (o = this.params.defaultVariants) == null ? void 0 : o[a];
|
|
43
|
-
return c !== void 0 ? `${a}=${String(c)}` : a;
|
|
44
|
-
}) : void 0, i = /* @__PURE__ */ new Set([]), r = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
|
|
45
|
-
return r && r.forEach((a, c, o) => {
|
|
46
|
-
const h = o.at(1);
|
|
47
|
-
h && i.add(h);
|
|
48
|
-
}), {
|
|
49
|
-
element: t,
|
|
50
|
-
variantKeys: s,
|
|
51
|
-
propValueKeys: [...i],
|
|
52
|
-
attr: {
|
|
53
|
-
"data-component-name": this._isProd ? void 0 : this._callerName
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
_withBuildContext(t) {
|
|
58
|
-
this._context = t;
|
|
59
|
-
const { name: s, config: i, prod: r } = t;
|
|
60
|
-
return this._isProd = r, this._callerName = s, this;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
64
|
-
N as StyleComponentGenerator
|
|
65
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { StyledParams, Tag } from '../types';
|
|
2
|
-
export interface GeneratorProps {
|
|
3
|
-
element?: string;
|
|
4
|
-
variantKeys?: string[];
|
|
5
|
-
propValueKeys?: string[];
|
|
6
|
-
attr: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export declare class StyleComponentGenerator {
|
|
11
|
-
tagName: Tag<any>;
|
|
12
|
-
params: StyledParams;
|
|
13
|
-
_isProd: boolean | undefined;
|
|
14
|
-
_callerName: string | undefined;
|
|
15
|
-
_context: {
|
|
16
|
-
name: string;
|
|
17
|
-
config: any;
|
|
18
|
-
} | undefined;
|
|
19
|
-
constructor(tagName: Tag<any>, params: StyledParams);
|
|
20
|
-
get hash(): string;
|
|
21
|
-
get priority(): number;
|
|
22
|
-
get classNames(): string;
|
|
23
|
-
get cssClassName(): string;
|
|
24
|
-
get cssDisplayNameVar(): string;
|
|
25
|
-
get templateKeys(): string[];
|
|
26
|
-
get css(): string;
|
|
27
|
-
get props(): GeneratorProps;
|
|
28
|
-
_withBuildContext(context: {
|
|
29
|
-
name: string;
|
|
30
|
-
config: any;
|
|
31
|
-
prod: boolean;
|
|
32
|
-
}): this;
|
|
33
|
-
}
|
package/index-84Wroia-.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="/* Empty */";exports.default=e;
|
package/index-BGaLvshf.js
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import * as H from "esbuild";
|
|
2
|
-
import { execSync as Q } from "child_process";
|
|
3
|
-
import { t as B, d as W } from "./dash-case-DMQMcCO6.js";
|
|
4
|
-
import { join as o } from "path";
|
|
5
|
-
import { existsSync as K, writeFileSync as w, mkdirSync as V, statSync as tt, readdirSync as st, readFileSync as v } from "fs";
|
|
6
|
-
import { readFile as et, writeFile as nt } from "fs/promises";
|
|
7
|
-
import { p as ot, a as rt, b as ct } from "./parse-templates-DUUSaubj.js";
|
|
8
|
-
import { createLogger as at, format as J, transports as it } from "winston";
|
|
9
|
-
const L = (t) => {
|
|
10
|
-
if (!t || t === "/") throw new Error("Could not find package.json file");
|
|
11
|
-
const s = o(t, "package.json");
|
|
12
|
-
return K(s) ? s : L(o(t, ".."));
|
|
13
|
-
}, lt = async (t) => {
|
|
14
|
-
const s = L(t);
|
|
15
|
-
return await et(s, "utf-8").then(JSON.parse).catch(() => {
|
|
16
|
-
});
|
|
17
|
-
}, pt = async (t) => {
|
|
18
|
-
const s = await lt(t);
|
|
19
|
-
if (s)
|
|
20
|
-
return s.type;
|
|
21
|
-
};
|
|
22
|
-
let M;
|
|
23
|
-
const q = async (t) => {
|
|
24
|
-
if (M) return M;
|
|
25
|
-
const s = await pt(t);
|
|
26
|
-
return s === "module" ? M = "esm" : (s === "commonjs" || import.meta.url.endsWith(".cjs")) && (M = "cjs"), M || "esm";
|
|
27
|
-
}, R = at({
|
|
28
|
-
level: "debug",
|
|
29
|
-
format: J.combine(J.colorize(), J.cli()),
|
|
30
|
-
transports: [new it.Console({})]
|
|
31
|
-
}), Ct = (t) => {
|
|
32
|
-
R.error(t);
|
|
33
|
-
}, O = {
|
|
34
|
-
externalModules: []
|
|
35
|
-
}, A = (t) => {
|
|
36
|
-
if (O.externalModules.length > 0) return O.externalModules;
|
|
37
|
-
const s = o(t, "salty.config.ts"), e = v(s, "utf8").match(/externalModules:\s?\[(.*)\]/);
|
|
38
|
-
if (!e) return [];
|
|
39
|
-
const n = e[1].split(",").map((l) => l.replace(/['"`]/g, "").trim());
|
|
40
|
-
return O.externalModules = n, n;
|
|
41
|
-
}, N = (t) => o(t, "./saltygen"), ft = ["salty", "css", "styles", "styled"], ut = (t = []) => new RegExp(`\\.(${[...ft, ...t].join("|")})\\.`), I = (t, s = []) => ut(s).test(t), gt = async (t) => {
|
|
42
|
-
const s = N(t), i = o(t, "salty.config.ts"), e = o(s, "salty.config.js"), n = await q(t), l = A(t);
|
|
43
|
-
await H.build({
|
|
44
|
-
entryPoints: [i],
|
|
45
|
-
minify: !0,
|
|
46
|
-
treeShaking: !0,
|
|
47
|
-
bundle: !0,
|
|
48
|
-
outfile: e,
|
|
49
|
-
format: n,
|
|
50
|
-
external: l
|
|
51
|
-
});
|
|
52
|
-
const S = Date.now(), { config: f } = await import(`${e}?t=${S}`);
|
|
53
|
-
return f;
|
|
54
|
-
}, dt = async (t) => {
|
|
55
|
-
const s = await gt(t), i = /* @__PURE__ */ new Set(), e = (u, a = []) => u ? Object.entries(u).flatMap(([m, p]) => {
|
|
56
|
-
if (!p) return;
|
|
57
|
-
if (typeof p == "object") return e(p, [...a, m]);
|
|
58
|
-
const P = [...a, m].join(".");
|
|
59
|
-
i.add(`"${P}"`);
|
|
60
|
-
const x = [...a.map(W), W(m)].join("-"), { result: y } = ct(p);
|
|
61
|
-
return `--${x}: ${y};`;
|
|
62
|
-
}) : [], n = (u) => u ? Object.entries(u).flatMap(([a, m]) => {
|
|
63
|
-
const p = e(m);
|
|
64
|
-
return a === "base" ? p.join("") : `${a} { ${p.join("")} }`;
|
|
65
|
-
}) : [], l = (u) => u ? Object.entries(u).flatMap(([a, m]) => Object.entries(m).flatMap(([p, P]) => {
|
|
66
|
-
const x = e(P, [a]), y = `.${a}-${p}, [data-${a}="${p}"]`, b = x.join("");
|
|
67
|
-
return `${y} { ${b} }`;
|
|
68
|
-
})) : [], S = e(s.variables), f = n(s.responsiveVariables), C = l(s.conditionalVariables), r = N(t), T = o(r, "css/variables.css"), g = `:root { ${S.join("")} ${f.join("")} } ${C.join("")}`;
|
|
69
|
-
w(T, g);
|
|
70
|
-
const h = o(r, "types/css-tokens.d.ts"), c = `type VariableTokens = ${[...i].join("|") || '""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;
|
|
71
|
-
w(h, c);
|
|
72
|
-
const d = o(r, "css/global.css"), k = ot(s.global, "");
|
|
73
|
-
w(d, k);
|
|
74
|
-
const $ = o(r, "css/templates.css"), j = rt(s.templates);
|
|
75
|
-
w($, j);
|
|
76
|
-
}, _ = async (t, s, i) => {
|
|
77
|
-
const e = B(s), n = o(i, "js", e + ".js"), l = await q(t), S = A(t);
|
|
78
|
-
await H.build({
|
|
79
|
-
entryPoints: [s],
|
|
80
|
-
minify: !0,
|
|
81
|
-
treeShaking: !0,
|
|
82
|
-
bundle: !0,
|
|
83
|
-
outfile: n,
|
|
84
|
-
format: l,
|
|
85
|
-
target: ["es2022"],
|
|
86
|
-
keepNames: !0,
|
|
87
|
-
external: S
|
|
88
|
-
});
|
|
89
|
-
const f = Date.now();
|
|
90
|
-
return await import(`${n}?t=${f}`);
|
|
91
|
-
}, z = async (t) => {
|
|
92
|
-
const s = N(t), i = o(s, "salty.config.js"), { config: e } = await import(i);
|
|
93
|
-
return e;
|
|
94
|
-
}, U = () => {
|
|
95
|
-
try {
|
|
96
|
-
return process.env.NODE_ENV === "production";
|
|
97
|
-
} catch {
|
|
98
|
-
return !1;
|
|
99
|
-
}
|
|
100
|
-
}, Ft = async (t, s = U()) => {
|
|
101
|
-
try {
|
|
102
|
-
s ? R.info("Generating CSS in production mode! 🔥") : R.info("Generating CSS in development mode! 🚀");
|
|
103
|
-
const i = [], e = [], n = N(t), l = o(n, "index.css");
|
|
104
|
-
(() => {
|
|
105
|
-
K(n) && Q("rm -rf " + n), V(n), V(o(n, "css")), V(o(n, "types"));
|
|
106
|
-
})(), await dt(t);
|
|
107
|
-
const f = await z(t);
|
|
108
|
-
async function C(c, d) {
|
|
109
|
-
const k = ["node_modules", "saltygen"], $ = tt(c);
|
|
110
|
-
if ($.isDirectory()) {
|
|
111
|
-
const j = st(c);
|
|
112
|
-
if (k.some((a) => c.includes(a))) return;
|
|
113
|
-
await Promise.all(j.map((a) => C(o(c, a), o(d, a))));
|
|
114
|
-
} else if ($.isFile() && I(c)) {
|
|
115
|
-
const u = await _(t, c, n), a = [];
|
|
116
|
-
Object.entries(u).forEach(([x, y]) => {
|
|
117
|
-
if (y.isKeyframes && y.css) {
|
|
118
|
-
const G = `${y.animationName}.css`, Y = `css/${G}`, Z = o(n, Y);
|
|
119
|
-
i.push(G), w(Z, y.css);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (!y.generator) return;
|
|
123
|
-
const b = y.generator._withBuildContext({
|
|
124
|
-
name: x,
|
|
125
|
-
config: f,
|
|
126
|
-
prod: s
|
|
127
|
-
}), D = `${b.hash}-${b.priority}.css`;
|
|
128
|
-
e[b.priority] || (e[b.priority] = []), e[b.priority].push(D), a.push(D);
|
|
129
|
-
const E = `css/${D}`, X = o(n, E);
|
|
130
|
-
w(X, b.css);
|
|
131
|
-
});
|
|
132
|
-
const m = a.map((x) => `@import url('./${x}');`).join(`
|
|
133
|
-
`), p = B(c, 6), P = o(n, `css/${p}.css`);
|
|
134
|
-
w(P, m);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
await C(t, n);
|
|
138
|
-
const r = i.map((c) => `@import url('./css/${c}');`).join(`
|
|
139
|
-
`);
|
|
140
|
-
let F = `@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
|
141
|
-
|
|
142
|
-
${["variables.css", "global.css", "templates.css"].filter((c) => {
|
|
143
|
-
try {
|
|
144
|
-
return v(o(n, "css", c), "utf8").length > 0;
|
|
145
|
-
} catch {
|
|
146
|
-
return !1;
|
|
147
|
-
}
|
|
148
|
-
}).map((c) => `@import url('./css/${c}');`).join(`
|
|
149
|
-
`)}
|
|
150
|
-
${r}`;
|
|
151
|
-
if (f.importStrategy !== "component") {
|
|
152
|
-
const c = e.flat().map((d) => `@import url('./css/${d}');`).join(`
|
|
153
|
-
`);
|
|
154
|
-
F += c;
|
|
155
|
-
}
|
|
156
|
-
w(l, F);
|
|
157
|
-
} catch (i) {
|
|
158
|
-
console.error(i);
|
|
159
|
-
}
|
|
160
|
-
}, jt = async (t, s) => {
|
|
161
|
-
try {
|
|
162
|
-
const i = [], e = o(t, "./saltygen"), n = o(e, "index.css");
|
|
163
|
-
if (I(s)) {
|
|
164
|
-
const S = await z(t), f = await _(t, s, e);
|
|
165
|
-
Object.entries(f).forEach(([h, F]) => {
|
|
166
|
-
if (!F.generator) return;
|
|
167
|
-
const c = F.generator._withBuildContext({
|
|
168
|
-
name: h,
|
|
169
|
-
config: S
|
|
170
|
-
}), d = `${c.hash}-${c.priority}.css`, k = `css/${d}`, $ = o(e, k);
|
|
171
|
-
i.push(d), w($, c.css);
|
|
172
|
-
});
|
|
173
|
-
const C = v(n, "utf8").split(`
|
|
174
|
-
`), r = i.map((h) => `@import url('../saltygen/css/${h}');`), g = [.../* @__PURE__ */ new Set([...C, ...r])].join(`
|
|
175
|
-
`);
|
|
176
|
-
w(n, g);
|
|
177
|
-
}
|
|
178
|
-
} catch (i) {
|
|
179
|
-
console.error(i);
|
|
180
|
-
}
|
|
181
|
-
}, xt = async (t, s, i = U()) => {
|
|
182
|
-
try {
|
|
183
|
-
const e = o(t, "./saltygen");
|
|
184
|
-
if (I(s)) {
|
|
185
|
-
const l = v(s, "utf8");
|
|
186
|
-
l.replace(/^(?!export\s)const\s.*/gm, (g) => `export ${g}`) !== l && await nt(s, l);
|
|
187
|
-
const f = await z(t), C = await _(t, s, e);
|
|
188
|
-
let r = l;
|
|
189
|
-
Object.entries(C).forEach(([g, h]) => {
|
|
190
|
-
var D;
|
|
191
|
-
if (h.isKeyframes || !h.generator) return;
|
|
192
|
-
const F = h.generator._withBuildContext({
|
|
193
|
-
name: g,
|
|
194
|
-
config: f,
|
|
195
|
-
prod: i
|
|
196
|
-
}), c = new RegExp(`\\s${g}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(l);
|
|
197
|
-
if (!c) return console.error("Could not find the original declaration");
|
|
198
|
-
const d = (D = c.at(1)) == null ? void 0 : D.trim(), k = new RegExp(`\\s${g}[=\\s]+styled\\(`, "g").exec(r);
|
|
199
|
-
if (!k) return console.error("Could not find the original declaration");
|
|
200
|
-
const { index: $ } = k;
|
|
201
|
-
let j = !1;
|
|
202
|
-
const u = setTimeout(() => j = !0, 5e3);
|
|
203
|
-
let a = 0, m = !1, p = 0;
|
|
204
|
-
for (; !m && !j; ) {
|
|
205
|
-
const E = r[$ + a];
|
|
206
|
-
E === "(" && p++, E === ")" && p--, p === 0 && E === ")" && (m = !0), a > r.length && (j = !0), a++;
|
|
207
|
-
}
|
|
208
|
-
if (!j) clearTimeout(u);
|
|
209
|
-
else throw new Error("Failed to find the end of the styled call and timed out");
|
|
210
|
-
const P = $ + a, x = r.slice($, P), y = r, b = ` ${g} = styled(${d}, "${F.classNames}", ${JSON.stringify(F.props)});`;
|
|
211
|
-
r = r.replace(x, b), y === r && console.error("Minimize file failed to change content", { name: g, tagName: d });
|
|
212
|
-
});
|
|
213
|
-
const T = B(s, 6);
|
|
214
|
-
return f.importStrategy === "component" && (r = `import '../../saltygen/css/${T}.css';
|
|
215
|
-
${r}`), r = r.replace("{ styled }", "{ styledClient as styled }"), r = r.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), r;
|
|
216
|
-
}
|
|
217
|
-
} catch (e) {
|
|
218
|
-
console.error("Error in minimizeFile:", e);
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
export {
|
|
222
|
-
Ct as a,
|
|
223
|
-
ut as b,
|
|
224
|
-
dt as c,
|
|
225
|
-
_ as d,
|
|
226
|
-
jt as e,
|
|
227
|
-
Ft as g,
|
|
228
|
-
I as i,
|
|
229
|
-
R as l,
|
|
230
|
-
xt as m,
|
|
231
|
-
ft as s
|
|
232
|
-
};
|
package/index-BKoD9apd.cjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";const te=require("esbuild"),se=require("child_process"),N=require("./dash-case-DKzpenwY.cjs"),i=require("path"),l=require("fs"),H=require("fs/promises"),J=require("./parse-templates-DVK3iZIl.cjs"),v=require("winston");var q=typeof document<"u"?document.currentScript:null;function ne(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=ne(te),G=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=i.join(e,"package.json");return l.existsSync(t)?t:G(i.join(e,".."))},oe=async e=>{const t=G(e);return await H.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},ie=async e=>{const t=await oe(e);if(t)return t.type};let T;const L=async e=>{if(T)return T;const t=await ie(e);return t==="module"?T="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:q&&q.tagName.toUpperCase()==="SCRIPT"&&q.src||new URL("index-BKoD9apd.cjs",document.baseURI).href).endsWith(".cjs"))&&(T="cjs"),T||"esm"},O=v.createLogger({level:"debug",format:v.format.combine(v.format.colorize(),v.format.cli()),transports:[new v.transports.Console({})]}),re=e=>{O.error(e)},I={externalModules:[]},W=e=>{if(I.externalModules.length>0)return I.externalModules;const t=i.join(e,"salty.config.ts"),s=l.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const o=s[1].split(",").map(u=>u.replace(/['"`]/g,"").trim());return I.externalModules=o,o},V=e=>i.join(e,"./saltygen"),K=["salty","css","styles","styled"],A=(e=[])=>new RegExp(`\\.(${[...K,...e].join("|")})\\.`),R=(e,t=[])=>A(t).test(e),ce=async e=>{const t=V(e),n=i.join(e,"salty.config.ts"),s=i.join(t,"salty.config.js"),o=await L(e),u=W(e);await U.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:s,format:o,external:u});const b=Date.now(),{config:p}=await import(`${s}?t=${b}`);return p},X=async e=>{const t=await ce(e),n=new Set,s=(g,a=[])=>g?Object.entries(g).flatMap(([m,f])=>{if(!f)return;if(typeof f=="object")return s(f,[...a,m]);const P=[...a,m].join(".");n.add(`"${P}"`);const x=[...a.map(N.dashCase),N.dashCase(m)].join("-"),{result:h}=J.parseValueTokens(f);return`--${x}: ${h};`}):[],o=g=>g?Object.entries(g).flatMap(([a,m])=>{const f=s(m);return a==="base"?f.join(""):`${a} { ${f.join("")} }`}):[],u=g=>g?Object.entries(g).flatMap(([a,m])=>Object.entries(m).flatMap(([f,P])=>{const x=s(P,[a]),h=`.${a}-${f}, [data-${a}="${f}"]`,w=x.join("");return`${h} { ${w} }`})):[],b=s(t.variables),p=o(t.responsiveVariables),F=u(t.conditionalVariables),r=V(e),E=i.join(r,"css/variables.css"),d=`:root { ${b.join("")} ${p.join("")} } ${F.join("")}`;l.writeFileSync(E,d);const j=i.join(r,"types/css-tokens.d.ts"),c=`type VariableTokens = ${[...n].join("|")||'""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;l.writeFileSync(j,c);const y=i.join(r,"css/global.css"),k=J.parseStyles(t.global,"");l.writeFileSync(y,k);const S=i.join(r,"css/templates.css"),C=J.parseTemplates(t.templates);l.writeFileSync(S,C)},_=async(e,t,n)=>{const s=N.toHash(t),o=i.join(n,"js",s+".js"),u=await L(e),b=W(e);await U.build({entryPoints:[t],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:u,target:["es2022"],keepNames:!0,external:b});const p=Date.now();return await import(`${o}?t=${p}`)},z=async e=>{const t=V(e),n=i.join(t,"salty.config.js"),{config:s}=await import(n);return s},Y=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},ae=async(e,t=Y())=>{try{t?O.info("Generating CSS in production mode! 🔥"):O.info("Generating CSS in development mode! 🚀");const n=[],s=[],o=V(e),u=i.join(o,"index.css");(()=>{l.existsSync(o)&&se.execSync("rm -rf "+o),l.mkdirSync(o),l.mkdirSync(i.join(o,"css")),l.mkdirSync(i.join(o,"types"))})(),await X(e);const p=await z(e);async function F(c,y){const k=["node_modules","saltygen"],S=l.statSync(c);if(S.isDirectory()){const C=l.readdirSync(c);if(k.some(a=>c.includes(a)))return;await Promise.all(C.map(a=>F(i.join(c,a),i.join(y,a))))}else if(S.isFile()&&R(c)){const g=await _(e,c,o),a=[];Object.entries(g).forEach(([x,h])=>{if(h.isKeyframes&&h.css){const B=`${h.animationName}.css`,Q=`css/${B}`,ee=i.join(o,Q);n.push(B),l.writeFileSync(ee,h.css);return}if(!h.generator)return;const w=h.generator._withBuildContext({name:x,config:p,prod:t}),D=`${w.hash}-${w.priority}.css`;s[w.priority]||(s[w.priority]=[]),s[w.priority].push(D),a.push(D);const M=`css/${D}`,Z=i.join(o,M);l.writeFileSync(Z,w.css)});const m=a.map(x=>`@import url('./${x}');`).join(`
|
|
2
|
-
`),f=N.toHash(c,6),P=i.join(o,`css/${f}.css`);l.writeFileSync(P,m)}}await F(e,o);const r=n.map(c=>`@import url('./css/${c}');`).join(`
|
|
3
|
-
`);let $=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
|
4
|
-
|
|
5
|
-
${["variables.css","global.css","templates.css"].filter(c=>{try{return l.readFileSync(i.join(o,"css",c),"utf8").length>0}catch{return!1}}).map(c=>`@import url('./css/${c}');`).join(`
|
|
6
|
-
`)}
|
|
7
|
-
${r}`;if(p.importStrategy!=="component"){const c=s.flat().map(y=>`@import url('./css/${y}');`).join(`
|
|
8
|
-
`);$+=c}l.writeFileSync(u,$)}catch(n){console.error(n)}},le=async(e,t)=>{try{const n=[],s=i.join(e,"./saltygen"),o=i.join(s,"index.css");if(R(t)){const b=await z(e),p=await _(e,t,s);Object.entries(p).forEach(([j,$])=>{if(!$.generator)return;const c=$.generator._withBuildContext({name:j,config:b}),y=`${c.hash}-${c.priority}.css`,k=`css/${y}`,S=i.join(s,k);n.push(y),l.writeFileSync(S,c.css)});const F=l.readFileSync(o,"utf8").split(`
|
|
9
|
-
`),r=n.map(j=>`@import url('../saltygen/css/${j}');`),d=[...new Set([...F,...r])].join(`
|
|
10
|
-
`);l.writeFileSync(o,d)}}catch(n){console.error(n)}},ue=async(e,t,n=Y())=>{try{const s=i.join(e,"./saltygen");if(R(t)){const u=l.readFileSync(t,"utf8");u.replace(/^(?!export\s)const\s.*/gm,d=>`export ${d}`)!==u&&await H.writeFile(t,u);const p=await z(e),F=await _(e,t,s);let r=u;Object.entries(F).forEach(([d,j])=>{var D;if(j.isKeyframes||!j.generator)return;const $=j.generator._withBuildContext({name:d,config:p,prod:n}),c=new RegExp(`\\s${d}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(u);if(!c)return console.error("Could not find the original declaration");const y=(D=c.at(1))==null?void 0:D.trim(),k=new RegExp(`\\s${d}[=\\s]+styled\\(`,"g").exec(r);if(!k)return console.error("Could not find the original declaration");const{index:S}=k;let C=!1;const g=setTimeout(()=>C=!0,5e3);let a=0,m=!1,f=0;for(;!m&&!C;){const M=r[S+a];M==="("&&f++,M===")"&&f--,f===0&&M===")"&&(m=!0),a>r.length&&(C=!0),a++}if(!C)clearTimeout(g);else throw new Error("Failed to find the end of the styled call and timed out");const P=S+a,x=r.slice(S,P),h=r,w=` ${d} = styled(${y}, "${$.classNames}", ${JSON.stringify($.props)});`;r=r.replace(x,w),h===r&&console.error("Minimize file failed to change content",{name:d,tagName:y})});const E=N.toHash(t,6);return p.importStrategy==="component"&&(r=`import '../../saltygen/css/${E}.css';
|
|
11
|
-
${r}`),r=r.replace("{ styled }","{ styledClient as styled }"),r=r.replace("@salty-css/react/styled","@salty-css/react/styled-client"),r}}catch(s){console.error("Error in minimizeFile:",s)}};exports.compileSaltyFile=_;exports.generateConfigStyles=X;exports.generateCss=ae;exports.generateFile=le;exports.isSaltyFile=R;exports.logError=re;exports.logger=O;exports.minimizeFile=ue;exports.saltyFileExtensions=K;exports.saltyFileRegExp=A;
|
package/index-D_732b92.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { d as O } from "./dash-case-DMQMcCO6.js";
|
|
2
|
-
const W = (s, r) => {
|
|
3
|
-
if (typeof s != "string") return { result: s };
|
|
4
|
-
if (!r) return { result: s };
|
|
5
|
-
const o = [];
|
|
6
|
-
return Object.values(r).forEach((i) => {
|
|
7
|
-
const { pattern: p, transform: c } = i;
|
|
8
|
-
s = s.replace(p, (a) => {
|
|
9
|
-
const { value: e, css: m } = c(a);
|
|
10
|
-
return m && o.push(m), e;
|
|
11
|
-
});
|
|
12
|
-
}), { result: s, additionalCss: o };
|
|
13
|
-
}, N = (s) => typeof s != "string" ? { result: s } : /\{[^{}]+\}/g.test(s) ? { result: s.replace(/\{([^{}]+)\}/g, (...i) => `var(--${O(i[1].replaceAll(".", "-"))})`) } : { result: s }, d = (s, r, o, i) => {
|
|
14
|
-
if (!s) return "";
|
|
15
|
-
const p = [], c = Object.entries(s).reduce((e, [m, t]) => {
|
|
16
|
-
const n = m.trim();
|
|
17
|
-
if (typeof t == "function" && (t = t()), typeof t == "object") {
|
|
18
|
-
if (!t) return e;
|
|
19
|
-
if (n === "variants")
|
|
20
|
-
return Object.entries(t).forEach(([f, u]) => {
|
|
21
|
-
u && Object.entries(u).forEach(([b, l]) => {
|
|
22
|
-
if (!l) return;
|
|
23
|
-
const j = `${r}.${f}-${b}`, y = d(l, j, o);
|
|
24
|
-
p.push(y);
|
|
25
|
-
});
|
|
26
|
-
}), e;
|
|
27
|
-
if (n === "defaultVariants")
|
|
28
|
-
return e;
|
|
29
|
-
if (n === "compoundVariants")
|
|
30
|
-
return t.forEach((f) => {
|
|
31
|
-
const { css: u, ...b } = f, l = Object.entries(b).reduce((y, [V, w]) => `${y}.${V}-${w}`, r), j = d(u, l, o);
|
|
32
|
-
p.push(j);
|
|
33
|
-
}), e;
|
|
34
|
-
if (n.startsWith("@")) {
|
|
35
|
-
const f = d(t, r, o), u = `${n} {
|
|
36
|
-
${f.replace(`
|
|
37
|
-
`, `
|
|
38
|
-
`)}
|
|
39
|
-
}`;
|
|
40
|
-
return p.push(u), e;
|
|
41
|
-
}
|
|
42
|
-
const $ = m.includes("&") ? n.replace("&", r) : n.startsWith(":") ? `${r}${n}` : `${r} ${n}`, h = d(t, $, o);
|
|
43
|
-
return p.push(h), e;
|
|
44
|
-
}
|
|
45
|
-
if (i != null && i.templates && i.templates[n]) {
|
|
46
|
-
const h = t.split(".").reduce((f, u) => f[u], i.templates[n]);
|
|
47
|
-
if (h) {
|
|
48
|
-
const f = d(h, "");
|
|
49
|
-
return `${e}${f}`;
|
|
50
|
-
}
|
|
51
|
-
return console.warn(`Template "${n}" with path of "${t}" was not found in config!`), e;
|
|
52
|
-
}
|
|
53
|
-
const S = n.startsWith("-") ? n : O(n), g = ($, h = ";") => e = `${e}${$}${h}`, E = ($) => g(`${S}:${$}`);
|
|
54
|
-
if (typeof t == "number") return E(t);
|
|
55
|
-
if (typeof t != "string")
|
|
56
|
-
if ("toString" in t) t = t.toString();
|
|
57
|
-
else return e;
|
|
58
|
-
const { modifiers: T } = i || {}, k = function* () {
|
|
59
|
-
yield N(t), yield W(t, T);
|
|
60
|
-
}();
|
|
61
|
-
for (const { result: $, additionalCss: h = [] } of k)
|
|
62
|
-
t = $, h.forEach((f) => {
|
|
63
|
-
const u = d(f, "");
|
|
64
|
-
g(u, "");
|
|
65
|
-
});
|
|
66
|
-
return E(t);
|
|
67
|
-
}, "");
|
|
68
|
-
if (!c) return p.join(`
|
|
69
|
-
`);
|
|
70
|
-
if (!r) return c;
|
|
71
|
-
let a = "";
|
|
72
|
-
return o !== void 0 ? a = `@layer l${o} { ${r} { ${c} } }` : a = `${r} { ${c} }`, [a, ...p].join(`
|
|
73
|
-
`);
|
|
74
|
-
}, P = (s, r = []) => {
|
|
75
|
-
if (!s) return "";
|
|
76
|
-
const o = [], i = {};
|
|
77
|
-
if (Object.entries(s).forEach(([p, c]) => {
|
|
78
|
-
if (typeof c == "object") {
|
|
79
|
-
if (!c) return;
|
|
80
|
-
const a = p.trim(), e = P(c, [...r, a]);
|
|
81
|
-
o.push(e);
|
|
82
|
-
} else
|
|
83
|
-
i[p] = c;
|
|
84
|
-
}), Object.keys(i).length) {
|
|
85
|
-
const p = r.map(O).join("-"), c = d(i, `.${p}`);
|
|
86
|
-
o.push(c);
|
|
87
|
-
}
|
|
88
|
-
return o.join(`
|
|
89
|
-
`);
|
|
90
|
-
}, x = (s) => Object.keys(s);
|
|
91
|
-
export {
|
|
92
|
-
P as a,
|
|
93
|
-
N as b,
|
|
94
|
-
x as g,
|
|
95
|
-
d as p
|
|
96
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";const T=require("./dash-case-DKzpenwY.cjs"),K=(e,s)=>{if(typeof e!="string")return{result:e};if(!s)return{result:e};const o=[];return Object.values(s).forEach(i=>{const{pattern:p,transform:c}=i;e=e.replace(p,d=>{const{value:r,css:l}=c(d);return l&&o.push(l),r})}),{result:e,additionalCss:o}},g=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...i)=>`var(--${T.dashCase(i[1].replaceAll(".","-"))})`)}:{result:e},a=(e,s,o,i)=>{if(!e)return"";const p=[],c=Object.entries(e).reduce((r,[l,t])=>{const n=l.trim();if(typeof t=="function"&&(t=t()),typeof t=="object"){if(!t)return r;if(n==="variants")return Object.entries(t).forEach(([f,u])=>{u&&Object.entries(u).forEach(([j,m])=>{if(!m)return;const y=`${s}.${f}-${j}`,b=a(m,y,o);p.push(b)})}),r;if(n==="defaultVariants")return r;if(n==="compoundVariants")return t.forEach(f=>{const{css:u,...j}=f,m=Object.entries(j).reduce((b,[W,q])=>`${b}.${W}-${q}`,s),y=a(u,m,o);p.push(y)}),r;if(n.startsWith("@")){const f=a(t,s,o),u=`${n} {
|
|
2
|
-
${f.replace(`
|
|
3
|
-
`,`
|
|
4
|
-
`)}
|
|
5
|
-
}`;return p.push(u),r}const $=l.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`,h=a(t,$,o);return p.push(h),r}if(i!=null&&i.templates&&i.templates[n]){const h=t.split(".").reduce((f,u)=>f[u],i.templates[n]);if(h){const f=a(h,"");return`${r}${f}`}return console.warn(`Template "${n}" with path of "${t}" was not found in config!`),r}const E=n.startsWith("-")?n:T.dashCase(n),O=($,h=";")=>r=`${r}${$}${h}`,S=$=>O(`${E}:${$}`);if(typeof t=="number")return S(t);if(typeof t!="string")if("toString"in t)t=t.toString();else return r;const{modifiers:V}=i||{},w=function*(){yield g(t),yield K(t,V)}();for(const{result:$,additionalCss:h=[]}of w)t=$,h.forEach(f=>{const u=a(f,"");O(u,"")});return S(t)},"");if(!c)return p.join(`
|
|
6
|
-
`);if(!s)return c;let d="";return o!==void 0?d=`@layer l${o} { ${s} { ${c} } }`:d=`${s} { ${c} }`,[d,...p].join(`
|
|
7
|
-
`)},k=(e,s=[])=>{if(!e)return"";const o=[],i={};if(Object.entries(e).forEach(([p,c])=>{if(typeof c=="object"){if(!c)return;const d=p.trim(),r=k(c,[...s,d]);o.push(r)}else i[p]=c}),Object.keys(i).length){const p=s.map(T.dashCase).join("-"),c=a(i,`.${p}`);o.push(c)}return o.join(`
|
|
8
|
-
`)},N=e=>Object.keys(e);exports.getTemplateKeys=N;exports.parseStyles=a;exports.parseTemplates=k;exports.parseValueTokens=g;
|
package/pascal-case-BQpR5PdN.js
DELETED
package/pascal-case-iWoaJWwT.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function r(e){return e?typeof e!="string"?r(String(e)):e.replace(/\s/g,"-").replace(/[-_]([a-z0-9])/g,a=>a[1].toUpperCase()).replace(/^[a-z]/,a=>a.toUpperCase()):""}exports.pascalCase=r;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { styled } from "@salty-css/react/styled";
|
|
2
|
-
|
|
3
|
-
export const <%- name %> = styled('<%- tag %>', {
|
|
4
|
-
<% if(className) { %>className: '<%- className %>',<% } %>
|
|
5
|
-
base: {
|
|
6
|
-
// Add your styles here
|
|
7
|
-
}
|
|
8
|
-
})`;exports.default=e;
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
package/salty.config-BhBY_oOk.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { defineConfig } from '@salty-css/core/config';
|
|
2
|
-
|
|
3
|
-
export const config = defineConfig({
|
|
4
|
-
// Add your custom config here
|
|
5
|
-
externalModules: ['react', 'react-dom']
|
|
6
|
-
});
|
|
7
|
-
`;exports.default=e;
|