@luxalgo/vela 0.5.3 → 0.6.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 (47) hide show
  1. package/README.md +3 -2
  2. package/dist/{DataProvider-gnzv-dgc.d.cts → DataProvider-Ce6PuCzQ.d.cts} +10 -1
  3. package/dist/{DataProvider-DTOEXKTI.d.ts → DataProvider-DNx9ntBD.d.ts} +10 -1
  4. package/dist/{chunk-EY63XBFZ.js → chunk-7ROONW6H.js} +132 -23
  5. package/dist/{chunk-L5NTMWPP.js → chunk-CA3N3PYT.js} +785 -857
  6. package/dist/{chunk-LJLZR44Y.js → chunk-EMS6PO2T.js} +5 -7
  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-DToMhiw3.d.ts} +9 -2
  11. package/dist/{contributions-b6AVrqqG.d.ts → contributions-Dlc7ZWZz.d.cts} +9 -2
  12. package/dist/{history-Ci3M0xLV.d.ts → history-BZADxpKx.d.cts} +5 -3
  13. package/dist/{history-Cf1lVsap.d.cts → history-BuHXJZJ2.d.ts} +5 -3
  14. package/dist/index.cjs +2761 -1597
  15. package/dist/index.d.cts +14 -6
  16. package/dist/index.d.ts +14 -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-BNPLOQO1.d.cts} +3 -3
  21. package/dist/{plugin-DP6A4t4o.d.ts → plugin-BqjEa5r3.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 +3729 -2565
  37. package/dist/vela.global.min.js +315 -66
  38. package/dist/widget.cjs +2359 -1054
  39. package/dist/widget.d.cts +30 -16
  40. package/dist/widget.d.ts +30 -16
  41. package/dist/widget.js +37 -14
  42. package/dist/workspace.cjs +2259 -944
  43. package/dist/workspace.d.cts +10 -5
  44. package/dist/workspace.d.ts +10 -5
  45. package/dist/workspace.js +29 -8
  46. package/package.json +1 -1
  47. package/dist/chunk-ATPU5CI6.js +0 -81
@@ -1,9 +1,9 @@
1
- import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, c as VelaTheme, N as NativeBackend } from './options-XTBpbx0s.cjs';
2
- import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as RangePreset, T as TrackSizes, b as VelaShellOptions, c as SyncOptions, d as SyncKind, e as WorkspaceState } from './history-Cf1lVsap.cjs';
3
- export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-Cf1lVsap.cjs';
1
+ import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, c as VelaTheme, N as NativeBackend } from './options-BlQ00Fju.cjs';
2
+ import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as RangePreset, T as TrackSizes, b as VelaShellOptions, c as SyncOptions, d as SyncKind, e as WorkspaceState } from './history-BZADxpKx.cjs';
3
+ export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-BZADxpKx.cjs';
4
4
  import { K as KeymapManager } from './keymap-CGOz5F5f.cjs';
5
- import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, a as ScriptRun } from './contributions-Ci_i3IN2.cjs';
6
- import { M as MarketDataFeed } from './DataProvider-gnzv-dgc.cjs';
5
+ import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, a as ScriptRun } from './contributions-Dlc7ZWZz.cjs';
6
+ import { M as MarketDataFeed } from './DataProvider-Ce6PuCzQ.cjs';
7
7
 
8
8
  /** The cells that follow `originId` under `setting` — PURE (never includes the origin). */
9
9
  declare function syncTargets(originId: string, setting: SyncSetting | undefined, cellIds: readonly string[]): string[];
