@supersolutions/super-chart-web 0.0.0 → 0.1.0
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/LICENSE +674 -0
- package/README.md +7 -1
- package/dist/annotations.d.ts +124 -0
- package/dist/annotations.js +315 -0
- package/dist/chunk-PTYNDDEE.js +3082 -0
- package/dist/engine.d.ts +147 -0
- package/dist/engine.js +6 -0
- package/dist/index.d.ts +413 -0
- package/dist/index.js +1807 -0
- package/dist/overlays.d.ts +24 -0
- package/dist/overlays.js +109 -0
- package/dist/super-chart.engine.global.js +7 -0
- package/dist/super-chart.global.js +75 -0
- package/package.json +57 -6
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { CandleMode, ChartDataPort, Drawing, DrawingStore, DrawingType, EngineFrame, EngineIndicatorSpec, EngineIndicators, EngineInspection, EngineLayout, EngineRenderOptions, IndicatorDefinition, MarketBar, RealtimeView } from '@supersolutions/super-chart-core';
|
|
2
|
+
|
|
3
|
+
/** Optional paint layer. Callbacks read borrowed data; they must not mutate chart state. */
|
|
4
|
+
export interface EngineLayer {
|
|
5
|
+
update: (frame: EngineFrame, revealedRawBars: readonly MarketBar[]) => void;
|
|
6
|
+
paint: (context: CanvasRenderingContext2D) => void;
|
|
7
|
+
dispose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface EngineChartOptions {
|
|
10
|
+
count?: number;
|
|
11
|
+
/** Visible candle bounds for wheel, pinch, keyboard and programmatic navigation. */
|
|
12
|
+
viewport?: {
|
|
13
|
+
minBars?: number;
|
|
14
|
+
maxBars?: number;
|
|
15
|
+
rightPaddingBars?: number;
|
|
16
|
+
minCandleSpacing?: number;
|
|
17
|
+
maxCandleSpacing?: number;
|
|
18
|
+
};
|
|
19
|
+
/** Optional quality budget per Canvas layer; default uses the device pixel ratio. */
|
|
20
|
+
resolution?: {
|
|
21
|
+
maxPixelRatio?: number;
|
|
22
|
+
maxCanvasPixels?: number;
|
|
23
|
+
};
|
|
24
|
+
mode?: CandleMode;
|
|
25
|
+
layout?: EngineLayout;
|
|
26
|
+
render?: EngineRenderOptions;
|
|
27
|
+
indicators?: readonly EngineIndicatorSpec[];
|
|
28
|
+
inertia?: boolean;
|
|
29
|
+
onInspect?: (inspection: EngineInspection | null) => void;
|
|
30
|
+
onToolComplete?: () => void;
|
|
31
|
+
}
|
|
32
|
+
export interface EngineConfiguration {
|
|
33
|
+
render: EngineRenderOptions;
|
|
34
|
+
layout: EngineLayout;
|
|
35
|
+
indicators: readonly EngineIndicatorSpec[];
|
|
36
|
+
drawingsJson: string;
|
|
37
|
+
mode: CandleMode;
|
|
38
|
+
}
|
|
39
|
+
/** Owned Canvas renderer. The migration guide lists intentionally retired Pro APIs. */
|
|
40
|
+
export declare class EngineChart {
|
|
41
|
+
private readonly series;
|
|
42
|
+
/** Loader boundary. Data reads return copies and are not used by the render hot path. */
|
|
43
|
+
readonly dataPort: ChartDataPort;
|
|
44
|
+
readonly view: RealtimeView;
|
|
45
|
+
readonly drawings: DrawingStore;
|
|
46
|
+
private readonly indicators;
|
|
47
|
+
private readonly doc;
|
|
48
|
+
private readonly win;
|
|
49
|
+
private readonly root;
|
|
50
|
+
private readonly canvas;
|
|
51
|
+
private readonly cursorCanvas;
|
|
52
|
+
private readonly drawingCanvas;
|
|
53
|
+
private readonly drawingContext;
|
|
54
|
+
private readonly drawingImages;
|
|
55
|
+
private readonly context;
|
|
56
|
+
private readonly cursorContext;
|
|
57
|
+
private readonly resizeObserver;
|
|
58
|
+
private readonly abort;
|
|
59
|
+
private readonly unsubscribers;
|
|
60
|
+
private readonly stopGestures;
|
|
61
|
+
private readonly drawingInput;
|
|
62
|
+
private readonly onInspect?;
|
|
63
|
+
private readonly inputs;
|
|
64
|
+
private readonly layers;
|
|
65
|
+
private readonly indicatorListeners;
|
|
66
|
+
private indicatorNoticeQueued;
|
|
67
|
+
private inputId;
|
|
68
|
+
private draining;
|
|
69
|
+
private preview;
|
|
70
|
+
private frame;
|
|
71
|
+
private frameId;
|
|
72
|
+
private cursorX;
|
|
73
|
+
private width;
|
|
74
|
+
private height;
|
|
75
|
+
private ratio;
|
|
76
|
+
private geometryDirty;
|
|
77
|
+
private paintDirty;
|
|
78
|
+
private drawingDirty;
|
|
79
|
+
private cursorDirty;
|
|
80
|
+
private disposed;
|
|
81
|
+
private readonly invalidateDrawings;
|
|
82
|
+
private readonly viewportOptions;
|
|
83
|
+
private readonly resolution;
|
|
84
|
+
private densityWidth;
|
|
85
|
+
private layout;
|
|
86
|
+
private renderOptions;
|
|
87
|
+
private dprQuery;
|
|
88
|
+
private readonly counters;
|
|
89
|
+
constructor(host: HTMLElement, options?: EngineChartOptions);
|
|
90
|
+
/** Millisecond OHLC input is normalized once at the data boundary. */
|
|
91
|
+
setData(bars: unknown, more?: boolean): void;
|
|
92
|
+
update(bar: unknown): void;
|
|
93
|
+
prependData(bars: unknown, more?: boolean): void;
|
|
94
|
+
updateBatch(bars: unknown, more?: boolean): void;
|
|
95
|
+
registerIndicator(definition: IndicatorDefinition): void;
|
|
96
|
+
unregisterIndicator(name: string, expectedCalculate?: IndicatorDefinition["calculate"]): boolean;
|
|
97
|
+
addIndicator(spec: EngineIndicatorSpec): string;
|
|
98
|
+
removeIndicator(id: string): boolean;
|
|
99
|
+
updateIndicator(id: string, changes: Pick<EngineIndicatorSpec, "params" | "pane" | "paneId" | "visible">): boolean;
|
|
100
|
+
listIndicators(): ReturnType<EngineIndicators["list"]>;
|
|
101
|
+
getRegisteredIndicatorNames(): readonly string[];
|
|
102
|
+
validateIndicatorReplacement(specs: readonly EngineIndicatorSpec[]): void;
|
|
103
|
+
replaceIndicators(specs: readonly EngineIndicatorSpec[]): void;
|
|
104
|
+
onIndicatorsChanged(listener: () => void): () => void;
|
|
105
|
+
private notifyIndicators;
|
|
106
|
+
setDrawingTool(tool: DrawingType | null): void;
|
|
107
|
+
/** Own this layer until removal or chart disposal. It receives only revealed replay data. */
|
|
108
|
+
addLayer(layer: EngineLayer): () => void;
|
|
109
|
+
setRenderOptions(options: EngineRenderOptions): void;
|
|
110
|
+
setLayout(options: EngineLayout): void;
|
|
111
|
+
getMetrics(): Readonly<typeof this.counters>;
|
|
112
|
+
/** Copy only the requested tail; the feed/render hot path keeps its owned array. */
|
|
113
|
+
getBars(options?: {
|
|
114
|
+
limit?: number;
|
|
115
|
+
}): MarketBar[];
|
|
116
|
+
getLastBar(): MarketBar | null;
|
|
117
|
+
getLayoutOptions(): EngineLayout;
|
|
118
|
+
getRenderOptions(): EngineRenderOptions;
|
|
119
|
+
/** Validate all supplied state before replacing any live configuration. */
|
|
120
|
+
restoreConfiguration(configuration: EngineConfiguration, data?: {
|
|
121
|
+
bars: readonly MarketBar[];
|
|
122
|
+
more?: boolean;
|
|
123
|
+
}): void;
|
|
124
|
+
/** Repaint owned layers after their model changes without rebuilding candle geometry. */
|
|
125
|
+
requestPaint(): void;
|
|
126
|
+
/** Decode local raster resources before an import commits retained drawings. */
|
|
127
|
+
prepareDrawingImages(drawings: readonly Drawing[]): Promise<void>;
|
|
128
|
+
/** Hold decoded resources across asynchronous market loading; release in finally. */
|
|
129
|
+
holdDrawingImages(drawings: readonly Drawing[]): () => void;
|
|
130
|
+
private retainDrawingImages;
|
|
131
|
+
snapshot(): Promise<Blob>;
|
|
132
|
+
dispose(): void;
|
|
133
|
+
private assertLive;
|
|
134
|
+
private updateReference;
|
|
135
|
+
private validateBars;
|
|
136
|
+
private validateRender;
|
|
137
|
+
private readonly pixelRatioChanged;
|
|
138
|
+
private watchPixelRatio;
|
|
139
|
+
private schedule;
|
|
140
|
+
private renderTick;
|
|
141
|
+
/** Keep an unused transparent layer tiny without changing its CSS or hit geometry. */
|
|
142
|
+
private sizeDrawingCanvas;
|
|
143
|
+
private flush;
|
|
144
|
+
}
|
|
145
|
+
export type { MarketBar, EngineRenderOptions, EngineLayout, EngineFrame, EngineInspection, Drawing, DrawingType, IndicatorDefinition } from "@supersolutions/super-chart-core";
|
|
146
|
+
|
|
147
|
+
export {};
|
package/dist/engine.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { CandleMode, ChartDataPort, DataStatus, Datafeed, Drawing, DrawingBounds, DrawingStore, DrawingType, EngineFrame, EngineIndicatorSpec, EngineIndicators, EngineInspection, EngineLayout, EngineRenderFrame, EngineRenderOptions, IndicatorDefinition, LoaderOptions, MarketBar, Period, RealtimeView, SymbolInfo, WorkspaceEvents, WorkspaceLoadResult, WorkspaceLoadState, WorkspaceMarket, WorkspaceReplayState, WorkspaceState } from '@supersolutions/super-chart-core';
|
|
2
|
+
|
|
3
|
+
/** Optional paint layer. Callbacks read borrowed data; they must not mutate chart state. */
|
|
4
|
+
export interface EngineLayer {
|
|
5
|
+
update: (frame: EngineFrame, revealedRawBars: readonly MarketBar[]) => void;
|
|
6
|
+
paint: (context: CanvasRenderingContext2D) => void;
|
|
7
|
+
dispose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface EngineChartOptions {
|
|
10
|
+
count?: number;
|
|
11
|
+
/** Visible candle bounds for wheel, pinch, keyboard and programmatic navigation. */
|
|
12
|
+
viewport?: {
|
|
13
|
+
minBars?: number;
|
|
14
|
+
maxBars?: number;
|
|
15
|
+
rightPaddingBars?: number;
|
|
16
|
+
minCandleSpacing?: number;
|
|
17
|
+
maxCandleSpacing?: number;
|
|
18
|
+
};
|
|
19
|
+
/** Optional quality budget per Canvas layer; default uses the device pixel ratio. */
|
|
20
|
+
resolution?: {
|
|
21
|
+
maxPixelRatio?: number;
|
|
22
|
+
maxCanvasPixels?: number;
|
|
23
|
+
};
|
|
24
|
+
mode?: CandleMode;
|
|
25
|
+
layout?: EngineLayout;
|
|
26
|
+
render?: EngineRenderOptions;
|
|
27
|
+
indicators?: readonly EngineIndicatorSpec[];
|
|
28
|
+
inertia?: boolean;
|
|
29
|
+
onInspect?: (inspection: EngineInspection | null) => void;
|
|
30
|
+
onToolComplete?: () => void;
|
|
31
|
+
}
|
|
32
|
+
export interface EngineConfiguration {
|
|
33
|
+
render: EngineRenderOptions;
|
|
34
|
+
layout: EngineLayout;
|
|
35
|
+
indicators: readonly EngineIndicatorSpec[];
|
|
36
|
+
drawingsJson: string;
|
|
37
|
+
mode: CandleMode;
|
|
38
|
+
}
|
|
39
|
+
/** Owned Canvas renderer. The migration guide lists intentionally retired Pro APIs. */
|
|
40
|
+
export declare class EngineChart {
|
|
41
|
+
private readonly series;
|
|
42
|
+
/** Loader boundary. Data reads return copies and are not used by the render hot path. */
|
|
43
|
+
readonly dataPort: ChartDataPort;
|
|
44
|
+
readonly view: RealtimeView;
|
|
45
|
+
readonly drawings: DrawingStore;
|
|
46
|
+
private readonly indicators;
|
|
47
|
+
private readonly doc;
|
|
48
|
+
private readonly win;
|
|
49
|
+
private readonly root;
|
|
50
|
+
private readonly canvas;
|
|
51
|
+
private readonly cursorCanvas;
|
|
52
|
+
private readonly drawingCanvas;
|
|
53
|
+
private readonly drawingContext;
|
|
54
|
+
private readonly drawingImages;
|
|
55
|
+
private readonly context;
|
|
56
|
+
private readonly cursorContext;
|
|
57
|
+
private readonly resizeObserver;
|
|
58
|
+
private readonly abort;
|
|
59
|
+
private readonly unsubscribers;
|
|
60
|
+
private readonly stopGestures;
|
|
61
|
+
private readonly drawingInput;
|
|
62
|
+
private readonly onInspect?;
|
|
63
|
+
private readonly inputs;
|
|
64
|
+
private readonly layers;
|
|
65
|
+
private readonly indicatorListeners;
|
|
66
|
+
private indicatorNoticeQueued;
|
|
67
|
+
private inputId;
|
|
68
|
+
private draining;
|
|
69
|
+
private preview;
|
|
70
|
+
private frame;
|
|
71
|
+
private frameId;
|
|
72
|
+
private cursorX;
|
|
73
|
+
private width;
|
|
74
|
+
private height;
|
|
75
|
+
private ratio;
|
|
76
|
+
private geometryDirty;
|
|
77
|
+
private paintDirty;
|
|
78
|
+
private drawingDirty;
|
|
79
|
+
private cursorDirty;
|
|
80
|
+
private disposed;
|
|
81
|
+
private readonly invalidateDrawings;
|
|
82
|
+
private readonly viewportOptions;
|
|
83
|
+
private readonly resolution;
|
|
84
|
+
private densityWidth;
|
|
85
|
+
private layout;
|
|
86
|
+
private renderOptions;
|
|
87
|
+
private dprQuery;
|
|
88
|
+
private readonly counters;
|
|
89
|
+
constructor(host: HTMLElement, options?: EngineChartOptions);
|
|
90
|
+
/** Millisecond OHLC input is normalized once at the data boundary. */
|
|
91
|
+
setData(bars: unknown, more?: boolean): void;
|
|
92
|
+
update(bar: unknown): void;
|
|
93
|
+
prependData(bars: unknown, more?: boolean): void;
|
|
94
|
+
updateBatch(bars: unknown, more?: boolean): void;
|
|
95
|
+
registerIndicator(definition: IndicatorDefinition): void;
|
|
96
|
+
unregisterIndicator(name: string, expectedCalculate?: IndicatorDefinition["calculate"]): boolean;
|
|
97
|
+
addIndicator(spec: EngineIndicatorSpec): string;
|
|
98
|
+
removeIndicator(id: string): boolean;
|
|
99
|
+
updateIndicator(id: string, changes: Pick<EngineIndicatorSpec, "params" | "pane" | "paneId" | "visible">): boolean;
|
|
100
|
+
listIndicators(): ReturnType<EngineIndicators["list"]>;
|
|
101
|
+
getRegisteredIndicatorNames(): readonly string[];
|
|
102
|
+
validateIndicatorReplacement(specs: readonly EngineIndicatorSpec[]): void;
|
|
103
|
+
replaceIndicators(specs: readonly EngineIndicatorSpec[]): void;
|
|
104
|
+
onIndicatorsChanged(listener: () => void): () => void;
|
|
105
|
+
private notifyIndicators;
|
|
106
|
+
setDrawingTool(tool: DrawingType | null): void;
|
|
107
|
+
/** Own this layer until removal or chart disposal. It receives only revealed replay data. */
|
|
108
|
+
addLayer(layer: EngineLayer): () => void;
|
|
109
|
+
setRenderOptions(options: EngineRenderOptions): void;
|
|
110
|
+
setLayout(options: EngineLayout): void;
|
|
111
|
+
getMetrics(): Readonly<typeof this.counters>;
|
|
112
|
+
/** Copy only the requested tail; the feed/render hot path keeps its owned array. */
|
|
113
|
+
getBars(options?: {
|
|
114
|
+
limit?: number;
|
|
115
|
+
}): MarketBar[];
|
|
116
|
+
getLastBar(): MarketBar | null;
|
|
117
|
+
getLayoutOptions(): EngineLayout;
|
|
118
|
+
getRenderOptions(): EngineRenderOptions;
|
|
119
|
+
/** Validate all supplied state before replacing any live configuration. */
|
|
120
|
+
restoreConfiguration(configuration: EngineConfiguration, data?: {
|
|
121
|
+
bars: readonly MarketBar[];
|
|
122
|
+
more?: boolean;
|
|
123
|
+
}): void;
|
|
124
|
+
/** Repaint owned layers after their model changes without rebuilding candle geometry. */
|
|
125
|
+
requestPaint(): void;
|
|
126
|
+
/** Decode local raster resources before an import commits retained drawings. */
|
|
127
|
+
prepareDrawingImages(drawings: readonly Drawing[]): Promise<void>;
|
|
128
|
+
/** Hold decoded resources across asynchronous market loading; release in finally. */
|
|
129
|
+
holdDrawingImages(drawings: readonly Drawing[]): () => void;
|
|
130
|
+
private retainDrawingImages;
|
|
131
|
+
snapshot(): Promise<Blob>;
|
|
132
|
+
dispose(): void;
|
|
133
|
+
private assertLive;
|
|
134
|
+
private updateReference;
|
|
135
|
+
private validateBars;
|
|
136
|
+
private validateRender;
|
|
137
|
+
private readonly pixelRatioChanged;
|
|
138
|
+
private watchPixelRatio;
|
|
139
|
+
private schedule;
|
|
140
|
+
private renderTick;
|
|
141
|
+
/** Keep an unused transparent layer tiny without changing its CSS or hit geometry. */
|
|
142
|
+
private sizeDrawingCanvas;
|
|
143
|
+
private flush;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Draw in the frame's logical-pixel coordinate system. The host sets the DPR transform.
|
|
147
|
+
* No data or geometry is recalculated here; inspection and rendering use the same model.
|
|
148
|
+
* Separate indicator panes use the same model and painter without candle geometry.
|
|
149
|
+
*/
|
|
150
|
+
export declare function paintEngineFrame(ctx: CanvasRenderingContext2D, frame: EngineRenderFrame, options?: EngineRenderOptions): void;
|
|
151
|
+
/** Draw on a separate cleared cursor layer so pointer moves do not redraw candles. */
|
|
152
|
+
export declare function paintEngineCursor(ctx: CanvasRenderingContext2D, frame: EngineRenderFrame, x: number, options?: EngineRenderOptions): void;
|
|
153
|
+
export type WorkspaceThemeName = "dark" | "light";
|
|
154
|
+
export type WorkspaceChromeKey = "background" | "text" | "surface" | "border" | "divider" | "danger" | "toolbar" | "muted" | "hover" | "hoverBorder" | "focus" | "accent" | "active" | "panelBorder" | "panel" | "panelShadow" | "error" | "colorScheme";
|
|
155
|
+
/** The existing scoped workspace variables; host styles and `ui.variables` use these same names. */
|
|
156
|
+
export declare const WORKSPACE_CHROME_VARS: Readonly<Record<WorkspaceChromeKey, string>>;
|
|
157
|
+
export interface WorkspaceTheme {
|
|
158
|
+
/** Values for `WORKSPACE_CHROME_VARS`. */
|
|
159
|
+
readonly chrome: Readonly<Record<WorkspaceChromeKey, string>>;
|
|
160
|
+
/** Canvas colours are explicit renderer values, independent of the DOM variables. */
|
|
161
|
+
readonly render: Readonly<Required<Pick<EngineRenderOptions, "background" | "grid" | "text" | "up" | "down" | "line">>>;
|
|
162
|
+
}
|
|
163
|
+
/** Dark keeps the current workspace defaults; light also covers controls, menus and status surfaces. */
|
|
164
|
+
export declare const WORKSPACE_THEMES: Readonly<Record<WorkspaceThemeName, WorkspaceTheme>>;
|
|
165
|
+
/** Host-owned persistence: writes are synchronous acknowledgements, not fire-and-forget. */
|
|
166
|
+
export interface WorkspaceDrawingStorage {
|
|
167
|
+
getItem: (key: string) => string | null;
|
|
168
|
+
setItem: (key: string, value: string) => void;
|
|
169
|
+
}
|
|
170
|
+
export interface WorkspaceDrawingCacheOptions {
|
|
171
|
+
/** Namespace is explicit; nothing is written to browser storage by default. */
|
|
172
|
+
namespace: string;
|
|
173
|
+
storage: WorkspaceDrawingStorage;
|
|
174
|
+
maxSymbols?: number;
|
|
175
|
+
/** Approximate UTF-16 string bytes in the in-memory document cache. */
|
|
176
|
+
maxBytes?: number;
|
|
177
|
+
}
|
|
178
|
+
export interface WorkspaceSearchOptions {
|
|
179
|
+
/** In-memory recents by default. Set zero to disable; at most 50. */
|
|
180
|
+
recentLimit?: number;
|
|
181
|
+
initialRecent?: readonly SymbolInfo[];
|
|
182
|
+
/** Explicit host namespace enables persistence; no default global storage key. */
|
|
183
|
+
persistKey?: string;
|
|
184
|
+
storage?: Pick<Storage, "getItem" | "setItem">;
|
|
185
|
+
}
|
|
186
|
+
/** Scoped workspace chrome. Canvas colours remain in chart.render. */
|
|
187
|
+
export interface WorkspaceAppearanceOptions {
|
|
188
|
+
/** Additional root classes for host styles; .sc-workspace always remains. */
|
|
189
|
+
className?: string;
|
|
190
|
+
density?: "compact" | "comfortable";
|
|
191
|
+
/** CSS custom properties only; values inherit from the host when omitted. */
|
|
192
|
+
variables?: Readonly<Partial<Record<`--sc-${string}`, string>>>;
|
|
193
|
+
}
|
|
194
|
+
export interface ChartWorkspaceOptions {
|
|
195
|
+
datafeed: Datafeed;
|
|
196
|
+
symbol: SymbolInfo;
|
|
197
|
+
period: Period;
|
|
198
|
+
periods?: readonly Period[];
|
|
199
|
+
chart?: EngineChartOptions;
|
|
200
|
+
/**
|
|
201
|
+
* `light` or `dark` for the chrome and the canvas colours; `chart.render` colours still win. Leave it out to keep the
|
|
202
|
+
* dark default and restyle through the existing `--sc-*` CSS custom properties (see `WORKSPACE_CHROME_VARS`).
|
|
203
|
+
*/
|
|
204
|
+
theme?: WorkspaceThemeName;
|
|
205
|
+
loader?: Omit<LoaderOptions, "datafeed" | "env">;
|
|
206
|
+
search?: WorkspaceSearchOptions;
|
|
207
|
+
ui?: WorkspaceAppearanceOptions;
|
|
208
|
+
/** Host persistence for completed edits; only acknowledged documents are evicted from memory. */
|
|
209
|
+
drawingCache?: WorkspaceDrawingCacheOptions;
|
|
210
|
+
/** Period-close estimate. Disable or supply the exchange's real session close. */
|
|
211
|
+
countdown?: {
|
|
212
|
+
enabled?: boolean;
|
|
213
|
+
closeTimestamp?: (market: WorkspaceMarket, lastBar: MarketBar) => number | null;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/** DOM controls for the owned engine. This is not the legacy Pro API compatibility surface. */
|
|
217
|
+
export declare class ChartWorkspace {
|
|
218
|
+
readonly chart: EngineChart;
|
|
219
|
+
/** Constructor load outcome; same-tick market changes share its final request. */
|
|
220
|
+
readonly ready: Promise<WorkspaceLoadResult>;
|
|
221
|
+
private readonly doc;
|
|
222
|
+
private readonly win;
|
|
223
|
+
private readonly abort;
|
|
224
|
+
private loader;
|
|
225
|
+
private timedReplay;
|
|
226
|
+
private readonly countdown;
|
|
227
|
+
private readonly loaderOptions;
|
|
228
|
+
private readonly loads;
|
|
229
|
+
private readonly events;
|
|
230
|
+
private readonly loaderUnsubscribe;
|
|
231
|
+
private readonly datafeed;
|
|
232
|
+
private readonly root;
|
|
233
|
+
private readonly chartHost;
|
|
234
|
+
private readonly statusNode;
|
|
235
|
+
private readonly stageStatus;
|
|
236
|
+
private readonly replayControls;
|
|
237
|
+
private readonly downloadButton;
|
|
238
|
+
private downloading;
|
|
239
|
+
private reportedStatusUI;
|
|
240
|
+
private readonly notice;
|
|
241
|
+
private readonly symbolButton;
|
|
242
|
+
private readonly periodSelect;
|
|
243
|
+
private readonly drawingSelect;
|
|
244
|
+
private readonly indicatorSelect;
|
|
245
|
+
private readonly syncPresentation;
|
|
246
|
+
private readonly searchPanel;
|
|
247
|
+
private readonly searchInput;
|
|
248
|
+
private readonly searchResults;
|
|
249
|
+
private readonly searchStatus;
|
|
250
|
+
private readonly recents;
|
|
251
|
+
private readonly recentLimit;
|
|
252
|
+
private searchSymbols;
|
|
253
|
+
private searchActive;
|
|
254
|
+
private searchShownQuery;
|
|
255
|
+
private searchLoading;
|
|
256
|
+
private readonly retryButton;
|
|
257
|
+
private readonly olderButton;
|
|
258
|
+
private readonly replayInfo;
|
|
259
|
+
private readonly replayButtons;
|
|
260
|
+
private readonly replaySpeed;
|
|
261
|
+
private readonly drawingButtons;
|
|
262
|
+
private readonly unsubscribe;
|
|
263
|
+
private readonly drawingDocuments;
|
|
264
|
+
private drawingSaveTimer;
|
|
265
|
+
private readonly persistentDrawings;
|
|
266
|
+
private lastDrawingList;
|
|
267
|
+
private readonly downloads;
|
|
268
|
+
private readonly actions;
|
|
269
|
+
private symbol;
|
|
270
|
+
private period;
|
|
271
|
+
private periods;
|
|
272
|
+
private scale;
|
|
273
|
+
private drawingSymbol;
|
|
274
|
+
private displayedPair;
|
|
275
|
+
private pending;
|
|
276
|
+
private waitingStart;
|
|
277
|
+
private olderPending;
|
|
278
|
+
private applyError;
|
|
279
|
+
private cancelled;
|
|
280
|
+
private reportedLoadState;
|
|
281
|
+
private reportedReplayState;
|
|
282
|
+
private searchAbort;
|
|
283
|
+
private searchTimer;
|
|
284
|
+
private searchGeneration;
|
|
285
|
+
private disposed;
|
|
286
|
+
private restoreGeneration;
|
|
287
|
+
private pendingRestore;
|
|
288
|
+
constructor(host: HTMLElement, options: ChartWorkspaceOptions);
|
|
289
|
+
getSymbol(): SymbolInfo;
|
|
290
|
+
getPeriod(): Period;
|
|
291
|
+
/** Register an optional pack on demand without loading it into every workspace. */
|
|
292
|
+
registerIndicator(definition: IndicatorDefinition): void;
|
|
293
|
+
setSymbol(symbol: SymbolInfo): Promise<WorkspaceLoadResult>;
|
|
294
|
+
setPeriod(period: Period | string): Promise<WorkspaceLoadResult>;
|
|
295
|
+
/** Validate both inputs before changing either; same-tick calls fetch the final pair once. */
|
|
296
|
+
setMarket(symbol: SymbolInfo, period: Period | string): Promise<WorkspaceLoadResult>;
|
|
297
|
+
private changeMarket;
|
|
298
|
+
/** Starts a real fresh request even when the selected market is unchanged. */
|
|
299
|
+
reload(): Promise<WorkspaceLoadResult>;
|
|
300
|
+
/**
|
|
301
|
+
* Abort the pending market load and its history/sync requests. Explicit
|
|
302
|
+
* cancellation retires this loader's cache; the next reload starts fresh.
|
|
303
|
+
* A settled chart is unaffected (returns false).
|
|
304
|
+
*/
|
|
305
|
+
cancelLoad(): boolean;
|
|
306
|
+
on<K extends keyof WorkspaceEvents>(type: K, listener: (event: WorkspaceEvents[K]) => void): () => void;
|
|
307
|
+
off<K extends keyof WorkspaceEvents>(type: K, listener: (event: WorkspaceEvents[K]) => void): void;
|
|
308
|
+
/** Detached candle objects; during replay, only revealed candles are returned. */
|
|
309
|
+
getBars(options?: {
|
|
310
|
+
limit?: number;
|
|
311
|
+
}): MarketBar[];
|
|
312
|
+
getLoadState(): WorkspaceLoadState;
|
|
313
|
+
getState(): WorkspaceState;
|
|
314
|
+
getReplayState(): WorkspaceReplayState;
|
|
315
|
+
startReplay(at?: number): boolean;
|
|
316
|
+
stepReplay(delta?: number): WorkspaceReplayState;
|
|
317
|
+
startReplayAt(timestamp: number): boolean;
|
|
318
|
+
playReplay(speed?: number): boolean;
|
|
319
|
+
pauseReplay(): void;
|
|
320
|
+
setReplaySpeed(speed: number): void;
|
|
321
|
+
exitReplay(): WorkspaceReplayState;
|
|
322
|
+
/** Market, indicators, drawings and presentation only; no feed, code or credentials. */
|
|
323
|
+
exportDocument(): string;
|
|
324
|
+
/**
|
|
325
|
+
* Validate/decode first, then load the requested market through the usual feed.
|
|
326
|
+
* A failed or superseded load never applies saved state to a different market.
|
|
327
|
+
* Registered executable layers are host-owned and are not serialized/restored.
|
|
328
|
+
*/
|
|
329
|
+
restoreDocument(json: string): Promise<WorkspaceLoadResult>;
|
|
330
|
+
getStatus(): DataStatus;
|
|
331
|
+
/**
|
|
332
|
+
* Switch the chrome and the canvas colours to a preset. The preset's six canvas colours replace the current ones,
|
|
333
|
+
* including any the host passed in `chart.render`; set those again afterwards through `chart.setRenderOptions`.
|
|
334
|
+
* Preset chrome variables likewise replace earlier values; other `ui.variables` stay untouched.
|
|
335
|
+
*/
|
|
336
|
+
setTheme(theme: WorkspaceThemeName): void;
|
|
337
|
+
private applyChromeTheme;
|
|
338
|
+
dispose(): void;
|
|
339
|
+
/** Flush a completed edit before leaving. Storage errors propagate; the document
|
|
340
|
+
* stays in memory and disposal can be retried after the host handles the error. */
|
|
341
|
+
saveDrawings(): void;
|
|
342
|
+
getDrawingCacheStats(): {
|
|
343
|
+
symbols: number;
|
|
344
|
+
bytes: number;
|
|
345
|
+
unsaved: number;
|
|
346
|
+
};
|
|
347
|
+
private queueDrawingSave;
|
|
348
|
+
private market;
|
|
349
|
+
private requestedPair;
|
|
350
|
+
private resolvePeriod;
|
|
351
|
+
private createReplay;
|
|
352
|
+
private createLoader;
|
|
353
|
+
private shownMatches;
|
|
354
|
+
private prepareRequest;
|
|
355
|
+
private request;
|
|
356
|
+
private currentResult;
|
|
357
|
+
private settleLoad;
|
|
358
|
+
private dataPort;
|
|
359
|
+
private restoreDrawings;
|
|
360
|
+
private updateStatus;
|
|
361
|
+
private updateReplay;
|
|
362
|
+
private updateDrawingControls;
|
|
363
|
+
private openSearch;
|
|
364
|
+
private closeSearch;
|
|
365
|
+
private cancelSearch;
|
|
366
|
+
private queueSearch;
|
|
367
|
+
private search;
|
|
368
|
+
private chooseSearchResult;
|
|
369
|
+
private searchKey;
|
|
370
|
+
private download;
|
|
371
|
+
private node;
|
|
372
|
+
private listen;
|
|
373
|
+
private button;
|
|
374
|
+
private select;
|
|
375
|
+
private row;
|
|
376
|
+
private field;
|
|
377
|
+
private setText;
|
|
378
|
+
private menu;
|
|
379
|
+
private run;
|
|
380
|
+
private errorMessage;
|
|
381
|
+
private showNotice;
|
|
382
|
+
private assertLive;
|
|
383
|
+
}
|
|
384
|
+
/** Encode a local file. Decode with DrawingImageRenderer.prepare before committing it. */
|
|
385
|
+
export declare function createDrawingImage(blob: Blob, signal?: AbortSignal): Promise<string>;
|
|
386
|
+
/** One instance per chart. All pixels originate in local raster bytes, keeping export untainted. */
|
|
387
|
+
export declare class DrawingImageRenderer {
|
|
388
|
+
private readonly decode;
|
|
389
|
+
private readonly entries;
|
|
390
|
+
private readonly held;
|
|
391
|
+
private pixels;
|
|
392
|
+
private disposed;
|
|
393
|
+
/** Optional owner-window decoder is useful when the chart lives in another document. */
|
|
394
|
+
constructor(decode?: (blob: Blob) => Promise<ImageBitmap>);
|
|
395
|
+
prepare(source: string): Promise<void>;
|
|
396
|
+
getError(source: string): Error | null;
|
|
397
|
+
paint(context: CanvasRenderingContext2D, source: string, bounds: DrawingBounds, clip: DrawingBounds, onInvalidate?: () => void): "ready" | "loading" | "unavailable";
|
|
398
|
+
/** Source data stays in drawing history; a released bitmap can be decoded again on undo. */
|
|
399
|
+
retain(sources: ReadonlySet<string>): void;
|
|
400
|
+
/** Keep validated resources across an asynchronous market/document restore. */
|
|
401
|
+
hold(sources: ReadonlySet<string>): () => void;
|
|
402
|
+
has(source: string): boolean;
|
|
403
|
+
release(source: string): void;
|
|
404
|
+
dispose(): void;
|
|
405
|
+
}
|
|
406
|
+
export { ENGINE_CHART_TYPES, EngineIndicators, DrawingStore, projectDrawing, hitTestDrawingGeometry, DRAWING_TYPES, drawingAnchorCount, createPriceScale, buildEngineFrame, parseWorkspaceDocument, WORKSPACE_DOCUMENT_LIMITS, validateDrawingImage, DRAWING_IMAGE_LIMITS } from "@supersolutions/super-chart-core";
|
|
407
|
+
export type { EngineRenderOptions, EngineChartType, EngineIndicatorSpec, EngineIndicatorInstance, EngineIndicatorResult, IndicatorDefinition, IndicatorFigure, IndicatorRow, IndicatorPane, Drawing, DrawingType, DrawingAnchor, DrawingGeometry, DrawingContext, PriceScaleOptions, PriceScaleMode, EngineFrame, EngineLayout, EngineInspection, WorkspaceDocumentV1, WorkspaceDocumentOptions, WorkspaceSavedRender, Datafeed, SymbolInfo, Period, Timespan, HistoryRequest, HistoryResult, SearchRequest, DatafeedSubscribeCallback, MarketBar, WorkspaceState, WorkspaceEvents, WorkspaceLoadState, WorkspaceLoadResult, WorkspaceMarket, WorkspaceReplayState } from "@supersolutions/super-chart-core";
|
|
408
|
+
|
|
409
|
+
export {
|
|
410
|
+
ChartWorkspace as SuperChart,
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
export {};
|