@luxalgo/vela-ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +28 -0
  4. package/README.md +83 -3
  5. package/cli/engine.mjs +282 -0
  6. package/cli/index.mjs +154 -0
  7. package/dist/badge.d.ts +26 -0
  8. package/dist/badge.js +44 -0
  9. package/dist/bar-chart.d.ts +40 -0
  10. package/dist/bar-chart.js +105 -0
  11. package/dist/button.d.ts +41 -0
  12. package/dist/button.js +10 -0
  13. package/dist/calendar.d.ts +22 -0
  14. package/dist/calendar.js +1 -0
  15. package/dist/callout-bubble.d.ts +98 -0
  16. package/dist/callout-bubble.js +173 -0
  17. package/dist/chart.d.ts +30 -0
  18. package/dist/chart.js +1 -0
  19. package/dist/checkbox.d.ts +60 -0
  20. package/dist/checkbox.js +12 -0
  21. package/dist/chunk-2GQIZM5Z.js +28 -0
  22. package/dist/chunk-2Q4JRINP.js +403 -0
  23. package/dist/chunk-3Q32K4PE.js +85 -0
  24. package/dist/chunk-5QHXOAZA.js +351 -0
  25. package/dist/chunk-6NXY62JS.js +25 -0
  26. package/dist/chunk-6QCILIT2.js +52 -0
  27. package/dist/chunk-A2FJ7Y7D.js +55 -0
  28. package/dist/chunk-A72NWYNP.js +26 -0
  29. package/dist/chunk-AJ2IYSOI.js +553 -0
  30. package/dist/chunk-BXMWQIBO.js +66 -0
  31. package/dist/chunk-CH3DV6FD.js +280 -0
  32. package/dist/chunk-EZQXTO6K.js +89 -0
  33. package/dist/chunk-FCO3YZLT.js +81 -0
  34. package/dist/chunk-FN2BUFNM.js +10 -0
  35. package/dist/chunk-FVH6L7FM.js +18 -0
  36. package/dist/chunk-G7IQLY3A.js +183 -0
  37. package/dist/chunk-IDA2BT7D.js +29 -0
  38. package/dist/chunk-J2QJATCD.js +12 -0
  39. package/dist/chunk-LZWZV2ZS.js +18 -0
  40. package/dist/chunk-MMTMOV6R.js +31 -0
  41. package/dist/chunk-OBLIX3VN.js +227 -0
  42. package/dist/chunk-P4MTEMT7.js +23 -0
  43. package/dist/chunk-Q6WTDVH6.js +31 -0
  44. package/dist/chunk-S7USVSYP.js +50 -0
  45. package/dist/chunk-SAPURP46.js +133 -0
  46. package/dist/chunk-TAKSIV57.js +90 -0
  47. package/dist/chunk-V6TTTMTE.js +79 -0
  48. package/dist/chunk-VMCR3S2A.js +22 -0
  49. package/dist/chunk-X4YPSIW6.js +72 -0
  50. package/dist/chunk-X66RJAIS.js +14 -0
  51. package/dist/chunk-XJAPCCOJ.js +101 -0
  52. package/dist/chunk-ZB3BZHSN.js +219 -0
  53. package/dist/color-picker.d.ts +103 -0
  54. package/dist/color-picker.js +19 -0
  55. package/dist/color.d.ts +24 -0
  56. package/dist/color.js +1 -0
  57. package/dist/context-menu.d.ts +72 -0
  58. package/dist/context-menu.js +161 -0
  59. package/dist/css.d.ts +15 -0
  60. package/dist/css.js +4 -0
  61. package/dist/data-table-DtU3FX9j.d.ts +61 -0
  62. package/dist/data-table.d.ts +3 -0
  63. package/dist/data-table.js +88 -0
  64. package/dist/date-picker.d.ts +90 -0
  65. package/dist/date-picker.js +257 -0
  66. package/dist/define-D5u3F5Dj.d.ts +21 -0
  67. package/dist/dialog.d.ts +89 -0
  68. package/dist/dialog.js +258 -0
  69. package/dist/dispose.d.ts +9 -0
  70. package/dist/dispose.js +2 -0
  71. package/dist/donut.d.ts +27 -0
  72. package/dist/donut.js +67 -0
  73. package/dist/drawer.d.ts +119 -0
  74. package/dist/drawer.js +326 -0
  75. package/dist/dropdown-menu.d.ts +114 -0
  76. package/dist/dropdown-menu.js +18 -0
  77. package/dist/empty.d.ts +21 -0
  78. package/dist/empty.js +38 -0
  79. package/dist/field.d.ts +147 -0
  80. package/dist/field.js +328 -0
  81. package/dist/glyph-select.d.ts +57 -0
  82. package/dist/glyph-select.js +17 -0
  83. package/dist/headless.d.ts +6 -0
  84. package/dist/headless.js +9 -0
  85. package/dist/hover-card.d.ts +43 -0
  86. package/dist/hover-card.js +97 -0
  87. package/dist/i18n.d.ts +20 -0
  88. package/dist/i18n.js +1 -0
  89. package/dist/icons.d.ts +20 -0
  90. package/dist/icons.js +2 -0
  91. package/dist/index.d.ts +45 -0
  92. package/dist/index.js +13 -0
  93. package/dist/input-group.d.ts +57 -0
  94. package/dist/input-group.js +86 -0
  95. package/dist/input.d.ts +54 -0
  96. package/dist/input.js +9 -0
  97. package/dist/kbd.d.ts +19 -0
  98. package/dist/kbd.js +8 -0
  99. package/dist/kit-text.d.ts +8 -0
  100. package/dist/kit-text.js +2 -0
  101. package/dist/line-chart.d.ts +32 -0
  102. package/dist/line-chart.js +120 -0
  103. package/dist/manifest.json +3854 -0
  104. package/dist/number-input.d.ts +99 -0
  105. package/dist/number-input.js +14 -0
  106. package/dist/page.d.ts +7 -0
  107. package/dist/page.js +1 -0
  108. package/dist/palette.d.ts +55 -0
  109. package/dist/palette.js +1 -0
  110. package/dist/placement.d.ts +98 -0
  111. package/dist/placement.js +1 -0
  112. package/dist/popover.d.ts +107 -0
  113. package/dist/popover.js +15 -0
  114. package/dist/scatter-chart.d.ts +32 -0
  115. package/dist/scatter-chart.js +121 -0
  116. package/dist/select.d.ts +112 -0
  117. package/dist/select.js +19 -0
  118. package/dist/sparkline.d.ts +22 -0
  119. package/dist/sparkline.js +72 -0
  120. package/dist/stat.d.ts +29 -0
  121. package/dist/stat.js +41 -0
  122. package/dist/styles.d.ts +22 -0
  123. package/dist/styles.js +2 -0
  124. package/dist/surface-events.d.ts +17 -0
  125. package/dist/surface-events.js +1 -0
  126. package/dist/surface-exit.d.ts +25 -0
  127. package/dist/surface-exit.js +1 -0
  128. package/dist/switch.d.ts +54 -0
  129. package/dist/switch.js +92 -0
  130. package/dist/t.d.ts +89 -0
  131. package/dist/t.js +1 -0
  132. package/dist/tabs.d.ts +63 -0
  133. package/dist/tabs.js +150 -0
  134. package/dist/text-area.d.ts +54 -0
  135. package/dist/text-area.js +9 -0
  136. package/dist/theme.d.ts +188 -0
  137. package/dist/theme.js +8 -0
  138. package/dist/theme.schema.json +1745 -0
  139. package/dist/themes/dark.css +3 -0
  140. package/dist/themes/light.css +3 -0
  141. package/dist/toggle-group.d.ts +56 -0
  142. package/dist/toggle-group.js +130 -0
  143. package/dist/tokens.d.ts +16 -0
  144. package/dist/tokens.js +3 -0
  145. package/dist/tooltip.d.ts +47 -0
  146. package/dist/tooltip.js +74 -0
  147. package/dist/variants-B4stUBnY.d.ts +16 -0
  148. package/dist/zag.d.ts +19 -0
  149. package/dist/zag.js +2 -0
  150. package/docs/theming.md +211 -0
  151. package/docs/what-to-change.md +20 -0
  152. package/docs/writing-a-component.md +247 -0
  153. package/llms.txt +66 -0
  154. package/package.json +90 -6
  155. package/registry/badge.ts +119 -0
  156. package/registry/bar-chart.ts +215 -0
  157. package/registry/button.ts +303 -0
  158. package/registry/callout-bubble.ts +336 -0
  159. package/registry/checkbox.ts +234 -0
  160. package/registry/color-picker.ts +582 -0
  161. package/registry/context-menu.ts +208 -0
  162. package/registry/data-table.ts +215 -0
  163. package/registry/date-picker.ts +483 -0
  164. package/registry/dialog.ts +535 -0
  165. package/registry/donut.ts +145 -0
  166. package/registry/drawer.ts +636 -0
  167. package/registry/dropdown-menu.ts +762 -0
  168. package/registry/empty.ts +91 -0
  169. package/registry/field.ts +585 -0
  170. package/registry/glyph-select.ts +268 -0
  171. package/registry/hover-card.ts +222 -0
  172. package/registry/input-group.ts +229 -0
  173. package/registry/input.ts +181 -0
  174. package/registry/kbd.ts +64 -0
  175. package/registry/line-chart.ts +218 -0
  176. package/registry/number-input.ts +443 -0
  177. package/registry/popover.ts +368 -0
  178. package/registry/scatter-chart.ts +221 -0
  179. package/registry/select.ts +620 -0
  180. package/registry/sparkline.ts +114 -0
  181. package/registry/stat.ts +96 -0
  182. package/registry/switch.ts +205 -0
  183. package/registry/tabs.ts +392 -0
  184. package/registry/text-area.ts +186 -0
  185. package/registry/toggle-group.ts +295 -0
  186. package/registry/tooltip.ts +156 -0
  187. package/skills/theming-vela-ui/SKILL.md +137 -0
  188. package/skills/using-vela-ui-components/SKILL.md +134 -0
  189. package/skills/writing-vela-ui-components/SKILL.md +163 -0
  190. package/src/components/badge.ts +119 -0
  191. package/src/components/bar-chart.ts +215 -0
  192. package/src/components/button.ts +303 -0
  193. package/src/components/callout-bubble.ts +336 -0
  194. package/src/components/checkbox.ts +234 -0
  195. package/src/components/color-picker.ts +582 -0
  196. package/src/components/context-menu.ts +208 -0
  197. package/src/components/data-table.ts +215 -0
  198. package/src/components/date-picker.ts +483 -0
  199. package/src/components/dialog.ts +535 -0
  200. package/src/components/donut.ts +145 -0
  201. package/src/components/drawer.ts +636 -0
  202. package/src/components/dropdown-menu.ts +762 -0
  203. package/src/components/empty.ts +91 -0
  204. package/src/components/field.ts +585 -0
  205. package/src/components/glyph-select.ts +268 -0
  206. package/src/components/hover-card.ts +222 -0
  207. package/src/components/input-group.ts +229 -0
  208. package/src/components/input.ts +181 -0
  209. package/src/components/kbd.ts +64 -0
  210. package/src/components/line-chart.ts +218 -0
  211. package/src/components/number-input.ts +443 -0
  212. package/src/components/popover.ts +368 -0
  213. package/src/components/scatter-chart.ts +221 -0
  214. package/src/components/select.ts +620 -0
  215. package/src/components/sparkline.ts +114 -0
  216. package/src/components/stat.ts +96 -0
  217. package/src/components/switch.ts +205 -0
  218. package/src/components/tabs.ts +392 -0
  219. package/src/components/text-area.ts +186 -0
  220. package/src/components/toggle-group.ts +295 -0
  221. package/src/components/tooltip.ts +156 -0
  222. package/src/index.ts +24 -0
  223. package/src/lib/calendar.ts +112 -0
  224. package/src/lib/chart.ts +72 -0
  225. package/src/lib/color.ts +89 -0
  226. package/src/lib/component-index.ts +131 -0
  227. package/src/lib/css.ts +44 -0
  228. package/src/lib/define.ts +45 -0
  229. package/src/lib/dispose.ts +36 -0
  230. package/src/lib/h.ts +55 -0
  231. package/src/lib/headless.ts +16 -0
  232. package/src/lib/i18n.ts +30 -0
  233. package/src/lib/icons.ts +237 -0
  234. package/src/lib/kit-text.ts +26 -0
  235. package/src/lib/page.ts +24 -0
  236. package/src/lib/palette.ts +81 -0
  237. package/src/lib/placement.ts +188 -0
  238. package/src/lib/styles.ts +53 -0
  239. package/src/lib/surface-events.ts +31 -0
  240. package/src/lib/surface-exit.ts +87 -0
  241. package/src/lib/t.ts +68 -0
  242. package/src/lib/theme.ts +654 -0
  243. package/src/lib/tokens.ts +111 -0
  244. package/src/lib/variants.ts +32 -0
  245. package/src/lib/zag.ts +46 -0
  246. package/stylelint/index.mjs +60 -0
  247. package/stylelint/lint.mjs +81 -0
  248. package/stylelint/plugin.mjs +115 -0