@@ -435,6 +435,8 @@ declare class VelaWorkspace {
435
435
  private historyUnsub;
436
436
  /** Favorite drawing tools — a WORKSPACE preference (one star set, every cell). */
437
437
  private favs;
438
+ /** Favorite timeframes — the shared topbar's quick-switch chips, one set for the grid. */
439
+ private tfFavs;
438
440
  /** Live sync configuration (mutable copy of the option). */
439
441
  private readonly syncOpts;
440
442
  private readonly persistKey;
@@ -621,6 +623,9 @@ declare class VelaWorkspace {
621
623
  private onCellIndicatorsChanged;
622
624
  /** Timeframe changes routed from the topbar menu / quick entry (chip state follows). */
623
625
  private setActiveTimeframe;
626
+ /** Star/unstar a timeframe — a WORKSPACE preference (one chip row, whatever the
627
+ * active cell); the topbar follows and the set persists with the document. */
628
+ private setTimeframeFavorite;
624
629
  /** The mode flipped (container resized across the breakpoint, or a coarse-pointer
625
630
  * change). Close the open surfaces — a desktop card must not linger over the
626
631
  * mobile chrome (and vice versa) — and re-present every cell's own chrome. */
@@ -1,9 +1,9 @@
1
- import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, c as VelaTheme, N as NativeBackend } from './options-XTBpbx0s.js';
2
- import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as RangePreset, T as TrackSizes, b as VelaShellOptions, c as SyncOptions, d as SyncKind, e as WorkspaceState } from './history-Ci3M0xLV.js';
3
- export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-Ci3M0xLV.js';
1
+ import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, c as VelaTheme, N as NativeBackend } from './options-BlQ00Fju.js';
2
+ import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as RangePreset, T as TrackSizes, b as VelaShellOptions, c as SyncOptions, d as SyncKind, e as WorkspaceState } from './history-BuHXJZJ2.js';
3
+ export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-BuHXJZJ2.js';
4
4
  import { K as KeymapManager } from './keymap-CGOz5F5f.js';
5
- import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, a as ScriptRun } from './contributions-b6AVrqqG.js';
6
- import { M as MarketDataFeed } from './DataProvider-DTOEXKTI.js';
5
+ import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, a as ScriptRun } from './contributions-DToMhiw3.js';
6
+ import { M as MarketDataFeed } from './DataProvider-DNx9ntBD.js';
7
7
 
8
8
  /** The cells that follow `originId` under `setting` — PURE (never includes the origin). */
9
9
  declare function syncTargets(originId: string, setting: SyncSetting | undefined, cellIds: readonly string[]): string[];
