@luxalgo/vela 0.6.2 → 0.6.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 (45) hide show
  1. package/dist/{DataProvider-DHX4x6-r.d.ts → DataProvider-BmHkcwvJ.d.ts} +1 -1
  2. package/dist/{DataProvider-CNmk84SH.d.cts → DataProvider-DrN7ZIou.d.cts} +1 -1
  3. package/dist/{chunk-TP56QRMK.js → chunk-2R7BANEM.js} +1 -1
  4. package/dist/{chunk-U5KCQHAC.js → chunk-3QX6QOCX.js} +80 -12
  5. package/dist/{chunk-7D6YIF34.js → chunk-6FA4TDUF.js} +325 -67
  6. package/dist/{chunk-7Y7CJ7EN.js → chunk-BEJ57HP4.js} +8 -1
  7. package/dist/{chunk-QHZ7IXFL.js → chunk-OICPLNU7.js} +59 -9
  8. package/dist/{contributions-DDpv7hEL.d.cts → contributions-2bEmCF9S.d.cts} +2 -2
  9. package/dist/{contributions-ciV6Neyd.d.ts → contributions-DatoAzMx.d.ts} +2 -2
  10. package/dist/{history-CFqZm5re.d.ts → history-BmyjaVir.d.cts} +6 -6
  11. package/dist/{history-ChoT34nz.d.cts → history-CvOtsjT5.d.ts} +6 -6
  12. package/dist/index.cjs +394 -78
  13. package/dist/index.d.cts +36 -9
  14. package/dist/index.d.ts +36 -9
  15. package/dist/index.js +4 -4
  16. package/dist/{options-BqGeFHtp.d.ts → options-YdiaaVjt.d.cts} +20 -1
  17. package/dist/{options-BqGeFHtp.d.cts → options-YdiaaVjt.d.ts} +20 -1
  18. package/dist/{plugin-C97gUCVf.d.ts → plugin-BeCMF1VQ.d.ts} +3 -3
  19. package/dist/{plugin-CSb_sTiN.d.cts → plugin-CkiStRaI.d.cts} +3 -3
  20. package/dist/plugin.cjs +8 -0
  21. package/dist/plugin.d.cts +4 -4
  22. package/dist/plugin.d.ts +4 -4
  23. package/dist/plugin.js +2 -2
  24. package/dist/providers/binance.d.cts +2 -2
  25. package/dist/providers/binance.d.ts +2 -2
  26. package/dist/providers/coinbase.d.cts +2 -2
  27. package/dist/providers/coinbase.d.ts +2 -2
  28. package/dist/providers/hyperliquid.d.cts +2 -2
  29. package/dist/providers/hyperliquid.d.ts +2 -2
  30. package/dist/ui.cjs +59 -9
  31. package/dist/ui.d.cts +10 -2
  32. package/dist/ui.d.ts +10 -2
  33. package/dist/ui.js +2 -2
  34. package/dist/vela.global.js +394 -78
  35. package/dist/vela.global.min.js +84 -47
  36. package/dist/widget.cjs +646 -191
  37. package/dist/widget.d.cts +29 -8
  38. package/dist/widget.d.ts +29 -8
  39. package/dist/widget.js +145 -73
  40. package/dist/workspace.cjs +601 -142
  41. package/dist/workspace.d.cts +29 -5
  42. package/dist/workspace.d.ts +29 -5
  43. package/dist/workspace.js +143 -67
  44. package/package.json +1 -1
  45. /package/dist/{chunk-Q3XQHLIH.js → chunk-AOGZBKUE.js} +0 -0
