@luxalgo/vela-ui 0.0.0-stage → 0.2.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 (269) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +28 -0
  4. package/README.md +86 -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 +55 -0
  12. package/dist/button.js +11 -0
  13. package/dist/calendar.d.ts +24 -0
  14. package/dist/calendar.js +1 -0
  15. package/dist/callout-bubble.d.ts +103 -0
  16. package/dist/callout-bubble.js +177 -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-3Q32K4PE.js +85 -0
  23. package/dist/chunk-6QCILIT2.js +52 -0
  24. package/dist/chunk-7VMN7NKJ.js +133 -0
  25. package/dist/chunk-A2FJ7Y7D.js +55 -0
  26. package/dist/chunk-A72NWYNP.js +26 -0
  27. package/dist/chunk-B5ZSRUDQ.js +227 -0
  28. package/dist/chunk-BXMWQIBO.js +66 -0
  29. package/dist/chunk-C3ICYMI3.js +25 -0
  30. package/dist/chunk-CC3DDNFC.js +117 -0
  31. package/dist/chunk-E2FE6V2N.js +81 -0
  32. package/dist/chunk-FN2BUFNM.js +10 -0
  33. package/dist/chunk-FVH6L7FM.js +18 -0
  34. package/dist/chunk-G7IQLY3A.js +183 -0
  35. package/dist/chunk-GVRX3UAV.js +82 -0
  36. package/dist/chunk-J2QJATCD.js +12 -0
  37. package/dist/chunk-LZWZV2ZS.js +18 -0
  38. package/dist/chunk-MJ4RUGX7.js +403 -0
  39. package/dist/chunk-MMTMOV6R.js +31 -0
  40. package/dist/chunk-P4MTEMT7.js +23 -0
  41. package/dist/chunk-Q6WTDVH6.js +31 -0
  42. package/dist/chunk-S7USVSYP.js +50 -0
  43. package/dist/chunk-TAKSIV57.js +90 -0
  44. package/dist/chunk-U3EH42YY.js +72 -0
  45. package/dist/chunk-V2Q4MRMS.js +573 -0
  46. package/dist/chunk-VMCR3S2A.js +22 -0
  47. package/dist/chunk-WBGSYCV2.js +101 -0
  48. package/dist/chunk-WGULXRWD.js +351 -0
  49. package/dist/chunk-WXH3EFV5.js +219 -0
  50. package/dist/chunk-X66RJAIS.js +14 -0
  51. package/dist/chunk-XBEL4K33.js +142 -0
  52. package/dist/chunk-Z5PINFQO.js +280 -0
  53. package/dist/collapsible.d.ts +49 -0
  54. package/dist/collapsible.js +106 -0
  55. package/dist/color-picker.d.ts +103 -0
  56. package/dist/color-picker.js +19 -0
  57. package/dist/color.d.ts +24 -0
  58. package/dist/color.js +1 -0
  59. package/dist/context-menu.d.ts +72 -0
  60. package/dist/context-menu.js +161 -0
  61. package/dist/css.d.ts +17 -0
  62. package/dist/css.js +4 -0
  63. package/dist/data-table.d.ts +40 -0
  64. package/dist/data-table.js +88 -0
  65. package/dist/date-picker.d.ts +90 -0
  66. package/dist/date-picker.js +257 -0
  67. package/dist/define-D5u3F5Dj.d.ts +21 -0
  68. package/dist/dialog.d.ts +89 -0
  69. package/dist/dialog.js +258 -0
  70. package/dist/dispose.d.ts +9 -0
  71. package/dist/dispose.js +2 -0
  72. package/dist/donut.d.ts +27 -0
  73. package/dist/donut.js +67 -0
  74. package/dist/drawer.d.ts +119 -0
  75. package/dist/drawer.js +326 -0
  76. package/dist/dropdown-menu.d.ts +114 -0
  77. package/dist/dropdown-menu.js +18 -0
  78. package/dist/empty.d.ts +21 -0
  79. package/dist/empty.js +38 -0
  80. package/dist/field.d.ts +147 -0
  81. package/dist/field.js +328 -0
  82. package/dist/glyph-select.d.ts +57 -0
  83. package/dist/glyph-select.js +17 -0
  84. package/dist/h-Bl37qUis.d.ts +24 -0
  85. package/dist/headless.d.ts +6 -0
  86. package/dist/headless.js +9 -0
  87. package/dist/hover-card.d.ts +43 -0
  88. package/dist/hover-card.js +97 -0
  89. package/dist/i18n.d.ts +20 -0
  90. package/dist/i18n.js +1 -0
  91. package/dist/icons.d.ts +20 -0
  92. package/dist/icons.js +2 -0
  93. package/dist/index.d.ts +51 -0
  94. package/dist/index.js +13 -0
  95. package/dist/input-group.d.ts +57 -0
  96. package/dist/input-group.js +87 -0
  97. package/dist/input.d.ts +54 -0
  98. package/dist/input.js +9 -0
  99. package/dist/item.d.ts +72 -0
  100. package/dist/item.js +131 -0
  101. package/dist/kbd.d.ts +19 -0
  102. package/dist/kbd.js +8 -0
  103. package/dist/kit-text.d.ts +8 -0
  104. package/dist/kit-text.js +2 -0
  105. package/dist/line-chart.d.ts +32 -0
  106. package/dist/line-chart.js +120 -0
  107. package/dist/manifest.json +4508 -0
  108. package/dist/month-grid.d.ts +45 -0
  109. package/dist/month-grid.js +157 -0
  110. package/dist/number-input.d.ts +99 -0
  111. package/dist/number-input.js +14 -0
  112. package/dist/page.d.ts +7 -0
  113. package/dist/page.js +1 -0
  114. package/dist/palette.d.ts +55 -0
  115. package/dist/palette.js +1 -0
  116. package/dist/placement.d.ts +98 -0
  117. package/dist/placement.js +1 -0
  118. package/dist/popover.d.ts +107 -0
  119. package/dist/popover.js +15 -0
  120. package/dist/scatter-chart.d.ts +32 -0
  121. package/dist/scatter-chart.js +121 -0
  122. package/dist/select.d.ts +112 -0
  123. package/dist/select.js +19 -0
  124. package/dist/slider.d.ts +46 -0
  125. package/dist/slider.js +111 -0
  126. package/dist/sort-button.d.ts +41 -0
  127. package/dist/sort-button.js +88 -0
  128. package/dist/sparkline.d.ts +22 -0
  129. package/dist/sparkline.js +72 -0
  130. package/dist/stat.d.ts +29 -0
  131. package/dist/stat.js +41 -0
  132. package/dist/styles.d.ts +22 -0
  133. package/dist/styles.js +2 -0
  134. package/dist/surface-events.d.ts +17 -0
  135. package/dist/surface-events.js +1 -0
  136. package/dist/surface-exit.d.ts +25 -0
  137. package/dist/surface-exit.js +1 -0
  138. package/dist/switch.d.ts +54 -0
  139. package/dist/switch.js +92 -0
  140. package/dist/t.d.ts +89 -0
  141. package/dist/t.js +1 -0
  142. package/dist/tabs.d.ts +65 -0
  143. package/dist/tabs.js +155 -0
  144. package/dist/text-area.d.ts +54 -0
  145. package/dist/text-area.js +9 -0
  146. package/dist/theme.d.ts +199 -0
  147. package/dist/theme.js +8 -0
  148. package/dist/theme.schema.json +1994 -0
  149. package/dist/themes/dark.css +3 -0
  150. package/dist/themes/light.css +3 -0
  151. package/dist/toggle-group.d.ts +56 -0
  152. package/dist/toggle-group.js +130 -0
  153. package/dist/tokens.d.ts +16 -0
  154. package/dist/tokens.js +3 -0
  155. package/dist/tooltip.d.ts +47 -0
  156. package/dist/tooltip.js +74 -0
  157. package/dist/variants-B4stUBnY.d.ts +16 -0
  158. package/dist/zag.d.ts +19 -0
  159. package/dist/zag.js +2 -0
  160. package/docs/theming.md +217 -0
  161. package/docs/what-to-change.md +20 -0
  162. package/docs/writing-a-component.md +250 -0
  163. package/llms.txt +71 -0
  164. package/package.json +90 -6
  165. package/registry/badge.ts +119 -0
  166. package/registry/bar-chart.ts +215 -0
  167. package/registry/button.ts +379 -0
  168. package/registry/callout-bubble.ts +347 -0
  169. package/registry/checkbox.ts +234 -0
  170. package/registry/collapsible.ts +271 -0
  171. package/registry/color-picker.ts +582 -0
  172. package/registry/context-menu.ts +208 -0
  173. package/registry/data-table.ts +215 -0
  174. package/registry/date-picker.ts +483 -0
  175. package/registry/dialog.ts +535 -0
  176. package/registry/donut.ts +145 -0
  177. package/registry/drawer.ts +636 -0
  178. package/registry/dropdown-menu.ts +762 -0
  179. package/registry/empty.ts +91 -0
  180. package/registry/field.ts +585 -0
  181. package/registry/glyph-select.ts +268 -0
  182. package/registry/hover-card.ts +222 -0
  183. package/registry/input-group.ts +229 -0
  184. package/registry/input.ts +181 -0
  185. package/registry/item.ts +376 -0
  186. package/registry/kbd.ts +64 -0
  187. package/registry/line-chart.ts +218 -0
  188. package/registry/month-grid.ts +328 -0
  189. package/registry/number-input.ts +443 -0
  190. package/registry/popover.ts +368 -0
  191. package/registry/scatter-chart.ts +221 -0
  192. package/registry/select.ts +620 -0
  193. package/registry/slider.ts +259 -0
  194. package/registry/sort-button.ts +189 -0
  195. package/registry/sparkline.ts +114 -0
  196. package/registry/stat.ts +96 -0
  197. package/registry/switch.ts +205 -0
  198. package/registry/tabs.ts +426 -0
  199. package/registry/text-area.ts +186 -0
  200. package/registry/toggle-group.ts +295 -0
  201. package/registry/tooltip.ts +156 -0
  202. package/skills/theming-vela-ui/SKILL.md +137 -0
  203. package/skills/using-vela-ui-components/SKILL.md +137 -0
  204. package/skills/writing-vela-ui-components/SKILL.md +163 -0
  205. package/src/components/badge.ts +119 -0
  206. package/src/components/bar-chart.ts +215 -0
  207. package/src/components/button.ts +379 -0
  208. package/src/components/callout-bubble.ts +347 -0
  209. package/src/components/checkbox.ts +234 -0
  210. package/src/components/collapsible.ts +271 -0
  211. package/src/components/color-picker.ts +582 -0
  212. package/src/components/context-menu.ts +208 -0
  213. package/src/components/data-table.ts +215 -0
  214. package/src/components/date-picker.ts +483 -0
  215. package/src/components/dialog.ts +535 -0
  216. package/src/components/donut.ts +145 -0
  217. package/src/components/drawer.ts +636 -0
  218. package/src/components/dropdown-menu.ts +762 -0
  219. package/src/components/empty.ts +91 -0
  220. package/src/components/field.ts +585 -0
  221. package/src/components/glyph-select.ts +268 -0
  222. package/src/components/hover-card.ts +222 -0
  223. package/src/components/input-group.ts +229 -0
  224. package/src/components/input.ts +181 -0
  225. package/src/components/item.ts +376 -0
  226. package/src/components/kbd.ts +64 -0
  227. package/src/components/line-chart.ts +218 -0
  228. package/src/components/month-grid.ts +328 -0
  229. package/src/components/number-input.ts +443 -0
  230. package/src/components/popover.ts +368 -0
  231. package/src/components/scatter-chart.ts +221 -0
  232. package/src/components/select.ts +620 -0
  233. package/src/components/slider.ts +259 -0
  234. package/src/components/sort-button.ts +189 -0
  235. package/src/components/sparkline.ts +114 -0
  236. package/src/components/stat.ts +96 -0
  237. package/src/components/switch.ts +205 -0
  238. package/src/components/tabs.ts +426 -0
  239. package/src/components/text-area.ts +186 -0
  240. package/src/components/toggle-group.ts +295 -0
  241. package/src/components/tooltip.ts +156 -0
  242. package/src/index.ts +24 -0
  243. package/src/lib/calendar.ts +117 -0
  244. package/src/lib/chart.ts +72 -0
  245. package/src/lib/color.ts +89 -0
  246. package/src/lib/component-index.ts +151 -0
  247. package/src/lib/css.ts +48 -0
  248. package/src/lib/define.ts +45 -0
  249. package/src/lib/dispose.ts +36 -0
  250. package/src/lib/h.ts +55 -0
  251. package/src/lib/headless.ts +16 -0
  252. package/src/lib/i18n.ts +30 -0
  253. package/src/lib/icons.ts +237 -0
  254. package/src/lib/kit-text.ts +26 -0
  255. package/src/lib/page.ts +24 -0
  256. package/src/lib/palette.ts +81 -0
  257. package/src/lib/placement.ts +188 -0
  258. package/src/lib/scope.ts +135 -0
  259. package/src/lib/styles.ts +53 -0
  260. package/src/lib/surface-events.ts +31 -0
  261. package/src/lib/surface-exit.ts +87 -0
  262. package/src/lib/t.ts +68 -0
  263. package/src/lib/theme.ts +664 -0
  264. package/src/lib/tokens.ts +111 -0
  265. package/src/lib/variants.ts +32 -0
  266. package/src/lib/zag.ts +46 -0
  267. package/stylelint/index.mjs +60 -0
  268. package/stylelint/lint.mjs +81 -0
  269. package/stylelint/plugin.mjs +115 -0
