@tempots/beatui 1.7.5 → 1.9.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.
Files changed (159) hide show
  1. package/dist/{ar-Wr6gMs-M.cjs → ar-CEzAem0F.cjs} +1 -1
  2. package/dist/{ar-fdUqbCvM.js → ar-CQieaqsq.js} +1 -1
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +1 -1
  5. package/dist/auth-divider-B8yr-E_b.cjs +1 -0
  6. package/dist/{auth-divider-D9KnNeyF.js → auth-divider-Byh5BWLc.js} +91 -88
  7. package/dist/better-auth/index.cjs.js +1 -1
  8. package/dist/better-auth/index.es.js +27 -26
  9. package/dist/card-BkA7Wvbh.cjs +1 -0
  10. package/dist/card-DX1DwGbL.js +62 -0
  11. package/dist/{colors-C2sgnzFH.js → colors-CyMhfbJi.js} +64 -58
  12. package/dist/{colors-DPCHjRMj.cjs → colors-IXZF9U-s.cjs} +1 -1
  13. package/dist/control-hqEuMzyI.js +343 -0
  14. package/dist/control-muup9GF1.cjs +1 -0
  15. package/dist/custom-validation-BA9iJWl_.cjs +1 -0
  16. package/dist/custom-validation-BOBoUwHY.js +181 -0
  17. package/dist/{de-C5-k5Eov.js → de-CBIwvkAH.js} +1 -1
  18. package/dist/{de-DZqdSEta.cjs → de-DdfxrlT3.cjs} +1 -1
  19. package/dist/deep-merge-8fwp1z4X.js +1346 -0
  20. package/dist/deep-merge-VDGE_HQD.cjs +1 -0
  21. package/dist/duration-input-DmsljXl3.cjs +1 -0
  22. package/dist/{duration-input-D4V_PHIg.js → duration-input-ZQlcqdXU.js} +32 -31
  23. package/dist/{editor-toolbar-group-FpOHrmtx.js → editor-toolbar-group-BNTBMJCe.js} +2 -2
  24. package/dist/{editor-toolbar-group-C_ft_T8D.cjs → editor-toolbar-group-DiMzqYgz.cjs} +1 -1
  25. package/dist/{es-h6jmoF4X.js → es--9HaEj2D.js} +1 -1
  26. package/dist/{es-CJgYfRap.cjs → es-DSdljxFJ.cjs} +1 -1
  27. package/dist/{fa-BuxK837l.js → fa-1Z-akcW7.js} +1 -1
  28. package/dist/{fa-BQ5PzwNY.cjs → fa-BolmeWRT.cjs} +1 -1
  29. package/dist/flyout-CuKFh_T7.js +151 -0
  30. package/dist/flyout-DC_tKaTG.cjs +1 -0
  31. package/dist/{fr-Bv3TG44U.cjs → fr-CODgUuoZ.cjs} +1 -1
  32. package/dist/{fr-BwILQ9G2.js → fr-DhHM9rou.js} +1 -1
  33. package/dist/{he-yC9Sc7JD.js → he-CBamXbGJ.js} +1 -1
  34. package/dist/{he-5LbvgMCC.cjs → he-Juw-dr28.cjs} +1 -1
  35. package/dist/{hi-Da7rcCpP.js → hi-DvvcX-Ra.js} +1 -1
  36. package/dist/{hi-YWhWcG_L.cjs → hi-R749jeg-.cjs} +1 -1
  37. package/dist/{index-CvU9E9wd.js → index-BfQaT5Jy.js} +104 -104
  38. package/dist/{index-XogEKwdt.cjs → index-Dv7nPuwA.cjs} +1 -1
  39. package/dist/index.cjs.js +4 -4
  40. package/dist/index.es.js +6713 -9831
  41. package/dist/{input-container-CyOgiiQD.cjs → input-container-BaWQLWB6.cjs} +1 -1
  42. package/dist/{input-container-8JFB11xN.js → input-container-DCS5oJ4S.js} +4 -4
  43. package/dist/{it-BxOIJE45.cjs → it-DT5oRZDH.cjs} +1 -1
  44. package/dist/{it-Yeklau78.js → it-aV6i8Qxz.js} +1 -1
  45. package/dist/{ja-Dxj9Q5Yd.js → ja-CuLhGnJX.js} +1 -1
  46. package/dist/{ja-CNhjK06P.cjs → ja-CwKaCYLB.cjs} +1 -1
  47. package/dist/json-schema/index.cjs.js +1 -1
  48. package/dist/json-schema/index.es.js +83 -79
  49. package/dist/json-schema-display/index.cjs.js +1 -1
  50. package/dist/json-schema-display/index.es.js +2 -2
  51. package/dist/json-structure/index.cjs.js +1 -1
  52. package/dist/json-structure/index.es.js +74 -72
  53. package/dist/{ko-DgkqcXTs.cjs → ko-Bucro9ID.cjs} +1 -1
  54. package/dist/{ko-gn_MsegK.js → ko-D-66BsEX.js} +1 -1
  55. package/dist/lexical/index.cjs.js +1 -1
  56. package/dist/lexical/index.es.js +5 -5
  57. package/dist/menu-BFLFKceF.cjs +1 -0
  58. package/dist/menu-BO6zqyfq.js +220 -0
  59. package/dist/modal-6Mq3vS5r.js +309 -0
  60. package/dist/modal-d77-TMc4.cjs +1 -0
  61. package/dist/{nl-vHNFtXXb.js → nl-CAny6wvm.js} +1 -1
  62. package/dist/{nl-Dy9lmbBO.cjs → nl-D7vHpehb.cjs} +1 -1
  63. package/dist/notice-BNGx86Yg.js +110 -0
  64. package/dist/notice-iF6zBMq9.cjs +1 -0
  65. package/dist/{oneof-branch-detection-Q_jxvJIA.js → oneof-branch-detection-Bm17RhC2.js} +27 -26
  66. package/dist/oneof-branch-detection-DZ4MrfBp.cjs +1 -0
  67. package/dist/openui/index.cjs.js +9 -0
  68. package/dist/openui/index.es.js +2174 -0
  69. package/dist/password-input-Bipt7Wsu.cjs +1 -0
  70. package/dist/password-input-mkRmrEPq.js +105 -0
  71. package/dist/{pl-BtYbtsmG.cjs → pl-CSiXoOKT.cjs} +1 -1
  72. package/dist/{pl-C0UdHla0.js → pl-rmZLgQ_V.js} +1 -1
  73. package/dist/prosemirror/index.cjs.js +1 -1
  74. package/dist/prosemirror/index.es.js +4 -4
  75. package/dist/{pt-CtNmqQ1X.cjs → pt-CJT-iq4y.cjs} +1 -1
  76. package/dist/{pt-DGKtfN0d.js → pt-DHnajqAi.js} +1 -1
  77. package/dist/{ru-CpXYLt-v.js → ru-C_E8OZNE.js} +1 -1
  78. package/dist/{ru-BaL_NPRU.cjs → ru-G3sr_ctV.cjs} +1 -1
  79. package/dist/slider-input-SLguFA0d.cjs +1 -0
  80. package/dist/slider-input-VYAMm7pE.js +285 -0
  81. package/dist/stepper-24p16Zsv.cjs +1 -0
  82. package/dist/stepper-TlzbfYWa.js +3222 -0
  83. package/dist/tailwind/preset.cjs.js +1 -1
  84. package/dist/tailwind/preset.es.js +38 -40
  85. package/dist/tailwind/vite-plugin.cjs.js +14 -12
  86. package/dist/tailwind/vite-plugin.es.js +317 -246
  87. package/dist/text-area-BdemKQ_w.cjs +1 -0
  88. package/dist/text-area-Br83-_PQ.js +431 -0
  89. package/dist/{text-input-NJypZSnE.js → text-input-ByuxdX8w.js} +5 -5
  90. package/dist/{text-input-DS5zlXb2.cjs → text-input-MjlUC_9u.cjs} +1 -1
  91. package/dist/{toolbar-BF2L6WKC.js → toolbar-CEBTTjHh.js} +1 -1
  92. package/dist/{toolbar-BBwfe8U9.cjs → toolbar-DWawYFFX.cjs} +1 -1
  93. package/dist/{tr-DwOd87oB.cjs → tr-DcxLHHTC.cjs} +1 -1
  94. package/dist/{tr-DIFZDFW_.js → tr-bVXwloKC.js} +1 -1
  95. package/dist/{translations-EwEmHe3v.cjs → translations-D3xqZUTA.cjs} +1 -1
  96. package/dist/{translations-BCMP-h52.js → translations-DU9wTV1y.js} +20 -19
  97. package/dist/{translations-5cXBrENb.js → translations-RT_UN8ny.js} +1 -1
  98. package/dist/{translations-BqWc0ZHz.cjs → translations-qljG2Chq.cjs} +1 -1
  99. package/dist/types/components/navigation/stepper.d.ts +4 -4
  100. package/dist/types/openui/index.d.ts +28 -0
  101. package/dist/types/openui/library/define-component.d.ts +15 -0
  102. package/dist/types/openui/library/library.d.ts +7 -0
  103. package/dist/types/openui/library/prompt-generator.d.ts +5 -0
  104. package/dist/types/openui/library/types.d.ts +33 -0
  105. package/dist/types/openui/parser/parser.d.ts +8 -0
  106. package/dist/types/openui/parser/streaming-parser.d.ts +14 -0
  107. package/dist/types/openui/parser/tokenizer.d.ts +9 -0
  108. package/dist/types/openui/parser/types.d.ts +46 -0
  109. package/dist/types/openui/registry/button.d.ts +148 -0
  110. package/dist/types/openui/registry/data.d.ts +177 -0
  111. package/dist/types/openui/registry/form.d.ts +65 -0
  112. package/dist/types/openui/registry/format.d.ts +67 -0
  113. package/dist/types/openui/registry/index.d.ts +9 -0
  114. package/dist/types/openui/registry/layout.d.ts +45 -0
  115. package/dist/types/openui/registry/navigation.d.ts +149 -0
  116. package/dist/types/openui/registry/overlay.d.ts +56 -0
  117. package/dist/types/openui/registry/typography.d.ts +17 -0
  118. package/dist/types/openui/renderer/action-context.d.ts +24 -0
  119. package/dist/types/openui/renderer/node-resolver.d.ts +9 -0
  120. package/dist/types/openui/renderer/openui-renderer.d.ts +32 -0
  121. package/dist/types/openui/renderer/skeleton.d.ts +2 -0
  122. package/dist/types/openui/streaming/from-fetch.d.ts +7 -0
  123. package/dist/types/openui/streaming/from-sse.d.ts +7 -0
  124. package/dist/types/openui/streaming/from-websocket.d.ts +10 -0
  125. package/dist/types/openui/streaming/types.d.ts +5 -0
  126. package/dist/types/tailwind/preset.d.ts +25 -4
  127. package/dist/types/tailwind/vite-plugin.d.ts +17 -5
  128. package/dist/types/tokens/colors.d.ts +87 -9
  129. package/dist/types/tokens/index.d.ts +7 -6
  130. package/dist/{ur-DBst-TXc.js → ur-Dls2qb4V.js} +1 -1
  131. package/dist/{ur-D9nLchps.cjs → ur-IRQoHh1E.cjs} +1 -1
  132. package/dist/use-form-BZ8vDYOv.cjs +2 -0
  133. package/dist/use-form-DsCzINfm.js +750 -0
  134. package/dist/utils-D3-NApSw.cjs +1 -0
  135. package/dist/utils-Nbh7yQ73.js +105 -0
  136. package/dist/{vi-Dg1aiMr5.cjs → vi-Bi9SvVCP.cjs} +1 -1
  137. package/dist/{vi-DQOJp32U.js → vi-C3mTzj50.js} +1 -1
  138. package/dist/widget-customization-BV6XB2v_.cjs +1 -0
  139. package/dist/widget-customization-Bso45ONQ.js +1198 -0
  140. package/dist/{zh-DPK4HXl2.js → zh-B4JRJBt2.js} +1 -1
  141. package/dist/{zh-tbwSTbmn.cjs → zh-BMU5rYu1.cjs} +1 -1
  142. package/package.json +31 -20
  143. package/dist/auth-divider-CjcrgXmq.cjs +0 -1
  144. package/dist/custom-validation-7por5nJN.js +0 -488
  145. package/dist/custom-validation-CLscGHY4.cjs +0 -1
  146. package/dist/deep-merge-D90SW1Ci.cjs +0 -1
  147. package/dist/deep-merge-DT2H9AGq.js +0 -1765
  148. package/dist/duration-input-4AQnQpyo.cjs +0 -1
  149. package/dist/menu-B60Q9j3-.cjs +0 -1
  150. package/dist/menu-BkqFGcXg.js +0 -366
  151. package/dist/notice-CQGJyZ8o.js +0 -211
  152. package/dist/notice-p2IqXS5-.cjs +0 -1
  153. package/dist/oneof-branch-detection-xDDDdYRk.cjs +0 -1
  154. package/dist/use-form-8NnZ-KHk.js +0 -1090
  155. package/dist/use-form-Dcra7GeE.cjs +0 -2
  156. package/dist/utils-DmEuG3Np.cjs +0 -1
  157. package/dist/utils-vUtP6iPG.js +0 -165
  158. package/dist/widget-customization-BIBva3f-.js +0 -1458
  159. package/dist/widget-customization-pqmtsraC.cjs +0 -1
