@tempots/beatui 0.83.5 → 0.86.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/dist/beatui.css +861 -470
- package/dist/beatui.tailwind.css +861 -470
- package/dist/{index-C2_iX1um.cjs → index-4GQLcxme.cjs} +1 -1
- package/dist/{index-DiEcd7ZV.js → index-BFe-x3-z.js} +2 -2
- package/dist/index-BywbRDsb.cjs +1 -0
- package/dist/{index-Bm43lZqE.cjs → index-BzRuy4V1.cjs} +3 -3
- package/dist/{index-Di1_W_7Q.js → index-D2_J_-XS.js} +46 -45
- package/dist/{index-CEqc0H3v.js → index-DfJMDwSU.js} +1 -1
- package/dist/{index-CCMjK4fD.js → index-KNk3k6NI.js} +1 -1
- package/dist/{index-BS31JX7x.cjs → index-anrXec7K.cjs} +1 -1
- package/dist/{index-C32iUFIr.js → index-vzoI95E1.js} +3 -3
- package/dist/{index-BZYWyjM_.cjs → index-yMrXbIdg.cjs} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +2175 -2166
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +183 -196
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +93 -93
- package/dist/lexical/index.cjs.js +2 -2
- package/dist/lexical/index.es.js +5 -5
- package/dist/lexical.css +79 -79
- package/dist/markdown/index.cjs.js +1 -1
- package/dist/markdown/index.es.js +1 -1
- package/dist/menu-De_-sGeb.cjs +1 -0
- package/dist/menu-Ui4lUPHM.js +373 -0
- package/dist/monaco/index.cjs.js +2 -2
- package/dist/monaco/index.es.js +2 -2
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/prosemirror.css +10 -10
- package/dist/styles-url-BSUFsmMD.cjs +1 -0
- package/dist/styles-url-BvcVGpBJ.js +4 -0
- package/dist/styles-url-BzPix7VR.cjs +1 -0
- package/dist/styles-url-CCopc5pG.js +4 -0
- package/dist/styles-url-CEDSZTyZ.cjs +1 -0
- package/dist/styles-url-CSXq0ZRz.js +4 -0
- package/dist/styles-url-DZhZ-9Bf.js +4 -0
- package/dist/styles-url-YAJ6Q1GS.cjs +1 -0
- package/dist/tailwind/preset.cjs.js +1 -1
- package/dist/tailwind/preset.es.js +18 -18
- package/dist/tailwind/vite-plugin.cjs.js +12 -15
- package/dist/tailwind/vite-plugin.es.js +178 -181
- package/dist/{theme-B5pmbvQ_.js → theme-BzpMLdvH.js} +6 -6
- package/dist/theme-DogY9oT1.cjs +1 -0
- package/dist/types/components/form/input/advanced-slider.d.ts +1 -1
- package/dist/types/components/form/input/combobox-input.d.ts +2 -0
- package/dist/types/components/form/input/combobox-tags-input.d.ts +3 -3
- package/dist/types/components/form/input/switch.d.ts +2 -1
- package/dist/types/components/theme/theme.d.ts +5 -4
- package/dist/types/tailwind/preset.d.ts +1 -1
- package/dist/widget-customization-B9Oc1bG4.cjs +1 -0
- package/dist/{widget-customization-0is7oTeP.js → widget-customization-Ct2eqKKR.js} +327 -360
- package/package.json +2 -2
- package/dist/index-DH37GTQj.cjs +0 -1
- package/dist/menu-CX72LaZ3.cjs +0 -1
- package/dist/menu-D_slbwl8.js +0 -374
- package/dist/styles-url-B3p8AqBy.cjs +0 -1
- package/dist/styles-url-COuz9fVH.js +0 -4
- package/dist/styles-url-CVCcF0ra.cjs +0 -1
- package/dist/styles-url-CZUL_YRT.cjs +0 -1
- package/dist/styles-url-CzNVxeM7.js +0 -4
- package/dist/styles-url-D8MjxiP-.cjs +0 -1
- package/dist/styles-url-DUdp56Ts.js +0 -4
- package/dist/styles-url-DpP5gepF.js +0 -4
- package/dist/theme-Dt6lCAvY.cjs +0 -1
- package/dist/widget-customization-B-LmxkPE.cjs +0 -1
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
import S from "node:fs";
|
|
2
2
|
import u from "node:path";
|
|
3
|
-
import { g as
|
|
4
|
-
import { mkdir as
|
|
5
|
-
import { createHash as
|
|
6
|
-
const
|
|
7
|
-
async function
|
|
3
|
+
import { g as z, a as V, b as H, c as J, d as Q } from "../index-D2_J_-XS.js";
|
|
4
|
+
import { mkdir as X, writeFile as k, readFile as K } from "node:fs/promises";
|
|
5
|
+
import { createHash as Y } from "node:crypto";
|
|
6
|
+
const Z = "https://fonts.googleapis.com/css2", x = "normal", q = 400, D = "Mozilla/5.0 (compatible; BeatUI Tailwind Plugin; +https://tempots.com)";
|
|
7
|
+
async function ee(e) {
|
|
8
8
|
const { projectRoot: s, requests: t, logger: r } = e;
|
|
9
9
|
if (!t || t.length === 0)
|
|
10
10
|
return null;
|
|
11
|
-
const a = e.cacheDir ? u.resolve(e.cacheDir) : u.join(s, "node_modules", ".beatui", "google-fonts"), n = [],
|
|
12
|
-
await
|
|
11
|
+
const a = e.cacheDir ? u.resolve(e.cacheDir) : u.join(s, "node_modules", ".beatui", "google-fonts"), n = [], d = /* @__PURE__ */ new Map();
|
|
12
|
+
await X(a, { recursive: !0 }).catch((g) => {
|
|
13
13
|
r?.(`Unable to create BeatUI Google Fonts cache directory: ${g}`);
|
|
14
14
|
});
|
|
15
15
|
for (const g of t)
|
|
16
16
|
try {
|
|
17
|
-
const i =
|
|
17
|
+
const i = M(g), l = await te({
|
|
18
18
|
request: g,
|
|
19
19
|
cssUrl: i,
|
|
20
20
|
cacheRoot: a,
|
|
21
21
|
logger: r
|
|
22
22
|
});
|
|
23
|
-
if (!
|
|
23
|
+
if (!l)
|
|
24
24
|
continue;
|
|
25
|
-
const
|
|
26
|
-
cssText:
|
|
25
|
+
const y = await ie({
|
|
26
|
+
cssText: l,
|
|
27
27
|
cacheRoot: a,
|
|
28
|
-
assetMap:
|
|
28
|
+
assetMap: d,
|
|
29
29
|
logger: r
|
|
30
30
|
});
|
|
31
|
-
n.push(
|
|
31
|
+
n.push(y);
|
|
32
32
|
} catch (i) {
|
|
33
33
|
r?.(
|
|
34
34
|
`Unexpected error while downloading Google Font "${g.family}": ${String(i)}`
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
|
-
return n.length === 0 ||
|
|
37
|
+
return n.length === 0 || d.size === 0 ? null : {
|
|
38
38
|
cssText: n.join(`
|
|
39
39
|
`),
|
|
40
|
-
assets: Array.from(
|
|
40
|
+
assets: Array.from(d.values())
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
async function
|
|
43
|
+
async function te({
|
|
44
44
|
request: e,
|
|
45
45
|
cssUrl: s,
|
|
46
46
|
cacheRoot: t,
|
|
47
47
|
logger: r
|
|
48
48
|
}) {
|
|
49
|
-
const a = u.join(t,
|
|
49
|
+
const a = u.join(t, se(e, s));
|
|
50
50
|
try {
|
|
51
51
|
const n = await fetch(s, {
|
|
52
52
|
headers: {
|
|
53
|
-
"User-Agent":
|
|
53
|
+
"User-Agent": D
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
if (!n.ok)
|
|
57
57
|
throw new Error(
|
|
58
58
|
`Failed to download Google Font CSS: ${n.status} ${n.statusText}`
|
|
59
59
|
);
|
|
60
|
-
const
|
|
61
|
-
return await
|
|
60
|
+
const d = await n.text();
|
|
61
|
+
return await k(a, d), d;
|
|
62
62
|
} catch (n) {
|
|
63
63
|
if (S.existsSync(a))
|
|
64
64
|
try {
|
|
65
|
-
const
|
|
65
|
+
const d = await K(a, "utf8");
|
|
66
66
|
return r?.(
|
|
67
67
|
`Using cached Google Font CSS for ${e.family} because download failed.`
|
|
68
|
-
),
|
|
69
|
-
} catch (
|
|
68
|
+
), d;
|
|
69
|
+
} catch (d) {
|
|
70
70
|
r?.(
|
|
71
|
-
`Failed to read cached Google Font CSS for ${e.family}: ${
|
|
71
|
+
`Failed to read cached Google Font CSS for ${e.family}: ${d}`
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
return r?.(
|
|
@@ -76,42 +76,42 @@ async function se({
|
|
|
76
76
|
), null;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const t =
|
|
79
|
+
function se(e, s) {
|
|
80
|
+
const t = Y("sha1").update(s).digest("hex").slice(0, 10);
|
|
81
81
|
return `${e.family.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-") || "font"}-${t}.css`;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
const { family: s } = e, t = s.trim().replace(/\s+/g, " "), r =
|
|
85
|
-
return n.append("family",
|
|
83
|
+
function M(e) {
|
|
84
|
+
const { family: s } = e, t = s.trim().replace(/\s+/g, " "), r = ne(e.weights), a = re(e.styles), n = new URLSearchParams();
|
|
85
|
+
return n.append("family", ae(t, r, a)), e.display && n.append("display", e.display), e.subsets && e.subsets.length > 0 && n.append("subset", e.subsets.join(",")), e.text && n.append("text", e.text), `${Z}?${n.toString()}`;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function ne(e) {
|
|
88
88
|
return !e || e.length === 0 ? [] : Array.from(new Set(e)).sort((s, t) => s - t);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function re(e) {
|
|
91
91
|
if (!e || e.length === 0)
|
|
92
|
-
return [
|
|
92
|
+
return [x];
|
|
93
93
|
const s = Array.from(new Set(e)), t = s.includes("italic"), r = s.includes("normal");
|
|
94
|
-
return !t && !r && s.push(
|
|
94
|
+
return !t && !r && s.push(x), s.sort((a, n) => a === n ? 0 : a === "normal" ? -1 : 1);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function ae(e, s, t) {
|
|
97
97
|
if (s.length === 0 && t.every((i) => i === "normal"))
|
|
98
98
|
return e;
|
|
99
|
-
const r = t.includes("italic"), a = t.includes("normal"), n = s.length > 0 ? s : [
|
|
99
|
+
const r = t.includes("italic"), a = t.includes("normal"), n = s.length > 0 ? s : [q];
|
|
100
100
|
if (!r)
|
|
101
101
|
return `${e}:wght@${n.join(";")}`;
|
|
102
|
-
const
|
|
102
|
+
const d = /* @__PURE__ */ new Set();
|
|
103
103
|
a && n.forEach((i) => {
|
|
104
|
-
|
|
104
|
+
d.add(`0,${i}`);
|
|
105
105
|
}), n.forEach((i) => {
|
|
106
|
-
|
|
106
|
+
d.add(`1,${i}`);
|
|
107
107
|
});
|
|
108
|
-
const g = Array.from(
|
|
109
|
-
const [
|
|
110
|
-
return
|
|
108
|
+
const g = Array.from(d).sort((i, l) => {
|
|
109
|
+
const [y, F] = i.split(",").map(Number), [T, v] = l.split(",").map(Number);
|
|
110
|
+
return y - T || F - v;
|
|
111
111
|
});
|
|
112
112
|
return `${e}:ital,wght@${g.join(";")}`;
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const oe = /url\(([^)]+)\)/g;
|
|
115
115
|
async function ie({
|
|
116
116
|
cssText: e,
|
|
117
117
|
cacheRoot: s,
|
|
@@ -120,61 +120,61 @@ async function ie({
|
|
|
120
120
|
}) {
|
|
121
121
|
let a = e;
|
|
122
122
|
const n = /* @__PURE__ */ new Set();
|
|
123
|
-
let
|
|
124
|
-
for (; (
|
|
125
|
-
const i =
|
|
123
|
+
let d;
|
|
124
|
+
for (; (d = oe.exec(e)) !== null; ) {
|
|
125
|
+
const i = d[1].trim().replace(/^['"]|['"]$/g, "");
|
|
126
126
|
i.startsWith("http") && n.add(i);
|
|
127
127
|
}
|
|
128
128
|
for (const g of n) {
|
|
129
|
-
const i = await
|
|
129
|
+
const i = await le(g, s, t, r);
|
|
130
130
|
if (!i)
|
|
131
131
|
continue;
|
|
132
|
-
const
|
|
133
|
-
a = a.replace(
|
|
132
|
+
const l = g.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"), y = new RegExp(`url\\((['"])${l}\\1\\)`, "g"), F = new RegExp(`url\\(${l}\\)`, "g");
|
|
133
|
+
a = a.replace(y, `url(${i.placeholder})`), a = a.replace(F, `url(${i.placeholder})`);
|
|
134
134
|
}
|
|
135
135
|
return a;
|
|
136
136
|
}
|
|
137
|
-
async function
|
|
137
|
+
async function le(e, s, t, r) {
|
|
138
138
|
const a = t.get(e);
|
|
139
139
|
if (a)
|
|
140
140
|
return a;
|
|
141
141
|
let n;
|
|
142
142
|
try {
|
|
143
|
-
const
|
|
144
|
-
n = u.basename(
|
|
145
|
-
} catch (
|
|
146
|
-
return r?.(`Invalid Google Font URL skipped: ${e} (${
|
|
143
|
+
const l = new URL(e);
|
|
144
|
+
n = u.basename(l.pathname);
|
|
145
|
+
} catch (l) {
|
|
146
|
+
return r?.(`Invalid Google Font URL skipped: ${e} (${l})`), null;
|
|
147
147
|
}
|
|
148
148
|
if (!n)
|
|
149
149
|
return r?.(`Unable to derive file name for Google Font URL: ${e}`), null;
|
|
150
|
-
const
|
|
151
|
-
if (!S.existsSync(
|
|
150
|
+
const d = u.join(s, n), g = `__BEATUI_GOOGLE_FONT_${t.size}__`;
|
|
151
|
+
if (!S.existsSync(d))
|
|
152
152
|
try {
|
|
153
|
-
const
|
|
153
|
+
const l = await fetch(e, {
|
|
154
154
|
headers: {
|
|
155
|
-
"User-Agent":
|
|
155
|
+
"User-Agent": D
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
|
-
if (!
|
|
158
|
+
if (!l.ok)
|
|
159
159
|
return r?.(
|
|
160
|
-
`Failed to download Google Font asset ${n}: ${
|
|
160
|
+
`Failed to download Google Font asset ${n}: ${l.status} ${l.statusText}`
|
|
161
161
|
), null;
|
|
162
|
-
const
|
|
163
|
-
await
|
|
164
|
-
} catch (
|
|
162
|
+
const y = Buffer.from(await l.arrayBuffer());
|
|
163
|
+
await k(d, y);
|
|
164
|
+
} catch (l) {
|
|
165
165
|
return r?.(
|
|
166
|
-
`Unexpected error while downloading Google Font asset ${n}: ${String(
|
|
166
|
+
`Unexpected error while downloading Google Font asset ${n}: ${String(l)}`
|
|
167
167
|
), null;
|
|
168
168
|
}
|
|
169
169
|
const i = {
|
|
170
170
|
url: e,
|
|
171
171
|
fileName: n,
|
|
172
|
-
localPath:
|
|
172
|
+
localPath: d,
|
|
173
173
|
placeholder: g
|
|
174
174
|
};
|
|
175
175
|
return t.set(e, i), i;
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function B(e) {
|
|
178
178
|
const s = typeof e == "string" ? new URL(e) : e;
|
|
179
179
|
if (s.protocol !== "file:")
|
|
180
180
|
throw new TypeError(`Expected file URL, received: ${s.href}`);
|
|
@@ -185,7 +185,7 @@ function W(e) {
|
|
|
185
185
|
}
|
|
186
186
|
return !r && t ? `//${t}${a}` : a;
|
|
187
187
|
}
|
|
188
|
-
const
|
|
188
|
+
const L = "@tempots/beatui/tailwind.css", b = "beatui.tailwind.css", w = u.dirname(B(import.meta.url)), O = ce(w) ?? w;
|
|
189
189
|
function j(e) {
|
|
190
190
|
if (Object.keys(e).length === 0)
|
|
191
191
|
return "";
|
|
@@ -197,7 +197,7 @@ function j(e) {
|
|
|
197
197
|
return s += `}
|
|
198
198
|
`, s;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function ce(e) {
|
|
201
201
|
let s = e;
|
|
202
202
|
const t = u.parse(s).root;
|
|
203
203
|
for (; s && s !== t; ) {
|
|
@@ -212,29 +212,29 @@ function ue(e) {
|
|
|
212
212
|
}
|
|
213
213
|
return null;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function ue(e) {
|
|
216
216
|
if (e == null)
|
|
217
217
|
return null;
|
|
218
218
|
const s = typeof e == "string" ? e : e.id;
|
|
219
219
|
if (!s)
|
|
220
220
|
return null;
|
|
221
221
|
const [t] = s.split("?");
|
|
222
|
-
return t.startsWith("virtual:") || t.startsWith("\0") ? null : t.startsWith("/@fs/") ? decodeURIComponent(t.slice(4)) : t.startsWith("file://") ?
|
|
222
|
+
return t.startsWith("virtual:") || t.startsWith("\0") ? null : t.startsWith("/@fs/") ? decodeURIComponent(t.slice(4)) : t.startsWith("file://") ? B(t) : u.isAbsolute(t) ? t : null;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function de(e) {
|
|
225
225
|
const s = /* @__PURE__ */ new Set([
|
|
226
|
-
u.resolve(
|
|
227
|
-
u.resolve(
|
|
228
|
-
u.resolve(
|
|
229
|
-
u.resolve(
|
|
230
|
-
u.resolve(
|
|
231
|
-
u.resolve(
|
|
232
|
-
u.resolve(
|
|
233
|
-
u.resolve(
|
|
234
|
-
u.resolve(
|
|
235
|
-
u.resolve(
|
|
236
|
-
u.resolve(
|
|
237
|
-
u.resolve(
|
|
226
|
+
u.resolve(w, b),
|
|
227
|
+
u.resolve(w, "../", b),
|
|
228
|
+
u.resolve(w, "../../", b),
|
|
229
|
+
u.resolve(w, "tailwind.css"),
|
|
230
|
+
u.resolve(w, "../tailwind.css"),
|
|
231
|
+
u.resolve(w, "../../tailwind.css"),
|
|
232
|
+
u.resolve(w, "../styles/tailwind.css"),
|
|
233
|
+
u.resolve(w, "../../styles/tailwind.css"),
|
|
234
|
+
u.resolve(O, "dist", b),
|
|
235
|
+
u.resolve(O, b),
|
|
236
|
+
u.resolve(O, "tailwind.css"),
|
|
237
|
+
u.resolve(O, "src/styles/tailwind.css"),
|
|
238
238
|
u.resolve(e, "node_modules/@tempots/beatui/tailwind.css")
|
|
239
239
|
]);
|
|
240
240
|
for (const t of s)
|
|
@@ -242,16 +242,16 @@ function fe(e) {
|
|
|
242
242
|
return t;
|
|
243
243
|
return null;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function fe(e) {
|
|
246
246
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function he(e, s) {
|
|
249
249
|
let t = e;
|
|
250
250
|
for (const [r, a] of s)
|
|
251
251
|
t = t.split(r).join(a);
|
|
252
252
|
return t;
|
|
253
253
|
}
|
|
254
|
-
async function
|
|
254
|
+
async function me(e, s) {
|
|
255
255
|
if (e == null || typeof e != "object")
|
|
256
256
|
return null;
|
|
257
257
|
const t = e.resolve;
|
|
@@ -263,12 +263,12 @@ async function ge(e, s) {
|
|
|
263
263
|
return null;
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function Se(e = {}) {
|
|
267
267
|
let s = process.cwd();
|
|
268
|
-
const t = e.injectCss !== !1, r = e.
|
|
269
|
-
let
|
|
270
|
-
const
|
|
271
|
-
|
|
268
|
+
const t = e.injectCss !== !1, r = e.rtlAttribute ?? "dir", a = e.rtlValue ?? "rtl";
|
|
269
|
+
let n = "/";
|
|
270
|
+
const g = e.semanticColors != null || e.semanticFonts != null || e.semanticRadii != null || e.semanticShadows != null || e.semanticMotion != null || e.semanticSpacing != null || e.semanticTextShadows != null ? j(
|
|
271
|
+
z({
|
|
272
272
|
colors: e.semanticColors,
|
|
273
273
|
fonts: e.semanticFonts,
|
|
274
274
|
radii: e.semanticRadii,
|
|
@@ -277,125 +277,125 @@ function $e(e = {}) {
|
|
|
277
277
|
spacing: e.semanticSpacing,
|
|
278
278
|
textShadows: e.semanticTextShadows
|
|
279
279
|
})
|
|
280
|
-
) : "",
|
|
281
|
-
|
|
282
|
-
) : "",
|
|
283
|
-
e.baseSpacing && (
|
|
284
|
-
const
|
|
285
|
-
let
|
|
286
|
-
const A = /* @__PURE__ */ new Map(),
|
|
287
|
-
let
|
|
280
|
+
) : "", i = e.fontFamilies ? j(
|
|
281
|
+
V(e.fontFamilies)
|
|
282
|
+
) : "", l = {};
|
|
283
|
+
e.baseSpacing && (l[H("base")] = e.baseSpacing), e.baseFontSize && (l[J()] = e.baseFontSize), e.baseMotionDuration && (l[Q("base")] = e.baseMotionDuration);
|
|
284
|
+
const y = j(l), F = fe(e.googleFonts);
|
|
285
|
+
let T = "", v = [];
|
|
286
|
+
const A = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), W = "/@beatui/google-fonts", E = [];
|
|
287
|
+
let G = null, C = null, _ = !1;
|
|
288
288
|
const I = (h) => {
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
const f = [
|
|
290
|
+
y,
|
|
291
|
+
g,
|
|
292
|
+
i
|
|
293
293
|
];
|
|
294
|
-
return
|
|
295
|
-
|
|
296
|
-
) :
|
|
294
|
+
return T && (h === "dev" ? f.push(
|
|
295
|
+
he(T, A)
|
|
296
|
+
) : f.push(T)), f.filter((o) => o && o.length > 0).join(`
|
|
297
297
|
`);
|
|
298
298
|
};
|
|
299
299
|
return {
|
|
300
300
|
name: "beatui-tailwind",
|
|
301
301
|
enforce: "pre",
|
|
302
302
|
async configResolved(h) {
|
|
303
|
-
if (s = h.root, _ = h.command === "build",
|
|
304
|
-
const
|
|
303
|
+
if (s = h.root, _ = h.command === "build", n = h.base && h.base !== "/" ? h.base.endsWith("/") ? h.base : `${h.base}/` : "/", t) {
|
|
304
|
+
const o = await me(
|
|
305
305
|
this,
|
|
306
|
-
|
|
306
|
+
L
|
|
307
307
|
);
|
|
308
|
-
|
|
308
|
+
C = ue(o) ?? de(s);
|
|
309
309
|
}
|
|
310
|
-
const
|
|
311
|
-
this && typeof this.warn == "function" ? this.warn(
|
|
310
|
+
const f = (o) => {
|
|
311
|
+
this && typeof this.warn == "function" ? this.warn(o) : h.logger.warn(o);
|
|
312
312
|
};
|
|
313
|
-
if (
|
|
314
|
-
const
|
|
313
|
+
if (F.length > 0) {
|
|
314
|
+
const o = Array.from(
|
|
315
315
|
// eslint-disable-next-line tempots/require-async-signal-disposal -- This is an array, not a Signal
|
|
316
|
-
new Set(
|
|
317
|
-
), c = await
|
|
316
|
+
new Set(F.map(M))
|
|
317
|
+
), c = await ee({
|
|
318
318
|
projectRoot: s,
|
|
319
|
-
requests:
|
|
320
|
-
logger: (m) =>
|
|
319
|
+
requests: F,
|
|
320
|
+
logger: (m) => f(`[BeatUI] ${m}`)
|
|
321
321
|
});
|
|
322
|
-
if (
|
|
323
|
-
for (const m of
|
|
324
|
-
const
|
|
325
|
-
A.set(m.placeholder,
|
|
322
|
+
if (T = c?.cssText ?? "", v = c?.assets ?? [], A.clear(), R.clear(), P.clear(), E.length = 0, v.length > 0)
|
|
323
|
+
for (const m of v) {
|
|
324
|
+
const p = `${W}/${m.fileName}`;
|
|
325
|
+
A.set(m.placeholder, p), P.set(p, m.localPath);
|
|
326
326
|
}
|
|
327
327
|
else
|
|
328
|
-
|
|
328
|
+
E.push(...o);
|
|
329
329
|
} else
|
|
330
|
-
|
|
331
|
-
t && !
|
|
330
|
+
E.length = 0;
|
|
331
|
+
t && !C && f(
|
|
332
332
|
"[BeatUI] Unable to resolve @tempots/beatui/tailwind.css. CSS will not be auto-injected."
|
|
333
333
|
);
|
|
334
334
|
},
|
|
335
335
|
configureServer(h) {
|
|
336
|
-
!t ||
|
|
337
|
-
const m =
|
|
336
|
+
!t || C == null || (h.middlewares.use((f, o, c) => {
|
|
337
|
+
const m = f.method ?? "GET";
|
|
338
338
|
if (!["GET", "HEAD"].includes(m)) {
|
|
339
339
|
c();
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
|
-
const
|
|
342
|
+
const p = (f.url ?? "").split("?")[0];
|
|
343
343
|
if (!new Set(
|
|
344
344
|
[
|
|
345
|
-
`/${
|
|
346
|
-
|
|
345
|
+
`/${b}`,
|
|
346
|
+
n === "/" ? null : `${n}${b}`
|
|
347
347
|
].filter(($) => !!$)
|
|
348
|
-
).has(
|
|
348
|
+
).has(p)) {
|
|
349
349
|
c();
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
352
|
-
|
|
352
|
+
o.setHeader("Content-Type", "text/css");
|
|
353
353
|
try {
|
|
354
|
-
let $ = S.readFileSync(
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
${
|
|
354
|
+
let $ = S.readFileSync(C, "utf8");
|
|
355
|
+
const N = I("dev");
|
|
356
|
+
N && ($ += `
|
|
357
|
+
${N}`), o.end($);
|
|
358
358
|
} catch ($) {
|
|
359
359
|
h.config.logger.error(
|
|
360
|
-
`[BeatUI] Failed to stream ${
|
|
361
|
-
),
|
|
360
|
+
`[BeatUI] Failed to stream ${L}: ${String($)}`
|
|
361
|
+
), o.statusCode = 500, o.end();
|
|
362
362
|
}
|
|
363
|
-
}),
|
|
364
|
-
const m =
|
|
363
|
+
}), P.size > 0 && h.middlewares.use((f, o, c) => {
|
|
364
|
+
const m = f.method ?? "GET";
|
|
365
365
|
if (!["GET", "HEAD"].includes(m)) {
|
|
366
366
|
c();
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
|
-
const
|
|
370
|
-
if (!
|
|
369
|
+
const p = (f.url ?? "").split("?")[0], U = p ? P.get(p) : void 0;
|
|
370
|
+
if (!U) {
|
|
371
371
|
c();
|
|
372
372
|
return;
|
|
373
373
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}).pipe(
|
|
374
|
+
o.setHeader("Content-Type", "font/woff2"), S.createReadStream(U).on("error", () => {
|
|
375
|
+
o.statusCode = 500, o.end();
|
|
376
|
+
}).pipe(o);
|
|
377
377
|
}));
|
|
378
378
|
},
|
|
379
379
|
buildStart() {
|
|
380
|
-
if (!_ || !t ||
|
|
381
|
-
|
|
382
|
-
const h =
|
|
383
|
-
let
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
386
|
-
${
|
|
380
|
+
if (!_ || !t || C == null) return;
|
|
381
|
+
R.clear(), G = null;
|
|
382
|
+
const h = C;
|
|
383
|
+
let f = S.readFileSync(h, "utf8");
|
|
384
|
+
const o = I("raw");
|
|
385
|
+
if (o && (f += `
|
|
386
|
+
${o}`), G = this.emitFile({
|
|
387
387
|
type: "asset",
|
|
388
|
-
fileName:
|
|
389
|
-
source:
|
|
390
|
-
}),
|
|
391
|
-
for (const c of
|
|
388
|
+
fileName: b,
|
|
389
|
+
source: f
|
|
390
|
+
}), v.length > 0)
|
|
391
|
+
for (const c of v)
|
|
392
392
|
try {
|
|
393
|
-
const m = S.readFileSync(c.localPath),
|
|
393
|
+
const m = S.readFileSync(c.localPath), p = this.emitFile({
|
|
394
394
|
type: "asset",
|
|
395
395
|
name: `assets/${c.fileName}`,
|
|
396
396
|
source: m
|
|
397
397
|
});
|
|
398
|
-
|
|
398
|
+
R.set(c.placeholder, p);
|
|
399
399
|
} catch (m) {
|
|
400
400
|
this.warn(
|
|
401
401
|
`[BeatUI] Failed to include Google Font asset ${c.fileName}: ${String(
|
|
@@ -404,24 +404,24 @@ ${l}`), O = this.emitFile({
|
|
|
404
404
|
);
|
|
405
405
|
}
|
|
406
406
|
},
|
|
407
|
-
generateBundle(h,
|
|
408
|
-
if (!_ || !
|
|
407
|
+
generateBundle(h, f) {
|
|
408
|
+
if (!_ || !G)
|
|
409
409
|
return;
|
|
410
|
-
const
|
|
410
|
+
const o = this.getFileName(G), c = f[o];
|
|
411
411
|
if (!c || c.type !== "asset" || typeof c.source != "string")
|
|
412
412
|
return;
|
|
413
413
|
let m = c.source;
|
|
414
|
-
for (const [
|
|
415
|
-
const $ = this.getFileName(
|
|
416
|
-
m = m.split(
|
|
414
|
+
for (const [p, U] of R) {
|
|
415
|
+
const $ = this.getFileName(U);
|
|
416
|
+
m = m.split(p).join($);
|
|
417
417
|
}
|
|
418
418
|
c.source = m;
|
|
419
419
|
},
|
|
420
420
|
transformIndexHtml(h) {
|
|
421
|
-
const
|
|
422
|
-
if (t &&
|
|
423
|
-
const c =
|
|
424
|
-
|
|
421
|
+
const f = [];
|
|
422
|
+
if (t && C) {
|
|
423
|
+
const c = n === "/" ? `/${b}` : `${n}${b}`;
|
|
424
|
+
f.push({
|
|
425
425
|
tag: "link",
|
|
426
426
|
attrs: {
|
|
427
427
|
rel: "stylesheet",
|
|
@@ -430,7 +430,7 @@ ${l}`), O = this.emitFile({
|
|
|
430
430
|
injectTo: "head-prepend"
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
|
-
|
|
433
|
+
E.length > 0 && f.push(
|
|
434
434
|
{
|
|
435
435
|
tag: "link",
|
|
436
436
|
attrs: {
|
|
@@ -448,7 +448,7 @@ ${l}`), O = this.emitFile({
|
|
|
448
448
|
},
|
|
449
449
|
injectTo: "head"
|
|
450
450
|
},
|
|
451
|
-
...
|
|
451
|
+
...E.map((c) => ({
|
|
452
452
|
tag: "link",
|
|
453
453
|
attrs: {
|
|
454
454
|
rel: "stylesheet",
|
|
@@ -458,17 +458,14 @@ ${l}`), O = this.emitFile({
|
|
|
458
458
|
injectTo: "head"
|
|
459
459
|
}))
|
|
460
460
|
);
|
|
461
|
-
const
|
|
461
|
+
const o = `
|
|
462
462
|
(() => {
|
|
463
463
|
const apply = () => {
|
|
464
464
|
const root = document.documentElement
|
|
465
465
|
const target = document.body
|
|
466
466
|
if (!target) return
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
target.classList.toggle('b-light', !hasDark)
|
|
470
|
-
const dirValue = root.getAttribute('${a.replace(/'/g, "\\'")}')
|
|
471
|
-
const isRtl = dirValue === '${n.replace(/'/g, "\\'")}'
|
|
467
|
+
const dirValue = root.getAttribute('${r.replace(/'/g, "\\'")}')
|
|
468
|
+
const isRtl = dirValue === '${a.replace(/'/g, "\\'")}'
|
|
472
469
|
target.classList.toggle('b-rtl', isRtl)
|
|
473
470
|
target.classList.toggle('b-ltr', !isRtl)
|
|
474
471
|
}
|
|
@@ -480,20 +477,20 @@ ${l}`), O = this.emitFile({
|
|
|
480
477
|
const observer = new MutationObserver(apply)
|
|
481
478
|
observer.observe(document.documentElement, {
|
|
482
479
|
attributes: true,
|
|
483
|
-
attributeFilter: ['
|
|
480
|
+
attributeFilter: ['${r.replace(/'/g, "\\'")}'],
|
|
484
481
|
})
|
|
485
482
|
})();
|
|
486
483
|
`;
|
|
487
|
-
return
|
|
484
|
+
return f.push({
|
|
488
485
|
tag: "script",
|
|
489
486
|
attrs: { type: "module" },
|
|
490
|
-
children:
|
|
487
|
+
children: o,
|
|
491
488
|
injectTo: "body"
|
|
492
|
-
}), { html: h, tags:
|
|
489
|
+
}), { html: h, tags: f };
|
|
493
490
|
}
|
|
494
491
|
};
|
|
495
492
|
}
|
|
496
493
|
export {
|
|
497
|
-
|
|
498
|
-
|
|
494
|
+
Se as beatuiTailwindPlugin,
|
|
495
|
+
Se as default
|
|
499
496
|
};
|