@tempots/beatui 0.83.5 → 0.85.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 +840 -428
- package/dist/beatui.tailwind.css +840 -428
- 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 +865 -848
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +2 -2
- 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-DMAhcoJ2.js +377 -0
- package/dist/menu-q8xJaBIb.cjs +1 -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/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-BngYjPvO.cjs +1 -0
- package/dist/{widget-customization-0is7oTeP.js → widget-customization-D-Vvr4vg.js} +300 -329
- package/package.json +1 -1
- 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,4 +1,4 @@
|
|
|
1
|
-
import { makeProviderMark as n, localStorageProp as o, computedOf as m, Use as u,
|
|
1
|
+
import { makeProviderMark as n, localStorageProp as o, computedOf as m, Use as u, Portal as i, attr as l } from "@tempots/dom";
|
|
2
2
|
import { useAppearance as f } from "@tempots/ui";
|
|
3
3
|
const d = {
|
|
4
4
|
mark: n("Theme"),
|
|
@@ -7,18 +7,18 @@ const d = {
|
|
|
7
7
|
defaultAppearance: a = "system",
|
|
8
8
|
appearancePreferenceKey: r = "bui-appearance"
|
|
9
9
|
} = {}) => {
|
|
10
|
-
const
|
|
10
|
+
const t = f(), e = o({
|
|
11
11
|
key: r,
|
|
12
12
|
defaultValue: a
|
|
13
13
|
}), c = () => {
|
|
14
|
-
|
|
14
|
+
t.dispose(), e.dispose();
|
|
15
15
|
};
|
|
16
16
|
return {
|
|
17
17
|
value: {
|
|
18
18
|
appearance: m(
|
|
19
|
-
|
|
19
|
+
t,
|
|
20
20
|
e
|
|
21
|
-
)((s,
|
|
21
|
+
)((s, p) => p === "system" ? s : p),
|
|
22
22
|
appearancePreference: e,
|
|
23
23
|
setAppearancePreference: (s) => {
|
|
24
24
|
e.set(s);
|
|
@@ -29,7 +29,7 @@ const d = {
|
|
|
29
29
|
}
|
|
30
30
|
}, y = () => u(
|
|
31
31
|
d,
|
|
32
|
-
({ appearance: a }) => i.class(a.map((r) =>
|
|
32
|
+
({ appearance: a }) => i("html", l.class(a.map((r) => r)))
|
|
33
33
|
);
|
|
34
34
|
export {
|
|
35
35
|
d as T,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("@tempots/dom"),m=require("@tempots/ui"),p={mark:e.makeProviderMark("Theme"),create:({defaultAppearance:r="system",appearancePreferenceKey:s="bui-appearance"}={})=>{const c=m.useAppearance(),a=e.localStorageProp({key:s,defaultValue:r}),o=()=>{c.dispose(),a.dispose()};return{value:{appearance:e.computedOf(c,a)((t,n)=>n==="system"?t:n),appearancePreference:a,setAppearancePreference:t=>{a.set(t)}},dispose:o}}},u=()=>e.Use(p,({appearance:r})=>e.Portal("html",e.attr.class(r.map(s=>s))));exports.Theme=p;exports.ThemeAppearance=u;
|
|
@@ -60,7 +60,7 @@ export interface AdvancedSliderOptions {
|
|
|
60
60
|
* Whether to show the current value label(s) above the thumb(s).
|
|
61
61
|
* @default false
|
|
62
62
|
*/
|
|
63
|
-
showValue?: boolean
|
|
63
|
+
showValue?: Value<boolean>;
|
|
64
64
|
/**
|
|
65
65
|
* Custom formatter for the displayed value labels.
|
|
66
66
|
* @default (v) => String(v)
|
|
@@ -26,6 +26,8 @@ export type ComboboxOptions<T> = Merge<InputOptions<T>, {
|
|
|
26
26
|
searchPlaceholder?: Value<string>;
|
|
27
27
|
/** Debounce delay in milliseconds for the search query. @default 150 */
|
|
28
28
|
debounceMs?: number;
|
|
29
|
+
/** Whether to auto-focus the search input when the dropdown opens. @default true */
|
|
30
|
+
autoFocusSearch?: boolean;
|
|
29
31
|
}>;
|
|
30
32
|
/**
|
|
31
33
|
* A searchable combobox input component with asynchronous option loading and custom rendering.
|
|
@@ -40,7 +40,8 @@ export type SwitchOptions = {
|
|
|
40
40
|
* support (Space and Enter to toggle), and a sliding thumb animation. The switch track
|
|
41
41
|
* color is theme-aware and configurable via the `color` property. Optional on/off labels
|
|
42
42
|
* appear inside the track and cross-fade based on the current state. The thumb position
|
|
43
|
-
* is
|
|
43
|
+
* is controlled entirely via CSS using `inset-inline-start`, which handles RTL
|
|
44
|
+
* automatically via the logical property.
|
|
44
45
|
*
|
|
45
46
|
* @param options - Configuration options for the switch
|
|
46
47
|
* @returns A styled switch element with animated thumb and optional labels
|
|
@@ -29,11 +29,12 @@ export interface ThemeOptions {
|
|
|
29
29
|
*/
|
|
30
30
|
export declare const Theme: Provider<ThemeValue, ThemeOptions>;
|
|
31
31
|
/**
|
|
32
|
-
* Reactive
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* Reactive node that applies the current theme appearance as a CSS class
|
|
33
|
+
* (`'dark'` or `'light'`) on the `<html>` element via a Portal.
|
|
34
|
+
* This aligns with Tailwind CSS's built-in `dark:` variant which expects
|
|
35
|
+
* a `dark` class on `<html>`.
|
|
35
36
|
*
|
|
36
|
-
* @returns A reactive
|
|
37
|
+
* @returns A reactive Portal TNode
|
|
37
38
|
*
|
|
38
39
|
* @example
|
|
39
40
|
* ```ts
|
|
@@ -144,7 +144,7 @@ interface TailwindPluginConfig {
|
|
|
144
144
|
* - Sets `darkMode: 'class'` so BeatUI's theme provider can toggle themes.
|
|
145
145
|
* - Registers core and semantic CSS custom properties as base styles.
|
|
146
146
|
* - Extends Tailwind's color palette with semantic aliases (e.g. `bg-primary-500`).
|
|
147
|
-
* - Adds convenience variants: `beatui-
|
|
147
|
+
* - Adds convenience variants: `beatui-light`, `beatui-rtl`, `beatui-ltr`.
|
|
148
148
|
*
|
|
149
149
|
* @param options - Optional overrides for semantic tokens and feature flags.
|
|
150
150
|
* @returns A Tailwind preset object to include in `tailwind.config.ts`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("@tempots/dom"),F=require("./deep-merge-UghuPcyW.cjs"),ct=require("./string-B9vVyfq3.cjs"),D=require("./input-container-CSi72GI1.cjs"),S=require("./text-input-8v79fzEy.cjs"),N=require("./translations-gVgMyNno.cjs"),ut=require("@tempots/ui"),z=require("./notice-Bc1L4Zpr.cjs"),pt=require("./session-id-B5lJMzbB.cjs"),dt=require("./utils-DIUEhA-Z.cjs");function q(e){if(typeof e!="string")return!1;const n=e.startsWith("#")?e.slice(1):e;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function X(e){if(typeof e!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s]=r,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(s,10);return l>=0&&l<=255&&i>=0&&i<=255&&c>=0&&c<=255}function Y(e){if(typeof e!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s,l]=r,i=parseInt(a,10),c=parseInt(o,10),u=parseInt(s,10),p=parseFloat(l);return i>=0&&i<=255&&c>=0&&c<=255&&u>=0&&u<=255&&p>=0&&p<=1}function G(e){if(typeof e!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s]=r,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(s,10);return l>=0&&l<=360&&i>=0&&i<=100&&c>=0&&c<=100}function gt(e){return q(e)||X(e)||Y(e)||G(e)}function K(e){if(!q(e))return null;let n=e.startsWith("#")?e.slice(1):e;return n.length===3&&(n=n.split("").map(r=>r+r).join("")),`#${n.toLowerCase()}`}function W(e,n,r){const a=o=>{const s=Math.round(Math.max(0,Math.min(255,o))).toString(16);return s.length===1?"0"+s:s};return`#${a(e)}${a(n)}${a(r)}`}function E(e){const n=K(e);if(!n)return null;const r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function ht(e,n){const r=E(e),a=E(n);if(!r||!a)return null;const o=(u,p,h)=>{const[m,d,b]=[u,p,h].map(I=>(I=I/255,I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4)));return .2126*m+.7152*d+.0722*b},s=o(r.r,r.g,r.b),l=o(a.r,a.g,a.b),i=Math.max(s,l),c=Math.min(s,l);return(i+.05)/(c+.05)}function Q(e){if(!e)return[0,0,0,1];const r=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(r){const u=r[1];if(u.length===8){const p=parseInt(u.slice(0,2),16),h=parseInt(u.slice(2,4),16),m=parseInt(u.slice(4,6),16),d=parseInt(u.slice(6,8),16)/255;return[p,h,m,d]}if(u.length===6)return[parseInt(u.slice(0,2),16),parseInt(u.slice(2,4),16),parseInt(u.slice(4,6),16),1];if(u.length===4){const p=parseInt(u[0]+u[0],16),h=parseInt(u[1]+u[1],16),m=parseInt(u[2]+u[2],16),d=parseInt(u[3]+u[3],16)/255;return[p,h,m,d]}if(u.length===3){const p=parseInt(u[0]+u[0],16),h=parseInt(u[1]+u[1],16),m=parseInt(u[2]+u[2],16);return[p,h,m,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const o=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(o)return[parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),1];const s=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const u=parseFloat(s[1]),p=parseFloat(s[2]),h=parseFloat(s[3]),m=s[4]!=null?parseFloat(s[4]):1,[d,b,I]=j(u,p/100,h/100);return[d,b,I,m]}const l=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(l){const u=parseFloat(l[1]),p=parseFloat(l[2])/100,h=parseFloat(l[3])/100,m=l[4]!=null?parseFloat(l[4]):1,[d,b,I]=tt(u,p,h);return[d,b,I,m]}const i=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(i){const u=i[1],p=parseFloat(i[2]),h=parseFloat(i[3]),m=i[4]!=null?parseFloat(i[4]):1,d=u.endsWith("%")?Math.max(0,Math.min(1,parseFloat(u)/100)):Math.max(0,Math.min(1,parseFloat(u))),[b,I,V]=nt(d,p,h);return[b,I,V,m]}const c=E(e);return c?[c.r,c.g,c.b,1]:[0,0,0,1]}function Z(e,n,r,a){return`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`}function J(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function j(e,n,r){e=(e%360+360)%360;const a=(1-Math.abs(2*r-1))*n,o=a*(1-Math.abs(e/60%2-1)),s=r-a/2;let l=0,i=0,c=0;return 0<=e&&e<60?[l,i,c]=[a,o,0]:60<=e&&e<120?[l,i,c]=[o,a,0]:120<=e&&e<180?[l,i,c]=[0,a,o]:180<=e&&e<240?[l,i,c]=[0,o,a]:240<=e&&e<300?[l,i,c]=[o,0,a]:[l,i,c]=[a,0,o],[Math.round((l+s)*255),Math.round((i+s)*255),Math.round((c+s)*255)]}function tt(e,n,r){e=(e%360+360)%360;const a=n+r;a>1&&(n/=a,r/=a);const[o,s,l]=j(e,1,.5).map(h=>h/255),i=1-n-r,c=o*i+n,u=s*i+n,p=l*i+n;return[Math.round(c*255),Math.round(u*255),Math.round(p*255)]}function H(e,n,r){e/=255,n/=255,r/=255;const a=Math.max(e,n,r),o=Math.min(e,n,r);let s=0,l=0;const i=(a+o)/2,c=a-o;if(c!==0){switch(l=i>.5?c/(2-a-o):c/(a+o),a){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;default:s=(e-n)/c+4}s*=60}return[Math.round(s),Math.round(l*100),Math.round(i*100)]}function et(e,n,r){const[a]=H(e,n,r),o=e/255,s=n/255,l=r/255,i=Math.min(o,s,l),c=1-Math.max(o,s,l);return[a,Math.round(i*100),Math.round(c*100)]}function O(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function U(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function nt(e,n,r){const a=r*Math.PI/180,o=Math.cos(a)*n,s=Math.sin(a)*n,l=e+.3963377774*o+.2158037573*s,i=e-.1055613458*o-.0638541728*s,c=e-.0894841775*o-1.291485548*s,u=l*l*l,p=i*i*i,h=c*c*c,m=4.0767416621*u-3.3077115913*p+.2309699292*h,d=-1.2684380046*u+2.6097574011*p-.3413193965*h,b=-.0041960863*u-.7034186147*p+1.707614701*h;return[U(m),U(d),U(b)]}function at(e,n,r){const a=O(e),o=O(n),s=O(r),l=.4122214708*a+.5363325363*o+.0514459929*s,i=.2119034982*a+.6806995451*o+.1073969566*s,c=.0883024619*a+.2817188376*o+.6299787005*s,u=Math.cbrt(l),p=Math.cbrt(i),h=Math.cbrt(c),m=.2104542553*u+.793617785*p-.0040720468*h,d=1.9779984951*u-2.428592205*p+.4505937099*h,b=.0259040371*u+.7827717662*p-.808675766*h,I=Math.sqrt(d*d+b*b);let V=Math.atan2(b,d)*180/Math.PI;return V<0&&(V+=360),[m,I,V]}function R(e,n,r,a,o,s){switch(o){case"hex":if(s){const l=c=>c.toString(16).padStart(2,"0"),i=Math.max(0,Math.min(255,Math.round(a*255)));return`#${l(e)}${l(n)}${l(r)}${l(i)}`}return W(e,n,r);case"rgb":return`rgb(${e}, ${n}, ${r})`;case"rgba":return`rgba(${e}, ${n}, ${r}, ${Math.round(a*100)/100})`;case"hsl":{const[l,i,c]=H(e,n,r);return`hsl(${l}, ${i}%, ${c}%)`}case"hsla":{const[l,i,c]=H(e,n,r);return`hsla(${l}, ${i}%, ${c}%, ${Math.round(a*100)/100})`}case"hwb":{const[l,i,c]=et(e,n,r);return a<1?`hwb(${l} ${i}% ${c}% / ${Math.round(a*100)/100})`:`hwb(${l} ${i}% ${c}%)`}case"oklch":{const[l,i,c]=at(e,n,r),u=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(i*1e3)/1e3).toFixed(3),h=(Math.round(c*10)/10).toFixed(1),m=Math.round(a*100)/100;return s||a<1?`oklch(${u} ${p} ${h} / ${m})`:`oklch(${u} ${p} ${h})`}}}function v(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}async function rt(e){return new Promise((n,r)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const o=a.result;n(o.split(",")[1])},a.onerror=o=>r(o)})}function mt(e){return Promise.all(e.map(rt))}function ft(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function bt(e){const n=ct.$t(e??""),r=n.length,a=new Uint8Array(r);for(let o=0;o<r;o++)a[o]=n.charCodeAt(o);return a}function st(e){const{value:n,onChange:r,onInput:a,...o}=e,s=new Map,l=t.Value.toSignal(n).map(p=>p.map((h,m)=>{const d=s.get(h),b=bt(h??""),I=d?.type||ft(b),V=d?.name??`file-${m}`,y=b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength),f=new Blob([y],{type:I});return new File([f],V,{type:I})})),i=p=>h=>{p&&mt(h).then(m=>{for(const[d,b]of m.entries())s.set(b,{name:h[d].name,type:h[d].type});p(m)})},c=i(r),u=i(a);return F.FilesInput({...o,value:l,onChange:c,onInput:u})}function yt(e){const{value:n,onInput:r,onChange:a,...o}=e;return st({...o,maxFiles:1,value:t.Value.map(n,s=>s==null?[]:[s]),onChange:s=>{a?.(s[0])},onInput:s=>{r?.(s[0])}})}function It(e,n){const[r,a,o]=e,s=r<<16^a<<8^o,l=J(s),i=6+Math.floor(l()*5),c=.18+l()*.06,u=[];for(let d=0;d<i;d++){const b=d/i*Math.PI*2,I=n*(1+(l()*2-1)*c),V=Math.cos(b)*I,y=Math.sin(b)*I;u.push({x:V,y})}const p=(u[0].x+u[i-1].x)/2,h=(u[0].y+u[i-1].y)/2;let m=`M ${p.toFixed(3)} ${h.toFixed(3)}`;for(let d=0;d<i;d++){const b=u[d],I=u[(d+1)%i],V=(b.x+I.x)/2,y=(b.y+I.y)/2;m+=` Q ${b.x.toFixed(3)} ${b.y.toFixed(3)} ${V.toFixed(3)} ${y.toFixed(3)}`}return m+=" Z",m}const wt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,displayValue:s,size:l,withAlpha:i}=e,c=t.Value.map(l??32,g=>g),u=t.Value.map(n,g=>Q(g??"#000000")),p=t.Value.map(u,([g,w,$])=>[g,w,$]),h=t.Value.map(u,([,,,g])=>g),m=t.prop(t.Value.get(h)??1),d=t.Value.map(i??!1,g=>g),b=t.Value.map(e.colorTextFormat??"rgb",g=>g),I=t.computedOf(p,m,b,d)(([g,w,$],C,A,T)=>R(g,w,$,C??1,v(A,T),T)),V=t.Value.map(e.colorTextFormat??"hex",g=>g),y=t.Value.map(c,g=>`${-g/2} ${-g/2} ${g} ${g}`),f=t.computedOf(p,c)((g,w)=>It(g,w/2)),M=t.computedOf(p,m,d)(([g,w,$],C,A)=>A||C<1?Z(g,w,$,C):W(g,w,$)),_=t.html.div(t.attr.class("bc-color-swatch-input__control"),t.attr.class(t.Value.map(d,g=>g?"bc-color-swatch-input__control--alpha":"")),t.attr.style(t.computedOf(c)(g=>`min-width:${g+2}px;height:${g+2}px`)),t.svg.svg(t.attr.class("bc-color-swatch-input__svg"),t.svgAttr.viewBox(y),t.svg.path(t.svgAttr.d(f),t.svgAttr.fill(M))),t.html.input(t.attr.type("color"),S.CommonInputAttributes(e),t.attr.value(t.Value.map(p,([g,w,$])=>W(g,w,$))),t.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(g=>{const w=g.target.value;if(!a)return;const{r:$,g:C,b:A}=E(w)??{r:0,g:0,b:0},T=t.Value.get(m)??1,k=v(t.Value.get(V),t.Value.get(d)),L=R($,C,A,T,k,t.Value.get(d));a(L)}):t.Empty,o!=null?t.on.input(g=>{const w=g.target.value;if(!o)return;const{r:$,g:C,b:A}=E(w)??{r:0,g:0,b:0},T=t.Value.get(m)??1,k=v(t.Value.get(V),t.Value.get(d)),L=R($,C,A,T,k,t.Value.get(d));o(L)}):t.Empty)),x=t.When(d,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-swatch-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(m,g=>String(g??1))),t.attr.disabled(e.disabled),t.on.input(g=>{const w=parseFloat(g.target.value);m.set(w);const[$,C,A]=t.Value.get(p),T=v(t.Value.get(V),t.Value.get(d)),k=R($,C,A,w,T,t.Value.get(d));o?.(k)}),t.on.change(g=>{const w=parseFloat(g.target.value);m.set(w);const[$,C,A]=t.Value.get(p),T=v(t.Value.get(V),t.Value.get(d)),k=R($,C,A,w,T,t.Value.get(d));a?.(k)})));return D.InputContainer({baseContainer:!0,...e,growInput:!1,input:_,after:t.Fragment(t.When(s??!1,()=>t.html.span(t.attr.class("bc-color-swatch-input__rgb"),I)),x,e.after)})},Vt=({startEditing:e,value:n,onChange:r,placeholder:a,disabled:o})=>{const s=t.Value.deriveProp(e??!1),l=t.prop(!1),i=t.Value.map(o??!1,c=>c);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(i,c=>c?"bc-editable-text--disabled":"")),t.aria.disabled(i),t.When(s,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),ut.AutoSelect(),t.on.keydown(c=>{c.key==="Enter"?s.set(!1):c.key==="Escape"&&(l.set(!0),s.set(!1))}),t.on.blur(t.emitValue(c=>{if(s.set(!1),l.value){l.set(!1);return}r(c)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(i)||s.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,c=>c!=null&&c.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(i,c=>!c),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(N.BeatUII18n,c=>t.aria.label(c.$.editLabel)),t.on.click(()=>s.set(!0)),N.Icon({icon:"line-md/pencil",color:"neutral"}))))))},Mt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,after:s,disabled:l}=e,i=F.NullableResetAfter(n,l,a??o);return D.InputContainer({...e,input:t.input.date(S.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDate(o)):t.Empty),after:s!=null?t.Fragment(i,s):i})},$t=e=>{const n=e.getFullYear(),r=e.getMonth()+1,a=e.getDate(),o=e.getHours(),s=e.getMinutes(),l=e.getSeconds();return`${n}-${r.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${o.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},xt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,after:s,disabled:l}=e,i=t.Value.map(n,u=>u!=null?$t(u):null),c=F.NullableResetAfter(n,l,a??o);return D.InputContainer({...e,input:t.input["datetime-local"](S.CommonInputAttributes(e),t.attr.value(t.Value.map(i,u=>u??null)),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDateTime(o)):t.Empty),after:s!=null?t.Fragment(c,s):c})},P=e=>typeof e=="string"&&e.trim()===""?null:e,ot=e=>e??"";function B(e){return n=>{const{value:r,onBlur:a,onChange:o,onInput:s,after:l,disabled:i,...c}=n,u=F.NullableResetAfter(r,i,o??s);return e({...c,disabled:i,value:t.Value.map(r,ot),onChange:o!=null?p=>o(P(p)):void 0,onInput:s!=null?p=>s(P(p)):void 0,onBlur:a,after:l!=null?t.Fragment(u,l):u})}}const _t=B(z.EmailInput),Ct=B(S.TextInput),At=B(z.PasswordInput),Tt=B(F.TextArea),Ft=({value:e,onChange:n,onInput:r,onBlur:a,offLabel:o,onLabel:s,disabled:l=!1,size:i="md",id:c,color:u="primary",tabIndex:p=0,matchInputHeight:h=!0})=>{const m=c??pt.sessionId("switch");function d(y,f){const M=["bc-switch",`bc-switch--size-${f}`,`bc-switch--${f}`];return h&&M.push("bc-switch--match-input"),y&&M.push("bc-switch--disabled"),M.join(" ")}function b(y){const f=y??"primary",M=new Map,_=N.backgroundValue(f,"solid","light"),x=N.backgroundValue(f,"solid","dark");return M.set("--switch-track-on-bg",_.backgroundColor),M.set("--switch-track-on-label",_.textColor),M.set("--switch-track-on-bg-dark",x.backgroundColor),M.set("--switch-track-on-label-dark",x.textColor),M.set("--switch-track-on-border-dark",N.borderColorValue(f,"dark")),Array.from(M.entries()).map(([g,w])=>`${g}: ${w}`).join("; ")}const I=()=>{t.Value.get(l)||(n?.(!t.Value.get(e)),r?.(!t.Value.get(e)))},V=y=>{t.Value.get(l)||(y.key===" "||y.key==="Enter")&&(y.preventDefault(),I())};return t.html.div(t.attr.class(t.computedOf(l??!1,i)((y,f)=>d(y??!1,f??"md"))),t.attr.style(t.computedOf(u)(y=>b(y))),t.attr.id(m),t.attr.role("switch"),t.attr.tabindex(t.computedOf(l??!1,p)((y,f)=>y?-1:f??0)),t.aria.checked(e),t.aria.disabled(l),t.on.click(I),t.on.keydown(V),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__track--on":"bc-switch__track--off")),o!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),o):null,s!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),s):null,t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__thumb--on":"bc-switch__thumb--off")))))},kt=B(F.UUIDInput),Nt="line-md:star-alt-filled",St="line-md:star-alt",lt=e=>{const{value:n,onChange:r,disabled:a,max:o=5,fullColor:s="yellow",emptyColor:l="neutral",fullIcon:i=Nt,emptyIcon:c=St,size:u="md",onBlur:p,rounding:h=1}=e,m=()=>{const f=t.Value.get(h);return f>0?f:1},d=f=>Math.min(Math.max(f,0),t.Value.get(o)),b=(f,M)=>{if(t.Value.get(a??!1))return;const x=f.currentTarget.getBoundingClientRect(),g=(f.clientX-x.left)/x.width,w=M-1+g,$=m(),C=Math.ceil(w/$)*$,A=d(C);r?.(A)},I=f=>{if(t.Value.get(a??!1))return;const M=m(),_=t.Value.get(n)??0;let x;switch(f.key){case"ArrowRight":case"ArrowUp":x=d(_+M);break;case"ArrowLeft":case"ArrowDown":x=d(_-M);break;case"Home":x=0;break;case"End":x=t.Value.get(o);break;default:return}f.preventDefault(),r?.(x)},V=t.Value.map(u,f=>`bc-icon--${f}`),y=({index:f,counter:M})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(V),N.Icon({icon:c,size:u,color:l,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(V),t.style.width(t.Value.map(n,_=>{const x=Math.floor(_);return x>f?"100%":x<f?"0%":`${(_-f)*100}%`})),N.Icon({icon:i,size:u,color:s,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))),t.on.click(t.emit(_=>b(_,M),{preventDefault:!0,stopPropagation:!0})));return D.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(S.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(a??!1,f=>f?-1:0)),t.aria.disabled(a??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(o,f=>f??0)),t.aria.valuenow(t.Value.map(n,f=>f??0)),t.aria.valuetext(t.computedOf(n,o)((f,M)=>{const _=f??0,x=M??0;return`${String(_)} / ${String(x)}`})),t.on.keydown(I),p!=null?t.on.blur(p):null,t.Repeat(o,y))})},Rt=e=>{const{value:n,onChange:r,onInput:a,onBlur:o,after:s,disabled:l,...i}=e,c=F.NullableResetAfter(n,l,r??a);return lt({...i,value:t.Value.map(n,u=>u??0),onChange:r,onInput:a,onBlur:o,after:s!=null?t.Fragment(c,s):c})},vt=e=>{const{value:n,step:r,min:a,max:o,onBlur:s,onChange:l,onInput:i}=e;return D.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),S.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(r),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),s!=null?t.on.blur(t.emitValueAsNumber(s)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(l)):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(i)):t.Empty)})},Et=e=>{const{value:n,step:r,min:a,max:o,onBlur:s,onChange:l,onInput:i}=e,c=t.Value.map(n,p=>{if(p!=null)return p;const h=a!=null?t.Value.get(a):void 0;return typeof h=="number"?h:0}),u=F.NullableResetAfter(n,e.disabled,l??i);return D.InputContainer({...e,focusableSelector:'input[type="range"]',after:u,input:t.html.input(t.attr.type("range"),S.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(r),t.attr.valueAsNumber(c),t.attr.class("bc-input bc-slider-input"),s!=null?t.on.blur(t.emitValueAsNumber(s)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(p=>{l(p)})):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(p=>{i(p)})):t.Empty)},t.Fragment())},Dt=B(F.UrlInput);class it{widgets=new Map;typeMapping=new Map;register(n,r){if(this.widgets.set(n,r),r.supportedTypes)for(const a of r.supportedTypes)this.typeMapping.has(a)||this.typeMapping.set(a,[]),this.typeMapping.get(a).push(n),this.typeMapping.get(a).sort((o,s)=>{const l=this.widgets.get(o)?.priority||0;return(this.widgets.get(s)?.priority||0)-l})}unregister(n){const r=this.widgets.get(n);if(r&&(this.widgets.delete(n),r.supportedTypes))for(const a of r.supportedTypes){const o=this.typeMapping.get(a);if(o){const s=o.indexOf(n);s>=0&&o.splice(s,1),o.length===0&&this.typeMapping.delete(a)}}}get(n){return this.widgets.get(n)}getAll(){return new Map(this.widgets)}getForType(n){return(this.typeMapping.get(n)||[]).map(a=>this.widgets.get(a)).filter(Boolean)}findBestWidget(n){const r=dt.resolveWidget(n.definition,n.name);if(r?.widget){const o=this.widgets.get(r.widget);if(o)return{name:r.widget,registration:o,resolved:r}}const a=[];for(const[o,s]of this.widgets.entries())if(s.matcher)try{s.matcher(n)&&a.push({name:o,registration:s,priority:s.priority??0})}catch(l){console.warn(`Error in matcher for widget "${o}":`,l)}if(a.length>0){a.sort((s,l)=>l.priority-s.priority);const o=a[0];return{name:o.name,registration:o.registration,resolved:{widget:o.name,source:"heuristics"}}}if(typeof n.definition=="object"&&n.definition.type){const o=Array.isArray(n.definition.type)?n.definition.type[0]:n.definition.type,s=this.getForType(o);if(s.length>0){const l=this.typeMapping.get(o)[0];return{name:l,registration:s[0],resolved:{widget:l,source:"type-fallback"}}}}return null}}const Bt=new it;function Ot(e,n,r){return{factory:n,matcher:a=>{const s=a.definition["x:ui"];return s===e||typeof s=="object"&&s!==null&&s.widget===e},displayName:r?.displayName??e,priority:r?.priority??100,...r}}function Ut(e,n,r){return{factory:n,matcher:a=>a.definition.format===e,displayName:r?.displayName??`${e} widget`,priority:r?.priority??75,...r}}function Wt(e,n,r,a){return{factory:r,matcher:o=>{const s=o.definition;return s.type===e&&s.format===n},displayName:a?.displayName??`${e}:${n} widget`,priority:a?.priority??80,...a}}function Ht(e){const n=e?.logPrefix??"WIDGET_DIAG",r=e?.filterFn??(()=>!0);return{factory:()=>null,displayName:"Diagnostic Widget (never matches)",priority:-1e3,matcher:a=>{if(!r(a))return!1;const o=a.definition,s={name:a.name,path:a.path.map(String),type:o?.type,hasRegistry:a.widgetRegistry!==void 0,definition:o};return console.log(`[${n}] name="${s.name??"ROOT"}" path=[${s.path.join(", ")}] type="${s.type??"unknown"}" hasRegistry=${s.hasRegistry}`),e?.onProcess?.(s),!1}}}exports.Base64Input=yt;exports.Base64sInput=st;exports.ColorSwatchInput=wt;exports.EditableText=Vt;exports.NullableDateInput=Mt;exports.NullableDateTimeInput=xt;exports.NullableEmailInput=_t;exports.NullablePasswordInput=At;exports.NullableRatingInput=Rt;exports.NullableSliderInput=Et;exports.NullableTextArea=Tt;exports.NullableTextInput=Ct;exports.NullableUUIDInput=kt;exports.NullableUrlInput=Dt;exports.RatingInput=lt;exports.SliderInput=vt;exports.Switch=Ft;exports.WidgetRegistry=it;exports.createDiagnosticWidget=Ht;exports.emptyToNull=P;exports.fileToBase64=rt;exports.forFormat=Ut;exports.forTypeAndFormat=Wt;exports.forXUI=Ot;exports.formatColor=R;exports.getContrastRatio=ht;exports.globalWidgetRegistry=Bt;exports.hexToRgb=E;exports.hslToRgb=j;exports.hwbToRgb=tt;exports.isValidColor=gt;exports.isValidHexColor=q;exports.isValidHslColor=G;exports.isValidRgbColor=X;exports.isValidRgbaColor=Y;exports.linearToSrgb=U;exports.mulberry32=J;exports.normalizeHexColor=K;exports.nullToEmpty=ot;exports.oklchToRgb=nt;exports.parseAnyColor=Q;exports.resolveEffectiveFormat=v;exports.rgbToHex=W;exports.rgbToHsl=H;exports.rgbToHwb=et;exports.rgbToOklch=at;exports.srgbToLinear=O;exports.toRgbaString=Z;
|