package/dist/donut.js ADDED
@@ -0,0 +1,67 @@
1
+ import { h } from './chunk-Q6WTDVH6.js';
2
+ import { defineComponent } from './chunk-VMCR3S2A.js';
3
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
4
+ import './chunk-2GQIZM5Z.js';
5
+ import './chunk-BXMWQIBO.js';
6
+ import './chunk-X66RJAIS.js';
7
+ import { t } from './chunk-6QCILIT2.js';
8
+
9
+ // src/components/donut.ts
10
+ var donutDef = defineComponent({
11
+ name: "donut",
12
+ parts: ["root", "ring", "track", "segment", "figure", "caption", "legend", "item", "swatch", "label", "value"],
13
+ settings: { "swatch-radius": "2px" }
14
+ });
15
+ var NS = "http://www.w3.org/2000/svg";
16
+ var R = 42;
17
+ var injectStyles = defineStyles(
18
+ "vela-ui-donut",
19
+ css`@layer vela.ui{[data-slot=donut]:where(:not([hidden])){align-items:center;gap:16px;display:flex}[data-slot=donut-ring]{flex:none}[data-slot=donut-track]{fill:none;stroke:${t.hover};stroke-width:12px}[data-slot=donut-segment]{fill:none;stroke-width:12px}[data-slot=donut-figure]{fill:${t.fg.bright};font-size:17px;font-weight:600}[data-slot=donut-caption]{fill:${t.fg.muted};font-size:10px}[data-slot=donut-legend]:where(:not([hidden])){flex-direction:column;gap:6px;min-width:140px;font-size:12px;display:flex}[data-slot=donut-item]:where(:not([hidden])){align-items:center;gap:8px;display:flex}[data-slot=donut-swatch]{border-radius:${donutDef.vars["swatch-radius"]};width:8px;height:8px}[data-slot=donut-label]{color:${t.fg.muted}}[data-slot=donut-value]{color:${t.fg.bright};font-variant-numeric:tabular-nums;margin-inline-start:auto;font-weight:600}}`
20
+ );
21
+ function svgPart(tag, part, attrs) {
22
+ const el = document.createElementNS(NS, tag);
23
+ el.setAttribute("data-slot", donutDef.slot(part));
24
+ for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, String(v));
25
+ return el;
26
+ }
27
+ function createDonut(props) {
28
+ injectStyles(document);
29
+ const ring = svgPart("svg", "ring", { viewBox: "0 0 112 112", width: 112, height: 112, "aria-hidden": "true" });
30
+ const legend = h("div", { slot: donutDef.slot("legend") });
31
+ const el = h("div", { className: props.className, slot: donutDef.slot("root") }, ring, legend);
32
+ const set = (segments, center, caption) => {
33
+ const total = segments.reduce((a, s) => a + s.value, 0) || 1;
34
+ const c = 2 * Math.PI * R;
35
+ let offset = 0;
36
+ const rings = [svgPart("circle", "track", { cx: 56, cy: 56, r: R })];
37
+ for (const s of segments) {
38
+ const len = s.value / total * c;
39
+ if (len > 0) {
40
+ const seg = svgPart("circle", "segment", { cx: 56, cy: 56, r: R, "stroke-dasharray": `${len} ${c - len}`, "stroke-dashoffset": -offset, transform: "rotate(-90 56 56)" });
41
+ seg.style.stroke = s.color;
42
+ rings.push(seg);
43
+ }
44
+ offset += len;
45
+ }
46
+ const figure = svgPart("text", "figure", { x: 56, y: caption ? 56 : 60, "text-anchor": "middle" });
47
+ figure.textContent = center;
48
+ rings.push(figure);
49
+ if (caption) {
50
+ const cap = svgPart("text", "caption", { x: 56, y: 73, "text-anchor": "middle" });
51
+ cap.textContent = caption;
52
+ rings.push(cap);
53
+ }
54
+ ring.replaceChildren(...rings);
55
+ legend.replaceChildren(
56
+ ...segments.map((s) => {
57
+ const swatch = h("span", { slot: donutDef.slot("swatch") });
58
+ swatch.style.background = s.color;
59
+ return h("div", { slot: donutDef.slot("item") }, swatch, h("span", { slot: donutDef.slot("label"), text: s.label }), h("b", { slot: donutDef.slot("value"), text: String(s.value) }));
60
+ })
61
+ );
62
+ };
63
+ set(props.segments, props.center, props.caption);
64
+ return { el, set, destroy: () => el.remove() };
65
+ }
66
+
67
+ export { createDonut, donutDef };
@@ -0,0 +1,119 @@
1
+ import { C as ComponentDef } from './define-D5u3F5Dj.js';
2
+ import * as dialog from '@zag-js/dialog';
3
+ import './t.js';
4
+
5
+ interface DrawerControllerOptions {
6
+ closeOnEscape?: boolean;
7
+ /** Tap outside (on the backdrop) dismisses — default true. */
8
+ closeOnInteractOutside?: boolean;
9
+ /** Element to focus on open (default: the machine's first-tabbable pick). The view
10
+ * points this at the sheet itself so opening never focuses an input — on touch
11
+ * devices that would pop the on-screen keyboard over the sheet. */
12
+ initialFocusEl?: () => HTMLElement | null;
13
+ onOpenChange?: (open: boolean) => void;
14
+ }
15
+ type DrawerService = dialog.Service;
16
+ type DrawerApi = dialog.Api;
17
+ interface DrawerController {
18
+ machine: typeof dialog.machine;
19
+ props: Partial<dialog.Props>;
20
+ connect(service: DrawerService): DrawerApi;
21
+ }
22
+ /** Zag's dialog machine with the drawer's defaults, for any view layer. */
23
+ declare function drawerController(opts?: DrawerControllerOptions): DrawerController;
24
+ declare const drawerDef: ComponentDef<"drawer", "backdrop" | "body" | "title" | "content" | "positioner" | "grab", "radius" | "edge-radius" | "side-width" | "grab-radius">;
25
+ type DrawerProps = DrawerOptions;
26
+ type DrawerDirection = 'top' | 'right' | 'bottom' | 'left';
27
+ interface DrawerOptions extends DrawerControllerOptions {
28
+ /** The edge it slides in from (default `'bottom'`, a bottom sheet). A drag toward that
29
+ * edge dismisses it. */
30
+ direction?: DrawerDirection;
31
+ title?: string;
32
+ content?: Node | ((body: HTMLElement) => void);
33
+ host?: HTMLElement;
34
+ /** Horizontal swipe across the sheet (fires on release; `'left'` = the finger moved
35
+ * left). Gestures that start inside a horizontally scrollable strip (tabs, chip
36
+ * rows) keep their native scroll instead. */
37
+ onSwipe?: (dir: 'left' | 'right') => void;
38
+ }
39
+ /** How far a move goes toward the drawer's edge (its dismiss direction), and across it. A
40
+ * side drawer's `right` is the inline end, so `mirrored` (right to left) flips it. */
41
+ declare function dismissAxis(dx: number, dy: number, direction: DrawerDirection, mirrored?: boolean): {
42
+ toward: number;
43
+ across: number;
44
+ };
45
+ /**
46
+ * Classify a pointer gesture over the sheet — PURE. `'pending'` until the movement
47
+ * clears the slop; then a decided pull toward the drawer's edge (down for a bottom sheet)
48
+ * becomes the dismiss `'drag'` (only while every scroller under the finger is at rest — a
49
+ * scrolled list keeps native scrolling), a decidedly horizontal move on a top or bottom
50
+ * sheet becomes an `'hswipe'` (when the sheet has a swipe handler and the finger is not on a
51
+ * strip that scrolls sideways itself), and everything else stays native `'scroll'`.
52
+ */
53
+ declare function classifyGesture(dx: number, dy: number, ctx: {
54
+ canSwipe: boolean;
55
+ scrolled: boolean;
56
+ hScrollable: boolean;
57
+ }, direction?: DrawerDirection, mirrored?: boolean): 'pending' | 'drag' | 'hswipe' | 'scroll';
58
+ /** Whether releasing a dismiss drag `d` px toward the edge closes the sheet, given the
59
+ * sheet's size along that axis — PURE. */
60
+ declare function dragDismisses(d: number, panelSizePx: number): boolean;
61
+ /** The direction a released horizontal swipe fires, or null when it was too short
62
+ * (or more vertical than horizontal after all) — PURE. */
63
+ declare function swipeDirection(dx: number, dy: number): 'left' | 'right' | null;
64
+ declare class Drawer {
65
+ /** Caller-owned content area — append your rows/lists here. */
66
+ readonly body: HTMLElement;
67
+ private readonly backdrop;
68
+ private readonly positioner;
69
+ private readonly panel;
70
+ private readonly titleEl;
71
+ private readonly handle;
72
+ private readonly ctrl;
73
+ private readonly direction;
74
+ constructor(opts?: DrawerOptions);
75
+ /** Any element between `from` and the panel that has already been scrolled down —
76
+ * a downward pull there must scroll it back up, never drag the sheet. */
77
+ private scrolledAncestor;
78
+ /** Any element between `from` and the panel that a pull toward this drawer's edge would
79
+ * scroll instead: scrolled down (bottom sheet), not at its end (top sheet), or scrolling
80
+ * sideways (side drawers). */
81
+ private scrollsTowardEdge;
82
+ /** Any element between `from` and the panel that scrolls horizontally on its own
83
+ * (the tab strip, chip rows) — a sideways move there is ITS scroll, not a swipe. */
84
+ private hScrollableAncestor;
85
+ /**
86
+ * One gesture recognizer for the whole sheet. A downward pull dismisses from
87
+ * anywhere — the grab handle immediately, the content once it is decidedly vertical
88
+ * and its scroller is at rest (a scrolled list keeps native scrolling). A decidedly
89
+ * horizontal move becomes an `onSwipe` (tabbed drawers flip pages with it). The
90
+ * non-passive touchmove hook is what keeps the browser from claiming the pull as a
91
+ * scroll once the sheet is (or may become) the drag target.
92
+ */
93
+ private wireGestures;
94
+ setTitle(title: string): void;
95
+ private opener;
96
+ private wasOpen;
97
+ /** The sheet and scrim's exit animation after a close; a reopen cancels it. */
98
+ private exit;
99
+ private destroyed;
100
+ private setShown;
101
+ /** Keep the just-closed sheet up through its exit animation, then hide it — or
102
+ * remove it, when it was destroyed meanwhile. `spreadProps` re-applies the close
103
+ * props' `hidden` only when its value changes, so lifting it keeps the sheet and
104
+ * scrim up until the exit ends. The positioner spans the host: inert, it lets
105
+ * clicks through to the page while the sheet animates out. */
106
+ private holdExit;
107
+ private detach;
108
+ /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
109
+ * teardown that outruns the machine's close notification). */
110
+ private restoreOpener;
111
+ private announce;
112
+ get open(): boolean;
113
+ show(): void;
114
+ hide(): void;
115
+ destroy(): void;
116
+ }
117
+ declare function createDrawer(props?: DrawerProps): Drawer;
118
+
119
+ export { Drawer, type DrawerApi, type DrawerController, type DrawerControllerOptions, type DrawerDirection, type DrawerOptions, type DrawerProps, type DrawerService, classifyGesture, createDrawer, dismissAxis, dragDismisses, drawerController, drawerDef, swipeDirection };
package/dist/drawer.js ADDED
@@ -0,0 +1,326 @@
1
+ import { announceSurface } from './chunk-J2QJATCD.js';
2
+ import { holdForExit } from './chunk-S7USVSYP.js';
3
+ import { disposeWithin } from './chunk-A72NWYNP.js';
4
+ import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-P4MTEMT7.js';
5
+ import { defineComponent } from './chunk-VMCR3S2A.js';
6
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
7
+ import './chunk-2GQIZM5Z.js';
8
+ import './chunk-BXMWQIBO.js';
9
+ import './chunk-X66RJAIS.js';
10
+ import { t } from './chunk-6QCILIT2.js';
11
+ import * as dialog from '@zag-js/dialog';
12
+
13
+ function drawerController(opts = {}) {
14
+ return {
15
+ machine: dialog.machine,
16
+ props: {
17
+ id: nextUid("vela-drawer"),
18
+ modal: true,
19
+ closeOnEscape: opts.closeOnEscape ?? true,
20
+ closeOnInteractOutside: opts.closeOnInteractOutside ?? true,
21
+ initialFocusEl: opts.initialFocusEl,
22
+ onOpenChange: (d) => opts.onOpenChange?.(d.open)
23
+ },
24
+ connect: (service) => dialog.connect(service, normalizeProps)
25
+ };
26
+ }
27
+ var drawerDef = defineComponent({
28
+ name: "drawer",
29
+ parts: ["backdrop", "positioner", "content", "grab", "title", "body"],
30
+ settings: { radius: "14px 14px 0 0", "edge-radius": "14px", "side-width": "min(75%, 360px)", "grab-radius": "2px" }
31
+ });
32
+ var injectStyles = defineStyles(
33
+ "vela-ui-drawer",
34
+ css`@layer vela.ui{[data-slot=drawer-backdrop]{background:${t.backdrop};z-index:${t.z.dialog};position:fixed;inset:0}[data-slot=drawer-backdrop]:is([data-layout] *){position:absolute}[data-slot=drawer-positioner]{z-index:${t.z.dialog};justify-content:center;align-items:flex-end;display:flex;position:fixed;inset:0}[data-slot=drawer-positioner]:is([data-layout] *){position:absolute}[data-slot=drawer-content]{background:${t.surface};color:${t.fg};border:1px solid ${t.border.strong};border-radius:${drawerDef.vars.radius};box-shadow:${t.shadow.dialog};border-bottom:none;outline:2px solid #0000;flex-direction:column;width:100%;max-height:85%;font-size:13px;display:flex;overflow:hidden}[data-slot=drawer-content][data-state=open]{animation:vela-drawer-in ${t.dur.med} ${t.ease}}[data-slot=drawer-content][data-direction=top]{border:1px solid ${t.border.strong};border-radius:0;border-top:none;border-end-end-radius:${drawerDef.vars["edge-radius"]};border-end-start-radius:${drawerDef.vars["edge-radius"]}}[data-slot=drawer-content][data-direction=left],[data-slot=drawer-content][data-direction=right]{border:1px solid ${t.border.strong};width:${drawerDef.vars["side-width"]};border-radius:0;height:100%;max-height:none}[data-slot=drawer-content][data-direction=right]{border-inline-end:none;border-start-start-radius:${drawerDef.vars["edge-radius"]};border-end-start-radius:${drawerDef.vars["edge-radius"]}}[data-slot=drawer-content][data-direction=left]{border-inline-start:none;border-start-end-radius:${drawerDef.vars["edge-radius"]};border-end-end-radius:${drawerDef.vars["edge-radius"]}}[data-slot=drawer-content][data-direction=top][data-state=open]{animation-name:vela-drawer-in-top}[data-slot=drawer-content][data-direction=right][data-state=open]{animation-name:vela-drawer-in-right}[data-slot=drawer-content][data-direction=left][data-state=open],[data-slot=drawer-content][data-direction=right][data-state=open]:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){animation-name:vela-drawer-in-left}[data-slot=drawer-content][data-direction=left][data-state=open]:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){animation-name:vela-drawer-in-right}[data-slot=drawer-positioner][data-direction=top]{align-items:flex-start}[data-slot=drawer-positioner][data-direction=right]{justify-content:flex-end;align-items:stretch}[data-slot=drawer-positioner][data-direction=left]{justify-content:flex-start;align-items:stretch}@keyframes vela-drawer-in{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes vela-drawer-in-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes vela-drawer-in-right{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes vela-drawer-in-left{0%{transform:translate(-100%)}to{transform:translate(0)}}[data-slot=drawer-grab]{cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;flex:none;justify-content:center;align-items:center;padding:10px 0 6px;display:flex}[data-slot=drawer-grab]:before{content:"";border-radius:${drawerDef.vars["grab-radius"]};background:${t.border.strong};width:36px;height:4px}[data-slot=drawer-content][data-direction=top] [data-slot=drawer-grab]{order:1;padding:6px 0 10px}[data-slot=drawer-content]:is([data-direction=left],[data-direction=right]) [data-slot=drawer-grab]{display:none}[data-slot=drawer-title]{letter-spacing:.2px;color:${t.fg.bright};-webkit-user-select:none;user-select:none;flex:none;padding:0 16px 10px;font-size:15px;font-weight:600}[data-slot=drawer-title]:empty{display:none}[data-slot=drawer-body]{overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;min-height:0;padding:0 ${t.space[3]} calc(${t.space[3]} + env(safe-area-inset-bottom,0px));flex:auto;overflow-y:auto}}`
35
+ );
36
+ var DISMISS_FRACTION = 0.33;
37
+ var DISMISS_PX = 96;
38
+ var SLOP_PX = 8;
39
+ var HSWIPE_MIN_PX = 48;
40
+ function dismissAxis(dx, dy, direction, mirrored = false) {
41
+ if (direction === "bottom") return { toward: dy, across: dx };
42
+ if (direction === "top") return { toward: -dy, across: dx };
43
+ const x = mirrored ? -dx : dx;
44
+ return { toward: direction === "right" ? x : -x, across: dy };
45
+ }
46
+ function classifyGesture(dx, dy, ctx, direction = "bottom", mirrored = false) {
47
+ if (Math.max(Math.abs(dx), Math.abs(dy)) < SLOP_PX) return "pending";
48
+ const { toward, across } = dismissAxis(dx, dy, direction, mirrored);
49
+ if (Math.abs(toward) > Math.abs(across)) return toward > 0 && !ctx.scrolled ? "drag" : "scroll";
50
+ const vertical = direction === "top" || direction === "bottom";
51
+ return vertical && ctx.canSwipe && !ctx.hScrollable ? "hswipe" : "scroll";
52
+ }
53
+ function dragDismisses(d, panelSizePx) {
54
+ return d >= Math.min(DISMISS_PX, panelSizePx * DISMISS_FRACTION);
55
+ }
56
+ function swipeDirection(dx, dy) {
57
+ if (Math.abs(dx) < HSWIPE_MIN_PX || Math.abs(dx) <= Math.abs(dy)) return null;
58
+ return dx < 0 ? "left" : "right";
59
+ }
60
+ var Drawer = class {
61
+ constructor(opts = {}) {
62
+ this.opener = null;
63
+ this.wasOpen = false;
64
+ /** The sheet and scrim's exit animation after a close; a reopen cancels it. */
65
+ this.exit = null;
66
+ this.destroyed = false;
67
+ const doc = (opts.host ?? document.body).ownerDocument;
68
+ injectStyles(doc);
69
+ const host = opts.host ?? doc.body;
70
+ this.backdrop = doc.createElement("div");
71
+ this.backdrop.className = "vela-drawer-backdrop vela-ui-layer";
72
+ this.backdrop.dataset.slot = drawerDef.slot("backdrop");
73
+ this.positioner = doc.createElement("div");
74
+ this.positioner.className = "vela-drawer-positioner vela-ui-layer";
75
+ this.positioner.dataset.slot = drawerDef.slot("positioner");
76
+ this.panel = doc.createElement("div");
77
+ this.panel.className = "vela-drawer";
78
+ this.panel.dataset.slot = drawerDef.slot("content");
79
+ this.panel.tabIndex = -1;
80
+ const grab = doc.createElement("div");
81
+ grab.className = "vela-drawer-grab";
82
+ grab.dataset.slot = drawerDef.slot("grab");
83
+ this.titleEl = doc.createElement("div");
84
+ this.titleEl.className = "vela-drawer-title";
85
+ this.titleEl.dataset.slot = drawerDef.slot("title");
86
+ this.titleEl.textContent = opts.title ?? "";
87
+ this.body = doc.createElement("div");
88
+ this.body.className = "vela-drawer-body";
89
+ this.body.dataset.slot = drawerDef.slot("body");
90
+ if (opts.content instanceof Node) this.body.appendChild(opts.content);
91
+ else if (typeof opts.content === "function") opts.content(this.body);
92
+ this.direction = opts.direction ?? "bottom";
93
+ if (this.direction !== "bottom") {
94
+ this.positioner.dataset.direction = this.direction;
95
+ this.panel.dataset.direction = this.direction;
96
+ }
97
+ this.panel.append(grab, this.titleEl, this.body);
98
+ this.positioner.appendChild(this.panel);
99
+ host.append(this.backdrop, this.positioner);
100
+ this.wireGestures(grab, opts.onSwipe);
101
+ this.ctrl = drawerController({ ...opts, initialFocusEl: () => this.panel });
102
+ const mid = String(this.ctrl.props.id);
103
+ this.handle = runMachine(this.ctrl.machine, this.ctrl.props, (service) => {
104
+ const api = this.ctrl.connect(service);
105
+ const closing = this.wasOpen && !api.open;
106
+ if (closing) this.announce(false);
107
+ spreadProps(this.backdrop, api.getBackdropProps(), mid);
108
+ spreadProps(this.positioner, api.getPositionerProps(), mid);
109
+ spreadProps(this.panel, api.getContentProps(), mid);
110
+ spreadProps(this.titleEl, api.getTitleProps(), mid);
111
+ if (api.open) {
112
+ this.exit?.cancel();
113
+ this.exit = null;
114
+ this.setShown(true);
115
+ } else if (closing) {
116
+ this.holdExit();
117
+ } else if (!this.exit) {
118
+ this.setShown(false);
119
+ }
120
+ if (api.open && !this.wasOpen) this.announce(true);
121
+ if (this.wasOpen && !api.open) this.restoreOpener();
122
+ this.wasOpen = api.open;
123
+ });
124
+ }
125
+ /** Any element between `from` and the panel that has already been scrolled down —
126
+ * a downward pull there must scroll it back up, never drag the sheet. */
127
+ scrolledAncestor(from) {
128
+ let el = from instanceof Element ? from : null;
129
+ while (el && el !== this.panel) {
130
+ if (el.scrollTop > 0) return true;
131
+ el = el.parentElement;
132
+ }
133
+ return false;
134
+ }
135
+ /** Any element between `from` and the panel that a pull toward this drawer's edge would
136
+ * scroll instead: scrolled down (bottom sheet), not at its end (top sheet), or scrolling
137
+ * sideways (side drawers). */
138
+ scrollsTowardEdge(from) {
139
+ if (this.direction === "bottom") return this.scrolledAncestor(from);
140
+ if (this.direction !== "top") return this.hScrollableAncestor(from);
141
+ let el = from instanceof Element ? from : null;
142
+ while (el && el !== this.panel) {
143
+ if (el.scrollTop + el.clientHeight < el.scrollHeight - 1) return true;
144
+ el = el.parentElement;
145
+ }
146
+ return false;
147
+ }
148
+ /** Any element between `from` and the panel that scrolls horizontally on its own
149
+ * (the tab strip, chip rows) — a sideways move there is ITS scroll, not a swipe. */
150
+ hScrollableAncestor(from) {
151
+ let el = from instanceof Element ? from : null;
152
+ while (el && el !== this.panel) {
153
+ if (el.scrollWidth > el.clientWidth + 1) return true;
154
+ el = el.parentElement;
155
+ }
156
+ return false;
157
+ }
158
+ /**
159
+ * One gesture recognizer for the whole sheet. A downward pull dismisses from
160
+ * anywhere — the grab handle immediately, the content once it is decidedly vertical
161
+ * and its scroller is at rest (a scrolled list keeps native scrolling). A decidedly
162
+ * horizontal move becomes an `onSwipe` (tabbed drawers flip pages with it). The
163
+ * non-passive touchmove hook is what keeps the browser from claiming the pull as a
164
+ * scroll once the sheet is (or may become) the drag target.
165
+ */
166
+ wireGestures(grab, onSwipe) {
167
+ let startX = 0;
168
+ let startY = 0;
169
+ let dx = 0;
170
+ let dy = 0;
171
+ let d = 0;
172
+ let mirrored = false;
173
+ let mode = "idle";
174
+ const dir = this.direction;
175
+ const vertical = dir === "top" || dir === "bottom";
176
+ const beginDrag = (e) => {
177
+ mode = "drag";
178
+ startX = e.clientX;
179
+ startY = e.clientY;
180
+ this.panel.style.transition = "none";
181
+ try {
182
+ this.panel.setPointerCapture(e.pointerId);
183
+ } catch {
184
+ }
185
+ };
186
+ this.panel.addEventListener("pointerdown", (e) => {
187
+ if (e.isPrimary === false) return;
188
+ startX = e.clientX;
189
+ startY = e.clientY;
190
+ dx = 0;
191
+ dy = 0;
192
+ d = 0;
193
+ mirrored = !vertical && getComputedStyle(this.panel).direction === "rtl";
194
+ if (grab.contains(e.target)) beginDrag(e);
195
+ else mode = "pending";
196
+ });
197
+ this.panel.addEventListener("pointermove", (e) => {
198
+ if (mode === "idle" || mode === "scroll") return;
199
+ dx = e.clientX - startX;
200
+ dy = e.clientY - startY;
201
+ if (mode === "pending") {
202
+ const intent = classifyGesture(
203
+ dx,
204
+ dy,
205
+ {
206
+ canSwipe: !!onSwipe,
207
+ scrolled: this.scrollsTowardEdge(e.target),
208
+ hScrollable: this.hScrollableAncestor(e.target)
209
+ },
210
+ dir,
211
+ mirrored
212
+ );
213
+ if (intent === "pending") return;
214
+ if (intent === "drag") beginDrag(e);
215
+ else mode = intent;
216
+ }
217
+ if (mode === "drag") {
218
+ d = Math.max(0, dismissAxis(e.clientX - startX, e.clientY - startY, dir, mirrored).toward);
219
+ const shift = dir === "bottom" ? d : dir === "top" ? -d : dir === "right" !== mirrored ? d : -d;
220
+ this.panel.style.transform = d > 0 ? vertical ? `translateY(${shift}px)` : `translateX(${shift}px)` : "";
221
+ }
222
+ });
223
+ this.panel.addEventListener(
224
+ "touchmove",
225
+ (e) => {
226
+ if (mode === "drag" || mode === "hswipe") {
227
+ e.preventDefault();
228
+ return;
229
+ }
230
+ if (mode !== "pending") return;
231
+ const t2 = e.touches[0];
232
+ if (!t2) return;
233
+ const { toward, across } = dismissAxis(t2.clientX - startX, t2.clientY - startY, dir, mirrored);
234
+ if (toward > Math.abs(across) && !this.scrollsTowardEdge(e.target)) e.preventDefault();
235
+ },
236
+ { passive: false }
237
+ );
238
+ const settle = () => {
239
+ if (mode === "idle") return;
240
+ const finished = mode;
241
+ mode = "idle";
242
+ if (finished === "drag") {
243
+ this.panel.style.transition = "";
244
+ this.panel.style.transform = "";
245
+ const box = this.panel.getBoundingClientRect();
246
+ if (dragDismisses(d, vertical ? box.height : box.width)) this.hide();
247
+ } else if (finished === "hswipe") {
248
+ const dir2 = swipeDirection(dx, dy);
249
+ if (dir2) onSwipe?.(dir2);
250
+ }
251
+ };
252
+ this.panel.addEventListener("pointerup", settle);
253
+ this.panel.addEventListener("pointercancel", settle);
254
+ }
255
+ setTitle(title) {
256
+ this.titleEl.textContent = title;
257
+ }
258
+ setShown(shown) {
259
+ this.backdrop.style.display = shown ? "" : "none";
260
+ this.positioner.style.display = shown ? "" : "none";
261
+ }
262
+ /** Keep the just-closed sheet up through its exit animation, then hide it — or
263
+ * remove it, when it was destroyed meanwhile. `spreadProps` re-applies the close
264
+ * props' `hidden` only when its value changes, so lifting it keeps the sheet and
265
+ * scrim up until the exit ends. The positioner spans the host: inert, it lets
266
+ * clicks through to the page while the sheet animates out. */
267
+ holdExit() {
268
+ const held = [this.panel, this.backdrop];
269
+ for (const el of held) el.hidden = false;
270
+ this.exit = holdForExit(
271
+ held,
272
+ () => {
273
+ this.exit = null;
274
+ if (this.destroyed) {
275
+ this.detach();
276
+ } else if (!this.open) {
277
+ for (const el of held) el.hidden = true;
278
+ this.setShown(false);
279
+ }
280
+ },
281
+ { inert: [this.positioner] }
282
+ );
283
+ }
284
+ detach() {
285
+ this.backdrop.remove();
286
+ this.positioner.remove();
287
+ }
288
+ /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
289
+ * teardown that outruns the machine's close notification). */
290
+ restoreOpener() {
291
+ const opener = this.opener;
292
+ this.opener = null;
293
+ if (opener?.isConnected) opener.focus({ preventScroll: true });
294
+ }
295
+ announce(open) {
296
+ const opener = this.opener === this.panel.ownerDocument.body ? null : this.opener;
297
+ announceSurface(this.panel, open, "drawer", opener);
298
+ }
299
+ get open() {
300
+ return this.ctrl.connect(this.handle.service).open;
301
+ }
302
+ show() {
303
+ this.opener = this.panel.ownerDocument.activeElement;
304
+ this.ctrl.connect(this.handle.service).setOpen(true);
305
+ }
306
+ hide() {
307
+ this.ctrl.connect(this.handle.service).setOpen(false);
308
+ }
309
+ destroy() {
310
+ if (this.wasOpen && !this.open) this.handle.flush();
311
+ this.handle.stop();
312
+ this.destroyed = true;
313
+ if (this.wasOpen) {
314
+ this.wasOpen = false;
315
+ this.announce(false);
316
+ }
317
+ this.restoreOpener();
318
+ disposeWithin(this.panel);
319
+ if (!this.exit) this.detach();
320
+ }
321
+ };
322
+ function createDrawer(props = {}) {
323
+ return new Drawer(props);
324
+ }
325
+
326
+ export { Drawer, classifyGesture, createDrawer, dismissAxis, dragDismisses, drawerController, drawerDef, swipeDirection };
@@ -0,0 +1,114 @@
1
+ import { C as ComponentDef } from './define-D5u3F5Dj.js';
2
+ import { PlacementProps } from './placement.js';
3
+ import { Translator } from './i18n.js';
4
+ import * as zagMenu from '@zag-js/menu';
5
+ import './t.js';
6
+
7
+ /** One menu entry. `id` is the selection value reported to `onSelect`. */
8
+ interface MenuItemDescriptor {
9
+ id: string;
10
+ label: string;
11
+ disabled?: boolean;
12
+ /** Draw a separator line above this item. */
13
+ separatorBefore?: boolean;
14
+ /** Right-aligned hint (e.g. a shortcut display from KeymapManager). */
15
+ hint?: string;
16
+ /** Selected state (undefined = plain item). A plain checked item renders as a
17
+ * highlighted row (brighter surface + bright ink) — or, in a menu built with
18
+ * `checkmarks`, as a leading ✓ with the row surface left free for hover. */
19
+ checked?: boolean;
20
+ /** Render as a SWITCH row (a right-aligned toggle pill reflecting `checked`)
21
+ * instead of the selected-row highlight, and keep the menu OPEN on selection —
22
+ * the shape for boolean settings living inside a dropdown. */
23
+ toggle?: boolean;
24
+ /** Icon id (see the `vela/ui` icon registry) rendered before the label. A level where
25
+ * any row has one gives its iconless rows an empty slot, so the labels align. */
26
+ icon?: string;
27
+ /** Favorite-star affordance at the row's right edge: `false` renders an outline
28
+ * star revealed on row hover, `true` a filled star that stays visible. Clicking
29
+ * it reports through the menu's `onFavorite` WITHOUT selecting (or closing) the
30
+ * row — undefined rows carry no star at all. */
31
+ favorite?: boolean;
32
+ /** Nested entries — the row becomes a submenu trigger opening its own list to the side.
33
+ * A branch is not selectable itself: `onSelect` only ever reports leaf ids. */
34
+ submenu?: readonly MenuItemDescriptor[];
35
+ }
36
+ interface DropdownMenuControllerOptions extends PlacementProps {
37
+ items: readonly MenuItemDescriptor[];
38
+ onSelect?: (id: string) => void;
39
+ /** @deprecated Use `side` and `align`. */
40
+ placement?: zagMenu.Props['positioning'] extends infer P | undefined ? (P extends {
41
+ placement?: infer PL;
42
+ } ? PL : never) : never;
43
+ onOpenChange?: (open: boolean) => void;
44
+ /** Pin the floating list to this rect (viewport coords). Used to keep an open
45
+ * menu still when its trigger moves — starring a timeframe adds a chip and
46
+ * would otherwise drag the list with the caret. `null` falls through to the
47
+ * live trigger. */
48
+ getAnchorRect?: () => {
49
+ x: number;
50
+ y: number;
51
+ width: number;
52
+ height: number;
53
+ } | null;
54
+ /** Share the trigger's DOM id with other machines composed on the same element. */
55
+ triggerId?: string;
56
+ /** Pin the machine's own id instead of taking a fresh one. A parent registers its
57
+ * submenus under this key, so rebuilding a branch replaces its entry rather than
58
+ * piling a new one on top. */
59
+ id?: string;
60
+ }
61
+ type DropdownMenuService = zagMenu.Service;
62
+ type DropdownMenuApi = zagMenu.Api;
63
+ interface DropdownMenuController {
64
+ machine: typeof zagMenu.machine;
65
+ props: Partial<zagMenu.Props>;
66
+ connect(service: DropdownMenuService): DropdownMenuApi;
67
+ }
68
+ /** Zag's menu machine with the options mapped onto it, for any view layer. */
69
+ declare function dropdownMenuController(opts: DropdownMenuControllerOptions): DropdownMenuController;
70
+ declare const dropdownMenuDef: ComponentDef<"dropdown-menu", "badge" | "label" | "mark" | "switch" | "star" | "icon" | "content" | "item" | "hint" | "arrow" | "separator", "radius" | "switch-radius">;
71
+ type DropdownMenuProps = DropdownMenuOptions;
72
+ interface DropdownMenuOptions extends DropdownMenuControllerOptions {
73
+ /** Element that opens the menu on click (gets the machine's trigger props). */
74
+ trigger?: HTMLElement;
75
+ host?: HTMLElement;
76
+ /** Override the root list's min-width (the stylesheet default suits full-word labels;
77
+ * compact lists like the timeframe dropdown pass something snug). Submenus keep the
78
+ * default. */
79
+ minWidth?: string;
80
+ /** Star-toggle reports from items carrying `favorite` (the menu stays open — starring
81
+ * is a side action on a row, never a selection). */
82
+ onFavorite?: (id: string, on: boolean) => void;
83
+ /** Mark checked items with a leading ✓ instead of the selected-row background wash —
84
+ * the shape for pointer-anchored action menus (right-click context menus), where a
85
+ * washed row reads as hover state. A level holding checkable rows reserves the mark
86
+ * column on all its rows so labels align; an all-action level keeps its natural left
87
+ * edge. Submenus inherit the mode. Dropdown menus (a trigger button opening a
88
+ * picker) keep the default wash. */
89
+ checkmarks?: boolean;
90
+ /** Sit each row's icon in a squared badge (a 24px rounded tile with a faint fill and a soft
91
+ * border) instead of a bare glyph: its glyph brightens on a hovered row, and the tile
92
+ * inverts on the selected one. A
93
+ * level where some rows carry an icon reserves the badge column on all its rows so
94
+ * labels align; a level with no icon keeps its natural left edge. With `checkmarks`,
95
+ * the mark column leads and the badge follows. Submenus inherit the mode. */
96
+ iconBadges?: boolean;
97
+ /** The translator of the menu's own words (a star's name). Default: the kit build's, else English. */
98
+ i18n?: Translator | null;
99
+ }
100
+ declare class DropdownMenu {
101
+ private readonly root;
102
+ constructor(opts: DropdownMenuOptions);
103
+ get api(): zagMenu.Api;
104
+ open(): void;
105
+ /** Open anchored to a viewport point (context menus). */
106
+ openAt(clientX: number, clientY: number): void;
107
+ close(): void;
108
+ /** Swap the item descriptors (e.g. checked states) and re-project. */
109
+ setItems(items: readonly MenuItemDescriptor[]): void;
110
+ destroy(): void;
111
+ }
112
+ declare function createDropdownMenu(props: DropdownMenuProps): DropdownMenu;
113
+
114
+ export { DropdownMenu, type DropdownMenuApi, type DropdownMenuController, type DropdownMenuControllerOptions, type DropdownMenuOptions, type DropdownMenuProps, type DropdownMenuService, type MenuItemDescriptor, createDropdownMenu, dropdownMenuController, dropdownMenuDef };
@@ -0,0 +1,18 @@
1
+ export { DropdownMenu, createDropdownMenu, dropdownMenuController, dropdownMenuDef } from './chunk-WGULXRWD.js';
2
+ import './chunk-G7IQLY3A.js';
3
+ import './chunk-FVH6L7FM.js';
4
+ import './chunk-FN2BUFNM.js';
5
+ import './chunk-J2QJATCD.js';
6
+ import './chunk-S7USVSYP.js';
7
+ import './chunk-V2Q4MRMS.js';
8
+ import './chunk-TAKSIV57.js';
9
+ import './chunk-MMTMOV6R.js';
10
+ import './chunk-3Q32K4PE.js';
11
+ import './chunk-P4MTEMT7.js';
12
+ import './chunk-Q6WTDVH6.js';
13
+ import './chunk-VMCR3S2A.js';
14
+ import './chunk-XBEL4K33.js';
15
+ import './chunk-2GQIZM5Z.js';
16
+ import './chunk-BXMWQIBO.js';
17
+ import './chunk-X66RJAIS.js';
18
+ import './chunk-6QCILIT2.js';
@@ -0,0 +1,21 @@
1
+ import { C as ComponentDef } from './define-D5u3F5Dj.js';
2
+ import './t.js';
3
+
4
+ declare const emptyDef: ComponentDef<"empty", "root" | "title" | "icon" | "description", "icon-radius">;
5
+ interface EmptyProps {
6
+ /** Icon id from the kit's registry, shown in a tile above the title. */
7
+ icon?: string;
8
+ title: string;
9
+ description?: string;
10
+ /** A control under the text (a button that adds the first item). */
11
+ action?: HTMLElement;
12
+ /** Extra class names (layout hooks). */
13
+ className?: string;
14
+ }
15
+ interface EmptyHandle {
16
+ readonly el: HTMLElement;
17
+ destroy(): void;
18
+ }
19
+ declare function createEmpty(props: EmptyProps): EmptyHandle;
20
+
21
+ export { type EmptyHandle, type EmptyProps, createEmpty, emptyDef };