package/dist/widget.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import { W as WidgetContext, V as Vela, y as SidePanelButton } from './contributions-DDpv7hEL.cjs';
2
- export { ah as DEFAULT_PANEL_ORDER, z as SidePanelDescriptor, A as SidePanelHandle, U as WidgetActionDescriptor, X as WidgetActionTarget, Y as WidgetAttachment, a4 as registerSidePanel, a5 as registerWidgetAction, a6 as registerWidgetAttachment, a8 as sidePanels, ac as unregisterSidePanel, ad as unregisterWidgetAction, ae as unregisterWidgetAttachment, af as widgetActions, ag as widgetAttachments } from './contributions-DDpv7hEL.cjs';
3
- import { b as VelaOptions, d as MarketSession, r as DataWindowReadout } from './options-BqGeFHtp.cjs';
1
+ import { W as WidgetContext, V as Vela, y as SidePanelButton } from './contributions-2bEmCF9S.cjs';
2
+ export { ah as DEFAULT_PANEL_ORDER, z as SidePanelDescriptor, A as SidePanelHandle, U as WidgetActionDescriptor, X as WidgetActionTarget, Y as WidgetAttachment, a4 as registerSidePanel, a5 as registerWidgetAction, a6 as registerWidgetAttachment, a8 as sidePanels, ac as unregisterSidePanel, ad as unregisterWidgetAction, ae as unregisterWidgetAttachment, af as widgetActions, ag as widgetAttachments } from './contributions-2bEmCF9S.cjs';
3
+ import { b as VelaOptions, d as MarketSession, r as DataWindowReadout } from './options-YdiaaVjt.cjs';
4
4
  import { K as KeymapManager } from './keymap-CGOz5F5f.cjs';
5
- import { W as WidgetHistory, b as VelaShellOptions, e as WorkspaceState, a as RangePreset, i as PersistedState, P as PanelsState } from './history-ChoT34nz.cjs';
6
- export { B as Bottombar, j as BottombarOptions, C as CellState, f as ChartState, I as IndicatorLoader, k as IndicatorManifest, l as IndicatorManifestEntry, m as RANGE_PRESETS, R as ResolvedIndicator, V as VelaStorage, n as WidgetStorage, g as decodeState, h as encodeState, o as legacyWidgetState, p as loadPersisted, q as localStorageAdapter, r as parsePersisted, t as resolveIndicators, s as sanitizeState, u as savePersisted } from './history-ChoT34nz.cjs';
7
- import { a as SymbolDescriptor } from './DataProvider-CNmk84SH.cjs';
5
+ import { W as WidgetHistory, b as VelaShellOptions, e as WorkspaceState, a as RangePreset, i as PersistedState, P as PanelsState } from './history-BmyjaVir.cjs';
6
+ export { B as Bottombar, j as BottombarOptions, C as CellState, f as ChartState, I as IndicatorLoader, k as IndicatorManifest, l as IndicatorManifestEntry, m as RANGE_PRESETS, R as ResolvedIndicator, V as VelaStorage, n as WidgetStorage, g as decodeState, h as encodeState, o as legacyWidgetState, p as loadPersisted, q as localStorageAdapter, r as parsePersisted, t as resolveIndicators, s as sanitizeState, u as savePersisted } from './history-BmyjaVir.cjs';
7
+ import { a as SymbolDescriptor } from './DataProvider-DrN7ZIou.cjs';
8
8
  import { d as SidePanel } from './side-panel-CT9ZwIGz.cjs';
9
9
  export { D as DEFAULT_PANEL_MAX_WIDTH, a as DEFAULT_PANEL_MIN_WIDTH, b as DEFAULT_PANEL_WIDTH, S as SidePanelOptions, c as clampPanelWidth } from './side-panel-CT9ZwIGz.cjs';
10
10
 
