@luxalgo/vela 0.5.3 → 0.5.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 (47) hide show
  1. package/README.md +3 -2
  2. package/dist/{DataProvider-DTOEXKTI.d.ts → DataProvider-Cqc_BaJ9.d.ts} +1 -1
  3. package/dist/{DataProvider-gnzv-dgc.d.cts → DataProvider-DgS2UyMc.d.cts} +1 -1
  4. package/dist/{chunk-L5NTMWPP.js → chunk-D6WM5IUE.js} +724 -851
  5. package/dist/{chunk-LJLZR44Y.js → chunk-EMS6PO2T.js} +5 -7
  6. package/dist/{chunk-EY63XBFZ.js → chunk-JBQUY2RI.js} +119 -12
  7. package/dist/chunk-OGRQW3M6.js +1328 -0
  8. package/dist/{chunk-P556H6EA.js → chunk-QWIEKZRE.js} +59 -34
  9. package/dist/{chunk-WJKLBYRM.js → chunk-ZNL2X6U2.js} +1 -1
  10. package/dist/{contributions-Ci_i3IN2.d.cts → contributions-4Nh1jbvb.d.cts} +2 -2
  11. package/dist/{contributions-b6AVrqqG.d.ts → contributions-DuIxJWeH.d.ts} +2 -2
  12. package/dist/{history-Cf1lVsap.d.cts → history-FsmvCIo4.d.ts} +5 -3
  13. package/dist/{history-Ci3M0xLV.d.ts → history-HofqYEh2.d.cts} +5 -3
  14. package/dist/index.cjs +2715 -1606
  15. package/dist/index.d.cts +6 -6
  16. package/dist/index.d.ts +6 -6
  17. package/dist/index.js +4 -4
  18. package/dist/{options-XTBpbx0s.d.ts → options-BlQ00Fju.d.cts} +3 -1
  19. package/dist/{options-XTBpbx0s.d.cts → options-BlQ00Fju.d.ts} +3 -1
  20. package/dist/{plugin-DlidwMj6.d.cts → plugin-DJR6z3e0.d.cts} +3 -3
  21. package/dist/{plugin-DP6A4t4o.d.ts → plugin-N_EaXN4-.d.ts} +3 -3
  22. package/dist/plugin.cjs +4 -0
  23. package/dist/plugin.d.cts +4 -4
  24. package/dist/plugin.d.ts +4 -4
  25. package/dist/plugin.js +2 -2
  26. package/dist/providers/binance.d.cts +2 -2
  27. package/dist/providers/binance.d.ts +2 -2
  28. package/dist/providers/coinbase.d.cts +2 -2
  29. package/dist/providers/coinbase.d.ts +2 -2
  30. package/dist/providers/hyperliquid.d.cts +2 -2
  31. package/dist/providers/hyperliquid.d.ts +2 -2
  32. package/dist/ui.cjs +1318 -4
  33. package/dist/ui.d.cts +383 -2
  34. package/dist/ui.d.ts +383 -2
  35. package/dist/ui.js +3 -3
  36. package/dist/vela.global.js +2709 -1600
  37. package/dist/vela.global.min.js +315 -66
  38. package/dist/widget.cjs +2275 -1032
  39. package/dist/widget.d.cts +25 -7
  40. package/dist/widget.d.ts +25 -7
  41. package/dist/widget.js +27 -9
  42. package/dist/workspace.cjs +2181 -926
  43. package/dist/workspace.d.cts +10 -5
  44. package/dist/workspace.d.ts +10 -5
  45. package/dist/workspace.js +25 -7
  46. package/package.json +1 -1
  47. package/dist/chunk-ATPU5CI6.js +0 -81
