@luxalgo/vela 0.8.3 → 0.8.5
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-oH78tYXL.d.ts → DataProvider-BUdlkx9I.d.ts} +1 -1
- package/dist/{DataProvider-wbtJ3-Sa.d.cts → DataProvider-DdqMxKdl.d.cts} +1 -1
- package/dist/{chunk-KWI3YDBW.js → chunk-ALTGHKIM.js} +584 -25
- package/dist/{chunk-TO3GIK7Z.js → chunk-AUOB7A5Y.js} +2 -2
- package/dist/{chunk-2IPXYM4B.js → chunk-BN4DNS3O.js} +114 -11
- package/dist/{chunk-VHGACEHO.js → chunk-I2U4NZD2.js} +7 -1
- package/dist/{chunk-HMHA733L.js → chunk-QYIO37K7.js} +2407 -829
- package/dist/{chunk-G7B7ZCBF.js → chunk-WY5H4S4I.js} +1 -1
- package/dist/{contributions-HGqnNb_P.d.ts → contributions-D8xuYc9U.d.cts} +91 -8
- package/dist/{contributions-BhOBRenr.d.cts → contributions-P9fBBuY1.d.ts} +91 -8
- package/dist/index.cjs +3064 -921
- package/dist/index.d.cts +25 -15
- package/dist/index.d.ts +25 -15
- package/dist/index.js +4 -4
- package/dist/{options-lMUwmRwh.d.cts → options-BI5Tp32b.d.cts} +100 -5
- package/dist/{options-lMUwmRwh.d.ts → options-BI5Tp32b.d.ts} +100 -5
- package/dist/{plugin-Do5J5xuF.d.cts → plugin-B8F1nor8.d.cts} +14 -8
- package/dist/{plugin-Cr2Pj8q8.d.ts → plugin-D5Z-Q6TX.d.ts} +14 -8
- package/dist/plugin.cjs +555 -17
- 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/{statusline-model-CY1wzxHg.d.ts → statusline-model-CTwtDIca.d.cts} +19 -4
- package/dist/{statusline-model-B-2xGlB_.d.cts → statusline-model-D9kWC9X5.d.ts} +19 -4
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +3 -3
- package/dist/vela.global.js +3071 -928
- package/dist/vela.global.min.js +125 -55
- package/dist/widget.cjs +3314 -1068
- package/dist/widget.d.cts +6 -6
- package/dist/widget.d.ts +6 -6
- package/dist/widget.js +7 -7
- package/dist/workspace.cjs +3314 -1068
- package/dist/workspace.d.cts +19 -5
- package/dist/workspace.d.ts +19 -5
- package/dist/workspace.js +6 -6
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { overlayScrollbarCss, isDarkColor, mix, HIGHLIGHT, ACCENT_BRIGHT, ACCENT, withAlpha, injectStyles, announceSurface, holdForExit, iconAt, iconEl, BULLISH, BEARISH, WARNING, NEUTRAL } from './chunk-
|
|
1
|
+
import { overlayScrollbarCss, isDarkColor, mix, HIGHLIGHT, ACCENT_BRIGHT, ACCENT, withAlpha, injectStyles, announceSurface, holdForExit, iconAt, iconEl, BULLISH, BEARISH, WARNING, NEUTRAL } from './chunk-I2U4NZD2.js';
|
|
2
2
|
import { VanillaMachine, normalizeProps, spreadProps } from '@zag-js/vanilla';
|
|
3
3
|
export { normalizeProps, spreadProps } from '@zag-js/vanilla';
|
|
4
4
|
import * as menu from '@zag-js/menu';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as Millis, ao as InputSchema, am as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, a_ as SeriesSpec, ak as Fill, H as Background, aQ as PriceLine, a7 as DrawingLine, a3 as DrawingBox, a6 as DrawingLabel, ab as DrawingPolyline, a8 as DrawingLinefill, ag as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a9 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, bg as PaneInfo, aj as DrawingsOption, ad as DrawingSeriesGateway, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, F as AddIndicatorOptions, aG as MarketSwitch, E as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-
|
|
2
|
-
import { S as SymbolInfo, B as BarRange, M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, b as ProviderCapabilities } from './DataProvider-
|
|
1
|
+
import { x as Millis, ao as InputSchema, am as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, a_ as SeriesSpec, ak as Fill, H as Background, aQ as PriceLine, a7 as DrawingLine, a3 as DrawingBox, a6 as DrawingLabel, ab as DrawingPolyline, a8 as DrawingLinefill, ag as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a9 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, bg as PaneInfo, aj as DrawingsOption, ad as DrawingSeriesGateway, bh as DrawingToolDefaults, bi as DrawingToolTemplate, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, F as AddIndicatorOptions, aG as MarketSwitch, E as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-BI5Tp32b.cjs';
|
|
2
|
+
import { S as SymbolInfo, B as BarRange, M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, b as ProviderCapabilities } from './DataProvider-DdqMxKdl.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A strategy's broker state at ONE bar — the flat summary a host reads while a script
|
|
@@ -502,7 +502,13 @@ interface NativeIndicatorContext {
|
|
|
502
502
|
bars(): readonly OHLCV[];
|
|
503
503
|
/** Market-data access (trades / capabilities) for data-driven natives. */
|
|
504
504
|
readonly data: DataControl;
|
|
505
|
-
/**
|
|
505
|
+
/**
|
|
506
|
+
* Push a fresh render output; the chart mounts it (first call) or patches it (subsequent).
|
|
507
|
+
* Series payloads are index-aligned: one slot per bar of `bars()` AS IT STANDS AT THE
|
|
508
|
+
* CALL, first slot on its first bar. The chart keeps an emitted output on those bars
|
|
509
|
+
* when history later lands in front of them (or the oldest bars are trimmed), until the
|
|
510
|
+
* next emit replaces it.
|
|
511
|
+
*/
|
|
506
512
|
emit(out: NativeIndicatorOutput): void;
|
|
507
513
|
/**
|
|
508
514
|
* Push a BESPOKE render payload to the renderer's native layer for this indicator's type (for a
|
|
@@ -521,7 +527,8 @@ interface NativeIndicatorContext {
|
|
|
521
527
|
interface NativeIndicator {
|
|
522
528
|
/** Begin: compute + emit the first output. */
|
|
523
529
|
start(ctx: NativeIndicatorContext, inputs: Record<string, InputValue>): void;
|
|
524
|
-
/**
|
|
530
|
+
/** The bars changed — a live tick, older history landing, or the candles re-derived
|
|
531
|
+
* by a price style — recompute + emit. */
|
|
525
532
|
onBars(): void;
|
|
526
533
|
/** The viewport changed (scroll/zoom) — for range-aware natives (see `reactsToViewport`). */
|
|
527
534
|
onViewport(range: VisibleRange): void;
|
|
@@ -533,7 +540,10 @@ interface NativeIndicator {
|
|
|
533
540
|
suspend(): void;
|
|
534
541
|
/** Shown again — resume + re-emit. */
|
|
535
542
|
resume(): void;
|
|
536
|
-
/** Removed
|
|
543
|
+
/** Removed, or replaced by a fresh instance (a market switch stops it as the switch
|
|
544
|
+
* begins) — full teardown (clear caches, stop timers). Only ever called after `start`.
|
|
545
|
+
* Pushes made inside `stop()` still land (a layer-backed native clears its channel
|
|
546
|
+
* here); once it returns, the context drops every push and emit. */
|
|
537
547
|
stop(): void;
|
|
538
548
|
}
|
|
539
549
|
/**
|
|
@@ -555,6 +565,17 @@ interface NativeIndicatorDescriptor {
|
|
|
555
565
|
readonly overlay: boolean;
|
|
556
566
|
/** Whether instances react to viewport changes (drives the orchestrator's viewport poke). */
|
|
557
567
|
readonly reactsToViewport?: boolean;
|
|
568
|
+
/**
|
|
569
|
+
* Compute only over the chart's COMPLETE history, the way script indicators do. While
|
|
570
|
+
* the history is still loading (a deep load streaming in, a source healing a cold
|
|
571
|
+
* symbol, a deeper depth being fetched), the instance is not started — its legend row
|
|
572
|
+
* shows a loading state, and `ready` / `indicator:added` wait — or, when it already
|
|
573
|
+
* runs, `onBars()` is held and the previous output stays on its bars. The first
|
|
574
|
+
* compute (or the re-run) comes once the history completes, so values computed over
|
|
575
|
+
* a partial history never paint and never repaint. Absent ⇒ the instance starts on
|
|
576
|
+
* the first bars and `onBars()` fires for every history chunk as it lands.
|
|
577
|
+
*/
|
|
578
|
+
readonly waitsForHistory?: boolean;
|
|
558
579
|
/** Marks the type as beta — surfaced in the catalog so a host "add indicator" UI can badge it. */
|
|
559
580
|
readonly beta?: boolean;
|
|
560
581
|
/**
|
|
@@ -950,6 +971,17 @@ interface VelaEventMap extends Record<string, unknown> {
|
|
|
950
971
|
"drawing:favorites": {
|
|
951
972
|
favorites: string[];
|
|
952
973
|
};
|
|
974
|
+
/** A tool's remembered settings changed — the ones its next drawing starts from (the last
|
|
975
|
+
* drawing of that type the user styled, a bulk restore, or a reset). Read them back with
|
|
976
|
+
* `drawings.toolDefaults()`. */
|
|
977
|
+
"drawing:defaults": {
|
|
978
|
+
type: DrawingTypeKey;
|
|
979
|
+
};
|
|
980
|
+
/** A tool's saved looks changed (saved, deleted, or a bulk restore) — read them back with
|
|
981
|
+
* `drawings.toolTemplates()`. */
|
|
982
|
+
"drawing:templates": {
|
|
983
|
+
type: DrawingTypeKey;
|
|
984
|
+
};
|
|
953
985
|
/** The armed drawing tool changed — toolbar click, one-shot tool finishing (back to
|
|
954
986
|
* the pointer, `null`), or a programmatic `drawings.setTool`. */
|
|
955
987
|
"drawing:tool": {
|
|
@@ -1294,6 +1326,7 @@ interface PaneController {
|
|
|
1294
1326
|
removePaneAndIndicators(paneId: string): void;
|
|
1295
1327
|
collapsePane(paneId: string, collapsed: boolean): void;
|
|
1296
1328
|
maximizePane(paneId: string | null): void;
|
|
1329
|
+
setPaneHeightWeight(paneId: string, weight: number): void;
|
|
1297
1330
|
moveIndicator(id: string, target: MoveTarget): void;
|
|
1298
1331
|
}
|
|
1299
1332
|
/**
|
|
@@ -1316,6 +1349,14 @@ declare class PanesControl {
|
|
|
1316
1349
|
collapse(paneId: string, collapsed?: boolean): this;
|
|
1317
1350
|
/** Maximize one pane to fill the plot, or restore the split (`null`). */
|
|
1318
1351
|
maximize(paneId: string | null): this;
|
|
1352
|
+
/**
|
|
1353
|
+
* Set a pane's height weight: the panes share the plot height in proportion to their
|
|
1354
|
+
* weights, so `setHeightWeight('price', 6)` next to two study panes at 1 gives the price
|
|
1355
|
+
* pane three quarters of the height. The weight sticks until the user drags a separator
|
|
1356
|
+
* or it is set again; a collapsed pane applies it when expanded. `weight` must be a
|
|
1357
|
+
* positive number.
|
|
1358
|
+
*/
|
|
1359
|
+
setHeightWeight(paneId: string, weight: number): this;
|
|
1319
1360
|
/** Move/merge an indicator to a pane — sugar for `handle.moveTo(...)` by id. */
|
|
1320
1361
|
moveIndicator(id: string, target: MoveTarget): this;
|
|
1321
1362
|
private guard;
|
|
@@ -1376,7 +1417,10 @@ declare class DrawingController {
|
|
|
1376
1417
|
private favs;
|
|
1377
1418
|
private selectedIds;
|
|
1378
1419
|
private clipboard;
|
|
1379
|
-
|
|
1420
|
+
/** Per-tool remembered settings — the last drawing of each type the user styled seeds the next. */
|
|
1421
|
+
private readonly defaults;
|
|
1422
|
+
/** Per-tool saved looks ("styles"), in the order they were saved. */
|
|
1423
|
+
private templates;
|
|
1380
1424
|
private readonly subs;
|
|
1381
1425
|
constructor(renderer: IChartRenderer, events: TypedEventBus<VelaEventMap>, option: DrawingsOption | undefined, seriesGateway?: DrawingSeriesGateway);
|
|
1382
1426
|
/** Whether the active renderer supports interactive drawings. */
|
|
@@ -1398,6 +1442,24 @@ declare class DrawingController {
|
|
|
1398
1442
|
/** Replace the whole favorite set (bulk restore) — unknown types are dropped. */
|
|
1399
1443
|
setFavorites(types: readonly DrawingTypeKey[]): void;
|
|
1400
1444
|
private pushFavorites;
|
|
1445
|
+
/** Every tool's remembered settings, by type (plain JSON — persist it as-is). */
|
|
1446
|
+
toolDefaults(): Partial<Record<DrawingTypeKey, DrawingToolDefaults>>;
|
|
1447
|
+
/** Replace every tool's remembered settings (restoring persisted prefs). Unknown types and
|
|
1448
|
+
* malformed entries are dropped; an unchanged set is a no-op and emits nothing. */
|
|
1449
|
+
setToolDefaults(map: Readonly<Record<string, unknown>> | null | undefined): void;
|
|
1450
|
+
/** Forget a tool's remembered settings (every tool's when `type` is omitted) — new drawings
|
|
1451
|
+
* start from the factory defaults again. */
|
|
1452
|
+
resetToolDefaults(type?: DrawingTypeKey): void;
|
|
1453
|
+
/** Every tool's saved looks, by type (plain JSON — persist it as-is). */
|
|
1454
|
+
toolTemplates(): Partial<Record<DrawingTypeKey, DrawingToolTemplate[]>>;
|
|
1455
|
+
/** Replace every tool's saved looks (restoring persisted prefs). Unknown types and
|
|
1456
|
+
* malformed entries are dropped; an unchanged set is a no-op and emits nothing. */
|
|
1457
|
+
setToolTemplates(map: Readonly<Record<string, unknown>> | null | undefined): void;
|
|
1458
|
+
/** Save the given settings as a named look for a tool (a same-named one is replaced). */
|
|
1459
|
+
saveToolTemplate(type: DrawingTypeKey, name: string, settings: DrawingToolDefaults): void;
|
|
1460
|
+
/** Delete a tool's saved look by name. */
|
|
1461
|
+
removeToolTemplate(type: DrawingTypeKey, name: string): void;
|
|
1462
|
+
private pushTemplates;
|
|
1401
1463
|
setToolbar(option: DrawingsOption): void;
|
|
1402
1464
|
/** Display (or clear) another chart's in-progress placement as a ghost — silently
|
|
1403
1465
|
* inert on a renderer without the optional `setExternalGhost` seam. */
|
|
@@ -1462,8 +1524,12 @@ declare class DrawingController {
|
|
|
1462
1524
|
/** Add clones (fresh ids, fresh mount-order z) as one undo step + select them. */
|
|
1463
1525
|
private insertClones;
|
|
1464
1526
|
private resolve;
|
|
1465
|
-
/**
|
|
1466
|
-
|
|
1527
|
+
/** `store.update` that remembers the drawing's settings only when the patch changed them:
|
|
1528
|
+
* moving an older drawing must not hand its look back to the tool. */
|
|
1529
|
+
private updateDrawing;
|
|
1530
|
+
/** Remember a drawing's settings as its tool's defaults (they seed the next one), and
|
|
1531
|
+
* announce a real change so a host can save it. */
|
|
1532
|
+
private captureDefaults;
|
|
1467
1533
|
private sync;
|
|
1468
1534
|
/** Renderer gesture → authoritative store mutation + event. */
|
|
1469
1535
|
private onIntent;
|
|
@@ -1562,6 +1628,21 @@ declare class DrawingsControl {
|
|
|
1562
1628
|
setFavorite(type: DrawingTypeKey, on: boolean): this;
|
|
1563
1629
|
/** Replace the whole favorite set (e.g. restoring persisted prefs). */
|
|
1564
1630
|
setFavorites(types: readonly DrawingTypeKey[]): this;
|
|
1631
|
+
/** Every tool's remembered settings, by type — what the next drawing of each type starts
|
|
1632
|
+
* from (its style, text styling and per-type settings such as fib levels). Plain JSON:
|
|
1633
|
+
* persist it and hand it back to {@link setToolDefaults} on the next load. */
|
|
1634
|
+
toolDefaults(): Partial<Record<DrawingTypeKey, DrawingToolDefaults>>;
|
|
1635
|
+
/** Replace every tool's remembered settings (e.g. restoring persisted prefs). Malformed
|
|
1636
|
+
* entries and unknown types are dropped. Follow changes on `drawing:defaults`. */
|
|
1637
|
+
setToolDefaults(map: Readonly<Record<string, unknown>>): this;
|
|
1638
|
+
/** Forget one tool's remembered settings (every tool's without an argument). */
|
|
1639
|
+
resetToolDefaults(type?: DrawingTypeKey): this;
|
|
1640
|
+
/** Every tool's saved looks ("styles" in the settings panel), by type. Plain JSON —
|
|
1641
|
+
* persist it and hand it back to {@link setToolTemplates}. */
|
|
1642
|
+
toolTemplates(): Partial<Record<DrawingTypeKey, DrawingToolTemplate[]>>;
|
|
1643
|
+
/** Replace every tool's saved looks (e.g. restoring persisted prefs). Follow changes on
|
|
1644
|
+
* `drawing:templates`. */
|
|
1645
|
+
setToolTemplates(map: Readonly<Record<string, unknown>>): this;
|
|
1565
1646
|
/** Aliases mirroring `renderer.getConfig()/applyConfig()` for symmetry. */
|
|
1566
1647
|
getConfig(): DrawingsDocument;
|
|
1567
1648
|
applyConfig(doc: unknown): this;
|
|
@@ -1924,6 +2005,8 @@ interface ContextMenuPointer {
|
|
|
1924
2005
|
time: number | null;
|
|
1925
2006
|
/** The kind of pane the pointer is on; null off the plot. */
|
|
1926
2007
|
paneKind: 'price' | 'study' | null;
|
|
2008
|
+
/** The id of the pane the pointer is on, as `chart.panes.list()` reports it; null off the plot. */
|
|
2009
|
+
paneId: string | null;
|
|
1927
2010
|
}
|
|
1928
2011
|
/** What {@link WidgetContext.addIndicator} takes: a named script, ready to run. */
|
|
1929
2012
|
interface ExternalIndicatorEntry {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as Millis, ao as InputSchema, am as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, a_ as SeriesSpec, ak as Fill, H as Background, aQ as PriceLine, a7 as DrawingLine, a3 as DrawingBox, a6 as DrawingLabel, ab as DrawingPolyline, a8 as DrawingLinefill, ag as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a9 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, bg as PaneInfo, aj as DrawingsOption, ad as DrawingSeriesGateway, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, F as AddIndicatorOptions, aG as MarketSwitch, E as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-
|
|
2
|
-
import { S as SymbolInfo, B as BarRange, M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, b as ProviderCapabilities } from './DataProvider-
|
|
1
|
+
import { x as Millis, ao as InputSchema, am as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, a_ as SeriesSpec, ak as Fill, H as Background, aQ as PriceLine, a7 as DrawingLine, a3 as DrawingBox, a6 as DrawingLabel, ab as DrawingPolyline, a8 as DrawingLinefill, ag as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a9 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, bg as PaneInfo, aj as DrawingsOption, ad as DrawingSeriesGateway, bh as DrawingToolDefaults, bi as DrawingToolTemplate, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, F as AddIndicatorOptions, aG as MarketSwitch, E as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-BI5Tp32b.js';
|
|
2
|
+
import { S as SymbolInfo, B as BarRange, M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, b as ProviderCapabilities } from './DataProvider-BUdlkx9I.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A strategy's broker state at ONE bar — the flat summary a host reads while a script
|
|
@@ -502,7 +502,13 @@ interface NativeIndicatorContext {
|
|
|
502
502
|
bars(): readonly OHLCV[];
|
|
503
503
|
/** Market-data access (trades / capabilities) for data-driven natives. */
|
|
504
504
|
readonly data: DataControl;
|
|
505
|
-
/**
|
|
505
|
+
/**
|
|
506
|
+
* Push a fresh render output; the chart mounts it (first call) or patches it (subsequent).
|
|
507
|
+
* Series payloads are index-aligned: one slot per bar of `bars()` AS IT STANDS AT THE
|
|
508
|
+
* CALL, first slot on its first bar. The chart keeps an emitted output on those bars
|
|
509
|
+
* when history later lands in front of them (or the oldest bars are trimmed), until the
|
|
510
|
+
* next emit replaces it.
|
|
511
|
+
*/
|
|
506
512
|
emit(out: NativeIndicatorOutput): void;
|
|
507
513
|
/**
|
|
508
514
|
* Push a BESPOKE render payload to the renderer's native layer for this indicator's type (for a
|
|
@@ -521,7 +527,8 @@ interface NativeIndicatorContext {
|
|
|
521
527
|
interface NativeIndicator {
|
|
522
528
|
/** Begin: compute + emit the first output. */
|
|
523
529
|
start(ctx: NativeIndicatorContext, inputs: Record<string, InputValue>): void;
|
|
524
|
-
/**
|
|
530
|
+
/** The bars changed — a live tick, older history landing, or the candles re-derived
|
|
531
|
+
* by a price style — recompute + emit. */
|
|
525
532
|
onBars(): void;
|
|
526
533
|
/** The viewport changed (scroll/zoom) — for range-aware natives (see `reactsToViewport`). */
|
|
527
534
|
onViewport(range: VisibleRange): void;
|
|
@@ -533,7 +540,10 @@ interface NativeIndicator {
|
|
|
533
540
|
suspend(): void;
|
|
534
541
|
/** Shown again — resume + re-emit. */
|
|
535
542
|
resume(): void;
|
|
536
|
-
/** Removed
|
|
543
|
+
/** Removed, or replaced by a fresh instance (a market switch stops it as the switch
|
|
544
|
+
* begins) — full teardown (clear caches, stop timers). Only ever called after `start`.
|
|
545
|
+
* Pushes made inside `stop()` still land (a layer-backed native clears its channel
|
|
546
|
+
* here); once it returns, the context drops every push and emit. */
|
|
537
547
|
stop(): void;
|
|
538
548
|
}
|
|
539
549
|
/**
|
|
@@ -555,6 +565,17 @@ interface NativeIndicatorDescriptor {
|
|
|
555
565
|
readonly overlay: boolean;
|
|
556
566
|
/** Whether instances react to viewport changes (drives the orchestrator's viewport poke). */
|
|
557
567
|
readonly reactsToViewport?: boolean;
|
|
568
|
+
/**
|
|
569
|
+
* Compute only over the chart's COMPLETE history, the way script indicators do. While
|
|
570
|
+
* the history is still loading (a deep load streaming in, a source healing a cold
|
|
571
|
+
* symbol, a deeper depth being fetched), the instance is not started — its legend row
|
|
572
|
+
* shows a loading state, and `ready` / `indicator:added` wait — or, when it already
|
|
573
|
+
* runs, `onBars()` is held and the previous output stays on its bars. The first
|
|
574
|
+
* compute (or the re-run) comes once the history completes, so values computed over
|
|
575
|
+
* a partial history never paint and never repaint. Absent ⇒ the instance starts on
|
|
576
|
+
* the first bars and `onBars()` fires for every history chunk as it lands.
|
|
577
|
+
*/
|
|
578
|
+
readonly waitsForHistory?: boolean;
|
|
558
579
|
/** Marks the type as beta — surfaced in the catalog so a host "add indicator" UI can badge it. */
|
|
559
580
|
readonly beta?: boolean;
|
|
560
581
|
/**
|
|
@@ -950,6 +971,17 @@ interface VelaEventMap extends Record<string, unknown> {
|
|
|
950
971
|
"drawing:favorites": {
|
|
951
972
|
favorites: string[];
|
|
952
973
|
};
|
|
974
|
+
/** A tool's remembered settings changed — the ones its next drawing starts from (the last
|
|
975
|
+
* drawing of that type the user styled, a bulk restore, or a reset). Read them back with
|
|
976
|
+
* `drawings.toolDefaults()`. */
|
|
977
|
+
"drawing:defaults": {
|
|
978
|
+
type: DrawingTypeKey;
|
|
979
|
+
};
|
|
980
|
+
/** A tool's saved looks changed (saved, deleted, or a bulk restore) — read them back with
|
|
981
|
+
* `drawings.toolTemplates()`. */
|
|
982
|
+
"drawing:templates": {
|
|
983
|
+
type: DrawingTypeKey;
|
|
984
|
+
};
|
|
953
985
|
/** The armed drawing tool changed — toolbar click, one-shot tool finishing (back to
|
|
954
986
|
* the pointer, `null`), or a programmatic `drawings.setTool`. */
|
|
955
987
|
"drawing:tool": {
|
|
@@ -1294,6 +1326,7 @@ interface PaneController {
|
|
|
1294
1326
|
removePaneAndIndicators(paneId: string): void;
|
|
1295
1327
|
collapsePane(paneId: string, collapsed: boolean): void;
|
|
1296
1328
|
maximizePane(paneId: string | null): void;
|
|
1329
|
+
setPaneHeightWeight(paneId: string, weight: number): void;
|
|
1297
1330
|
moveIndicator(id: string, target: MoveTarget): void;
|
|
1298
1331
|
}
|
|
1299
1332
|
/**
|
|
@@ -1316,6 +1349,14 @@ declare class PanesControl {
|
|
|
1316
1349
|
collapse(paneId: string, collapsed?: boolean): this;
|
|
1317
1350
|
/** Maximize one pane to fill the plot, or restore the split (`null`). */
|
|
1318
1351
|
maximize(paneId: string | null): this;
|
|
1352
|
+
/**
|
|
1353
|
+
* Set a pane's height weight: the panes share the plot height in proportion to their
|
|
1354
|
+
* weights, so `setHeightWeight('price', 6)` next to two study panes at 1 gives the price
|
|
1355
|
+
* pane three quarters of the height. The weight sticks until the user drags a separator
|
|
1356
|
+
* or it is set again; a collapsed pane applies it when expanded. `weight` must be a
|
|
1357
|
+
* positive number.
|
|
1358
|
+
*/
|
|
1359
|
+
setHeightWeight(paneId: string, weight: number): this;
|
|
1319
1360
|
/** Move/merge an indicator to a pane — sugar for `handle.moveTo(...)` by id. */
|
|
1320
1361
|
moveIndicator(id: string, target: MoveTarget): this;
|
|
1321
1362
|
private guard;
|
|
@@ -1376,7 +1417,10 @@ declare class DrawingController {
|
|
|
1376
1417
|
private favs;
|
|
1377
1418
|
private selectedIds;
|
|
1378
1419
|
private clipboard;
|
|
1379
|
-
|
|
1420
|
+
/** Per-tool remembered settings — the last drawing of each type the user styled seeds the next. */
|
|
1421
|
+
private readonly defaults;
|
|
1422
|
+
/** Per-tool saved looks ("styles"), in the order they were saved. */
|
|
1423
|
+
private templates;
|
|
1380
1424
|
private readonly subs;
|
|
1381
1425
|
constructor(renderer: IChartRenderer, events: TypedEventBus<VelaEventMap>, option: DrawingsOption | undefined, seriesGateway?: DrawingSeriesGateway);
|
|
1382
1426
|
/** Whether the active renderer supports interactive drawings. */
|
|
@@ -1398,6 +1442,24 @@ declare class DrawingController {
|
|
|
1398
1442
|
/** Replace the whole favorite set (bulk restore) — unknown types are dropped. */
|
|
1399
1443
|
setFavorites(types: readonly DrawingTypeKey[]): void;
|
|
1400
1444
|
private pushFavorites;
|
|
1445
|
+
/** Every tool's remembered settings, by type (plain JSON — persist it as-is). */
|
|
1446
|
+
toolDefaults(): Partial<Record<DrawingTypeKey, DrawingToolDefaults>>;
|
|
1447
|
+
/** Replace every tool's remembered settings (restoring persisted prefs). Unknown types and
|
|
1448
|
+
* malformed entries are dropped; an unchanged set is a no-op and emits nothing. */
|
|
1449
|
+
setToolDefaults(map: Readonly<Record<string, unknown>> | null | undefined): void;
|
|
1450
|
+
/** Forget a tool's remembered settings (every tool's when `type` is omitted) — new drawings
|
|
1451
|
+
* start from the factory defaults again. */
|
|
1452
|
+
resetToolDefaults(type?: DrawingTypeKey): void;
|
|
1453
|
+
/** Every tool's saved looks, by type (plain JSON — persist it as-is). */
|
|
1454
|
+
toolTemplates(): Partial<Record<DrawingTypeKey, DrawingToolTemplate[]>>;
|
|
1455
|
+
/** Replace every tool's saved looks (restoring persisted prefs). Unknown types and
|
|
1456
|
+
* malformed entries are dropped; an unchanged set is a no-op and emits nothing. */
|
|
1457
|
+
setToolTemplates(map: Readonly<Record<string, unknown>> | null | undefined): void;
|
|
1458
|
+
/** Save the given settings as a named look for a tool (a same-named one is replaced). */
|
|
1459
|
+
saveToolTemplate(type: DrawingTypeKey, name: string, settings: DrawingToolDefaults): void;
|
|
1460
|
+
/** Delete a tool's saved look by name. */
|
|
1461
|
+
removeToolTemplate(type: DrawingTypeKey, name: string): void;
|
|
1462
|
+
private pushTemplates;
|
|
1401
1463
|
setToolbar(option: DrawingsOption): void;
|
|
1402
1464
|
/** Display (or clear) another chart's in-progress placement as a ghost — silently
|
|
1403
1465
|
* inert on a renderer without the optional `setExternalGhost` seam. */
|
|
@@ -1462,8 +1524,12 @@ declare class DrawingController {
|
|
|
1462
1524
|
/** Add clones (fresh ids, fresh mount-order z) as one undo step + select them. */
|
|
1463
1525
|
private insertClones;
|
|
1464
1526
|
private resolve;
|
|
1465
|
-
/**
|
|
1466
|
-
|
|
1527
|
+
/** `store.update` that remembers the drawing's settings only when the patch changed them:
|
|
1528
|
+
* moving an older drawing must not hand its look back to the tool. */
|
|
1529
|
+
private updateDrawing;
|
|
1530
|
+
/** Remember a drawing's settings as its tool's defaults (they seed the next one), and
|
|
1531
|
+
* announce a real change so a host can save it. */
|
|
1532
|
+
private captureDefaults;
|
|
1467
1533
|
private sync;
|
|
1468
1534
|
/** Renderer gesture → authoritative store mutation + event. */
|
|
1469
1535
|
private onIntent;
|
|
@@ -1562,6 +1628,21 @@ declare class DrawingsControl {
|
|
|
1562
1628
|
setFavorite(type: DrawingTypeKey, on: boolean): this;
|
|
1563
1629
|
/** Replace the whole favorite set (e.g. restoring persisted prefs). */
|
|
1564
1630
|
setFavorites(types: readonly DrawingTypeKey[]): this;
|
|
1631
|
+
/** Every tool's remembered settings, by type — what the next drawing of each type starts
|
|
1632
|
+
* from (its style, text styling and per-type settings such as fib levels). Plain JSON:
|
|
1633
|
+
* persist it and hand it back to {@link setToolDefaults} on the next load. */
|
|
1634
|
+
toolDefaults(): Partial<Record<DrawingTypeKey, DrawingToolDefaults>>;
|
|
1635
|
+
/** Replace every tool's remembered settings (e.g. restoring persisted prefs). Malformed
|
|
1636
|
+
* entries and unknown types are dropped. Follow changes on `drawing:defaults`. */
|
|
1637
|
+
setToolDefaults(map: Readonly<Record<string, unknown>>): this;
|
|
1638
|
+
/** Forget one tool's remembered settings (every tool's without an argument). */
|
|
1639
|
+
resetToolDefaults(type?: DrawingTypeKey): this;
|
|
1640
|
+
/** Every tool's saved looks ("styles" in the settings panel), by type. Plain JSON —
|
|
1641
|
+
* persist it and hand it back to {@link setToolTemplates}. */
|
|
1642
|
+
toolTemplates(): Partial<Record<DrawingTypeKey, DrawingToolTemplate[]>>;
|
|
1643
|
+
/** Replace every tool's saved looks (e.g. restoring persisted prefs). Follow changes on
|
|
1644
|
+
* `drawing:templates`. */
|
|
1645
|
+
setToolTemplates(map: Readonly<Record<string, unknown>>): this;
|
|
1565
1646
|
/** Aliases mirroring `renderer.getConfig()/applyConfig()` for symmetry. */
|
|
1566
1647
|
getConfig(): DrawingsDocument;
|
|
1567
1648
|
applyConfig(doc: unknown): this;
|
|
@@ -1924,6 +2005,8 @@ interface ContextMenuPointer {
|
|
|
1924
2005
|
time: number | null;
|
|
1925
2006
|
/** The kind of pane the pointer is on; null off the plot. */
|
|
1926
2007
|
paneKind: 'price' | 'study' | null;
|
|
2008
|
+
/** The id of the pane the pointer is on, as `chart.panes.list()` reports it; null off the plot. */
|
|
2009
|
+
paneId: string | null;
|
|
1927
2010
|
}
|
|
1928
2011
|
/** What {@link WidgetContext.addIndicator} takes: a named script, ready to run. */
|
|
1929
2012
|
interface ExternalIndicatorEntry {
|