@luxalgo/vela 0.8.0 → 0.8.2

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 (49) hide show
  1. package/NOTICE +1 -1
  2. package/README.md +16 -8
  3. package/dist/{DataProvider-BrlxntPN.d.cts → DataProvider-COGDs9Xg.d.cts} +1 -1
  4. package/dist/{DataProvider-DwFIoV4r.d.ts → DataProvider-DpOWZD8F.d.ts} +1 -1
  5. package/dist/{chunk-KA77UTRF.js → chunk-27UTYE7T.js} +25 -2
  6. package/dist/{chunk-EZ5FWVLA.js → chunk-DPAA3SRT.js} +94 -13
  7. package/dist/{chunk-BZQM2XO7.js → chunk-HKNO24GD.js} +13 -1
  8. package/dist/{chunk-2IAETM2I.js → chunk-NLDTVFOI.js} +79 -6
  9. package/dist/{chunk-E3GU6AUI.js → chunk-R2JMNIHY.js} +68 -23
  10. package/dist/{chunk-QBPUT5SU.js → chunk-T3DZIR5Y.js} +211 -54
  11. package/dist/{contributions-tjNExo1o.d.ts → contributions-Cgm9RJYP.d.cts} +38 -11
  12. package/dist/{contributions-CtlptxR8.d.cts → contributions-bWgwyiVi.d.ts} +38 -11
  13. package/dist/index.cjs +317 -62
  14. package/dist/index.d.cts +8 -8
  15. package/dist/index.d.ts +8 -8
  16. package/dist/index.js +4 -4
  17. package/dist/{options-BnEPUuVV.d.ts → options-NAUHiQEC.d.cts} +3 -3
  18. package/dist/{options-BnEPUuVV.d.cts → options-NAUHiQEC.d.ts} +3 -3
  19. package/dist/{plugin-BWxJRKzS.d.cts → plugin-CjjzZX2F.d.cts} +4 -4
  20. package/dist/{plugin-e2WUEtiI.d.ts → plugin-CqxWoDKS.d.ts} +4 -4
  21. package/dist/plugin.cjs +20 -6
  22. package/dist/plugin.d.cts +5 -5
  23. package/dist/plugin.d.ts +5 -5
  24. package/dist/plugin.js +2 -2
  25. package/dist/providers/binance.d.cts +2 -2
  26. package/dist/providers/binance.d.ts +2 -2
  27. package/dist/providers/coinbase.d.cts +2 -2
  28. package/dist/providers/coinbase.d.ts +2 -2
  29. package/dist/providers/hyperliquid.d.cts +2 -2
  30. package/dist/providers/hyperliquid.d.ts +2 -2
  31. package/dist/{side-panel-HF0IAzwf.d.cts → side-panel-wMNfgyZb.d.cts} +13 -0
  32. package/dist/{side-panel-HF0IAzwf.d.ts → side-panel-wMNfgyZb.d.ts} +13 -0
  33. package/dist/{statusline-model-zKXtGIjj.d.ts → statusline-model-Dih6FGWP.d.ts} +3 -3
  34. package/dist/{statusline-model-DFY7tuHj.d.cts → statusline-model-Dpfpq54A.d.cts} +3 -3
  35. package/dist/ui.cjs +115 -5
  36. package/dist/ui.d.cts +28 -2
  37. package/dist/ui.d.ts +28 -2
  38. package/dist/ui.js +3 -3
  39. package/dist/vela.global.js +317 -62
  40. package/dist/vela.global.min.js +61 -68
  41. package/dist/widget.cjs +476 -85
  42. package/dist/widget.d.cts +20 -10
  43. package/dist/widget.d.ts +20 -10
  44. package/dist/widget.js +7 -7
  45. package/dist/workspace.cjs +476 -85
  46. package/dist/workspace.d.cts +6 -6
  47. package/dist/workspace.d.ts +6 -6
  48. package/dist/workspace.js +6 -6
  49. package/package.json +3 -3
