@luxalgo/vela 0.8.2 → 0.8.3

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 (48) hide show
  1. package/dist/{DataProvider-DpOWZD8F.d.ts → DataProvider-oH78tYXL.d.ts} +1 -1
  2. package/dist/{DataProvider-COGDs9Xg.d.cts → DataProvider-wbtJ3-Sa.d.cts} +1 -1
  3. package/dist/{chunk-R2JMNIHY.js → chunk-2IPXYM4B.js} +258 -169
  4. package/dist/{chunk-NLDTVFOI.js → chunk-G7B7ZCBF.js} +129 -10
  5. package/dist/{chunk-T3DZIR5Y.js → chunk-HMHA733L.js} +306 -168
  6. package/dist/{chunk-DPAA3SRT.js → chunk-KWI3YDBW.js} +254 -9
  7. package/dist/{chunk-27UTYE7T.js → chunk-TO3GIK7Z.js} +49 -7
  8. package/dist/{chunk-HKNO24GD.js → chunk-VHGACEHO.js} +50 -1
  9. package/dist/{contributions-Cgm9RJYP.d.cts → contributions-BhOBRenr.d.cts} +44 -4
  10. package/dist/{contributions-bWgwyiVi.d.ts → contributions-HGqnNb_P.d.ts} +44 -4
  11. package/dist/index.cjs +497 -79
  12. package/dist/index.d.cts +34 -14
  13. package/dist/index.d.ts +34 -14
  14. package/dist/index.js +5 -5
  15. package/dist/{options-NAUHiQEC.d.ts → options-lMUwmRwh.d.cts} +66 -1
  16. package/dist/{options-NAUHiQEC.d.cts → options-lMUwmRwh.d.ts} +66 -1
  17. package/dist/{plugin-CqxWoDKS.d.ts → plugin-Cr2Pj8q8.d.ts} +4 -4
  18. package/dist/{plugin-CjjzZX2F.d.cts → plugin-Do5J5xuF.d.cts} +4 -4
  19. package/dist/plugin.cjs +18 -0
  20. package/dist/plugin.d.cts +5 -5
  21. package/dist/plugin.d.ts +5 -5
  22. package/dist/plugin.js +3 -3
  23. package/dist/providers/binance.d.cts +2 -2
  24. package/dist/providers/binance.d.ts +2 -2
  25. package/dist/providers/coinbase.d.cts +2 -2
  26. package/dist/providers/coinbase.d.ts +2 -2
  27. package/dist/providers/hyperliquid.d.cts +2 -2
  28. package/dist/providers/hyperliquid.d.ts +2 -2
  29. package/dist/{side-panel-wMNfgyZb.d.cts → side-panel-_2UK1gSm.d.cts} +45 -3
  30. package/dist/{side-panel-wMNfgyZb.d.ts → side-panel-_2UK1gSm.d.ts} +45 -3
  31. package/dist/{statusline-model-Dpfpq54A.d.cts → statusline-model-B-2xGlB_.d.cts} +3 -3
  32. package/dist/{statusline-model-Dih6FGWP.d.ts → statusline-model-CY1wzxHg.d.ts} +3 -3
  33. package/dist/ui.cjs +224 -14
  34. package/dist/ui.d.cts +119 -87
  35. package/dist/ui.d.ts +119 -87
  36. package/dist/ui.js +3 -3
  37. package/dist/vela.global.js +497 -79
  38. package/dist/vela.global.min.js +86 -52
  39. package/dist/widget.cjs +850 -167
  40. package/dist/widget.d.cts +24 -10
  41. package/dist/widget.d.ts +24 -10
  42. package/dist/widget.js +7 -7
  43. package/dist/workspace.cjs +849 -167
  44. package/dist/workspace.d.cts +47 -20
  45. package/dist/workspace.d.ts +47 -20
  46. package/dist/workspace.js +6 -6
  47. package/package.json +1 -1
  48. /package/dist/{chunk-JU4CWEBF.js → chunk-W5YPYZ2P.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { overlayScrollbarCss, isDarkColor, mix, HIGHLIGHT, ACCENT_BRIGHT, ACCENT, withAlpha, injectStyles, announceSurface, iconAt, iconEl, BULLISH, BEARISH, WARNING, NEUTRAL } from './chunk-HKNO24GD.js';
1
+ import { overlayScrollbarCss, isDarkColor, mix, HIGHLIGHT, ACCENT_BRIGHT, ACCENT, withAlpha, injectStyles, announceSurface, holdForExit, iconAt, iconEl, BULLISH, BEARISH, WARNING, NEUTRAL } from './chunk-VHGACEHO.js';
2
2
  import { VanillaMachine, normalizeProps, spreadProps } from '@zag-js/vanilla';
3
3
  export { normalizeProps, spreadProps } from '@zag-js/vanilla';
4
4
  import * as menu from '@zag-js/menu';
@@ -226,6 +226,35 @@ var MENU_CSS = `
226
226
  color: var(--vela-fg-bright);
227
227
  }
228
228
  .vela-menu-item[data-checkmark] { color: var(--vela-fg-bright); }
229
+ /* Badge mode (iconBadges): the row icon sits in a rounded tile and the row grows to fit
230
+ it. An icon-less row of the same level keeps an invisible slot, so labels align. */
231
+ .vela-menu[data-badges] > .vela-menu-item { padding: 5px 10px 5px 6px; }
232
+ .vela-menu-item .vela-menu-badge {
233
+ width: 24px;
234
+ height: 24px;
235
+ padding: 3px;
236
+ flex: none;
237
+ box-sizing: border-box;
238
+ display: inline-flex;
239
+ align-items: center;
240
+ justify-content: center;
241
+ border-radius: var(--vela-radius-md);
242
+ background: var(--vela-hover);
243
+ border: 1px solid var(--vela-border);
244
+ color: var(--vela-fg-muted);
245
+ transition: background var(--vela-dur-fast) var(--vela-ease), border-color var(--vela-dur-fast) var(--vela-ease), color var(--vela-dur-fast) var(--vela-ease);
246
+ }
247
+ .vela-menu-item .vela-menu-badge:empty { background: transparent; border-color: transparent; }
248
+ .vela-menu-item .vela-menu-badge .vela-icon { color: inherit; }
249
+ .vela-menu-item[data-highlighted] .vela-menu-badge:not(:empty) { color: var(--vela-fg-bright); }
250
+ /* The selected tile inverts: a bright fill under the surface-colored glyph. After the
251
+ hover rule, so a selected row keeps its tile while highlighted. */
252
+ .vela-menu-item[data-checked] .vela-menu-badge:not(:empty),
253
+ .vela-menu-item[data-checkmark] .vela-menu-badge:not(:empty) {
254
+ background: color-mix(in srgb, var(--vela-fg-bright) 83%, var(--vela-surface));
255
+ border-color: color-mix(in srgb, var(--vela-fg-bright) 40%, transparent);
256
+ color: var(--vela-surface);
257
+ }
229
258
  /* Switch rows (boolean settings in a dropdown): a right-aligned toggle pill \u2014 the
230
259
  same control language as the settings dialog's toggles. */
231
260
  .vela-menu-switch {
@@ -292,11 +321,14 @@ var Surface = class _Surface {
292
321
  this.pinnedAnchor = null;
293
322
  /** The open state last announced — see {@link announce}. */
294
323
  this.shown = false;
324
+ /** The list's exit animation after a close; a reopen cancels it. */
325
+ this.exit = null;
295
326
  this.doc = doc;
296
327
  this.host = opts.host;
297
328
  this.onSelect = opts.onSelect;
298
329
  this.onFavorite = opts.onFavorite;
299
330
  this.checkmarks = opts.checkmarks === true;
331
+ this.iconBadges = opts.iconBadges === true;
300
332
  this.positioner = doc.createElement("div");
301
333
  this.positioner.className = "vela-ui-layer";
302
334
  this.list = doc.createElement("ul");
@@ -327,14 +359,30 @@ var Surface = class _Surface {
327
359
  if (opts.triggerId && trigger) trigger.id = opts.triggerId;
328
360
  this.handle = runMachine(this.ctrl.machine, this.ctrl.props, (service) => {
329
361
  const api = this.ctrl.connect(service);
330
- if (this.shown && !api.open) this.announce(false);
362
+ const closing = this.shown && !api.open;
363
+ if (closing) this.announce(false);
364
+ if (api.open && this.exit) {
365
+ this.exit.cancel();
366
+ this.exit = null;
367
+ }
331
368
  if (trigger) spreadProps(trigger, api.getTriggerProps(), this.mid);
332
369
  spreadProps(this.positioner, api.getPositionerProps(), this.mid);
333
370
  spreadProps(this.list, api.getContentProps(), this.mid);
334
371
  this.project(api);
372
+ if (closing) this.holdExit();
335
373
  if (api.open && !this.shown) this.announce(true);
336
374
  });
337
375
  }
376
+ /** Keep the just-closed list up through its exit animation. `spreadProps` re-applies
377
+ * `hidden` only when the machine's value for it changes, so the list stays shown until
378
+ * the exit ends — or until a reopen, which projects `hidden: false` itself. */
379
+ holdExit() {
380
+ this.list.hidden = false;
381
+ this.exit = holdForExit(this.list, () => {
382
+ this.exit = null;
383
+ if (!this.shown) this.list.hidden = true;
384
+ });
385
+ }
338
386
  get api() {
339
387
  return this.ctrl.connect(this.handle.service);
340
388
  }
@@ -358,6 +406,7 @@ var Surface = class _Surface {
358
406
  destroy() {
359
407
  for (const sub of this.subs.values()) sub.destroy();
360
408
  this.subs.clear();
409
+ this.exit?.finish();
361
410
  this.handle.stop();
362
411
  if (this.shown) this.announce(false);
363
412
  this.positioner.remove();
@@ -384,6 +433,10 @@ var Surface = class _Surface {
384
433
  const doc = this.doc;
385
434
  this.list.replaceChildren();
386
435
  const markable = this.checkmarks && this.items.some((i) => !(i.submenu && i.submenu.length > 0) && !i.toggle && i.checked !== void 0);
436
+ const iconic = this.items.some((i) => !!i.icon);
437
+ const badged = this.iconBadges && iconic;
438
+ if (badged) this.list.dataset.badges = "1";
439
+ else delete this.list.dataset.badges;
387
440
  for (const item of this.items) {
388
441
  if (item.separatorBefore) {
389
442
  const sep = doc.createElement("li");
@@ -409,7 +462,16 @@ var Surface = class _Surface {
409
462
  } else if (!branch && !item.toggle && item.checked) {
410
463
  li.dataset.checked = "1";
411
464
  }
412
- if (item.icon) li.appendChild(iconEl(item.icon, doc));
465
+ if (badged) {
466
+ const badge = doc.createElement("span");
467
+ badge.className = "vela-menu-badge";
468
+ if (item.icon) badge.appendChild(iconEl(item.icon, doc));
469
+ li.appendChild(badge);
470
+ } else if (item.icon) {
471
+ li.appendChild(iconEl(item.icon, doc));
472
+ } else if (iconic) {
473
+ li.appendChild(iconEl("", doc));
474
+ }
413
475
  const label = doc.createElement("span");
414
476
  label.className = "vela-menu-label";
415
477
  label.textContent = item.label;
@@ -457,6 +519,7 @@ var Surface = class _Surface {
457
519
  onSelect: this.onSelect,
458
520
  onFavorite: this.onFavorite,
459
521
  checkmarks: this.checkmarks,
522
+ iconBadges: this.iconBadges,
460
523
  id: `${this.mid}--${item.id}`
461
524
  });
462
525
  sub.setItems(item.submenu ?? []);
@@ -482,7 +545,8 @@ var Menu = class {
482
545
  id: opts.id,
483
546
  minWidth: opts.minWidth,
484
547
  onFavorite: opts.onFavorite,
485
- checkmarks: opts.checkmarks
548
+ checkmarks: opts.checkmarks,
549
+ iconBadges: opts.iconBadges
486
550
  });
487
551
  this.root.setItems(opts.items);
488
552
  }
@@ -586,6 +650,7 @@ var POPOVER_CSS = `
586
650
 
587
651
  // src/ui/components/popover/view.ts
588
652
  var open = null;
653
+ var leaving = /* @__PURE__ */ new Set();
589
654
  function closeOpenPopovers() {
590
655
  open?.hide();
591
656
  }
@@ -613,6 +678,8 @@ var Popover = class {
613
678
  this.shown = false;
614
679
  /** The pending removal of a fading-out shell; a show() that reuses the shell cancels it. */
615
680
  this.leaveTimer = null;
681
+ /** The shell's exit animation before it leaves the DOM; a show() that reuses the shell cancels it. */
682
+ this.exit = null;
616
683
  const doc = opts.trigger.ownerDocument;
617
684
  injectStyles(POPOVER_STYLE_ID, POPOVER_CSS, doc);
618
685
  this.trigger = opts.trigger;
@@ -649,6 +716,10 @@ var Popover = class {
649
716
  clearTimeout(this.leaveTimer);
650
717
  this.leaveTimer = null;
651
718
  }
719
+ this.exit?.cancel();
720
+ this.exit = null;
721
+ leaving.delete(this);
722
+ for (const p of [...leaving]) if (p.trigger === this.trigger) p.exit?.finish();
652
723
  ensureUIHost(this.el, this.inheritsTokens ? void 0 : this.theme);
653
724
  if (this.fadeMs > 0) {
654
725
  this.el.style.transition = `opacity ${this.fadeMs}ms ease`;
@@ -705,7 +776,12 @@ var Popover = class {
705
776
  this.el.remove();
706
777
  }, this.fadeMs);
707
778
  } else {
708
- this.el.remove();
779
+ this.exit = holdForExit(this.el, () => {
780
+ this.exit = null;
781
+ leaving.delete(this);
782
+ this.el.remove();
783
+ });
784
+ if (this.exit) leaving.add(this);
709
785
  }
710
786
  if (open === this) open = null;
711
787
  this.ctrl.onClose?.();
@@ -717,6 +793,7 @@ var Popover = class {
717
793
  }
718
794
  destroy() {
719
795
  this.hide();
796
+ this.exit?.finish();
720
797
  }
721
798
  reposition() {
722
799
  if (this.shown) this.place();
@@ -1394,6 +1471,9 @@ var Dialog = class {
1394
1471
  constructor(opts = {}) {
1395
1472
  this.opener = null;
1396
1473
  this.wasOpen = false;
1474
+ /** The panel and scrim's exit animation after a close; a reopen cancels it. */
1475
+ this.exit = null;
1476
+ this.destroyed = false;
1397
1477
  const doc = (opts.host ?? document.body).ownerDocument;
1398
1478
  injectStyles(DIALOG_STYLE_ID, DIALOG_CSS, doc);
1399
1479
  const host = opts.host ?? doc.body;
@@ -1490,19 +1570,57 @@ var Dialog = class {
1490
1570
  const mid = String(this.ctrl.props.id);
1491
1571
  this.handle = runMachine(this.ctrl.machine, this.ctrl.props, (service) => {
1492
1572
  const api = this.ctrl.connect(service);
1493
- if (this.wasOpen && !api.open) this.announce(false);
1573
+ const closing = this.wasOpen && !api.open;
1574
+ if (closing) this.announce(false);
1494
1575
  spreadProps(this.backdrop, api.getBackdropProps(), mid);
1495
1576
  spreadProps(this.positioner, api.getPositionerProps(), mid);
1496
1577
  spreadProps(this.panel, api.getContentProps(), mid);
1497
1578
  spreadProps(title, api.getTitleProps(), mid);
1498
1579
  spreadProps(close, api.getCloseTriggerProps(), mid);
1499
- this.backdrop.style.display = api.open ? "" : "none";
1500
- this.positioner.style.display = api.open ? "" : "none";
1580
+ if (api.open) {
1581
+ this.exit?.cancel();
1582
+ this.exit = null;
1583
+ this.setShown(true);
1584
+ } else if (closing) {
1585
+ this.holdExit();
1586
+ } else if (!this.exit) {
1587
+ this.setShown(false);
1588
+ }
1501
1589
  if (api.open && !this.wasOpen) this.announce(true);
1502
1590
  if (this.wasOpen && !api.open) this.restoreOpener();
1503
1591
  this.wasOpen = api.open;
1504
1592
  });
1505
1593
  }
1594
+ setShown(shown) {
1595
+ this.backdrop.style.display = shown ? "" : "none";
1596
+ this.positioner.style.display = shown ? "" : "none";
1597
+ }
1598
+ /** Keep the just-closed dialog up through its exit animation, then hide it — or
1599
+ * remove it, when it was destroyed meanwhile. `spreadProps` re-applies the close
1600
+ * props' `hidden` only when its value changes, so lifting it keeps the panel and
1601
+ * scrim up until the exit ends. The positioner spans the viewport: inert, it lets
1602
+ * clicks through to the page while the panel animates out. */
1603
+ holdExit() {
1604
+ const held = [this.panel, this.backdrop];
1605
+ for (const el of held) el.hidden = false;
1606
+ this.exit = holdForExit(
1607
+ held,
1608
+ () => {
1609
+ this.exit = null;
1610
+ if (this.destroyed) {
1611
+ this.detach();
1612
+ } else if (!this.open) {
1613
+ for (const el of held) el.hidden = true;
1614
+ this.setShown(false);
1615
+ }
1616
+ },
1617
+ { inert: [this.positioner] }
1618
+ );
1619
+ }
1620
+ detach() {
1621
+ this.backdrop.remove();
1622
+ this.positioner.remove();
1623
+ }
1506
1624
  /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
1507
1625
  * teardown that outruns the machine's close notification). */
1508
1626
  restoreOpener() {
@@ -1531,15 +1649,16 @@ var Dialog = class {
1531
1649
  return el?.closest(".vela-popover, .vela-menu") != null;
1532
1650
  }
1533
1651
  destroy() {
1652
+ if (this.wasOpen && !this.open) this.handle.flush();
1534
1653
  if (this.open) this.hide();
1535
1654
  this.handle.stop();
1655
+ this.destroyed = true;
1536
1656
  if (this.wasOpen) {
1537
1657
  this.wasOpen = false;
1538
1658
  this.announce(false);
1539
1659
  }
1540
1660
  this.restoreOpener();
1541
- this.backdrop.remove();
1542
- this.positioner.remove();
1661
+ if (!this.exit) this.detach();
1543
1662
  }
1544
1663
  };
1545
1664