@luxalgo/vela 0.8.2 → 0.8.4

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-COGDs9Xg.d.cts → DataProvider-Bw58CjYy.d.cts} +1 -1
  2. package/dist/{DataProvider-DpOWZD8F.d.ts → DataProvider-Byo8pEv0.d.ts} +1 -1
  3. package/dist/{chunk-DPAA3SRT.js → chunk-ALTGHKIM.js} +836 -32
  4. package/dist/{chunk-27UTYE7T.js → chunk-AUOB7A5Y.js} +49 -7
  5. package/dist/{chunk-HKNO24GD.js → chunk-I2U4NZD2.js} +56 -1
  6. package/dist/{chunk-R2JMNIHY.js → chunk-MOJ4T26N.js} +341 -169
  7. package/dist/{chunk-T3DZIR5Y.js → chunk-UNUVPQFW.js} +2214 -886
  8. package/dist/{chunk-NLDTVFOI.js → chunk-WY5H4S4I.js} +129 -10
  9. package/dist/{contributions-Cgm9RJYP.d.cts → contributions-BY3zSYiZ.d.ts} +98 -7
  10. package/dist/{contributions-bWgwyiVi.d.ts → contributions-DOm40g5-.d.cts} +98 -7
  11. package/dist/index.cjs +3066 -893
  12. package/dist/index.d.cts +36 -22
  13. package/dist/index.d.ts +36 -22
  14. package/dist/index.js +5 -5
  15. package/dist/{options-NAUHiQEC.d.ts → options-CSXbjMM5.d.cts} +129 -4
  16. package/dist/{options-NAUHiQEC.d.cts → options-CSXbjMM5.d.ts} +129 -4
  17. package/dist/{plugin-CqxWoDKS.d.ts → plugin-BDxUhGO3.d.ts} +4 -4
  18. package/dist/{plugin-CjjzZX2F.d.cts → plugin-CiQVyETg.d.cts} +4 -4
  19. package/dist/plugin.cjs +573 -17
  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-Dih6FGWP.d.ts → statusline-model-C9tYXuux.d.ts} +19 -4
  32. package/dist/{statusline-model-Dpfpq54A.d.cts → statusline-model-DUBX6Fib.d.cts} +19 -4
  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 +3073 -900
  38. package/dist/vela.global.min.js +158 -54
  39. package/dist/widget.cjs +3640 -1119
  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 +3639 -1119
  44. package/dist/workspace.d.cts +61 -20
  45. package/dist/workspace.d.ts +61 -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,5 +1,5 @@
1
- import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-NLDTVFOI.js';
2
- import { injectStyles, announceSurface } from './chunk-HKNO24GD.js';
1
+ import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-WY5H4S4I.js';
2
+ import { injectStyles, holdForExit, announceSurface } from './chunk-I2U4NZD2.js';
3
3
  import * as tooltip from '@zag-js/tooltip';
4
4
  import * as dialog from '@zag-js/dialog';
5
5
 
