@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.
- package/dist/{ar-Wr6gMs-M.cjs → ar-CEzAem0F.cjs} +1 -1
- package/dist/{ar-fdUqbCvM.js → ar-CQieaqsq.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/auth-divider-B8yr-E_b.cjs +1 -0
- package/dist/{auth-divider-D9KnNeyF.js → auth-divider-Byh5BWLc.js} +91 -88
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +27 -26
- package/dist/card-BkA7Wvbh.cjs +1 -0
- package/dist/card-DX1DwGbL.js +62 -0
- package/dist/{colors-C2sgnzFH.js → colors-CyMhfbJi.js} +64 -58
- package/dist/{colors-DPCHjRMj.cjs → colors-IXZF9U-s.cjs} +1 -1
- package/dist/control-hqEuMzyI.js +343 -0
- package/dist/control-muup9GF1.cjs +1 -0
- package/dist/custom-validation-BA9iJWl_.cjs +1 -0
- package/dist/custom-validation-BOBoUwHY.js +181 -0
- package/dist/{de-C5-k5Eov.js → de-CBIwvkAH.js} +1 -1
- package/dist/{de-DZqdSEta.cjs → de-DdfxrlT3.cjs} +1 -1
- package/dist/deep-merge-8fwp1z4X.js +1346 -0
- package/dist/deep-merge-VDGE_HQD.cjs +1 -0
- package/dist/duration-input-DmsljXl3.cjs +1 -0
- package/dist/{duration-input-D4V_PHIg.js → duration-input-ZQlcqdXU.js} +32 -31
- package/dist/{editor-toolbar-group-FpOHrmtx.js → editor-toolbar-group-BNTBMJCe.js} +2 -2
- package/dist/{editor-toolbar-group-C_ft_T8D.cjs → editor-toolbar-group-DiMzqYgz.cjs} +1 -1
- package/dist/{es-h6jmoF4X.js → es--9HaEj2D.js} +1 -1
- package/dist/{es-CJgYfRap.cjs → es-DSdljxFJ.cjs} +1 -1
- package/dist/{fa-BuxK837l.js → fa-1Z-akcW7.js} +1 -1
- package/dist/{fa-BQ5PzwNY.cjs → fa-BolmeWRT.cjs} +1 -1
- package/dist/flyout-CuKFh_T7.js +151 -0
- package/dist/flyout-DC_tKaTG.cjs +1 -0
- package/dist/{fr-Bv3TG44U.cjs → fr-CODgUuoZ.cjs} +1 -1
- package/dist/{fr-BwILQ9G2.js → fr-DhHM9rou.js} +1 -1
- package/dist/{he-yC9Sc7JD.js → he-CBamXbGJ.js} +1 -1
- package/dist/{he-5LbvgMCC.cjs → he-Juw-dr28.cjs} +1 -1
- package/dist/{hi-Da7rcCpP.js → hi-DvvcX-Ra.js} +1 -1
- package/dist/{hi-YWhWcG_L.cjs → hi-R749jeg-.cjs} +1 -1
- package/dist/{index-CvU9E9wd.js → index-BfQaT5Jy.js} +104 -104
- package/dist/{index-XogEKwdt.cjs → index-Dv7nPuwA.cjs} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +6713 -9831
- package/dist/{input-container-CyOgiiQD.cjs → input-container-BaWQLWB6.cjs} +1 -1
- package/dist/{input-container-8JFB11xN.js → input-container-DCS5oJ4S.js} +4 -4
- package/dist/{it-BxOIJE45.cjs → it-DT5oRZDH.cjs} +1 -1
- package/dist/{it-Yeklau78.js → it-aV6i8Qxz.js} +1 -1
- package/dist/{ja-Dxj9Q5Yd.js → ja-CuLhGnJX.js} +1 -1
- package/dist/{ja-CNhjK06P.cjs → ja-CwKaCYLB.cjs} +1 -1
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +83 -79
- package/dist/json-schema-display/index.cjs.js +1 -1
- package/dist/json-schema-display/index.es.js +2 -2
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +74 -72
- package/dist/{ko-DgkqcXTs.cjs → ko-Bucro9ID.cjs} +1 -1
- package/dist/{ko-gn_MsegK.js → ko-D-66BsEX.js} +1 -1
- package/dist/lexical/index.cjs.js +1 -1
- package/dist/lexical/index.es.js +5 -5
- package/dist/menu-BFLFKceF.cjs +1 -0
- package/dist/menu-BO6zqyfq.js +220 -0
- package/dist/modal-6Mq3vS5r.js +309 -0
- package/dist/modal-d77-TMc4.cjs +1 -0
- package/dist/{nl-vHNFtXXb.js → nl-CAny6wvm.js} +1 -1
- package/dist/{nl-Dy9lmbBO.cjs → nl-D7vHpehb.cjs} +1 -1
- package/dist/notice-BNGx86Yg.js +110 -0
- package/dist/notice-iF6zBMq9.cjs +1 -0
- package/dist/{oneof-branch-detection-Q_jxvJIA.js → oneof-branch-detection-Bm17RhC2.js} +27 -26
- package/dist/oneof-branch-detection-DZ4MrfBp.cjs +1 -0
- package/dist/openui/index.cjs.js +9 -0
- package/dist/openui/index.es.js +2174 -0
- package/dist/password-input-Bipt7Wsu.cjs +1 -0
- package/dist/password-input-mkRmrEPq.js +105 -0
- package/dist/{pl-BtYbtsmG.cjs → pl-CSiXoOKT.cjs} +1 -1
- package/dist/{pl-C0UdHla0.js → pl-rmZLgQ_V.js} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +4 -4
- package/dist/{pt-CtNmqQ1X.cjs → pt-CJT-iq4y.cjs} +1 -1
- package/dist/{pt-DGKtfN0d.js → pt-DHnajqAi.js} +1 -1
- package/dist/{ru-CpXYLt-v.js → ru-C_E8OZNE.js} +1 -1
- package/dist/{ru-BaL_NPRU.cjs → ru-G3sr_ctV.cjs} +1 -1
- package/dist/slider-input-SLguFA0d.cjs +1 -0
- package/dist/slider-input-VYAMm7pE.js +285 -0
- package/dist/stepper-24p16Zsv.cjs +1 -0
- package/dist/stepper-TlzbfYWa.js +3222 -0
- package/dist/tailwind/preset.cjs.js +1 -1
- package/dist/tailwind/preset.es.js +38 -40
- package/dist/tailwind/vite-plugin.cjs.js +14 -12
- package/dist/tailwind/vite-plugin.es.js +317 -246
- package/dist/text-area-BdemKQ_w.cjs +1 -0
- package/dist/text-area-Br83-_PQ.js +431 -0
- package/dist/{text-input-NJypZSnE.js → text-input-ByuxdX8w.js} +5 -5
- package/dist/{text-input-DS5zlXb2.cjs → text-input-MjlUC_9u.cjs} +1 -1
- package/dist/{toolbar-BF2L6WKC.js → toolbar-CEBTTjHh.js} +1 -1
- package/dist/{toolbar-BBwfe8U9.cjs → toolbar-DWawYFFX.cjs} +1 -1
- package/dist/{tr-DwOd87oB.cjs → tr-DcxLHHTC.cjs} +1 -1
- package/dist/{tr-DIFZDFW_.js → tr-bVXwloKC.js} +1 -1
- package/dist/{translations-EwEmHe3v.cjs → translations-D3xqZUTA.cjs} +1 -1
- package/dist/{translations-BCMP-h52.js → translations-DU9wTV1y.js} +20 -19
- package/dist/{translations-5cXBrENb.js → translations-RT_UN8ny.js} +1 -1
- package/dist/{translations-BqWc0ZHz.cjs → translations-qljG2Chq.cjs} +1 -1
- package/dist/types/components/navigation/stepper.d.ts +4 -4
- package/dist/types/openui/index.d.ts +28 -0
- package/dist/types/openui/library/define-component.d.ts +15 -0
- package/dist/types/openui/library/library.d.ts +7 -0
- package/dist/types/openui/library/prompt-generator.d.ts +5 -0
- package/dist/types/openui/library/types.d.ts +33 -0
- package/dist/types/openui/parser/parser.d.ts +8 -0
- package/dist/types/openui/parser/streaming-parser.d.ts +14 -0
- package/dist/types/openui/parser/tokenizer.d.ts +9 -0
- package/dist/types/openui/parser/types.d.ts +46 -0
- package/dist/types/openui/registry/button.d.ts +148 -0
- package/dist/types/openui/registry/data.d.ts +177 -0
- package/dist/types/openui/registry/form.d.ts +65 -0
- package/dist/types/openui/registry/format.d.ts +67 -0
- package/dist/types/openui/registry/index.d.ts +9 -0
- package/dist/types/openui/registry/layout.d.ts +45 -0
- package/dist/types/openui/registry/navigation.d.ts +149 -0
- package/dist/types/openui/registry/overlay.d.ts +56 -0
- package/dist/types/openui/registry/typography.d.ts +17 -0
- package/dist/types/openui/renderer/action-context.d.ts +24 -0
- package/dist/types/openui/renderer/node-resolver.d.ts +9 -0
- package/dist/types/openui/renderer/openui-renderer.d.ts +32 -0
- package/dist/types/openui/renderer/skeleton.d.ts +2 -0
- package/dist/types/openui/streaming/from-fetch.d.ts +7 -0
- package/dist/types/openui/streaming/from-sse.d.ts +7 -0
- package/dist/types/openui/streaming/from-websocket.d.ts +10 -0
- package/dist/types/openui/streaming/types.d.ts +5 -0
- package/dist/types/tailwind/preset.d.ts +25 -4
- package/dist/types/tailwind/vite-plugin.d.ts +17 -5
- package/dist/types/tokens/colors.d.ts +87 -9
- package/dist/types/tokens/index.d.ts +7 -6
- package/dist/{ur-DBst-TXc.js → ur-Dls2qb4V.js} +1 -1
- package/dist/{ur-D9nLchps.cjs → ur-IRQoHh1E.cjs} +1 -1
- package/dist/use-form-BZ8vDYOv.cjs +2 -0
- package/dist/use-form-DsCzINfm.js +750 -0
- package/dist/utils-D3-NApSw.cjs +1 -0
- package/dist/utils-Nbh7yQ73.js +105 -0
- package/dist/{vi-Dg1aiMr5.cjs → vi-Bi9SvVCP.cjs} +1 -1
- package/dist/{vi-DQOJp32U.js → vi-C3mTzj50.js} +1 -1
- package/dist/widget-customization-BV6XB2v_.cjs +1 -0
- package/dist/widget-customization-Bso45ONQ.js +1198 -0
- package/dist/{zh-DPK4HXl2.js → zh-B4JRJBt2.js} +1 -1
- package/dist/{zh-tbwSTbmn.cjs → zh-BMU5rYu1.cjs} +1 -1
- package/package.json +31 -20
- package/dist/auth-divider-CjcrgXmq.cjs +0 -1
- package/dist/custom-validation-7por5nJN.js +0 -488
- package/dist/custom-validation-CLscGHY4.cjs +0 -1
- package/dist/deep-merge-D90SW1Ci.cjs +0 -1
- package/dist/deep-merge-DT2H9AGq.js +0 -1765
- package/dist/duration-input-4AQnQpyo.cjs +0 -1
- package/dist/menu-B60Q9j3-.cjs +0 -1
- package/dist/menu-BkqFGcXg.js +0 -366
- package/dist/notice-CQGJyZ8o.js +0 -211
- package/dist/notice-p2IqXS5-.cjs +0 -1
- package/dist/oneof-branch-detection-xDDDdYRk.cjs +0 -1
- package/dist/use-form-8NnZ-KHk.js +0 -1090
- package/dist/use-form-Dcra7GeE.cjs +0 -2
- package/dist/utils-DmEuG3Np.cjs +0 -1
- package/dist/utils-vUtP6iPG.js +0 -165
- package/dist/widget-customization-BIBva3f-.js +0 -1458
- package/dist/widget-customization-pqmtsraC.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../index-Dv7nPuwA.cjs"),o=require("../colors-IXZF9U-s.cjs");function u(e){const r=[...o.semanticColorNames];return e&&r.push(...e),Object.fromEntries(r.map(a=>[a,Object.fromEntries(o.colorShades.map(t=>[t,`var(--color-${a}-${t})`]))]))}function b(e){const{includeCoreTokens:r=!0,includeSemanticTokens:a=!0}=e,t={};if(r){const i=n.generateCoreTokenVariables(e.customColors);e.baseSpacing&&(i["--spacing-base-raw"]=e.baseSpacing),e.baseFontSize&&(i["--font-size-base-raw"]=e.baseFontSize),e.baseMotionDuration&&(i[n.getMotionDurationVarName("base")]=e.baseMotionDuration),t[":root"]=i}return a&&(t[":root"]={...t[":root"]??{},...n.generateSemanticTokenVariables({colors:e.semanticColors,fonts:e.semanticFonts,radii:e.semanticRadii,shadows:e.semanticShadows,motion:e.semanticMotion,spacing:e.semanticSpacing,textShadows:e.semanticTextShadows})}),e.fontFamilies&&(t[":root"]={...t[":root"]??{},...n.generateFontFamilyOverrideVariables(e.fontFamilies)}),t}const c=Object.assign((e,r)=>({handler:e,config:r}),{withOptions(e,r=()=>({})){const a=t=>({handler:e(t),config:r(t)});return a.__isOptionsFunction=!0,a}});function l(e={}){const r=b(e),a=e.extendTheme??!0,t=e.customColors?Object.keys(e.customColors):void 0;return{darkMode:"class",theme:{extend:a?{colors:u(t)}:{}},plugins:[c(({addBase:s})=>{Object.keys(r).length>0&&s(r)}),c(({addVariant:s})=>{s("beatui-light",".light &"),s("beatui-rtl",".b-rtl &"),s("beatui-ltr",".b-ltr &")})]}}const m=l();exports.beatuiPreset=m;exports.createBeatuiPreset=l;
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import { g as
|
|
2
|
-
import { s as
|
|
3
|
-
function f() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { g as o, a as c, b as l, c as m } from "../index-BfQaT5Jy.js";
|
|
2
|
+
import { s as u, c as b } from "../colors-CyMhfbJi.js";
|
|
3
|
+
function f(e) {
|
|
4
|
+
const a = [...u];
|
|
5
|
+
return e && a.push(...e), Object.fromEntries(
|
|
6
|
+
a.map((r) => [
|
|
7
|
+
r,
|
|
7
8
|
Object.fromEntries(
|
|
8
|
-
|
|
9
|
-
t,
|
|
10
|
-
`var(--color-${e}-${t})`
|
|
11
|
-
])
|
|
9
|
+
b.map((t) => [t, `var(--color-${r}-${t})`])
|
|
12
10
|
)
|
|
13
11
|
])
|
|
14
12
|
);
|
|
15
13
|
}
|
|
16
|
-
function
|
|
17
|
-
const { includeCoreTokens:
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
e.baseSpacing && (
|
|
14
|
+
function g(e) {
|
|
15
|
+
const { includeCoreTokens: a = !0, includeSemanticTokens: r = !0 } = e, t = {};
|
|
16
|
+
if (a) {
|
|
17
|
+
const s = o(e.customColors);
|
|
18
|
+
e.baseSpacing && (s["--spacing-base-raw"] = e.baseSpacing), e.baseFontSize && (s["--font-size-base-raw"] = e.baseFontSize), e.baseMotionDuration && (s[c("base")] = e.baseMotionDuration), t[":root"] = s;
|
|
21
19
|
}
|
|
22
|
-
return
|
|
23
|
-
...
|
|
24
|
-
...
|
|
20
|
+
return r && (t[":root"] = {
|
|
21
|
+
...t[":root"] ?? {},
|
|
22
|
+
...l({
|
|
25
23
|
colors: e.semanticColors,
|
|
26
24
|
fonts: e.semanticFonts,
|
|
27
25
|
radii: e.semanticRadii,
|
|
@@ -30,47 +28,47 @@ function d(e) {
|
|
|
30
28
|
spacing: e.semanticSpacing,
|
|
31
29
|
textShadows: e.semanticTextShadows
|
|
32
30
|
})
|
|
33
|
-
}), e.fontFamilies && (
|
|
34
|
-
...
|
|
35
|
-
...
|
|
36
|
-
}),
|
|
31
|
+
}), e.fontFamilies && (t[":root"] = {
|
|
32
|
+
...t[":root"] ?? {},
|
|
33
|
+
...m(e.fontFamilies)
|
|
34
|
+
}), t;
|
|
37
35
|
}
|
|
38
36
|
const n = Object.assign(
|
|
39
|
-
(e,
|
|
37
|
+
(e, a) => ({
|
|
40
38
|
handler: e,
|
|
41
|
-
config:
|
|
39
|
+
config: a
|
|
42
40
|
}),
|
|
43
41
|
{
|
|
44
|
-
withOptions(e,
|
|
45
|
-
const
|
|
46
|
-
handler: e(
|
|
47
|
-
config: t
|
|
42
|
+
withOptions(e, a = () => ({})) {
|
|
43
|
+
const r = (t) => ({
|
|
44
|
+
handler: e(t),
|
|
45
|
+
config: a(t)
|
|
48
46
|
});
|
|
49
|
-
return
|
|
47
|
+
return r.__isOptionsFunction = !0, r;
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
);
|
|
53
|
-
function
|
|
54
|
-
const t =
|
|
51
|
+
function d(e = {}) {
|
|
52
|
+
const a = g(e), r = e.extendTheme ?? !0, t = e.customColors ? Object.keys(e.customColors) : void 0;
|
|
55
53
|
return {
|
|
56
54
|
darkMode: "class",
|
|
57
55
|
theme: {
|
|
58
|
-
extend:
|
|
59
|
-
colors: f()
|
|
56
|
+
extend: r ? {
|
|
57
|
+
colors: f(t)
|
|
60
58
|
} : {}
|
|
61
59
|
},
|
|
62
60
|
plugins: [
|
|
63
|
-
n(({ addBase:
|
|
64
|
-
Object.keys(
|
|
61
|
+
n(({ addBase: i }) => {
|
|
62
|
+
Object.keys(a).length > 0 && i(a);
|
|
65
63
|
}),
|
|
66
|
-
n(({ addVariant:
|
|
67
|
-
|
|
64
|
+
n(({ addVariant: i }) => {
|
|
65
|
+
i("beatui-light", ".light &"), i("beatui-rtl", ".b-rtl &"), i("beatui-ltr", ".b-ltr &");
|
|
68
66
|
})
|
|
69
67
|
]
|
|
70
68
|
};
|
|
71
69
|
}
|
|
72
|
-
const
|
|
70
|
+
const F = d();
|
|
73
71
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
F as beatuiPreset,
|
|
73
|
+
d as createBeatuiPreset
|
|
76
74
|
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
`),assets:Array.from(
|
|
3
|
-
`;for(const[t,
|
|
4
|
-
`;return
|
|
5
|
-
`,
|
|
6
|
-
`)
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("node:fs"),d=require("node:path"),G=require("../index-Dv7nPuwA.cjs"),k=require("../colors-IXZF9U-s.cjs"),x=require("node:fs/promises"),Y=require("node:crypto");var L=typeof document<"u"?document.currentScript:null;const Z="https://fonts.googleapis.com/css2",B="normal",q=400,V="Mozilla/5.0 (compatible; BeatUI Tailwind Plugin; +https://tempots.com)";async function ee(e){const{projectRoot:s,requests:t,logger:o}=e;if(!t||t.length===0)return null;const r=e.cacheDir?d.resolve(e.cacheDir):d.join(s,"node_modules",".beatui","google-fonts"),n=[],a=new Map;await x.mkdir(r,{recursive:!0}).catch(h=>{o?.(`Unable to create BeatUI Google Fonts cache directory: ${h}`)});for(const h of t)try{const f=J(h),g=await te({request:h,cssUrl:f,cacheRoot:r,logger:o});if(!g)continue;const b=await ie({cssText:g,cacheRoot:r,assetMap:a,logger:o});n.push(b)}catch(f){o?.(`Unexpected error while downloading Google Font "${h.family}": ${String(f)}`)}return n.length===0||a.size===0?null:{cssText:n.join(`
|
|
2
|
+
`),assets:Array.from(a.values())}}async function te({request:e,cssUrl:s,cacheRoot:t,logger:o}){const r=d.join(t,se(e,s));try{const n=await fetch(s,{headers:{"User-Agent":V}});if(!n.ok)throw new Error(`Failed to download Google Font CSS: ${n.status} ${n.statusText}`);const a=await n.text();return await x.writeFile(r,a),a}catch(n){if(p.existsSync(r))try{const a=await x.readFile(r,"utf8");return o?.(`Using cached Google Font CSS for ${e.family} because download failed.`),a}catch(a){o?.(`Failed to read cached Google Font CSS for ${e.family}: ${a}`)}return o?.(`Unable to download Google Font CSS for ${e.family}: ${n}`),null}}function se(e,s){const t=Y.createHash("sha1").update(s).digest("hex").slice(0,10);return`${e.family.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-")||"font"}-${t}.css`}function J(e){const{family:s}=e,t=s.trim().replace(/\s+/g," "),o=ne(e.weights),r=oe(e.styles),n=new URLSearchParams;return n.append("family",re(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),`${Z}?${n.toString()}`}function ne(e){return!e||e.length===0?[]:Array.from(new Set(e)).sort((s,t)=>s-t)}function oe(e){if(!e||e.length===0)return[B];const s=Array.from(new Set(e)),t=s.includes("italic"),o=s.includes("normal");return!t&&!o&&s.push(B),s.sort((r,n)=>r===n?0:r==="normal"?-1:1)}function re(e,s,t){if(s.length===0&&t.every(f=>f==="normal"))return e;const o=t.includes("italic"),r=t.includes("normal"),n=s.length>0?s:[q];if(!o)return`${e}:wght@${n.join(";")}`;const a=new Set;r&&n.forEach(f=>{a.add(`0,${f}`)}),n.forEach(f=>{a.add(`1,${f}`)});const h=Array.from(a).sort((f,g)=>{const[b,T]=f.split(",").map(Number),[U,v]=g.split(",").map(Number);return b-U||T-v});return`${e}:ital,wght@${h.join(";")}`}const ae=/url\(([^)]+)\)/g;async function ie({cssText:e,cacheRoot:s,assetMap:t,logger:o}){let r=e;const n=new Set;let a;for(;(a=ae.exec(e))!==null;){const f=a[1].trim().replace(/^['"]|['"]$/g,"");f.startsWith("http")&&n.add(f)}for(const h of n){const f=await le(h,s,t,o);if(!f)continue;const g=h.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),b=new RegExp(`url\\((['"])${g}\\1\\)`,"g"),T=new RegExp(`url\\(${g}\\)`,"g");r=r.replace(b,`url(${f.placeholder})`),r=r.replace(T,`url(${f.placeholder})`)}return r}async function le(e,s,t,o){const r=t.get(e);if(r)return r;let n;try{const g=new URL(e);n=d.basename(g.pathname)}catch(g){return o?.(`Invalid Google Font URL skipped: ${e} (${g})`),null}if(!n)return o?.(`Unable to derive file name for Google Font URL: ${e}`),null;const a=d.join(s,n),h=`__BEATUI_GOOGLE_FONT_${t.size}__`;if(!p.existsSync(a))try{const g=await fetch(e,{headers:{"User-Agent":V}});if(!g.ok)return o?.(`Failed to download Google Font asset ${n}: ${g.status} ${g.statusText}`),null;const b=Buffer.from(await g.arrayBuffer());await x.writeFile(a,b)}catch(g){return o?.(`Unexpected error while downloading Google Font asset ${n}: ${String(g)}`),null}const f={url:e,fileName:n,localPath:a,placeholder:h};return t.set(e,f),f}function Q(e){const s=typeof e=="string"?new URL(e):e;if(s.protocol!=="file:")throw new TypeError(`Expected file URL, received: ${s.href}`);const t=s.hostname,o=t===""||t==="localhost",r=decodeURIComponent(s.pathname);if(process.platform==="win32"){let n=r.replace(/\//g,"\\");return!o&&t?`\\\\${t}${n}`:(n.startsWith("\\")&&(n=n.slice(1)),n)}return!o&&t?`//${t}${r}`:r}const W="@tempots/beatui/tailwind.css",C="beatui.tailwind.css",$=d.dirname(Q(typeof document>"u"?require("url").pathToFileURL(__filename).href:L&&L.tagName.toUpperCase()==="SCRIPT"&&L.src||new URL("tailwind/vite-plugin.cjs.js",document.baseURI).href)),I=ce($)??$;function _(e){if(Object.keys(e).length===0)return"";let s=`:root {
|
|
3
|
+
`;for(const[t,o]of Object.entries(e))s+=` ${t}: ${o};
|
|
4
|
+
`;return s+=`}
|
|
5
|
+
`,s}function ce(e){let s=e;const t=d.parse(s).root;for(;s&&s!==t;){const o=d.join(s,"package.json");if(p.existsSync(o))try{if(JSON.parse(p.readFileSync(o,"utf8"))?.name==="@tempots/beatui")return s}catch{}s=d.dirname(s)}return null}function ue(e){if(e==null)return null;const s=typeof e=="string"?e:e.id;if(!s)return null;const[t]=s.split("?");return t.startsWith("virtual:")||t.startsWith("\0")?null:t.startsWith("/@fs/")?decodeURIComponent(t.slice(4)):t.startsWith("file://")?Q(t):d.isAbsolute(t)?t:null}function de(e){const s=new Set([d.resolve($,C),d.resolve($,"../",C),d.resolve($,"../../",C),d.resolve($,"tailwind.css"),d.resolve($,"../tailwind.css"),d.resolve($,"../../tailwind.css"),d.resolve($,"../styles/tailwind.css"),d.resolve($,"../../styles/tailwind.css"),d.resolve(I,"dist",C),d.resolve(I,C),d.resolve(I,"tailwind.css"),d.resolve(I,"src/styles/tailwind.css"),d.resolve(e,"node_modules/@tempots/beatui/tailwind.css")]);for(const t of s)if(p.existsSync(t))return t;return null}function fe(e){return e?Array.isArray(e)?e:[e]:[]}function he(e,s){let t=e;for(const[o,r]of s)t=t.split(o).join(r);return t}async function me(e,s){if(e==null||typeof e!="object")return null;const t=e.resolve;if(!t)return null;try{return await t.call(e,s,void 0,{skipSelf:!0})}catch{return null}}const z=new Set(Object.keys(k.colors));function ge(e,s,t,o){if(!e)return;const r=Object.keys(e);for(const n of r)z.has(n)&&o(`[BeatUI] Custom color "${n}" collides with a built-in palette name. Choose a different name to avoid conflicts.`);for(const n of r){const a=e[n];for(const h of k.colorShades)(!(h in a)||!a[h])&&t(`[BeatUI] Custom color "${n}" is missing shade ${h}. It will fall back to transparent.`)}if(s){const n=new Set([...z,...r]);for(const[a,h]of Object.entries(s))h&&!n.has(h)&&t(`[BeatUI] semanticColors.${a} references "${h}" which is not a built-in or custom color palette name.`)}}function H(e){return e.length===0?["// Auto-generated by @tempots/beatui — do not edit","declare module '@tempots/beatui' {"," // eslint-disable-next-line @typescript-eslint/no-empty-interface"," interface CustomColorRegistry {}","}",""].join(`
|
|
6
|
+
`):["// Auto-generated by @tempots/beatui — do not edit","declare module '@tempots/beatui' {"," interface CustomColorRegistry {",...e.map(s=>` ${s}: true`)," }","}",""].join(`
|
|
7
|
+
`)}function X(e={}){let s=process.cwd();const t=e.injectCss!==!1,o=e.rtlAttribute??"dir",r=e.rtlValue??"rtl";let n="/";const a=e.customColors?_((()=>{const m={};for(const[u,i]of Object.entries(e.customColors))for(const c of k.colorShades)m[`--color-${u}-${c}`]=i[c];return m})()):"",f=e.semanticColors!=null||e.semanticFonts!=null||e.semanticRadii!=null||e.semanticShadows!=null||e.semanticMotion!=null||e.semanticSpacing!=null||e.semanticTextShadows!=null?_(G.generateSemanticTokenVariables({colors:e.semanticColors,fonts:e.semanticFonts,radii:e.semanticRadii,shadows:e.semanticShadows,motion:e.semanticMotion,spacing:e.semanticSpacing,textShadows:e.semanticTextShadows})):"",g=e.fontFamilies?_(G.generateFontFamilyOverrideVariables(e.fontFamilies)):"",b={};e.baseSpacing&&(b["--spacing-base-raw"]=e.baseSpacing),e.baseFontSize&&(b["--font-size-base-raw"]=e.baseFontSize),e.baseMotionDuration&&(b[G.getMotionDurationVarName("base")]=e.baseMotionDuration);const T=_(b),U=fe(e.googleFonts);let v="",E=[];const N=new Map,j=new Map,O=new Map,K="/@beatui/google-fonts",R=[];let P=null,F=null,A=!1;const D=m=>{const u=[a,T,f,g];return v&&(m==="dev"?u.push(he(v,N)):u.push(v)),u.filter(i=>i&&i.length>0).join(`
|
|
8
|
+
`)};return{name:"beatui-tailwind",enforce:"pre",async configResolved(m){s=m.root,A=m.command==="build";const u=e.customColors?Object.keys(e.customColors):[],i=d.resolve(s,"beatui-custom-colors.d.ts");if(u.length>0){const l=H(u);(p.existsSync(i)?p.readFileSync(i,"utf8"):"")!==l&&p.writeFileSync(i,l,"utf8")}else if(p.existsSync(i)){const l=H([]);p.readFileSync(i,"utf8")!==l&&p.writeFileSync(i,l,"utf8")}if(n=m.base&&m.base!=="/"?m.base.endsWith("/")?m.base:`${m.base}/`:"/",t){const l=await me(this,W);F=ue(l)??de(s)}const c=l=>{this&&typeof this.warn=="function"?this.warn(l):m.logger.warn(l)};if(ge(e.customColors,e.semanticColors,l=>c(l),l=>{throw new Error(l)}),U.length>0){const l=Array.from(new Set(U.map(J))),w=await ee({projectRoot:s,requests:U,logger:y=>c(`[BeatUI] ${y}`)});if(v=w?.cssText??"",E=w?.assets??[],N.clear(),j.clear(),O.clear(),R.length=0,E.length>0)for(const y of E){const S=`${K}/${y.fileName}`;N.set(y.placeholder,S),O.set(S,y.localPath)}else R.push(...l)}else R.length=0;t&&!F&&c("[BeatUI] Unable to resolve @tempots/beatui/tailwind.css. CSS will not be auto-injected.")},configureServer(m){!t||F==null||(m.middlewares.use((u,i,c)=>{const l=u.method??"GET";if(!["GET","HEAD"].includes(l)){c();return}const w=(u.url??"").split("?")[0];if(!new Set([`/${C}`,n==="/"?null:`${n}${C}`].filter(S=>!!S)).has(w)){c();return}i.setHeader("Content-Type","text/css");try{let S=p.readFileSync(F,"utf8");const M=D("dev");M&&(S+=`
|
|
9
|
+
${M}`),i.end(S)}catch(S){m.config.logger.error(`[BeatUI] Failed to stream ${W}: ${String(S)}`),i.statusCode=500,i.end()}}),O.size>0&&m.middlewares.use((u,i,c)=>{const l=u.method??"GET";if(!["GET","HEAD"].includes(l)){c();return}const w=(u.url??"").split("?")[0],y=w?O.get(w):void 0;if(!y){c();return}i.setHeader("Content-Type","font/woff2"),p.createReadStream(y).on("error",()=>{i.statusCode=500,i.end()}).pipe(i)}))},buildStart(){if(!A||!t||F==null)return;j.clear(),P=null;const m=F;let u=p.readFileSync(m,"utf8");const i=D("raw");if(i&&(u+=`
|
|
10
|
+
${i}`),P=this.emitFile({type:"asset",fileName:C,source:u}),E.length>0)for(const c of E)try{const l=p.readFileSync(c.localPath),w=this.emitFile({type:"asset",name:`assets/${c.fileName}`,source:l});j.set(c.placeholder,w)}catch(l){this.warn(`[BeatUI] Failed to include Google Font asset ${c.fileName}: ${String(l)}`)}},generateBundle(m,u){if(!A||!P)return;const i=this.getFileName(P),c=u[i];if(!c||c.type!=="asset"||typeof c.source!="string")return;let l=c.source;for(const[w,y]of j){const S=this.getFileName(y);l=l.split(w).join(S)}c.source=l},transformIndexHtml(m){const u=[];if(t&&F){const c=n==="/"?`/${C}`:`${n}${C}`;u.push({tag:"link",attrs:{rel:"stylesheet",href:c},injectTo:"head-prepend"})}R.length>0&&u.push({tag:"link",attrs:{rel:"preconnect",href:"https://fonts.googleapis.com"},injectTo:"head"},{tag:"link",attrs:{rel:"preconnect",href:"https://fonts.gstatic.com",crossorigin:""},injectTo:"head"},...R.map(c=>({tag:"link",attrs:{rel:"stylesheet",href:c,"data-beatui-google-font":""},injectTo:"head"})));const i=`
|
|
9
11
|
(() => {
|
|
10
12
|
const apply = () => {
|
|
11
13
|
const root = document.documentElement
|
|
12
14
|
const target = document.body
|
|
13
15
|
if (!target) return
|
|
14
|
-
const dirValue = root.getAttribute('${
|
|
15
|
-
const isRtl = dirValue === '${
|
|
16
|
+
const dirValue = root.getAttribute('${o.replace(/'/g,"\\'")}')
|
|
17
|
+
const isRtl = dirValue === '${r.replace(/'/g,"\\'")}'
|
|
16
18
|
target.classList.toggle('b-rtl', isRtl)
|
|
17
19
|
target.classList.toggle('b-ltr', !isRtl)
|
|
18
20
|
}
|
|
@@ -24,7 +26,7 @@ ${a}`),O=this.emitFile({type:"asset",fileName:y,source:f}),v.length>0)for(const
|
|
|
24
26
|
const observer = new MutationObserver(apply)
|
|
25
27
|
observer.observe(document.documentElement, {
|
|
26
28
|
attributes: true,
|
|
27
|
-
attributeFilter: ['${
|
|
29
|
+
attributeFilter: ['${o.replace(/'/g,"\\'")}'],
|
|
28
30
|
})
|
|
29
31
|
})();
|
|
30
|
-
`;return
|
|
32
|
+
`;return u.push({tag:"script",attrs:{type:"module"},children:i,injectTo:"body"}),{html:m,tags:u}}}}exports.beatuiTailwindPlugin=X;exports.default=X;
|