@@ -0,0 +1,183 @@
1
+ import { pageState } from './chunk-X66RJAIS.js';
2
+
3
+ // src/lib/icons.ts
4
+ var registry = pageState("icons@1", () => /* @__PURE__ */ new Map());
5
+ function registerIcon(id, svg) {
6
+ registry.set(id, svg);
7
+ }
8
+ function iconMarkup(id) {
9
+ return registry.get(id) ?? null;
10
+ }
11
+ function icon(id) {
12
+ return registry.get(id) ?? "";
13
+ }
14
+ function iconAt(id, px) {
15
+ return icon(id).replace("<svg ", `<svg width="${px}" height="${px}" `);
16
+ }
17
+ function svg16(body, extra = "") {
18
+ return `<svg viewBox="0 0 16 16" width="1em" height="1em" ${extra ? extra + " " : ""}fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round">${body}</svg>`;
19
+ }
20
+ function svg24(body, extra = "") {
21
+ return `<svg viewBox="0 0 24 24" width="1em" height="1em" ${extra ? extra + " " : ""}fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${body}</svg>`;
22
+ }
23
+ function svg24Solid(body) {
24
+ return `<svg viewBox="0 0 24 24" width="1em" height="1em" fill="currentColor" stroke="none">${body}</svg>`;
25
+ }
26
+ var S = svg16;
27
+ registerIcon(
28
+ "style-candles",
29
+ S('<path d="M4.5 2v2M4.5 12v2M11.5 2v1.5M11.5 11v3"/><rect x="2.8" y="4" width="3.4" height="8" rx="0.6" fill="currentColor" fill-opacity="0.25"/><rect x="9.8" y="3.5" width="3.4" height="7.5" rx="0.6" fill="currentColor"/>')
30
+ );
31
+ registerIcon(
32
+ "style-bars",
33
+ S('<path d="M4.5 2.5v11M2.5 5h2M4.5 11h2"/><path d="M11.5 2.5v11M9.5 4.5h2M11.5 10.5h2"/>')
34
+ );
35
+ registerIcon("style-line", S('<path d="M1.5 11.5 5.5 7l3 2.5 5-6"/>'));
36
+ registerIcon(
37
+ "style-area",
38
+ S('<path d="M1.5 11.5 5.5 7l3 2.5 5-6"/><path d="M1.5 11.5 5.5 7l3 2.5 5-6V13.5h-12z" fill="currentColor" fill-opacity="0.25" stroke="none"/>')
39
+ );
40
+ registerIcon(
41
+ "style-baseline",
42
+ S('<path d="M1.5 8h13" stroke-dasharray="2 2"/><path d="M2.5 8 5.25 4.5 8 8h-5.5z" fill="currentColor" fill-opacity="0.25" stroke="none"/><path d="M2.5 8 5.25 4.5 8 8"/><path d="M8 8l2.75 3.5L13.5 8h-5.5z" fill="currentColor" fill-opacity="0.25" stroke="none"/><path d="M8 8l2.75 3.5L13.5 8"/>')
43
+ );
44
+ registerIcon(
45
+ "style-heikinashi",
46
+ S('<path d="M4.5 12v2M11.5 2v2"/><rect x="2.8" y="5" width="3.4" height="7" rx="0.6" fill="currentColor" fill-opacity="0.25"/><rect x="9.8" y="4" width="3.4" height="7" rx="0.6" fill="currentColor"/>')
47
+ );
48
+ registerIcon("indicators", S('<path d="M1.5 12.5 5 7l2.5 3.5L11 4l3.5 5"/><circle cx="11" cy="4" r="1.4" fill="currentColor" stroke="none"/>'));
49
+ registerIcon("undo", S('<path d="M6.2 9.5 2.7 6l3.5-3.5"/><path d="M2.7 6h6.8a3.65 3.65 0 0 1 0 7.3H7.5"/>'));
50
+ registerIcon("redo", S('<path d="M9.8 9.5 13.3 6 9.8 2.5"/><path d="M13.3 6H6.5a3.65 3.65 0 0 0 0 7.3h2"/>'));
51
+ registerIcon(
52
+ "objects",
53
+ S('<path d="M8 1.8 14 5 8 8.2 2 5z"/><path d="M2 8l6 3.2L14 8" opacity="0.7"/><path d="M2 11l6 3.2 6-3.2" opacity="0.4"/>')
54
+ );
55
+ registerIcon("clock", S('<circle cx="8" cy="8" r="6.2"/><path d="M8 4.8V8l2.4 1.6"/>'));
56
+ registerIcon(
57
+ "calendar",
58
+ S('<rect x="2.2" y="3.2" width="11.6" height="10.6" rx="1.4"/><path d="M5.2 1.8v2.8M10.8 1.8v2.8M2.2 6.8h11.6"/>')
59
+ );
60
+ registerIcon("datawindow", S('<rect x="1.8" y="2.5" width="12.4" height="11" rx="1.5"/><path d="M4.5 5.5h4M4.5 8h7M4.5 10.5h5.5"/>'));
61
+ registerIcon("camera", S('<path d="M5.5 4 6.5 2.5h3L10.5 4h3A1 1 0 0 1 14.5 5v7.5a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z"/><circle cx="8" cy="8.5" r="2.6"/>'));
62
+ registerIcon(
63
+ "gear",
64
+ S('<path d="M6.55 1.4h2.9l.32 1.72c.48.14.92.38 1.3.7l1.66-.55 1.45 2.5-1.35 1.1c.08.34.12.7.12 1.07s-.04.73-.12 1.07l1.35 1.1-1.45 2.5-1.66-.55a4.3 4.3 0 0 1-1.3.7L9.45 14.6h-2.9l-.32-1.72a4.3 4.3 0 0 1-1.3-.7l-1.66.55-1.45-2.5 1.35-1.1A4.4 4.4 0 0 1 3.05 7.94c0-.37.04-.73.12-1.07l-1.35-1.1 1.45-2.5 1.66.55c.38-.32.82-.56 1.3-.7L6.55 1.4z"/><circle cx="8" cy="8" r="2.2"/>')
65
+ );
66
+ registerIcon("search", S('<circle cx="7" cy="7" r="4.5"/><path d="m10.5 10.5 3.5 3.5"/>'));
67
+ registerIcon("bell", S('<path d="M8 2a4 4 0 0 0-4 4v2.5L2.5 11v1h11v-1L12 8.5V6a4 4 0 0 0-4-4z"/><path d="M6.5 13.5a1.5 1.5 0 0 0 3 0"/>'));
68
+ registerIcon(
69
+ "market-open",
70
+ svg24('<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>')
71
+ );
72
+ registerIcon(
73
+ "market-pre",
74
+ svg24('<path d="M12 2v8"/><path d="m4.93 10.93 1.41 1.41"/><path d="M2 18h2"/><path d="M20 18h2"/><path d="m19.07 10.93-1.41 1.41"/><path d="M22 22H2"/><path d="m8 6 4-4 4 4"/><path d="M16 18a4 4 0 0 0-8 0"/>')
75
+ );
76
+ registerIcon(
77
+ "market-post",
78
+ svg24('<path d="M12 10V2"/><path d="m4.93 10.93 1.41 1.41"/><path d="M2 18h2"/><path d="M20 18h2"/><path d="m19.07 10.93-1.41 1.41"/><path d="M22 22H2"/><path d="m16 14-4 4-4-4"/><path d="M16 6a4 4 0 0 0-8 0"/>')
79
+ );
80
+ registerIcon(
81
+ "market-extended",
82
+ svg24('<path d="M22 22H2"/><path d="M12 3a5 5 0 0 0 7.5 7.5A7.5 7.5 0 1 1 12 3Z"/>')
83
+ );
84
+ registerIcon("market-closed", svg24('<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>'));
85
+ registerIcon(
86
+ "market-holiday",
87
+ svg24('<path d="m10 20-1.25-2.5L6 16"/><path d="M10 4 8.75 6.5 6 8"/><path d="m14 20 1.25-2.5L18 16"/><path d="m14 4 1.25 2.5L18 8"/><path d="m17 10-5 5-5-5"/><path d="M4 12h16"/>')
88
+ );
89
+ registerIcon("chevron-right", S('<path d="m6 3.5 4.5 4.5L6 12.5"/>'));
90
+ registerIcon("chevron-left", S('<path d="M10 3.5 5.5 8l4.5 4.5"/>'));
91
+ registerIcon("chevron-down", S('<path d="M3.5 6 8 10.5 12.5 6"/>'));
92
+ registerIcon("chevron-up", S('<path d="M3.5 10 8 5.5 12.5 10"/>'));
93
+ registerIcon("chevrons-right", S('<path d="m4 3.5 4.5 4.5L4 12.5"/><path d="m8.5 3.5 4.5 4.5-4.5 4.5"/>'));
94
+ registerIcon("chevrons-left", S('<path d="M12 3.5 7.5 8l4.5 4.5"/><path d="M7.5 3.5 3 8l4.5 4.5"/>'));
95
+ registerIcon("replay", S('<path d="M14 4.2v7.6L8.6 8z"/><path d="M7.4 4.2v7.6L2 8z"/>'));
96
+ registerIcon("check", S('<path d="m2.8 8.4 3.4 3.4 7-7.6"/>'));
97
+ registerIcon("close", S('<path d="m3.8 3.8 8.4 8.4M12.2 3.8l-8.4 8.4"/>'));
98
+ registerIcon("pin", S('<path d="M5.6 2.5h4.8M6.4 2.5v3.6L4.4 8.4v.9h7.2v-.9L9.6 6.1V2.5M8 9.3v4.2"/>'));
99
+ registerIcon("pin-filled", S('<path d="M5.6 2.5h4.8M6.4 2.5v3.6L4.4 8.4v.9h7.2v-.9L9.6 6.1V2.5M8 9.3v4.2"/><path d="M6.4 2.5h3.2v3.6l2 2.3v.9H4.4v-.9l2-2.3z" fill="currentColor" stroke="none"/>'));
100
+ registerIcon("eye", S('<path d="M1.5 8s2.5-5.4 6.5-5.4S14.5 8 14.5 8 12 13.4 8 13.4 1.5 8 1.5 8z"/><circle cx="8" cy="8" r="1.8"/>'));
101
+ registerIcon("eye-off", S('<path d="M1.5 8s2.5-5.4 6.5-5.4S14.5 8 14.5 8 12 13.4 8 13.4 1.5 8 1.5 8z" opacity="0.45"/><path d="m3 13 10-10"/>'));
102
+ registerIcon("lock", S('<rect x="3.2" y="7" width="9.6" height="6.6" rx="1.2"/><path d="M5.6 7V5.2a2.4 2.4 0 0 1 4.8 0V7"/>'));
103
+ registerIcon("unlock", S('<rect x="3.2" y="7" width="9.6" height="6.6" rx="1.2"/><path d="M5.6 7V5.2a2.4 2.4 0 0 1 4.7-.7"/>'));
104
+ registerIcon("trash", S('<path d="M2.5 4.3h11M6.2 4.3V3.1a1 1 0 0 1 1-1h1.6a1 1 0 0 1 1 1v1.2M4.2 4.3l.5 9.1a1.15 1.15 0 0 0 1.15 1.1h4.3a1.15 1.15 0 0 0 1.15-1.1l.5-9.1M6.5 7v4.5M9.5 7v4.5"/>'));
105
+ registerIcon("group", S('<path d="M1.8 4.5V2.4a.6.6 0 0 1 .6-.6h2.1M11.5 1.8h2.1a.6.6 0 0 1 .6.6v2.1M14.2 11.5v2.1a.6.6 0 0 1-.6.6h-2.1M4.5 14.2H2.4a.6.6 0 0 1-.6-.6v-2.1"/><rect x="4" y="4" width="4.2" height="4.2" rx="0.7"/><rect x="7.8" y="7.8" width="4.2" height="4.2" rx="0.7"/>'));
106
+ registerIcon("ungroup", S('<rect x="1.6" y="1.6" width="6.2" height="6.2" rx="0.9"/><rect x="8.2" y="8.2" width="6.2" height="6.2" rx="0.9" stroke-dasharray="2 1.5"/>'));
107
+ registerIcon("clone", S('<rect x="5.5" y="5.5" width="9" height="9" rx="1.2"/><path d="M11 5.5v-3a1 1 0 0 0-1-1H2.5a1 1 0 0 0-1 1V10a1 1 0 0 0 1 1h3"/>'));
108
+ registerIcon("arrow-up", S('<path d="M8 13.2V3M4.2 6.8 8 3l3.8 3.8"/>'));
109
+ registerIcon("arrow-down", S('<path d="M8 2.8V13M4.2 9.2 8 13l3.8-3.8"/>'));
110
+ registerIcon("move-vertical", S('<path d="M8 2.5v11M5 5.5 8 2.5l3 3M5 10.5l3 3 3-3"/>'));
111
+ registerIcon("move", S('<path d="M8 1.8v12.4M1.8 8h12.4M5.6 4.2 8 1.8l2.4 2.4M5.6 11.8 8 14.2l2.4-2.4M4.2 5.6 1.8 8l2.4 2.4M11.8 5.6 14.2 8l-2.4 2.4"/>'));
112
+ registerIcon("pen", S('<path d="m10.8 2.2 3 3-8 8-3.6.6.6-3.6z"/><path d="m9.2 3.8 3 3"/>'));
113
+ registerIcon("wave", S('<path d="M1.5 10.4c1.6 0 1.9-4.8 3.4-4.8s1.8 4.8 3.4 4.8 1.8-4.8 3.4-4.8 1.6 4.8 2.8 4.8"/>'));
114
+ registerIcon("folder-plus", S('<path d="M1.6 4.4a1 1 0 0 1 1-1h2.7l1.3 1.7h6.8a1 1 0 0 1 1 1v6.5a1 1 0 0 1-1 1h-10.8a1 1 0 0 1-1-1z"/><path d="M8 7.6v3.6M6.2 9.4h3.6"/>'));
115
+ registerIcon("folder-minus", S('<path d="M1.6 4.4a1 1 0 0 1 1-1h2.7l1.3 1.7h6.8a1 1 0 0 1 1 1v6.5a1 1 0 0 1-1 1h-10.8a1 1 0 0 1-1-1z"/><path d="M6.2 9.4h3.6"/>'));
116
+ registerIcon("collapse", S('<path d="M3 8h10"/>'));
117
+ registerIcon("expand", S('<rect x="2.2" y="2.2" width="11.6" height="11.6" rx="1.4"/><path d="M8 5.4v5.2M5.4 8h5.2"/>'));
118
+ registerIcon("plus", S('<path d="M8 2.8v10.4M2.8 8h10.4"/>'));
119
+ registerIcon("minus", S('<path d="M2.8 8h10.4"/>'));
120
+ registerIcon("maximize", S('<path d="M2.5 6V3a.5.5 0 0 1 .5-.5h3M10 2.5h3a.5.5 0 0 1 .5.5v3M13.5 10v3a.5.5 0 0 1-.5.5h-3M6 13.5H3a.5.5 0 0 1-.5-.5v-3"/>'));
121
+ registerIcon("restore", S('<path d="M6 2.5v3a.5.5 0 0 1-.5.5h-3M13.5 6h-3a.5.5 0 0 1-.5-.5v-3M10 13.5v-3a.5.5 0 0 1 .5-.5h3M2.5 10h3a.5.5 0 0 1 .5.5v3"/>'));
122
+ registerIcon("restore", S('<path d="M6.2 2.5v3.7H2.5M9.8 13.5V9.8h3.7M13.5 6.2H9.8V2.5M2.5 9.8h3.7v3.7"/>'));
123
+ registerIcon("star", S('<path d="M8 2.2l1.75 3.55 3.9.55-2.8 2.75.65 3.9L8 11.1l-3.5 1.85.65-3.9-2.8-2.75 3.9-.55z"/>'));
124
+ registerIcon("star-filled", S('<path d="M8 2.2l1.75 3.55 3.9.55-2.8 2.75.65 3.9L8 11.1l-3.5 1.85.65-3.9-2.8-2.75 3.9-.55z"/>', 'fill="currentColor"'));
125
+ registerIcon("grip", S('<circle cx="6" cy="3.5" r="1"/><circle cx="10" cy="3.5" r="1"/><circle cx="6" cy="8" r="1"/><circle cx="10" cy="8" r="1"/><circle cx="6" cy="12.5" r="1"/><circle cx="10" cy="12.5" r="1"/>', 'fill="currentColor" stroke="none"'));
126
+ registerIcon("kebab", S('<circle cx="8" cy="3.2" r="1.2"/><circle cx="8" cy="8" r="1.2"/><circle cx="8" cy="12.8" r="1.2"/>', 'fill="currentColor" stroke="none"'));
127
+ registerIcon("burger", S('<path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>'));
128
+ registerIcon("info", S('<path d="M8 7.4v4.4"/><circle cx="8" cy="4.6" r="0.9" fill="currentColor" stroke="none"/>'));
129
+ registerIcon("reset", S('<path d="M2 8a6 6 0 1 0 6-6 6.5 6.5 0 0 0-4.5 1.83L2 5.33"/><path d="M2 2v3.33h3.33"/>'));
130
+ registerIcon("pane-collapse", S('<path d="M2.6 9.4h4v4M13.4 6.6h-4v-4"/><path d="m9.4 6.6 4.2-4.2M2.4 13.6l4.2-4.2"/>'));
131
+ registerIcon("pane-expand", S('<path d="M9.8 2.4h3.8v3.8M6.2 13.6H2.4V9.8"/><path d="m13.6 2.4-4.4 4.4M2.4 13.6l4.4-4.4"/>'));
132
+ registerIcon("cursor", svg24('<path d="M5 3l6 16 2-6 6-2z"/>', 'fill="currentColor" stroke="none"'));
133
+ registerIcon(
134
+ "ruler",
135
+ svg24('<path d="M21.3 15.3 8.7 2.7a1 1 0 0 0-1.4 0L2.7 7.3a1 1 0 0 0 0 1.4l12.6 12.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4Z"/><path d="m7.5 10.5 2 2"/><path d="m10.5 7.5 2 2"/><path d="m13.5 4.5 2 2"/><path d="m4.5 13.5 2 2"/>')
136
+ );
137
+ registerIcon(
138
+ "magnet",
139
+ svg24('<path d="m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15"/><path d="m5 8 4 4"/><path d="m12 15 4 4"/>')
140
+ );
141
+ registerIcon(
142
+ "eraser",
143
+ svg24('<path d="m7 21-4.3-4.3a1 1 0 0 1 0-1.4L13 5a2 2 0 0 1 2.8 0l4.2 4.2a2 2 0 0 1 0 2.8L12 20"/><path d="M22 21H7"/><path d="m5 11 9 9"/>')
144
+ );
145
+ registerIcon(
146
+ "pen-lock",
147
+ svg24('<path d="M13.8 4.2a2.1 2.1 0 0 1 3 3L8.5 15.5l-3.5 1 1-3.5Z"/><rect x="13" y="14.5" width="8" height="6" rx="1.2"/><path d="M15 14.5v-1.6a2 2 0 0 1 4 0v1.6"/>')
148
+ );
149
+ registerIcon(
150
+ "pen-sync",
151
+ // Pen + two stacked panes — drawing onto every linked chart at once.
152
+ svg24('<path d="M13.8 4.2a2.1 2.1 0 0 1 3 3L8.5 15.5l-3.5 1 1-3.5Z"/><rect x="12.5" y="13.5" width="6" height="4.8" rx="1"/><path d="M15.5 18.3v1a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-2.8a1 1 0 0 0-1-1h-1"/>')
153
+ );
154
+ registerIcon("brush", svg24('<path d="M9.5 12 17 4.5a2.12 2.12 0 0 1 3 3L12.5 15"/><path d="M7 14a3 3 0 0 0-3 3c0 1.3-1.2 1.5-1.5 2 .8.9 2 1.5 3.5 1.5a3.5 3.5 0 0 0 3.5-3.5 3 3 0 0 0-2.5-3Z"/>'));
155
+ registerIcon(
156
+ "bucket",
157
+ svg24('<path d="m18.5 11.5-7-7L4 12a1.8 1.8 0 0 0 0 2.5l5 5a1.8 1.8 0 0 0 2.5 0Z"/><path d="m5 5 4 4"/><path d="M3.5 13.5h13"/><path d="M21 17.5c0 1.1-.9 2-2 2s-2-.9-2-2c0-1 1.2-1.7 2-3 .8 1.3 2 2 2 3Z"/>')
158
+ );
159
+ registerIcon("type", svg24('<path d="M5 6V4.5h14V6"/><path d="M12 4.5v15"/><path d="M9.5 19.5h5"/>'));
160
+ registerIcon("bold", svg24('<path d="M7 5h6a3.5 3.5 0 0 1 0 7H7Z"/><path d="M7 12h7a3.5 3.5 0 0 1 0 7H7Z"/>', 'stroke-width="2.4"'));
161
+ registerIcon("italic", svg24('<path d="M15 5h-5M14 19H9M14.5 5 10 19"/>', 'stroke-width="2.2"'));
162
+ registerIcon("price-delta", svg24('<path d="M12 4v16"/><path d="M8 8l4-4 4 4"/><path d="M8 16l4 4 4-4"/>'));
163
+ registerIcon("date-delta", svg24('<path d="M4 12h16"/><path d="M8 8l-4 4 4 4"/><path d="M16 8l4 4-4 4"/>'));
164
+ registerIcon("bring-front", svg24('<rect x="8.5" y="8.5" width="7" height="7" rx="1.5"/><path d="M4.5 10.5V6a1.5 1.5 0 0 1 1.5-1.5h4.5"/><path d="M19.5 13.5V18a1.5 1.5 0 0 1-1.5 1.5h-4.5"/>'));
165
+ registerIcon(
166
+ "send-back",
167
+ svg24('<rect x="8.5" y="8.5" width="7" height="7" rx="1.5" fill="currentColor" stroke="none" opacity="0.35"/><path d="M4.5 10.5V6a1.5 1.5 0 0 1 1.5-1.5h4.5"/><path d="M19.5 13.5V18a1.5 1.5 0 0 1-1.5 1.5h-4.5"/><rect x="8.5" y="8.5" width="7" height="7" rx="1.5"/>')
168
+ );
169
+ registerIcon("r-squared", '<svg viewBox="0 0 24 24" width="1em" height="1em" fill="currentColor" stroke="none"><text x="2.5" y="17.5" font-size="14" font-family="serif">R\xB2</text></svg>');
170
+ registerIcon("bands", svg24('<path d="M3 6h18"/><path d="M3 18h18"/><path d="M3 12h18" stroke-dasharray="3 3"/>'));
171
+ registerIcon("dedekind", svg24('<path d="M2 20h20"/><path d="M4 20a8 8 0 0 1 16 0"/><path d="M8 20a4 4 0 0 1 8 0"/><path d="M12 4v16"/>'));
172
+ registerIcon("sonic", svg24('<circle cx="15" cy="12" r="4"/><circle cx="12" cy="12" r="2.5"/><path d="M8 5v14"/>'));
173
+ registerIcon("supersonic", svg24('<circle cx="16" cy="12" r="3.5"/><path d="M6 12 15 6M6 12 15 18"/>'));
174
+ function iconEl(id, doc = document) {
175
+ const span = doc.createElement("span");
176
+ span.className = "vela-icon";
177
+ span.setAttribute("aria-hidden", "true");
178
+ const svg = iconMarkup(id);
179
+ if (svg) span.innerHTML = svg;
180
+ return span;
181
+ }
182
+
183
+ export { icon, iconAt, iconEl, iconMarkup, registerIcon, svg16, svg24, svg24Solid };
@@ -0,0 +1,29 @@
1
+ import { injectLayerOrder, injectStyles } from './chunk-2GQIZM5Z.js';
2
+ import { pageState } from './chunk-X66RJAIS.js';
3
+
4
+ // src/lib/css.ts
5
+ var written = pageState("written-css@1", () => /* @__PURE__ */ new Set());
6
+ function css(strings, ...values) {
7
+ let out = strings[0] ?? "";
8
+ for (let i = 0; i < values.length; i += 1) out += String(values[i]) + (strings[i + 1] ?? "");
9
+ written.add(out);
10
+ return out;
11
+ }
12
+ function isWrittenCss(text) {
13
+ return written.has(text);
14
+ }
15
+ function acceptCss(text) {
16
+ written.add(text);
17
+ }
18
+ function defineStyles(id, text) {
19
+ const injected = /* @__PURE__ */ new WeakMap();
20
+ return (root = document) => {
21
+ if (injected.get(root)?.isConnected) return;
22
+ injectLayerOrder(root);
23
+ injectStyles(id, text, root);
24
+ const sheet = root.getElementById?.(id) ?? (root instanceof Document ? null : root.querySelector(`#${CSS.escape(id)}`));
25
+ if (sheet) injected.set(root, sheet);
26
+ };
27
+ }
28
+
29
+ export { acceptCss, css, defineStyles, isWrittenCss };
@@ -0,0 +1,12 @@
1
+ // src/lib/surface-events.ts
2
+ var SURFACE_OPEN_EVENT = "vela:surface-open";
3
+ var SURFACE_CLOSE_EVENT = "vela:surface-close";
4
+ function announceSurface(el, open, kind, trigger = null) {
5
+ const View = el.ownerDocument.defaultView;
6
+ if (!View) return;
7
+ el.dispatchEvent(
8
+ new View.CustomEvent(open ? SURFACE_OPEN_EVENT : SURFACE_CLOSE_EVENT, { bubbles: true, composed: true, detail: { kind, trigger } })
9
+ );
10
+ }
11
+
12
+ export { SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, announceSurface };
@@ -0,0 +1,18 @@
1
+ // src/lib/variants.ts
2
+ function variants(spec) {
3
+ const keys = Object.keys(spec);
4
+ const attrs = keys.map((key) => `data-${key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`);
5
+ const resolve = (values = {}) => {
6
+ const out = {};
7
+ for (const key of keys) out[key] = values[key] ?? spec[key][0];
8
+ return out;
9
+ };
10
+ const fn = (values = {}) => {
11
+ const out = {};
12
+ for (let i = 0; i < keys.length; i += 1) out[attrs[i]] = values[keys[i]] ?? spec[keys[i]][0];
13
+ return out;
14
+ };
15
+ return Object.assign(fn, { spec, resolve });
16
+ }
17
+
18
+ export { variants };
@@ -0,0 +1,31 @@
1
+ // src/lib/palette.ts
2
+ var ACCENT = "#2962ff";
3
+ var ACCENT_BRIGHT = "#38c0fd";
4
+ var BULLISH = "#089981";
5
+ var BEARISH = "#f23645";
6
+ var NEUTRAL = "#787b86";
7
+ var HIGHLIGHT = "#e0b400";
8
+ var WARNING = "#ff9800";
9
+ var INFO = "#5b9cf6";
10
+ var MARKER = "#ff5d00";
11
+ var VALID = "#0ecb81";
12
+ var INVALID = "#f6465d";
13
+ var SESSION_PRE = "#f97316";
14
+ var SESSION_POST = "#0ea5e9";
15
+ var SESSION_OFF = "#9ca3af";
16
+ var SERIES_LINE = "#3b82f6";
17
+ var CROSSHAIR = "#9aa0ad";
18
+ var SLATE_DEEP = "#1e293b";
19
+ var SLATE = "#475569";
20
+ var CHIP_PLATE = "#595959";
21
+ var TRADE_LONG = ACCENT;
22
+ var TRADE_SHORT = BEARISH;
23
+ var TRADE_EXIT = "#d500f9";
24
+ var CATEGORICAL = [ACCENT, BULLISH, BEARISH, WARNING, "#7e57c2", "#26a69a", INFO, "#e573b5"];
25
+ function categoricalColor(key) {
26
+ let h = 0;
27
+ for (let i = 0; i < key.length; i++) h = h * 31 + key.charCodeAt(i) >>> 0;
28
+ return CATEGORICAL[h % CATEGORICAL.length];
29
+ }
30
+
31
+ export { ACCENT, ACCENT_BRIGHT, BEARISH, BULLISH, CATEGORICAL, CHIP_PLATE, CROSSHAIR, HIGHLIGHT, INFO, INVALID, MARKER, NEUTRAL, SERIES_LINE, SESSION_OFF, SESSION_POST, SESSION_PRE, SLATE, SLATE_DEEP, TRADE_EXIT, TRADE_LONG, TRADE_SHORT, VALID, WARNING, categoricalColor };
@@ -0,0 +1,227 @@
1
+ import { announceSurface } from './chunk-J2QJATCD.js';
2
+ import { holdForExit } from './chunk-S7USVSYP.js';
3
+ import { floatingLayerHost, ensureUIHost } from './chunk-AJ2IYSOI.js';
4
+ import { viewportRect, insetRect, intersectRects, placePopover } from './chunk-3Q32K4PE.js';
5
+ import { disposeWithin } from './chunk-A72NWYNP.js';
6
+ import { h } from './chunk-Q6WTDVH6.js';
7
+ import { t } from './chunk-6QCILIT2.js';
8
+ import { defineComponent } from './chunk-VMCR3S2A.js';
9
+ import { css, defineStyles } from './chunk-IDA2BT7D.js';
10
+ import { pageState } from './chunk-X66RJAIS.js';
11
+
12
+ // src/components/popover.ts
13
+ function popoverController(opts = {}) {
14
+ return {
15
+ side: opts.side ?? "bottom",
16
+ gap: opts.sideOffset ?? opts.gap ?? 4,
17
+ align: opts.align ?? "start",
18
+ alignOffset: opts.alignOffset ?? 0,
19
+ avoidCollisions: opts.avoidCollisions ?? true,
20
+ matchWidth: opts.matchWidth ?? false,
21
+ position: opts.position ?? "fixed",
22
+ boundaryInset: opts.collisionPadding ?? opts.boundaryInset ?? 0,
23
+ viewportInset: opts.collisionPadding ?? opts.viewportInset ?? 6,
24
+ onClose: opts.onClose
25
+ };
26
+ }
27
+ var popoverDef = defineComponent({ name: "popover", parts: ["content"] });
28
+ var POPOVER_STYLE_ID = "vela-ui-popover";
29
+ var POPOVER_CSS = css`@layer vela.ui{[data-slot~=popover-content]{z-index:${t.z.popover};box-sizing:border-box;overflow-anchor:none;position:fixed}[data-slot~=popover-content][data-position=absolute]{position:absolute}}`;
30
+ var injectStyles = defineStyles(POPOVER_STYLE_ID, POPOVER_CSS);
31
+ var showing = pageState("open-popover@1", () => ({ popover: null }));
32
+ var leaving = /* @__PURE__ */ new Set();
33
+ function closeOpenPopovers() {
34
+ showing.popover?.hide();
35
+ }
36
+ function isPopoverOpen() {
37
+ return showing.popover !== null;
38
+ }
39
+ function openPopoverTrigger() {
40
+ return showing.popover?.trigger ?? null;
41
+ }
42
+ var POPOVER_DISMISS_FLAG = "__velaPopoverDismiss";
43
+ function markPopoverDismiss(e) {
44
+ e[POPOVER_DISMISS_FLAG] = true;
45
+ }
46
+ function eventDismissedPopover(e) {
47
+ return e[POPOVER_DISMISS_FLAG] === true;
48
+ }
49
+ function toRect(r) {
50
+ return { left: r.left, top: r.top, right: r.right, bottom: r.bottom, width: r.width, height: r.height };
51
+ }
52
+ var Popover = class {
53
+ constructor(opts) {
54
+ this.onOutside = null;
55
+ this.onKey = null;
56
+ this.onReflow = null;
57
+ this.shown = false;
58
+ /** The pending removal of a fading-out shell; a show() that reuses the shell cancels it. */
59
+ this.leaveTimer = null;
60
+ /** The shell's exit animation before it leaves the DOM; a show() that reuses the shell cancels it. */
61
+ this.exit = null;
62
+ const doc = opts.trigger.ownerDocument;
63
+ injectStyles(doc);
64
+ this.trigger = opts.trigger;
65
+ this.host = opts.host ?? floatingLayerHost(opts.trigger, doc.body);
66
+ this.inheritsTokens = !opts.host && this.host !== doc.body;
67
+ this.ctrl = popoverController(opts);
68
+ this.boundary = opts.collisionBoundary ?? opts.boundary ?? "viewport";
69
+ this.theme = opts.theme;
70
+ this.fadeMs = Math.max(0, opts.fadeMs ?? 0);
71
+ this.el = h("div", {
72
+ className: "vela-popover vela-ui-layer" + (opts.className ? ` ${opts.className}` : ""),
73
+ slot: opts.slot ? `${popoverDef.slot("content")} ${opts.slot}` : popoverDef.slot("content"),
74
+ data: { position: this.ctrl.position }
75
+ });
76
+ if (opts.zIndex !== void 0) this.el.style.zIndex = String(opts.zIndex);
77
+ this.el.addEventListener("pointerdown", (e) => e.stopPropagation());
78
+ if (opts.content instanceof Node) this.el.appendChild(opts.content);
79
+ else if (typeof opts.content === "function") opts.content(this.el);
80
+ }
81
+ get open() {
82
+ return this.shown;
83
+ }
84
+ get position() {
85
+ return this.ctrl.position;
86
+ }
87
+ get align() {
88
+ return this.ctrl.align;
89
+ }
90
+ show() {
91
+ if (this.shown) {
92
+ this.place();
93
+ return;
94
+ }
95
+ const previous = showing.popover;
96
+ if (previous && previous !== this) previous.hide();
97
+ if (this.leaveTimer !== null) {
98
+ clearTimeout(this.leaveTimer);
99
+ this.leaveTimer = null;
100
+ }
101
+ this.exit?.cancel();
102
+ this.exit = null;
103
+ leaving.delete(this);
104
+ for (const p of [...leaving]) if (p.trigger === this.trigger) p.exit?.finish();
105
+ ensureUIHost(this.el, this.inheritsTokens ? void 0 : this.theme);
106
+ if (this.fadeMs > 0) {
107
+ this.el.style.transition = `opacity ${this.fadeMs}ms ease`;
108
+ this.el.style.opacity = "0";
109
+ this.el.style.pointerEvents = "";
110
+ }
111
+ this.host.appendChild(this.el);
112
+ this.shown = true;
113
+ showing.popover = this;
114
+ this.place();
115
+ if (this.fadeMs > 0) this.el.style.opacity = "1";
116
+ const onOutside = (ev) => {
117
+ const target = ev.target;
118
+ if (this.el.contains(target) || this.trigger.contains(target)) return;
119
+ markPopoverDismiss(ev);
120
+ this.hide();
121
+ };
122
+ const onKey = (ev) => {
123
+ if (ev.key !== "Escape") return;
124
+ ev.preventDefault();
125
+ ev.stopPropagation();
126
+ this.hide();
127
+ };
128
+ const onReflow = () => this.place();
129
+ setTimeout(() => {
130
+ if (this.onOutside === onOutside) document.addEventListener("pointerdown", onOutside, true);
131
+ }, 0);
132
+ document.addEventListener("keydown", onKey, true);
133
+ window.addEventListener("resize", onReflow, true);
134
+ document.addEventListener("scroll", onReflow, true);
135
+ this.onOutside = onOutside;
136
+ this.onKey = onKey;
137
+ this.onReflow = onReflow;
138
+ announceSurface(this.el, true, "popover", this.trigger);
139
+ }
140
+ hide() {
141
+ if (!this.shown) return;
142
+ this.shown = false;
143
+ announceSurface(this.el, false, "popover", this.trigger);
144
+ if (this.onOutside) document.removeEventListener("pointerdown", this.onOutside, true);
145
+ if (this.onKey) document.removeEventListener("keydown", this.onKey, true);
146
+ if (this.onReflow) {
147
+ window.removeEventListener("resize", this.onReflow, true);
148
+ document.removeEventListener("scroll", this.onReflow, true);
149
+ }
150
+ this.onOutside = null;
151
+ this.onKey = null;
152
+ this.onReflow = null;
153
+ if (this.fadeMs > 0) {
154
+ this.el.style.opacity = "0";
155
+ this.el.style.pointerEvents = "none";
156
+ this.leaveTimer = setTimeout(() => {
157
+ this.leaveTimer = null;
158
+ this.el.remove();
159
+ }, this.fadeMs);
160
+ } else {
161
+ this.exit = holdForExit(this.el, () => {
162
+ this.exit = null;
163
+ leaving.delete(this);
164
+ this.el.remove();
165
+ });
166
+ if (this.exit) leaving.add(this);
167
+ }
168
+ if (showing.popover === this) showing.popover = null;
169
+ this.ctrl.onClose?.();
170
+ }
171
+ /** Show if closed, hide if this instance is the open popover. */
172
+ toggle() {
173
+ if (this.shown) this.hide();
174
+ else this.show();
175
+ }
176
+ /** Hide for good and release the kit controls in the content. A popover built per open
177
+ * is discarded on close instead: its owner releases the content through `onClose`. */
178
+ destroy() {
179
+ this.hide();
180
+ this.exit?.finish();
181
+ disposeWithin(this.el);
182
+ }
183
+ reposition() {
184
+ if (this.shown) this.place();
185
+ }
186
+ clampRect() {
187
+ const view = viewportRect(window.innerWidth, window.innerHeight, this.ctrl.viewportInset);
188
+ const bound = this.readBoundary();
189
+ if (!bound) return view;
190
+ const inset = insetRect(bound, this.ctrl.boundaryInset);
191
+ return intersectRects(view, inset);
192
+ }
193
+ readBoundary() {
194
+ const b = this.boundary;
195
+ if (b === "viewport") return null;
196
+ const raw = typeof b === "function" ? b() : b.getBoundingClientRect();
197
+ return raw ? toRect(raw) : null;
198
+ }
199
+ place() {
200
+ const ar = this.trigger.getBoundingClientRect();
201
+ if (this.ctrl.matchWidth) {
202
+ this.el.style.minWidth = `${Math.round(Math.max(this.el.offsetWidth, ar.width))}px`;
203
+ }
204
+ const origin = this.ctrl.position === "absolute" ? this.host.getBoundingClientRect() : { left: 0, top: 0 };
205
+ const pos = placePopover({
206
+ trigger: toRect(ar),
207
+ pop: { width: this.el.offsetWidth, height: this.el.offsetHeight },
208
+ gap: this.ctrl.gap,
209
+ align: this.ctrl.align,
210
+ side: this.ctrl.side,
211
+ alignOffset: this.ctrl.alignOffset,
212
+ avoidCollisions: this.ctrl.avoidCollisions,
213
+ clamp: this.clampRect(),
214
+ originX: origin.left,
215
+ originY: origin.top
216
+ });
217
+ this.el.style.left = `${pos.left}px`;
218
+ this.el.style.top = `${pos.top}px`;
219
+ this.el.dataset.side = pos.side;
220
+ this.el.dataset.align = this.ctrl.align;
221
+ }
222
+ };
223
+ function createPopover(props) {
224
+ return new Popover(props);
225
+ }
226
+
227
+ export { POPOVER_CSS, POPOVER_STYLE_ID, Popover, closeOpenPopovers, createPopover, eventDismissedPopover, isPopoverOpen, openPopoverTrigger, popoverController, popoverDef };
@@ -0,0 +1,23 @@
1
+ import { pageUid } from './chunk-X66RJAIS.js';
2
+ import { VanillaMachine } from '@zag-js/vanilla';
3
+ export { normalizeProps, spreadProps } from '@zag-js/vanilla';
4
+
5
+ function runMachine(machine, props, render) {
6
+ const m = new VanillaMachine(machine, props);
7
+ const unsub = m.subscribe(render);
8
+ m.start();
9
+ render(m.service);
10
+ return {
11
+ service: m.service,
12
+ flush: () => render(m.service),
13
+ stop: () => {
14
+ unsub();
15
+ m.stop();
16
+ }
17
+ };
18
+ }
19
+ function nextUid(prefix) {
20
+ return pageUid(prefix);
21
+ }
22
+
23
+ export { nextUid, runMachine };
@@ -0,0 +1,31 @@
1
+ // src/lib/h.ts
2
+ function h(tag, props = {}, ...children) {
3
+ const el = document.createElement(tag);
4
+ if (props.className) el.className = props.className;
5
+ if (props.slot) el.setAttribute("data-slot", props.slot);
6
+ if (props.data) for (const [k, v] of Object.entries(props.data)) setAttr(el, `data-${k}`, v);
7
+ if (props.attrs) for (const [k, v] of Object.entries(props.attrs)) setAttr(el, k, v);
8
+ if (props.style) el.style.cssText = props.style;
9
+ if (props.text !== void 0) el.textContent = props.text;
10
+ if (props.on) for (const [type, fn] of Object.entries(props.on)) el.addEventListener(type, fn);
11
+ append(el, children);
12
+ return el;
13
+ }
14
+ function append(el, children) {
15
+ for (const c of children) {
16
+ if (c == null || c === false) continue;
17
+ if (Array.isArray(c)) append(el, c);
18
+ else if (typeof c === "string" || typeof c === "number") el.appendChild(document.createTextNode(String(c)));
19
+ else el.appendChild(c);
20
+ }
21
+ }
22
+ function addSlot(el, slot) {
23
+ const slots = (el.getAttribute("data-slot") ?? "").split(" ").filter(Boolean);
24
+ if (!slots.includes(slot)) el.setAttribute("data-slot", [...slots, slot].join(" "));
25
+ }
26
+ function setAttr(el, name, v) {
27
+ if (v == null || v === false) el.removeAttribute(name);
28
+ else el.setAttribute(name, v === true ? "" : String(v));
29
+ }
30
+
31
+ export { addSlot, append, h };
@@ -0,0 +1,50 @@
1
+ // src/lib/surface-exit.ts
2
+ var CLOSING_ATTR = "data-closing";
3
+ var SURFACE_EXIT_CAP_MS = 1e3;
4
+ function animationsOf(els) {
5
+ return els.flatMap((el) => el.getAnimations({ subtree: true }));
6
+ }
7
+ function ends(a) {
8
+ return Number.isFinite(a.effect?.getComputedTiming().endTime ?? Number.POSITIVE_INFINITY);
9
+ }
10
+ function holdForExit(els, done, opts = {}) {
11
+ const list = Array.isArray(els) ? els : [els];
12
+ if (list.length === 0 || !list.every((el) => typeof el.getAnimations === "function")) {
13
+ done();
14
+ return null;
15
+ }
16
+ const before = new Set(animationsOf(list));
17
+ for (const el of list) el.setAttribute(CLOSING_ATTR, "");
18
+ const exit = animationsOf(list).filter((a) => !before.has(a) && ends(a));
19
+ if (exit.length === 0) {
20
+ for (const el of list) el.removeAttribute(CLOSING_ATTR);
21
+ done();
22
+ return null;
23
+ }
24
+ const frozen = [...list, ...opts.inert ?? []];
25
+ const wasInert = frozen.map((el) => el.inert);
26
+ for (const el of frozen) el.inert = true;
27
+ let settled = false;
28
+ const settle = (complete) => {
29
+ if (settled) return;
30
+ settled = true;
31
+ clearTimeout(cap);
32
+ for (const el of list) el.removeAttribute(CLOSING_ATTR);
33
+ frozen.forEach((el, i) => {
34
+ el.inert = wasInert[i];
35
+ });
36
+ if (complete) done();
37
+ };
38
+ const cap = setTimeout(() => settle(true), SURFACE_EXIT_CAP_MS);
39
+ let pending = exit.length;
40
+ const one = () => {
41
+ if (--pending === 0) settle(true);
42
+ };
43
+ for (const a of exit) a.finished.then(one, one);
44
+ return {
45
+ cancel: () => settle(false),
46
+ finish: () => settle(true)
47
+ };
48
+ }
49
+
50
+ export { SURFACE_EXIT_CAP_MS, holdForExit };