package/dist/ui.cjs CHANGED
@@ -335,6 +335,7 @@ registerIcon("expand", S('<rect x="2.2" y="2.2" width="11.6" height="11.6" rx="1
335
335
  registerIcon("plus", S('<path d="M8 2.8v10.4M2.8 8h10.4"/>'));
336
336
  registerIcon("minus", S('<path d="M2.8 8h10.4"/>'));
337
337
  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"/>'));
338
+ 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"/>'));
338
339
  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"/>'));
339
340
  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"/>'));
340
341
  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"'));
@@ -416,6 +417,17 @@ function nextUid(prefix) {
416
417
  return `${prefix}-${++uid}`;
417
418
  }
418
419
 
420
+ // src/ui/surface-events.ts
421
+ var SURFACE_OPEN_EVENT = "vela:surface-open";
422
+ var SURFACE_CLOSE_EVENT = "vela:surface-close";
423
+ function announceSurface(el, open2, kind, trigger = null) {
424
+ const View = el.ownerDocument.defaultView;
425
+ if (!View) return;
426
+ el.dispatchEvent(
427
+ new View.CustomEvent(open2 ? SURFACE_OPEN_EVENT : SURFACE_CLOSE_EVENT, { bubbles: true, composed: true, detail: { kind, trigger } })
428
+ );
429
+ }
430
+
419
431
  // src/ui/keymap.ts
420
432
  var KEY_ALIASES = {
421
433
  esc: "escape",
@@ -777,6 +789,8 @@ var Surface = class _Surface {
777
789
  /** Trigger rect captured when this level opened — the list stays put if the
778
790
  * trigger then moves (favorite chips shifting the caret). */
779
791
  this.pinnedAnchor = null;
792
+ /** The open state last announced — see {@link announce}. */
793
+ this.shown = false;
780
794
  this.doc = doc;
781
795
  this.host = opts.host;
782
796
  this.onSelect = opts.onSelect;
@@ -790,6 +804,7 @@ var Surface = class _Surface {
790
804
  this.positioner.appendChild(this.list);
791
805
  this.host.appendChild(this.positioner);
792
806
  const trigger = opts.trigger;
807
+ this.opener = trigger ?? opts.opener ?? null;
793
808
  this.ctrl = menuController({
794
809
  items: [],
795
810
  id: opts.id,
@@ -811,15 +826,21 @@ var Surface = class _Surface {
811
826
  if (opts.triggerId && trigger) trigger.id = opts.triggerId;
812
827
  this.handle = runMachine(this.ctrl.machine, this.ctrl.props, (service) => {
813
828
  const api = this.ctrl.connect(service);
829
+ if (this.shown && !api.open) this.announce(false);
814
830
  if (trigger) vanilla.spreadProps(trigger, api.getTriggerProps(), this.mid);
815
831
  vanilla.spreadProps(this.positioner, api.getPositionerProps(), this.mid);
816
832
  vanilla.spreadProps(this.list, api.getContentProps(), this.mid);
817
833
  this.project(api);
834
+ if (api.open && !this.shown) this.announce(true);
818
835
  });
819
836
  }
820
837
  get api() {
821
838
  return this.ctrl.connect(this.handle.service);
822
839
  }
840
+ announce(open2) {
841
+ this.shown = open2;
842
+ announceSurface(this.list, open2, "menu", this.opener);
843
+ }
823
844
  setItems(items) {
824
845
  this.items = items;
825
846
  for (const sub of this.subs.values()) sub.destroy();
@@ -837,6 +858,7 @@ var Surface = class _Surface {
837
858
  for (const sub of this.subs.values()) sub.destroy();
838
859
  this.subs.clear();
839
860
  this.handle.stop();
861
+ if (this.shown) this.announce(false);
840
862
  this.positioner.remove();
841
863
  }
842
864
  byId(id) {
@@ -930,6 +952,7 @@ var Surface = class _Surface {
930
952
  const sub = new _Surface(doc, {
931
953
  host: this.host,
932
954
  placement: "right-start",
955
+ opener: li,
933
956
  onSelect: this.onSelect,
934
957
  onFavorite: this.onFavorite,
935
958
  checkmarks: this.checkmarks,
@@ -1149,16 +1172,21 @@ var Popover = class {
1149
1172
  this.hide();
1150
1173
  };
1151
1174
  const onReflow = () => this.place();
1152
- setTimeout(() => document.addEventListener("pointerdown", onOutside, true), 0);
1175
+ setTimeout(() => {
1176
+ if (this.onOutside === onOutside) document.addEventListener("pointerdown", onOutside, true);
1177
+ }, 0);
1153
1178
  document.addEventListener("keydown", onKey, true);
1154
1179
  window.addEventListener("resize", onReflow, true);
1155
1180
  document.addEventListener("scroll", onReflow, true);
1156
1181
  this.onOutside = onOutside;
1157
1182
  this.onKey = onKey;
1158
1183
  this.onReflow = onReflow;
1184
+ announceSurface(this.el, true, "popover", this.trigger);
1159
1185
  }
1160
1186
  hide() {
1161
1187
  if (!this.shown) return;
1188
+ this.shown = false;
1189
+ announceSurface(this.el, false, "popover", this.trigger);
1162
1190
  if (this.onOutside) document.removeEventListener("pointerdown", this.onOutside, true);
1163
1191
  if (this.onKey) document.removeEventListener("keydown", this.onKey, true);
1164
1192
  if (this.onReflow) {
@@ -1178,7 +1206,6 @@ var Popover = class {
1178
1206
  } else {
1179
1207
  this.el.remove();
1180
1208
  }
1181
- this.shown = false;
1182
1209
  if (open === this) open = null;
1183
1210
  this.ctrl.onClose?.();
1184
1211
  }
@@ -1384,6 +1411,8 @@ ${overlayScrollbarCss(".vela-dialog *")}
1384
1411
  `;
1385
1412
  var Dialog = class {
1386
1413
  constructor(opts = {}) {
1414
+ this.opener = null;
1415
+ this.wasOpen = false;
1387
1416
  const doc = (opts.host ?? document.body).ownerDocument;
1388
1417
  injectStyles(DIALOG_STYLE_ID, DIALOG_CSS, doc);
1389
1418
  const host = opts.host ?? doc.body;
@@ -1480,6 +1509,7 @@ var Dialog = class {
1480
1509
  const mid = String(this.ctrl.props.id);
1481
1510
  this.handle = runMachine(this.ctrl.machine, this.ctrl.props, (service) => {
1482
1511
  const api = this.ctrl.connect(service);
1512
+ if (this.wasOpen && !api.open) this.announce(false);
1483
1513
  vanilla.spreadProps(this.backdrop, api.getBackdropProps(), mid);
1484
1514
  vanilla.spreadProps(this.positioner, api.getPositionerProps(), mid);
1485
1515
  vanilla.spreadProps(this.panel, api.getContentProps(), mid);
@@ -1487,12 +1517,27 @@ var Dialog = class {
1487
1517
  vanilla.spreadProps(close, api.getCloseTriggerProps(), mid);
1488
1518
  this.backdrop.style.display = api.open ? "" : "none";
1489
1519
  this.positioner.style.display = api.open ? "" : "none";
1520
+ if (api.open && !this.wasOpen) this.announce(true);
1521
+ if (this.wasOpen && !api.open) this.restoreOpener();
1522
+ this.wasOpen = api.open;
1490
1523
  });
1491
1524
  }
1525
+ /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
1526
+ * teardown that outruns the machine's close notification). */
1527
+ restoreOpener() {
1528
+ const opener = this.opener;
1529
+ this.opener = null;
1530
+ if (opener?.isConnected) opener.focus({ preventScroll: true });
1531
+ }
1532
+ announce(open2) {
1533
+ const opener = this.opener === this.panel.ownerDocument.body ? null : this.opener;
1534
+ announceSurface(this.panel, open2, "dialog", opener);
1535
+ }
1492
1536
  get open() {
1493
1537
  return this.ctrl.connect(this.handle.service).open;
1494
1538
  }
1495
1539
  show() {
1540
+ this.opener = this.panel.ownerDocument.activeElement;
1496
1541
  this.ctrl.connect(this.handle.service).setOpen(true);
1497
1542
  }
1498
1543
  hide() {
@@ -1507,6 +1552,11 @@ var Dialog = class {
1507
1552
  destroy() {
1508
1553
  if (this.open) this.hide();
1509
1554
  this.handle.stop();
1555
+ if (this.wasOpen) {
1556
+ this.wasOpen = false;
1557
+ this.announce(false);
1558
+ }
1559
+ this.restoreOpener();
1510
1560
  this.backdrop.remove();
1511
1561
  this.positioner.remove();
1512
1562
  }
@@ -1635,6 +1685,8 @@ function swipeDirection(dx, dy) {
1635
1685
  }
1636
1686
  var Drawer = class {
1637
1687
  constructor(opts = {}) {
1688
+ this.opener = null;
1689
+ this.wasOpen = false;
1638
1690
  const doc = (opts.host ?? document.body).ownerDocument;
1639
1691
  injectStyles(DRAWER_STYLE_ID, DRAWER_CSS, doc);
1640
1692
  const host = opts.host ?? doc.body;
@@ -1662,12 +1714,16 @@ var Drawer = class {
1662
1714
  const mid = String(this.ctrl.props.id);
1663
1715
  this.handle = runMachine(this.ctrl.machine, this.ctrl.props, (service) => {
1664
1716
  const api = this.ctrl.connect(service);
1717
+ if (this.wasOpen && !api.open) this.announce(false);
1665
1718
  vanilla.spreadProps(this.backdrop, api.getBackdropProps(), mid);
1666
1719
  vanilla.spreadProps(this.positioner, api.getPositionerProps(), mid);
1667
1720
  vanilla.spreadProps(this.panel, api.getContentProps(), mid);
1668
1721
  vanilla.spreadProps(this.titleEl, api.getTitleProps(), mid);
1669
1722
  this.backdrop.style.display = api.open ? "" : "none";
1670
1723
  this.positioner.style.display = api.open ? "" : "none";
1724
+ if (api.open && !this.wasOpen) this.announce(true);
1725
+ if (this.wasOpen && !api.open) this.restoreOpener();
1726
+ this.wasOpen = api.open;
1671
1727
  });
1672
1728
  }
1673
1729
  /** Any element between `from` and the panel that has already been scrolled down —
@@ -1776,10 +1832,22 @@ var Drawer = class {
1776
1832
  setTitle(title) {
1777
1833
  this.titleEl.textContent = title;
1778
1834
  }
1835
+ /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
1836
+ * teardown that outruns the machine's close notification). */
1837
+ restoreOpener() {
1838
+ const opener = this.opener;
1839
+ this.opener = null;
1840
+ if (opener?.isConnected) opener.focus({ preventScroll: true });
1841
+ }
1842
+ announce(open2) {
1843
+ const opener = this.opener === this.panel.ownerDocument.body ? null : this.opener;
1844
+ announceSurface(this.panel, open2, "drawer", opener);
1845
+ }
1779
1846
  get open() {
1780
1847
  return this.ctrl.connect(this.handle.service).open;
1781
1848
  }
1782
1849
  show() {
1850
+ this.opener = this.panel.ownerDocument.activeElement;
1783
1851
  this.ctrl.connect(this.handle.service).setOpen(true);
1784
1852
  }
1785
1853
  hide() {
@@ -1787,6 +1855,11 @@ var Drawer = class {
1787
1855
  }
1788
1856
  destroy() {
1789
1857
  this.handle.stop();
1858
+ if (this.wasOpen) {
1859
+ this.wasOpen = false;
1860
+ this.announce(false);
1861
+ }
1862
+ this.restoreOpener();
1790
1863
  this.backdrop.remove();
1791
1864
  this.positioner.remove();
1792
1865
  }
@@ -2718,14 +2791,49 @@ function buildColorPicker(color, theme, onChange, options = {}) {
2718
2791
  const knob = document.createElement("div");
2719
2792
  knob.style.cssText = "position:absolute;top:50%;width:15px;height:15px;border-radius:50%;background:var(--vela-selected-bg);box-shadow:0 1px 3px rgba(0,0,0,0.55);transform:translate(-50%,-50%);pointer-events:none;";
2720
2793
  track.appendChild(knob);
2721
- const pctBox = document.createElement("div");
2722
- pctBox.style.cssText = `min-width:42px;text-align:center;font:var(--vela-font-size-md) ${theme.fontFamily};color:var(--vela-fg);border:1px solid var(--vela-border);border-radius:5px;padding:3px 4px;`;
2794
+ const pctBox = document.createElement("input");
2795
+ pctBox.type = "text";
2796
+ pctBox.inputMode = "numeric";
2797
+ pctBox.title = "Opacity (%)";
2798
+ pctBox.style.cssText = `width:46px;box-sizing:border-box;text-align:center;font:var(--vela-font-size-md) ${theme.fontFamily};color:var(--vela-fg);background:transparent;border:1px solid var(--vela-border);border-radius:5px;padding:3px 4px;outline:none;`;
2799
+ pctBox.addEventListener("focus", () => {
2800
+ pctBox.style.borderColor = "var(--vela-border-strong)";
2801
+ pctBox.select();
2802
+ });
2723
2803
  opRow.append(track, pctBox);
2724
2804
  const paintOpacity = () => {
2725
2805
  track.style.background = `linear-gradient(to right, ${curHex}00, ${curHex}ff), ${CHECKER}`;
2726
2806
  knob.style.left = `${curAlpha * 100}%`;
2727
- pctBox.textContent = `${Math.round(curAlpha * 100)}%`;
2807
+ pctBox.value = `${Math.round(curAlpha * 100)}%`;
2808
+ };
2809
+ const commitTyped = () => {
2810
+ pctBox.style.borderColor = "var(--vela-border)";
2811
+ const n = parseFloat(pctBox.value.replace("%", ""));
2812
+ if (Number.isFinite(n)) {
2813
+ const next = Math.max(0, Math.min(100, n)) / 100;
2814
+ if (Math.round(next * 100) !== Math.round(curAlpha * 100)) {
2815
+ curAlpha = next;
2816
+ paintOpacity();
2817
+ emit();
2818
+ return;
2819
+ }
2820
+ }
2821
+ paintOpacity();
2728
2822
  };
2823
+ pctBox.addEventListener("change", commitTyped);
2824
+ pctBox.addEventListener("blur", () => {
2825
+ pctBox.style.borderColor = "var(--vela-border)";
2826
+ paintOpacity();
2827
+ });
2828
+ pctBox.addEventListener("keydown", (e) => {
2829
+ if (e.key === "Escape") return;
2830
+ e.stopPropagation();
2831
+ if (e.key === "Enter") {
2832
+ e.preventDefault();
2833
+ commitTyped();
2834
+ pctBox.blur();
2835
+ }
2836
+ });
2729
2837
  let dragging = false;
2730
2838
  const onDrag = (clientX) => {
2731
2839
  const r = track.getBoundingClientRect();
@@ -3936,6 +4044,8 @@ exports.KeymapManager = KeymapManager;
3936
4044
  exports.Menu = Menu;
3937
4045
  exports.NumberInput = NumberInput;
3938
4046
  exports.Popover = Popover;
4047
+ exports.SURFACE_CLOSE_EVENT = SURFACE_CLOSE_EVENT;
4048
+ exports.SURFACE_OPEN_EVENT = SURFACE_OPEN_EVENT;
3939
4049
  exports.Select = Select;
3940
4050
  exports.Switch = Switch;
3941
4051
  exports.TextArea = TextArea;
package/dist/ui.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as VelaTheme } from './options-BnEPUuVV.cjs';
1
+ import { c as VelaTheme } from './options-NAUHiQEC.cjs';
2
2
  import { MachineSchema, Service, Machine } from '@zag-js/core';
3
3
  export { a as KeyBindingDescriptor, K as KeymapManager, b as KeymapOptions, R as ResolvedBinding } from './keymap-CGOz5F5f.cjs';
4
4
  import * as tooltip from '@zag-js/tooltip';
@@ -48,6 +48,20 @@ declare function runMachine<T extends MachineSchema>(machine: Machine<T>, props:
48
48
  /** Unique ids for machine instances (Zag keys its DOM lookups on them). */
49
49
  declare function nextUid(prefix: string): string;
50
50
 
51
+ /** Dispatched on a surface's element once it is shown. */
52
+ declare const SURFACE_OPEN_EVENT = "vela:surface-open";
53
+ /** Dispatched on a surface's element as it starts to close, before it hides or leaves the DOM. */
54
+ declare const SURFACE_CLOSE_EVENT = "vela:surface-close";
55
+ /** What opened or closed: a menu (submenus included), a popover (select lists, color
56
+ * pickers, mark cards, the layout picker), a dialog, a drawer, or a side panel. */
57
+ type SurfaceKind = 'menu' | 'popover' | 'dialog' | 'drawer' | 'panel';
58
+ /** The `detail` of a {@link SURFACE_OPEN_EVENT} / {@link SURFACE_CLOSE_EVENT} event. */
59
+ interface SurfaceEventDetail {
60
+ kind: SurfaceKind;
61
+ /** The element that opened it, when there is one (a menu's button, a popover's trigger). */
62
+ trigger: HTMLElement | null;
63
+ }
64
+
51
65
  interface TooltipControllerOptions {
52
66
  placement?: tooltip.Placement;
53
67
  /** ms before opening on hover (default 0 — the reference tooltips are instant). */
@@ -229,6 +243,12 @@ declare class Dialog {
229
243
  private readonly handle;
230
244
  private readonly ctrl;
231
245
  constructor(opts?: DialogOptions);
246
+ private opener;
247
+ private wasOpen;
248
+ /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
249
+ * teardown that outruns the machine's close notification). */
250
+ private restoreOpener;
251
+ private announce;
232
252
  get open(): boolean;
233
253
  show(): void;
234
254
  hide(): void;
@@ -290,6 +310,12 @@ declare class Drawer {
290
310
  */
291
311
  private wireGestures;
292
312
  setTitle(title: string): void;
313
+ private opener;
314
+ private wasOpen;
315
+ /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
316
+ * teardown that outruns the machine's close notification). */
317
+ private restoreOpener;
318
+ private announce;
293
319
  get open(): boolean;
294
320
  show(): void;
295
321
  hide(): void;
@@ -1071,4 +1097,4 @@ declare class DatePicker {
1071
1097
  private cellEl;
1072
1098
  }
1073
1099
 
1074
- export { CALLOUT_CSS, CALLOUT_STYLE_ID, CalloutBubble, type CalloutBubbleOptions, type CalloutBubbleSpec, type CalloutPanel, type CalloutPanelItem, type CalloutPanelRow, type ColorCommit, ColorField, type ColorFieldOpts, type ColorFieldShape, type ColorPickerController, type ColorPickerControllerOptions, type ColorPickerOptions, DatePicker, type DatePickerCell, type DatePickerController, type DatePickerControllerOptions, type DatePickerOptions, type DatePickerPanel, Dialog, type DialogApi, type DialogControllerOptions, type DialogOptions, type DialogService, Drawer, type DrawerApi, type DrawerControllerOptions, type DrawerOptions, type DrawerService, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, FIELD_GAP_PX, type FieldControlDesc, type FieldControlHandle, type FieldGridOptions, type FieldGridVariant, type FieldInlineItem, type FieldLabelSize, type FieldRowOptions, type FieldSectionOptions, type FieldToggleOpts, type GlyphOption, GlyphSelect, type GlyphSelectController, type GlyphSelectControllerOptions, type GlyphSelectOptions, type MachineHandle, Menu, type MenuApi, type MenuControllerOptions, type MenuItemDescriptor, type MenuOptions, type MenuService, type NumberCommit, NumberInput, type NumberInputController, type NumberInputControllerOptions, type NumberInputOptions, type NumberSize, type PlaceArgs, type PlaceResult, Popover, type PopoverAlign, type PopoverBoundary, type PopoverController, type PopoverControllerOptions, type PopoverOptions, type PopoverPosition, type Rect, Select, type SelectController, type SelectControllerOptions, type SelectListPopoverOpts, type SelectOption, type SelectOptions, type SelectSize, Switch, type SwitchController, type SwitchControllerOptions, type SwitchOptions, type SwitchSize, type SwitchTone, TextArea, type TextAreaController, type TextAreaControllerOptions, type TextAreaOptions, type TextAreaSize, TextField, type TextFieldController, type TextFieldControllerOptions, type TextFieldOptions, type TextFieldSize, Tooltip, type TooltipApi, type TooltipControllerOptions, type TooltipOptions, type TooltipService, WIDTH_FIELD_OPTIONS, applyPlotOverlayTokens, applyThemeTokens, blendOver, buildColorPicker, buildFieldControl, buildPalette, calloutPanelRows, clampNumber, closeColorPopover, closeOpenPopovers, closeWidthPopover, closesPanel, colorField, colorPickerController, combineColor, datePickerController, decorateSelectScroll, dialogController, drawerController, ensureUIHost, eventDismissedPopover, fieldGrid, fieldGridColumns, fieldRow, fieldSection, fieldSeparator, fillSelectList, glyphSelectController, hslHex, iconEl, injectStyles, insetRect, intersectRects, isPopoverOpen, isoDate, lineWidthGlyph, menuController, nextUid, normalizeDateInput, numberInputController, openPopoverTrigger, openSelectList, overlayScrollbarCss, placePopover, popoverController, runMachine, selectController, snapToStep, splitColor, switchController, textAreaController, textFieldController, toggleSelectList, tooltipController, transparencyChecker, viewportRect, widthField, widthFieldOptions, withAlpha };
1100
+ export { CALLOUT_CSS, CALLOUT_STYLE_ID, CalloutBubble, type CalloutBubbleOptions, type CalloutBubbleSpec, type CalloutPanel, type CalloutPanelItem, type CalloutPanelRow, type ColorCommit, ColorField, type ColorFieldOpts, type ColorFieldShape, type ColorPickerController, type ColorPickerControllerOptions, type ColorPickerOptions, DatePicker, type DatePickerCell, type DatePickerController, type DatePickerControllerOptions, type DatePickerOptions, type DatePickerPanel, Dialog, type DialogApi, type DialogControllerOptions, type DialogOptions, type DialogService, Drawer, type DrawerApi, type DrawerControllerOptions, type DrawerOptions, type DrawerService, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, FIELD_GAP_PX, type FieldControlDesc, type FieldControlHandle, type FieldGridOptions, type FieldGridVariant, type FieldInlineItem, type FieldLabelSize, type FieldRowOptions, type FieldSectionOptions, type FieldToggleOpts, type GlyphOption, GlyphSelect, type GlyphSelectController, type GlyphSelectControllerOptions, type GlyphSelectOptions, type MachineHandle, Menu, type MenuApi, type MenuControllerOptions, type MenuItemDescriptor, type MenuOptions, type MenuService, type NumberCommit, NumberInput, type NumberInputController, type NumberInputControllerOptions, type NumberInputOptions, type NumberSize, type PlaceArgs, type PlaceResult, Popover, type PopoverAlign, type PopoverBoundary, type PopoverController, type PopoverControllerOptions, type PopoverOptions, type PopoverPosition, type Rect, SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, Select, type SelectController, type SelectControllerOptions, type SelectListPopoverOpts, type SelectOption, type SelectOptions, type SelectSize, type SurfaceEventDetail, type SurfaceKind, Switch, type SwitchController, type SwitchControllerOptions, type SwitchOptions, type SwitchSize, type SwitchTone, TextArea, type TextAreaController, type TextAreaControllerOptions, type TextAreaOptions, type TextAreaSize, TextField, type TextFieldController, type TextFieldControllerOptions, type TextFieldOptions, type TextFieldSize, Tooltip, type TooltipApi, type TooltipControllerOptions, type TooltipOptions, type TooltipService, WIDTH_FIELD_OPTIONS, applyPlotOverlayTokens, applyThemeTokens, blendOver, buildColorPicker, buildFieldControl, buildPalette, calloutPanelRows, clampNumber, closeColorPopover, closeOpenPopovers, closeWidthPopover, closesPanel, colorField, colorPickerController, combineColor, datePickerController, decorateSelectScroll, dialogController, drawerController, ensureUIHost, eventDismissedPopover, fieldGrid, fieldGridColumns, fieldRow, fieldSection, fieldSeparator, fillSelectList, glyphSelectController, hslHex, iconEl, injectStyles, insetRect, intersectRects, isPopoverOpen, isoDate, lineWidthGlyph, menuController, nextUid, normalizeDateInput, numberInputController, openPopoverTrigger, openSelectList, overlayScrollbarCss, placePopover, popoverController, runMachine, selectController, snapToStep, splitColor, switchController, textAreaController, textFieldController, toggleSelectList, tooltipController, transparencyChecker, viewportRect, widthField, widthFieldOptions, withAlpha };
package/dist/ui.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as VelaTheme } from './options-BnEPUuVV.js';
1
+ import { c as VelaTheme } from './options-NAUHiQEC.js';
2
2
  import { MachineSchema, Service, Machine } from '@zag-js/core';
3
3
  export { a as KeyBindingDescriptor, K as KeymapManager, b as KeymapOptions, R as ResolvedBinding } from './keymap-CGOz5F5f.js';
4
4
  import * as tooltip from '@zag-js/tooltip';
@@ -48,6 +48,20 @@ declare function runMachine<T extends MachineSchema>(machine: Machine<T>, props:
48
48
  /** Unique ids for machine instances (Zag keys its DOM lookups on them). */
49
49
  declare function nextUid(prefix: string): string;
50
50
 
51
+ /** Dispatched on a surface's element once it is shown. */
52
+ declare const SURFACE_OPEN_EVENT = "vela:surface-open";
53
+ /** Dispatched on a surface's element as it starts to close, before it hides or leaves the DOM. */
54
+ declare const SURFACE_CLOSE_EVENT = "vela:surface-close";
55
+ /** What opened or closed: a menu (submenus included), a popover (select lists, color
56
+ * pickers, mark cards, the layout picker), a dialog, a drawer, or a side panel. */
57
+ type SurfaceKind = 'menu' | 'popover' | 'dialog' | 'drawer' | 'panel';
58
+ /** The `detail` of a {@link SURFACE_OPEN_EVENT} / {@link SURFACE_CLOSE_EVENT} event. */
59
+ interface SurfaceEventDetail {
60
+ kind: SurfaceKind;
61
+ /** The element that opened it, when there is one (a menu's button, a popover's trigger). */
62
+ trigger: HTMLElement | null;
63
+ }
64
+
51
65
  interface TooltipControllerOptions {
52
66
  placement?: tooltip.Placement;
53
67
  /** ms before opening on hover (default 0 — the reference tooltips are instant). */
@@ -229,6 +243,12 @@ declare class Dialog {
229
243
  private readonly handle;
230
244
  private readonly ctrl;
231
245
  constructor(opts?: DialogOptions);
246
+ private opener;
247
+ private wasOpen;
248
+ /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
249
+ * teardown that outruns the machine's close notification). */
250
+ private restoreOpener;
251
+ private announce;
232
252
  get open(): boolean;
233
253
  show(): void;
234
254
  hide(): void;
@@ -290,6 +310,12 @@ declare class Drawer {
290
310
  */
291
311
  private wireGestures;
292
312
  setTitle(title: string): void;
313
+ private opener;
314
+ private wasOpen;
315
+ /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
316
+ * teardown that outruns the machine's close notification). */
317
+ private restoreOpener;
318
+ private announce;
293
319
  get open(): boolean;
294
320
  show(): void;
295
321
  hide(): void;
@@ -1071,4 +1097,4 @@ declare class DatePicker {
1071
1097
  private cellEl;
1072
1098
  }
1073
1099
 
1074
- export { CALLOUT_CSS, CALLOUT_STYLE_ID, CalloutBubble, type CalloutBubbleOptions, type CalloutBubbleSpec, type CalloutPanel, type CalloutPanelItem, type CalloutPanelRow, type ColorCommit, ColorField, type ColorFieldOpts, type ColorFieldShape, type ColorPickerController, type ColorPickerControllerOptions, type ColorPickerOptions, DatePicker, type DatePickerCell, type DatePickerController, type DatePickerControllerOptions, type DatePickerOptions, type DatePickerPanel, Dialog, type DialogApi, type DialogControllerOptions, type DialogOptions, type DialogService, Drawer, type DrawerApi, type DrawerControllerOptions, type DrawerOptions, type DrawerService, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, FIELD_GAP_PX, type FieldControlDesc, type FieldControlHandle, type FieldGridOptions, type FieldGridVariant, type FieldInlineItem, type FieldLabelSize, type FieldRowOptions, type FieldSectionOptions, type FieldToggleOpts, type GlyphOption, GlyphSelect, type GlyphSelectController, type GlyphSelectControllerOptions, type GlyphSelectOptions, type MachineHandle, Menu, type MenuApi, type MenuControllerOptions, type MenuItemDescriptor, type MenuOptions, type MenuService, type NumberCommit, NumberInput, type NumberInputController, type NumberInputControllerOptions, type NumberInputOptions, type NumberSize, type PlaceArgs, type PlaceResult, Popover, type PopoverAlign, type PopoverBoundary, type PopoverController, type PopoverControllerOptions, type PopoverOptions, type PopoverPosition, type Rect, Select, type SelectController, type SelectControllerOptions, type SelectListPopoverOpts, type SelectOption, type SelectOptions, type SelectSize, Switch, type SwitchController, type SwitchControllerOptions, type SwitchOptions, type SwitchSize, type SwitchTone, TextArea, type TextAreaController, type TextAreaControllerOptions, type TextAreaOptions, type TextAreaSize, TextField, type TextFieldController, type TextFieldControllerOptions, type TextFieldOptions, type TextFieldSize, Tooltip, type TooltipApi, type TooltipControllerOptions, type TooltipOptions, type TooltipService, WIDTH_FIELD_OPTIONS, applyPlotOverlayTokens, applyThemeTokens, blendOver, buildColorPicker, buildFieldControl, buildPalette, calloutPanelRows, clampNumber, closeColorPopover, closeOpenPopovers, closeWidthPopover, closesPanel, colorField, colorPickerController, combineColor, datePickerController, decorateSelectScroll, dialogController, drawerController, ensureUIHost, eventDismissedPopover, fieldGrid, fieldGridColumns, fieldRow, fieldSection, fieldSeparator, fillSelectList, glyphSelectController, hslHex, iconEl, injectStyles, insetRect, intersectRects, isPopoverOpen, isoDate, lineWidthGlyph, menuController, nextUid, normalizeDateInput, numberInputController, openPopoverTrigger, openSelectList, overlayScrollbarCss, placePopover, popoverController, runMachine, selectController, snapToStep, splitColor, switchController, textAreaController, textFieldController, toggleSelectList, tooltipController, transparencyChecker, viewportRect, widthField, widthFieldOptions, withAlpha };
1100
+ export { CALLOUT_CSS, CALLOUT_STYLE_ID, CalloutBubble, type CalloutBubbleOptions, type CalloutBubbleSpec, type CalloutPanel, type CalloutPanelItem, type CalloutPanelRow, type ColorCommit, ColorField, type ColorFieldOpts, type ColorFieldShape, type ColorPickerController, type ColorPickerControllerOptions, type ColorPickerOptions, DatePicker, type DatePickerCell, type DatePickerController, type DatePickerControllerOptions, type DatePickerOptions, type DatePickerPanel, Dialog, type DialogApi, type DialogControllerOptions, type DialogOptions, type DialogService, Drawer, type DrawerApi, type DrawerControllerOptions, type DrawerOptions, type DrawerService, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, FIELD_GAP_PX, type FieldControlDesc, type FieldControlHandle, type FieldGridOptions, type FieldGridVariant, type FieldInlineItem, type FieldLabelSize, type FieldRowOptions, type FieldSectionOptions, type FieldToggleOpts, type GlyphOption, GlyphSelect, type GlyphSelectController, type GlyphSelectControllerOptions, type GlyphSelectOptions, type MachineHandle, Menu, type MenuApi, type MenuControllerOptions, type MenuItemDescriptor, type MenuOptions, type MenuService, type NumberCommit, NumberInput, type NumberInputController, type NumberInputControllerOptions, type NumberInputOptions, type NumberSize, type PlaceArgs, type PlaceResult, Popover, type PopoverAlign, type PopoverBoundary, type PopoverController, type PopoverControllerOptions, type PopoverOptions, type PopoverPosition, type Rect, SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, Select, type SelectController, type SelectControllerOptions, type SelectListPopoverOpts, type SelectOption, type SelectOptions, type SelectSize, type SurfaceEventDetail, type SurfaceKind, Switch, type SwitchController, type SwitchControllerOptions, type SwitchOptions, type SwitchSize, type SwitchTone, TextArea, type TextAreaController, type TextAreaControllerOptions, type TextAreaOptions, type TextAreaSize, TextField, type TextFieldController, type TextFieldControllerOptions, type TextFieldOptions, type TextFieldSize, Tooltip, type TooltipApi, type TooltipControllerOptions, type TooltipOptions, type TooltipService, WIDTH_FIELD_OPTIONS, applyPlotOverlayTokens, applyThemeTokens, blendOver, buildColorPicker, buildFieldControl, buildPalette, calloutPanelRows, clampNumber, closeColorPopover, closeOpenPopovers, closeWidthPopover, closesPanel, colorField, colorPickerController, combineColor, datePickerController, decorateSelectScroll, dialogController, drawerController, ensureUIHost, eventDismissedPopover, fieldGrid, fieldGridColumns, fieldRow, fieldSection, fieldSeparator, fillSelectList, glyphSelectController, hslHex, iconEl, injectStyles, insetRect, intersectRects, isPopoverOpen, isoDate, lineWidthGlyph, menuController, nextUid, normalizeDateInput, numberInputController, openPopoverTrigger, openSelectList, overlayScrollbarCss, placePopover, popoverController, runMachine, selectController, snapToStep, splitColor, switchController, textAreaController, textFieldController, toggleSelectList, tooltipController, transparencyChecker, viewportRect, widthField, widthFieldOptions, withAlpha };
package/dist/ui.js CHANGED
@@ -1,3 +1,3 @@
1
- export { Drawer, KeymapManager, Tooltip, drawerController, tooltipController } from './chunk-KA77UTRF.js';
2
- export { CALLOUT_CSS, CALLOUT_STYLE_ID, CalloutBubble, ColorField, DatePicker, Dialog, FIELD_GAP_PX, GlyphSelect, Menu, NumberInput, Popover, Select, Switch, TextArea, TextField, WIDTH_FIELD_OPTIONS, applyPlotOverlayTokens, applyThemeTokens, blendOver, buildColorPicker, buildFieldControl, buildPalette, calloutPanelRows, clampNumber, closeColorPopover, closeOpenPopovers, closeWidthPopover, closesPanel, colorField, colorPickerController, combineColor, datePickerController, decorateSelectScroll, dialogController, ensureUIHost, eventDismissedPopover, fieldGrid, fieldGridColumns, fieldRow, fieldSection, fieldSeparator, fillSelectList, glyphSelectController, hslHex, insetRect, intersectRects, isPopoverOpen, isoDate, lineWidthGlyph, menuController, nextUid, normalizeDateInput, normalizeProps, numberInputController, openPopoverTrigger, openSelectList, placePopover, popoverController, runMachine, selectController, snapToStep, splitColor, spreadProps, switchController, textAreaController, textFieldController, toggleSelectList, transparencyChecker, viewportRect, widthField, widthFieldOptions } from './chunk-2IAETM2I.js';
3
- export { FIELD_FOCUS_CSS, FIELD_FOCUS_RING, iconEl, iconMarkup, injectStyles, overlayScrollbarCss, registerIcon, svg16, svg24, withAlpha } from './chunk-BZQM2XO7.js';
1
+ export { Drawer, KeymapManager, Tooltip, drawerController, tooltipController } from './chunk-27UTYE7T.js';
2
+ export { CALLOUT_CSS, CALLOUT_STYLE_ID, CalloutBubble, ColorField, DatePicker, Dialog, FIELD_GAP_PX, GlyphSelect, Menu, NumberInput, Popover, Select, Switch, TextArea, TextField, WIDTH_FIELD_OPTIONS, applyPlotOverlayTokens, applyThemeTokens, blendOver, buildColorPicker, buildFieldControl, buildPalette, calloutPanelRows, clampNumber, closeColorPopover, closeOpenPopovers, closeWidthPopover, closesPanel, colorField, colorPickerController, combineColor, datePickerController, decorateSelectScroll, dialogController, ensureUIHost, eventDismissedPopover, fieldGrid, fieldGridColumns, fieldRow, fieldSection, fieldSeparator, fillSelectList, glyphSelectController, hslHex, insetRect, intersectRects, isPopoverOpen, isoDate, lineWidthGlyph, menuController, nextUid, normalizeDateInput, normalizeProps, numberInputController, openPopoverTrigger, openSelectList, placePopover, popoverController, runMachine, selectController, snapToStep, splitColor, spreadProps, switchController, textAreaController, textFieldController, toggleSelectList, transparencyChecker, viewportRect, widthField, widthFieldOptions } from './chunk-NLDTVFOI.js';
3
+ export { FIELD_FOCUS_CSS, FIELD_FOCUS_RING, SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, iconEl, iconMarkup, injectStyles, overlayScrollbarCss, registerIcon, svg16, svg24, withAlpha } from './chunk-HKNO24GD.js';