@@ -345,6 +345,9 @@ var Drawer = class {
345
345
  constructor(opts = {}) {
346
346
  this.opener = null;
347
347
  this.wasOpen = false;
348
+ /** The sheet and scrim's exit animation after a close; a reopen cancels it. */
349
+ this.exit = null;
350
+ this.destroyed = false;
348
351
  const doc = (opts.host ?? document.body).ownerDocument;
349
352
  injectStyles(DRAWER_STYLE_ID, DRAWER_CSS, doc);
350
353
  const host = opts.host ?? doc.body;
@@ -372,13 +375,21 @@ var Drawer = class {
372
375
  const mid = String(this.ctrl.props.id);
373
376
  this.handle = runMachine(this.ctrl.machine, this.ctrl.props, (service) => {
374
377
  const api = this.ctrl.connect(service);
375
- if (this.wasOpen && !api.open) this.announce(false);
378
+ const closing = this.wasOpen && !api.open;
379
+ if (closing) this.announce(false);
376
380
  spreadProps(this.backdrop, api.getBackdropProps(), mid);
377
381
  spreadProps(this.positioner, api.getPositionerProps(), mid);
378
382
  spreadProps(this.panel, api.getContentProps(), mid);
379
383
  spreadProps(this.titleEl, api.getTitleProps(), mid);
380
- this.backdrop.style.display = api.open ? "" : "none";
381
- this.positioner.style.display = api.open ? "" : "none";
384
+ if (api.open) {
385
+ this.exit?.cancel();
386
+ this.exit = null;
387
+ this.setShown(true);
388
+ } else if (closing) {
389
+ this.holdExit();
390
+ } else if (!this.exit) {
391
+ this.setShown(false);
392
+ }
382
393
  if (api.open && !this.wasOpen) this.announce(true);
383
394
  if (this.wasOpen && !api.open) this.restoreOpener();
384
395
  this.wasOpen = api.open;
@@ -490,6 +501,36 @@ var Drawer = class {
490
501
  setTitle(title) {
491
502
  this.titleEl.textContent = title;
492
503
  }
504
+ setShown(shown) {
505
+ this.backdrop.style.display = shown ? "" : "none";
506
+ this.positioner.style.display = shown ? "" : "none";
507
+ }
508
+ /** Keep the just-closed sheet up through its exit animation, then hide it — or
509
+ * remove it, when it was destroyed meanwhile. `spreadProps` re-applies the close
510
+ * props' `hidden` only when its value changes, so lifting it keeps the sheet and
511
+ * scrim up until the exit ends. The positioner spans the host: inert, it lets
512
+ * clicks through to the page while the sheet animates out. */
513
+ holdExit() {
514
+ const held = [this.panel, this.backdrop];
515
+ for (const el of held) el.hidden = false;
516
+ this.exit = holdForExit(
517
+ held,
518
+ () => {
519
+ this.exit = null;
520
+ if (this.destroyed) {
521
+ this.detach();
522
+ } else if (!this.open) {
523
+ for (const el of held) el.hidden = true;
524
+ this.setShown(false);
525
+ }
526
+ },
527
+ { inert: [this.positioner] }
528
+ );
529
+ }
530
+ detach() {
531
+ this.backdrop.remove();
532
+ this.positioner.remove();
533
+ }
493
534
  /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
494
535
  * teardown that outruns the machine's close notification). */
495
536
  restoreOpener() {
@@ -512,14 +553,15 @@ var Drawer = class {
512
553
  this.ctrl.connect(this.handle.service).setOpen(false);
513
554
  }
514
555
  destroy() {
556
+ if (this.wasOpen && !this.open) this.handle.flush();
515
557
  this.handle.stop();
558
+ this.destroyed = true;
516
559
  if (this.wasOpen) {
517
560
  this.wasOpen = false;
518
561
  this.announce(false);
519
562
  }
520
563
  this.restoreOpener();
521
- this.backdrop.remove();
522
- this.positioner.remove();
564
+ if (!this.exit) this.detach();
523
565
  }
524
566
  };
525
567
 
@@ -239,6 +239,12 @@ function mix(base, top, alpha) {
239
239
  const c = (x, y) => Math.round(x + (y - x) * alpha);
240
240
  return `rgb(${c(b.r, t.r)},${c(b.g, t.g)},${c(b.b, t.b)})`;
241
241
  }
242
+ function toHex6(color, fallback = "#888888") {
243
+ const c = parseRgb(color);
244
+ if (!c) return fallback;
245
+ const h = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
246
+ return `#${h(c.r)}${h(c.g)}${h(c.b)}`;
247
+ }
242
248
  function isDarkColor(color) {
243
249
  const c = parseRgb(color);
244
250
  if (!c) return true;
@@ -282,4 +288,53 @@ function announceSurface(el, open, kind, trigger = null) {
282
288
  );
283
289
  }
284
290
 
285
- export { ACCENT, ACCENT_BRIGHT, BEARISH, BULLISH, CATEGORICAL, CHIP_PLATE, CROSSHAIR, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, HIGHLIGHT, INFO, INVALID, MARKER, NEUTRAL, SERIES_LINE, SESSION_OFF, SESSION_POST, SESSION_PRE, SLATE, SLATE_DEEP, SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, TRADE_EXIT, TRADE_LONG, TRADE_SHORT, VALID, WARNING, announceSurface, categoricalColor, icon, iconAt, iconEl, iconMarkup, injectStyles, isDarkColor, mix, overlayScrollbarCss, registerIcon, svg16, svg24, svg24Solid, withAlpha };
291
+ // src/ui/surface-exit.ts
292
+ var CLOSING_ATTR = "data-closing";
293
+ var SURFACE_EXIT_CAP_MS = 1e3;
294
+ function animationsOf(els) {
295
+ return els.flatMap((el) => el.getAnimations({ subtree: true }));
296
+ }
297
+ function ends(a) {
298
+ return Number.isFinite(a.effect?.getComputedTiming().endTime ?? Number.POSITIVE_INFINITY);
299
+ }
300
+ function holdForExit(els, done, opts = {}) {
301
+ const list = Array.isArray(els) ? els : [els];
302
+ if (list.length === 0 || !list.every((el) => typeof el.getAnimations === "function")) {
303
+ done();
304
+ return null;
305
+ }
306
+ const before = new Set(animationsOf(list));
307
+ for (const el of list) el.setAttribute(CLOSING_ATTR, "");
308
+ const exit = animationsOf(list).filter((a) => !before.has(a) && ends(a));
309
+ if (exit.length === 0) {
310
+ for (const el of list) el.removeAttribute(CLOSING_ATTR);
311
+ done();
312
+ return null;
313
+ }
314
+ const frozen = [...list, ...opts.inert ?? []];
315
+ const wasInert = frozen.map((el) => el.inert);
316
+ for (const el of frozen) el.inert = true;
317
+ let settled = false;
318
+ const settle = (complete) => {
319
+ if (settled) return;
320
+ settled = true;
321
+ clearTimeout(cap);
322
+ for (const el of list) el.removeAttribute(CLOSING_ATTR);
323
+ frozen.forEach((el, i) => {
324
+ el.inert = wasInert[i];
325
+ });
326
+ if (complete) done();
327
+ };
328
+ const cap = setTimeout(() => settle(true), SURFACE_EXIT_CAP_MS);
329
+ let pending = exit.length;
330
+ const one = () => {
331
+ if (--pending === 0) settle(true);
332
+ };
333
+ for (const a of exit) a.finished.then(one, one);
334
+ return {
335
+ cancel: () => settle(false),
336
+ finish: () => settle(true)
337
+ };
338
+ }
339
+
340
+ export { ACCENT, ACCENT_BRIGHT, BEARISH, BULLISH, CATEGORICAL, CHIP_PLATE, CROSSHAIR, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, HIGHLIGHT, INFO, INVALID, MARKER, NEUTRAL, SERIES_LINE, SESSION_OFF, SESSION_POST, SESSION_PRE, SLATE, SLATE_DEEP, SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, TRADE_EXIT, TRADE_LONG, TRADE_SHORT, VALID, WARNING, announceSurface, categoricalColor, holdForExit, icon, iconAt, iconEl, iconMarkup, injectStyles, isDarkColor, mix, overlayScrollbarCss, registerIcon, svg16, svg24, svg24Solid, toHex6, withAlpha };