@tempots/beatui 0.95.0 → 1.0.1

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 (239) hide show
  1. package/dist/{ar-BVXPzVJB.cjs → ar-CuI1Jgt6.cjs} +1 -1
  2. package/dist/{ar-B4jDJwHQ.js → ar-DaKbK_t8.js} +87 -11
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +1 -1
  5. package/dist/{auth-divider-BPwKk8MW.js → auth-divider-CbME_yVQ.js} +87 -86
  6. package/dist/auth-divider-MMhfmLBu.cjs +1 -0
  7. package/dist/beatui.css +1628 -545
  8. package/dist/beatui.tailwind.css +1628 -545
  9. package/dist/better-auth/index.cjs.js +1 -1
  10. package/dist/better-auth/index.es.js +6 -6
  11. package/dist/codehighlight/index.cjs.js +22 -0
  12. package/dist/codehighlight/index.es.js +76 -0
  13. package/dist/colors-B-p6IzX9.cjs +1 -0
  14. package/dist/{colors-BY0Ja_bf.js → colors-DwufPN8S.js} +18 -18
  15. package/dist/{de-Dd33yWzb.js → de-3MTPDS1i.js} +82 -6
  16. package/dist/{de-BdfPZskW.cjs → de-DthHehbh.cjs} +1 -1
  17. package/dist/{deep-merge-C8dSqIXI.js → deep-merge-BzIheQtH.js} +511 -517
  18. package/dist/deep-merge-EkjEgK0N.cjs +1 -0
  19. package/dist/{duration-input-IuFWywO5.cjs → duration-input-ClgYjeBa.cjs} +1 -1
  20. package/dist/{duration-input-DFZwkg6M.js → duration-input-DGzmIImj.js} +5 -5
  21. package/dist/{editor-toolbar-group-DiJFgGcI.js → editor-toolbar-group-Crlu1QJw.js} +3 -3
  22. package/dist/{editor-toolbar-group-BCBfu8pG.cjs → editor-toolbar-group-mkL4QozO.cjs} +1 -1
  23. package/dist/es-B6GJLk9h.cjs +1 -0
  24. package/dist/{es-jHMT3_7O.js → es-DwMUvBeU.js} +94 -18
  25. package/dist/{fa-eX3_BAZR.js → fa-0rvQiKrJ.js} +87 -11
  26. package/dist/{fa-BXnP4pbN.cjs → fa-BwgP93iV.cjs} +1 -1
  27. package/dist/{fr-Bj-GjMJm.js → fr-B4i6NzLl.js} +86 -10
  28. package/dist/{fr-HJDhGjI2.cjs → fr-CQzk5zqY.cjs} +1 -1
  29. package/dist/{he-DYgmPPkG.js → he-C71n-hsn.js} +87 -11
  30. package/dist/{he-C6nEVZhN.cjs → he-DcxxvRfs.cjs} +1 -1
  31. package/dist/{hi-DMVSXAJt.cjs → hi-D-KHVWg4.cjs} +1 -1
  32. package/dist/{hi-CgYLonE9.js → hi-xmrXpeVU.js} +87 -11
  33. package/dist/index-B5MAsOC-.cjs +1 -0
  34. package/dist/{index-B8cqD9ny.js → index-C3o9GSH6.js} +106 -105
  35. package/dist/index.cjs.js +4 -4
  36. package/dist/index.es.js +8055 -5285
  37. package/dist/input-container-BvEcp7FU.js +275 -0
  38. package/dist/input-container-Di1YvVB_.cjs +1 -0
  39. package/dist/{it-CO2BPqah.js → it-CDZTtOBC.js} +83 -7
  40. package/dist/{it-DhfVcjKb.cjs → it-D344Dutu.cjs} +1 -1
  41. package/dist/{ja-Bt6fGS_Q.cjs → ja-BNgnDZ27.cjs} +1 -1
  42. package/dist/{ja-BrzwjH8T.js → ja-Zz1LzidW.js} +91 -15
  43. package/dist/json-schema/index.cjs.js +1 -1
  44. package/dist/json-schema/index.es.js +261 -257
  45. package/dist/json-schema-display/index.cjs.js +1 -1
  46. package/dist/json-schema-display/index.es.js +2 -2
  47. package/dist/json-structure/index.cjs.js +1 -1
  48. package/dist/json-structure/index.es.js +132 -133
  49. package/dist/{ko-D-lJ4wYQ.js → ko-9laUsZDL.js} +90 -14
  50. package/dist/{ko-DfAaBGrz.cjs → ko-D-WJ9NK7.cjs} +1 -1
  51. package/dist/lexical/index.cjs.js +2 -39
  52. package/dist/lexical/index.es.js +2056 -20626
  53. package/dist/markdown/index.cjs.js +1 -1
  54. package/dist/markdown/index.es.js +41 -4
  55. package/dist/{menu-CV85y3Xf.js → menu-B8yoDMRS.js} +23 -23
  56. package/dist/menu-B92oSDct.cjs +1 -0
  57. package/dist/modal-BT0jjDqX.cjs +1 -0
  58. package/dist/{modal-CwZuWiSK.js → modal-DBguyX-b.js} +9 -9
  59. package/dist/monaco/index.cjs.js +2 -2
  60. package/dist/monaco/index.es.js +7 -7
  61. package/dist/{nl-CNWBQjK5.cjs → nl-CrqUlFie.cjs} +1 -1
  62. package/dist/{nl-ClsworIe.js → nl-Dcll9fVA.js} +86 -10
  63. package/dist/notice-B5wTXoTq.cjs +1 -0
  64. package/dist/{notice-D7hYFM5A.js → notice-BKcyJD5w.js} +37 -37
  65. package/dist/oneof-branch-detection-J_DYEEcD.js +1077 -0
  66. package/dist/oneof-branch-detection-ZUBZ6hqy.cjs +1 -0
  67. package/dist/{pl-CqHTeu3-.cjs → pl-9UksIrvX.cjs} +1 -1
  68. package/dist/{pl-WTwLAxnV.js → pl-Dm9N9Gbr.js} +83 -7
  69. package/dist/prosemirror/index.cjs.js +3 -1
  70. package/dist/prosemirror/index.es.js +636 -4
  71. package/dist/{pt-CgkjJnsG.js → pt-CFi5cn0k.js} +88 -12
  72. package/dist/{pt-BQmsiqbo.cjs → pt-_kfdzwqi.cjs} +1 -1
  73. package/dist/{ru-CtgH7OY9.js → ru-CEhZUw8R.js} +91 -15
  74. package/dist/{ru-CG56A2To.cjs → ru-CW1WNNlr.cjs} +1 -1
  75. package/dist/stack-BLMteGTn.js +15 -0
  76. package/dist/stack-dwLevGa2.cjs +1 -0
  77. package/dist/tailwind/preset.cjs.js +1 -1
  78. package/dist/tailwind/preset.es.js +2 -2
  79. package/dist/tailwind/vite-plugin.cjs.js +1 -1
  80. package/dist/tailwind/vite-plugin.es.js +1 -1
  81. package/dist/text-input-DfqXolVe.js +55 -0
  82. package/dist/text-input-X_q01NsY.cjs +1 -0
  83. package/dist/toolbar-DY0ax2Qd.js +130 -0
  84. package/dist/toolbar-DoKdYXIL.cjs +1 -0
  85. package/dist/{tr-DE7_VtKu.cjs → tr-B6GIRegf.cjs} +1 -1
  86. package/dist/{tr-D1O1vEmr.js → tr-ZmnVDhLP.js} +81 -5
  87. package/dist/{translations-yu4gNqlP.js → translations-A4kR7CW8.js} +1 -1
  88. package/dist/{translations-DyCmyLE_.js → translations-B1_yyDUK.js} +207 -129
  89. package/dist/{translations-DBxIjvWR.cjs → translations-C81buKAw.cjs} +1 -1
  90. package/dist/translations-Dbx7L7Q1.cjs +1 -0
  91. package/dist/types/beatui-i18n/default.d.ts +71 -0
  92. package/dist/types/beatui-i18n/locales/en.d.ts +71 -0
  93. package/dist/types/beatui-i18n/translations.d.ts +71 -0
  94. package/dist/types/codehighlight/code-highlight.d.ts +21 -0
  95. package/dist/types/codehighlight/index.d.ts +14 -0
  96. package/dist/types/components/button/toggle-button.d.ts +4 -4
  97. package/dist/types/components/data/avatar.d.ts +3 -1
  98. package/dist/types/components/data/badge.d.ts +10 -18
  99. package/dist/types/components/data/column-filter-panel.d.ts +31 -0
  100. package/dist/types/components/data/column-filter.d.ts +110 -0
  101. package/dist/types/components/data/column-header-menu.d.ts +42 -0
  102. package/dist/types/components/data/data-source.d.ts +190 -0
  103. package/dist/types/components/data/data-table-body.d.ts +12 -0
  104. package/dist/types/components/data/data-table-column-toggle.d.ts +4 -0
  105. package/dist/types/components/data/data-table-context.d.ts +53 -0
  106. package/dist/types/components/data/data-table-header.d.ts +6 -0
  107. package/dist/types/components/data/data-table-resolve.d.ts +26 -0
  108. package/dist/types/components/data/data-table-types.d.ts +201 -0
  109. package/dist/types/components/data/data-table.d.ts +38 -0
  110. package/dist/types/components/data/data-toolbar.d.ts +44 -0
  111. package/dist/types/components/data/date-picker-shared.d.ts +55 -0
  112. package/dist/types/components/data/date-picker.d.ts +58 -0
  113. package/dist/types/components/data/date-range-picker.d.ts +56 -0
  114. package/dist/types/components/data/filter.d.ts +268 -0
  115. package/dist/types/components/data/index.d.ts +13 -4
  116. package/dist/types/components/data/indicator.d.ts +41 -0
  117. package/dist/types/components/data/progress-bar.d.ts +2 -2
  118. package/dist/types/components/data/selection-checkbox.d.ts +63 -0
  119. package/dist/types/components/data/skeleton.d.ts +1 -1
  120. package/dist/types/components/data/sortable-header.d.ts +55 -0
  121. package/dist/types/components/data/unstyled-drop-zone.d.ts +2 -2
  122. package/dist/types/components/form/control/control.d.ts +9 -9
  123. package/dist/types/components/form/input/advanced-slider.d.ts +6 -6
  124. package/dist/types/components/form/input/appearance-selector.d.ts +9 -2
  125. package/dist/types/components/form/input/bigint-input.d.ts +3 -3
  126. package/dist/types/components/form/input/checkbox-input.d.ts +6 -7
  127. package/dist/types/components/form/input/color-input.d.ts +1 -1
  128. package/dist/types/components/form/input/color-swatch-input.d.ts +3 -3
  129. package/dist/types/components/form/input/combobox-input.d.ts +5 -5
  130. package/dist/types/components/form/input/combobox-tags-input.d.ts +5 -5
  131. package/dist/types/components/form/input/date-input.d.ts +4 -4
  132. package/dist/types/components/form/input/date-time-input.d.ts +4 -4
  133. package/dist/types/components/form/input/dropdown-input.d.ts +5 -5
  134. package/dist/types/components/form/input/editable-text.d.ts +2 -2
  135. package/dist/types/components/form/input/index.d.ts +1 -0
  136. package/dist/types/components/form/input/input-container.d.ts +1 -1
  137. package/dist/types/components/form/input/input-options.d.ts +28 -1
  138. package/dist/types/components/form/input/mask-input.d.ts +8 -2
  139. package/dist/types/components/form/input/native-select.d.ts +3 -3
  140. package/dist/types/components/form/input/nullable-bigint-input.d.ts +3 -3
  141. package/dist/types/components/form/input/nullable-date-input.d.ts +2 -2
  142. package/dist/types/components/form/input/nullable-date-time-input.d.ts +2 -2
  143. package/dist/types/components/form/input/nullable-rating-input.d.ts +8 -8
  144. package/dist/types/components/form/input/nullable-uuid-input.d.ts +4 -4
  145. package/dist/types/components/form/input/number-input.d.ts +3 -3
  146. package/dist/types/components/form/input/otp-input.d.ts +12 -12
  147. package/dist/types/components/form/input/rating-input.d.ts +7 -8
  148. package/dist/types/components/form/input/select-tags-input.d.ts +5 -5
  149. package/dist/types/components/form/input/switch.d.ts +2 -2
  150. package/dist/types/components/form/input/tri-state-checkbox-input.d.ts +82 -0
  151. package/dist/types/components/form/input/uuid-input.d.ts +2 -2
  152. package/dist/types/components/json-structure/controls/uuid-control.d.ts +1 -1
  153. package/dist/types/components/layout/card.d.ts +66 -0
  154. package/dist/types/components/layout/collapse.d.ts +2 -2
  155. package/dist/types/components/layout/flex.d.ts +26 -0
  156. package/dist/types/components/layout/index.d.ts +1 -0
  157. package/dist/types/components/lexical/floating/slash-command-palette.d.ts +2 -2
  158. package/dist/types/components/media/pdf-page-viewer.d.ts +8 -5
  159. package/dist/types/components/misc/index.d.ts +1 -0
  160. package/dist/types/components/misc/loading-overlay.d.ts +29 -0
  161. package/dist/types/components/misc/notice.d.ts +4 -4
  162. package/dist/types/components/misc/notification-provider.d.ts +9 -3
  163. package/dist/types/components/misc/notification.d.ts +9 -9
  164. package/dist/types/components/navigation/breadcrumbs.d.ts +1 -1
  165. package/dist/types/components/navigation/menu.d.ts +6 -6
  166. package/dist/types/components/navigation/pagination.d.ts +17 -4
  167. package/dist/types/components/navigation/sidebar/sidebar-link.d.ts +2 -2
  168. package/dist/types/components/navigation/tabs/tabs.d.ts +17 -8
  169. package/dist/types/components/navigation/toolbar/toolbar.d.ts +12 -6
  170. package/dist/types/components/overlay/announcement-bar.d.ts +12 -4
  171. package/dist/types/components/overlay/dialogs.d.ts +2 -2
  172. package/dist/types/components/overlay/modal.d.ts +9 -2
  173. package/dist/types/components/overlay/tooltip.d.ts +6 -6
  174. package/dist/types/components/theme/types.d.ts +15 -4
  175. package/dist/types/lexical/plugins/slash-commands.d.ts +1 -1
  176. package/dist/types/tokens/z-index.d.ts +18 -18
  177. package/dist/types/utils/use-animated-toggle.d.ts +12 -4
  178. package/dist/{ur-ZJgsSpG2.cjs → ur-CtFl_tz6.cjs} +1 -1
  179. package/dist/{ur-BcuB7IqE.js → ur-yYgj3NmT.js} +87 -11
  180. package/dist/use-animated-toggle-C3asw_Sg.js +207 -0
  181. package/dist/use-animated-toggle-cKcuItmz.cjs +1 -0
  182. package/dist/use-form-CaW192gw.cjs +2 -0
  183. package/dist/{use-form-CfxvyTfd.js → use-form-Dn6v2tEh.js} +153 -152
  184. package/dist/utils-DmEuG3Np.cjs +1 -0
  185. package/dist/utils-vUtP6iPG.js +165 -0
  186. package/dist/{vi-D0rQ3dIx.js → vi-D5u4CLQO.js} +88 -12
  187. package/dist/{vi-BOgLRkuK.cjs → vi-DyCZSpsk.cjs} +1 -1
  188. package/dist/widget-customization-B49MeU4E.cjs +1 -0
  189. package/dist/widget-customization-DEiQ_31d.js +1063 -0
  190. package/dist/{zh-DoYqiZO1.js → zh-B0kwMMer.js} +90 -14
  191. package/dist/{zh-BTZ8OZ4H.cjs → zh-C3ZxMQKb.cjs} +1 -1
  192. package/package.json +208 -37
  193. package/dist/_commonjsHelpers-DKOUU3wS.cjs +0 -1
  194. package/dist/_commonjsHelpers-DaMA6jEr.js +0 -8
  195. package/dist/auth-divider-BgaQ8ifw.cjs +0 -1
  196. package/dist/colors-BI0YhONJ.cjs +0 -1
  197. package/dist/deep-merge-ChJQbUKq.cjs +0 -1
  198. package/dist/es-C8TpneCm.cjs +0 -1
  199. package/dist/hls.light.min-C6xKDzRR.cjs +0 -27
  200. package/dist/hls.light.min-hEMf_E8u.js +0 -8311
  201. package/dist/index-1JaBwDB-.js +0 -921
  202. package/dist/index-CN10Cyqr.cjs +0 -1
  203. package/dist/index-CTcbhnPw.cjs +0 -4
  204. package/dist/index-DF7RFzD9.cjs +0 -1
  205. package/dist/index-D_zOXmU5.cjs +0 -36
  206. package/dist/index-DfPkCwdC.js +0 -2709
  207. package/dist/index-vowHNIPH.js +0 -14308
  208. package/dist/index-yOU4Ceaq.js +0 -68
  209. package/dist/index-zQ3IYJFH.cjs +0 -1
  210. package/dist/input-container-BWYHj0Iq.cjs +0 -1
  211. package/dist/input-container-DMoVdH6E.js +0 -263
  212. package/dist/menu-De_-sGeb.cjs +0 -1
  213. package/dist/modal-CiGmgsOI.cjs +0 -1
  214. package/dist/notice-CPZQuxcA.cjs +0 -1
  215. package/dist/oneof-branch-detection-BFxukD63.cjs +0 -8
  216. package/dist/oneof-branch-detection-izpPjBCR.js +0 -6290
  217. package/dist/stack-4VUGISn6.cjs +0 -1
  218. package/dist/stack-Bm-UZosx.js +0 -879
  219. package/dist/string-B9vVyfq3.cjs +0 -1
  220. package/dist/string-DYyMxBl-.js +0 -19
  221. package/dist/text-input-BLupB3cU.js +0 -45
  222. package/dist/text-input-M6WBhhVj.cjs +0 -1
  223. package/dist/timer-BJHOsuS6.cjs +0 -1
  224. package/dist/timer-Rd2sKnvH.js +0 -65
  225. package/dist/toolbar-Be1eU0qU.js +0 -118
  226. package/dist/toolbar-WWv5kcYG.cjs +0 -1
  227. package/dist/translations-OOsMRpX9.cjs +0 -1
  228. package/dist/types/components/data/calendar-shared.d.ts +0 -59
  229. package/dist/types/components/data/calendar.d.ts +0 -107
  230. package/dist/types/components/data/icon-badge.d.ts +0 -14
  231. package/dist/types/components/data/range-calendar.d.ts +0 -104
  232. package/dist/types/components/data/tag.d.ts +0 -51
  233. package/dist/use-animated-toggle-C7PTmnZi.js +0 -195
  234. package/dist/use-animated-toggle-DrqK7nUS.cjs +0 -1
  235. package/dist/use-form-ClA0ZRco.cjs +0 -2
  236. package/dist/utils-DEbsp9Q9.js +0 -129
  237. package/dist/utils-DIUEhA-Z.cjs +0 -1
  238. package/dist/widget-customization-CLZNGavL.js +0 -1042
  239. package/dist/widget-customization-DtEEo35Y.cjs +0 -1
