@styleframe/transpiler 3.2.0 → 3.4.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/CHANGELOG.md +44 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/consume/css/at-rule.d.ts +8 -0
- package/dist/consume/css/at-rule.d.ts.map +1 -0
- package/dist/consume/css/at-rule.test.d.ts +2 -0
- package/dist/consume/css/at-rule.test.d.ts.map +1 -0
- package/dist/consume/css/consume.d.ts +7 -0
- package/dist/consume/css/consume.d.ts.map +1 -0
- package/dist/consume/css/consume.test.d.ts +2 -0
- package/dist/consume/css/consume.test.d.ts.map +1 -0
- package/dist/consume/css/container.d.ts +11 -0
- package/dist/consume/css/container.d.ts.map +1 -0
- package/dist/consume/css/container.test.d.ts +2 -0
- package/dist/consume/css/container.test.d.ts.map +1 -0
- package/dist/consume/css/css.d.ts +7 -0
- package/dist/consume/css/css.d.ts.map +1 -0
- package/dist/consume/css/css.test.d.ts +2 -0
- package/dist/consume/css/css.test.d.ts.map +1 -0
- package/dist/consume/css/declarations.d.ts +7 -0
- package/dist/consume/css/declarations.d.ts.map +1 -0
- package/dist/consume/css/declarations.test.d.ts +2 -0
- package/dist/consume/css/declarations.test.d.ts.map +1 -0
- package/dist/consume/css/index.d.ts +13 -0
- package/dist/consume/css/index.d.ts.map +1 -0
- package/dist/consume/css/primitive.d.ts +7 -0
- package/dist/consume/css/primitive.d.ts.map +1 -0
- package/dist/consume/css/primitive.test.d.ts +2 -0
- package/dist/consume/css/primitive.test.d.ts.map +1 -0
- package/dist/consume/css/ref.d.ts +7 -0
- package/dist/consume/css/ref.d.ts.map +1 -0
- package/dist/consume/css/ref.test.d.ts +2 -0
- package/dist/consume/css/ref.test.d.ts.map +1 -0
- package/dist/consume/css/root.d.ts +4 -0
- package/dist/consume/css/root.d.ts.map +1 -0
- package/dist/consume/css/root.test.d.ts +2 -0
- package/dist/consume/css/root.test.d.ts.map +1 -0
- package/dist/consume/css/selector.d.ts +7 -0
- package/dist/consume/css/selector.d.ts.map +1 -0
- package/dist/consume/css/selector.test.d.ts +2 -0
- package/dist/consume/css/selector.test.d.ts.map +1 -0
- package/dist/consume/css/theme.d.ts +4 -0
- package/dist/consume/css/theme.d.ts.map +1 -0
- package/dist/consume/css/theme.test.d.ts +2 -0
- package/dist/consume/css/theme.test.d.ts.map +1 -0
- package/dist/consume/css/utility.d.ts +7 -0
- package/dist/consume/css/utility.d.ts.map +1 -0
- package/dist/consume/css/utility.test.d.ts +2 -0
- package/dist/consume/css/utility.test.d.ts.map +1 -0
- package/dist/consume/css/variable.d.ts +4 -0
- package/dist/consume/css/variable.d.ts.map +1 -0
- package/dist/consume/css/variable.test.d.ts +2 -0
- package/dist/consume/css/variable.test.d.ts.map +1 -0
- package/dist/consume/dts/constants.d.ts +25 -0
- package/dist/consume/dts/constants.d.ts.map +1 -0
- package/dist/consume/dts/consume.d.ts +6 -0
- package/dist/consume/dts/consume.d.ts.map +1 -0
- package/dist/consume/dts/index.d.ts +7 -0
- package/dist/consume/dts/index.d.ts.map +1 -0
- package/dist/consume/dts/recipe.d.ts +8 -0
- package/dist/consume/dts/recipe.d.ts.map +1 -0
- package/dist/consume/dts/recipe.test.d.ts +2 -0
- package/dist/consume/dts/recipe.test.d.ts.map +1 -0
- package/dist/consume/dts/root.d.ts +4 -0
- package/dist/consume/dts/root.d.ts.map +1 -0
- package/dist/consume/dts/root.test.d.ts +2 -0
- package/dist/consume/dts/root.test.d.ts.map +1 -0
- package/dist/consume/dts/selector.d.ts +9 -0
- package/dist/consume/dts/selector.d.ts.map +1 -0
- package/dist/consume/dts/shims.d.ts +10 -0
- package/dist/consume/dts/shims.d.ts.map +1 -0
- package/dist/consume/dts/shims.test.d.ts +2 -0
- package/dist/consume/dts/shims.test.d.ts.map +1 -0
- package/dist/consume/ts/consume.d.ts +7 -0
- package/dist/consume/ts/consume.d.ts.map +1 -0
- package/dist/consume/ts/index.d.ts +4 -0
- package/dist/consume/ts/index.d.ts.map +1 -0
- package/dist/consume/ts/recipe.d.ts +8 -0
- package/dist/consume/ts/recipe.d.ts.map +1 -0
- package/dist/consume/ts/recipe.test.d.ts +2 -0
- package/dist/consume/ts/recipe.test.d.ts.map +1 -0
- package/dist/consume/ts/root.d.ts +4 -0
- package/dist/consume/ts/root.d.ts.map +1 -0
- package/dist/consume/ts/root.test.d.ts +2 -0
- package/dist/consume/ts/root.test.d.ts.map +1 -0
- package/dist/consume/ts/selector.d.ts +9 -0
- package/dist/consume/ts/selector.d.ts.map +1 -0
- package/dist/consume/ts/selector.test.d.ts +2 -0
- package/dist/consume/ts/selector.test.d.ts.map +1 -0
- package/dist/defaults.d.ts +5 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.test.d.ts +2 -0
- package/dist/defaults.test.d.ts.map +1 -0
- package/dist/generator/genAtRuleQuery.d.ts +2 -0
- package/dist/generator/genAtRuleQuery.d.ts.map +1 -0
- package/dist/generator/genAtRuleQuery.test.d.ts +2 -0
- package/dist/generator/genAtRuleQuery.test.d.ts.map +1 -0
- package/dist/generator/genDeclaration.d.ts +2 -0
- package/dist/generator/genDeclaration.d.ts.map +1 -0
- package/dist/generator/genDeclaration.test.d.ts +2 -0
- package/dist/generator/genDeclaration.test.d.ts.map +1 -0
- package/dist/generator/genDeclarationsBlock.d.ts +2 -0
- package/dist/generator/genDeclarationsBlock.d.ts.map +1 -0
- package/dist/generator/genDeclarationsBlock.test.d.ts +2 -0
- package/dist/generator/genDeclarationsBlock.test.d.ts.map +1 -0
- package/dist/generator/genDeclareVariable.d.ts +2 -0
- package/dist/generator/genDeclareVariable.d.ts.map +1 -0
- package/dist/generator/genDeclareVariable.test.d.ts +2 -0
- package/dist/generator/genDeclareVariable.test.d.ts.map +1 -0
- package/dist/generator/genInlineAtRule.d.ts +2 -0
- package/dist/generator/genInlineAtRule.d.ts.map +1 -0
- package/dist/generator/genInlineAtRule.test.d.ts +2 -0
- package/dist/generator/genInlineAtRule.test.d.ts.map +1 -0
- package/dist/generator/genReferenceVariable.d.ts +2 -0
- package/dist/generator/genReferenceVariable.d.ts.map +1 -0
- package/dist/generator/genReferenceVariable.test.d.ts +2 -0
- package/dist/generator/genReferenceVariable.test.d.ts.map +1 -0
- package/dist/generator/genSafePropertyName.d.ts +2 -0
- package/dist/generator/genSafePropertyName.d.ts.map +1 -0
- package/dist/generator/genSafePropertyName.test.d.ts +2 -0
- package/dist/generator/genSafePropertyName.test.d.ts.map +1 -0
- package/dist/generator/genSafeVariableName.d.ts +10 -0
- package/dist/generator/genSafeVariableName.d.ts.map +1 -0
- package/dist/generator/genSafeVariableName.test.d.ts +2 -0
- package/dist/generator/genSafeVariableName.test.d.ts.map +1 -0
- package/dist/generator/genSelector.d.ts +2 -0
- package/dist/generator/genSelector.d.ts.map +1 -0
- package/dist/generator/genSelector.test.d.ts +2 -0
- package/dist/generator/genSelector.test.d.ts.map +1 -0
- package/dist/generator/index.d.ts +10 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/license.d.ts +3 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/minify/defaults.d.ts +3 -0
- package/dist/minify/defaults.d.ts.map +1 -0
- package/dist/minify/generate-map.d.ts +8 -0
- package/dist/minify/generate-map.d.ts.map +1 -0
- package/dist/minify/generate-map.test.d.ts +2 -0
- package/dist/minify/generate-map.test.d.ts.map +1 -0
- package/dist/minify/index.d.ts +5 -0
- package/dist/minify/index.d.ts.map +1 -0
- package/dist/minify/shorten.d.ts +4 -0
- package/dist/minify/shorten.d.ts.map +1 -0
- package/dist/minify/shorten.test.d.ts +2 -0
- package/dist/minify/shorten.test.d.ts.map +1 -0
- package/dist/transpile.d.ts +5 -0
- package/dist/transpile.d.ts.map +1 -0
- package/dist/transpile.test.d.ts +2 -0
- package/dist/transpile.test.d.ts.map +1 -0
- package/dist/transpiler.js +775 -653
- package/dist/transpiler.umd.cjs +23 -19
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +10 -13
- package/dist/transpiler.d.ts +0 -65
package/dist/transpiler.js
CHANGED
|
@@ -1,700 +1,822 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
var e = " ", t = [
|
|
3
|
+
"charset",
|
|
4
|
+
"import",
|
|
5
|
+
"namespace"
|
|
6
|
+
], n = ["layer"];
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ../core/dist/styleframe.js
|
|
9
|
+
function r(e) {
|
|
10
|
+
return typeof e == "object" && !!e;
|
|
4
11
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
12
|
+
function i(e, t) {
|
|
13
|
+
return r(e) && "type" in e && e.type === t;
|
|
7
14
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
15
|
+
function a(e) {
|
|
16
|
+
return i(e, "variable");
|
|
10
17
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
18
|
+
function o(e) {
|
|
19
|
+
return i(e, "reference");
|
|
13
20
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
21
|
+
function s(e) {
|
|
22
|
+
return i(e, "selector");
|
|
16
23
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
24
|
+
function c(e) {
|
|
25
|
+
return i(e, "at-rule");
|
|
19
26
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
27
|
+
function l(e) {
|
|
28
|
+
return i(e, "utility");
|
|
22
29
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
30
|
+
function u(e) {
|
|
31
|
+
return i(e, "css");
|
|
25
32
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
33
|
+
function d(e) {
|
|
34
|
+
return i(e, "theme");
|
|
28
35
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
36
|
+
function f(e) {
|
|
37
|
+
return i(e, "root");
|
|
31
38
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
function p(e) {
|
|
40
|
+
return i(e, "recipe");
|
|
41
|
+
}
|
|
42
|
+
function m(e) {
|
|
43
|
+
let t = 5381;
|
|
44
|
+
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n) & 4294967295;
|
|
45
|
+
return (t >>> 0).toString(16).padStart(7, "0").slice(0, 7);
|
|
46
|
+
}
|
|
47
|
+
var h = ({ name: e, value: t, modifiers: n }) => `_${[
|
|
48
|
+
...n,
|
|
49
|
+
e,
|
|
50
|
+
...t === "default" ? [] : [t]
|
|
43
51
|
].filter(Boolean).join(":")}`;
|
|
44
|
-
function
|
|
45
|
-
|
|
52
|
+
function g(e) {
|
|
53
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
46
54
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
55
|
+
function _(e) {
|
|
56
|
+
return `.${e.replace(/[[\].#()%,:/]/g, "\\$&")}`;
|
|
57
|
+
}
|
|
58
|
+
function v(e) {
|
|
59
|
+
if (e instanceof Buffer) return Buffer.from(e);
|
|
60
|
+
let t = e.constructor;
|
|
61
|
+
return new t(e.buffer.slice(0), e.byteOffset, e.byteLength / e.BYTES_PER_ELEMENT || 1);
|
|
62
|
+
}
|
|
63
|
+
function y(e) {
|
|
64
|
+
if (e ||= {}, e.circular) return ee(e);
|
|
65
|
+
let t = /* @__PURE__ */ new Map();
|
|
66
|
+
if (t.set(Date, (e) => new Date(e)), t.set(Map, (e, t) => new Map(r(Array.from(e), t))), t.set(Set, (e, t) => new Set(r(Array.from(e), t))), e.constructorHandlers) for (let n of e.constructorHandlers) t.set(n[0], n[1]);
|
|
67
|
+
let n;
|
|
68
|
+
return e.proto ? a : i;
|
|
69
|
+
function r(e, r) {
|
|
70
|
+
let i = Object.keys(e), a = Array.from({ length: i.length });
|
|
71
|
+
for (let o = 0; o < i.length; o++) {
|
|
72
|
+
let s = i[o], c = e[s];
|
|
73
|
+
typeof c != "object" || !c ? a[s] = c : c.constructor !== Object && (n = t.get(c.constructor)) ? a[s] = n(c, r) : ArrayBuffer.isView(c) ? a[s] = v(c) : a[s] = r(c);
|
|
74
|
+
}
|
|
75
|
+
return a;
|
|
76
|
+
}
|
|
77
|
+
function i(e) {
|
|
78
|
+
if (typeof e != "object" || !e) return e;
|
|
79
|
+
if (Array.isArray(e)) return r(e, i);
|
|
80
|
+
if (e.constructor !== Object && (n = t.get(e.constructor))) return n(e, i);
|
|
81
|
+
let a = {};
|
|
82
|
+
for (let r in e) {
|
|
83
|
+
if (Object.hasOwnProperty.call(e, r) === !1) continue;
|
|
84
|
+
let o = e[r];
|
|
85
|
+
typeof o != "object" || !o ? a[r] = o : o.constructor !== Object && (n = t.get(o.constructor)) ? a[r] = n(o, i) : ArrayBuffer.isView(o) ? a[r] = v(o) : a[r] = i(o);
|
|
86
|
+
}
|
|
87
|
+
return a;
|
|
88
|
+
}
|
|
89
|
+
function a(e) {
|
|
90
|
+
if (typeof e != "object" || !e) return e;
|
|
91
|
+
if (Array.isArray(e)) return r(e, a);
|
|
92
|
+
if (e.constructor !== Object && (n = t.get(e.constructor))) return n(e, a);
|
|
93
|
+
let i = {};
|
|
94
|
+
for (let r in e) {
|
|
95
|
+
let o = e[r];
|
|
96
|
+
typeof o != "object" || !o ? i[r] = o : o.constructor !== Object && (n = t.get(o.constructor)) ? i[r] = n(o, a) : ArrayBuffer.isView(o) ? i[r] = v(o) : i[r] = a(o);
|
|
97
|
+
}
|
|
98
|
+
return i;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function ee(e) {
|
|
102
|
+
let t = [], n = [], r = /* @__PURE__ */ new Map();
|
|
103
|
+
if (r.set(Date, (e) => new Date(e)), r.set(Map, (e, t) => new Map(a(Array.from(e), t))), r.set(Set, (e, t) => new Set(a(Array.from(e), t))), e.constructorHandlers) for (let t of e.constructorHandlers) r.set(t[0], t[1]);
|
|
104
|
+
let i;
|
|
105
|
+
return e.proto ? s : o;
|
|
106
|
+
function a(e, a) {
|
|
107
|
+
let o = Object.keys(e), s = Array.from({ length: o.length });
|
|
108
|
+
for (let c = 0; c < o.length; c++) {
|
|
109
|
+
let l = o[c], u = e[l];
|
|
110
|
+
if (typeof u != "object" || !u) s[l] = u;
|
|
111
|
+
else if (u.constructor !== Object && (i = r.get(u.constructor))) s[l] = i(u, a);
|
|
112
|
+
else if (ArrayBuffer.isView(u)) s[l] = v(u);
|
|
113
|
+
else {
|
|
114
|
+
let e = t.indexOf(u);
|
|
115
|
+
e === -1 ? s[l] = a(u) : s[l] = n[e];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return s;
|
|
119
|
+
}
|
|
120
|
+
function o(e) {
|
|
121
|
+
if (typeof e != "object" || !e) return e;
|
|
122
|
+
if (Array.isArray(e)) return a(e, o);
|
|
123
|
+
if (e.constructor !== Object && (i = r.get(e.constructor))) return i(e, o);
|
|
124
|
+
let s = {};
|
|
125
|
+
t.push(e), n.push(s);
|
|
126
|
+
for (let a in e) {
|
|
127
|
+
if (Object.hasOwnProperty.call(e, a) === !1) continue;
|
|
128
|
+
let c = e[a];
|
|
129
|
+
if (typeof c != "object" || !c) s[a] = c;
|
|
130
|
+
else if (c.constructor !== Object && (i = r.get(c.constructor))) s[a] = i(c, o);
|
|
131
|
+
else if (ArrayBuffer.isView(c)) s[a] = v(c);
|
|
132
|
+
else {
|
|
133
|
+
let e = t.indexOf(c);
|
|
134
|
+
e === -1 ? s[a] = o(c) : s[a] = n[e];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return t.pop(), n.pop(), s;
|
|
138
|
+
}
|
|
139
|
+
function s(e) {
|
|
140
|
+
if (typeof e != "object" || !e) return e;
|
|
141
|
+
if (Array.isArray(e)) return a(e, s);
|
|
142
|
+
if (e.constructor !== Object && (i = r.get(e.constructor))) return i(e, s);
|
|
143
|
+
let o = {};
|
|
144
|
+
t.push(e), n.push(o);
|
|
145
|
+
for (let a in e) {
|
|
146
|
+
let c = e[a];
|
|
147
|
+
if (typeof c != "object" || !c) o[a] = c;
|
|
148
|
+
else if (c.constructor !== Object && (i = r.get(c.constructor))) o[a] = i(c, s);
|
|
149
|
+
else if (ArrayBuffer.isView(c)) o[a] = v(c);
|
|
150
|
+
else {
|
|
151
|
+
let e = t.indexOf(c);
|
|
152
|
+
e === -1 ? o[a] = s(c) : o[a] = n[e];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return t.pop(), n.pop(), o;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
y();
|
|
159
|
+
function b(e, t = 8) {
|
|
160
|
+
let n = "";
|
|
161
|
+
for (let e = 0; e < t; e++) {
|
|
162
|
+
let e = Math.floor(Math.random() * 62);
|
|
163
|
+
n += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[e];
|
|
164
|
+
}
|
|
165
|
+
return e ? `${e}${n}` : n;
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/defaults.ts
|
|
169
|
+
var x = ({ name: e }) => `.${e}-theme, [data-theme="${e}"]`, S = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/generator/genAtRuleQuery.ts
|
|
172
|
+
function te(e, t) {
|
|
173
|
+
return `@${e}${t ? " " : ""}${t}`;
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region ../../node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
|
|
177
|
+
var ne = /\d/, re = [
|
|
178
|
+
"-",
|
|
179
|
+
"_",
|
|
180
|
+
"/",
|
|
181
|
+
"."
|
|
182
|
+
];
|
|
183
|
+
function ie(e = "") {
|
|
184
|
+
if (!ne.test(e)) return e !== e.toLowerCase();
|
|
185
|
+
}
|
|
186
|
+
function C(e, t) {
|
|
187
|
+
let n = t ?? re, r = [];
|
|
188
|
+
if (!e || typeof e != "string") return r;
|
|
189
|
+
let i = "", a, o;
|
|
190
|
+
for (let t of e) {
|
|
191
|
+
let e = n.includes(t);
|
|
192
|
+
if (e === !0) {
|
|
193
|
+
r.push(i), i = "", a = void 0;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
let s = ie(t);
|
|
197
|
+
if (o === !1) {
|
|
198
|
+
if (a === !1 && s === !0) {
|
|
199
|
+
r.push(i), i = t, a = s;
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
if (a === !0 && s === !1 && i.length > 1) {
|
|
203
|
+
let e = i.at(-1);
|
|
204
|
+
r.push(i.slice(0, Math.max(0, i.length - 1))), i = e + t, a = s;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
i += t, a = s, o = e;
|
|
209
|
+
}
|
|
210
|
+
return r.push(i), r;
|
|
49
211
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
return Buffer.from(e);
|
|
53
|
-
const t = e.constructor;
|
|
54
|
-
return new t(
|
|
55
|
-
e.buffer.slice(0),
|
|
56
|
-
e.byteOffset,
|
|
57
|
-
e.byteLength / e.BYTES_PER_ELEMENT || 1
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
function Z(e) {
|
|
61
|
-
if (e = e || {}, e.circular)
|
|
62
|
-
return W(e);
|
|
63
|
-
const t = /* @__PURE__ */ new Map();
|
|
64
|
-
if (t.set(Date, (s) => new Date(s)), t.set(
|
|
65
|
-
Map,
|
|
66
|
-
(s, a) => new Map(n(Array.from(s), a))
|
|
67
|
-
), t.set(
|
|
68
|
-
Set,
|
|
69
|
-
(s, a) => new Set(n(Array.from(s), a))
|
|
70
|
-
), e.constructorHandlers)
|
|
71
|
-
for (const s of e.constructorHandlers)
|
|
72
|
-
t.set(s[0], s[1]);
|
|
73
|
-
let r;
|
|
74
|
-
return e.proto ? c : o;
|
|
75
|
-
function n(s, a) {
|
|
76
|
-
const u = Object.keys(s), i = Array.from({ length: u.length });
|
|
77
|
-
for (let f = 0; f < u.length; f++) {
|
|
78
|
-
const l = u[f], m = s[l];
|
|
79
|
-
typeof m != "object" || m === null ? i[l] = m : m.constructor !== Object && (r = t.get(m.constructor)) ? i[l] = r(m, a) : ArrayBuffer.isView(m) ? i[l] = A(m) : i[l] = a(m);
|
|
80
|
-
}
|
|
81
|
-
return i;
|
|
82
|
-
}
|
|
83
|
-
function o(s) {
|
|
84
|
-
if (typeof s != "object" || s === null) return s;
|
|
85
|
-
if (Array.isArray(s)) return n(s, o);
|
|
86
|
-
if (s.constructor !== Object && (r = t.get(s.constructor)))
|
|
87
|
-
return r(s, o);
|
|
88
|
-
const a = {};
|
|
89
|
-
for (const u in s) {
|
|
90
|
-
if (Object.hasOwnProperty.call(s, u) === !1) continue;
|
|
91
|
-
const i = s[u];
|
|
92
|
-
typeof i != "object" || i === null ? a[u] = i : i.constructor !== Object && (r = t.get(i.constructor)) ? a[u] = r(i, o) : ArrayBuffer.isView(i) ? a[u] = A(i) : a[u] = o(i);
|
|
93
|
-
}
|
|
94
|
-
return a;
|
|
95
|
-
}
|
|
96
|
-
function c(s) {
|
|
97
|
-
if (typeof s != "object" || s === null) return s;
|
|
98
|
-
if (Array.isArray(s)) return n(s, c);
|
|
99
|
-
if (s.constructor !== Object && (r = t.get(s.constructor)))
|
|
100
|
-
return r(s, c);
|
|
101
|
-
const a = {};
|
|
102
|
-
for (const u in s) {
|
|
103
|
-
const i = s[u];
|
|
104
|
-
typeof i != "object" || i === null ? a[u] = i : i.constructor !== Object && (r = t.get(i.constructor)) ? a[u] = r(i, c) : ArrayBuffer.isView(i) ? a[u] = A(i) : a[u] = c(i);
|
|
105
|
-
}
|
|
106
|
-
return a;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function W(e) {
|
|
110
|
-
const t = [], r = [], n = /* @__PURE__ */ new Map();
|
|
111
|
-
if (n.set(Date, (u) => new Date(u)), n.set(
|
|
112
|
-
Map,
|
|
113
|
-
(u, i) => new Map(c(Array.from(u), i))
|
|
114
|
-
), n.set(
|
|
115
|
-
Set,
|
|
116
|
-
(u, i) => new Set(c(Array.from(u), i))
|
|
117
|
-
), e.constructorHandlers)
|
|
118
|
-
for (const u of e.constructorHandlers)
|
|
119
|
-
n.set(u[0], u[1]);
|
|
120
|
-
let o;
|
|
121
|
-
return e.proto ? a : s;
|
|
122
|
-
function c(u, i) {
|
|
123
|
-
const f = Object.keys(u), l = Array.from({ length: f.length });
|
|
124
|
-
for (let m = 0; m < f.length; m++) {
|
|
125
|
-
const d = f[m], p = u[d];
|
|
126
|
-
if (typeof p != "object" || p === null)
|
|
127
|
-
l[d] = p;
|
|
128
|
-
else if (p.constructor !== Object && (o = n.get(p.constructor)))
|
|
129
|
-
l[d] = o(p, i);
|
|
130
|
-
else if (ArrayBuffer.isView(p))
|
|
131
|
-
l[d] = A(p);
|
|
132
|
-
else {
|
|
133
|
-
const b = t.indexOf(p);
|
|
134
|
-
b !== -1 ? l[d] = r[b] : l[d] = i(p);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return l;
|
|
138
|
-
}
|
|
139
|
-
function s(u) {
|
|
140
|
-
if (typeof u != "object" || u === null) return u;
|
|
141
|
-
if (Array.isArray(u)) return c(u, s);
|
|
142
|
-
if (u.constructor !== Object && (o = n.get(u.constructor)))
|
|
143
|
-
return o(u, s);
|
|
144
|
-
const i = {};
|
|
145
|
-
t.push(u), r.push(i);
|
|
146
|
-
for (const f in u) {
|
|
147
|
-
if (Object.hasOwnProperty.call(u, f) === !1) continue;
|
|
148
|
-
const l = u[f];
|
|
149
|
-
if (typeof l != "object" || l === null)
|
|
150
|
-
i[f] = l;
|
|
151
|
-
else if (l.constructor !== Object && (o = n.get(l.constructor)))
|
|
152
|
-
i[f] = o(l, s);
|
|
153
|
-
else if (ArrayBuffer.isView(l))
|
|
154
|
-
i[f] = A(l);
|
|
155
|
-
else {
|
|
156
|
-
const m = t.indexOf(l);
|
|
157
|
-
m !== -1 ? i[f] = r[m] : i[f] = s(l);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return t.pop(), r.pop(), i;
|
|
161
|
-
}
|
|
162
|
-
function a(u) {
|
|
163
|
-
if (typeof u != "object" || u === null) return u;
|
|
164
|
-
if (Array.isArray(u)) return c(u, a);
|
|
165
|
-
if (u.constructor !== Object && (o = n.get(u.constructor)))
|
|
166
|
-
return o(u, a);
|
|
167
|
-
const i = {};
|
|
168
|
-
t.push(u), r.push(i);
|
|
169
|
-
for (const f in u) {
|
|
170
|
-
const l = u[f];
|
|
171
|
-
if (typeof l != "object" || l === null)
|
|
172
|
-
i[f] = l;
|
|
173
|
-
else if (l.constructor !== Object && (o = n.get(l.constructor)))
|
|
174
|
-
i[f] = o(l, a);
|
|
175
|
-
else if (ArrayBuffer.isView(l))
|
|
176
|
-
i[f] = A(l);
|
|
177
|
-
else {
|
|
178
|
-
const m = t.indexOf(l);
|
|
179
|
-
m !== -1 ? i[f] = r[m] : i[f] = a(l);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return t.pop(), r.pop(), i;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
Z();
|
|
186
|
-
function G(e, t = 8) {
|
|
187
|
-
const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
188
|
-
let n = "";
|
|
189
|
-
for (let o = 0; o < t; o++) {
|
|
190
|
-
const c = Math.floor(Math.random() * r.length);
|
|
191
|
-
n += r[c];
|
|
192
|
-
}
|
|
193
|
-
return e ? `${e}${n}` : n;
|
|
194
|
-
}
|
|
195
|
-
const Y = ({ name: e }) => `.${e}-theme, [data-theme="${e}"]`, w = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
|
|
196
|
-
function X(e, t) {
|
|
197
|
-
return `@${e}${t ? " " : ""}${t}`;
|
|
198
|
-
}
|
|
199
|
-
const ee = /\d/, te = ["-", "_", "/", "."];
|
|
200
|
-
function re(e = "") {
|
|
201
|
-
if (!ee.test(e))
|
|
202
|
-
return e !== e.toLowerCase();
|
|
203
|
-
}
|
|
204
|
-
function B(e, t) {
|
|
205
|
-
const r = te, n = [];
|
|
206
|
-
if (!e || typeof e != "string")
|
|
207
|
-
return n;
|
|
208
|
-
let o = "", c, s;
|
|
209
|
-
for (const a of e) {
|
|
210
|
-
const u = r.includes(a);
|
|
211
|
-
if (u === !0) {
|
|
212
|
-
n.push(o), o = "", c = void 0;
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
const i = re(a);
|
|
216
|
-
if (s === !1) {
|
|
217
|
-
if (c === !1 && i === !0) {
|
|
218
|
-
n.push(o), o = a, c = i;
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
if (c === !0 && i === !1 && o.length > 1) {
|
|
222
|
-
const f = o.at(-1);
|
|
223
|
-
n.push(o.slice(0, Math.max(0, o.length - 1))), o = f + a, c = i;
|
|
224
|
-
continue;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
o += a, c = i, s = u;
|
|
228
|
-
}
|
|
229
|
-
return n.push(o), n;
|
|
230
|
-
}
|
|
231
|
-
function ne(e) {
|
|
232
|
-
return e ? e[0].toUpperCase() + e.slice(1) : "";
|
|
212
|
+
function ae(e) {
|
|
213
|
+
return e ? e[0].toUpperCase() + e.slice(1) : "";
|
|
233
214
|
}
|
|
234
215
|
function oe(e) {
|
|
235
|
-
|
|
216
|
+
return e ? e[0].toLowerCase() + e.slice(1) : "";
|
|
236
217
|
}
|
|
237
|
-
function
|
|
238
|
-
|
|
218
|
+
function se(e, t) {
|
|
219
|
+
return e ? (Array.isArray(e) ? e : C(e)).map((e) => ae(t?.normalize ? e.toLowerCase() : e)).join("") : "";
|
|
239
220
|
}
|
|
240
221
|
function ce(e, t) {
|
|
241
|
-
|
|
222
|
+
return oe(se(e || "", t));
|
|
242
223
|
}
|
|
243
|
-
function
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
function ie(e) {
|
|
247
|
-
return ` ${e}`;
|
|
224
|
+
function le(e, t) {
|
|
225
|
+
return e ? (Array.isArray(e) ? e : C(e)).map((e) => e.toLowerCase()).join(t ?? "-") : "";
|
|
248
226
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
`
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/utils.ts
|
|
229
|
+
function w(e) {
|
|
230
|
+
return ` ${e}`;
|
|
253
231
|
}
|
|
254
232
|
function T(e) {
|
|
255
|
-
|
|
233
|
+
return e.split("\n").map((e) => w(e)).join("\n");
|
|
256
234
|
}
|
|
257
235
|
function E(e) {
|
|
258
|
-
|
|
236
|
+
return e === e.toUpperCase();
|
|
259
237
|
}
|
|
260
|
-
function
|
|
261
|
-
|
|
238
|
+
function D(e) {
|
|
239
|
+
return ce(e);
|
|
262
240
|
}
|
|
263
|
-
function
|
|
264
|
-
|
|
241
|
+
function O(e) {
|
|
242
|
+
return le(e);
|
|
265
243
|
}
|
|
266
|
-
|
|
267
|
-
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/generator/genSafePropertyName.ts
|
|
246
|
+
function ue(e) {
|
|
247
|
+
return O(e);
|
|
268
248
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/generator/genDeclaration.ts
|
|
251
|
+
function k(e, t) {
|
|
252
|
+
return `${e.startsWith("--") ? e : ue(e)}: ${t};`;
|
|
273
253
|
}
|
|
274
|
-
|
|
275
|
-
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/generator/genDeclarationsBlock.ts
|
|
256
|
+
function de(e) {
|
|
257
|
+
return `{${e.length > 0 ? "\n" : ""}${e.map((e) => `${T(`${e}`)}\n`).join("")}}`;
|
|
276
258
|
}
|
|
277
|
-
|
|
278
|
-
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/generator/genSafeVariableName.ts
|
|
261
|
+
function A(e) {
|
|
262
|
+
return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
|
|
279
263
|
}
|
|
280
|
-
|
|
281
|
-
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/generator/genDeclareVariable.ts
|
|
266
|
+
function fe(e, t) {
|
|
267
|
+
return k(A(e), t);
|
|
282
268
|
}
|
|
283
|
-
|
|
284
|
-
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/generator/genReferenceVariable.ts
|
|
271
|
+
function pe(e, t) {
|
|
272
|
+
return `var(${A(e)}${t ? `, ${t}` : ""})`;
|
|
285
273
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
function U(e) {
|
|
292
|
-
return function(r, n) {
|
|
293
|
-
const c = (n.variables?.name ?? w)({ name: r.name });
|
|
294
|
-
return pe(c, e(r.value, n));
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
function C(e) {
|
|
298
|
-
const t = U(e), r = ye(e);
|
|
299
|
-
return function(o, c, s) {
|
|
300
|
-
const { variables: a, declarations: u, children: i } = c, f = o === ":root", l = (a ?? []).map(
|
|
301
|
-
(g) => t(g, s)
|
|
302
|
-
), m = r(
|
|
303
|
-
u ?? {},
|
|
304
|
-
s
|
|
305
|
-
), d = (i ?? []).map(
|
|
306
|
-
(g) => e(g, s)
|
|
307
|
-
), p = l.length > 0, b = m.length > 0, v = d.length > 0;
|
|
308
|
-
return f ? `${p || b ? O(o, [
|
|
309
|
-
...l,
|
|
310
|
-
...p && b ? [""] : [],
|
|
311
|
-
...m
|
|
312
|
-
]) : ""}${v && (p || b) ? `
|
|
313
|
-
|
|
314
|
-
` : ""}${d.join(`
|
|
315
|
-
|
|
316
|
-
`)}` : O(o, [
|
|
317
|
-
...l,
|
|
318
|
-
...p && (v || b) ? [""] : [],
|
|
319
|
-
...m,
|
|
320
|
-
...b && v ? [""] : [],
|
|
321
|
-
...d.flatMap(
|
|
322
|
-
(g, L) => L === d.length - 1 ? [g] : [g, ""]
|
|
323
|
-
)
|
|
324
|
-
]);
|
|
325
|
-
};
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region src/generator/genSelector.ts
|
|
276
|
+
function j(e, t) {
|
|
277
|
+
return `${e} ${de(t)}`;
|
|
326
278
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
return c || s && !(a || u || i) ? `${f};` : t(f, n, o);
|
|
334
|
-
};
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/consume/css/declarations.ts
|
|
281
|
+
function me(e) {
|
|
282
|
+
return function(t, n) {
|
|
283
|
+
return Object.entries(t).map(([t, r]) => k(t, e(r, n)));
|
|
284
|
+
};
|
|
335
285
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/consume/css/variable.ts
|
|
288
|
+
function M(e) {
|
|
289
|
+
return function(t, n) {
|
|
290
|
+
return fe((n.variables?.name ?? S)({ name: t.name }), e(t.value, n));
|
|
291
|
+
};
|
|
340
292
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/consume/css/container.ts
|
|
295
|
+
function N(e) {
|
|
296
|
+
let t = M(e), n = me(e);
|
|
297
|
+
return function(r, i, a) {
|
|
298
|
+
let { variables: o, declarations: s, children: c } = i, l = r === ":root", u = (o ?? []).map((e) => t(e, a)), d = n(s ?? {}, a), f = (c ?? []).map((t) => e(t, a)), p = u.length > 0, m = d.length > 0, h = f.length > 0;
|
|
299
|
+
return l ? `${p || m ? j(r, [
|
|
300
|
+
...u,
|
|
301
|
+
...p && m ? [""] : [],
|
|
302
|
+
...d
|
|
303
|
+
]) : ""}${h && (p || m) ? "\n\n" : ""}${f.join("\n\n")}` : j(r, [
|
|
304
|
+
...u,
|
|
305
|
+
...p && (h || m) ? [""] : [],
|
|
306
|
+
...d,
|
|
307
|
+
...m && h ? [""] : [],
|
|
308
|
+
...f.flatMap((e, t) => t === f.length - 1 ? [e] : [e, ""])
|
|
309
|
+
]);
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/consume/css/at-rule.ts
|
|
314
|
+
function P(e) {
|
|
315
|
+
let r = N(e);
|
|
316
|
+
return function(e, i) {
|
|
317
|
+
let a = t.includes(e.identifier), o = n.includes(e.identifier), s = Object.keys(e.declarations).length > 0, c = e.variables.length > 0, l = e.children.length > 0, u = te(e.identifier, e.rule);
|
|
318
|
+
return a || o && !(s || c || l) ? `${u};` : r(u, e, i);
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/consume/css/css.ts
|
|
323
|
+
function F(e) {
|
|
324
|
+
return function(t, n) {
|
|
325
|
+
return t.value.map((t) => e(t, n)).join("").trim();
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region src/consume/css/primitive.ts
|
|
330
|
+
function I(e) {
|
|
331
|
+
return function(e, t) {
|
|
332
|
+
return e == null ? "" : `${e}`;
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/consume/css/ref.ts
|
|
337
|
+
function L(e) {
|
|
338
|
+
return function(t, n) {
|
|
339
|
+
return pe((n.variables?.name ?? S)({ name: t.name }), t.fallback ? e(t.fallback, n) : void 0);
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/consume/css/root.ts
|
|
344
|
+
function R(e) {
|
|
345
|
+
let t = N(e);
|
|
346
|
+
return function(n, r, i) {
|
|
347
|
+
let a = i?.treeshake ?? !1, o = i?.scanner ?? !1, s = n._usage.variables, c = (e) => !a || s.has(e.name), l = (e) => a ? {
|
|
348
|
+
...e,
|
|
349
|
+
variables: e.variables.filter(c)
|
|
350
|
+
} : e, u = a && o, d = n._usage.utilities, f = (e) => e.type !== "utility" || !u ? !0 : d.has(h({
|
|
351
|
+
name: e.name,
|
|
352
|
+
value: e.value,
|
|
353
|
+
modifiers: e.modifiers
|
|
354
|
+
})), p = l(n), m = u ? {
|
|
355
|
+
...p,
|
|
356
|
+
children: p.children.filter(f)
|
|
357
|
+
} : p;
|
|
358
|
+
return n.themes.map(l).reduce((t, n) => (t.push(e(n, r)), t), [t(":root", m, r)]).join("\n\n");
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/consume/css/selector.ts
|
|
363
|
+
function z(e) {
|
|
364
|
+
let t = N(e);
|
|
365
|
+
return function(e, n) {
|
|
366
|
+
return t(e.query, e, n);
|
|
367
|
+
};
|
|
366
368
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/consume/css/theme.ts
|
|
371
|
+
function he(e) {
|
|
372
|
+
let t = N(e);
|
|
373
|
+
return function(e, n) {
|
|
374
|
+
return t((n.themes?.selector ?? x)({ name: e.name }), e, n);
|
|
375
|
+
};
|
|
372
376
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
case z(e):
|
|
411
|
-
return i(e, t);
|
|
412
|
-
default:
|
|
413
|
-
return f(e, t);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
function je(e) {
|
|
417
|
-
return function(r, n) {
|
|
418
|
-
let o = r._exportName;
|
|
419
|
-
o || (o = E(r.name), r.name[0] && T(r.name[0]) && (o = x(o)));
|
|
420
|
-
const c = `${o}Recipe`, s = r._runtime ?? {};
|
|
421
|
-
return `const ${c} = ${JSON.stringify(
|
|
422
|
-
s,
|
|
423
|
-
null,
|
|
424
|
-
4
|
|
425
|
-
)} as const satisfies RecipeRuntime;
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region src/consume/css/utility.ts
|
|
379
|
+
function ge(e) {
|
|
380
|
+
let t = N(e);
|
|
381
|
+
return function(e, n) {
|
|
382
|
+
let r = [], i = _((n.utilities?.selector ?? h)({
|
|
383
|
+
name: e.name,
|
|
384
|
+
value: e.value,
|
|
385
|
+
modifiers: e.modifiers
|
|
386
|
+
}));
|
|
387
|
+
return r.push(t(i, e, n)), r.join("\n\n");
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region src/consume/css/consume.ts
|
|
392
|
+
function B(e, t, n) {
|
|
393
|
+
let r = R(B), i = z(B), p = ge(B), m = P(B), h = he(B), g = M(B), _ = L(B), v = F(B), y = I(B);
|
|
394
|
+
switch (!0) {
|
|
395
|
+
case s(e): return i(e, t);
|
|
396
|
+
case l(e): return p(e, t);
|
|
397
|
+
case c(e): return m(e, t);
|
|
398
|
+
case f(e): return r(e, t, n);
|
|
399
|
+
case d(e): return h(e, t);
|
|
400
|
+
case a(e): return g(e, t);
|
|
401
|
+
case o(e): return _(e, t);
|
|
402
|
+
case u(e): return v(e, t);
|
|
403
|
+
default: return y(e, t);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/consume/ts/recipe.ts
|
|
408
|
+
function _e(e) {
|
|
409
|
+
return function(e, t, n) {
|
|
410
|
+
let r = e._exportName;
|
|
411
|
+
r || (r = D(e.name), e.name[0] && E(e.name[0]) && (r = g(r)));
|
|
412
|
+
let i = `${r}Recipe`, a = e._runtime ?? {}, o = n?.shortMap ? ", __shortMap" : "", s = `${g(r)}Props`;
|
|
413
|
+
return `const ${i} = ${JSON.stringify(a, null, 4)} as const satisfies RecipeRuntime;
|
|
426
414
|
|
|
427
|
-
export
|
|
415
|
+
export type ${s} = RecipeVariantProps<typeof ${i}>;
|
|
416
|
+
export const ${r} = createRecipe("${e.name}", ${i}${o});
|
|
428
417
|
`;
|
|
429
|
-
|
|
418
|
+
};
|
|
430
419
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
function Ne(e) {
|
|
437
|
-
return function(r, n) {
|
|
438
|
-
const o = Re(r.children), c = r.recipes.length > 0, s = o.length > 0;
|
|
439
|
-
if (!c && !s)
|
|
440
|
-
return "";
|
|
441
|
-
const a = [];
|
|
442
|
-
return c && (a.push(`import { createRecipe } from '@styleframe/runtime';
|
|
443
|
-
import type { RecipeRuntime } from '@styleframe/runtime';
|
|
444
|
-
`), a.push(e(r.recipes, n))), s && a.push(e(o, n)), a.join(`
|
|
445
|
-
`);
|
|
446
|
-
};
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/consume/ts/root.ts
|
|
422
|
+
function ve(e) {
|
|
423
|
+
return e.filter((e) => s(e) && !!e._exportName);
|
|
447
424
|
}
|
|
448
|
-
function
|
|
449
|
-
|
|
450
|
-
|
|
425
|
+
function ye(e) {
|
|
426
|
+
return function(t, n, r) {
|
|
427
|
+
let i = ve(t.children), a = t._usage?.recipes, o = a && a.size > 0 ? t.recipes.filter((e) => a.has(e.name)) : t.recipes, s = o.length > 0, c = i.length > 0;
|
|
428
|
+
if (!s && !c) return "";
|
|
429
|
+
let l = [];
|
|
430
|
+
if (s) {
|
|
431
|
+
let t = ["import { createRecipe } from '@styleframe/runtime';", "import type { RecipeRuntime, RecipeVariantProps } from '@styleframe/runtime';"];
|
|
432
|
+
r?.shortMap && t.push("import type { ShorteningMap } from '@styleframe/runtime';"), l.push(`${t.join("\n")}\n`), r?.shortMap && l.push(`const __shortMap: ShorteningMap = ${JSON.stringify(r.shortMap)} as const;\n`), l.push(e(o, n, r));
|
|
433
|
+
}
|
|
434
|
+
return c && l.push(e(i, n)), l.join("\n");
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/consume/ts/selector.ts
|
|
439
|
+
function be(e) {
|
|
440
|
+
return function(e, t) {
|
|
441
|
+
return e._exportName ? `export const ${e._exportName} = ${JSON.stringify(e.query)};
|
|
451
442
|
` : "";
|
|
452
|
-
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/consume/ts/consume.ts
|
|
447
|
+
function V(e, t, n) {
|
|
448
|
+
let r = ye(V), i = _e(V), a = be(V);
|
|
449
|
+
switch (!0) {
|
|
450
|
+
case Array.isArray(e): return e.map((e) => V(e, t, n)).join("\n");
|
|
451
|
+
case f(e): return r(e, t, n);
|
|
452
|
+
case p(e): return i(e, t, n);
|
|
453
|
+
case s(e): return a(e, t);
|
|
454
|
+
default: return "";
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/consume/dts/constants.ts
|
|
459
|
+
var H = "// Auto-generated by @styleframe/plugin - DO NOT EDIT", U = "styleframe.d.ts", W = "shims.d.ts", xe = "virtual:styleframe", Se = "virtual:styleframe.css";
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/consume/dts/recipe.ts
|
|
462
|
+
function Ce(e) {
|
|
463
|
+
let t = e?.variants;
|
|
464
|
+
if (!t || Object.keys(t).length === 0) return "Record<string, never>";
|
|
465
|
+
let n = [];
|
|
466
|
+
for (let [e, r] of Object.entries(t)) {
|
|
467
|
+
if (!r) continue;
|
|
468
|
+
let t = Object.keys(r);
|
|
469
|
+
if (t.length > 0) {
|
|
470
|
+
let r = t.map((e) => `"${e}"`).join(" | "), i = t.includes("true") && t.includes("false") ? `${r} | boolean` : r;
|
|
471
|
+
n.push(`${e}?: ${i}`);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return n.length === 0 ? "Record<string, never>" : `{ ${n.join("; ")} }`;
|
|
475
|
+
}
|
|
476
|
+
function G(e) {
|
|
477
|
+
return function(e, t) {
|
|
478
|
+
let n = e._exportName;
|
|
479
|
+
n || (n = D(e.name), e.name[0] && E(e.name[0]) && (n = g(n)));
|
|
480
|
+
let r = Ce(e._runtime), i = `${g(n)}Props`;
|
|
481
|
+
return `export type ${i} = ${r};
|
|
482
|
+
export const ${n}: (props?: ${i}) => string;`;
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/consume/dts/root.ts
|
|
487
|
+
function we(e) {
|
|
488
|
+
return e.filter((e) => s(e) && !!e._exportName);
|
|
489
|
+
}
|
|
490
|
+
function Te(e) {
|
|
491
|
+
return function(t, n) {
|
|
492
|
+
let r = we(t.children), i = t._usage?.recipes, a = i && i.size > 0 ? t.recipes.filter((e) => i.has(e.name)) : t.recipes, o = a.length > 0, s = r.length > 0, c = [
|
|
493
|
+
H,
|
|
494
|
+
"import type { Styleframe } from \"@styleframe/core\";",
|
|
495
|
+
"",
|
|
496
|
+
"export function styleframe(): Styleframe;"
|
|
497
|
+
];
|
|
498
|
+
if (o) {
|
|
499
|
+
c.push("");
|
|
500
|
+
let t = a.map((t) => e(t, n)).filter(Boolean);
|
|
501
|
+
c.push(...t);
|
|
502
|
+
}
|
|
503
|
+
if (s) {
|
|
504
|
+
c.push("");
|
|
505
|
+
let t = r.map((t) => e(t, n)).filter(Boolean);
|
|
506
|
+
c.push(...t);
|
|
507
|
+
}
|
|
508
|
+
return c.push(""), c.join("\n");
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/consume/dts/selector.ts
|
|
511
513
|
function Ee(e) {
|
|
512
|
-
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
);
|
|
538
|
-
} catch {
|
|
539
|
-
return {
|
|
540
|
-
key: "",
|
|
541
|
-
instanceId: "",
|
|
542
|
-
environment: "",
|
|
543
|
-
valid: !1
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
function Fe(e) {
|
|
548
|
-
const t = e?.variants;
|
|
549
|
-
if (!t || Object.keys(t).length === 0)
|
|
550
|
-
return "Record<string, never>";
|
|
551
|
-
const r = [];
|
|
552
|
-
for (const [n, o] of Object.entries(t)) {
|
|
553
|
-
if (!o) continue;
|
|
554
|
-
const c = Object.keys(o);
|
|
555
|
-
if (c.length > 0) {
|
|
556
|
-
const s = c.map((i) => `"${i}"`).join(" | "), u = c.includes("true") && c.includes("false") ? `${s} | boolean` : s;
|
|
557
|
-
r.push(`${n}?: ${u}`);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
return r.length === 0 ? "Record<string, never>" : `{ ${r.join("; ")} }`;
|
|
561
|
-
}
|
|
562
|
-
function Ue(e) {
|
|
563
|
-
return function(r, n) {
|
|
564
|
-
let o = r._exportName;
|
|
565
|
-
o || (o = E(r.name), r.name[0] && T(r.name[0]) && (o = x(o)));
|
|
566
|
-
const c = Fe(r._runtime);
|
|
567
|
-
return ` export const ${o}: (props?: ${c}) => string;`;
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
function Le(e) {
|
|
571
|
-
return e.filter(
|
|
572
|
-
(t) => S(t) && !!t._exportName
|
|
573
|
-
);
|
|
574
|
-
}
|
|
575
|
-
function Pe(e) {
|
|
576
|
-
return function(r, n) {
|
|
577
|
-
const o = Le(r.children), c = r.recipes.length > 0, s = o.length > 0, a = [
|
|
578
|
-
"// Auto-generated by @styleframe/plugin - DO NOT EDIT",
|
|
579
|
-
"",
|
|
580
|
-
'declare module "virtual:styleframe" {',
|
|
581
|
-
' import type { Styleframe } from "@styleframe/core";',
|
|
582
|
-
"",
|
|
583
|
-
" /** Returns the global styleframe instance from styleframe.config.ts */",
|
|
584
|
-
" export function styleframe(): Styleframe;"
|
|
585
|
-
];
|
|
586
|
-
if (c) {
|
|
587
|
-
a.push("");
|
|
588
|
-
const u = r.recipes.map((i) => e(i, n)).filter(Boolean);
|
|
589
|
-
a.push(...u);
|
|
590
|
-
}
|
|
591
|
-
if (s) {
|
|
592
|
-
a.push("");
|
|
593
|
-
const u = o.map((i) => e(i, n)).filter(Boolean);
|
|
594
|
-
a.push(...u);
|
|
595
|
-
}
|
|
596
|
-
return a.push("}"), a.push(""), a.push('declare module "virtual:styleframe.css" {'), a.push(" const css: string;"), a.push(" export default css;"), a.push("}"), a.push(""), a.join(`
|
|
597
|
-
`);
|
|
598
|
-
};
|
|
514
|
+
return function(e, t) {
|
|
515
|
+
return e._exportName ? `export const ${e._exportName}: string;` : "";
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/consume/dts/consume.ts
|
|
520
|
+
function K(e, t) {
|
|
521
|
+
let n = Te(K), r = G(K), i = Ee(K);
|
|
522
|
+
switch (!0) {
|
|
523
|
+
case Array.isArray(e): return e.map((e) => K(e, t)).join("\n");
|
|
524
|
+
case f(e): return n(e, t);
|
|
525
|
+
case p(e): return r(e, t);
|
|
526
|
+
case s(e): return i(e, t);
|
|
527
|
+
default: return "";
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/consume/dts/shims.ts
|
|
532
|
+
function De(e) {
|
|
533
|
+
let t = e.split("\n").filter((e, t) => !(t === 0 && e === "// Auto-generated by @styleframe/plugin - DO NOT EDIT")).map((e) => e.length > 0 ? ` ${e}` : e).join("\n").replace(/\n+$/, "");
|
|
534
|
+
return [
|
|
535
|
+
`declare module "${xe}" {`,
|
|
536
|
+
t,
|
|
537
|
+
"}"
|
|
538
|
+
].join("\n");
|
|
599
539
|
}
|
|
600
|
-
function
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
540
|
+
function Oe(e) {
|
|
541
|
+
return `${[
|
|
542
|
+
H,
|
|
543
|
+
De(e),
|
|
544
|
+
"",
|
|
545
|
+
`declare module "${Se}" {`,
|
|
546
|
+
" const css: string;",
|
|
547
|
+
" export default css;",
|
|
548
|
+
"}"
|
|
549
|
+
].join("\n")}\n`;
|
|
550
|
+
}
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/minify/defaults.ts
|
|
553
|
+
var q = {
|
|
554
|
+
display: "d",
|
|
555
|
+
position: "pos",
|
|
556
|
+
overflow: "ov",
|
|
557
|
+
"overflow-x": "ovx",
|
|
558
|
+
"overflow-y": "ovy",
|
|
559
|
+
visibility: "vis",
|
|
560
|
+
"z-index": "z",
|
|
561
|
+
float: "fl",
|
|
562
|
+
clear: "cl",
|
|
563
|
+
margin: "m",
|
|
564
|
+
"margin-top": "mt",
|
|
565
|
+
"margin-right": "mr",
|
|
566
|
+
"margin-bottom": "mb",
|
|
567
|
+
"margin-left": "ml",
|
|
568
|
+
"margin-inline": "mx",
|
|
569
|
+
"margin-block": "my",
|
|
570
|
+
padding: "p",
|
|
571
|
+
"padding-top": "pt",
|
|
572
|
+
"padding-right": "pr",
|
|
573
|
+
"padding-bottom": "pb",
|
|
574
|
+
"padding-left": "pl",
|
|
575
|
+
"padding-inline": "px",
|
|
576
|
+
"padding-block": "py",
|
|
577
|
+
gap: "g",
|
|
578
|
+
width: "w",
|
|
579
|
+
"min-width": "miw",
|
|
580
|
+
"max-width": "maw",
|
|
581
|
+
height: "h",
|
|
582
|
+
"min-height": "mih",
|
|
583
|
+
"max-height": "mah",
|
|
584
|
+
color: "c",
|
|
585
|
+
"font-size": "fs",
|
|
586
|
+
"font-weight": "fw",
|
|
587
|
+
"font-family": "ff",
|
|
588
|
+
"font-style": "fst",
|
|
589
|
+
"line-height": "lh",
|
|
590
|
+
"letter-spacing": "ls",
|
|
591
|
+
"text-align": "ta",
|
|
592
|
+
"text-transform": "tt",
|
|
593
|
+
"text-decoration": "td",
|
|
594
|
+
"white-space": "ws",
|
|
595
|
+
background: "bg",
|
|
596
|
+
"background-color": "bgc",
|
|
597
|
+
"border-color": "bc",
|
|
598
|
+
"border-width": "bw",
|
|
599
|
+
"border-style": "bs",
|
|
600
|
+
"border-radius": "br",
|
|
601
|
+
"flex-direction": "fd",
|
|
602
|
+
"flex-wrap": "fwr",
|
|
603
|
+
"align-items": "ai",
|
|
604
|
+
"align-content": "ac",
|
|
605
|
+
"align-self": "as",
|
|
606
|
+
"justify-content": "jc",
|
|
607
|
+
"justify-items": "ji",
|
|
608
|
+
"justify-self": "js",
|
|
609
|
+
opacity: "op",
|
|
610
|
+
"box-shadow": "bsh",
|
|
611
|
+
cursor: "cur",
|
|
612
|
+
"pointer-events": "pe",
|
|
613
|
+
transition: "tr",
|
|
614
|
+
transform: "tf",
|
|
615
|
+
animation: "an"
|
|
616
|
+
}, J = {
|
|
617
|
+
hover: "h",
|
|
618
|
+
focus: "f",
|
|
619
|
+
active: "a",
|
|
620
|
+
disabled: "dis",
|
|
621
|
+
"focus-within": "fw",
|
|
622
|
+
"focus-visible": "fv",
|
|
623
|
+
first: "fi",
|
|
624
|
+
last: "la",
|
|
625
|
+
dark: "dk"
|
|
626
|
+
};
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region src/minify/generate-map.ts
|
|
629
|
+
function Y(e, t = 0) {
|
|
630
|
+
let n = e.split(/[-.]/);
|
|
631
|
+
return n.map((e, r) => {
|
|
632
|
+
let i = r === n.length - 1 ? 1 + t : 1;
|
|
633
|
+
return e.slice(0, i);
|
|
634
|
+
}).join("");
|
|
635
|
+
}
|
|
636
|
+
function ke(e, t = 0) {
|
|
637
|
+
if (e.length <= 2) return e;
|
|
638
|
+
if (e.startsWith("[")) {
|
|
639
|
+
let t = `[${m(e.slice(1, -1))}]`;
|
|
640
|
+
return t.length < e.length ? t : e;
|
|
641
|
+
}
|
|
642
|
+
if (e.startsWith("#")) {
|
|
643
|
+
let t = `[${m(e)}]`;
|
|
644
|
+
return t.length < e.length ? t : e;
|
|
645
|
+
}
|
|
646
|
+
return e.includes("-") || e.includes(".") ? Y(e, t) : e.slice(0, 1 + t);
|
|
647
|
+
}
|
|
648
|
+
function X(e, t, n) {
|
|
649
|
+
let r = [...e].sort(), i = {}, a = /* @__PURE__ */ new Set();
|
|
650
|
+
if (n) for (let e of r) {
|
|
651
|
+
let t = n[e];
|
|
652
|
+
t && (i[e] = t, a.add(t));
|
|
653
|
+
}
|
|
654
|
+
for (let e of r) {
|
|
655
|
+
if (i[e]) continue;
|
|
656
|
+
let n = 0, r = t(e, n);
|
|
657
|
+
if (r !== e) {
|
|
658
|
+
for (; a.has(r);) {
|
|
659
|
+
n++;
|
|
660
|
+
let i = t(e, n);
|
|
661
|
+
if (i === r || i.length >= e.length) break;
|
|
662
|
+
r = i;
|
|
663
|
+
}
|
|
664
|
+
!a.has(r) && r !== e && (i[e] = r, a.add(r));
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return i;
|
|
668
|
+
}
|
|
669
|
+
function Z(e, t) {
|
|
670
|
+
let n = e.utilities.map((e) => e.name), r = e.modifiers.flatMap((e) => e.key), i = /* @__PURE__ */ new Set();
|
|
671
|
+
for (let t of e.utilities) for (let e of t.values) i.add(e.key);
|
|
672
|
+
let a = t?.properties ?? q, o = t?.modifiers ?? J, s = t?.values;
|
|
673
|
+
return {
|
|
674
|
+
p: X(n, Y, a),
|
|
675
|
+
v: X([...i], ke, s),
|
|
676
|
+
m: X(r, Y, o)
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region src/minify/shorten.ts
|
|
681
|
+
function Q(e, t) {
|
|
682
|
+
return {
|
|
683
|
+
name: t.p[e.name] ?? e.name,
|
|
684
|
+
value: e.value === "default" ? e.value : t.v[e.value] ?? e.value,
|
|
685
|
+
modifiers: e.modifiers.map((e) => t.m[e] ?? e)
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
function Ae(e, t, n = h) {
|
|
689
|
+
let r = {}, i = (e) => {
|
|
690
|
+
for (let i of e) {
|
|
691
|
+
if (i.type !== "utility") continue;
|
|
692
|
+
let e = {
|
|
693
|
+
name: i.name,
|
|
694
|
+
value: i.value,
|
|
695
|
+
modifiers: i.modifiers
|
|
696
|
+
}, a = n(e), o = n(Q(e, t));
|
|
697
|
+
a !== o && (r[a] = o);
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
i(e.children);
|
|
701
|
+
for (let t of e.themes) i(t.children);
|
|
702
|
+
return r;
|
|
703
|
+
}
|
|
704
|
+
//#endregion
|
|
705
|
+
//#region ../../node_modules/.pnpm/@styleframe+license@2.0.2/node_modules/@styleframe/license/dist/license.js
|
|
706
|
+
var je = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4\nqSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n\nBiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA\ndQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj\nhC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn\n4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+\nGwIDAQAB\n-----END PUBLIC KEY-----", Me = "__licenseRequired", Ne = "__licenseValidated";
|
|
707
|
+
async function Pe(e) {
|
|
708
|
+
let t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), n = Uint8Array.from(atob(t), (e) => e.charCodeAt(0));
|
|
709
|
+
return await crypto.subtle.importKey("spki", n, {
|
|
710
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
711
|
+
hash: "SHA-256"
|
|
712
|
+
}, !0, ["verify"]);
|
|
713
|
+
}
|
|
714
|
+
async function Fe({ payload: e, signature: t }) {
|
|
715
|
+
let n = new TextEncoder().encode(e), r = Uint8Array.from(atob(t), (e) => e.charCodeAt(0)), i = await Pe(je);
|
|
716
|
+
if (!await crypto.subtle.verify({ name: "RSASSA-PKCS1-v1_5" }, i, r, n)) throw Error("License validation failed: Invalid signature detected. The license may have been modified or corrupted.");
|
|
717
|
+
return JSON.parse(e);
|
|
645
718
|
}
|
|
719
|
+
function Ie(e) {
|
|
720
|
+
return Object.prototype.hasOwnProperty.call(e, Me);
|
|
721
|
+
}
|
|
722
|
+
async function Le(e) {
|
|
723
|
+
let t = Object.getOwnPropertyDescriptor(e, Ne);
|
|
724
|
+
if (!t?.value) return {
|
|
725
|
+
key: "",
|
|
726
|
+
instanceId: "",
|
|
727
|
+
environment: "",
|
|
728
|
+
valid: !1
|
|
729
|
+
};
|
|
730
|
+
let n = t.value;
|
|
731
|
+
if (typeof n != "object" || !n || !("payload" in n) || !("signature" in n) || typeof n.payload != "string" || typeof n.signature != "string") return {
|
|
732
|
+
key: "",
|
|
733
|
+
instanceId: "",
|
|
734
|
+
environment: "",
|
|
735
|
+
valid: !1
|
|
736
|
+
};
|
|
737
|
+
try {
|
|
738
|
+
return await Fe(n);
|
|
739
|
+
} catch {
|
|
740
|
+
return {
|
|
741
|
+
key: "",
|
|
742
|
+
instanceId: "",
|
|
743
|
+
environment: "",
|
|
744
|
+
valid: !1
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/license.ts
|
|
750
|
+
function Re(e) {
|
|
751
|
+
let t = Math.floor(Math.random() * 100);
|
|
752
|
+
e.root.children.push({
|
|
753
|
+
type: "selector",
|
|
754
|
+
id: b("sel-"),
|
|
755
|
+
query: `html:nth-of-type(${t}n+1)::after`,
|
|
756
|
+
variables: [],
|
|
757
|
+
children: [],
|
|
758
|
+
declarations: {
|
|
759
|
+
content: "\"Styleframe Pro: Development Mode – License required for production use\"",
|
|
760
|
+
zIndex: 99999,
|
|
761
|
+
position: "fixed",
|
|
762
|
+
display: "block !important",
|
|
763
|
+
opacity: "1 !important",
|
|
764
|
+
bottom: 0,
|
|
765
|
+
left: 0,
|
|
766
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
767
|
+
color: "white",
|
|
768
|
+
fontSize: "12px",
|
|
769
|
+
lineHeight: "1",
|
|
770
|
+
padding: "0.5rem",
|
|
771
|
+
fontFamily: "sans-serif"
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
//#endregion
|
|
776
|
+
//#region src/transpile.ts
|
|
646
777
|
function $(e, t = "") {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
async function
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
Y as defaultThemeSelectorFn,
|
|
693
|
-
Q as defaultUtilitySelectorFn,
|
|
694
|
-
w as defaultVariableNameFn,
|
|
695
|
-
ae as indentLines,
|
|
696
|
-
T as isUppercase,
|
|
697
|
-
E as toCamelCase,
|
|
698
|
-
le as toKebabCase,
|
|
699
|
-
Ve as transpile
|
|
700
|
-
};
|
|
778
|
+
return {
|
|
779
|
+
name: e,
|
|
780
|
+
content: t
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
async function ze(e, { type: t = "all", treeshake: n = !1, scanner: r = !1, minify: i = !1, minifyOptions: a, consumers: o = {
|
|
784
|
+
css: B,
|
|
785
|
+
ts: V,
|
|
786
|
+
dts: K
|
|
787
|
+
} } = {}) {
|
|
788
|
+
let s = { files: [] }, c = e.options, l = {
|
|
789
|
+
treeshake: n,
|
|
790
|
+
scanner: r
|
|
791
|
+
};
|
|
792
|
+
if (i && (l.shortMap = Z(e.root, a)), Ie(e)) {
|
|
793
|
+
let t = await Le(e);
|
|
794
|
+
(!t.valid || t.instanceId !== e.id) && Re(e);
|
|
795
|
+
}
|
|
796
|
+
if (t === "all" || t === "css") {
|
|
797
|
+
let t = Be(c, l), n = $("index.css", o.css(e.root, t, l));
|
|
798
|
+
s.files.push(n);
|
|
799
|
+
}
|
|
800
|
+
if (t === "all" || t === "ts") {
|
|
801
|
+
let t = $("index.ts", o.ts(e.root, c, l));
|
|
802
|
+
s.files.push(t);
|
|
803
|
+
}
|
|
804
|
+
if (t === "dts") {
|
|
805
|
+
let t = o.dts(e.root, c);
|
|
806
|
+
s.files.push($(U, t), $(W, Oe(t)));
|
|
807
|
+
}
|
|
808
|
+
return s;
|
|
809
|
+
}
|
|
810
|
+
function Be(e, t) {
|
|
811
|
+
if (!t.shortMap) return e;
|
|
812
|
+
let n = e.utilities?.selector ?? h;
|
|
813
|
+
return {
|
|
814
|
+
...e,
|
|
815
|
+
utilities: {
|
|
816
|
+
...e.utilities,
|
|
817
|
+
selector: (e) => n(Q(e, t.shortMap))
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
//#endregion
|
|
822
|
+
export { e as DEFAULT_INDENT, W as DTS_SHIMS_FILENAME, U as DTS_TYPES_FILENAME, t as STATEMENT_AT_RULES, n as STATEMENT_OR_BLOCK_AT_RULES, w as addIndentToLine, Ae as buildClassNameLookup, B as consumeCSS, V as consumeTS, $ as createFile, J as defaultModifierShortNames, q as defaultPropertyShortNames, x as defaultThemeSelectorFn, h as defaultUtilitySelectorFn, S as defaultVariableNameFn, Z as generateShorteningMap, T as indentLines, E as isUppercase, Q as shortenUtilityOptions, D as toCamelCase, O as toKebabCase, ze as transpile };
|