@@ -23,6 +23,11 @@ declare class VelaWidget {
23
23
  private readonly statusline;
24
24
  /** Keeps the statusline's market badge on the symbol's real calendar (see {@link MarketStatusTracker}). */
25
25
  private readonly marketStatus;
26
+ /** Keeps the pre/post-market shading on the symbol's real calendar (see {@link SessionShadingTracker}). */
27
+ private readonly sessionShading;
28
+ /** Whether the ACTIVE symbol declares real trading sessions (RTH/ETH meaningful) —
29
+ * gates the bottombar toggle and the settings dialog's Trading session group. */
30
+ private sessionsAvailable;
26
31
  private readonly watermark;
27
32
  private readonly bottombar;
28
33
  private readonly objectTree;
@@ -160,9 +165,25 @@ declare class VelaWidget {
160
165
  * disabled there, but the API tolerates the call — the provider ignores the flag).
161
166
  */
162
167
  setSession(session: MarketSession): void;
163
- /** Re-derive the RTH/ETH toggle's posture from the ACTIVE symbol's metadata: enabled
164
- * iff the resolved symbol declares a real session vocabulary (not `24x7`). */
168
+ /** Re-derive the session chrome from the ACTIVE symbol's metadata: the RTH/ETH
169
+ * toggle shows (and the settings dialog's Trading session group appears) iff the
170
+ * resolved symbol declares a real session vocabulary (not `24x7`); the pre/post
171
+ * shading re-derives for the new market either way. */
165
172
  private refreshSessionToggle;
173
+ /** (Re)derive the pre/post-market shading bands for the current market. The loaded
174
+ * depth (bars × timeframe) bounds the calendar fetch; the tracker clamps it. */
175
+ private refreshSessionShading;
176
+ /** The session-shade colors live in the renderer CONFIG (persisted with it, edited
177
+ * live by the dialog swatch) — the widget only proxies them into its settings rows. */
178
+ private sessionShadeColor;
179
+ private setSessionShadeColor;
180
+ /**
181
+ * (Re)contribute the widget's settings-dialog sections: status line parts, the fetch
182
+ * depth, the watermark toggle, and — only while the active symbol HAS sessions — the
183
+ * Trading session group (RTH/ETH switch + the pre/post-market shading colors) inside
184
+ * the Symbol tab. Re-run whenever a gate changes (the dialog reads them on open).
185
+ */
186
+ private pushSettingsSections;
166
187
  /** Star/unstar a timeframe — the topbar chips and dropdown stars follow, and the
167
188
  * set persists with the rest of the shell state. */
168
189
  private setTimeframeFavorite;
package/dist/widget.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { W as WidgetContext, V as Vela, y as SidePanelButton } from './contributions-ciV6Neyd.js';
2
- export { ah as DEFAULT_PANEL_ORDER, z as SidePanelDescriptor, A as SidePanelHandle, U as WidgetActionDescriptor, X as WidgetActionTarget, Y as WidgetAttachment, a4 as registerSidePanel, a5 as registerWidgetAction, a6 as registerWidgetAttachment, a8 as sidePanels, ac as unregisterSidePanel, ad as unregisterWidgetAction, ae as unregisterWidgetAttachment, af as widgetActions, ag as widgetAttachments } from './contributions-ciV6Neyd.js';
3
- import { b as VelaOptions, d as MarketSession, r as DataWindowReadout } from './options-BqGeFHtp.js';
1
+ import { W as WidgetContext, V as Vela, y as SidePanelButton } from './contributions-DatoAzMx.js';
2
+ export { ah as DEFAULT_PANEL_ORDER, z as SidePanelDescriptor, A as SidePanelHandle, U as WidgetActionDescriptor, X as WidgetActionTarget, Y as WidgetAttachment, a4 as registerSidePanel, a5 as registerWidgetAction, a6 as registerWidgetAttachment, a8 as sidePanels, ac as unregisterSidePanel, ad as unregisterWidgetAction, ae as unregisterWidgetAttachment, af as widgetActions, ag as widgetAttachments } from './contributions-DatoAzMx.js';
3
+ import { b as VelaOptions, d as MarketSession, r as DataWindowReadout } from './options-YdiaaVjt.js';
4
4
  import { K as KeymapManager } from './keymap-CGOz5F5f.js';
5
- import { W as WidgetHistory, b as VelaShellOptions, e as WorkspaceState, a as RangePreset, i as PersistedState, P as PanelsState } from './history-CFqZm5re.js';
6
- export { B as Bottombar, j as BottombarOptions, C as CellState, f as ChartState, I as IndicatorLoader, k as IndicatorManifest, l as IndicatorManifestEntry, m as RANGE_PRESETS, R as ResolvedIndicator, V as VelaStorage, n as WidgetStorage, g as decodeState, h as encodeState, o as legacyWidgetState, p as loadPersisted, q as localStorageAdapter, r as parsePersisted, t as resolveIndicators, s as sanitizeState, u as savePersisted } from './history-CFqZm5re.js';
7
- import { a as SymbolDescriptor } from './DataProvider-DHX4x6-r.js';
5
+ import { W as WidgetHistory, b as VelaShellOptions, e as WorkspaceState, a as RangePreset, i as PersistedState, P as PanelsState } from './history-CvOtsjT5.js';
6
+ export { B as Bottombar, j as BottombarOptions, C as CellState, f as ChartState, I as IndicatorLoader, k as IndicatorManifest, l as IndicatorManifestEntry, m as RANGE_PRESETS, R as ResolvedIndicator, V as VelaStorage, n as WidgetStorage, g as decodeState, h as encodeState, o as legacyWidgetState, p as loadPersisted, q as localStorageAdapter, r as parsePersisted, t as resolveIndicators, s as sanitizeState, u as savePersisted } from './history-CvOtsjT5.js';
7
+ import { a as SymbolDescriptor } from './DataProvider-BmHkcwvJ.js';
8
8
  import { d as SidePanel } from './side-panel-CT9ZwIGz.js';
9
9
  export { D as DEFAULT_PANEL_MAX_WIDTH, a as DEFAULT_PANEL_MIN_WIDTH, b as DEFAULT_PANEL_WIDTH, S as SidePanelOptions, c as clampPanelWidth } from './side-panel-CT9ZwIGz.js';
10
10
 
@@ -23,6 +23,11 @@ declare class VelaWidget {
23
23
  private readonly statusline;
24
24
  /** Keeps the statusline's market badge on the symbol's real calendar (see {@link MarketStatusTracker}). */
25
25
  private readonly marketStatus;
26
+ /** Keeps the pre/post-market shading on the symbol's real calendar (see {@link SessionShadingTracker}). */
27
+ private readonly sessionShading;
28
+ /** Whether the ACTIVE symbol declares real trading sessions (RTH/ETH meaningful) —
29
+ * gates the bottombar toggle and the settings dialog's Trading session group. */
30
+ private sessionsAvailable;
26
31
  private readonly watermark;
27
32
  private readonly bottombar;
28
33
  private readonly objectTree;
@@ -160,9 +165,25 @@ declare class VelaWidget {
160
165
  * disabled there, but the API tolerates the call — the provider ignores the flag).
161
166
  */
162
167
  setSession(session: MarketSession): void;
163
- /** Re-derive the RTH/ETH toggle's posture from the ACTIVE symbol's metadata: enabled
164
- * iff the resolved symbol declares a real session vocabulary (not `24x7`). */
168
+ /** Re-derive the session chrome from the ACTIVE symbol's metadata: the RTH/ETH
169
+ * toggle shows (and the settings dialog's Trading session group appears) iff the
170
+ * resolved symbol declares a real session vocabulary (not `24x7`); the pre/post
171
+ * shading re-derives for the new market either way. */
165
172
  private refreshSessionToggle;
173
+ /** (Re)derive the pre/post-market shading bands for the current market. The loaded
174
+ * depth (bars × timeframe) bounds the calendar fetch; the tracker clamps it. */
175
+ private refreshSessionShading;
176
+ /** The session-shade colors live in the renderer CONFIG (persisted with it, edited
177
+ * live by the dialog swatch) — the widget only proxies them into its settings rows. */
178
+ private sessionShadeColor;
179
+ private setSessionShadeColor;
180
+ /**
181
+ * (Re)contribute the widget's settings-dialog sections: status line parts, the fetch
182
+ * depth, the watermark toggle, and — only while the active symbol HAS sessions — the
183
+ * Trading session group (RTH/ETH switch + the pre/post-market shading colors) inside
184
+ * the Symbol tab. Re-run whenever a gate changes (the dialog reads them on open).
185
+ */
186
+ private pushSettingsSections;
166
187
  /** Star/unstar a timeframe — the topbar chips and dropdown stars follow, and the
167
188
  * set persists with the rest of the shell state. */
168
189
  private setTimeframeFavorite;
package/dist/widget.js CHANGED
@@ -1,11 +1,11 @@
1
- import { Glider, WidgetHistory, localStorageAdapter, decodeState, prefixedSymbol, normalizeSession, SymbolPicker, IndicatorPicker, TimeframeQuick, Topbar, PanelDock, ObjectTree, DataWindow, ChartContextMenu, Toast, Watermark, Statusline, MarketStatusTracker, Bottombar, MobileBar, DrawingPill, LayoutModeController, ZOOM_IN, ZOOM_OUT, PAN_FAST, ShortcutsHelp, TimeframeDrawer, RANGE_PRESETS, DrawingsDrawer, MoreDrawer, priceStyleIcon, priceStyleLabel, TimezoneDrawer, PriceScaleDrawer, indicatorLedger, sanitizeState, legacyWidgetState, parsePersisted, statuslineInkOf, toolShortcutHints, resolveIndicators, encodeState } from './chunk-U5KCQHAC.js';
2
- export { Bottombar, ChartContextMenu, DataWindow, IndicatorPicker, ObjectTree, PanelDock, RANGE_PRESETS, ShortcutsHelp, Statusline, SymbolPicker, TimeframeQuick, Topbar, Watermark, dataWindowSections, decimalsFor, decodeState, encodeState, filterSymbols, fmtChange, fmtPrice, legacyWidgetState, loadPersisted, localStorageAdapter, parsePersisted, parseTimeframe, priceStyleLabel, resolveIndicators, sanitizeState, savePersisted, timeframeLabel, timeframeMs } from './chunk-U5KCQHAC.js';
3
- import { registerBuiltinChartTypes, resolveTheme, parseSymbol, buildToolbar, priceStyleIds, Vela, normalizeTimezone } from './chunk-7D6YIF34.js';
4
- export { TIMEZONES, normalizeTimezone, tzButtonLabel, tzMenuLabel, tzOffset } from './chunk-7D6YIF34.js';
5
- import { widgetActions, widgetAttachments, legendActionsProviderFor, resolveEngines } from './chunk-7Y7CJ7EN.js';
6
- export { DEFAULT_PANEL_MAX_WIDTH, DEFAULT_PANEL_MIN_WIDTH, DEFAULT_PANEL_ORDER, DEFAULT_PANEL_WIDTH, SidePanel, clampPanelWidth, registerSidePanel, registerWidgetAction, registerWidgetAttachment, sidePanels, unregisterSidePanel, unregisterWidgetAction, unregisterWidgetAttachment, widgetActions, widgetAttachments } from './chunk-7Y7CJ7EN.js';
7
- import { KeymapManager, isEditableTarget } from './chunk-TP56QRMK.js';
8
- import { ensureUIHost, Menu, applyPlotOverlayTokens } from './chunk-QHZ7IXFL.js';
1
+ import { SessionShadingTracker, Glider, WidgetHistory, localStorageAdapter, decodeState, prefixedSymbol, normalizeSession, SymbolPicker, IndicatorPicker, TimeframeQuick, Topbar, PanelDock, ObjectTree, DataWindow, ChartContextMenu, Toast, Watermark, Statusline, MarketStatusTracker, Bottombar, MobileBar, DrawingPill, LayoutModeController, ZOOM_IN, ZOOM_OUT, PAN_FAST, ShortcutsHelp, TimeframeDrawer, RANGE_PRESETS, DrawingsDrawer, MoreDrawer, priceStyleIcon, priceStyleLabel, TimezoneDrawer, PriceScaleDrawer, timeframeMs, indicatorLedger, sanitizeState, legacyWidgetState, parsePersisted, statuslineInkOf, toolShortcutHints, resolveIndicators, encodeState } from './chunk-3QX6QOCX.js';
2
+ export { Bottombar, ChartContextMenu, DataWindow, IndicatorPicker, ObjectTree, PanelDock, RANGE_PRESETS, ShortcutsHelp, Statusline, SymbolPicker, TimeframeQuick, Topbar, Watermark, dataWindowSections, decimalsFor, decodeState, encodeState, filterSymbols, fmtChange, fmtPrice, legacyWidgetState, loadPersisted, localStorageAdapter, parsePersisted, parseTimeframe, priceStyleLabel, resolveIndicators, sanitizeState, savePersisted, timeframeLabel, timeframeMs } from './chunk-3QX6QOCX.js';
3
+ import { registerBuiltinChartTypes, resolveTheme, parseSymbol, buildToolbar, priceStyleIds, Vela, normalizeTimezone } from './chunk-6FA4TDUF.js';
4
+ export { TIMEZONES, normalizeTimezone, tzButtonLabel, tzMenuLabel, tzOffset } from './chunk-6FA4TDUF.js';
5
+ import { widgetActions, widgetAttachments, legendActionsProviderFor, resolveEngines } from './chunk-BEJ57HP4.js';
6
+ export { DEFAULT_PANEL_MAX_WIDTH, DEFAULT_PANEL_MIN_WIDTH, DEFAULT_PANEL_ORDER, DEFAULT_PANEL_WIDTH, SidePanel, clampPanelWidth, registerSidePanel, registerWidgetAction, registerWidgetAttachment, sidePanels, unregisterSidePanel, unregisterWidgetAction, unregisterWidgetAttachment, widgetActions, widgetAttachments } from './chunk-BEJ57HP4.js';
7
+ import { KeymapManager, isEditableTarget } from './chunk-2R7BANEM.js';
8
+ import { ensureUIHost, Menu, applyPlotOverlayTokens } from './chunk-OICPLNU7.js';
9
9
  import { injectStyles } from './chunk-PN5KWFZ4.js';
10
10
 
11
11
  // src/widget/url-state.ts
@@ -54,6 +54,11 @@ var WIDGET_CSS = `
54
54
  `;
55
55
  var VelaWidget = class {
56
56
  constructor(container, opts) {
57
+ /** Keeps the pre/post-market shading on the symbol's real calendar (see {@link SessionShadingTracker}). */
58
+ this.sessionShading = new SessionShadingTracker((zones) => this.inner?.renderer.set("sessionZones", zones));
59
+ /** Whether the ACTIVE symbol declares real trading sessions (RTH/ETH meaningful) —
60
+ * gates the bottombar toggle and the settings dialog's Trading session group. */
61
+ this.sessionsAvailable = false;
57
62
  this.shortcutsHelp = null;
58
63
  this.inner = null;
59
64
  /** The manifest library (loaded once). */
@@ -517,17 +522,140 @@ var VelaWidget = class {
517
522
  this.markStateDirty();
518
523
  void this.inner?.setMarket({ session });
519
524
  }
520
- /** Re-derive the RTH/ETH toggle's posture from the ACTIVE symbol's metadata: enabled
521
- * iff the resolved symbol declares a real session vocabulary (not `24x7`). */
525
+ /** Re-derive the session chrome from the ACTIVE symbol's metadata: the RTH/ETH
526
+ * toggle shows (and the settings dialog's Trading session group appears) iff the
527
+ * resolved symbol declares a real session vocabulary (not `24x7`); the pre/post
528
+ * shading re-derives for the new market either way. */
522
529
  refreshSessionToggle() {
523
530
  const chart = this.inner;
524
- if (!chart || !this.bottombar) return;
531
+ if (!chart) return;
525
532
  void chart.data.symbolInfo(this.symbol).then((si) => {
526
533
  if (this.destroyed || this.inner !== chart) return;
527
534
  const enabled = typeof si?.session === "string" && si.session !== "" && si.session !== "24x7";
528
535
  this.bottombar?.setSession({ session: this.session ?? "regular", enabled });
536
+ if (enabled !== this.sessionsAvailable) {
537
+ this.sessionsAvailable = enabled;
538
+ this.pushSettingsSections();
539
+ }
540
+ this.refreshSessionShading();
529
541
  });
530
542
  }
543
+ /** (Re)derive the pre/post-market shading bands for the current market. The loaded
544
+ * depth (bars × timeframe) bounds the calendar fetch; the tracker clamps it. */
545
+ refreshSessionShading() {
546
+ const chart = this.inner;
547
+ if (!chart) return;
548
+ const lookbackMs = Math.max(this.bars, this.rangeBars) * timeframeMs(this.timeframe);
549
+ this.sessionShading.track(chart.data, this.symbol, { session: this.session ?? "regular", lookbackMs });
550
+ }
551
+ /** The session-shade colors live in the renderer CONFIG (persisted with it, edited
552
+ * live by the dialog swatch) — the widget only proxies them into its settings rows. */
553
+ sessionShadeColor(key) {
554
+ const cfg = this.inner?.renderer.getConfig();
555
+ const v = cfg?.sessions?.[key];
556
+ return typeof v === "string" ? v : "";
557
+ }
558
+ setSessionShadeColor(key, color) {
559
+ this.inner?.renderer.applyConfig({ sessions: { [key]: color } });
560
+ this.markStateDirty();
561
+ }
562
+ /**
563
+ * (Re)contribute the widget's settings-dialog sections: status line parts, the fetch
564
+ * depth, the watermark toggle, and — only while the active symbol HAS sessions — the
565
+ * Trading session group (RTH/ETH switch + the pre/post-market shading colors) inside
566
+ * the Symbol tab. Re-run whenever a gate changes (the dialog reads them on open).
567
+ */
568
+ pushSettingsSections() {
569
+ const chart = this.inner;
570
+ if (!chart) return;
571
+ const rth = "Regular hours (RTH)";
572
+ const eth = "Extended hours (ETH)";
573
+ const sessionSection = {
574
+ title: "Trading session",
575
+ placement: "symbol",
576
+ rows: [
577
+ {
578
+ kind: "select",
579
+ label: "Session",
580
+ options: [rth, eth],
581
+ get: () => (this.session ?? "regular") === "extended" ? eth : rth,
582
+ set: (v) => this.setSession(v === eth ? "extended" : "regular")
583
+ },
584
+ {
585
+ kind: "color",
586
+ label: "Pre-market",
587
+ get: () => this.sessionShadeColor("premarketColor"),
588
+ set: (v) => this.setSessionShadeColor("premarketColor", v)
589
+ },
590
+ {
591
+ kind: "color",
592
+ label: "Post-market",
593
+ get: () => this.sessionShadeColor("postmarketColor"),
594
+ set: (v) => this.setSessionShadeColor("postmarketColor", v)
595
+ }
596
+ ]
597
+ };
598
+ const advanced = {
599
+ title: "Advanced",
600
+ placement: "end",
601
+ rows: [
602
+ {
603
+ kind: "select",
604
+ label: "Bars to fetch",
605
+ options: ["500", "1000", "2000", "5000", "10000", "20000"],
606
+ get: () => String(this.bars),
607
+ set: (v) => {
608
+ this.bars = Number(v);
609
+ this.markStateDirty();
610
+ void this.inner?.setMarket({ bars: Math.max(this.bars, this.rangeBars) });
611
+ }
612
+ }
613
+ ]
614
+ };
615
+ const watermarkSection = {
616
+ title: "Watermark",
617
+ placement: "symbol",
618
+ rows: [
619
+ {
620
+ kind: "toggle",
621
+ label: "Symbol watermark",
622
+ get: () => this.watermarkOn,
623
+ set: (v) => this.setWatermarkVisible(v)
624
+ }
625
+ ]
626
+ };
627
+ const sections = [];
628
+ if (this.statusline) {
629
+ const sl = this.statusline;
630
+ sections.push({
631
+ title: "Status line",
632
+ rows: [
633
+ { kind: "heading", label: "Status line" },
634
+ { kind: "toggle", label: "Symbol name", get: () => sl.partVisible("name"), set: (v) => sl.setPartVisible("name", v) },
635
+ { kind: "toggle", label: "Market status", get: () => sl.partVisible("market"), set: (v) => sl.setPartVisible("market", v) },
636
+ { kind: "toggle", label: "OHLC values", get: () => sl.partVisible("ohlc"), set: (v) => sl.setPartVisible("ohlc", v) },
637
+ { kind: "toggle", label: "Bar change values", get: () => sl.partVisible("change"), set: (v) => sl.setPartVisible("change", v) },
638
+ { kind: "heading", label: "Indicators" },
639
+ {
640
+ kind: "toggle",
641
+ label: "Titles",
642
+ get: () => this.indicatorTitlesOn,
643
+ set: (v) => this.setIndicatorTitlesVisible(v)
644
+ },
645
+ {
646
+ kind: "toggle",
647
+ label: "Values",
648
+ get: () => this.indicatorValuesOn,
649
+ set: (v) => this.setIndicatorValuesVisible(v)
650
+ }
651
+ ]
652
+ });
653
+ }
654
+ sections.push(advanced);
655
+ if (this.sessionsAvailable) sections.push(sessionSection);
656
+ sections.push(watermarkSection);
657
+ chart.renderer.setSettingsSections(sections);
658
+ }
531
659
  /** Star/unstar a timeframe — the topbar chips and dropdown stars follow, and the
532
660
  * set persists with the rest of the shell state. */
533
661
  setTimeframeFavorite(tf, on) {
@@ -833,6 +961,7 @@ var VelaWidget = class {
833
961
  this.indicatorPicker?.destroy();
834
962
  this.tfQuick.destroy();
835
963
  this.marketStatus?.stop();
964
+ this.sessionShading.stop();
836
965
  this.statusline?.destroy();
837
966
  this.watermark?.destroy();
838
967
  this.bottombar?.destroy();
@@ -971,7 +1100,10 @@ var VelaWidget = class {
971
1100
  this.refreshSessionToggle();
972
1101
  this.marketStatus?.track(chart.data, symbol);
973
1102
  }
974
- if (timeframe !== this.timeframe) this.syncTimeframeChrome(timeframe);
1103
+ if (timeframe !== this.timeframe) {
1104
+ this.syncTimeframeChrome(timeframe);
1105
+ this.refreshSessionShading();
1106
+ }
975
1107
  });
976
1108
  this.history.onChart(chart);
977
1109
  chart.on("alert", (alert) => {
@@ -1020,67 +1152,7 @@ var VelaWidget = class {
1020
1152
  this.statusline?.onChart(chart);
1021
1153
  this.drawingPill.onChart(chart);
1022
1154
  this.syncStatuslineColors();
1023
- const advanced = {
1024
- title: "Advanced",
1025
- placement: "end",
1026
- rows: [
1027
- {
1028
- kind: "select",
1029
- label: "Bars to fetch",
1030
- options: ["500", "1000", "2000", "5000", "10000", "20000"],
1031
- get: () => String(this.bars),
1032
- set: (v) => {
1033
- this.bars = Number(v);
1034
- this.markStateDirty();
1035
- void this.inner?.setMarket({ bars: Math.max(this.bars, this.rangeBars) });
1036
- }
1037
- }
1038
- ]
1039
- };
1040
- const watermarkSection = {
1041
- title: "Watermark",
1042
- placement: "symbol",
1043
- rows: [
1044
- {
1045
- kind: "toggle",
1046
- label: "Symbol watermark",
1047
- get: () => this.watermarkOn,
1048
- set: (v) => this.setWatermarkVisible(v)
1049
- }
1050
- ]
1051
- };
1052
- if (this.statusline) {
1053
- const sl = this.statusline;
1054
- chart.renderer.setSettingsSections([
1055
- {
1056
- title: "Status line",
1057
- rows: [
1058
- { kind: "heading", label: "Status line" },
1059
- { kind: "toggle", label: "Symbol name", get: () => sl.partVisible("name"), set: (v) => sl.setPartVisible("name", v) },
1060
- { kind: "toggle", label: "Market status", get: () => sl.partVisible("market"), set: (v) => sl.setPartVisible("market", v) },
1061
- { kind: "toggle", label: "OHLC values", get: () => sl.partVisible("ohlc"), set: (v) => sl.setPartVisible("ohlc", v) },
1062
- { kind: "toggle", label: "Bar change values", get: () => sl.partVisible("change"), set: (v) => sl.setPartVisible("change", v) },
1063
- { kind: "heading", label: "Indicators" },
1064
- {
1065
- kind: "toggle",
1066
- label: "Titles",
1067
- get: () => this.indicatorTitlesOn,
1068
- set: (v) => this.setIndicatorTitlesVisible(v)
1069
- },
1070
- {
1071
- kind: "toggle",
1072
- label: "Values",
1073
- get: () => this.indicatorValuesOn,
1074
- set: (v) => this.setIndicatorValuesVisible(v)
1075
- }
1076
- ]
1077
- },
1078
- advanced,
1079
- watermarkSection
1080
- ]);
1081
- } else {
1082
- chart.renderer.setSettingsSections([advanced, watermarkSection]);
1083
- }
1155
+ this.pushSettingsSections();
1084
1156
  void chart.ready().then(() => {
1085
1157
  if (this.buildSeq !== seq || this.destroyed) return;
1086
1158
  if (this.pendingRange) {