package/dist/ui.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as VelaTheme } from './options-XTBpbx0s.cjs';
1
+ import { c as VelaTheme } from './options-BlQ00Fju.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';
@@ -94,6 +94,11 @@ interface MenuItemDescriptor {
94
94
  toggle?: boolean;
95
95
  /** Icon id (see the `vela/ui` icon registry) rendered before the label. */
96
96
  icon?: string;
97
+ /** Favorite-star affordance at the row's right edge: `false` renders an outline
98
+ * star revealed on row hover, `true` a filled star that stays visible. Clicking
99
+ * it reports through the menu's `onFavorite` WITHOUT selecting (or closing) the
100
+ * row — undefined rows carry no star at all. */
101
+ favorite?: boolean;
97
102
  /** Nested entries — the row becomes a submenu trigger opening its own list to the side.
98
103
  * A branch is not selectable itself: `onSelect` only ever reports leaf ids. */
99
104
  submenu?: readonly MenuItemDescriptor[];
@@ -105,6 +110,16 @@ interface MenuControllerOptions {
105
110
  placement?: infer PL;
106
111
  } ? PL : never : never;
107
112
  onOpenChange?: (open: boolean) => void;
113
+ /** Pin the floating list to this rect (viewport coords). Used to keep an open
114
+ * menu still when its trigger moves — starring a timeframe adds a chip and
115
+ * would otherwise drag the list with the caret. `null` falls through to the
116
+ * live trigger. */
117
+ getAnchorRect?: () => {
118
+ x: number;
119
+ y: number;
120
+ width: number;
121
+ height: number;
122
+ } | null;
108
123
  /** Share the trigger's DOM id with other machines composed on the same element. */
109
124
  triggerId?: string;
110
125
  /** Pin the machine's own id instead of taking a fresh one. A parent registers its
@@ -129,6 +144,9 @@ interface MenuOptions extends MenuControllerOptions {
129
144
  * compact lists like the timeframe dropdown pass something snug). Submenus keep the
130
145
  * default. */
131
146
  minWidth?: string;
147
+ /** Star-toggle reports from items carrying `favorite` (the menu stays open — starring
148
+ * is a side action on a row, never a selection). */
149
+ onFavorite?: (id: string, on: boolean) => void;
132
150
  }
