acttrader-charts 1.0.21 → 1.1.0-beta.6
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/README.md +223 -5
- package/dist/{MACD-DGFPNwy9.d.cts → MACD-7Y0rnDBQ.d.cts} +363 -6
- package/dist/{MACD-DGFPNwy9.d.ts → MACD-7Y0rnDBQ.d.ts} +363 -6
- package/dist/index.cjs +6892 -1463
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +680 -77
- package/dist/index.d.ts +680 -77
- package/dist/index.js +6876 -1462
- package/dist/index.js.map +1 -1
- package/dist/indicators/index.d.cts +2 -2
- package/dist/indicators/index.d.ts +2 -2
- package/dist/webview/chart.html +93 -67
- package/package.json +6 -3
|
@@ -1,3 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Definition of a multi-chart layout preset (grid template).
|
|
3
|
+
* Used by the chart-owned LayoutPopover and emitted via the `layoutChange` event.
|
|
4
|
+
* The host project is responsible for actually mounting N panes per `count`.
|
|
5
|
+
*/
|
|
6
|
+
interface LayoutPreset {
|
|
7
|
+
id: string;
|
|
8
|
+
count: number;
|
|
9
|
+
cols: string;
|
|
10
|
+
rows: string;
|
|
11
|
+
areas?: string;
|
|
12
|
+
areaOrder?: string[];
|
|
13
|
+
icon: string;
|
|
14
|
+
}
|
|
15
|
+
/** Cross-pane sync toggles emitted alongside layoutChange. */
|
|
16
|
+
interface LayoutSyncState {
|
|
17
|
+
symbol: boolean;
|
|
18
|
+
interval: boolean;
|
|
19
|
+
crosshair: boolean;
|
|
20
|
+
time: boolean;
|
|
21
|
+
dateRange: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare const LAYOUT_PRESETS: LayoutPreset[];
|
|
24
|
+
declare const PRESETS_BY_COUNT: Record<number, LayoutPreset[]>;
|
|
25
|
+
declare const PRESET_COUNTS: number[];
|
|
26
|
+
/**
|
|
27
|
+
* Register a preset that appears alongside the built-ins in `getAllPresets()`
|
|
28
|
+
* and the chart-owned `LayoutPopover`. Re-registering the same id overwrites.
|
|
29
|
+
* Throws when the id collides with a built-in preset.
|
|
30
|
+
*/
|
|
31
|
+
declare function registerCustomPreset(preset: LayoutPreset): void;
|
|
32
|
+
/** Remove a previously registered custom preset. No-op for unknown ids. */
|
|
33
|
+
declare function unregisterCustomPreset(id: string): void;
|
|
34
|
+
/** All registered custom presets, in insertion order. */
|
|
35
|
+
declare function getCustomPresets(): LayoutPreset[];
|
|
36
|
+
/** Built-ins followed by registered custom presets. */
|
|
37
|
+
declare function getAllPresets(): LayoutPreset[];
|
|
38
|
+
/**
|
|
39
|
+
* Resolve a preset by id, checking custom presets first, then built-ins. Falls
|
|
40
|
+
* back to the single-pane preset when nothing matches.
|
|
41
|
+
*/
|
|
42
|
+
declare function getPreset(id: string): LayoutPreset;
|
|
43
|
+
/** Human-readable label for each preset, useful in status bars / tooltips. */
|
|
44
|
+
declare const PRESET_LABEL: Record<string, string>;
|
|
45
|
+
/** Default sync state — matches the host's current defaults in useChartLayout.ts. */
|
|
46
|
+
declare const DEFAULT_LAYOUT_SYNC: LayoutSyncState;
|
|
47
|
+
|
|
1
48
|
declare class ScaleManager {
|
|
2
49
|
private static readonly VERTICAL_PADDING_PX;
|
|
3
50
|
xToPixel(index: number, viewport: Viewport, chartWidth: number): number;
|
|
@@ -37,6 +84,11 @@ interface DrawingToolbarUiConfig {
|
|
|
37
84
|
btnGap: number;
|
|
38
85
|
/** Container width (px) below which LeftBar switches to mobile layout */
|
|
39
86
|
mobileBreakpoint: number;
|
|
87
|
+
/**
|
|
88
|
+
* Use Lucide-style modern SVG icons for the drawing toolbar categories.
|
|
89
|
+
* Default: `false` (original icons, unchanged for all existing consumers).
|
|
90
|
+
*/
|
|
91
|
+
modernIcons?: boolean;
|
|
40
92
|
}
|
|
41
93
|
interface TopBarUiConfig {
|
|
42
94
|
/** Height of the top bar strip */
|
|
@@ -354,6 +406,11 @@ interface ChartThemeUi {
|
|
|
354
406
|
reconnecting: string;
|
|
355
407
|
disconnected: string;
|
|
356
408
|
};
|
|
409
|
+
/**
|
|
410
|
+
* Background color of the scroll-to-latest (➕) button.
|
|
411
|
+
* When omitted the button uses the chart background + axisBorder border (neutral style).
|
|
412
|
+
*/
|
|
413
|
+
scrollToEndBtnBg?: string;
|
|
357
414
|
}
|
|
358
415
|
/** Colors specific to the drawing toolbar (LeftBar). */
|
|
359
416
|
interface DrawingToolbarColors {
|
|
@@ -426,6 +483,12 @@ interface TradeLevelColors {
|
|
|
426
483
|
/** Color of the drag grip icon when hovered. */
|
|
427
484
|
dragHandleHover: string;
|
|
428
485
|
}
|
|
486
|
+
/**
|
|
487
|
+
* Default per-drawing-type style fallbacks. Each drawing type has an entry that
|
|
488
|
+
* provides default stroke/fill/text values; per-instance `IDrawing.style`
|
|
489
|
+
* overrides these. Used by `resolveStyle()` in `src/drawings/styleUtils.ts`.
|
|
490
|
+
*/
|
|
491
|
+
type DrawingThemeMap = Record<DrawingToolType, AnyDrawingStyle>;
|
|
429
492
|
/** Colors for the Trade Panel side drawer. */
|
|
430
493
|
interface TradePanelColors {
|
|
431
494
|
background: string;
|
|
@@ -476,6 +539,8 @@ interface ChartTheme {
|
|
|
476
539
|
tradeLevels: TradeLevelColors;
|
|
477
540
|
/** Trade Panel side drawer colors */
|
|
478
541
|
tradePanel: TradePanelColors;
|
|
542
|
+
/** Per-drawing-type default style fallbacks (keyed by DrawingToolType). */
|
|
543
|
+
drawing: DrawingThemeMap;
|
|
479
544
|
}
|
|
480
545
|
/** A deep-partial version of ChartTheme for use in `themeOverrides`. */
|
|
481
546
|
type DeepPartialChartTheme = DeepPartial<ChartTheme>;
|
|
@@ -538,6 +603,13 @@ interface DataLoaderParams {
|
|
|
538
603
|
end: Date;
|
|
539
604
|
interval: string;
|
|
540
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* Params passed to `compareDataLoader`. Mirrors `DataLoaderParams` but also
|
|
608
|
+
* carries the compare symbol so a single loader can serve multiple compares.
|
|
609
|
+
*/
|
|
610
|
+
interface CompareDataLoaderParams extends DataLoaderParams {
|
|
611
|
+
symbol: string;
|
|
612
|
+
}
|
|
541
613
|
/**
|
|
542
614
|
* Per-theme deep-partial color overrides applied on top of the built-in
|
|
543
615
|
* dark / light themes. Only the keys you supply are replaced.
|
|
@@ -871,6 +943,31 @@ interface ChartConfig {
|
|
|
871
943
|
* Default: `false`.
|
|
872
944
|
*/
|
|
873
945
|
hideLevelConfirmCancel?: boolean;
|
|
946
|
+
/**
|
|
947
|
+
* When `true`, clicking or tapping anywhere outside a selected/active trade
|
|
948
|
+
* level dismisses it (reverting any pending edits, mirroring ✗ Cancel).
|
|
949
|
+
* When `false` (default), the active level is preserved across outside
|
|
950
|
+
* clicks — only explicit ✓ / ✗ buttons, tapping the level itself, or
|
|
951
|
+
* `setLevels()` removing it will dismiss it. Recommended `false` so
|
|
952
|
+
* incidental clicks (e.g. price-axis resize, tapping outside the QTY input)
|
|
953
|
+
* don't drop the user's in-progress edit.
|
|
954
|
+
* Default: `false`.
|
|
955
|
+
*/
|
|
956
|
+
deselectActiveOnOutsideClick?: boolean;
|
|
957
|
+
/**
|
|
958
|
+
* Always render SL/TP bracket lines + price pills, even when the parent
|
|
959
|
+
* trade level is not hovered or selected. Close (×) buttons remain
|
|
960
|
+
* hover-only to keep the chart uncluttered.
|
|
961
|
+
* Default: `true`. Set `false` to only show them on hover/selection.
|
|
962
|
+
*/
|
|
963
|
+
showTradeLevelsAlways?: boolean;
|
|
964
|
+
/**
|
|
965
|
+
* Show the candle countdown timer on the right price axis, just below
|
|
966
|
+
* the live price tag. Subject to the same `candleCountdownTimeframes`
|
|
967
|
+
* filter as the time-axis countdown.
|
|
968
|
+
* Default: `false`.
|
|
969
|
+
*/
|
|
970
|
+
showPriceAxisCountdown?: boolean;
|
|
874
971
|
/**
|
|
875
972
|
* Multiplier applied to the Confirm (✓), Cancel (✗), Edit (✎), and Close (×)
|
|
876
973
|
* buttons on trade-level overlays (both main-level and SL/TP bracket boxes).
|
|
@@ -885,16 +982,163 @@ interface ChartConfig {
|
|
|
885
982
|
*/
|
|
886
983
|
enableThemeToggle?: boolean;
|
|
887
984
|
/**
|
|
888
|
-
* Hide the symbol name
|
|
889
|
-
*
|
|
890
|
-
*
|
|
985
|
+
* Hide the symbol name and tick-activity (streaming) dot shown in the
|
|
986
|
+
* top-left corner of the chart canvas. The OHLC(V) data strip is **not**
|
|
987
|
+
* affected by this flag — use `hideOHLCV` to hide it independently.
|
|
988
|
+
* Default: `false` (symbol + dot are visible).
|
|
891
989
|
*/
|
|
892
990
|
hideSymbolAndTick?: boolean;
|
|
991
|
+
/**
|
|
992
|
+
* Hide the OHLC(V) data strip rendered in the top-left overlay
|
|
993
|
+
* (the `O: H: L: C: V:` line(s)). Independent of `hideSymbolAndTick`.
|
|
994
|
+
* Default: `false` (strip is visible).
|
|
995
|
+
*/
|
|
996
|
+
hideOHLCV?: boolean;
|
|
893
997
|
/**
|
|
894
998
|
* Show the bottom duration-selector bar.
|
|
895
999
|
* Default: `false` (bar is hidden).
|
|
896
1000
|
*/
|
|
897
1001
|
showBottomBar?: boolean;
|
|
1002
|
+
/**
|
|
1003
|
+
* Text-decoration for the clickable symbol name in the top-left OHLCV strip.
|
|
1004
|
+
* Default: `'underline'` (existing behaviour).
|
|
1005
|
+
* - `'underline'` → persistent underline whenever the symbol is clickable
|
|
1006
|
+
* - `'none'` → never underline; click handler still attached
|
|
1007
|
+
* - `'hover'` → no resting underline, but `:hover` / `:focus-visible` reveal one
|
|
1008
|
+
* (preferred for branded designs that still want a link affordance)
|
|
1009
|
+
*/
|
|
1010
|
+
symbolNameDecoration?: 'underline' | 'none' | 'hover';
|
|
1011
|
+
/** Called when the user clicks "Add alert" in the trade popover. Omit to hide the alert row. */
|
|
1012
|
+
onAddAlert?: (price: number) => void;
|
|
1013
|
+
/**
|
|
1014
|
+
* Header layout variant. Default `'simple'`.
|
|
1015
|
+
* - `'simple'` — original top-bar with dropdowns + duration buttons
|
|
1016
|
+
* - `'advanced'` — compact toolbar with timeframe pills + Compare/1-Click
|
|
1017
|
+
* - `'compact'` — slim per-pane toolbar (timeframe + series + indicators only),
|
|
1018
|
+
* sized for multi-pane grid cells. Symbol is changed via the
|
|
1019
|
+
* on-canvas OHLC strip label (no symbol button in this variant).
|
|
1020
|
+
*
|
|
1021
|
+
* If both `headerLayout` and the deprecated `features.advancedToolbar` are set,
|
|
1022
|
+
* `headerLayout` wins.
|
|
1023
|
+
*
|
|
1024
|
+
* - `'mobile'` — Mobile header: a single scrollable action row
|
|
1025
|
+
* (`Tools` button · timeframe pills · `Ask AI` button). Opt-in and fully
|
|
1026
|
+
* isolated; selecting it has no effect on any other white-label. The host
|
|
1027
|
+
* gates it itself, e.g. `headerLayout: isMobile ? 'mobile' : undefined`.
|
|
1028
|
+
* The `Ask AI` button only renders when {@link ChartConfig.onAskAiClick} is set.
|
|
1029
|
+
*/
|
|
1030
|
+
headerLayout?: 'simple' | 'advanced' | 'compact' | 'mobile';
|
|
1031
|
+
/**
|
|
1032
|
+
* Called when the user taps the "Ask AI" (✦) button in the `'mobile'` header.
|
|
1033
|
+
* Omit to hide the button entirely. No effect in other header layouts.
|
|
1034
|
+
*/
|
|
1035
|
+
onAskAiClick?: () => void;
|
|
1036
|
+
/**
|
|
1037
|
+
* Hide the chart header entirely (simple TopBar / AdvancedToolbar /
|
|
1038
|
+
* CompactToolbar — whichever `headerLayout` would have rendered).
|
|
1039
|
+
*
|
|
1040
|
+
* Use when the host UI provides its own controls and drives the chart via
|
|
1041
|
+
* `setTimeframe`, `setSeries`, `addIndicatorByName`, `removeIndicator`.
|
|
1042
|
+
*
|
|
1043
|
+
* Independent of `showUI` (which hides ALL UI) and `showBottomBar` /
|
|
1044
|
+
* drawing-tools / OHLC strip flags. Default: `false` (header visible).
|
|
1045
|
+
*/
|
|
1046
|
+
hideHeader?: boolean;
|
|
1047
|
+
/**
|
|
1048
|
+
* Show the Layout button and built-in multi-chart layout preset popover.
|
|
1049
|
+
* Default `false`. Works in both `'simple'` and `'advanced'` header layouts.
|
|
1050
|
+
*
|
|
1051
|
+
* The chart owns ONLY the picker UI. Selecting a preset emits a `layoutChange`
|
|
1052
|
+
* event with `{ presetId, preset, sync }`; the host project is responsible for
|
|
1053
|
+
* mounting the actual N-pane grid of ChartEngine instances and applying sync.
|
|
1054
|
+
*
|
|
1055
|
+
* Suppresses the deprecated `onLayoutClick` callback if also provided
|
|
1056
|
+
* (a one-time `console.warn` is logged at init).
|
|
1057
|
+
*/
|
|
1058
|
+
enableMultipleLayouts?: boolean;
|
|
1059
|
+
/**
|
|
1060
|
+
* Initial state of the cross-pane sync toggles (Symbol / Interval / Crosshair
|
|
1061
|
+
* / Time / Date range) shown in the chart-owned layout popover when
|
|
1062
|
+
* `enableMultipleLayouts: true`. Partial — any omitted key falls back to
|
|
1063
|
+
* {@link DEFAULT_LAYOUT_SYNC}, so existing consumers are unaffected.
|
|
1064
|
+
*
|
|
1065
|
+
* Use this to restore a user's persisted sync preferences on init. To change
|
|
1066
|
+
* the toggles on an already-mounted chart, call {@link ChartEngine.setLayoutSync}.
|
|
1067
|
+
*/
|
|
1068
|
+
layoutSync?: Partial<LayoutSyncState>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Show the Snapshot button and built-in Download/Copy popover.
|
|
1071
|
+
* Default `false`. Works in both `'simple'` and `'advanced'` header layouts.
|
|
1072
|
+
*
|
|
1073
|
+
* The chart emits a `snapshot` event with `{ dataUrl, action }` BEFORE
|
|
1074
|
+
* attempting the native browser action — mobile wrappers (Android/iOS)
|
|
1075
|
+
* can intercept via the JS bridge to use native APIs (Photos library,
|
|
1076
|
+
* UIPasteboard, ClipboardManager) where browser permissions are restricted.
|
|
1077
|
+
*
|
|
1078
|
+
* Suppresses the deprecated `onScreenshotClick` callback if also provided
|
|
1079
|
+
* (a one-time `console.warn` is logged at init).
|
|
1080
|
+
*/
|
|
1081
|
+
enableSnapshot?: boolean;
|
|
1082
|
+
/**
|
|
1083
|
+
* Opt-in feature flags. All flags default to `false` / disabled so existing
|
|
1084
|
+
* consumers are completely unaffected when this field is omitted.
|
|
1085
|
+
*/
|
|
1086
|
+
features?: {
|
|
1087
|
+
/**
|
|
1088
|
+
* @deprecated Use top-level `headerLayout: 'advanced'` instead. Will be
|
|
1089
|
+
* removed in a future major version. Currently treated as an alias.
|
|
1090
|
+
*/
|
|
1091
|
+
advancedToolbar?: boolean;
|
|
1092
|
+
};
|
|
1093
|
+
/**
|
|
1094
|
+
* Fetches historical OHLC bars for a compare symbol. When provided, the
|
|
1095
|
+
* library owns the Compare flow end-to-end: clicking the Compare button
|
|
1096
|
+
* opens an in-chart picker (reusing `isins`), and this loader is invoked
|
|
1097
|
+
* to populate each chosen compare. It is also re-invoked whenever the
|
|
1098
|
+
* primary symbol's range changes (timeframe switch, primary-symbol switch,
|
|
1099
|
+
* history pan-back, `resetData`) so compares stay aligned.
|
|
1100
|
+
*
|
|
1101
|
+
* No streaming — compares are historical-only in v1.
|
|
1102
|
+
*/
|
|
1103
|
+
compareDataLoader?: (params: CompareDataLoaderParams) => Promise<OHLCVBar[]>;
|
|
1104
|
+
/**
|
|
1105
|
+
* Compare symbols to add automatically on chart init. Each one triggers a
|
|
1106
|
+
* `compareDataLoader` call against the initial primary range.
|
|
1107
|
+
*/
|
|
1108
|
+
initialCompares?: string[];
|
|
1109
|
+
/**
|
|
1110
|
+
* Maximum number of concurrent compare symbols. Attempting to add beyond
|
|
1111
|
+
* this emits a `compareError` event instead of fetching. Default: `8`.
|
|
1112
|
+
*/
|
|
1113
|
+
maxCompares?: number;
|
|
1114
|
+
/**
|
|
1115
|
+
* @deprecated With `enableMultipleLayouts: true`, the chart owns the popover
|
|
1116
|
+
* and emits a `layoutChange` event. Listen to that event instead.
|
|
1117
|
+
* Still honored when `enableMultipleLayouts` is omitted/false.
|
|
1118
|
+
*/
|
|
1119
|
+
onLayoutClick?: () => void;
|
|
1120
|
+
/**
|
|
1121
|
+
* Called when the user toggles the 1-Click Trade button. Receives the new
|
|
1122
|
+
* active state as a boolean. The button is rendered in whichever toolbar is
|
|
1123
|
+
* active (default `TopBar` or `AdvancedToolbar`).
|
|
1124
|
+
*
|
|
1125
|
+
* **When omitted, the 1-Click Trade button is hidden** — callback presence
|
|
1126
|
+
* gates the button's visibility, matching the pattern used by
|
|
1127
|
+
* `onLayoutClick` / `onScreenshotClick`.
|
|
1128
|
+
*/
|
|
1129
|
+
onOneClickTradeToggle?: (active: boolean) => void;
|
|
1130
|
+
/**
|
|
1131
|
+
* @deprecated Renamed to `onOneClickTradeToggle` for clarity. Will be
|
|
1132
|
+
* removed in a future major version. If both are provided,
|
|
1133
|
+
* `onOneClickTradeToggle` wins and a console warning is emitted.
|
|
1134
|
+
*/
|
|
1135
|
+
onOneClickToggle?: (active: boolean) => void;
|
|
1136
|
+
/**
|
|
1137
|
+
* @deprecated With `enableSnapshot: true`, the chart owns the popover and
|
|
1138
|
+
* emits a `snapshot` event. Listen to that event instead.
|
|
1139
|
+
* Still honored when `enableSnapshot` is omitted/false.
|
|
1140
|
+
*/
|
|
1141
|
+
onScreenshotClick?: () => void;
|
|
898
1142
|
/**
|
|
899
1143
|
* @deprecated DraftOrderQtyInput has been removed. This option is a no-op.
|
|
900
1144
|
* Accepted for backward compatibility only.
|
|
@@ -943,6 +1187,38 @@ interface DrawingHandle {
|
|
|
943
1187
|
pointIndex: number;
|
|
944
1188
|
cursor: string;
|
|
945
1189
|
}
|
|
1190
|
+
/** Base per-instance style fields applicable to every drawing. */
|
|
1191
|
+
interface DrawingStyle {
|
|
1192
|
+
/** Primary line/border/marker color. */
|
|
1193
|
+
strokeColor?: string;
|
|
1194
|
+
/** Stroke width in px (typically 1–4). */
|
|
1195
|
+
lineWidth?: number;
|
|
1196
|
+
/** Dash pattern for lines and shape borders. */
|
|
1197
|
+
lineStyle?: 'solid' | 'dashed' | 'dotted';
|
|
1198
|
+
/** Fill color for shapes that have a fill (rectangle, channel, fib level fills). */
|
|
1199
|
+
fillColor?: string;
|
|
1200
|
+
/** Fill opacity (0..1). */
|
|
1201
|
+
fillOpacity?: number;
|
|
1202
|
+
}
|
|
1203
|
+
/** Extends DrawingStyle for text-bearing drawings (text, callout, anchoredNote, priceNote). */
|
|
1204
|
+
interface DrawingTextStyle extends DrawingStyle {
|
|
1205
|
+
/** Foreground text color. */
|
|
1206
|
+
textColor?: string;
|
|
1207
|
+
/** Font size in px (default 13). */
|
|
1208
|
+
fontSize?: number;
|
|
1209
|
+
}
|
|
1210
|
+
/** Per-level visibility + color for multi-level drawings (fib family, gann box). */
|
|
1211
|
+
interface DrawingLevelStyle {
|
|
1212
|
+
visible: boolean;
|
|
1213
|
+
color: string;
|
|
1214
|
+
}
|
|
1215
|
+
/** Extends DrawingStyle for fib/multi-level drawings. */
|
|
1216
|
+
interface DrawingFibStyle extends DrawingStyle {
|
|
1217
|
+
/** Map of level value (as string, e.g. '0', '0.236', '0.5', '1') → per-level style. */
|
|
1218
|
+
levels?: Record<string, DrawingLevelStyle>;
|
|
1219
|
+
}
|
|
1220
|
+
/** Union of all drawing style shapes. */
|
|
1221
|
+
type AnyDrawingStyle = DrawingStyle | DrawingTextStyle | DrawingFibStyle;
|
|
946
1222
|
interface IDrawing {
|
|
947
1223
|
id: string;
|
|
948
1224
|
type: DrawingToolType;
|
|
@@ -951,7 +1227,9 @@ interface IDrawing {
|
|
|
951
1227
|
visible?: boolean;
|
|
952
1228
|
locked?: boolean;
|
|
953
1229
|
text?: string;
|
|
954
|
-
|
|
1230
|
+
/** Optional per-instance style override; falls back to theme defaults when absent. */
|
|
1231
|
+
style?: AnyDrawingStyle;
|
|
1232
|
+
render(ctx: CanvasRenderingContext2D, scale: ScaleManager, viewport: Viewport, priceRange: PriceRange, chartW: number, chartH: number, isSelected: boolean, pricePrecision?: number, theme?: ChartTheme): void;
|
|
955
1233
|
hitTest(x: number, y: number, scale: ScaleManager, viewport: Viewport, priceRange: PriceRange, chartW: number, chartH: number): boolean;
|
|
956
1234
|
/** Returns the handle under (x, y), or null if none */
|
|
957
1235
|
getHandle(x: number, y: number, scale: ScaleManager, viewport: Viewport, priceRange: PriceRange, chartW: number, chartH: number): DrawingHandle | null;
|
|
@@ -971,6 +1249,13 @@ interface IWebSocketAdapter {
|
|
|
971
1249
|
}
|
|
972
1250
|
type IndicatorParams = Record<string, number | string>;
|
|
973
1251
|
interface ActiveIndicatorState {
|
|
1252
|
+
/**
|
|
1253
|
+
* Unique per-instance identifier (e.g. "EMA#3"). Distinguishes multiple
|
|
1254
|
+
* active instances of the same indicator type. All per-instance state and
|
|
1255
|
+
* UI (results cache, sub-pane overlays, scale factors, pills) is keyed by
|
|
1256
|
+
* this, not by `shortName` — so e.g. EMA-20, EMA-50 and EMA-200 can coexist.
|
|
1257
|
+
*/
|
|
1258
|
+
instanceId: string;
|
|
974
1259
|
indicator: IIndicator;
|
|
975
1260
|
shortName: string;
|
|
976
1261
|
currentParams: IndicatorParams;
|
|
@@ -985,12 +1270,20 @@ interface SerializedDrawing {
|
|
|
985
1270
|
visible?: boolean;
|
|
986
1271
|
text?: string;
|
|
987
1272
|
locked?: boolean;
|
|
1273
|
+
/** Optional per-instance style override; absent for drawings using theme defaults. */
|
|
1274
|
+
style?: AnyDrawingStyle;
|
|
988
1275
|
}
|
|
989
1276
|
/** Serializable per-symbol chart state emitted via the `stateChange` event. */
|
|
990
1277
|
interface IndicatorStateEntry {
|
|
991
1278
|
shortName: string;
|
|
992
1279
|
params: IndicatorParams;
|
|
993
1280
|
visible?: boolean;
|
|
1281
|
+
/**
|
|
1282
|
+
* Per-instance id captured at serialization time. Optional for backward
|
|
1283
|
+
* compatibility — configs saved before multi-instance support omit it, and
|
|
1284
|
+
* `setState` mints a fresh id when it's absent.
|
|
1285
|
+
*/
|
|
1286
|
+
instanceId?: string;
|
|
994
1287
|
}
|
|
995
1288
|
/** Color overrides for the chart canvas elements (background, grid, candles, etc.). */
|
|
996
1289
|
interface CanvasColorSettings {
|
|
@@ -1050,6 +1343,11 @@ interface ChartState {
|
|
|
1050
1343
|
factor: number;
|
|
1051
1344
|
panOffset: number;
|
|
1052
1345
|
};
|
|
1346
|
+
/**
|
|
1347
|
+
* Active compare symbols at snapshot time. The library will re-add each
|
|
1348
|
+
* one (in order) via `compareDataLoader` when this state is restored.
|
|
1349
|
+
*/
|
|
1350
|
+
compares?: string[];
|
|
1053
1351
|
}
|
|
1054
1352
|
interface CrosshairPosition {
|
|
1055
1353
|
x: number;
|
|
@@ -1059,7 +1357,12 @@ interface CrosshairPosition {
|
|
|
1059
1357
|
bar: OHLCVBar | null;
|
|
1060
1358
|
}
|
|
1061
1359
|
type ChartEventMap = {
|
|
1062
|
-
|
|
1360
|
+
/**
|
|
1361
|
+
* Crosshair position changed. Payload is `null` when the crosshair leaves
|
|
1362
|
+
* the chart area or is otherwise cleared — listeners that mirror crosshair
|
|
1363
|
+
* across multiple panes use `null` to clear the mirrored crosshair.
|
|
1364
|
+
*/
|
|
1365
|
+
crosshair: CrosshairPosition | null;
|
|
1063
1366
|
click: CrosshairPosition;
|
|
1064
1367
|
zoom: {
|
|
1065
1368
|
viewport: Viewport;
|
|
@@ -1251,6 +1554,60 @@ type ChartEventMap = {
|
|
|
1251
1554
|
bracketOrderLabel?: string;
|
|
1252
1555
|
}>;
|
|
1253
1556
|
};
|
|
1557
|
+
/**
|
|
1558
|
+
* Emitted when the user picks a preset in the multi-layout popover or toggles
|
|
1559
|
+
* a sync option. Fires only when `enableMultipleLayouts: true`. The host
|
|
1560
|
+
* project listens to this event to mount/teardown N panes accordingly.
|
|
1561
|
+
*/
|
|
1562
|
+
layoutChange: {
|
|
1563
|
+
presetId: string;
|
|
1564
|
+
preset: LayoutPreset;
|
|
1565
|
+
sync: LayoutSyncState;
|
|
1566
|
+
};
|
|
1567
|
+
/**
|
|
1568
|
+
* Emitted when the user picks Download or Copy from the snapshot popover.
|
|
1569
|
+
* Fires only when `enableSnapshot: true`. The chart attempts the native
|
|
1570
|
+
* browser action immediately after emitting; mobile wrappers can intercept
|
|
1571
|
+
* via the JS bridge to short-circuit and use platform APIs.
|
|
1572
|
+
*/
|
|
1573
|
+
snapshot: {
|
|
1574
|
+
/** Full PNG data URL of the composited chart canvas. */
|
|
1575
|
+
dataUrl: string;
|
|
1576
|
+
action: 'download' | 'copy';
|
|
1577
|
+
};
|
|
1578
|
+
/** Emitted after a compare symbol has been added and its bars resolved. */
|
|
1579
|
+
compareAdded: {
|
|
1580
|
+
symbol: string;
|
|
1581
|
+
color: string;
|
|
1582
|
+
};
|
|
1583
|
+
/** Emitted when a compare symbol is removed (×, `removeCompare`, or `clearCompares`). */
|
|
1584
|
+
compareRemoved: {
|
|
1585
|
+
symbol: string;
|
|
1586
|
+
};
|
|
1587
|
+
/**
|
|
1588
|
+
* Emitted when adding a compare or fetching its bars fails — e.g. no
|
|
1589
|
+
* `compareDataLoader` configured, loader rejected, or `maxCompares` reached.
|
|
1590
|
+
*/
|
|
1591
|
+
compareError: {
|
|
1592
|
+
symbol: string;
|
|
1593
|
+
message: string;
|
|
1594
|
+
};
|
|
1595
|
+
/**
|
|
1596
|
+
* Emitted after an indicator instance is added. `instanceId` uniquely
|
|
1597
|
+
* identifies the instance (e.g. "EMA#3") so callers can later remove that
|
|
1598
|
+
* specific instance via `removeIndicator(instanceId)` — important now that
|
|
1599
|
+
* multiple instances of the same `shortName` can coexist.
|
|
1600
|
+
*/
|
|
1601
|
+
indicatorAdded: {
|
|
1602
|
+
instanceId: string;
|
|
1603
|
+
shortName: string;
|
|
1604
|
+
params: IndicatorParams;
|
|
1605
|
+
};
|
|
1606
|
+
/** Emitted after an indicator instance is removed (pill ×, settings dialog, or `removeIndicator`). */
|
|
1607
|
+
indicatorRemoved: {
|
|
1608
|
+
instanceId: string;
|
|
1609
|
+
shortName: string;
|
|
1610
|
+
};
|
|
1254
1611
|
};
|
|
1255
1612
|
/** Distinguishes level types: historical trade, open position, or pending order. */
|
|
1256
1613
|
type TradeLevelType = 'trade' | 'position' | 'pending';
|
|
@@ -1442,4 +1799,4 @@ declare class MACD implements IIndicator {
|
|
|
1442
1799
|
render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, paneHeight: number, rangeOverride?: PriceRange): void;
|
|
1443
1800
|
}
|
|
1444
1801
|
|
|
1445
|
-
export { type
|
|
1802
|
+
export { type DrawingToolbarUiConfig as $, type AnyDrawingStyle as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_CROSSHAIR_CONFIG as E, DEFAULT_DRAWING_TOOLBAR_CONFIG as F, DEFAULT_INDICATOR_OVERLAY_CONFIG as G, DEFAULT_LABELS as H, type IIndicator as I, DEFAULT_LAYOUT_SYNC as J, DEFAULT_PRICE_AXIS_CONFIG as K, type LayoutSyncState as L, DEFAULT_TIME_AXIS_CONFIG as M, DEFAULT_TOP_BAR_CONFIG as N, type OHLCVBar as O, type PriceRange as P, DEFAULT_TRADE_BUTTON_CONFIG as Q, DEFAULT_UI_CONFIG as R, type SeriesType as S, type Timeframe as T, type DataLoaderParams as U, type Viewport as V, type DeepPartial$1 as W, type DeepPartialChartTheme as X, type DialogLabels as Y, type DrawingToolbarColors as Z, type DrawingToolbarLabels as _, type IndicatorParams as a, type Duration as a0, EMA as a1, type IndicatorOverlayColors as a2, type IndicatorOverlayUiConfig as a3, type IndicatorResult as a4, type IndicatorStateEntry as a5, LAYOUT_PRESETS as a6, LIGHT_THEME as a7, type LayoutPreset as a8, MACD as a9, getAllPresets as aA, getCustomPresets as aB, getPreset as aC, registerCustomPreset as aD, resolveCssVarsInTheme as aE, resolveLabels as aF, resolveUiConfig as aG, unregisterCustomPreset as aH, type PriceSource as aI, type OhlcLabels as aa, type OrderSubmit as ab, PRESETS_BY_COUNT as ac, PRESET_COUNTS as ad, PRESET_LABEL as ae, type Padding as af, type PendingOrderLevel as ag, type PositionLevel as ah, type PositionRenderStyle as ai, type PriceAxisUiConfig as aj, RSI as ak, SMA as al, type Theme as am, type ThemeOverrides as an, type TimeAxisUiConfig as ao, type TopBarColors as ap, type TopBarLabels as aq, type TopBarUiConfig as ar, type TradeButtonUiConfig as as, type TradeDisplayFilter as at, type TradeLabels as au, type TradeLevel as av, type TradeLevelColors as aw, type TradePanelColors as ax, type UiConfig as ay, deepMergeTheme as az, type ChartEventMap as b, type ChartState as c, type IDrawing as d, type IWebSocketAdapter as e, type TradeLevelType as f, type ChartTheme as g, type AnyLevel as h, type DrawingPoint as i, ScaleManager as j, type DrawingHandle as k, type SerializedDrawing as l, type Tick as m, type StreamStatus as n, type ActiveIndicatorState as o, type BottomBarColors as p, type BottomBarLabels as q, type BottomBarUiConfig as r, type CanvasColorSettings as s, type ChartLabels as t, type ChartMiscLabels as u, type ChartThemeUi as v, type CrosshairPosition as w, type CrosshairUiConfig as x, DARK_THEME as y, DEFAULT_BOTTOM_BAR_CONFIG as z };
|