@@ -435,6 +435,8 @@ declare class VelaWorkspace {
435
435
  private historyUnsub;
436
436
  /** Favorite drawing tools — a WORKSPACE preference (one star set, every cell). */
437
437
  private favs;
438
+ /** Favorite timeframes — the shared topbar's quick-switch chips, one set for the grid. */
439
+ private tfFavs;
438
440
  /** Live sync configuration (mutable copy of the option). */
439
441
  private readonly syncOpts;
440
442
  private readonly persistKey;
@@ -621,6 +623,9 @@ declare class VelaWorkspace {
621
623
  private onCellIndicatorsChanged;
622
624
  /** Timeframe changes routed from the topbar menu / quick entry (chip state follows). */
623
625
  private setActiveTimeframe;
626
+ /** Star/unstar a timeframe — a WORKSPACE preference (one chip row, whatever the
627
+ * active cell); the topbar follows and the set persists with the document. */
628
+ private setTimeframeFavorite;
624
629
  /** The mode flipped (container resized across the breakpoint, or a coarse-pointer
625
630
  * change). Close the open surfaces — a desktop card must not linger over the
626
631
  * mobile chrome (and vice versa) — and re-present every cell's own chrome. */
package/dist/workspace.js CHANGED
@@ -1,10 +1,10 @@
1
- import { WidgetHistory, prefixedSymbol, Watermark, Statusline, ChartContextMenu, statuslineInkOf, indicatorLedger, Glider, localStorageAdapter, decodeState, SymbolPicker, IndicatorPicker, TimeframeQuick, Topbar, PanelDock, ObjectTree, DataWindow, Toast, Bottombar, MobileBar, DrawingPill, LayoutModeController, toolShortcutHints, resolveIndicators, sanitizeState, encodeState, TimeframeDrawer, RANGE_PRESETS, DrawingsDrawer, MoreDrawer, priceStyleIcon, priceStyleLabel, TimezoneDrawer, PriceScaleDrawer, ZOOM_IN, ZOOM_OUT, PAN_FAST, ShortcutsHelp } from './chunk-EY63XBFZ.js';
2
- export { decodeState, encodeState, sanitizeState } from './chunk-EY63XBFZ.js';
3
- import { parseSymbol, Vela, normalizeTimezone, TypedEventBus, MultiProviderFeed, resolveTheme, createCustomMark, createAttributionMark, DrawingToolbar, defaultToolbar, applyAttributionMarkTheme, sharedBarStore, timeframeToMs, priceStyleIds } from './chunk-L5NTMWPP.js';
4
- import { resolveEngines, legendActionsProviderFor, rendererDefaults, widgetActions, widgetAttachments } from './chunk-WJKLBYRM.js';
5
- import { applyPlotOverlayTokens, ensureUIHost, KeymapManager, Menu, isEditableTarget } from './chunk-P556H6EA.js';
6
- import './chunk-ATPU5CI6.js';
7
- import { registerIcon, svg16, injectStyles } from './chunk-LJLZR44Y.js';
1
+ import { WidgetHistory, prefixedSymbol, Watermark, Statusline, ChartContextMenu, statuslineInkOf, indicatorLedger, Glider, localStorageAdapter, decodeState, SymbolPicker, IndicatorPicker, TimeframeQuick, Topbar, PanelDock, ObjectTree, DataWindow, Toast, Bottombar, MobileBar, DrawingPill, LayoutModeController, toolShortcutHints, resolveIndicators, sanitizeState, encodeState, TimeframeDrawer, RANGE_PRESETS, DrawingsDrawer, MoreDrawer, priceStyleIcon, priceStyleLabel, TimezoneDrawer, PriceScaleDrawer, ZOOM_IN, ZOOM_OUT, PAN_FAST, ShortcutsHelp } from './chunk-7ROONW6H.js';
2
+ export { decodeState, encodeState, sanitizeState } from './chunk-7ROONW6H.js';
3
+ import { parseSymbol, Vela, normalizeTimezone, TypedEventBus, MultiProviderFeed, resolveTheme, createCustomMark, createAttributionMark, DrawingToolbar, defaultToolbar, applyAttributionMarkTheme, sharedBarStore, timeframeToMs, priceStyleIds } from './chunk-CA3N3PYT.js';
4
+ import { resolveEngines, legendActionsProviderFor, rendererDefaults, widgetActions, widgetAttachments } from './chunk-ZNL2X6U2.js';
5
+ import { KeymapManager, Menu, isEditableTarget } from './chunk-QWIEKZRE.js';
6
+ import { applyPlotOverlayTokens, ensureUIHost } from './chunk-OGRQW3M6.js';
7
+ import { registerIcon, svg16, injectStyles } from './chunk-EMS6PO2T.js';
8
8
 
9
9
  // src/workspace/sync.ts
10
10
  function syncTargets(originId, setting, cellIds) {
@@ -161,6 +161,9 @@ var ChartCell = class {
161
161
  this.statusline = deps.statusline ? new Statusline(this.host, symbol ?? "") : null;
162
162
  this.statusline?.setMeta(seed.timeframe ?? "60", this.state.provider ?? "");
163
163
  this.statusline?.onChart(this.inner);
164
+ void this.inner.data.ready().then(() => {
165
+ if (this.inner && this.state.symbol) this.statusline?.setMeta(this.state.timeframe ?? "60", this.inner.data.displayPrefix(this.state.symbol) ?? this.state.provider ?? "");
166
+ });
164
167
  this.syncStatuslineColors();
165
168
  this.contextMenu = new ChartContextMenu(this.host, {
166
169
  resetView: () => {
@@ -283,7 +286,7 @@ var ChartCell = class {
283
286
  this.state.timeframe = timeframe;
284
287
  this.watermark?.update(symbol2, timeframe);
285
288
  this.statusline?.setSymbol(symbol2);
286
- this.statusline?.setMeta(timeframe, this.inner?.data.resolve(symbol2)?.provider ?? this.state.provider ?? "");
289
+ this.statusline?.setMeta(timeframe, this.inner?.data.displayPrefix(symbol2) ?? this.state.provider ?? "");
287
290
  if (this.inner) this.statusline?.onChart(this.inner);
288
291
  this.refreshNativeCatalog();
289
292
  this.deps.onMarketChanged(this.id);
@@ -920,6 +923,8 @@ var VelaWorkspace = class {
920
923
  this.historyUnsub = null;
921
924
  /** Favorite drawing tools — a WORKSPACE preference (one star set, every cell). */
922
925
  this.favs = [];
926
+ /** Favorite timeframes — the shared topbar's quick-switch chips, one set for the grid. */
927
+ this.tfFavs = [];
923
928
  /** Live sync configuration (mutable copy of the option). */
924
929
  this.syncOpts = {};
925
930
  this.stateTimer = null;
@@ -983,6 +988,7 @@ var VelaWorkspace = class {
983
988
  }
984
989
  this.timezone = boot?.timezone ?? opts.timezone ?? "Etc/UTC";
985
990
  if (boot?.favorites) this.favs = [...boot.favorites];
991
+ if (boot?.timeframeFavorites) this.tfFavs = [...boot.timeframeFavorites];
986
992
  const sync = boot?.sync ?? opts.sync;
987
993
  for (const kind of ["viewport", "symbol", "timeframe", "crosshair", "drawings"]) {
988
994
  this.applySyncSetting(kind, sync?.[kind]);
@@ -1037,8 +1043,10 @@ var VelaWorkspace = class {
1037
1043
  onAlertsClick: (anchor) => this.openAlertsMenu(anchor),
1038
1044
  timeframe: "60",
1039
1045
  timeframes: opts.timeframes ?? DEFAULT_TIMEFRAMES,
1046
+ timeframeFavorites: this.tfFavs,
1040
1047
  priceStyle: "candles",
1041
1048
  onTimeframe: (tf) => this.setActiveTimeframe(tf),
1049
+ onTimeframeFavorite: (tf, on) => this.setTimeframeFavorite(tf, on),
1042
1050
  onPriceStyle: (style) => this.active.setPriceStyle(style),
1043
1051
  layout: {
1044
1052
  current: this.def.id,
@@ -1289,6 +1297,7 @@ var VelaWorkspace = class {
1289
1297
  const state = { version: 1, layout: this.def.id, timezone: this.timezone, sync: { ...this.syncOpts }, charts };
1290
1298
  if (this.activeId) state.activeCellId = this.activeId;
1291
1299
  if (this.favs.length > 0) state.favorites = [...this.favs];
1300
+ if (this.tfFavs.length > 0) state.timeframeFavorites = [...this.tfFavs];
1292
1301
  if (this.trackSizes.size > 0) state.trackSizes = Object.fromEntries([...this.trackSizes].map(([k, v]) => [k, { ...v }]));
1293
1302
  const panels = this.dock.getState();
1294
1303
  if (panels) state.panels = panels;
@@ -1309,6 +1318,10 @@ var VelaWorkspace = class {
1309
1318
  this.bottombar?.setTimezone(st.timezone);
1310
1319
  }
1311
1320
  if (st.favorites) this.favs = [...st.favorites];
1321
+ if (st.timeframeFavorites) {
1322
+ this.tfFavs = [...st.timeframeFavorites];
1323
+ this.topbar.setTimeframeFavorites(this.tfFavs);
1324
+ }
1312
1325
  this.dock.applyState(st.panels);
1313
1326
  for (const kind of ["viewport", "symbol", "timeframe", "crosshair", "drawings"]) this.applySyncSetting(kind, st.sync?.[kind]);
1314
1327
  this.trackSizes.clear();
@@ -1884,6 +1897,14 @@ var VelaWorkspace = class {
1884
1897
  this.bottombar?.setActiveRange(null);
1885
1898
  this.active.setTimeframe(tf);
1886
1899
  }
1900
+ /** Star/unstar a timeframe — a WORKSPACE preference (one chip row, whatever the
1901
+ * active cell); the topbar follows and the set persists with the document. */
1902
+ setTimeframeFavorite(tf, on) {
1903
+ if (on === this.tfFavs.includes(tf)) return;
1904
+ this.tfFavs = on ? [tf, ...this.tfFavs] : this.tfFavs.filter((f) => f !== tf);
1905
+ this.topbar.setTimeframeFavorites(this.tfFavs);
1906
+ this.markStateDirty();
1907
+ }
1887
1908
  /** The mode flipped (container resized across the breakpoint, or a coarse-pointer
1888
1909
  * change). Close the open surfaces — a desktop card must not linger over the
1889
1910
  * mobile chrome (and vice versa) — and re-present every cell's own chrome. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxalgo/vela",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "Open-source charting library with a native high-performance renderer, drawing tools, pluggable chart types and pluggable scripting engines.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://luxalgo.com/vela",
@@ -1,81 +0,0 @@
1
- import { isDarkColor, mix, HIGHLIGHT, ACCENT_BRIGHT, ACCENT, withAlpha } from './chunk-LJLZR44Y.js';
2
-
3
- // src/core/tokens.ts
4
- var STATIC_TOKENS = {
5
- "--vela-space-1": "4px",
6
- "--vela-space-2": "8px",
7
- "--vela-space-3": "12px",
8
- "--vela-space-4": "16px",
9
- "--vela-radius-sm": "4px",
10
- "--vela-radius-md": "6px",
11
- "--vela-radius-lg": "10px",
12
- "--vela-z-tooltip": "60",
13
- "--vela-z-menu": "50",
14
- "--vela-z-dialog": "40",
15
- "--vela-ease": "cubic-bezier(0.22, 1, 0.36, 1)",
16
- "--vela-dur-fast": "90ms",
17
- "--vela-dur-med": "160ms",
18
- "--vela-font-size-sm": "11px",
19
- "--vela-font-size-md": "12px",
20
- "--vela-font-size-lg": "14px"
21
- };
22
- function themeTokens(t) {
23
- const dark = isDarkColor(t.background);
24
- const wash = (a) => dark ? `rgba(255,255,255,${a})` : withAlpha(t.textColor, a + 0.02);
25
- const elevated = mix(t.background, dark ? "#ffffff" : t.textColor, dark ? 0.03 : 0.05);
26
- return {
27
- "--vela-font": t.fontFamily,
28
- "--vela-bg": t.background,
29
- // Chrome text is slightly brighter than the chart's own axis text, which is
30
- // deliberately recessive; the chart keeps using `t.textColor` directly.
31
- "--vela-fg": dark ? "#d1d4dc" : t.textColor,
32
- "--vela-fg-muted": dark ? "#868a96" : withAlpha(t.textColor, 0.62),
33
- "--vela-fg-faint": withAlpha(t.textColor, 0.35),
34
- "--vela-fg-bright": dark ? "#f0f3fa" : "#000000",
35
- "--vela-surface": t.background,
36
- // Panels and menus float ABOVE the chart, so their surface is the wash flattened onto
37
- // the chart background — opaque, or candles read through the panel.
38
- "--vela-surface-elev": elevated,
39
- "--vela-surface-overlay": elevated,
40
- // Recessed fields (inputs, selects) read as cut INTO their panel, so they fall back
41
- // to the chart surface and are separated from the panel by their border alone.
42
- "--vela-surface-sunken": t.background,
43
- "--vela-border": t.borderColor,
44
- "--vela-border-strong": dark ? "#34353b" : withAlpha(t.textColor, 0.28),
45
- "--vela-border-soft": t.borderColor,
46
- // Barely-there rules INSIDE a panel (row separators), where a full border would
47
- // chop the list into boxes.
48
- "--vela-border-faint": withAlpha(t.textColor, 0.08),
49
- "--vela-hover": wash(0.06),
50
- "--vela-active": wash(0.1),
51
- // A deliberately stronger hover for rows inside an already-tinted surface (menu
52
- // items in an active flyout), where the normal wash would not separate from it.
53
- "--vela-hover-strong": wash(0.16),
54
- "--vela-focus": withAlpha(t.textColor, 0.5),
55
- "--vela-focus-soft": withAlpha(t.textColor, 0.12),
56
- // Separator hover — the SAME wash the chart's pane separators paint on hover
57
- // (soft full-thickness band + solid 2px center line), so DOM-drawn dividers
58
- // (the workspace grid) and canvas-drawn ones read as one family.
59
- "--vela-separator-hover-band": withAlpha(t.textColor, 0.1),
60
- "--vela-separator-hover-line": withAlpha(t.textColor, 0.55),
61
- "--vela-scroll": withAlpha(t.textColor, 0.3),
62
- "--vela-accent": ACCENT,
63
- "--vela-accent-bright": ACCENT_BRIGHT,
64
- "--vela-highlight": HIGHLIGHT,
65
- // The inverse chip: a filled selected state (active tab, ticked checkbox). Its ink
66
- // must contrast the fill, so the pair flips together with the theme.
67
- "--vela-selected-bg": dark ? "#f0f3fa" : t.textColor,
68
- "--vela-selected-fg": dark ? t.background : "#ffffff",
69
- // Fixed ink for saturated fills (accent buttons, categorical avatars) — those fills
70
- // are theme-independent, so their ink is too.
71
- "--vela-fg-on-fill": "#ffffff",
72
- "--vela-up": t.upColor,
73
- "--vela-down": t.downColor,
74
- "--vela-danger": t.downColor,
75
- "--vela-shadow": "0 8px 30px rgba(0,0,0,0.5)",
76
- "--vela-shadow-dialog": "0 20px 60px rgba(0,0,0,0.5)",
77
- "--vela-backdrop": "rgba(0,0,0,0.45)"
78
- };
79
- }
80
-
81
- export { STATIC_TOKENS, themeTokens };