@abdullahjaswal/tickyr-charts-solid 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 +14 -0
- package/README.md +43 -0
- package/dist/animation/animator.d.ts +52 -0
- package/dist/animation/bar-entry.d.ts +44 -0
- package/dist/animation/bar-update.d.ts +38 -0
- package/dist/animation/easings.d.ts +22 -0
- package/dist/animation/index.d.ts +4 -0
- package/dist/charts/bar-chart-controller.d.ts +98 -0
- package/dist/charts/bar-chart-helpers.d.ts +334 -0
- package/dist/charts/candle-chart-controller.d.ts +353 -0
- package/dist/charts/candle-chart-helpers.d.ts +781 -0
- package/dist/charts/depth-chart-controller.d.ts +84 -0
- package/dist/charts/depth-chart-helpers.d.ts +185 -0
- package/dist/charts/depth-series.d.ts +41 -0
- package/dist/charts/heatmap-chart-controller.d.ts +78 -0
- package/dist/charts/heatmap-chart-helpers.d.ts +174 -0
- package/dist/charts/heatmap-color-compute.d.ts +11 -0
- package/dist/charts/hierarchy.d.ts +49 -0
- package/dist/charts/histogram-binning.d.ts +33 -0
- package/dist/charts/histogram-chart-controller.d.ts +82 -0
- package/dist/charts/histogram-chart-helpers.d.ts +199 -0
- package/dist/charts/kagi-chart-controller.d.ts +154 -0
- package/dist/charts/line-chart-controller.d.ts +209 -0
- package/dist/charts/line-chart-helpers.d.ts +606 -0
- package/dist/charts/mark-buffers.d.ts +105 -0
- package/dist/charts/pie-chart-controller.d.ts +83 -0
- package/dist/charts/pie-chart-helpers.d.ts +155 -0
- package/dist/charts/pie-slice-compute.d.ts +44 -0
- package/dist/charts/pnf-chart-controller.d.ts +153 -0
- package/dist/charts/renko-chart-controller.d.ts +151 -0
- package/dist/charts/sankey-chart-controller.d.ts +176 -0
- package/dist/charts/sankey-layout.d.ts +64 -0
- package/dist/charts/scatter-chart-controller.d.ts +90 -0
- package/dist/charts/scatter-chart-helpers.d.ts +257 -0
- package/dist/charts/scatter-density.d.ts +5 -0
- package/dist/charts/scatter-regression.d.ts +27 -0
- package/dist/charts/sunburst-chart-controller.d.ts +107 -0
- package/dist/charts/sunburst-chart-helpers.d.ts +143 -0
- package/dist/charts/sunburst-layout.d.ts +40 -0
- package/dist/charts/time-off-algorithms.d.ts +53 -0
- package/dist/charts/treemap-chart-controller.d.ts +103 -0
- package/dist/charts/treemap-chart-helpers.d.ts +163 -0
- package/dist/charts/treemap-layout.d.ts +29 -0
- package/dist/charts/types.d.ts +38 -0
- package/dist/clock/clock.d.ts +10 -0
- package/dist/composition/chart-group-state.d.ts +46 -0
- package/dist/composition/index.d.ts +1 -0
- package/dist/composition/pane.d.ts +33 -0
- package/dist/domain/concat.d.ts +18 -0
- package/dist/domain/drawings.d.ts +44 -0
- package/dist/domain/heikin-ashi.d.ts +9 -0
- package/dist/domain/index.d.ts +7 -0
- package/dist/domain/ingestion.d.ts +7 -0
- package/dist/domain/live-state.d.ts +12 -0
- package/dist/domain/markers.d.ts +38 -0
- package/dist/domain/series.d.ts +22 -0
- package/dist/domain/values.d.ts +32 -0
- package/dist/engine/aggregation.d.ts +15 -0
- package/dist/engine/downsampling.d.ts +3 -0
- package/dist/engine/events.d.ts +14 -0
- package/dist/engine/index.d.ts +13 -0
- package/dist/engine/indicators.d.ts +37 -0
- package/dist/engine/markets.d.ts +8 -0
- package/dist/engine/module.d.ts +8 -0
- package/dist/engine/quadtree.d.ts +18 -0
- package/dist/engine/session.d.ts +11 -0
- package/dist/engine/signals.d.ts +52 -0
- package/dist/engine/streaming.d.ts +20 -0
- package/dist/engine/time-axis.d.ts +16 -0
- package/dist/engine/version.d.ts +16 -0
- package/dist/engine/views.d.ts +3 -0
- package/dist/index.js +17026 -0
- package/dist/interaction/keyboard.d.ts +16 -0
- package/dist/interaction/touch.d.ts +27 -0
- package/dist/perf/adaptive-complexity.d.ts +45 -0
- package/dist/perf/memory-pressure.d.ts +16 -0
- package/dist/perf/offscreen-canvas-host.d.ts +32 -0
- package/dist/perf/offscreen-canvas.d.ts +50 -0
- package/dist/perf/offscreen-canvas.worker.d.ts +1 -0
- package/dist/perf/shared-array-buffer.d.ts +10 -0
- package/dist/perf/visibility.d.ts +39 -0
- package/dist/perf/webgl-renderer.d.ts +24 -0
- package/dist/perf/wire-memory-pressure.d.ts +2 -0
- package/dist/personalization/accessibility.d.ts +16 -0
- package/dist/personalization/axes/animation.d.ts +33 -0
- package/dist/personalization/axes/area-baseline.d.ts +8 -0
- package/dist/personalization/axes/axis-labels.d.ts +3 -0
- package/dist/personalization/axes/bin-algorithm.d.ts +3 -0
- package/dist/personalization/axes/box-sizing.d.ts +22 -0
- package/dist/personalization/axes/cell-shape.d.ts +3 -0
- package/dist/personalization/axes/curve-type.d.ts +11 -0
- package/dist/personalization/axes/density.d.ts +4 -0
- package/dist/personalization/axes/depth-fill-type.d.ts +3 -0
- package/dist/personalization/axes/depth-limit.d.ts +2 -0
- package/dist/personalization/axes/glow.d.ts +21 -0
- package/dist/personalization/axes/heatmap-color-scale.d.ts +31 -0
- package/dist/personalization/axes/histogram-overlay.d.ts +18 -0
- package/dist/personalization/axes/indicator-pane-spec.d.ts +85 -0
- package/dist/personalization/axes/label-behavior.d.ts +3 -0
- package/dist/personalization/axes/label-content.d.ts +17 -0
- package/dist/personalization/axes/label-placement.d.ts +3 -0
- package/dist/personalization/axes/label-rotation.d.ts +3 -0
- package/dist/personalization/axes/level-highlight.d.ts +14 -0
- package/dist/personalization/axes/line-dash.d.ts +2 -0
- package/dist/personalization/axes/mid-line.d.ts +14 -0
- package/dist/personalization/axes/node-alignment.d.ts +3 -0
- package/dist/personalization/axes/null-behavior.d.ts +3 -0
- package/dist/personalization/axes/number-format.d.ts +18 -0
- package/dist/personalization/axes/pan-zoom.d.ts +42 -0
- package/dist/personalization/axes/pattern.d.ts +26 -0
- package/dist/personalization/axes/point-markers.d.ts +55 -0
- package/dist/personalization/axes/point-opacity.d.ts +6 -0
- package/dist/personalization/axes/point-size.d.ts +23 -0
- package/dist/personalization/axes/price-range.d.ts +9 -0
- package/dist/personalization/axes/radius-proportion.d.ts +3 -0
- package/dist/personalization/axes/regression-line.d.ts +36 -0
- package/dist/personalization/axes/sankey-link-color.d.ts +10 -0
- package/dist/personalization/axes/sankey-value-display.d.ts +4 -0
- package/dist/personalization/axes/small-slice-threshold.d.ts +15 -0
- package/dist/personalization/axes/sort-order.d.ts +3 -0
- package/dist/personalization/axes/spread-display.d.ts +4 -0
- package/dist/personalization/axes/stacking.d.ts +17 -0
- package/dist/personalization/axes/tile-layout.d.ts +3 -0
- package/dist/personalization/axes/time-off-axes.d.ts +19 -0
- package/dist/personalization/axes/treemap-color-scale.d.ts +3 -0
- package/dist/personalization/axes/value-labels.d.ts +21 -0
- package/dist/personalization/axes/view-mode.d.ts +3 -0
- package/dist/personalization/axes/volume-coloring.d.ts +24 -0
- package/dist/personalization/axes/y-axis-mode.d.ts +3 -0
- package/dist/personalization/index.d.ts +38 -0
- package/dist/personalization/locale/formatter.d.ts +45 -0
- package/dist/personalization/locale/resolver.d.ts +22 -0
- package/dist/personalization/palette/built-ins.d.ts +10 -0
- package/dist/personalization/palette/derive.d.ts +35 -0
- package/dist/personalization/palette/index.d.ts +6 -0
- package/dist/personalization/palette/oklch.d.ts +19 -0
- package/dist/personalization/palette/registry.d.ts +7 -0
- package/dist/personalization/palette/tonal-symmetry.d.ts +32 -0
- package/dist/personalization/palette/types.d.ts +63 -0
- package/dist/personalization/personalization.d.ts +137 -0
- package/dist/personalization/tooltip-props.d.ts +40 -0
- package/dist/rendering/canvas.d.ts +6 -0
- package/dist/rendering/color-tables.d.ts +52 -0
- package/dist/rendering/dirty-rect-tracker.d.ts +49 -0
- package/dist/rendering/dirty-rect.d.ts +17 -0
- package/dist/rendering/draw/area-fill-threshold.d.ts +19 -0
- package/dist/rendering/draw/area-fill.d.ts +47 -0
- package/dist/rendering/draw/area-gradient.d.ts +35 -0
- package/dist/rendering/draw/axis.d.ts +65 -0
- package/dist/rendering/draw/bar.d.ts +31 -0
- package/dist/rendering/draw/candle-live-treatment.d.ts +43 -0
- package/dist/rendering/draw/candle.d.ts +101 -0
- package/dist/rendering/draw/connection-indicator.d.ts +30 -0
- package/dist/rendering/draw/crosshair.d.ts +27 -0
- package/dist/rendering/draw/drawings.d.ts +64 -0
- package/dist/rendering/draw/grid.d.ts +20 -0
- package/dist/rendering/draw/indicator-band.d.ts +17 -0
- package/dist/rendering/draw/indicator-line.d.ts +15 -0
- package/dist/rendering/draw/last-price.d.ts +36 -0
- package/dist/rendering/draw/line.d.ts +16 -0
- package/dist/rendering/draw/live-bar.d.ts +31 -0
- package/dist/rendering/draw/markers.d.ts +53 -0
- package/dist/rendering/draw/pane-divider.d.ts +22 -0
- package/dist/rendering/draw/point-markers.d.ts +23 -0
- package/dist/rendering/glow/glow.d.ts +40 -0
- package/dist/rendering/index.d.ts +9 -0
- package/dist/rendering/layers/should-split.d.ts +12 -0
- package/dist/rendering/patterns/cross-hatch.d.ts +4 -0
- package/dist/rendering/patterns/pattern-tiles.d.ts +25 -0
- package/dist/rendering/pipeline.d.ts +21 -0
- package/dist/rendering/stacked-layout.d.ts +23 -0
- package/dist/rendering/standardization-tokens.d.ts +26 -0
- package/dist/rendering/static-layer-cache.d.ts +34 -0
- package/dist/rendering/threshold-split.d.ts +14 -0
- package/dist/shared/binary-search.d.ts +2 -0
- package/dist/shared/typed.d.ts +8 -0
- package/dist/solid/chart-group.d.ts +16 -0
- package/dist/solid/charts-provider.d.ts +38 -0
- package/dist/solid/components/area-chart.d.ts +21 -0
- package/dist/solid/components/bar-chart.d.ts +84 -0
- package/dist/solid/components/candle-chart.d.ts +142 -0
- package/dist/solid/components/chart-group-brush.d.ts +13 -0
- package/dist/solid/components/chart-group-navigator.d.ts +12 -0
- package/dist/solid/components/depth-chart.d.ts +8 -0
- package/dist/solid/components/heatmap-chart.d.ts +8 -0
- package/dist/solid/components/histogram-chart.d.ts +8 -0
- package/dist/solid/components/kagi-chart.d.ts +8 -0
- package/dist/solid/components/line-chart.d.ts +110 -0
- package/dist/solid/components/pie-chart.d.ts +20 -0
- package/dist/solid/components/point-figure-chart.d.ts +8 -0
- package/dist/solid/components/renko-chart.d.ts +8 -0
- package/dist/solid/components/sankey-chart.d.ts +8 -0
- package/dist/solid/components/scatter-chart.d.ts +8 -0
- package/dist/solid/components/sunburst-chart.d.ts +8 -0
- package/dist/solid/components/treemap-chart.d.ts +8 -0
- package/dist/solid/hooks/use-chart-theme.d.ts +2 -0
- package/dist/solid/hooks/use-streaming-candles.d.ts +33 -0
- package/dist/solid/index.d.ts +73 -0
- package/dist/solid/tooltips/default-candle-tooltip.d.ts +4 -0
- package/dist/solid/tooltips/default-extreme-tooltip.d.ts +6 -0
- package/dist/solid/tooltips/default-tooltip.d.ts +4 -0
- package/dist/solid/tooltips/default-volume-bar-tooltip.d.ts +4 -0
- package/dist/solid/tooltips/index.d.ts +4 -0
- package/dist/tickyr_charts_wasm-C-sFYtmv.js +828 -0
- package/dist/viewport/category-axis.d.ts +32 -0
- package/dist/viewport/clip-ticks.d.ts +8 -0
- package/dist/viewport/index.d.ts +6 -0
- package/dist/viewport/nice-ticks.d.ts +9 -0
- package/dist/viewport/nice-time-ticks.d.ts +7 -0
- package/dist/viewport/orientation.d.ts +56 -0
- package/dist/viewport/padded-domain.d.ts +16 -0
- package/dist/viewport/scales/linear.d.ts +9 -0
- package/dist/viewport/scales/log.d.ts +9 -0
- package/dist/viewport/scales/time.d.ts +7 -0
- package/dist/viewport/viewport-sizer.d.ts +15 -0
- package/dist/viewport/visible-window.d.ts +5 -0
- package/package.json +41 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { CandleSeries, LiveState, EventMarker, DrawingType } from '../domain';
|
|
2
|
+
import { Personalization, ChartFormatter } from '../personalization';
|
|
3
|
+
import { CandleType, CandleChartBaseProps, CandleStaleBannerRenderProps, VolumeBarTooltipProps, SignalTooltipProps, OrderTooltipProps, PositionTooltipProps, ExtremeHoverState, HoverState, ResolvedSeriesArrays, CandleChartTooltipProps } from './candle-chart-helpers';
|
|
4
|
+
import { ExtremeTooltipProps } from './line-chart-helpers';
|
|
5
|
+
/** Provider snapshot - same shape as the other chart-controllers. */
|
|
6
|
+
export interface CandleChartProviderSnapshot {
|
|
7
|
+
theme: import('../personalization').ThemeInput;
|
|
8
|
+
palette: string;
|
|
9
|
+
locale: string;
|
|
10
|
+
timeZone: string | undefined;
|
|
11
|
+
visualStyle: import('../personalization').VisualStyle;
|
|
12
|
+
outlineFillColor: "auto" | string;
|
|
13
|
+
outlineFillOpacity: number;
|
|
14
|
+
cornerRadius: number;
|
|
15
|
+
borderWidth: number;
|
|
16
|
+
accents: boolean;
|
|
17
|
+
osTheme: import('../personalization').Theme;
|
|
18
|
+
appTheme: import('../personalization').Theme;
|
|
19
|
+
}
|
|
20
|
+
/** Snapshot of derived state the adapter consumes for JSX. */
|
|
21
|
+
export interface CandleChartRenderContext {
|
|
22
|
+
personalization: Personalization;
|
|
23
|
+
formatter: ChartFormatter;
|
|
24
|
+
resolvedLocaleBase: string;
|
|
25
|
+
resolvedTimeZone: string | undefined;
|
|
26
|
+
series: CandleSeries;
|
|
27
|
+
arr: ResolvedSeriesArrays;
|
|
28
|
+
candleType: CandleType;
|
|
29
|
+
ariaLabel: string;
|
|
30
|
+
isSparkline: boolean;
|
|
31
|
+
cssWidth: number;
|
|
32
|
+
cssHeight: number;
|
|
33
|
+
}
|
|
34
|
+
/** Closest marker under the pointer (within `MARKER_HIT_RADIUS_PX`).
|
|
35
|
+
* Adapter renders the matching tooltip JSX (signal/order/position/event)
|
|
36
|
+
* via the corresponding host-supplied render-prop. */
|
|
37
|
+
export interface MarkerHoverState {
|
|
38
|
+
readonly kind: "signal" | "order" | "position" | "event";
|
|
39
|
+
/** Index in the marker array; `-1` for `'position'` (singleton). */
|
|
40
|
+
readonly idx: number;
|
|
41
|
+
readonly pointerX: number;
|
|
42
|
+
readonly pointerY: number;
|
|
43
|
+
}
|
|
44
|
+
export interface CandleChartControllerCallbacks {
|
|
45
|
+
onContextChange(ctx: CandleChartRenderContext): void;
|
|
46
|
+
onHoverChange(hover: HoverState | null): void;
|
|
47
|
+
onExtremeHoverChange(eh: ExtremeHoverState | null): void;
|
|
48
|
+
onLiveStateChange(s: LiveState): void;
|
|
49
|
+
onReducedMotionChange(v: boolean): void;
|
|
50
|
+
/** Whether a drawing tool is armed (host's UI typically reflects this
|
|
51
|
+
* with a pressed-button state on the toolbar). */
|
|
52
|
+
onArmedToolChange(isDrawing: boolean): void;
|
|
53
|
+
/** Internal selection - fires when the controller's state changes. The
|
|
54
|
+
* host can also pass `selectedDrawingId` as a controlled prop, in
|
|
55
|
+
* which case this fires only when the host clears its prop and the
|
|
56
|
+
* controller takes over. */
|
|
57
|
+
onSelectedDrawingIdChange(id: string | undefined): void;
|
|
58
|
+
/** Drawing currently under the pointer (used by `drawingHandlesMode:
|
|
59
|
+
* 'on-hover'`). `undefined` when the cursor is over empty area. */
|
|
60
|
+
onHoverDrawingIdChange(id: string | undefined): void;
|
|
61
|
+
/** Closest marker (signal/order/position/event) under the pointer; `null`
|
|
62
|
+
* when nothing is in range. Adapter renders the matching tooltip JSX. */
|
|
63
|
+
onMarkerHoverChange(marker: MarkerHoverState | null): void;
|
|
64
|
+
/** Theme-cross-fade key - incremented every time `personalization.theme`
|
|
65
|
+
* flips (light↔dark). Adapter uses it as a React `key` on the static
|
|
66
|
+
* canvas to retrigger a CSS opacity-fade animation. Initial mount
|
|
67
|
+
* emits `0`; subsequent flips emit `1`, `2`, … so the adapter can
|
|
68
|
+
* skip the fade on first render. */
|
|
69
|
+
onThemeFadeKeyChange(key: number): void;
|
|
70
|
+
/** Whether the pointer is currently over the volume-pane divider band
|
|
71
|
+
* (within `PANE_DRAG_HANDLE_PX`). Adapter swaps the cursor to
|
|
72
|
+
* `row-resize` when `true`. */
|
|
73
|
+
onOverDividerChange(over: boolean): void;
|
|
74
|
+
}
|
|
75
|
+
/** Controller-specific prop type. Extends the framework-agnostic
|
|
76
|
+
* `CandleChartBaseProps` (in `candle-chart-helpers.ts`) with the eight
|
|
77
|
+
* render-prop fields whose return type is widened to `unknown` so both
|
|
78
|
+
* the React adapter (returns `React.ReactNode`) and the Solid adapter
|
|
79
|
+
* (returns `JSX.Element`) pass type-check via covariance. */
|
|
80
|
+
export interface CandleChartControllerProps extends CandleChartBaseProps {
|
|
81
|
+
tooltip?: undefined | false | ((p: CandleChartTooltipProps) => unknown);
|
|
82
|
+
extremeTooltip?: boolean | ((p: ExtremeTooltipProps) => unknown);
|
|
83
|
+
volumeBarTooltip?: boolean | ((p: VolumeBarTooltipProps) => unknown);
|
|
84
|
+
staleBanner?: boolean | ((p: CandleStaleBannerRenderProps) => unknown);
|
|
85
|
+
signalTooltip?: false | ((p: SignalTooltipProps) => unknown);
|
|
86
|
+
orderTooltip?: false | ((p: OrderTooltipProps) => unknown);
|
|
87
|
+
positionTooltip?: false | ((p: PositionTooltipProps) => unknown);
|
|
88
|
+
eventTooltip?: false | ((p: {
|
|
89
|
+
marker: EventMarker;
|
|
90
|
+
pointerX: number;
|
|
91
|
+
pointerY: number;
|
|
92
|
+
formatter: ChartFormatter;
|
|
93
|
+
}) => unknown);
|
|
94
|
+
}
|
|
95
|
+
export interface CandleChartControllerMountOptions extends CandleChartControllerCallbacks {
|
|
96
|
+
/** The chart's outer container DOM node. Used by the visibility source
|
|
97
|
+
* to pause draws when scrolled off-screen. May be null (e.g. in
|
|
98
|
+
* controller-only test harnesses) - visibility then falls back to a
|
|
99
|
+
* page-visibility-only stub. */
|
|
100
|
+
container?: HTMLElement | null;
|
|
101
|
+
staticCanvas: HTMLCanvasElement;
|
|
102
|
+
dynamicCanvas: HTMLCanvasElement | null;
|
|
103
|
+
initialProps: CandleChartControllerProps;
|
|
104
|
+
initialProvider: CandleChartProviderSnapshot;
|
|
105
|
+
}
|
|
106
|
+
export declare class CandleChartController {
|
|
107
|
+
private staticCanvas;
|
|
108
|
+
private dynamicCanvas;
|
|
109
|
+
private callbacks;
|
|
110
|
+
private props;
|
|
111
|
+
private providerCtx;
|
|
112
|
+
private handle;
|
|
113
|
+
private hoverState;
|
|
114
|
+
private extremeHoverState;
|
|
115
|
+
private dynCfg;
|
|
116
|
+
private liveStateInputs;
|
|
117
|
+
private reducedMotion;
|
|
118
|
+
private liveState;
|
|
119
|
+
private crosshairAlpha;
|
|
120
|
+
private armedTool;
|
|
121
|
+
private internalSelectedId;
|
|
122
|
+
private hoverDrawingId;
|
|
123
|
+
private keydownCleanup;
|
|
124
|
+
private markerHover;
|
|
125
|
+
private themeFadeKey;
|
|
126
|
+
private prevTheme;
|
|
127
|
+
private volumeHeightRatio;
|
|
128
|
+
private dividerDrag;
|
|
129
|
+
private overDivider;
|
|
130
|
+
/** External (prop-provided) volume ratio. When the prop changes, we
|
|
131
|
+
* reset our internal state to it; user drag mutations override until
|
|
132
|
+
* the prop changes again. */
|
|
133
|
+
private propVolumeHeightRatio;
|
|
134
|
+
private crosshairFadeAnim;
|
|
135
|
+
private crosshairFadeRafId;
|
|
136
|
+
private zoomWindow;
|
|
137
|
+
private panDrag;
|
|
138
|
+
/** Visible slice of `arr` after applying `zoomWindow`. When the window
|
|
139
|
+
* is null, this aliases `arr`. Used for layout + drawFullCandleChart. */
|
|
140
|
+
private visibleArr;
|
|
141
|
+
private animState;
|
|
142
|
+
private animationRafId;
|
|
143
|
+
private bgChromeCanvas;
|
|
144
|
+
private fgChromeCanvas;
|
|
145
|
+
/** Closure captured at the end of `runStaticDraw()` that knows how to
|
|
146
|
+
* composite the chrome caches + bars-only draw. Invoked per
|
|
147
|
+
* animation rAF tick - bypasses the full static-draw path so axes /
|
|
148
|
+
* text / drawings / markers stay cached. */
|
|
149
|
+
private directRedraw;
|
|
150
|
+
private series;
|
|
151
|
+
private historySeries;
|
|
152
|
+
private combinedSeries;
|
|
153
|
+
/** Dirty-rect tracking for partial dynamic-layer repaints.
|
|
154
|
+
* Crosshair / marker overlays disturb only thin
|
|
155
|
+
* strips + live-bar zone - clipping to those rectangles gives a
|
|
156
|
+
* real GPU-fill saving. Auto-disabled below `shouldUseDirtyRects`
|
|
157
|
+
* threshold; force-disabled via `partialRepaints: false` prop. */
|
|
158
|
+
private dirtyRing;
|
|
159
|
+
private dirtyScratch;
|
|
160
|
+
private useDirtyRects;
|
|
161
|
+
private prevHoverSnapX;
|
|
162
|
+
private prevHoverSnapY;
|
|
163
|
+
private prevHoverActive;
|
|
164
|
+
/** Unified marker quadtree. Holds POINT
|
|
165
|
+
* markers - signals + events - at their resolved (px, py) coords.
|
|
166
|
+
* ID encoded as `(kind << 24) | idx` so a single .nearest query
|
|
167
|
+
* resolves to a (kind, idx) pair without per-pointer-event linear
|
|
168
|
+
* scans. Order + position markers stay linear-tested because they
|
|
169
|
+
* are horizontal-LINE markers (any-x at a fixed y), not points,
|
|
170
|
+
* and a point quadtree wouldn't accelerate them. */
|
|
171
|
+
private markerQuadtree;
|
|
172
|
+
private markerQuadtreeBuilding;
|
|
173
|
+
/** Live last-bar overlay accumulated by `onTick(t, p, s)`. When set,
|
|
174
|
+
* resolveDerived applies it to the most recent bar (high/low/close/
|
|
175
|
+
* volume update - open is preserved from `props.data`). Reset whenever
|
|
176
|
+
* `props.data` changes identity. */
|
|
177
|
+
private liveLastBar;
|
|
178
|
+
private liveLastBarSourceId;
|
|
179
|
+
/** rAF coalescer for onTick - multiple ticks in one frame yield a
|
|
180
|
+
* single static-draw call. */
|
|
181
|
+
private onTickRafId;
|
|
182
|
+
/** Engine-backed streaming aggregator. Created lazily on the first
|
|
183
|
+
* `onTick()` call when `props.streaming` is configured; otherwise
|
|
184
|
+
* null and onTick falls through to JS-side last-bar mutation. */
|
|
185
|
+
private streamingEngine;
|
|
186
|
+
private streamingMarket;
|
|
187
|
+
/** Reused AggregationEvent scratch - engine writes into this per
|
|
188
|
+
* pushTick (zero allocation per tick). */
|
|
189
|
+
private streamingEventScratch;
|
|
190
|
+
/** Identity of the `streaming` config we built the engine against;
|
|
191
|
+
* changes → engine is torn down + rebuilt next tick. */
|
|
192
|
+
private streamingConfigId;
|
|
193
|
+
/** Pending engine-driven bars appended past `props.data` - when
|
|
194
|
+
* `Engine.pushTick` returns `AppendNew`, we append a fresh bar
|
|
195
|
+
* here so subsequent draws render the engine-aggregated history. */
|
|
196
|
+
private streamingAppendedTimes;
|
|
197
|
+
private streamingAppendedOpens;
|
|
198
|
+
private streamingAppendedHighs;
|
|
199
|
+
private streamingAppendedLows;
|
|
200
|
+
private streamingAppendedCloses;
|
|
201
|
+
private streamingAppendedVolumes;
|
|
202
|
+
private streamingAppendedLength;
|
|
203
|
+
private streamingAppendedCapacity;
|
|
204
|
+
/** VWAP overlay values. Computed once per static-draw when
|
|
205
|
+
* `props.vwap` is configured + volumes are present. `null` when
|
|
206
|
+
* inactive. Value math is
|
|
207
|
+
* the engine's `vwap(highs, lows, closes, volumes, sessionStarts)`. */
|
|
208
|
+
private vwapValues;
|
|
209
|
+
private combinedArr;
|
|
210
|
+
private arr;
|
|
211
|
+
private personalization;
|
|
212
|
+
private resolvedLocale;
|
|
213
|
+
private formatter;
|
|
214
|
+
private candleType;
|
|
215
|
+
private isSparkline;
|
|
216
|
+
/** Resolved animation axes - clamped by reducedMotion. */
|
|
217
|
+
private animSettings;
|
|
218
|
+
private mqCleanup;
|
|
219
|
+
private staleTimeoutId;
|
|
220
|
+
private indicatorAbort;
|
|
221
|
+
private rafId;
|
|
222
|
+
private staticDrawAbort;
|
|
223
|
+
private disposed;
|
|
224
|
+
/** Visibility source - pauses the rAF loop when the chart is hidden
|
|
225
|
+
* (tab background / scrolled off-screen). */
|
|
226
|
+
private visibility;
|
|
227
|
+
private visibilityUnsubscribe;
|
|
228
|
+
/** Watermark subscription - when `props.watermark` is `{ image: src }`,
|
|
229
|
+
* the global `_watermarkSubscribers` set fires this on image load
|
|
230
|
+
* so we can re-run the static draw to paint the now-decoded bitmap. */
|
|
231
|
+
private watermarkSub;
|
|
232
|
+
constructor(opts: CandleChartControllerMountOptions);
|
|
233
|
+
/** Arm a drawing tool. The next pointerdown captures anchor #1; subsequent
|
|
234
|
+
* pointerdowns capture additional anchors; once `ANCHOR_COUNTS[type]`
|
|
235
|
+
* anchors are captured, the drawing commits via `props.onDrawingsChange`
|
|
236
|
+
* and the tool disarms. Hosts typically call this from a toolbar button. */
|
|
237
|
+
startDrawing(type: DrawingType): void;
|
|
238
|
+
/** Cancel an in-flight drawing without committing. */
|
|
239
|
+
cancelDrawing(): void;
|
|
240
|
+
/** Whether a drawing tool is currently armed. */
|
|
241
|
+
isDrawing(): boolean;
|
|
242
|
+
update(props: CandleChartControllerProps, providerCtx: CandleChartProviderSnapshot): void;
|
|
243
|
+
handlePointerMove(e: PointerEvent): void;
|
|
244
|
+
handlePointerLeave(): void;
|
|
245
|
+
/** Pointer-up - releases an in-flight pan-drag or divider-drag. */
|
|
246
|
+
handlePointerUp(e?: PointerEvent): void;
|
|
247
|
+
/** Wheel handler - zoom-around-cursor. Updates `zoomWindow` and
|
|
248
|
+
* re-runs static draw. Snap-zoom (no smoothing
|
|
249
|
+
* rAF) for now; smoothing is a future extension that adds an rAF
|
|
250
|
+
* ramp over `panZoomSmoothing`-resolved duration. */
|
|
251
|
+
handleWheel(e: WheelEvent): void;
|
|
252
|
+
/** Pointerdown handles three roles depending on state:
|
|
253
|
+
* 1. If a drawing tool is armed: capture the next anchor at the
|
|
254
|
+
* pointer's data-coordinate. When `ANCHOR_COUNTS[type]` anchors
|
|
255
|
+
* are captured, commit the drawing via `props.onDrawingsChange`
|
|
256
|
+
* and disarm the tool.
|
|
257
|
+
* 2. If no tool is armed and the pointer is over an existing drawing:
|
|
258
|
+
* select that drawing.
|
|
259
|
+
* 3. Otherwise: clear selection. */
|
|
260
|
+
handlePointerDown(e: PointerEvent): void;
|
|
261
|
+
/** Imperative live-tick API. Two modes:
|
|
262
|
+
*
|
|
263
|
+
* **Engine-backed (preferred):** when `props.streaming` is set the
|
|
264
|
+
* controller routes ticks through the engine's `Engine.pushTick`
|
|
265
|
+
* for validate-then-aggregate semantics. The engine handles bucket
|
|
266
|
+
* transitions, anomaly detection, and OHLC math correctly. On
|
|
267
|
+
* `AppendNew` events the new bar is appended to the visible series.
|
|
268
|
+
*
|
|
269
|
+
* **JS-side (fallback):** updates high/low/close of the current last
|
|
270
|
+
* bar in-place. Open is preserved - host owns bar progression (call
|
|
271
|
+
* `update({ data })` with a fresh last bar to start a new bucket).
|
|
272
|
+
*
|
|
273
|
+
* Multiple ticks per rAF coalesce into a single static-draw call.
|
|
274
|
+
* Primitive args - no per-tick object allocation. */
|
|
275
|
+
onTick(time: number, price: number, size?: number): void;
|
|
276
|
+
/** Manual last-bar mutation path. Host owns bar progression. */
|
|
277
|
+
private routeTickJsSide;
|
|
278
|
+
/** Engine-backed path. Lazy-spawns the streaming engine on first
|
|
279
|
+
* use; routes the tick through `Engine.pushTick`; folds the result
|
|
280
|
+
* into either the live-bar overlay (`MutateLast`) or the appended
|
|
281
|
+
* ring (`AppendNew`). */
|
|
282
|
+
private routeTickThroughEngine;
|
|
283
|
+
/** Compute the live-bar overlay for the most recent visible bar based
|
|
284
|
+
* on the engine's `MutateLast` event. */
|
|
285
|
+
private applyLiveLastBarFromEvent;
|
|
286
|
+
/** Grow the engine-bar ring + append the freshly-closed bar. */
|
|
287
|
+
private appendEngineBar;
|
|
288
|
+
/** Concatenate engine-appended bars onto the host-provided series.
|
|
289
|
+
* Allocates one set of typed arrays per static draw. */
|
|
290
|
+
private appendEngineBarsToSeries;
|
|
291
|
+
/** Internal: clone the base series's last bar with live-tick
|
|
292
|
+
* high/low/close/volume merged in. Open is preserved. Allocates one
|
|
293
|
+
* set of typed arrays per static draw. */
|
|
294
|
+
private applyLiveLastBar;
|
|
295
|
+
dispose(): void;
|
|
296
|
+
private setHover;
|
|
297
|
+
private setExtremeHover;
|
|
298
|
+
private setMarkerHover;
|
|
299
|
+
private setSelectedDrawingId;
|
|
300
|
+
private setHoverDrawingId;
|
|
301
|
+
/** Build a `DrawCtx` for hit-test against drawings. Mirrors the
|
|
302
|
+
* shape `drawDrawing` consumes; `selected` is unused here so we
|
|
303
|
+
* pass a placeholder. */
|
|
304
|
+
private makeDrawCtx;
|
|
305
|
+
/** Esc keydown handler. Cancels an in-flight drawing tool, otherwise
|
|
306
|
+
* deletes the selected drawing (if any) and `drawingDeleteOnEsc` is
|
|
307
|
+
* not disabled. */
|
|
308
|
+
private setupKeydownListener;
|
|
309
|
+
private repaintDynamic;
|
|
310
|
+
/** Push V-strip + H-strip + marker-dot + live-bar-zone rects into
|
|
311
|
+
* the dirty ring covering both the previous and current hover
|
|
312
|
+
* positions. */
|
|
313
|
+
private pushDynamicDirtyRects;
|
|
314
|
+
private resolveDerived;
|
|
315
|
+
private applyDynamicCfgFromProps;
|
|
316
|
+
private applyLiveStateInputsFromProps;
|
|
317
|
+
private setupReducedMotionWatcher;
|
|
318
|
+
private tearDownReducedMotionWatcher;
|
|
319
|
+
private kickStaleTimeout;
|
|
320
|
+
private kickRafLoop;
|
|
321
|
+
private tearDownRafLoop;
|
|
322
|
+
/** Detect data changes since the previous prop snapshot. Mounts the
|
|
323
|
+
* entry animation once on first 0→N transition; later last-bar
|
|
324
|
+
* mutations (same length, new lastClose) trigger the update animation.
|
|
325
|
+
* Mirrors the React adapter's detect-data-changes useEffect. */
|
|
326
|
+
private detectDataChanges;
|
|
327
|
+
/** Animation rAF - engages only while entry or update is in flight.
|
|
328
|
+
* This loop does NOT trigger any state
|
|
329
|
+
* change; it mutates `animState` in place and invokes `directRedraw`
|
|
330
|
+
* which composites the chrome cache + paints just the bars. No
|
|
331
|
+
* layout rebuild. */
|
|
332
|
+
private kickAnimationRaf;
|
|
333
|
+
private tearDownAnimationRaf;
|
|
334
|
+
/** Crosshair fade - ramps `crosshairAlpha` toward `target` over
|
|
335
|
+
* `personalization.crosshairFadeDuration` ms. The rAF
|
|
336
|
+
* body mutates state in place, no allocations per frame. Instant
|
|
337
|
+
* (no rAF) when duration === 0 or already at target. */
|
|
338
|
+
private kickCrosshairFade;
|
|
339
|
+
private tearDownCrosshairFadeRaf;
|
|
340
|
+
/** When `props.watermark` is `{ image: src }`, the watermark image
|
|
341
|
+
* loads asynchronously via the global cache. Subscribe so the chart
|
|
342
|
+
* can re-run static draw once the image is decoded - the bitmap then
|
|
343
|
+
* composites into the FG chrome offscreen on the next paint. */
|
|
344
|
+
private setupWatermarkSubscription;
|
|
345
|
+
private tearDownWatermarkSubscription;
|
|
346
|
+
private runStaticDraw;
|
|
347
|
+
/** Build (or rebuild) the unified marker quadtree. Async because the
|
|
348
|
+
* engine's Quadtree ctor lives in WASM; the pointer-query path is
|
|
349
|
+
* sync. While rebuild is in flight the previous tree continues to
|
|
350
|
+
* serve queries (stale coords); we swap on completion. */
|
|
351
|
+
private kickMarkerQuadtreeRebuild;
|
|
352
|
+
}
|
|
353
|
+
export type { CandleType, HoverState, ExtremeHoverState, ChartHandle, ChartLayout, DynamicCfg, ResolvedSeriesArrays, IndicatorComputeResult, LiveStateInputs, CandleChartBaseProps, } from './candle-chart-helpers';
|