@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.
- package/dist/{DataProvider-DHX4x6-r.d.ts → DataProvider-BmHkcwvJ.d.ts} +1 -1
- package/dist/{DataProvider-CNmk84SH.d.cts → DataProvider-DrN7ZIou.d.cts} +1 -1
- package/dist/{chunk-TP56QRMK.js → chunk-2R7BANEM.js} +1 -1
- package/dist/{chunk-U5KCQHAC.js → chunk-3QX6QOCX.js} +80 -12
- package/dist/{chunk-7D6YIF34.js → chunk-6FA4TDUF.js} +325 -67
- package/dist/{chunk-7Y7CJ7EN.js → chunk-BEJ57HP4.js} +8 -1
- package/dist/{chunk-QHZ7IXFL.js → chunk-OICPLNU7.js} +59 -9
- package/dist/{contributions-DDpv7hEL.d.cts → contributions-2bEmCF9S.d.cts} +2 -2
- package/dist/{contributions-ciV6Neyd.d.ts → contributions-DatoAzMx.d.ts} +2 -2
- package/dist/{history-CFqZm5re.d.ts → history-BmyjaVir.d.cts} +6 -6
- package/dist/{history-ChoT34nz.d.cts → history-CvOtsjT5.d.ts} +6 -6
- package/dist/index.cjs +394 -78
- package/dist/index.d.cts +36 -9
- package/dist/index.d.ts +36 -9
- package/dist/index.js +4 -4
- package/dist/{options-BqGeFHtp.d.ts → options-YdiaaVjt.d.cts} +20 -1
- package/dist/{options-BqGeFHtp.d.cts → options-YdiaaVjt.d.ts} +20 -1
- package/dist/{plugin-C97gUCVf.d.ts → plugin-BeCMF1VQ.d.ts} +3 -3
- package/dist/{plugin-CSb_sTiN.d.cts → plugin-CkiStRaI.d.cts} +3 -3
- package/dist/plugin.cjs +8 -0
- package/dist/plugin.d.cts +4 -4
- package/dist/plugin.d.ts +4 -4
- package/dist/plugin.js +2 -2
- package/dist/providers/binance.d.cts +2 -2
- package/dist/providers/binance.d.ts +2 -2
- package/dist/providers/coinbase.d.cts +2 -2
- package/dist/providers/coinbase.d.ts +2 -2
- package/dist/providers/hyperliquid.d.cts +2 -2
- package/dist/providers/hyperliquid.d.ts +2 -2
- package/dist/ui.cjs +59 -9
- package/dist/ui.d.cts +10 -2
- package/dist/ui.d.ts +10 -2
- package/dist/ui.js +2 -2
- package/dist/vela.global.js +394 -78
- package/dist/vela.global.min.js +84 -47
- package/dist/widget.cjs +646 -191
- package/dist/widget.d.cts +29 -8
- package/dist/widget.d.ts +29 -8
- package/dist/widget.js +145 -73
- package/dist/workspace.cjs +601 -142
- package/dist/workspace.d.cts +29 -5
- package/dist/workspace.d.ts +29 -5
- package/dist/workspace.js +143 -67
- package/package.json +1 -1
- /package/dist/{chunk-Q3XQHLIH.js → chunk-AOGZBKUE.js} +0 -0
package/dist/workspace.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
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-
|
|
3
|
-
export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-
|
|
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-YdiaaVjt.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-BmyjaVir.cjs';
|
|
3
|
+
export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-BmyjaVir.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-
|
|
6
|
-
import { M as MarketDataFeed } from './DataProvider-
|
|
5
|
+
import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, a as ScriptRun } from './contributions-2bEmCF9S.cjs';
|
|
6
|
+
import { M as MarketDataFeed } from './DataProvider-DrN7ZIou.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[];
|
|
@@ -95,6 +95,8 @@ interface CellDeps {
|
|
|
95
95
|
activate(id: string): void;
|
|
96
96
|
/** The cell's market changed in place (chrome/retention refresh upstream). */
|
|
97
97
|
onMarketChanged(id: string): void;
|
|
98
|
+
/** The cell's price style changed in place (topbar icon/menu refresh upstream). */
|
|
99
|
+
onPriceStyleChanged(id: string): void;
|
|
98
100
|
/** The cell's indicator ledger changed (count/picker refresh upstream). */
|
|
99
101
|
onIndicatorsChanged(id: string): void;
|
|
100
102
|
/** Persistable per-cell state changed outside the market/indicator channels
|
|
@@ -129,6 +131,8 @@ declare class ChartCell {
|
|
|
129
131
|
private readonly statusline;
|
|
130
132
|
/** Keeps this cell's market badge on the symbol's real calendar (see {@link MarketStatusTracker}). */
|
|
131
133
|
private readonly marketStatus;
|
|
134
|
+
/** Keeps the pre/post-market shading on the symbol's real calendar (see {@link SessionShadingTracker}). */
|
|
135
|
+
private readonly sessionShading;
|
|
132
136
|
private readonly watermark;
|
|
133
137
|
private readonly contextMenu;
|
|
134
138
|
private readonly offMarket;
|
|
@@ -167,6 +171,22 @@ declare class ChartCell {
|
|
|
167
171
|
/** Switch this cell's shown session in place (a reload — RTH and ETH are different bars). */
|
|
168
172
|
setSession(session: MarketSession): void;
|
|
169
173
|
private refreshSessionAvailable;
|
|
174
|
+
/** (Re)derive the pre/post-market shading bands for this cell's market. The loaded
|
|
175
|
+
* depth (bars × timeframe) bounds the calendar fetch; the tracker clamps it. */
|
|
176
|
+
private refreshSessionShading;
|
|
177
|
+
/** The session-shade colors live in the renderer CONFIG (persisted with it, edited
|
|
178
|
+
* live by the dialog swatch) — the cell only proxies them into its settings rows. */
|
|
179
|
+
private sessionShadeColor;
|
|
180
|
+
private setSessionShadeColor;
|
|
181
|
+
/**
|
|
182
|
+
* (Re)contribute this cell's settings-dialog sections: status line parts, the
|
|
183
|
+
* per-cell fetch depth, the watermark toggle, and — only while the cell's symbol
|
|
184
|
+
* HAS sessions — the Trading session group (RTH/ETH switch + the pre/post-market
|
|
185
|
+
* shading colors) inside the Symbol tab. Bars/watermark/titles are persistable
|
|
186
|
+
* cell state; a depth-only reload is silent, so mark dirty here. Re-run whenever
|
|
187
|
+
* a gate changes (the dialog reads the sections on open).
|
|
188
|
+
*/
|
|
189
|
+
private pushSettingsSections;
|
|
170
190
|
/** Show/hide this cell's symbol watermark (persisted per cell). */
|
|
171
191
|
setWatermarkVisible(visible: boolean): void;
|
|
172
192
|
/** Show/hide this cell's indicator titles — the in-chart legend rows (persisted per cell). */
|
|
@@ -636,6 +656,10 @@ declare class VelaWorkspace {
|
|
|
636
656
|
private propagateMarket;
|
|
637
657
|
/** Trigger ② — a cell's market changed: retention + sync always; chrome only if active. */
|
|
638
658
|
private onCellMarketChanged;
|
|
659
|
+
/** Trigger ② — a cell's price style changed: the topbar button/menu only if active.
|
|
660
|
+
* Reads the cell back (not the requested style) so the button reflects what the
|
|
661
|
+
* renderer actually applied. */
|
|
662
|
+
private onCellPriceStyleChanged;
|
|
639
663
|
/** Trigger ② — a cell's indicator ledger changed: count + picker only if active. */
|
|
640
664
|
private onCellIndicatorsChanged;
|
|
641
665
|
/** Timeframe changes routed from the topbar menu / quick entry (chip state follows). */
|
package/dist/workspace.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
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-
|
|
3
|
-
export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-
|
|
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-YdiaaVjt.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-CvOtsjT5.js';
|
|
3
|
+
export { f as ChartState, P as PanelsState, g as decodeState, h as encodeState, s as sanitizeState } from './history-CvOtsjT5.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-
|
|
6
|
-
import { M as MarketDataFeed } from './DataProvider-
|
|
5
|
+
import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, a as ScriptRun } from './contributions-DatoAzMx.js';
|
|
6
|
+
import { M as MarketDataFeed } from './DataProvider-BmHkcwvJ.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[];
|
|
@@ -95,6 +95,8 @@ interface CellDeps {
|
|
|
95
95
|
activate(id: string): void;
|
|
96
96
|
/** The cell's market changed in place (chrome/retention refresh upstream). */
|
|
97
97
|
onMarketChanged(id: string): void;
|
|
98
|
+
/** The cell's price style changed in place (topbar icon/menu refresh upstream). */
|
|
99
|
+
onPriceStyleChanged(id: string): void;
|
|
98
100
|
/** The cell's indicator ledger changed (count/picker refresh upstream). */
|
|
99
101
|
onIndicatorsChanged(id: string): void;
|
|
100
102
|
/** Persistable per-cell state changed outside the market/indicator channels
|
|
@@ -129,6 +131,8 @@ declare class ChartCell {
|
|
|
129
131
|
private readonly statusline;
|
|
130
132
|
/** Keeps this cell's market badge on the symbol's real calendar (see {@link MarketStatusTracker}). */
|
|
131
133
|
private readonly marketStatus;
|
|
134
|
+
/** Keeps the pre/post-market shading on the symbol's real calendar (see {@link SessionShadingTracker}). */
|
|
135
|
+
private readonly sessionShading;
|
|
132
136
|
private readonly watermark;
|
|
133
137
|
private readonly contextMenu;
|
|
134
138
|
private readonly offMarket;
|
|
@@ -167,6 +171,22 @@ declare class ChartCell {
|
|
|
167
171
|
/** Switch this cell's shown session in place (a reload — RTH and ETH are different bars). */
|
|
168
172
|
setSession(session: MarketSession): void;
|
|
169
173
|
private refreshSessionAvailable;
|
|
174
|
+
/** (Re)derive the pre/post-market shading bands for this cell's market. The loaded
|
|
175
|
+
* depth (bars × timeframe) bounds the calendar fetch; the tracker clamps it. */
|
|
176
|
+
private refreshSessionShading;
|
|
177
|
+
/** The session-shade colors live in the renderer CONFIG (persisted with it, edited
|
|
178
|
+
* live by the dialog swatch) — the cell only proxies them into its settings rows. */
|
|
179
|
+
private sessionShadeColor;
|
|
180
|
+
private setSessionShadeColor;
|
|
181
|
+
/**
|
|
182
|
+
* (Re)contribute this cell's settings-dialog sections: status line parts, the
|
|
183
|
+
* per-cell fetch depth, the watermark toggle, and — only while the cell's symbol
|
|
184
|
+
* HAS sessions — the Trading session group (RTH/ETH switch + the pre/post-market
|
|
185
|
+
* shading colors) inside the Symbol tab. Bars/watermark/titles are persistable
|
|
186
|
+
* cell state; a depth-only reload is silent, so mark dirty here. Re-run whenever
|
|
187
|
+
* a gate changes (the dialog reads the sections on open).
|
|
188
|
+
*/
|
|
189
|
+
private pushSettingsSections;
|
|
170
190
|
/** Show/hide this cell's symbol watermark (persisted per cell). */
|
|
171
191
|
setWatermarkVisible(visible: boolean): void;
|
|
172
192
|
/** Show/hide this cell's indicator titles — the in-chart legend rows (persisted per cell). */
|
|
@@ -636,6 +656,10 @@ declare class VelaWorkspace {
|
|
|
636
656
|
private propagateMarket;
|
|
637
657
|
/** Trigger ② — a cell's market changed: retention + sync always; chrome only if active. */
|
|
638
658
|
private onCellMarketChanged;
|
|
659
|
+
/** Trigger ② — a cell's price style changed: the topbar button/menu only if active.
|
|
660
|
+
* Reads the cell back (not the requested style) so the button reflects what the
|
|
661
|
+
* renderer actually applied. */
|
|
662
|
+
private onCellPriceStyleChanged;
|
|
639
663
|
/** Trigger ② — a cell's indicator ledger changed: count + picker only if active. */
|
|
640
664
|
private onCellIndicatorsChanged;
|
|
641
665
|
/** Timeframe changes routed from the topbar menu / quick entry (chip state follows). */
|
package/dist/workspace.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WidgetHistory, prefixedSymbol, normalizeSession, Watermark, Statusline, MarketStatusTracker, 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-
|
|
2
|
-
export { decodeState, encodeState, sanitizeState } from './chunk-
|
|
3
|
-
import { parseSymbol, Vela, normalizeTimezone, TypedEventBus, MultiProviderFeed, resolveTheme, createCustomMark, createAttributionMark, DrawingToolbar, defaultToolbar, applyAttributionMarkTheme, sharedBarStore, timeframeToMs, priceStyleIds } from './chunk-
|
|
4
|
-
import { resolveEngines, legendActionsProviderFor, rendererDefaults, widgetActions, widgetAttachments } from './chunk-
|
|
5
|
-
import { KeymapManager, isEditableTarget } from './chunk-
|
|
6
|
-
import { applyPlotOverlayTokens, ensureUIHost, Menu } from './chunk-
|
|
1
|
+
import { WidgetHistory, SessionShadingTracker, prefixedSymbol, normalizeSession, Watermark, Statusline, MarketStatusTracker, ChartContextMenu, timeframeMs, 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-3QX6QOCX.js';
|
|
2
|
+
export { decodeState, encodeState, sanitizeState } from './chunk-3QX6QOCX.js';
|
|
3
|
+
import { parseSymbol, Vela, normalizeTimezone, TypedEventBus, MultiProviderFeed, resolveTheme, createCustomMark, createAttributionMark, DrawingToolbar, defaultToolbar, applyAttributionMarkTheme, sharedBarStore, timeframeToMs, priceStyleIds } from './chunk-6FA4TDUF.js';
|
|
4
|
+
import { resolveEngines, legendActionsProviderFor, rendererDefaults, widgetActions, widgetAttachments } from './chunk-BEJ57HP4.js';
|
|
5
|
+
import { KeymapManager, isEditableTarget } from './chunk-2R7BANEM.js';
|
|
6
|
+
import { applyPlotOverlayTokens, ensureUIHost, Menu } from './chunk-OICPLNU7.js';
|
|
7
7
|
import { registerIcon, svg16, injectStyles } from './chunk-PN5KWFZ4.js';
|
|
8
8
|
|
|
9
9
|
// src/workspace/sync.ts
|
|
@@ -70,6 +70,8 @@ var ChartCell = class {
|
|
|
70
70
|
this.activeRangeId = null;
|
|
71
71
|
/** Latched verdict of {@link sessionAvailable} (async metadata, sticky per symbol). */
|
|
72
72
|
this.sessionAvailableFlag = false;
|
|
73
|
+
/** Keeps the pre/post-market shading on the symbol's real calendar (see {@link SessionShadingTracker}). */
|
|
74
|
+
this.sessionShading = new SessionShadingTracker((zones) => this.inner?.renderer.set("sessionZones", zones));
|
|
73
75
|
this.manifest = [];
|
|
74
76
|
/** A restored ledger's manifest entry NAMES, waiting for the manifest to resolve
|
|
75
77
|
* (a pool/persisted cell can be built before the shared manifest has loaded). */
|
|
@@ -226,67 +228,7 @@ var ChartCell = class {
|
|
|
226
228
|
});
|
|
227
229
|
this.syncPresentNatives();
|
|
228
230
|
this.refreshNativeCatalog();
|
|
229
|
-
|
|
230
|
-
title: "Advanced",
|
|
231
|
-
placement: "end",
|
|
232
|
-
rows: [
|
|
233
|
-
{
|
|
234
|
-
kind: "select",
|
|
235
|
-
label: "Bars to fetch",
|
|
236
|
-
options: ["500", "1000", "2000", "5000", "10000", "20000"],
|
|
237
|
-
get: () => String(this.state.bars ?? 1e3),
|
|
238
|
-
set: (v) => {
|
|
239
|
-
this.state.bars = Number(v);
|
|
240
|
-
this.deps.onStateDirty();
|
|
241
|
-
void this.inner?.setMarket({ bars: Math.max(this.state.bars, this.rangeBars) });
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
]
|
|
245
|
-
};
|
|
246
|
-
const watermarkSection = {
|
|
247
|
-
title: "Watermark",
|
|
248
|
-
placement: "symbol",
|
|
249
|
-
rows: [
|
|
250
|
-
{
|
|
251
|
-
kind: "toggle",
|
|
252
|
-
label: "Symbol watermark",
|
|
253
|
-
get: () => this.watermarkOn,
|
|
254
|
-
set: (v) => this.setWatermarkVisible(v)
|
|
255
|
-
}
|
|
256
|
-
]
|
|
257
|
-
};
|
|
258
|
-
if (this.statusline) {
|
|
259
|
-
const sl = this.statusline;
|
|
260
|
-
this.inner.renderer.setSettingsSections([
|
|
261
|
-
{
|
|
262
|
-
title: "Status line",
|
|
263
|
-
rows: [
|
|
264
|
-
{ kind: "heading", label: "Status line" },
|
|
265
|
-
{ kind: "toggle", label: "Symbol name", get: () => sl.partVisible("name"), set: (v) => sl.setPartVisible("name", v) },
|
|
266
|
-
{ kind: "toggle", label: "Market status", get: () => sl.partVisible("market"), set: (v) => sl.setPartVisible("market", v) },
|
|
267
|
-
{ kind: "toggle", label: "OHLC values", get: () => sl.partVisible("ohlc"), set: (v) => sl.setPartVisible("ohlc", v) },
|
|
268
|
-
{ kind: "toggle", label: "Bar change values", get: () => sl.partVisible("change"), set: (v) => sl.setPartVisible("change", v) },
|
|
269
|
-
{ kind: "heading", label: "Indicators" },
|
|
270
|
-
{
|
|
271
|
-
kind: "toggle",
|
|
272
|
-
label: "Titles",
|
|
273
|
-
get: () => this.indicatorTitlesOn,
|
|
274
|
-
set: (v) => this.setIndicatorTitlesVisible(v)
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
kind: "toggle",
|
|
278
|
-
label: "Values",
|
|
279
|
-
get: () => this.indicatorValuesOn,
|
|
280
|
-
set: (v) => this.setIndicatorValuesVisible(v)
|
|
281
|
-
}
|
|
282
|
-
]
|
|
283
|
-
},
|
|
284
|
-
advanced,
|
|
285
|
-
watermarkSection
|
|
286
|
-
]);
|
|
287
|
-
} else {
|
|
288
|
-
this.inner.renderer.setSettingsSections([advanced, watermarkSection]);
|
|
289
|
-
}
|
|
231
|
+
this.pushSettingsSections();
|
|
290
232
|
this.offMarket = this.inner.on("market:changed", ({ symbol: symbol2, timeframe }) => {
|
|
291
233
|
this.state.symbol = symbol2;
|
|
292
234
|
this.state.provider = parseSymbol(symbol2).provider ?? void 0;
|
|
@@ -331,9 +273,130 @@ var ChartCell = class {
|
|
|
331
273
|
if (available !== this.sessionAvailableFlag) {
|
|
332
274
|
this.sessionAvailableFlag = available;
|
|
333
275
|
this.deps.onMarketChanged(this.id);
|
|
276
|
+
this.pushSettingsSections();
|
|
334
277
|
}
|
|
278
|
+
this.refreshSessionShading();
|
|
335
279
|
});
|
|
336
280
|
}
|
|
281
|
+
/** (Re)derive the pre/post-market shading bands for this cell's market. The loaded
|
|
282
|
+
* depth (bars × timeframe) bounds the calendar fetch; the tracker clamps it. */
|
|
283
|
+
refreshSessionShading() {
|
|
284
|
+
const chart = this.inner;
|
|
285
|
+
const symbol = this.state.symbol;
|
|
286
|
+
if (!chart || !symbol) return;
|
|
287
|
+
const lookbackMs = Math.max(this.state.bars ?? 1e3, this.rangeBars) * timeframeMs(this.state.timeframe ?? "60");
|
|
288
|
+
this.sessionShading.track(chart.data, symbol, { session: this.session, lookbackMs });
|
|
289
|
+
}
|
|
290
|
+
/** The session-shade colors live in the renderer CONFIG (persisted with it, edited
|
|
291
|
+
* live by the dialog swatch) — the cell only proxies them into its settings rows. */
|
|
292
|
+
sessionShadeColor(key) {
|
|
293
|
+
const cfg = this.inner?.renderer.getConfig();
|
|
294
|
+
const v = cfg?.sessions?.[key];
|
|
295
|
+
return typeof v === "string" ? v : "";
|
|
296
|
+
}
|
|
297
|
+
setSessionShadeColor(key, color) {
|
|
298
|
+
this.inner?.renderer.applyConfig({ sessions: { [key]: color } });
|
|
299
|
+
this.deps.onStateDirty();
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* (Re)contribute this cell's settings-dialog sections: status line parts, the
|
|
303
|
+
* per-cell fetch depth, the watermark toggle, and — only while the cell's symbol
|
|
304
|
+
* HAS sessions — the Trading session group (RTH/ETH switch + the pre/post-market
|
|
305
|
+
* shading colors) inside the Symbol tab. Bars/watermark/titles are persistable
|
|
306
|
+
* cell state; a depth-only reload is silent, so mark dirty here. Re-run whenever
|
|
307
|
+
* a gate changes (the dialog reads the sections on open).
|
|
308
|
+
*/
|
|
309
|
+
pushSettingsSections() {
|
|
310
|
+
const chart = this.inner;
|
|
311
|
+
if (!chart) return;
|
|
312
|
+
const rth = "Regular hours (RTH)";
|
|
313
|
+
const eth = "Extended hours (ETH)";
|
|
314
|
+
const sessionSection = {
|
|
315
|
+
title: "Trading session",
|
|
316
|
+
placement: "symbol",
|
|
317
|
+
rows: [
|
|
318
|
+
{
|
|
319
|
+
kind: "select",
|
|
320
|
+
label: "Session",
|
|
321
|
+
options: [rth, eth],
|
|
322
|
+
get: () => this.session === "extended" ? eth : rth,
|
|
323
|
+
set: (v) => this.setSession(v === eth ? "extended" : "regular")
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
kind: "color",
|
|
327
|
+
label: "Pre-market",
|
|
328
|
+
get: () => this.sessionShadeColor("premarketColor"),
|
|
329
|
+
set: (v) => this.setSessionShadeColor("premarketColor", v)
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
kind: "color",
|
|
333
|
+
label: "Post-market",
|
|
334
|
+
get: () => this.sessionShadeColor("postmarketColor"),
|
|
335
|
+
set: (v) => this.setSessionShadeColor("postmarketColor", v)
|
|
336
|
+
}
|
|
337
|
+
]
|
|
338
|
+
};
|
|
339
|
+
const advanced = {
|
|
340
|
+
title: "Advanced",
|
|
341
|
+
placement: "end",
|
|
342
|
+
rows: [
|
|
343
|
+
{
|
|
344
|
+
kind: "select",
|
|
345
|
+
label: "Bars to fetch",
|
|
346
|
+
options: ["500", "1000", "2000", "5000", "10000", "20000"],
|
|
347
|
+
get: () => String(this.state.bars ?? 1e3),
|
|
348
|
+
set: (v) => {
|
|
349
|
+
this.state.bars = Number(v);
|
|
350
|
+
this.deps.onStateDirty();
|
|
351
|
+
void this.inner?.setMarket({ bars: Math.max(this.state.bars, this.rangeBars) });
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
};
|
|
356
|
+
const watermarkSection = {
|
|
357
|
+
title: "Watermark",
|
|
358
|
+
placement: "symbol",
|
|
359
|
+
rows: [
|
|
360
|
+
{
|
|
361
|
+
kind: "toggle",
|
|
362
|
+
label: "Symbol watermark",
|
|
363
|
+
get: () => this.watermarkOn,
|
|
364
|
+
set: (v) => this.setWatermarkVisible(v)
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
};
|
|
368
|
+
const sections = [];
|
|
369
|
+
if (this.statusline) {
|
|
370
|
+
const sl = this.statusline;
|
|
371
|
+
sections.push({
|
|
372
|
+
title: "Status line",
|
|
373
|
+
rows: [
|
|
374
|
+
{ kind: "heading", label: "Status line" },
|
|
375
|
+
{ kind: "toggle", label: "Symbol name", get: () => sl.partVisible("name"), set: (v) => sl.setPartVisible("name", v) },
|
|
376
|
+
{ kind: "toggle", label: "Market status", get: () => sl.partVisible("market"), set: (v) => sl.setPartVisible("market", v) },
|
|
377
|
+
{ kind: "toggle", label: "OHLC values", get: () => sl.partVisible("ohlc"), set: (v) => sl.setPartVisible("ohlc", v) },
|
|
378
|
+
{ kind: "toggle", label: "Bar change values", get: () => sl.partVisible("change"), set: (v) => sl.setPartVisible("change", v) },
|
|
379
|
+
{ kind: "heading", label: "Indicators" },
|
|
380
|
+
{
|
|
381
|
+
kind: "toggle",
|
|
382
|
+
label: "Titles",
|
|
383
|
+
get: () => this.indicatorTitlesOn,
|
|
384
|
+
set: (v) => this.setIndicatorTitlesVisible(v)
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
kind: "toggle",
|
|
388
|
+
label: "Values",
|
|
389
|
+
get: () => this.indicatorValuesOn,
|
|
390
|
+
set: (v) => this.setIndicatorValuesVisible(v)
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
sections.push(advanced);
|
|
396
|
+
if (this.sessionAvailableFlag) sections.push(sessionSection);
|
|
397
|
+
sections.push(watermarkSection);
|
|
398
|
+
chart.renderer.setSettingsSections(sections);
|
|
399
|
+
}
|
|
337
400
|
/** Show/hide this cell's symbol watermark (persisted per cell). */
|
|
338
401
|
setWatermarkVisible(visible) {
|
|
339
402
|
this.watermarkOn = visible;
|
|
@@ -388,6 +451,7 @@ var ChartCell = class {
|
|
|
388
451
|
this.state.priceStyle = style;
|
|
389
452
|
this.inner?.renderer.set("priceStyle", style);
|
|
390
453
|
this.syncStatuslineColors();
|
|
454
|
+
this.deps.onPriceStyleChanged(this.id);
|
|
391
455
|
}
|
|
392
456
|
/** OHLC/change ink in the status line follows the ACTIVE price style's configured
|
|
393
457
|
* colors and direction rule (candle bodies by close-vs-open, baseline by position
|
|
@@ -611,6 +675,7 @@ var ChartCell = class {
|
|
|
611
675
|
this.contextMenu.destroy();
|
|
612
676
|
this.history.destroy();
|
|
613
677
|
this.marketStatus?.stop();
|
|
678
|
+
this.sessionShading.stop();
|
|
614
679
|
this.statusline?.destroy();
|
|
615
680
|
this.watermark?.destroy();
|
|
616
681
|
this.inner?.destroy();
|
|
@@ -1642,6 +1707,7 @@ var VelaWorkspace = class {
|
|
|
1642
1707
|
context: () => this.context(),
|
|
1643
1708
|
activate: (id2) => this.setActiveCell(id2),
|
|
1644
1709
|
onMarketChanged: (id2) => this.onCellMarketChanged(id2),
|
|
1710
|
+
onPriceStyleChanged: (id2) => this.onCellPriceStyleChanged(id2),
|
|
1645
1711
|
onIndicatorsChanged: (id2) => this.onCellIndicatorsChanged(id2),
|
|
1646
1712
|
onStateDirty: () => this.markStateDirty(),
|
|
1647
1713
|
manifestSettled: () => this.manifestSettled
|
|
@@ -1931,6 +1997,16 @@ var VelaWorkspace = class {
|
|
|
1931
1997
|
this.objectTree.setSymbol(cell.symbol);
|
|
1932
1998
|
this.bottombar?.setSession({ session: cell.session, enabled: cell.sessionAvailable });
|
|
1933
1999
|
}
|
|
2000
|
+
/** Trigger ② — a cell's price style changed: the topbar button/menu only if active.
|
|
2001
|
+
* Reads the cell back (not the requested style) so the button reflects what the
|
|
2002
|
+
* renderer actually applied. */
|
|
2003
|
+
onCellPriceStyleChanged(id) {
|
|
2004
|
+
this.markStateDirty();
|
|
2005
|
+
if (id !== this.activeId) return;
|
|
2006
|
+
const cell = this.cellsById.get(id);
|
|
2007
|
+
if (!cell) return;
|
|
2008
|
+
this.topbar.setPriceStyle(cell.priceStyle);
|
|
2009
|
+
}
|
|
1934
2010
|
/** Trigger ② — a cell's indicator ledger changed: count + picker only if active. */
|
|
1935
2011
|
onCellIndicatorsChanged(id) {
|
|
1936
2012
|
this.markStateDirty();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxalgo/vela",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
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",
|
|
File without changes
|