@luxalgo/vela 0.5.4 → 0.6.1

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 (37) hide show
  1. package/dist/{DataProvider-DgS2UyMc.d.cts → DataProvider-BNKtYU5V.d.cts} +22 -3
  2. package/dist/{DataProvider-Cqc_BaJ9.d.ts → DataProvider-gJjN_0eh.d.ts} +22 -3
  3. package/dist/{chunk-D6WM5IUE.js → chunk-4MQEG67Z.js} +77 -18
  4. package/dist/{chunk-JBQUY2RI.js → chunk-6LZJRO2S.js} +48 -18
  5. package/dist/{contributions-DuIxJWeH.d.ts → contributions-D64UA74H.d.cts} +9 -2
  6. package/dist/{contributions-4Nh1jbvb.d.cts → contributions-lPAgo9Cu.d.ts} +9 -2
  7. package/dist/{history-FsmvCIo4.d.ts → history-CVoFDJ2D.d.ts} +21 -3
  8. package/dist/{history-HofqYEh2.d.cts → history-fSMXVLt1.d.cts} +21 -3
  9. package/dist/index.cjs +77 -18
  10. package/dist/index.d.cts +14 -6
  11. package/dist/index.d.ts +14 -6
  12. package/dist/index.js +1 -1
  13. package/dist/{options-BlQ00Fju.d.cts → options-BqGeFHtp.d.cts} +15 -1
  14. package/dist/{options-BlQ00Fju.d.ts → options-BqGeFHtp.d.ts} +15 -1
  15. package/dist/{plugin-DJR6z3e0.d.cts → plugin-D5ni4WEJ.d.cts} +3 -3
  16. package/dist/{plugin-N_EaXN4-.d.ts → plugin-o5HJH46Z.d.ts} +3 -3
  17. package/dist/plugin.d.cts +4 -4
  18. package/dist/plugin.d.ts +4 -4
  19. package/dist/providers/binance.d.cts +2 -2
  20. package/dist/providers/binance.d.ts +2 -2
  21. package/dist/providers/coinbase.d.cts +2 -2
  22. package/dist/providers/coinbase.d.ts +2 -2
  23. package/dist/providers/hyperliquid.d.cts +2 -2
  24. package/dist/providers/hyperliquid.d.ts +2 -2
  25. package/dist/ui.d.cts +1 -1
  26. package/dist/ui.d.ts +1 -1
  27. package/dist/vela.global.js +77 -18
  28. package/dist/vela.global.min.js +29 -29
  29. package/dist/widget.cjs +175 -40
  30. package/dist/widget.d.cts +23 -15
  31. package/dist/widget.d.ts +23 -15
  32. package/dist/widget.js +56 -10
  33. package/dist/workspace.cjs +172 -36
  34. package/dist/workspace.d.cts +20 -5
  35. package/dist/workspace.d.ts +20 -5
  36. package/dist/workspace.js +52 -5
  37. package/package.json +1 -1