133
151
  declare class Menu {
134
152
  private readonly root;
@@ -247,4 +265,367 @@ declare class Drawer {
247
265
  destroy(): void;
248
266
  }
249
267
 
250
- export { Dialog, type DialogApi, type DialogControllerOptions, type DialogOptions, type DialogService, Drawer, type DrawerApi, type DrawerControllerOptions, type DrawerOptions, type DrawerService, type MachineHandle, Menu, type MenuApi, type MenuControllerOptions, type MenuItemDescriptor, type MenuOptions, type MenuService, Tooltip, type TooltipApi, type TooltipControllerOptions, type TooltipOptions, type TooltipService, applyPlotOverlayTokens, applyThemeTokens, dialogController, drawerController, ensureUIHost, iconEl, injectStyles, menuController, nextUid, runMachine, tooltipController, withAlpha };
268
+ type PopoverAlign = 'start' | 'end';
269
+ type PopoverPosition = 'fixed' | 'absolute';
270
+ /** Axis-aligned rectangle in viewport coordinates. */
271
+ interface Rect {
272
+ left: number;
273
+ top: number;
274
+ right: number;
275
+ bottom: number;
276
+ width: number;
277
+ height: number;
278
+ }
279
+ interface PlaceArgs {
280
+ trigger: Rect;
281
+ pop: {
282
+ width: number;
283
+ height: number;
284
+ };
285
+ gap: number;
286
+ align: PopoverAlign;
287
+ /** Already-inset clamp rectangle in viewport coordinates. */
288
+ clamp: Rect;
289
+ /** Subtracted from left/top when the popover is `position:absolute` inside a host. */
290
+ originX: number;
291
+ originY: number;
292
+ }
293
+ interface PlaceResult {
294
+ left: number;
295
+ top: number;
296
+ }
297
+ /** Inset a rectangle uniformly (positive inset shrinks). */
298
+ declare function insetRect(r: Rect, inset: number): Rect;
299
+ /** Viewport rect with a uniform inset (the 6px air ColorField/WidthField used). */
300
+ declare function viewportRect(width: number, height: number, inset: number): Rect;
301
+ /** Intersection of two rects. Empty (non-positive size) if they don't overlap. */
302
+ declare function intersectRects(a: Rect, b: Rect): Rect;
303
+ /**
304
+ * Place a popover under `trigger`, flipping above when it would leave `clamp`.
305
+ * Prefers the side with more room when neither fully fits. `align: 'end'` right-aligns
306
+ * to the trigger (swatches and width fields sit at the row's right edge).
307
+ */
308
+ declare function placePopover(a: PlaceArgs): PlaceResult;
309
+ interface PopoverControllerOptions {
310
+ gap?: number;
311
+ align?: PopoverAlign;
312
+ matchWidth?: boolean;
313
+ position?: PopoverPosition;
314
+ boundaryInset?: number;
315
+ viewportInset?: number;
316
+ onClose?: () => void;
317
+ }
318
+ interface PopoverController {
319
+ gap: number;
320
+ align: PopoverAlign;
321
+ matchWidth: boolean;
322
+ position: PopoverPosition;
323
+ boundaryInset: number;
324
+ viewportInset: number;
325
+ onClose?: () => void;
326
+ }
327
+ declare function popoverController(opts?: PopoverControllerOptions): PopoverController;
328
+
329
+ type PopoverBoundary = 'viewport' | HTMLElement | (() => DOMRect | null);
330
+ interface PopoverOptions extends PopoverControllerOptions {
331
+ trigger: HTMLElement;
332
+ content?: Node | ((body: HTMLElement) => void);
333
+ /** Portal target. Defaults to `document.body`. Drawing chrome passes the chart host. */
334
+ host?: HTMLElement;
335
+ theme?: VelaTheme;
336
+ className?: string;
337
+ zIndex?: string | number;
338
+ /** Clamp rectangle. `'viewport'` (default) or an element (dialog / chart host). */
339
+ boundary?: PopoverBoundary;
340
+ }
341
+ /** Close whichever kit popover is showing (dialog teardown, a second trigger). */
342
+ declare function closeOpenPopovers(): void;
343
+ declare function isPopoverOpen(): boolean;
344
+ declare function openPopoverTrigger(): HTMLElement | null;
345
+ declare class Popover {
346
+ readonly el: HTMLElement;
347
+ readonly trigger: HTMLElement;
348
+ private readonly host;
349
+ private readonly ctrl;
350
+ private readonly boundary;
351
+ private readonly theme?;
352
+ private onOutside;
353
+ private onKey;
354
+ private onReflow;
355
+ private shown;
356
+ constructor(opts: PopoverOptions);
357
+ get open(): boolean;
358
+ get position(): PopoverPosition;
359
+ get align(): PopoverAlign;
360
+ show(): void;
361
+ hide(): void;
362
+ /** Show if closed, hide if this instance is the open popover. */
363
+ toggle(): void;
364
+ destroy(): void;
365
+ reposition(): void;
366
+ private clampRect;
367
+ private readBoundary;
368
+ private place;
369
+ }
370
+
371
+ type SwitchSize = 'sm' | 'md';
372
+ /** `bright` = indicator-dialog fill (`--vela-fg-bright`); `selected` = chart-settings fill. */
373
+ type SwitchTone = 'bright' | 'selected';
374
+ interface SwitchControllerOptions {
375
+ checked?: boolean;
376
+ disabled?: boolean;
377
+ size?: SwitchSize;
378
+ tone?: SwitchTone;
379
+ onChange?: (checked: boolean) => void;
380
+ }
381
+ interface SwitchController {
382
+ checked: boolean;
383
+ disabled: boolean;
384
+ size: SwitchSize;
385
+ tone: SwitchTone;
386
+ setChecked(v: boolean): void;
387
+ toggle(): boolean;
388
+ }
389
+ declare function switchController(opts?: SwitchControllerOptions): SwitchController;
390
+
391
+ interface SwitchOptions extends SwitchControllerOptions {
392
+ id?: string;
393
+ }
394
+ declare class Switch {
395
+ readonly el: HTMLButtonElement;
396
+ private readonly ctrl;
397
+ constructor(opts?: SwitchOptions);
398
+ get checked(): boolean;
399
+ setChecked(v: boolean): void;
400
+ private paint;
401
+ }
402
+
403
+ type SelectSize = 'sm' | 'md';
404
+ interface SelectOption {
405
+ value: string;
406
+ label: string;
407
+ }
408
+ interface SelectControllerOptions {
409
+ options: readonly SelectOption[];
410
+ value?: string;
411
+ size?: SelectSize;
412
+ /** Stretch the trigger to its parent (indicator dialog). Chart settings hug content. */
413
+ fill?: boolean;
414
+ disabled?: boolean;
415
+ onChange?: (value: string, label: string) => void;
416
+ }
417
+ interface SelectController {
418
+ options: readonly SelectOption[];
419
+ value: string;
420
+ size: SelectSize;
421
+ fill: boolean;
422
+ disabled: boolean;
423
+ setValue(v: string): void;
424
+ labelOf(value: string): string;
425
+ pick(value: string): {
426
+ value: string;
427
+ label: string;
428
+ };
429
+ }
430
+ declare function selectController(opts: SelectControllerOptions): SelectController;
431
+
432
+ interface SelectListPopoverOpts {
433
+ theme?: VelaTheme;
434
+ matchWidth?: boolean;
435
+ boundary?: PopoverBoundary;
436
+ boundaryInset?: number;
437
+ gap?: number;
438
+ align?: PopoverOptions['align'];
439
+ host?: HTMLElement;
440
+ position?: PopoverOptions['position'];
441
+ zIndex?: string | number;
442
+ size?: SelectSize;
443
+ onClose?: () => void;
444
+ }
445
+ interface SelectOptions extends SelectControllerOptions {
446
+ id?: string;
447
+ theme?: VelaTheme;
448
+ /** Placement for the open list (dialog-rect clamp, etc.). */
449
+ list?: SelectListPopoverOpts;
450
+ }
451
+ /** Fill `menu` with option buttons. Call {@link decorateSelectScroll} after the menu is on screen. */
452
+ declare function fillSelectList(menu: HTMLElement, options: readonly SelectOption[], current: string, onPick: (value: string, label: string) => void): void;
453
+ /** Overlay scrollbar + scroll-into-view — needs a laid-out list (after the popover is shown). */
454
+ declare function decorateSelectScroll(menu: HTMLElement): void;
455
+ /** Open (or re-click close) a themed option list under `trigger`. */
456
+ declare function toggleSelectList(trigger: HTMLElement, options: readonly SelectOption[], current: string, onPick: (value: string, label: string) => void, opts?: SelectListPopoverOpts): Popover | null;
457
+ declare function openSelectList(trigger: HTMLElement, options: readonly SelectOption[], current: string, onPick: (value: string, label: string) => void, opts?: SelectListPopoverOpts): Popover;
458
+ declare class Select {
459
+ readonly el: HTMLElement;
460
+ private readonly trigger;
461
+ private readonly labelEl;
462
+ private readonly ctrl;
463
+ private readonly listOpts;
464
+ private list;
465
+ constructor(opts: SelectOptions);
466
+ get value(): string;
467
+ setValue(v: string): void;
468
+ toggle(): void;
469
+ destroy(): void;
470
+ }
471
+
472
+ type NumberSize = 'sm' | 'md';
473
+ type NumberCommit = 'blur' | 'live';
474
+ interface NumberInputControllerOptions {
475
+ value: number;
476
+ min?: number;
477
+ max?: number;
478
+ step?: number;
479
+ integer?: boolean;
480
+ size?: NumberSize;
481
+ /** `blur` (indicator dialog: clamp + steppers) vs `live` (chart settings: no clamp). */
482
+ commit?: NumberCommit;
483
+ steppers?: boolean;
484
+ clamp?: boolean;
485
+ disabled?: boolean;
486
+ onChange?: (value: number) => void;
487
+ }
488
+ declare function clampNumber(n: number, opts: {
489
+ min?: number;
490
+ max?: number;
491
+ integer?: boolean;
492
+ }): number;
493
+ /** Trim binary-float noise after stepper arithmetic (`1.7 + 0.1` → `1.8`, not
494
+ * `1.7999999999999998`): round to the decimals the base value and step imply. */
495
+ declare function snapToStep(n: number, base: number, step: number): number;
496
+ interface NumberInputController {
497
+ value: number;
498
+ min?: number;
499
+ max?: number;
500
+ step: number;
501
+ integer: boolean;
502
+ size: NumberSize;
503
+ commit: NumberCommit;
504
+ steppers: boolean;
505
+ clamp: boolean;
506
+ disabled: boolean;
507
+ apply(raw: number): number | null;
508
+ /** Write the displayed value without emitting (vela-sync / external refresh). */
509
+ sync(raw: number): number;
510
+ nudge(dir: 1 | -1): number | null;
511
+ }
512
+ declare function numberInputController(opts: NumberInputControllerOptions): NumberInputController;
513
+
514
+ interface NumberInputOptions extends NumberInputControllerOptions {
515
+ id?: string;
516
+ title?: string;
517
+ /** Chart-settings placeholder mode: empty field means `emptyValue` (the default). */
518
+ placeholder?: string;
519
+ emptyValue?: number;
520
+ compact?: boolean;
521
+ }
522
+ declare class NumberInput {
523
+ readonly el: HTMLElement;
524
+ readonly input: HTMLInputElement;
525
+ private readonly ctrl;
526
+ private last;
527
+ private readonly placeholderMode;
528
+ private readonly emptyValue;
529
+ constructor(opts: NumberInputOptions);
530
+ get value(): number;
531
+ setValue(v: number): void;
532
+ private buildSteppers;
533
+ }
534
+
535
+ type TextFieldSize = 'sm' | 'md';
536
+ interface TextFieldControllerOptions {
537
+ value?: string;
538
+ size?: TextFieldSize;
539
+ fill?: boolean;
540
+ disabled?: boolean;
541
+ onChange?: (value: string) => void;
542
+ }
543
+ interface TextFieldController {
544
+ value: string;
545
+ size: TextFieldSize;
546
+ fill: boolean;
547
+ disabled: boolean;
548
+ commit(next: string): string | null;
549
+ /** Write without emitting (external refresh). */
550
+ sync(next: string): void;
551
+ }
552
+ declare function textFieldController(opts?: TextFieldControllerOptions): TextFieldController;
553
+
554
+ interface TextFieldOptions extends TextFieldControllerOptions {
555
+ id?: string;
556
+ }
557
+ declare class TextField {
558
+ readonly el: HTMLElement;
559
+ readonly input: HTMLInputElement;
560
+ private readonly ctrl;
561
+ constructor(opts?: TextFieldOptions);
562
+ get value(): string;
563
+ setValue(v: string): void;
564
+ }
565
+
566
+ /** Split a color into its `#RRGGBB` part + alpha 0..1 (handles `#RGB`, `#RRGGBB(AA)`, `rgba()`). */
567
+ declare function splitColor(color: string): {
568
+ hex6: string;
569
+ alpha: number;
570
+ };
571
+ /** Combine a `#RRGGBB` + alpha into `#RRGGBB` (opaque) or `#RRGGBBAA`. */
572
+ declare function combineColor(hex6: string, alpha: number): string;
573
+ /** Composite `fg` over `bg` at `alpha`, returning an opaque `#rrggbb`. */
574
+ declare function blendOver(fg: string, bg: string, alpha: number): string;
575
+ /** HSL (h 0-360, s/l 0-100) → `#rrggbb`. */
576
+ declare function hslHex(h: number, s: number, l: number): string;
577
+ /** A swatch palette: a grayscale row, then hue columns × shade rows. */
578
+ declare function buildPalette(): string[][];
579
+ /** The alpha checkerboard laid under translucent colors. Its grays are fixed on purpose:
580
+ * it stands for "nothing here", so it must not shift with the theme. */
581
+ declare function transparencyChecker(size: number): string;
582
+ type ColorFieldShape = 'square' | 'circle';
583
+ interface ColorPickerControllerOptions {
584
+ color?: string;
585
+ onChange?: (value: string) => void;
586
+ }
587
+ interface ColorPickerController {
588
+ hex6: string;
589
+ alpha: number;
590
+ combined(): string;
591
+ setHex(hex: string): void;
592
+ setAlpha(a: number): void;
593
+ }
594
+ declare function colorPickerController(opts?: ColorPickerControllerOptions): ColorPickerController;
595
+
596
+ /**
597
+ * A self-contained color picker: a swatch grid (grays + hue × shade), a
598
+ * recents row with a custom "+" picker, and an opacity slider over a transparency checker.
599
+ * Emits `#RRGGBB` / `#RRGGBBAA` through `onChange`.
600
+ */
601
+ declare function buildColorPicker(color: string, theme: VelaTheme, onChange: (v: string) => void): HTMLElement;
602
+ interface ColorFieldOpts {
603
+ shape?: ColorFieldShape;
604
+ theme: VelaTheme;
605
+ getVal: () => string;
606
+ onVal: (v: string) => void;
607
+ id?: string;
608
+ popover?: Pick<PopoverOptions, 'host' | 'position' | 'boundary' | 'zIndex' | 'gap' | 'align'>;
609
+ }
610
+ /** Closed-state swatch shape. `square` is the chart-settings field; `circle` is the
611
+ * indicator-dialog preview — a square chip inset from a matching square field border. */
612
+ declare function colorField(theme: VelaTheme, getVal: () => string, onVal: (v: string) => void, opts?: {
613
+ shape?: ColorFieldShape;
614
+ id?: string;
615
+ popover?: ColorFieldOpts['popover'];
616
+ }): HTMLElement;
617
+ declare class ColorField {
618
+ readonly el: HTMLButtonElement;
619
+ private readonly swatch;
620
+ private readonly getVal;
621
+ private readonly onVal;
622
+ private readonly theme;
623
+ private readonly popoverOpts;
624
+ constructor(opts: ColorFieldOpts);
625
+ private paint;
626
+ private toggle;
627
+ }
628
+ /** Close any open color (or other kit) popover — dialog teardown. */
629
+ declare function closeColorPopover(): void;
630
+
631
+ export { ColorField, type ColorFieldOpts, type ColorFieldShape, type ColorPickerController, type ColorPickerControllerOptions, Dialog, type DialogApi, type DialogControllerOptions, type DialogOptions, type DialogService, Drawer, type DrawerApi, type DrawerControllerOptions, type DrawerOptions, type DrawerService, 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, TextField, type TextFieldController, type TextFieldControllerOptions, type TextFieldOptions, type TextFieldSize, Tooltip, type TooltipApi, type TooltipControllerOptions, type TooltipOptions, type TooltipService, applyPlotOverlayTokens, applyThemeTokens, blendOver, buildColorPicker, buildPalette, clampNumber, closeColorPopover, closeOpenPopovers, colorField, colorPickerController, combineColor, decorateSelectScroll, dialogController, drawerController, ensureUIHost, fillSelectList, hslHex, iconEl, injectStyles, insetRect, intersectRects, isPopoverOpen, menuController, nextUid, numberInputController, openPopoverTrigger, openSelectList, placePopover, popoverController, runMachine, selectController, snapToStep, splitColor, switchController, textFieldController, toggleSelectList, tooltipController, transparencyChecker, viewportRect, withAlpha };