@@ -1,1042 +0,0 @@
1
- import { Value as p, prop as rt, computedOf as D, html as _, attr as u, svg as tt, svgAttr as Y, Empty as A, on as M, When as W, Fragment as j, aria as N, emitValue as Z, Use as lt, input as ot, emitValueAsNullableDate as et, emitValueAsNullableDateTime as nt, Repeat as ut, style as pt, emit as dt, emitValueAsNumber as V } from "@tempots/dom";
2
- import { F as ht, N as z, T as gt, U as ft, a as mt } from "./deep-merge-C8dSqIXI.js";
3
- import { $ as bt } from "./string-DYyMxBl-.js";
4
- import { I as E } from "./input-container-DMoVdH6E.js";
5
- import { C as U, T as wt } from "./text-input-BLupB3cU.js";
6
- import { B as yt, I as q, b as st, a as It } from "./translations-DyCmyLE_.js";
7
- import { AutoSelect as Mt } from "@tempots/ui";
8
- import { E as $t, P as xt } from "./notice-D7hYFM5A.js";
9
- import { s as _t } from "./session-id-3KiilioY.js";
10
- import { r as kt } from "./utils-DEbsp9Q9.js";
11
- function it(t) {
12
- if (typeof t != "string") return !1;
13
- const e = t.startsWith("#") ? t.slice(1) : t;
14
- return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(e);
15
- }
16
- function Ft(t) {
17
- if (typeof t != "string") return !1;
18
- const e = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i, a = t.match(e);
19
- if (!a) return !1;
20
- const [, n, r, s] = a, o = parseInt(n, 10), i = parseInt(r, 10), c = parseInt(s, 10);
21
- return o >= 0 && o <= 255 && i >= 0 && i <= 255 && c >= 0 && c <= 255;
22
- }
23
- function Ct(t) {
24
- if (typeof t != "string") return !1;
25
- const e = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i, a = t.match(e);
26
- if (!a) return !1;
27
- const [, n, r, s, o] = a, i = parseInt(n, 10), c = parseInt(r, 10), l = parseInt(s, 10), d = parseFloat(o);
28
- return i >= 0 && i <= 255 && c >= 0 && c <= 255 && l >= 0 && l <= 255 && d >= 0 && d <= 1;
29
- }
30
- function Tt(t) {
31
- if (typeof t != "string") return !1;
32
- const e = /^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i, a = t.match(e);
33
- if (!a) return !1;
34
- const [, n, r, s] = a, o = parseInt(n, 10), i = parseInt(r, 10), c = parseInt(s, 10);
35
- return o >= 0 && o <= 360 && i >= 0 && i <= 100 && c >= 0 && c <= 100;
36
- }
37
- function re(t) {
38
- return it(t) || Ft(t) || Ct(t) || Tt(t);
39
- }
40
- function At(t) {
41
- if (!it(t)) return null;
42
- let e = t.startsWith("#") ? t.slice(1) : t;
43
- return e.length === 3 && (e = e.split("").map((a) => a + a).join("")), `#${e.toLowerCase()}`;
44
- }
45
- function Q(t, e, a) {
46
- const n = (r) => {
47
- const s = Math.round(Math.max(0, Math.min(255, r))).toString(16);
48
- return s.length === 1 ? "0" + s : s;
49
- };
50
- return `#${n(t)}${n(e)}${n(a)}`;
51
- }
52
- function H(t) {
53
- const e = At(t);
54
- if (!e) return null;
55
- const a = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
56
- return a ? {
57
- r: parseInt(a[1], 16),
58
- g: parseInt(a[2], 16),
59
- b: parseInt(a[3], 16)
60
- } : null;
61
- }
62
- function oe(t, e) {
63
- const a = H(t), n = H(e);
64
- if (!a || !n) return null;
65
- const r = (l, d, f) => {
66
- const [m, g, b] = [l, d, f].map((I) => (I = I / 255, I <= 0.03928 ? I / 12.92 : Math.pow((I + 0.055) / 1.055, 2.4)));
67
- return 0.2126 * m + 0.7152 * g + 0.0722 * b;
68
- }, s = r(a.r, a.g, a.b), o = r(n.r, n.g, n.b), i = Math.max(s, o), c = Math.min(s, o);
69
- return (i + 0.05) / (c + 0.05);
70
- }
71
- function St(t) {
72
- if (!t) return [0, 0, 0, 1];
73
- const a = t.trim().match(
74
- /^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/
75
- );
76
- if (a) {
77
- const l = a[1];
78
- if (l.length === 8) {
79
- const d = parseInt(l.slice(0, 2), 16), f = parseInt(l.slice(2, 4), 16), m = parseInt(l.slice(4, 6), 16), g = parseInt(l.slice(6, 8), 16) / 255;
80
- return [d, f, m, g];
81
- }
82
- if (l.length === 6)
83
- return [
84
- parseInt(l.slice(0, 2), 16),
85
- parseInt(l.slice(2, 4), 16),
86
- parseInt(l.slice(4, 6), 16),
87
- 1
88
- ];
89
- if (l.length === 4) {
90
- const d = parseInt(l[0] + l[0], 16), f = parseInt(l[1] + l[1], 16), m = parseInt(l[2] + l[2], 16), g = parseInt(l[3] + l[3], 16) / 255;
91
- return [d, f, m, g];
92
- }
93
- if (l.length === 3) {
94
- const d = parseInt(l[0] + l[0], 16), f = parseInt(l[1] + l[1], 16), m = parseInt(l[2] + l[2], 16);
95
- return [d, f, m, 1];
96
- }
97
- }
98
- const n = t.match(
99
- /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i
100
- );
101
- if (n)
102
- return [
103
- parseInt(n[1], 10),
104
- parseInt(n[2], 10),
105
- parseInt(n[3], 10),
106
- parseFloat(n[4])
107
- ];
108
- const r = t.match(
109
- /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i
110
- );
111
- if (r)
112
- return [parseInt(r[1], 10), parseInt(r[2], 10), parseInt(r[3], 10), 1];
113
- const s = t.match(
114
- /^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i
115
- );
116
- if (s) {
117
- const l = parseFloat(s[1]), d = parseFloat(s[2]), f = parseFloat(s[3]), m = s[4] != null ? parseFloat(s[4]) : 1, [g, b, I] = ct(l, d / 100, f / 100);
118
- return [g, b, I, m];
119
- }
120
- const o = t.match(
121
- /^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i
122
- );
123
- if (o) {
124
- const l = parseFloat(o[1]), d = parseFloat(o[2]) / 100, f = parseFloat(o[3]) / 100, m = o[4] != null ? parseFloat(o[4]) : 1, [g, b, I] = Nt(l, d, f);
125
- return [g, b, I, m];
126
- }
127
- const i = t.match(
128
- /^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i
129
- );
130
- if (i) {
131
- const l = i[1], d = parseFloat(i[2]), f = parseFloat(i[3]), m = i[4] != null ? parseFloat(i[4]) : 1, g = l.endsWith("%") ? Math.max(0, Math.min(1, parseFloat(l) / 100)) : Math.max(0, Math.min(1, parseFloat(l))), [b, I, x] = Bt(g, d, f);
132
- return [b, I, x, m];
133
- }
134
- const c = H(t);
135
- return c ? [c.r, c.g, c.b, 1] : [0, 0, 0, 1];
136
- }
137
- function vt(t, e, a, n) {
138
- return `rgba(${Math.round(t)}, ${Math.round(e)}, ${Math.round(a)}, ${Math.max(
139
- 0,
140
- Math.min(1, Math.round(n * 100) / 100)
141
- )})`;
142
- }
143
- function Rt(t) {
144
- let e = t + 1831565813;
145
- return function() {
146
- return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
147
- };
148
- }
149
- function ct(t, e, a) {
150
- t = (t % 360 + 360) % 360;
151
- const n = (1 - Math.abs(2 * a - 1)) * e, r = n * (1 - Math.abs(t / 60 % 2 - 1)), s = a - n / 2;
152
- let o, i, c;
153
- return 0 <= t && t < 60 ? [o, i, c] = [n, r, 0] : 60 <= t && t < 120 ? [o, i, c] = [r, n, 0] : 120 <= t && t < 180 ? [o, i, c] = [0, n, r] : 180 <= t && t < 240 ? [o, i, c] = [0, r, n] : 240 <= t && t < 300 ? [o, i, c] = [r, 0, n] : [o, i, c] = [n, 0, r], [
154
- Math.round((o + s) * 255),
155
- Math.round((i + s) * 255),
156
- Math.round((c + s) * 255)
157
- ];
158
- }
159
- function Nt(t, e, a) {
160
- t = (t % 360 + 360) % 360;
161
- const n = e + a;
162
- n > 1 && (e /= n, a /= n);
163
- const [r, s, o] = ct(t, 1, 0.5).map((f) => f / 255), i = 1 - e - a, c = r * i + e, l = s * i + e, d = o * i + e;
164
- return [Math.round(c * 255), Math.round(l * 255), Math.round(d * 255)];
165
- }
166
- function J(t, e, a) {
167
- t /= 255, e /= 255, a /= 255;
168
- const n = Math.max(t, e, a), r = Math.min(t, e, a);
169
- let s = 0, o = 0;
170
- const i = (n + r) / 2, c = n - r;
171
- if (c !== 0) {
172
- switch (o = i > 0.5 ? c / (2 - n - r) : c / (n + r), n) {
173
- case t:
174
- s = (e - a) / c + (e < a ? 6 : 0);
175
- break;
176
- case e:
177
- s = (a - t) / c + 2;
178
- break;
179
- default:
180
- s = (t - e) / c + 4;
181
- }
182
- s *= 60;
183
- }
184
- return [Math.round(s), Math.round(o * 100), Math.round(i * 100)];
185
- }
186
- function Dt(t, e, a) {
187
- const [n] = J(t, e, a), r = t / 255, s = e / 255, o = a / 255, i = Math.min(r, s, o), c = 1 - Math.max(r, s, o);
188
- return [n, Math.round(i * 100), Math.round(c * 100)];
189
- }
190
- function G(t) {
191
- const e = t / 255;
192
- return e <= 0.04045 ? e / 12.92 : Math.pow((e + 0.055) / 1.055, 2.4);
193
- }
194
- function K(t) {
195
- const e = t <= 31308e-7 ? 12.92 * t : 1.055 * Math.pow(t, 0.4166666666666667) - 0.055;
196
- return Math.round(Math.max(0, Math.min(1, e)) * 255);
197
- }
198
- function Bt(t, e, a) {
199
- const n = a * Math.PI / 180, r = Math.cos(n) * e, s = Math.sin(n) * e, o = t + 0.3963377774 * r + 0.2158037573 * s, i = t - 0.1055613458 * r - 0.0638541728 * s, c = t - 0.0894841775 * r - 1.291485548 * s, l = o * o * o, d = i * i * i, f = c * c * c, m = 4.0767416621 * l - 3.3077115913 * d + 0.2309699292 * f, g = -1.2684380046 * l + 2.6097574011 * d - 0.3413193965 * f, b = -0.0041960863 * l - 0.7034186147 * d + 1.707614701 * f;
200
- return [K(m), K(g), K(b)];
201
- }
202
- function Vt(t, e, a) {
203
- const n = G(t), r = G(e), s = G(a), o = 0.4122214708 * n + 0.5363325363 * r + 0.0514459929 * s, i = 0.2119034982 * n + 0.6806995451 * r + 0.1073969566 * s, c = 0.0883024619 * n + 0.2817188376 * r + 0.6299787005 * s, l = Math.cbrt(o), d = Math.cbrt(i), f = Math.cbrt(c), m = 0.2104542553 * l + 0.793617785 * d - 0.0040720468 * f, g = 1.9779984951 * l - 2.428592205 * d + 0.4505937099 * f, b = 0.0259040371 * l + 0.7827717662 * d - 0.808675766 * f, I = Math.sqrt(g * g + b * b);
204
- let x = Math.atan2(b, g) * 180 / Math.PI;
205
- return x < 0 && (x += 360), [m, I, x];
206
- }
207
- function P(t, e, a, n, r, s) {
208
- switch (r) {
209
- case "hex":
210
- if (s) {
211
- const o = (c) => c.toString(16).padStart(2, "0"), i = Math.max(0, Math.min(255, Math.round(n * 255)));
212
- return `#${o(t)}${o(e)}${o(a)}${o(i)}`;
213
- }
214
- return Q(t, e, a);
215
- case "rgb":
216
- return `rgb(${t}, ${e}, ${a})`;
217
- case "rgba":
218
- return `rgba(${t}, ${e}, ${a}, ${Math.round(n * 100) / 100})`;
219
- case "hsl": {
220
- const [o, i, c] = J(t, e, a);
221
- return `hsl(${o}, ${i}%, ${c}%)`;
222
- }
223
- case "hsla": {
224
- const [o, i, c] = J(t, e, a);
225
- return `hsla(${o}, ${i}%, ${c}%, ${Math.round(n * 100) / 100})`;
226
- }
227
- case "hwb": {
228
- const [o, i, c] = Dt(t, e, a);
229
- return n < 1 ? `hwb(${o} ${i}% ${c}% / ${Math.round(n * 100) / 100})` : `hwb(${o} ${i}% ${c}%)`;
230
- }
231
- case "oklch": {
232
- const [o, i, c] = Vt(t, e, a), l = (Math.round(o * 1e3) / 1e3).toFixed(3), d = (Math.round(i * 1e3) / 1e3).toFixed(3), f = (Math.round(c * 10) / 10).toFixed(1), m = Math.round(n * 100) / 100;
233
- return s || n < 1 ? `oklch(${l} ${d} ${f} / ${m})` : `oklch(${l} ${d} ${f})`;
234
- }
235
- }
236
- }
237
- function O(t, e) {
238
- return e ? t === "rgb" ? "rgba" : t === "hsl" ? "hsla" : t : t === "rgba" ? "rgb" : t === "hsla" ? "hsl" : t;
239
- }
240
- async function Et(t) {
241
- return new Promise((e, a) => {
242
- const n = new FileReader();
243
- n.readAsDataURL(t), n.onload = () => {
244
- const r = n.result;
245
- e(r.split(",")[1]);
246
- }, n.onerror = (r) => a(r);
247
- });
248
- }
249
- function Ut(t) {
250
- return Promise.all(t.map(Et));
251
- }
252
- function Lt(t) {
253
- if (t.length >= 4) {
254
- if (t[0] === 137 && t[1] === 80 && t[2] === 78 && t[3] === 71)
255
- return "image/png";
256
- if (t[0] === 255 && t[1] === 216) return "image/jpeg";
257
- if (t[0] === 71 && t[1] === 73 && t[2] === 70)
258
- return "image/gif";
259
- if (t[0] === 82 && t[1] === 73 && t[2] === 70 && t[3] === 70 && t.length >= 12 && t[8] === 87 && t[9] === 69 && t[10] === 66 && t[11] === 80)
260
- return "image/webp";
261
- }
262
- try {
263
- if (new TextDecoder("utf-8").decode(t.slice(0, 256)).includes("<svg")) return "image/svg+xml";
264
- } catch {
265
- }
266
- return "application/octet-stream";
267
- }
268
- function Pt(t) {
269
- const e = bt(t ?? ""), a = e.length, n = new Uint8Array(a);
270
- for (let r = 0; r < a; r++) n[r] = e.charCodeAt(r);
271
- return n;
272
- }
273
- function Ot(t) {
274
- const {
275
- value: e,
276
- onChange: a,
277
- onInput: n,
278
- ...r
279
- } = t, s = /* @__PURE__ */ new Map(), o = p.toSignal(e).map((d) => d.map((f, m) => {
280
- const g = s.get(f), b = Pt(f ?? ""), I = g?.type || Lt(b), x = g?.name ?? `file-${m}`, y = b.buffer.slice(
281
- b.byteOffset,
282
- b.byteOffset + b.byteLength
283
- ), F = new Blob([y], { type: I });
284
- return new File([F], x, { type: I });
285
- })), i = (d) => (f) => {
286
- d && Ut(f).then((m) => {
287
- for (const [g, b] of m.entries())
288
- s.set(b, { name: f[g].name, type: f[g].type });
289
- d(m);
290
- });
291
- }, c = i(a), l = i(n);
292
- return ht({
293
- ...r,
294
- value: o,
295
- onChange: c,
296
- onInput: l
297
- });
298
- }
299
- function ie(t) {
300
- const {
301
- value: e,
302
- onInput: a,
303
- onChange: n,
304
- ...r
305
- } = t;
306
- return Ot({
307
- ...r,
308
- maxFiles: 1,
309
- value: p.map(e, (s) => s == null ? [] : [s]),
310
- onChange: (s) => {
311
- n?.(s[0]);
312
- },
313
- onInput: (s) => {
314
- a?.(s[0]);
315
- }
316
- });
317
- }
318
- function Wt(t, e) {
319
- const [a, n, r] = t, s = a << 16 ^ n << 8 ^ r, o = Rt(s), i = 6 + Math.floor(o() * 5), c = 0.18 + o() * 0.06, l = [];
320
- for (let g = 0; g < i; g++) {
321
- const b = g / i * Math.PI * 2, I = e * (1 + (o() * 2 - 1) * c), x = Math.cos(b) * I, y = Math.sin(b) * I;
322
- l.push({ x, y });
323
- }
324
- const d = (l[0].x + l[i - 1].x) / 2, f = (l[0].y + l[i - 1].y) / 2;
325
- let m = `M ${d.toFixed(3)} ${f.toFixed(3)}`;
326
- for (let g = 0; g < i; g++) {
327
- const b = l[g], I = l[(g + 1) % i], x = (b.x + I.x) / 2, y = (b.y + I.y) / 2;
328
- m += ` Q ${b.x.toFixed(3)} ${b.y.toFixed(3)} ${x.toFixed(3)} ${y.toFixed(3)}`;
329
- }
330
- return m += " Z", m;
331
- }
332
- const ce = (t) => {
333
- const { value: e, onBlur: a, onChange: n, onInput: r, displayValue: s, size: o, withAlpha: i } = t, c = p.map(o ?? 32, (h) => h), l = p.map(e, (h) => St(h ?? "#000000")), d = p.map(
334
- l,
335
- ([h, $, k]) => [h, $, k]
336
- ), f = p.map(l, ([, , , h]) => h), m = rt(p.get(f) ?? 1), g = p.map(i ?? !1, (h) => h), b = p.map(
337
- t.colorTextFormat ?? "rgb",
338
- (h) => h
339
- ), I = D(
340
- d,
341
- m,
342
- b,
343
- g
344
- )(
345
- ([h, $, k], T, v, R) => P(h, $, k, T ?? 1, O(v, R), R)
346
- ), x = p.map(
347
- t.colorTextFormat ?? "hex",
348
- (h) => h
349
- ), y = p.map(c, (h) => `${-h / 2} ${-h / 2} ${h} ${h}`), F = D(
350
- d,
351
- c
352
- )((h, $) => Wt(h, $ / 2)), w = D(
353
- d,
354
- m,
355
- g
356
- )(
357
- ([h, $, k], T, v) => v || T < 1 ? vt(h, $, k, T) : Q(h, $, k)
358
- ), S = _.div(
359
- u.class("bc-color-swatch-input__control"),
360
- u.class(
361
- p.map(
362
- g,
363
- (h) => h ? "bc-color-swatch-input__control--alpha" : ""
364
- )
365
- ),
366
- u.style(
367
- D(c)((h) => `min-width:${h + 2}px;height:${h + 2}px`)
368
- ),
369
- // The SVG blob preview
370
- tt.svg(
371
- u.class("bc-color-swatch-input__svg"),
372
- Y.viewBox(y),
373
- tt.path(Y.d(F), Y.fill(w))
374
- ),
375
- // Invisible native input overlays the blob for picker and accessibility
376
- _.input(
377
- u.type("color"),
378
- U(t),
379
- // Native color input needs hex without alpha
380
- u.value(p.map(d, ([h, $, k]) => Q(h, $, k))),
381
- u.class(
382
- "bc-input bc-color-swatch-input bc-color-swatch-input__native"
383
- ),
384
- a != null ? M.blur(a) : A,
385
- n != null ? M.change((h) => {
386
- const $ = h.target.value;
387
- if (!n) return;
388
- const { r: k, g: T, b: v } = H($) ?? { r: 0, g: 0, b: 0 }, R = p.get(m) ?? 1, B = O(
389
- p.get(x),
390
- p.get(g)
391
- ), X = P(k, T, v, R, B, p.get(g));
392
- n(X);
393
- }) : A,
394
- r != null ? M.input((h) => {
395
- const $ = h.target.value;
396
- if (!r) return;
397
- const { r: k, g: T, b: v } = H($) ?? { r: 0, g: 0, b: 0 }, R = p.get(m) ?? 1, B = O(
398
- p.get(x),
399
- p.get(g)
400
- ), X = P(k, T, v, R, B, p.get(g));
401
- r(X);
402
- }) : A
403
- )
404
- ), C = W(
405
- g,
406
- () => _.input(
407
- u.type("range"),
408
- u.class("bc-color-swatch-input__alpha"),
409
- u.min(0),
410
- u.max(1),
411
- u.step(0.01),
412
- u.value(p.map(m, (h) => String(h ?? 1))),
413
- u.disabled(t.disabled),
414
- M.input((h) => {
415
- const $ = parseFloat(h.target.value);
416
- m.set($);
417
- const [k, T, v] = p.get(d), R = O(
418
- p.get(x),
419
- p.get(g)
420
- ), B = P(k, T, v, $, R, p.get(g));
421
- r?.(B);
422
- }),
423
- M.change((h) => {
424
- const $ = parseFloat(h.target.value);
425
- m.set($);
426
- const [k, T, v] = p.get(d), R = O(
427
- p.get(x),
428
- p.get(g)
429
- ), B = P(k, T, v, $, R, p.get(g));
430
- n?.(B);
431
- })
432
- )
433
- );
434
- return E({
435
- baseContainer: !0,
436
- ...t,
437
- // ensure our control does not try to grow
438
- growInput: !1,
439
- input: S,
440
- // If caller provided an `after`, append RGB before it
441
- after: j(
442
- W(
443
- s ?? !1,
444
- () => _.span(u.class("bc-color-swatch-input__rgb"), I)
445
- ),
446
- C,
447
- t.after
448
- )
449
- });
450
- }, at = (t) => typeof t == "string" && t.trim() === "" ? null : t, Ht = (t) => t ?? "";
451
- function L(t) {
452
- return (e) => {
453
- const { value: a, onBlur: n, onChange: r, onInput: s, after: o, disabled: i, ...c } = e, l = z(a, i, r ?? s);
454
- return t({
455
- ...c,
456
- disabled: i,
457
- value: p.map(a, Ht),
458
- onChange: r != null ? (d) => r(at(d)) : void 0,
459
- onInput: s != null ? (d) => s(at(d)) : void 0,
460
- onBlur: n,
461
- after: o != null ? j(l, o) : l
462
- });
463
- };
464
- }
465
- const le = ({
466
- startEditing: t,
467
- value: e,
468
- onChange: a,
469
- placeholder: n,
470
- disabled: r
471
- }) => {
472
- const s = p.deriveProp(t ?? !1), o = rt(!1), i = p.map(r ?? !1, (c) => c);
473
- return _.div(
474
- u.class("bc-editable-text"),
475
- u.class(
476
- p.map(
477
- i,
478
- (c) => c ? "bc-editable-text--disabled" : ""
479
- )
480
- ),
481
- N.disabled(i),
482
- W(
483
- s,
484
- () => _.input(
485
- u.placeholder(n),
486
- u.value(e),
487
- u.class("bc-editable-text__input"),
488
- Mt(),
489
- M.keydown((c) => {
490
- c.key === "Enter" ? s.set(!1) : c.key === "Escape" && (o.set(!0), s.set(!1));
491
- }),
492
- M.blur(
493
- Z((c) => {
494
- if (s.set(!1), o.value) {
495
- o.set(!1);
496
- return;
497
- }
498
- a(c);
499
- })
500
- )
501
- ),
502
- () => _.span(
503
- M.click(() => {
504
- p.get(i) || s.set(!0);
505
- }),
506
- u.class("bc-editable-text__display"),
507
- W(
508
- p.map(e, (c) => c != null && c.trim() !== ""),
509
- () => _.span(u.class("bc-editable-text__text"), e),
510
- () => _.span(
511
- u.class("bc-editable-text__placeholder"),
512
- n
513
- )
514
- ),
515
- W(
516
- p.map(i, (c) => !c),
517
- () => _.button(
518
- u.type("button"),
519
- u.class("bc-editable-text__edit-button"),
520
- lt(yt, (c) => N.label(c.$.editLabel)),
521
- M.click(() => s.set(!0)),
522
- q({ icon: "line-md/pencil", color: "neutral" })
523
- )
524
- )
525
- )
526
- )
527
- );
528
- }, ue = (t) => {
529
- const { value: e, onBlur: a, onChange: n, onInput: r, after: s, disabled: o } = t, i = z(e, o, n ?? r);
530
- return E({
531
- ...t,
532
- input: ot.date(
533
- U(t),
534
- u.valueAsDate(e),
535
- u.class("bc-input"),
536
- a != null ? M.blur(Z(a)) : A,
537
- n != null ? M.change(et(n)) : A,
538
- r != null ? M.input(et(r)) : A
539
- ),
540
- after: s != null ? j(i, s) : i
541
- });
542
- }, jt = (t) => {
543
- const e = t.getFullYear(), a = t.getMonth() + 1, n = t.getDate(), r = t.getHours(), s = t.getMinutes(), o = t.getSeconds();
544
- return `${e}-${a.toString().padStart(2, "0")}-${n.toString().padStart(2, "0")}T${r.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}`;
545
- }, pe = (t) => {
546
- const { value: e, onBlur: a, onChange: n, onInput: r, after: s, disabled: o } = t, i = p.map(e, (l) => l != null ? jt(l) : null), c = z(e, o, n ?? r);
547
- return E({
548
- ...t,
549
- input: ot["datetime-local"](
550
- U(t),
551
- u.value(p.map(i, (l) => l ?? null)),
552
- u.class("bc-input"),
553
- a != null ? M.blur(Z(a)) : A,
554
- n != null ? M.change(nt(n)) : A,
555
- r != null ? M.input(nt(r)) : A
556
- ),
557
- after: s != null ? j(c, s) : c
558
- });
559
- }, de = L($t), he = L(wt), ge = L(xt), fe = L(
560
- gt
561
- ), me = ({
562
- value: t,
563
- onChange: e,
564
- onInput: a,
565
- onBlur: n,
566
- offLabel: r,
567
- onLabel: s,
568
- disabled: o = !1,
569
- size: i = "md",
570
- id: c,
571
- color: l = "primary",
572
- tabIndex: d = 0,
573
- matchInputHeight: f = !0
574
- }) => {
575
- const m = c ?? _t("switch");
576
- function g(y, F) {
577
- const w = [
578
- "bc-switch",
579
- `bc-switch--size-${F}`,
580
- `bc-switch--${F}`
581
- ];
582
- return f && w.push("bc-switch--match-input"), y && w.push("bc-switch--disabled"), w.join(" ");
583
- }
584
- function b(y) {
585
- const F = y ?? "primary", w = /* @__PURE__ */ new Map(), S = st(F, "solid", "light"), C = st(F, "solid", "dark");
586
- return w.set("--switch-track-on-bg", S.backgroundColor), w.set("--switch-track-on-label", S.textColor), w.set("--switch-track-on-bg-dark", C.backgroundColor), w.set("--switch-track-on-label-dark", C.textColor), w.set(
587
- "--switch-track-on-border-dark",
588
- It(F, "dark")
589
- ), Array.from(w.entries()).map(([h, $]) => `${h}: ${$}`).join("; ");
590
- }
591
- const I = () => {
592
- p.get(o) || (e?.(!p.get(t)), a?.(!p.get(t)));
593
- }, x = (y) => {
594
- p.get(o) || (y.key === " " || y.key === "Enter") && (y.preventDefault(), I());
595
- };
596
- return _.div(
597
- u.class(
598
- D(
599
- o ?? !1,
600
- i
601
- )(
602
- (y, F) => g(y ?? !1, F ?? "md")
603
- )
604
- ),
605
- u.style(
606
- D(l)(
607
- (y) => b(y)
608
- )
609
- ),
610
- u.id(m),
611
- u.role("switch"),
612
- u.tabindex(
613
- D(
614
- o ?? !1,
615
- d
616
- )((y, F) => y ? -1 : F ?? 0)
617
- ),
618
- N.checked(t),
619
- N.disabled(o),
620
- M.click(I),
621
- M.keydown(x),
622
- n != null ? M.blur(n) : null,
623
- _.div(
624
- u.class("bc-switch__track"),
625
- u.class(
626
- p.map(
627
- t,
628
- (y) => y ? "bc-switch__track--on" : "bc-switch__track--off"
629
- )
630
- ),
631
- r != null ? _.div(
632
- N.hidden(!0),
633
- u.class("bc-switch__track-label bc-switch__track-label--off"),
634
- u.class(
635
- p.map(
636
- t,
637
- (y) => y ? "bc-switch__track-label--hidden" : "bc-switch__track-label--visible"
638
- )
639
- ),
640
- r
641
- ) : null,
642
- s != null ? _.div(
643
- u.class("bc-switch__track-label bc-switch__track-label--on"),
644
- u.class(
645
- p.map(
646
- t,
647
- (y) => y ? "bc-switch__track-label--visible" : "bc-switch__track-label--hidden"
648
- )
649
- ),
650
- s
651
- ) : null,
652
- _.div(
653
- u.class("bc-switch__thumb"),
654
- u.class(
655
- p.map(
656
- t,
657
- (y) => y ? "bc-switch__thumb--on" : "bc-switch__thumb--off"
658
- )
659
- )
660
- )
661
- )
662
- );
663
- }, be = L(ft), zt = "line-md:star-alt-filled", Xt = "line-md:star-alt", Yt = (t) => {
664
- const {
665
- value: e,
666
- onChange: a,
667
- onInput: n,
668
- disabled: r,
669
- max: s = 5,
670
- fullColor: o = "yellow",
671
- emptyColor: i = "neutral",
672
- fullIcon: c = zt,
673
- emptyIcon: l = Xt,
674
- size: d = "md",
675
- onBlur: f,
676
- rounding: m = 1
677
- } = t, g = () => {
678
- const w = p.get(m);
679
- return w > 0 ? w : 1;
680
- }, b = (w) => Math.min(Math.max(w, 0), p.get(s)), I = (w, S) => {
681
- if (p.get(r ?? !1)) return;
682
- const h = w.currentTarget.getBoundingClientRect(), $ = (w.clientX - h.left) / h.width, k = S - 1 + $, T = g(), v = Math.ceil(k / T) * T, R = b(v);
683
- a?.(R), n?.(R);
684
- }, x = (w) => {
685
- if (p.get(r ?? !1)) return;
686
- const S = g(), C = p.get(e) ?? 0;
687
- let h;
688
- switch (w.key) {
689
- case "ArrowRight":
690
- case "ArrowUp":
691
- h = b(C + S);
692
- break;
693
- case "ArrowLeft":
694
- case "ArrowDown":
695
- h = b(C - S);
696
- break;
697
- case "Home":
698
- h = 0;
699
- break;
700
- case "End":
701
- h = p.get(s);
702
- break;
703
- default:
704
- return;
705
- }
706
- w.preventDefault(), a?.(h), n?.(h);
707
- }, y = p.map(d, (w) => `bc-icon--${w}`), F = ({ index: w, counter: S }) => _.span(
708
- u.class("bc-rating-input__icon-container"),
709
- u.class(y),
710
- q(
711
- {
712
- icon: l,
713
- size: d,
714
- color: i,
715
- tone: "soft"
716
- },
717
- u.class("bc-rating-input__icon-empty")
718
- ),
719
- _.span(
720
- u.class("bc-rating-input__icon-clipper"),
721
- u.class(y),
722
- pt.width(
723
- p.map(e, (C) => {
724
- const h = Math.floor(C);
725
- return h > w ? "100%" : h < w ? "0%" : `${(C - w) * 100}%`;
726
- })
727
- ),
728
- q(
729
- {
730
- icon: c,
731
- size: d,
732
- color: o,
733
- tone: "soft"
734
- },
735
- u.class("bc-rating-input__icon-full")
736
- )
737
- ),
738
- M.click(
739
- dt((C) => I(C, S), {
740
- preventDefault: !0,
741
- stopPropagation: !0
742
- })
743
- )
744
- );
745
- return E({
746
- baseContainer: !0,
747
- growInput: !1,
748
- focusableSelector: '[role="slider"]',
749
- ...t,
750
- input: _.div(
751
- // Common input attributes (id, required, invalid, custom classes, etc.)
752
- U(t),
753
- u.class("bc-rating-input"),
754
- // ARIA slider semantics
755
- u.role("slider"),
756
- u.tabindex(p.map(r ?? !1, (w) => w ? -1 : 0)),
757
- N.disabled(r ?? !1),
758
- N.valuemin(0),
759
- N.valuemax(p.map(s, (w) => w ?? 0)),
760
- N.valuenow(p.map(e, (w) => w ?? 0)),
761
- N.valuetext(
762
- D(
763
- e,
764
- s
765
- )((w, S) => {
766
- const C = w ?? 0, h = S ?? 0;
767
- return `${String(C)} / ${String(h)}`;
768
- })
769
- ),
770
- // Keyboard & focus handlers
771
- M.keydown(x),
772
- f != null ? M.blur(f) : null,
773
- ut(s, F)
774
- )
775
- });
776
- }, we = (t) => {
777
- const { value: e, onChange: a, onInput: n, onBlur: r, after: s, disabled: o, ...i } = t, c = z(e, o, a ?? n);
778
- return Yt({
779
- ...i,
780
- // Map null -> 0 for display so the control shows as empty when null
781
- value: p.map(e, (l) => l ?? 0),
782
- // Pass through numeric changes; clear button will call onChange(null)
783
- onChange: a,
784
- onInput: n,
785
- onBlur: r,
786
- after: s != null ? j(c, s) : c
787
- });
788
- }, ye = (t) => {
789
- const { value: e, step: a, min: n, max: r, onBlur: s, onChange: o, onInput: i } = t;
790
- return E({
791
- ...t,
792
- // Make sure clicks anywhere focus the range input
793
- focusableSelector: 'input[type="range"]',
794
- input: _.input(
795
- u.type("range"),
796
- U(t),
797
- u.min(n),
798
- u.max(r),
799
- u.step(a),
800
- // Using value as number to keep it in sync
801
- u.valueAsNumber(e),
802
- u.class("bc-input bc-slider-input"),
803
- s != null ? M.blur(V(s)) : A,
804
- o != null ? M.change(V(o)) : A,
805
- i != null ? M.input(V(i)) : A
806
- )
807
- });
808
- }, Ie = (t) => {
809
- const { value: e, step: a, min: n, max: r, onBlur: s, onChange: o, onInput: i } = t, c = p.map(e, (d) => {
810
- if (d != null) return d;
811
- const f = n != null ? p.get(n) : void 0;
812
- return typeof f == "number" ? f : 0;
813
- }), l = z(
814
- e,
815
- t.disabled,
816
- o ?? i
817
- );
818
- return E({
819
- ...t,
820
- focusableSelector: 'input[type="range"]',
821
- after: l,
822
- input: _.input(
823
- u.type("range"),
824
- U(t),
825
- u.min(n),
826
- u.max(r),
827
- u.step(a),
828
- u.valueAsNumber(c),
829
- u.class("bc-input bc-slider-input"),
830
- s != null ? M.blur(V(s)) : A,
831
- o != null ? M.change(
832
- V((d) => {
833
- o(d);
834
- })
835
- ) : A,
836
- i != null ? M.input(
837
- V((d) => {
838
- i(d);
839
- })
840
- ) : A
841
- )
842
- });
843
- }, Me = L(mt);
844
- class Gt {
845
- widgets = /* @__PURE__ */ new Map();
846
- typeMapping = /* @__PURE__ */ new Map();
847
- // JSON Schema type -> widget names
848
- /**
849
- * Register a custom widget
850
- */
851
- register(e, a) {
852
- if (this.widgets.set(e, a), a.supportedTypes)
853
- for (const n of a.supportedTypes)
854
- this.typeMapping.has(n) || this.typeMapping.set(n, []), this.typeMapping.get(n).push(e), this.typeMapping.get(n).sort((r, s) => {
855
- const o = this.widgets.get(r)?.priority || 0;
856
- return (this.widgets.get(s)?.priority || 0) - o;
857
- });
858
- }
859
- /**
860
- * Unregister a widget
861
- */
862
- unregister(e) {
863
- const a = this.widgets.get(e);
864
- if (a && (this.widgets.delete(e), a.supportedTypes))
865
- for (const n of a.supportedTypes) {
866
- const r = this.typeMapping.get(n);
867
- if (r) {
868
- const s = r.indexOf(e);
869
- s >= 0 && r.splice(s, 1), r.length === 0 && this.typeMapping.delete(n);
870
- }
871
- }
872
- }
873
- /**
874
- * Get a registered widget
875
- */
876
- get(e) {
877
- return this.widgets.get(e);
878
- }
879
- /**
880
- * Get all registered widgets
881
- */
882
- getAll() {
883
- return new Map(this.widgets);
884
- }
885
- /**
886
- * Get widgets that support a specific JSON Schema type
887
- */
888
- getForType(e) {
889
- return (this.typeMapping.get(e) || []).map((n) => this.widgets.get(n)).filter(Boolean);
890
- }
891
- /**
892
- * Find the best widget for a schema context
893
- */
894
- findBestWidget(e) {
895
- const a = kt(e.definition, e.name);
896
- if (a?.widget) {
897
- const r = this.widgets.get(a.widget);
898
- if (r)
899
- return { name: a.widget, registration: r, resolved: a };
900
- }
901
- const n = [];
902
- for (const [r, s] of this.widgets.entries())
903
- if (s.matcher)
904
- try {
905
- s.matcher(e) && n.push({
906
- name: r,
907
- registration: s,
908
- priority: s.priority ?? 0
909
- });
910
- } catch (o) {
911
- console.warn(`Error in matcher for widget "${r}":`, o);
912
- }
913
- if (n.length > 0) {
914
- n.sort((s, o) => o.priority - s.priority);
915
- const r = n[0];
916
- return {
917
- name: r.name,
918
- registration: r.registration,
919
- resolved: { widget: r.name, source: "heuristics" }
920
- };
921
- }
922
- if (typeof e.definition == "object" && e.definition.type) {
923
- const r = Array.isArray(e.definition.type) ? e.definition.type[0] : e.definition.type, s = this.getForType(r);
924
- if (s.length > 0) {
925
- const o = this.typeMapping.get(r)[0];
926
- return {
927
- name: o,
928
- registration: s[0],
929
- resolved: { widget: o, source: "type-fallback" }
930
- };
931
- }
932
- }
933
- return null;
934
- }
935
- }
936
- const $e = new Gt();
937
- function xe(t, e, a) {
938
- return {
939
- factory: e,
940
- matcher: (n) => {
941
- const s = n.definition["x:ui"];
942
- return s === t || typeof s == "object" && s !== null && s.widget === t;
943
- },
944
- displayName: a?.displayName ?? t,
945
- priority: a?.priority ?? 100,
946
- // High priority for explicit matches
947
- ...a
948
- };
949
- }
950
- function _e(t, e, a) {
951
- return {
952
- factory: e,
953
- matcher: (n) => n.definition.format === t,
954
- displayName: a?.displayName ?? `${t} widget`,
955
- priority: a?.priority ?? 75,
956
- ...a
957
- };
958
- }
959
- function ke(t, e, a, n) {
960
- return {
961
- factory: a,
962
- matcher: (r) => {
963
- const s = r.definition;
964
- return s.type === t && s.format === e;
965
- },
966
- displayName: n?.displayName ?? `${t}:${e} widget`,
967
- priority: n?.priority ?? 80,
968
- ...n
969
- };
970
- }
971
- function Fe(t) {
972
- const e = t?.logPrefix ?? "WIDGET_DIAG", a = t?.filterFn ?? (() => !0);
973
- return {
974
- factory: () => null,
975
- displayName: "Diagnostic Widget (never matches)",
976
- priority: -1e3,
977
- // Very low priority, should never actually match
978
- matcher: (n) => {
979
- if (!a(n)) return !1;
980
- const r = n.definition, s = {
981
- name: n.name,
982
- path: n.path.map(String),
983
- type: r?.type,
984
- hasRegistry: n.widgetRegistry !== void 0,
985
- definition: r
986
- };
987
- return console.log(
988
- `[${e}] name="${s.name ?? "ROOT"}" path=[${s.path.join(", ")}] type="${s.type ?? "unknown"}" hasRegistry=${s.hasRegistry}`
989
- ), t?.onProcess?.(s), !1;
990
- }
991
- };
992
- }
993
- export {
994
- Nt as A,
995
- ie as B,
996
- ce as C,
997
- Tt as D,
998
- le as E,
999
- Ft as F,
1000
- Ct as G,
1001
- K as H,
1002
- Rt as I,
1003
- Bt as J,
1004
- St as K,
1005
- O as L,
1006
- Q as M,
1007
- he as N,
1008
- J as O,
1009
- Dt as P,
1010
- Vt as Q,
1011
- Yt as R,
1012
- ye as S,
1013
- G as T,
1014
- vt as U,
1015
- Gt as W,
1016
- fe as a,
1017
- be as b,
1018
- Me as c,
1019
- ge as d,
1020
- pe as e,
1021
- ue as f,
1022
- $e as g,
1023
- de as h,
1024
- Ie as i,
1025
- we as j,
1026
- me as k,
1027
- Fe as l,
1028
- _e as m,
1029
- ke as n,
1030
- xe as o,
1031
- at as p,
1032
- Ht as q,
1033
- re as r,
1034
- it as s,
1035
- At as t,
1036
- Ot as u,
1037
- Et as v,
1038
- P as w,
1039
- oe as x,
1040
- H as y,
1041
- ct as z
1042
- };