@@ -1,257 +1,258 @@
1
- import S from "node:fs";
2
- import u from "node:path";
3
- import { a as z, b as V, c as H, d as J, e as Q } from "../index-CvU9E9wd.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
- const { projectRoot: s, requests: t, logger: r } = e;
1
+ import p from "node:fs";
2
+ import f from "node:path";
3
+ import { b as Q, c as X, a as K } from "../index-BfQaT5Jy.js";
4
+ import { a as Y, c as M } from "../colors-CyMhfbJi.js";
5
+ import { mkdir as Z, writeFile as W, readFile as q } from "node:fs/promises";
6
+ import { createHash as ee } from "node:crypto";
7
+ const te = "https://fonts.googleapis.com/css2", k = "normal", se = 400, z = "Mozilla/5.0 (compatible; BeatUI Tailwind Plugin; +https://tempots.com)";
8
+ async function ne(e) {
9
+ const { projectRoot: s, requests: t, logger: o } = e;
9
10
  if (!t || t.length === 0)
10
11
  return null;
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
- r?.(`Unable to create BeatUI Google Fonts cache directory: ${g}`);
12
+ const r = e.cacheDir ? f.resolve(e.cacheDir) : f.join(s, "node_modules", ".beatui", "google-fonts"), n = [], a = /* @__PURE__ */ new Map();
13
+ await Z(r, { recursive: !0 }).catch((h) => {
14
+ o?.(`Unable to create BeatUI Google Fonts cache directory: ${h}`);
14
15
  });
15
- for (const g of t)
16
+ for (const h of t)
16
17
  try {
17
- const i = M(g), l = await te({
18
- request: g,
19
- cssUrl: i,
20
- cacheRoot: a,
21
- logger: r
18
+ const d = H(h), g = await oe({
19
+ request: h,
20
+ cssUrl: d,
21
+ cacheRoot: r,
22
+ logger: o
22
23
  });
23
- if (!l)
24
+ if (!g)
24
25
  continue;
25
- const y = await ie({
26
- cssText: l,
27
- cacheRoot: a,
28
- assetMap: d,
29
- logger: r
26
+ const b = await ue({
27
+ cssText: g,
28
+ cacheRoot: r,
29
+ assetMap: a,
30
+ logger: o
30
31
  });
31
- n.push(y);
32
- } catch (i) {
33
- r?.(
34
- `Unexpected error while downloading Google Font "${g.family}": ${String(i)}`
32
+ n.push(b);
33
+ } catch (d) {
34
+ o?.(
35
+ `Unexpected error while downloading Google Font "${h.family}": ${String(d)}`
35
36
  );
36
37
  }
37
- return n.length === 0 || d.size === 0 ? null : {
38
+ return n.length === 0 || a.size === 0 ? null : {
38
39
  cssText: n.join(`
39
40
  `),
40
- assets: Array.from(d.values())
41
+ assets: Array.from(a.values())
41
42
  };
42
43
  }
43
- async function te({
44
+ async function oe({
44
45
  request: e,
45
46
  cssUrl: s,
46
47
  cacheRoot: t,
47
- logger: r
48
+ logger: o
48
49
  }) {
49
- const a = u.join(t, se(e, s));
50
+ const r = f.join(t, re(e, s));
50
51
  try {
51
52
  const n = await fetch(s, {
52
53
  headers: {
53
- "User-Agent": D
54
+ "User-Agent": z
54
55
  }
55
56
  });
56
57
  if (!n.ok)
57
58
  throw new Error(
58
59
  `Failed to download Google Font CSS: ${n.status} ${n.statusText}`
59
60
  );
60
- const d = await n.text();
61
- return await k(a, d), d;
61
+ const a = await n.text();
62
+ return await W(r, a), a;
62
63
  } catch (n) {
63
- if (S.existsSync(a))
64
+ if (p.existsSync(r))
64
65
  try {
65
- const d = await K(a, "utf8");
66
- return r?.(
66
+ const a = await q(r, "utf8");
67
+ return o?.(
67
68
  `Using cached Google Font CSS for ${e.family} because download failed.`
68
- ), d;
69
- } catch (d) {
70
- r?.(
71
- `Failed to read cached Google Font CSS for ${e.family}: ${d}`
69
+ ), a;
70
+ } catch (a) {
71
+ o?.(
72
+ `Failed to read cached Google Font CSS for ${e.family}: ${a}`
72
73
  );
73
74
  }
74
- return r?.(
75
+ return o?.(
75
76
  `Unable to download Google Font CSS for ${e.family}: ${n}`
76
77
  ), null;
77
78
  }
78
79
  }
79
- function se(e, s) {
80
- const t = Y("sha1").update(s).digest("hex").slice(0, 10);
80
+ function re(e, s) {
81
+ const t = ee("sha1").update(s).digest("hex").slice(0, 10);
81
82
  return `${e.family.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-") || "font"}-${t}.css`;
82
83
  }
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()}`;
84
+ function H(e) {
85
+ const { family: s } = e, t = s.trim().replace(/\s+/g, " "), o = ae(e.weights), r = ie(e.styles), n = new URLSearchParams();
86
+ return n.append("family", le(t, o, r)), 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), `${te}?${n.toString()}`;
86
87
  }
87
- function ne(e) {
88
+ function ae(e) {
88
89
  return !e || e.length === 0 ? [] : Array.from(new Set(e)).sort((s, t) => s - t);
89
90
  }
90
- function re(e) {
91
+ function ie(e) {
91
92
  if (!e || e.length === 0)
92
- return [x];
93
- const s = Array.from(new Set(e)), t = s.includes("italic"), r = s.includes("normal");
94
- return !t && !r && s.push(x), s.sort((a, n) => a === n ? 0 : a === "normal" ? -1 : 1);
93
+ return [k];
94
+ const s = Array.from(new Set(e)), t = s.includes("italic"), o = s.includes("normal");
95
+ return !t && !o && s.push(k), s.sort((r, n) => r === n ? 0 : r === "normal" ? -1 : 1);
95
96
  }
96
- function ae(e, s, t) {
97
- if (s.length === 0 && t.every((i) => i === "normal"))
97
+ function le(e, s, t) {
98
+ if (s.length === 0 && t.every((d) => d === "normal"))
98
99
  return e;
99
- const r = t.includes("italic"), a = t.includes("normal"), n = s.length > 0 ? s : [q];
100
- if (!r)
100
+ const o = t.includes("italic"), r = t.includes("normal"), n = s.length > 0 ? s : [se];
101
+ if (!o)
101
102
  return `${e}:wght@${n.join(";")}`;
102
- const d = /* @__PURE__ */ new Set();
103
- a && n.forEach((i) => {
104
- d.add(`0,${i}`);
105
- }), n.forEach((i) => {
106
- d.add(`1,${i}`);
103
+ const a = /* @__PURE__ */ new Set();
104
+ r && n.forEach((d) => {
105
+ a.add(`0,${d}`);
106
+ }), n.forEach((d) => {
107
+ a.add(`1,${d}`);
107
108
  });
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;
109
+ const h = Array.from(a).sort((d, g) => {
110
+ const [b, T] = d.split(",").map(Number), [U, v] = g.split(",").map(Number);
111
+ return b - U || T - v;
111
112
  });
112
- return `${e}:ital,wght@${g.join(";")}`;
113
+ return `${e}:ital,wght@${h.join(";")}`;
113
114
  }
114
- const oe = /url\(([^)]+)\)/g;
115
- async function ie({
115
+ const ce = /url\(([^)]+)\)/g;
116
+ async function ue({
116
117
  cssText: e,
117
118
  cacheRoot: s,
118
119
  assetMap: t,
119
- logger: r
120
+ logger: o
120
121
  }) {
121
- let a = e;
122
+ let r = e;
122
123
  const n = /* @__PURE__ */ new Set();
123
- let d;
124
- for (; (d = oe.exec(e)) !== null; ) {
125
- const i = d[1].trim().replace(/^['"]|['"]$/g, "");
126
- i.startsWith("http") && n.add(i);
124
+ let a;
125
+ for (; (a = ce.exec(e)) !== null; ) {
126
+ const d = a[1].trim().replace(/^['"]|['"]$/g, "");
127
+ d.startsWith("http") && n.add(d);
127
128
  }
128
- for (const g of n) {
129
- const i = await le(g, s, t, r);
130
- if (!i)
129
+ for (const h of n) {
130
+ const d = await fe(h, s, t, o);
131
+ if (!d)
131
132
  continue;
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})`);
133
+ const g = h.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"), b = new RegExp(`url\\((['"])${g}\\1\\)`, "g"), T = new RegExp(`url\\(${g}\\)`, "g");
134
+ r = r.replace(b, `url(${d.placeholder})`), r = r.replace(T, `url(${d.placeholder})`);
134
135
  }
135
- return a;
136
+ return r;
136
137
  }
137
- async function le(e, s, t, r) {
138
- const a = t.get(e);
139
- if (a)
140
- return a;
138
+ async function fe(e, s, t, o) {
139
+ const r = t.get(e);
140
+ if (r)
141
+ return r;
141
142
  let n;
142
143
  try {
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;
144
+ const g = new URL(e);
145
+ n = f.basename(g.pathname);
146
+ } catch (g) {
147
+ return o?.(`Invalid Google Font URL skipped: ${e} (${g})`), null;
147
148
  }
148
149
  if (!n)
149
- return r?.(`Unable to derive file name for Google Font URL: ${e}`), null;
150
- const d = u.join(s, n), g = `__BEATUI_GOOGLE_FONT_${t.size}__`;
151
- if (!S.existsSync(d))
150
+ return o?.(`Unable to derive file name for Google Font URL: ${e}`), null;
151
+ const a = f.join(s, n), h = `__BEATUI_GOOGLE_FONT_${t.size}__`;
152
+ if (!p.existsSync(a))
152
153
  try {
153
- const l = await fetch(e, {
154
+ const g = await fetch(e, {
154
155
  headers: {
155
- "User-Agent": D
156
+ "User-Agent": z
156
157
  }
157
158
  });
158
- if (!l.ok)
159
- return r?.(
160
- `Failed to download Google Font asset ${n}: ${l.status} ${l.statusText}`
159
+ if (!g.ok)
160
+ return o?.(
161
+ `Failed to download Google Font asset ${n}: ${g.status} ${g.statusText}`
161
162
  ), null;
162
- const y = Buffer.from(await l.arrayBuffer());
163
- await k(d, y);
164
- } catch (l) {
165
- return r?.(
166
- `Unexpected error while downloading Google Font asset ${n}: ${String(l)}`
163
+ const b = Buffer.from(await g.arrayBuffer());
164
+ await W(a, b);
165
+ } catch (g) {
166
+ return o?.(
167
+ `Unexpected error while downloading Google Font asset ${n}: ${String(g)}`
167
168
  ), null;
168
169
  }
169
- const i = {
170
+ const d = {
170
171
  url: e,
171
172
  fileName: n,
172
- localPath: d,
173
- placeholder: g
173
+ localPath: a,
174
+ placeholder: h
174
175
  };
175
- return t.set(e, i), i;
176
+ return t.set(e, d), d;
176
177
  }
177
- function B(e) {
178
+ function V(e) {
178
179
  const s = typeof e == "string" ? new URL(e) : e;
179
180
  if (s.protocol !== "file:")
180
181
  throw new TypeError(`Expected file URL, received: ${s.href}`);
181
- const t = s.hostname, r = t === "" || t === "localhost", a = decodeURIComponent(s.pathname);
182
+ const t = s.hostname, o = t === "" || t === "localhost", r = decodeURIComponent(s.pathname);
182
183
  if (process.platform === "win32") {
183
- let n = a.replace(/\//g, "\\");
184
- return !r && t ? `\\\\${t}${n}` : (n.startsWith("\\") && (n = n.slice(1)), n);
184
+ let n = r.replace(/\//g, "\\");
185
+ return !o && t ? `\\\\${t}${n}` : (n.startsWith("\\") && (n = n.slice(1)), n);
185
186
  }
186
- return !r && t ? `//${t}${a}` : a;
187
+ return !o && t ? `//${t}${r}` : r;
187
188
  }
188
- const L = "@tempots/beatui/tailwind.css", b = "beatui.tailwind.css", w = u.dirname(B(import.meta.url)), O = ce(w) ?? w;
189
- function j(e) {
189
+ const L = "@tempots/beatui/tailwind.css", F = "beatui.tailwind.css", $ = f.dirname(V(import.meta.url)), P = de($) ?? $;
190
+ function I(e) {
190
191
  if (Object.keys(e).length === 0)
191
192
  return "";
192
193
  let s = `:root {
193
194
  `;
194
- for (const [t, r] of Object.entries(e))
195
- s += ` ${t}: ${r};
195
+ for (const [t, o] of Object.entries(e))
196
+ s += ` ${t}: ${o};
196
197
  `;
197
198
  return s += `}
198
199
  `, s;
199
200
  }
200
- function ce(e) {
201
+ function de(e) {
201
202
  let s = e;
202
- const t = u.parse(s).root;
203
+ const t = f.parse(s).root;
203
204
  for (; s && s !== t; ) {
204
- const r = u.join(s, "package.json");
205
- if (S.existsSync(r))
205
+ const o = f.join(s, "package.json");
206
+ if (p.existsSync(o))
206
207
  try {
207
- if (JSON.parse(S.readFileSync(r, "utf8"))?.name === "@tempots/beatui")
208
+ if (JSON.parse(p.readFileSync(o, "utf8"))?.name === "@tempots/beatui")
208
209
  return s;
209
210
  } catch {
210
211
  }
211
- s = u.dirname(s);
212
+ s = f.dirname(s);
212
213
  }
213
214
  return null;
214
215
  }
215
- function ue(e) {
216
+ function he(e) {
216
217
  if (e == null)
217
218
  return null;
218
219
  const s = typeof e == "string" ? e : e.id;
219
220
  if (!s)
220
221
  return null;
221
222
  const [t] = s.split("?");
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
+ return t.startsWith("virtual:") || t.startsWith("\0") ? null : t.startsWith("/@fs/") ? decodeURIComponent(t.slice(4)) : t.startsWith("file://") ? V(t) : f.isAbsolute(t) ? t : null;
223
224
  }
224
- function de(e) {
225
+ function me(e) {
225
226
  const s = /* @__PURE__ */ new Set([
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
- u.resolve(e, "node_modules/@tempots/beatui/tailwind.css")
227
+ f.resolve($, F),
228
+ f.resolve($, "../", F),
229
+ f.resolve($, "../../", F),
230
+ f.resolve($, "tailwind.css"),
231
+ f.resolve($, "../tailwind.css"),
232
+ f.resolve($, "../../tailwind.css"),
233
+ f.resolve($, "../styles/tailwind.css"),
234
+ f.resolve($, "../../styles/tailwind.css"),
235
+ f.resolve(P, "dist", F),
236
+ f.resolve(P, F),
237
+ f.resolve(P, "tailwind.css"),
238
+ f.resolve(P, "src/styles/tailwind.css"),
239
+ f.resolve(e, "node_modules/@tempots/beatui/tailwind.css")
239
240
  ]);
240
241
  for (const t of s)
241
- if (S.existsSync(t))
242
+ if (p.existsSync(t))
242
243
  return t;
243
244
  return null;
244
245
  }
245
- function fe(e) {
246
+ function ge(e) {
246
247
  return e ? Array.isArray(e) ? e : [e] : [];
247
248
  }
248
- function he(e, s) {
249
+ function pe(e, s) {
249
250
  let t = e;
250
- for (const [r, a] of s)
251
- t = t.split(r).join(a);
251
+ for (const [o, r] of s)
252
+ t = t.split(o).join(r);
252
253
  return t;
253
254
  }
254
- async function me(e, s) {
255
+ async function we(e, s) {
255
256
  if (e == null || typeof e != "object")
256
257
  return null;
257
258
  const t = e.resolve;
@@ -263,12 +264,65 @@ async function me(e, s) {
263
264
  return null;
264
265
  }
265
266
  }
266
- function Se(e = {}) {
267
+ const D = new Set(Object.keys(Y));
268
+ function be(e, s, t, o) {
269
+ if (!e) return;
270
+ const r = Object.keys(e);
271
+ for (const n of r)
272
+ D.has(n) && o(
273
+ `[BeatUI] Custom color "${n}" collides with a built-in palette name. Choose a different name to avoid conflicts.`
274
+ );
275
+ for (const n of r) {
276
+ const a = e[n];
277
+ for (const h of M)
278
+ (!(h in a) || !a[h]) && t(
279
+ `[BeatUI] Custom color "${n}" is missing shade ${h}. It will fall back to transparent.`
280
+ );
281
+ }
282
+ if (s) {
283
+ const n = /* @__PURE__ */ new Set([...D, ...r]);
284
+ for (const [a, h] of Object.entries(s))
285
+ h && !n.has(h) && t(
286
+ `[BeatUI] semanticColors.${a} references "${h}" which is not a built-in or custom color palette name.`
287
+ );
288
+ }
289
+ }
290
+ function B(e) {
291
+ return e.length === 0 ? [
292
+ "// Auto-generated by @tempots/beatui — do not edit",
293
+ "declare module '@tempots/beatui' {",
294
+ " // eslint-disable-next-line @typescript-eslint/no-empty-interface",
295
+ " interface CustomColorRegistry {}",
296
+ "}",
297
+ ""
298
+ ].join(`
299
+ `) : [
300
+ "// Auto-generated by @tempots/beatui — do not edit",
301
+ "declare module '@tempots/beatui' {",
302
+ " interface CustomColorRegistry {",
303
+ ...e.map((s) => ` ${s}: true`),
304
+ " }",
305
+ "}",
306
+ ""
307
+ ].join(`
308
+ `);
309
+ }
310
+ function Te(e = {}) {
267
311
  let s = process.cwd();
268
- const t = e.injectCss !== !1, r = e.rtlAttribute ?? "dir", a = e.rtlValue ?? "rtl";
312
+ const t = e.injectCss !== !1, o = e.rtlAttribute ?? "dir", r = e.rtlValue ?? "rtl";
269
313
  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({
314
+ const a = e.customColors ? I(
315
+ (() => {
316
+ const m = {};
317
+ for (const [u, i] of Object.entries(
318
+ e.customColors
319
+ ))
320
+ for (const c of M)
321
+ m[`--color-${u}-${c}`] = i[c];
322
+ return m;
323
+ })()
324
+ ) : "", d = e.semanticColors != null || e.semanticFonts != null || e.semanticRadii != null || e.semanticShadows != null || e.semanticMotion != null || e.semanticSpacing != null || e.semanticTextShadows != null ? I(
325
+ Q({
272
326
  colors: e.semanticColors,
273
327
  fonts: e.semanticFonts,
274
328
  radii: e.semanticRadii,
@@ -277,150 +331,167 @@ function Se(e = {}) {
277
331
  spacing: e.semanticSpacing,
278
332
  textShadows: e.semanticTextShadows
279
333
  })
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
- const I = (h) => {
289
- const f = [
290
- y,
291
- g,
292
- i
334
+ ) : "", g = e.fontFamilies ? I(
335
+ X(e.fontFamilies)
336
+ ) : "", b = {};
337
+ e.baseSpacing && (b["--spacing-base-raw"] = e.baseSpacing), e.baseFontSize && (b["--font-size-base-raw"] = e.baseFontSize), e.baseMotionDuration && (b[K("base")] = e.baseMotionDuration);
338
+ const T = I(b), U = ge(e.googleFonts);
339
+ let v = "", E = [];
340
+ const A = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map(), J = "/@beatui/google-fonts", R = [];
341
+ let x = null, C = null, G = !1;
342
+ const N = (m) => {
343
+ const u = [
344
+ a,
345
+ T,
346
+ d,
347
+ g
293
348
  ];
294
- return T && (h === "dev" ? f.push(
295
- he(T, A)
296
- ) : f.push(T)), f.filter((o) => o && o.length > 0).join(`
349
+ return v && (m === "dev" ? u.push(
350
+ pe(v, A)
351
+ ) : u.push(v)), u.filter((i) => i && i.length > 0).join(`
297
352
  `);
298
353
  };
299
354
  return {
300
355
  name: "beatui-tailwind",
301
356
  enforce: "pre",
302
- async configResolved(h) {
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(
357
+ async configResolved(m) {
358
+ s = m.root, G = m.command === "build";
359
+ const u = e.customColors ? Object.keys(e.customColors) : [], i = f.resolve(s, "beatui-custom-colors.d.ts");
360
+ if (u.length > 0) {
361
+ const l = B(u);
362
+ (p.existsSync(i) ? p.readFileSync(i, "utf8") : "") !== l && p.writeFileSync(i, l, "utf8");
363
+ } else if (p.existsSync(i)) {
364
+ const l = B([]);
365
+ p.readFileSync(i, "utf8") !== l && p.writeFileSync(i, l, "utf8");
366
+ }
367
+ if (n = m.base && m.base !== "/" ? m.base.endsWith("/") ? m.base : `${m.base}/` : "/", t) {
368
+ const l = await we(
305
369
  this,
306
370
  L
307
371
  );
308
- C = ue(o) ?? de(s);
372
+ C = he(l) ?? me(s);
309
373
  }
310
- const f = (o) => {
311
- this && typeof this.warn == "function" ? this.warn(o) : h.logger.warn(o);
374
+ const c = (l) => {
375
+ this && typeof this.warn == "function" ? this.warn(l) : m.logger.warn(l);
312
376
  };
313
- if (F.length > 0) {
314
- const o = Array.from(
315
- new Set(F.map(M))
316
- ), c = await ee({
377
+ if (be(
378
+ e.customColors,
379
+ e.semanticColors,
380
+ (l) => c(l),
381
+ (l) => {
382
+ throw new Error(l);
383
+ }
384
+ ), U.length > 0) {
385
+ const l = Array.from(
386
+ new Set(U.map(H))
387
+ ), w = await ne({
317
388
  projectRoot: s,
318
- requests: F,
319
- logger: (m) => f(`[BeatUI] ${m}`)
389
+ requests: U,
390
+ logger: (y) => c(`[BeatUI] ${y}`)
320
391
  });
321
- if (T = c?.cssText ?? "", v = c?.assets ?? [], A.clear(), R.clear(), P.clear(), E.length = 0, v.length > 0)
322
- for (const m of v) {
323
- const p = `${W}/${m.fileName}`;
324
- A.set(m.placeholder, p), P.set(p, m.localPath);
392
+ if (v = w?.cssText ?? "", E = w?.assets ?? [], A.clear(), O.clear(), j.clear(), R.length = 0, E.length > 0)
393
+ for (const y of E) {
394
+ const S = `${J}/${y.fileName}`;
395
+ A.set(y.placeholder, S), j.set(S, y.localPath);
325
396
  }
326
397
  else
327
- E.push(...o);
398
+ R.push(...l);
328
399
  } else
329
- E.length = 0;
330
- t && !C && f(
400
+ R.length = 0;
401
+ t && !C && c(
331
402
  "[BeatUI] Unable to resolve @tempots/beatui/tailwind.css. CSS will not be auto-injected."
332
403
  );
333
404
  },
334
- configureServer(h) {
335
- !t || C == null || (h.middlewares.use((f, o, c) => {
336
- const m = f.method ?? "GET";
337
- if (!["GET", "HEAD"].includes(m)) {
405
+ configureServer(m) {
406
+ !t || C == null || (m.middlewares.use((u, i, c) => {
407
+ const l = u.method ?? "GET";
408
+ if (!["GET", "HEAD"].includes(l)) {
338
409
  c();
339
410
  return;
340
411
  }
341
- const p = (f.url ?? "").split("?")[0];
412
+ const w = (u.url ?? "").split("?")[0];
342
413
  if (!new Set(
343
414
  [
344
- `/${b}`,
345
- n === "/" ? null : `${n}${b}`
346
- ].filter(($) => !!$)
347
- ).has(p)) {
415
+ `/${F}`,
416
+ n === "/" ? null : `${n}${F}`
417
+ ].filter((S) => !!S)
418
+ ).has(w)) {
348
419
  c();
349
420
  return;
350
421
  }
351
- o.setHeader("Content-Type", "text/css");
422
+ i.setHeader("Content-Type", "text/css");
352
423
  try {
353
- let $ = S.readFileSync(C, "utf8");
354
- const N = I("dev");
355
- N && ($ += `
356
- ${N}`), o.end($);
357
- } catch ($) {
358
- h.config.logger.error(
359
- `[BeatUI] Failed to stream ${L}: ${String($)}`
360
- ), o.statusCode = 500, o.end();
424
+ let S = p.readFileSync(C, "utf8");
425
+ const _ = N("dev");
426
+ _ && (S += `
427
+ ${_}`), i.end(S);
428
+ } catch (S) {
429
+ m.config.logger.error(
430
+ `[BeatUI] Failed to stream ${L}: ${String(S)}`
431
+ ), i.statusCode = 500, i.end();
361
432
  }
362
- }), P.size > 0 && h.middlewares.use((f, o, c) => {
363
- const m = f.method ?? "GET";
364
- if (!["GET", "HEAD"].includes(m)) {
433
+ }), j.size > 0 && m.middlewares.use((u, i, c) => {
434
+ const l = u.method ?? "GET";
435
+ if (!["GET", "HEAD"].includes(l)) {
365
436
  c();
366
437
  return;
367
438
  }
368
- const p = (f.url ?? "").split("?")[0], U = p ? P.get(p) : void 0;
369
- if (!U) {
439
+ const w = (u.url ?? "").split("?")[0], y = w ? j.get(w) : void 0;
440
+ if (!y) {
370
441
  c();
371
442
  return;
372
443
  }
373
- o.setHeader("Content-Type", "font/woff2"), S.createReadStream(U).on("error", () => {
374
- o.statusCode = 500, o.end();
375
- }).pipe(o);
444
+ i.setHeader("Content-Type", "font/woff2"), p.createReadStream(y).on("error", () => {
445
+ i.statusCode = 500, i.end();
446
+ }).pipe(i);
376
447
  }));
377
448
  },
378
449
  buildStart() {
379
- if (!_ || !t || C == null) return;
380
- R.clear(), G = null;
381
- const h = C;
382
- let f = S.readFileSync(h, "utf8");
383
- const o = I("raw");
384
- if (o && (f += `
385
- ${o}`), G = this.emitFile({
450
+ if (!G || !t || C == null) return;
451
+ O.clear(), x = null;
452
+ const m = C;
453
+ let u = p.readFileSync(m, "utf8");
454
+ const i = N("raw");
455
+ if (i && (u += `
456
+ ${i}`), x = this.emitFile({
386
457
  type: "asset",
387
- fileName: b,
388
- source: f
389
- }), v.length > 0)
390
- for (const c of v)
458
+ fileName: F,
459
+ source: u
460
+ }), E.length > 0)
461
+ for (const c of E)
391
462
  try {
392
- const m = S.readFileSync(c.localPath), p = this.emitFile({
463
+ const l = p.readFileSync(c.localPath), w = this.emitFile({
393
464
  type: "asset",
394
465
  name: `assets/${c.fileName}`,
395
- source: m
466
+ source: l
396
467
  });
397
- R.set(c.placeholder, p);
398
- } catch (m) {
468
+ O.set(c.placeholder, w);
469
+ } catch (l) {
399
470
  this.warn(
400
471
  `[BeatUI] Failed to include Google Font asset ${c.fileName}: ${String(
401
- m
472
+ l
402
473
  )}`
403
474
  );
404
475
  }
405
476
  },
406
- generateBundle(h, f) {
407
- if (!_ || !G)
477
+ generateBundle(m, u) {
478
+ if (!G || !x)
408
479
  return;
409
- const o = this.getFileName(G), c = f[o];
480
+ const i = this.getFileName(x), c = u[i];
410
481
  if (!c || c.type !== "asset" || typeof c.source != "string")
411
482
  return;
412
- let m = c.source;
413
- for (const [p, U] of R) {
414
- const $ = this.getFileName(U);
415
- m = m.split(p).join($);
483
+ let l = c.source;
484
+ for (const [w, y] of O) {
485
+ const S = this.getFileName(y);
486
+ l = l.split(w).join(S);
416
487
  }
417
- c.source = m;
488
+ c.source = l;
418
489
  },
419
- transformIndexHtml(h) {
420
- const f = [];
490
+ transformIndexHtml(m) {
491
+ const u = [];
421
492
  if (t && C) {
422
- const c = n === "/" ? `/${b}` : `${n}${b}`;
423
- f.push({
493
+ const c = n === "/" ? `/${F}` : `${n}${F}`;
494
+ u.push({
424
495
  tag: "link",
425
496
  attrs: {
426
497
  rel: "stylesheet",
@@ -429,7 +500,7 @@ ${o}`), G = this.emitFile({
429
500
  injectTo: "head-prepend"
430
501
  });
431
502
  }
432
- E.length > 0 && f.push(
503
+ R.length > 0 && u.push(
433
504
  {
434
505
  tag: "link",
435
506
  attrs: {
@@ -447,7 +518,7 @@ ${o}`), G = this.emitFile({
447
518
  },
448
519
  injectTo: "head"
449
520
  },
450
- ...E.map((c) => ({
521
+ ...R.map((c) => ({
451
522
  tag: "link",
452
523
  attrs: {
453
524
  rel: "stylesheet",
@@ -457,14 +528,14 @@ ${o}`), G = this.emitFile({
457
528
  injectTo: "head"
458
529
  }))
459
530
  );
460
- const o = `
531
+ const i = `
461
532
  (() => {
462
533
  const apply = () => {
463
534
  const root = document.documentElement
464
535
  const target = document.body
465
536
  if (!target) return
466
- const dirValue = root.getAttribute('${r.replace(/'/g, "\\'")}')
467
- const isRtl = dirValue === '${a.replace(/'/g, "\\'")}'
537
+ const dirValue = root.getAttribute('${o.replace(/'/g, "\\'")}')
538
+ const isRtl = dirValue === '${r.replace(/'/g, "\\'")}'
468
539
  target.classList.toggle('b-rtl', isRtl)
469
540
  target.classList.toggle('b-ltr', !isRtl)
470
541
  }
@@ -476,20 +547,20 @@ ${o}`), G = this.emitFile({
476
547
  const observer = new MutationObserver(apply)
477
548
  observer.observe(document.documentElement, {
478
549
  attributes: true,
479
- attributeFilter: ['${r.replace(/'/g, "\\'")}'],
550
+ attributeFilter: ['${o.replace(/'/g, "\\'")}'],
480
551
  })
481
552
  })();
482
553
  `;
483
- return f.push({
554
+ return u.push({
484
555
  tag: "script",
485
556
  attrs: { type: "module" },
486
- children: o,
557
+ children: i,
487
558
  injectTo: "body"
488
- }), { html: h, tags: f };
559
+ }), { html: m, tags: u };
489
560
  }
490
561
  };
491
562
  }
492
563
  export {
493
- Se as beatuiTailwindPlugin,
494
- Se as default
564
+ Te as beatuiTailwindPlugin,
565
+ Te as default
495
566
  };