@@ -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-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-HofqYEh2.cjs';
3
- export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-HofqYEh2.cjs';
1
+ import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, c as VelaTheme, N as NativeBackend, d as MarketSession } from './options-BqGeFHtp.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-fSMXVLt1.cjs';
3
+ export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-fSMXVLt1.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-4Nh1jbvb.cjs';
6
- import { M as MarketDataFeed } from './DataProvider-DgS2UyMc.cjs';
5
+ import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, a as ScriptRun } from './contributions-D64UA74H.cjs';
6
+ import { M as MarketDataFeed } from './DataProvider-BNKtYU5V.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[];
@@ -35,6 +35,8 @@ interface CellSeed {
35
35
  timeframe?: string;
36
36
  priceStyle?: string;
37
37
  bars?: number;
38
+ /** Trading session to show (markets that have one; `regular` is the default). */
39
+ session?: string;
38
40
  /** Offline bars for this cell — replaces the provider (boot-only). */
39
41
  data?: OHLCV[];
40
42
  /** Initial visible window (boot-only). */
@@ -118,6 +120,8 @@ declare class ChartCell {
118
120
  lastCrossPrice: number | null;
119
121
  /** The bottombar range chip this cell is framed on (null = none). */
120
122
  activeRangeId: string | null;
123
+ /** Latched verdict of {@link sessionAvailable} (async metadata, sticky per symbol). */
124
+ private sessionAvailableFlag;
121
125
  private inner;
122
126
  /** The live app theme — seeded from deps, updated on `theme:changed` (the base the
123
127
  * plot-overlay tokens re-derive from). */
@@ -150,6 +154,17 @@ declare class ChartCell {
150
154
  private indicatorValuesOn;
151
155
  private destroyed;
152
156
  constructor(id: string, gridHost: HTMLElement, seed: CellBoot, deps: CellDeps);
157
+ /**
158
+ * Does this cell's market HAVE sessions (RTH/ETH meaningful)? Derived from the
159
+ * symbol's own metadata (`syminfo.session !== '24x7'`), asynchronously — the
160
+ * workspace re-projects the shared bottombar when the verdict lands or changes.
161
+ */
162
+ get sessionAvailable(): boolean;
163
+ /** This cell's shown session (`regular` when unset — the provider default). */
164
+ get session(): MarketSession;
165
+ /** Switch this cell's shown session in place (a reload — RTH and ETH are different bars). */
166
+ setSession(session: MarketSession): void;
167
+ private refreshSessionAvailable;
153
168
  /** Show/hide this cell's symbol watermark (persisted per cell). */
154
169
  setWatermarkVisible(visible: boolean): void;
155
170
  /** Show/hide this cell's indicator titles — the in-chart legend rows (persisted per cell). */
@@ -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-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-FsmvCIo4.js';
3
- export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-FsmvCIo4.js';
1
+ import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, c as VelaTheme, N as NativeBackend, d as MarketSession } from './options-BqGeFHtp.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-CVoFDJ2D.js';
3
+ export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-CVoFDJ2D.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-DuIxJWeH.js';
6
- import { M as MarketDataFeed } from './DataProvider-Cqc_BaJ9.js';
5
+ import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, a as ScriptRun } from './contributions-lPAgo9Cu.js';
6
+ import { M as MarketDataFeed } from './DataProvider-gJjN_0eh.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[];
@@ -35,6 +35,8 @@ interface CellSeed {
35
35
  timeframe?: string;
36
36
  priceStyle?: string;
37
37
  bars?: number;
38
+ /** Trading session to show (markets that have one; `regular` is the default). */
39
+ session?: string;
38
40
  /** Offline bars for this cell — replaces the provider (boot-only). */
39
41
  data?: OHLCV[];
40
42
  /** Initial visible window (boot-only). */
@@ -118,6 +120,8 @@ declare class ChartCell {
118
120
  lastCrossPrice: number | null;
119
121
  /** The bottombar range chip this cell is framed on (null = none). */
120
122
  activeRangeId: string | null;
123
+ /** Latched verdict of {@link sessionAvailable} (async metadata, sticky per symbol). */
124
+ private sessionAvailableFlag;
121
125
  private inner;
122
126
  /** The live app theme — seeded from deps, updated on `theme:changed` (the base the
123
127
  * plot-overlay tokens re-derive from). */
@@ -150,6 +154,17 @@ declare class ChartCell {
150
154
  private indicatorValuesOn;
151
155
  private destroyed;
152
156
  constructor(id: string, gridHost: HTMLElement, seed: CellBoot, deps: CellDeps);
157
+ /**
158
+ * Does this cell's market HAVE sessions (RTH/ETH meaningful)? Derived from the
159
+ * symbol's own metadata (`syminfo.session !== '24x7'`), asynchronously — the
160
+ * workspace re-projects the shared bottombar when the verdict lands or changes.
161
+ */
162
+ get sessionAvailable(): boolean;
163
+ /** This cell's shown session (`regular` when unset — the provider default). */
164
+ get session(): MarketSession;
165
+ /** Switch this cell's shown session in place (a reload — RTH and ETH are different bars). */
166
+ setSession(session: MarketSession): void;
167
+ private refreshSessionAvailable;
153
168
  /** Show/hide this cell's symbol watermark (persisted per cell). */
154
169
  setWatermarkVisible(visible: boolean): void;
155
170
  /** Show/hide this cell's indicator titles — the in-chart legend rows (persisted per cell). */
package/dist/workspace.js CHANGED
@@ -1,6 +1,6 @@
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-JBQUY2RI.js';
2
- export { decodeState, encodeState, sanitizeState } from './chunk-JBQUY2RI.js';
3
- import { parseSymbol, Vela, normalizeTimezone, TypedEventBus, MultiProviderFeed, resolveTheme, createCustomMark, createAttributionMark, DrawingToolbar, defaultToolbar, applyAttributionMarkTheme, sharedBarStore, timeframeToMs, priceStyleIds } from './chunk-D6WM5IUE.js';
1
+ import { WidgetHistory, prefixedSymbol, normalizeSession, 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-6LZJRO2S.js';
2
+ export { decodeState, encodeState, sanitizeState } from './chunk-6LZJRO2S.js';
3
+ import { parseSymbol, Vela, normalizeTimezone, TypedEventBus, MultiProviderFeed, resolveTheme, createCustomMark, createAttributionMark, DrawingToolbar, defaultToolbar, applyAttributionMarkTheme, sharedBarStore, timeframeToMs, priceStyleIds } from './chunk-4MQEG67Z.js';
4
4
  import { resolveEngines, legendActionsProviderFor, rendererDefaults, widgetActions, widgetAttachments } from './chunk-ZNL2X6U2.js';
5
5
  import { KeymapManager, Menu, isEditableTarget } from './chunk-QWIEKZRE.js';
6
6
  import { applyPlotOverlayTokens, ensureUIHost } from './chunk-OGRQW3M6.js';
@@ -39,6 +39,7 @@ function seedDefaults(opts) {
39
39
  timeframe: opts.timeframe,
40
40
  bars: opts.bars,
41
41
  priceStyle: opts.priceStyle,
42
+ session: opts.session,
42
43
  data: opts.data,
43
44
  visibleRange: opts.visibleRange
44
45
  };
@@ -67,6 +68,8 @@ var ChartCell = class {
67
68
  this.lastCrossPrice = null;
68
69
  /** The bottombar range chip this cell is framed on (null = none). */
69
70
  this.activeRangeId = null;
71
+ /** Latched verdict of {@link sessionAvailable} (async metadata, sticky per symbol). */
72
+ this.sessionAvailableFlag = false;
70
73
  this.manifest = [];
71
74
  /** A restored ledger's manifest entry NAMES, waiting for the manifest to resolve
72
75
  * (a pool/persisted cell can be built before the shared manifest has loaded). */
@@ -86,7 +89,7 @@ var ChartCell = class {
86
89
  this.destroyed = false;
87
90
  this.appTheme = deps.theme;
88
91
  const symbol = prefixedSymbol(seed);
89
- this.state = { symbol, provider: parseSymbol(symbol ?? "").provider ?? void 0, timeframe: seed.timeframe, priceStyle: seed.priceStyle, bars: seed.bars };
92
+ this.state = { symbol, provider: parseSymbol(symbol ?? "").provider ?? void 0, timeframe: seed.timeframe, priceStyle: seed.priceStyle, bars: seed.bars, session: normalizeSession(seed.session) };
90
93
  const doc = gridHost.ownerDocument;
91
94
  this.host = doc.createElement("div");
92
95
  this.host.className = "vela-cell";
@@ -103,6 +106,7 @@ var ChartCell = class {
103
106
  timeframe: seed.timeframe,
104
107
  bars: seed.bars,
105
108
  priceStyle: seed.priceStyle,
109
+ session: normalizeSession(seed.session),
106
110
  data: seed.data,
107
111
  visibleRange: seed.visibleRange,
108
112
  theme: deps.theme,
@@ -161,6 +165,10 @@ var ChartCell = class {
161
165
  this.statusline = deps.statusline ? new Statusline(this.host, symbol ?? "") : null;
162
166
  this.statusline?.setMeta(seed.timeframe ?? "60", this.state.provider ?? "");
163
167
  this.statusline?.onChart(this.inner);
168
+ void this.inner.data.ready().then(() => {
169
+ if (this.inner && this.state.symbol) this.statusline?.setMeta(this.state.timeframe ?? "60", this.inner.data.displayPrefix(this.state.symbol) ?? this.state.provider ?? "");
170
+ this.refreshSessionAvailable();
171
+ });
164
172
  this.syncStatuslineColors();
165
173
  this.contextMenu = new ChartContextMenu(this.host, {
166
174
  resetView: () => {
@@ -281,14 +289,48 @@ var ChartCell = class {
281
289
  this.state.symbol = symbol2;
282
290
  this.state.provider = parseSymbol(symbol2).provider ?? void 0;
283
291
  this.state.timeframe = timeframe;
292
+ this.state.session = normalizeSession(this.inner?.market.session);
284
293
  this.watermark?.update(symbol2, timeframe);
285
294
  this.statusline?.setSymbol(symbol2);
286
- this.statusline?.setMeta(timeframe, this.inner?.data.resolve(symbol2)?.provider ?? this.state.provider ?? "");
295
+ this.statusline?.setMeta(timeframe, this.inner?.data.displayPrefix(symbol2) ?? this.state.provider ?? "");
287
296
  if (this.inner) this.statusline?.onChart(this.inner);
288
297
  this.refreshNativeCatalog();
298
+ this.refreshSessionAvailable();
289
299
  this.deps.onMarketChanged(this.id);
290
300
  });
291
301
  }
302
+ /**
303
+ * Does this cell's market HAVE sessions (RTH/ETH meaningful)? Derived from the
304
+ * symbol's own metadata (`syminfo.session !== '24x7'`), asynchronously — the
305
+ * workspace re-projects the shared bottombar when the verdict lands or changes.
306
+ */
307
+ get sessionAvailable() {
308
+ return this.sessionAvailableFlag;
309
+ }
310
+ /** This cell's shown session (`regular` when unset — the provider default). */
311
+ get session() {
312
+ return normalizeSession(this.state.session) ?? "regular";
313
+ }
314
+ /** Switch this cell's shown session in place (a reload — RTH and ETH are different bars). */
315
+ setSession(session) {
316
+ if (session === this.session) return;
317
+ this.state.session = session;
318
+ this.deps.onStateDirty();
319
+ void this.inner?.setMarket({ session });
320
+ }
321
+ refreshSessionAvailable() {
322
+ const chart = this.inner;
323
+ const symbol = this.state.symbol;
324
+ if (!chart || !symbol) return;
325
+ void chart.data.symbolInfo(symbol).then((si) => {
326
+ if (this.inner !== chart) return;
327
+ const available = typeof si?.session === "string" && si.session !== "" && si.session !== "24x7";
328
+ if (available !== this.sessionAvailableFlag) {
329
+ this.sessionAvailableFlag = available;
330
+ this.deps.onMarketChanged(this.id);
331
+ }
332
+ });
333
+ }
292
334
  /** Show/hide this cell's symbol watermark (persisted per cell). */
293
335
  setWatermarkVisible(visible) {
294
336
  this.watermarkOn = visible;
@@ -1146,6 +1188,9 @@ var VelaWorkspace = class {
1146
1188
  this.bottombar?.setActiveRange(preset.id);
1147
1189
  },
1148
1190
  onTimezone: (zone) => this.setTimezone(zone),
1191
+ // RTH/ETH acts on the ACTIVE cell (like the range chips): sessions
1192
+ // are a per-chart market dimension, not a shell preference.
1193
+ onSession: (session) => this.active.setSession(session),
1149
1194
  onSettingsClick: () => this.active.chart.renderer.openSettings()
1150
1195
  }) : null;
1151
1196
  this.mobileBar = opts.bottombar !== false ? new MobileBar(this.root, {
@@ -1478,6 +1523,7 @@ var VelaWorkspace = class {
1478
1523
  this.objectTree.setSymbol(cell.symbol);
1479
1524
  this.dock.onChart(cell.chart);
1480
1525
  this.bottombar?.setActiveRange(cell.activeRangeId);
1526
+ this.bottombar?.setSession({ session: cell.session, enabled: cell.sessionAvailable });
1481
1527
  this.indicatorPicker?.sync();
1482
1528
  this.glider.stop();
1483
1529
  const d = cell.chart.drawings;
@@ -1879,6 +1925,7 @@ var VelaWorkspace = class {
1879
1925
  this.mobileBar?.setSymbol(cell.symbol);
1880
1926
  this.mobileBar?.setTimeframe(cell.timeframe);
1881
1927
  this.objectTree.setSymbol(cell.symbol);
1928
+ this.bottombar?.setSession({ session: cell.session, enabled: cell.sessionAvailable });
1882
1929
  }
1883
1930
  /** Trigger ② — a cell's indicator ledger changed: count + picker only if active. */
1884
1931
  onCellIndicatorsChanged(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxalgo/vela",
3
- "version": "0.5.4",
3
+ "version": "0.6.1",
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",