@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,101 @@
|
|
|
1
|
+
export interface DrawCandleBodyArgs {
|
|
2
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
3
|
+
/** Body center x in CSS px. */
|
|
4
|
+
readonly x: number;
|
|
5
|
+
/** Half body width in CSS px. Total body footprint = 2 * halfBodyW. */
|
|
6
|
+
readonly halfBodyW: number;
|
|
7
|
+
/** Top y (smaller pixel value; canvas y grows downward). */
|
|
8
|
+
readonly bodyTop: number;
|
|
9
|
+
/** Bottom y (larger pixel value). Must be ≥ bodyTop (caller-clamped). */
|
|
10
|
+
readonly bodyBottom: number;
|
|
11
|
+
/** Per-corner radius (uniform on candle bodies). 0 = sharp. */
|
|
12
|
+
readonly cornerRadius: number;
|
|
13
|
+
/** Fill style. `null` skips the fill (Outline + opacity-0 case). */
|
|
14
|
+
readonly fillStyle: string | null;
|
|
15
|
+
/** Stroke color. `null` skips the stroke. */
|
|
16
|
+
readonly strokeStyle: string | null;
|
|
17
|
+
/** Stroke width in CSS px. Ignored when strokeStyle is null. */
|
|
18
|
+
readonly strokeWidth: number;
|
|
19
|
+
}
|
|
20
|
+
/** Draws a candle body - a rounded-rectangle delegated to drawBar.
|
|
21
|
+
* Bodies always have all-round corners (cornerRadius applies uniformly to
|
|
22
|
+
* all four; this differs from BarChart's bar-on-baseline rule because a
|
|
23
|
+
* candle body doesn't sit on a baseline - it spans open ↔ close). */
|
|
24
|
+
/** @ZeroAlloc - per-bar primitive. No heap allocation per call. */
|
|
25
|
+
export declare function drawCandleBody(args: DrawCandleBodyArgs & {
|
|
26
|
+
readonly patternFill?: CanvasPattern | null;
|
|
27
|
+
}): void;
|
|
28
|
+
export interface DrawCandleWickArgs {
|
|
29
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
30
|
+
/** Wick center x in CSS px (matches body center). */
|
|
31
|
+
readonly x: number;
|
|
32
|
+
/** Top y (smaller pixel value, corresponds to the high). */
|
|
33
|
+
readonly wickTop: number;
|
|
34
|
+
/** Bottom y (larger pixel value, corresponds to the low). */
|
|
35
|
+
readonly wickBottom: number;
|
|
36
|
+
/** Body's top y (smaller pixel value). The wick is SPLIT around the
|
|
37
|
+
* body - the upper segment ends here and the lower segment never
|
|
38
|
+
* enters here. Required because Outline-mode bodies have a translucent
|
|
39
|
+
* interior and any wick drawn through them would visibly bleed
|
|
40
|
+
* through (canonical candle rendering: wick is logically outside the
|
|
41
|
+
* body - the body's edges already convey open/close). */
|
|
42
|
+
readonly bodyTop: number;
|
|
43
|
+
/** Body's bottom y (larger pixel value). The lower wick segment
|
|
44
|
+
* starts here. */
|
|
45
|
+
readonly bodyBottom: number;
|
|
46
|
+
/** Stroke width in CSS px (default 1.4). */
|
|
47
|
+
readonly lineWidth: number;
|
|
48
|
+
/** Stroke color. */
|
|
49
|
+
readonly strokeStyle: string;
|
|
50
|
+
}
|
|
51
|
+
/** Draws a candle wick as TWO segments around the body - upper from the
|
|
52
|
+
* high to the body's top edge, lower from the body's bottom edge to the
|
|
53
|
+
* low. The wick never crosses the body interior, so translucent
|
|
54
|
+
* (Outline-style) bodies don't get visible bleed-through and opaque
|
|
55
|
+
* bodies don't waste overdraw. Either segment skips when its length
|
|
56
|
+
* collapses to zero (e.g. high == body-top, low == body-bottom).
|
|
57
|
+
*
|
|
58
|
+
* No pixel-snapping: the wick renders at exactly the input `x` so it
|
|
59
|
+
* stays centered on the body (which doesn't pixel-snap either - body
|
|
60
|
+
* width can be any sub-pixel value via `bodyWidthRatio` × slot, and
|
|
61
|
+
* slot pitch is rarely integer at typical viewport sizes). At sub-
|
|
62
|
+
* pixel `x` the canvas anti-aliases the stroke; that's acceptable
|
|
63
|
+
* because the alternative - snapping the wick alone - drifts up to
|
|
64
|
+
* 0.8 px off the body's visible center, which is visibly wrong. */
|
|
65
|
+
/** @ZeroAlloc - per-bar primitive. No heap allocation per call. */
|
|
66
|
+
export declare function drawCandleWick(args: DrawCandleWickArgs): void;
|
|
67
|
+
export interface DrawOhlcBarArgs {
|
|
68
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
69
|
+
/** Bar center x in CSS px. */
|
|
70
|
+
readonly x: number;
|
|
71
|
+
/** Half tick width in CSS px. Total open/close tick footprint =
|
|
72
|
+
* 2 * halfTickW (each tick spans halfTickW pixels from x). Each
|
|
73
|
+
* tick = 0.5 × bodyWidthRatio × slotWidth, so halfTickW =
|
|
74
|
+
* 0.5 × halfBodyW. The caller computes this. */
|
|
75
|
+
readonly halfTickW: number;
|
|
76
|
+
/** Top y (smaller pixel value, corresponds to the high). */
|
|
77
|
+
readonly highY: number;
|
|
78
|
+
/** Bottom y (larger pixel value, corresponds to the low). */
|
|
79
|
+
readonly lowY: number;
|
|
80
|
+
/** Open-tick y (the y at which the open price renders). Tick extends
|
|
81
|
+
* LEFT of x by halfTickW. */
|
|
82
|
+
readonly openY: number;
|
|
83
|
+
/** Close-tick y. Tick extends RIGHT of x by halfTickW. */
|
|
84
|
+
readonly closeY: number;
|
|
85
|
+
/** Stroke width in CSS px. */
|
|
86
|
+
readonly lineWidth: number;
|
|
87
|
+
/** Stroke color (direction-aware: palette.up if close ≥ open, else
|
|
88
|
+
* palette.down - caller resolves; this primitive just paints). */
|
|
89
|
+
readonly strokeStyle: string;
|
|
90
|
+
}
|
|
91
|
+
/** Draws a Western-style OHLC bar - vertical High–Low line, open tick to
|
|
92
|
+
* the left, close tick to the right. Three line ops in a single
|
|
93
|
+
* beginPath/stroke (one canvas op for the whole bar).
|
|
94
|
+
*
|
|
95
|
+
* No pixel-snapping (consistent with `drawCandleWick`): renders at the
|
|
96
|
+
* input `x` / `openY` / `closeY` exactly. Pixel-snapping the bar
|
|
97
|
+
* centerline while leaving body geometry unsnapped causes visible
|
|
98
|
+
* centering drift (see candle wick rationale); for OHLC there's no
|
|
99
|
+
* body but consistency matters for cross-chart visual stability and
|
|
100
|
+
* for accurately representing the open / close prices' actual y. */
|
|
101
|
+
export declare function drawOhlcBar(args: DrawOhlcBarArgs): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LiveState } from '../../domain';
|
|
2
|
+
import { ConnectionIndicator, LegendPosition, VisualStyle } from '../../personalization';
|
|
3
|
+
export interface DrawConnectionIndicatorArgs {
|
|
4
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
5
|
+
readonly mode: ConnectionIndicator;
|
|
6
|
+
readonly state: LiveState;
|
|
7
|
+
readonly position: LegendPosition;
|
|
8
|
+
readonly visualStyle: VisualStyle;
|
|
9
|
+
/** Pre-resolved CSS rgba strings per state (caller picks from palette). */
|
|
10
|
+
readonly liveColor: string;
|
|
11
|
+
readonly staleColor: string;
|
|
12
|
+
readonly disconnectedColor: string;
|
|
13
|
+
/** Chart background color - used for pill Outline fill + behind-text. */
|
|
14
|
+
readonly bgColor: string;
|
|
15
|
+
/** Pre-resolved foreground (label text). */
|
|
16
|
+
readonly textColor: string;
|
|
17
|
+
/** Inner draw rect - anchor sits inside this with a small inset. */
|
|
18
|
+
readonly innerLeft: number;
|
|
19
|
+
readonly innerRight: number;
|
|
20
|
+
readonly innerTop: number;
|
|
21
|
+
readonly innerBottom: number;
|
|
22
|
+
/** Font + size for the indicator text. */
|
|
23
|
+
readonly font: string;
|
|
24
|
+
readonly fontSize: number;
|
|
25
|
+
/** ms clock for halo pulse phase. */
|
|
26
|
+
readonly now: number;
|
|
27
|
+
/** Collapse halo pulse to static when true. */
|
|
28
|
+
readonly reducedMotion: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function drawConnectionIndicator(args: DrawConnectionIndicatorArgs): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GridStyle } from './grid';
|
|
2
|
+
export type CrosshairMarker = "none" | "circle" | "square";
|
|
3
|
+
export interface DrawCrosshairArgs {
|
|
4
|
+
ctx: CanvasRenderingContext2D;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
innerLeftPx: number;
|
|
8
|
+
innerRightPx: number;
|
|
9
|
+
innerTopPx: number;
|
|
10
|
+
innerBottomPx: number;
|
|
11
|
+
lineColor: string;
|
|
12
|
+
lineWidth: number;
|
|
13
|
+
lineStyle: GridStyle;
|
|
14
|
+
marker: CrosshairMarker;
|
|
15
|
+
markerSize: number;
|
|
16
|
+
/** Inner color (the "dot in the middle"). Typically the chart background
|
|
17
|
+
* so the marker reads as a donut on top of the line. */
|
|
18
|
+
markerFill: string;
|
|
19
|
+
/** Outer ring color (typically the series line color). */
|
|
20
|
+
markerStroke: string;
|
|
21
|
+
/** Ring thickness in CSS px. Default 2 - wide enough that the donut
|
|
22
|
+
* reads at a glance against a busy chart. */
|
|
23
|
+
markerStrokeWidth?: number;
|
|
24
|
+
}
|
|
25
|
+
/** @ZeroAlloc - runs on every pointermove + dynamic-layer frame. No
|
|
26
|
+
* heap allocation; canvas primitives only. */
|
|
27
|
+
export declare function drawCrosshair(args: DrawCrosshairArgs): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Drawing } from '../../domain/drawings';
|
|
2
|
+
export interface DrawCtx {
|
|
3
|
+
ctx: CanvasRenderingContext2D;
|
|
4
|
+
/** Project a data-anchor (t, y) into pixel coords. */
|
|
5
|
+
toPxX: (t: number) => number;
|
|
6
|
+
toPxY: (y: number) => number;
|
|
7
|
+
/** Plot rect (in CSS px) - used for full-width / full-height lines
|
|
8
|
+
* and for clipping. */
|
|
9
|
+
innerLeft: number;
|
|
10
|
+
innerRight: number;
|
|
11
|
+
innerTop: number;
|
|
12
|
+
innerBottom: number;
|
|
13
|
+
/** Default stroke + fill resolved by the chart from palette /
|
|
14
|
+
* drawingDefault* axes. The drawing's own `style.color` overrides. */
|
|
15
|
+
defaultColor: string;
|
|
16
|
+
defaultLineWidth: number;
|
|
17
|
+
defaultLineStyle: "solid" | "dashed" | "dotted";
|
|
18
|
+
defaultFillOpacity: number;
|
|
19
|
+
/** Selected? Adds a subtle highlight + shows handles. */
|
|
20
|
+
selected: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function drawTrendLine(d: Drawing, dctx: DrawCtx): void;
|
|
23
|
+
export declare function drawHorizontalLine(d: Drawing, dctx: DrawCtx): void;
|
|
24
|
+
export declare function drawVerticalLine(d: Drawing, dctx: DrawCtx): void;
|
|
25
|
+
export declare function drawRectangle(d: Drawing, dctx: DrawCtx): void;
|
|
26
|
+
export declare function drawEllipse(d: Drawing, dctx: DrawCtx): void;
|
|
27
|
+
export declare function drawArrow(d: Drawing, dctx: DrawCtx): void;
|
|
28
|
+
export declare function drawTextDrawing(d: Drawing, dctx: DrawCtx): void;
|
|
29
|
+
export declare function drawFibRetracement(d: Drawing, dctx: DrawCtx): void;
|
|
30
|
+
export declare function drawFibExtension(d: Drawing, dctx: DrawCtx): void;
|
|
31
|
+
export declare function drawPitchfork(d: Drawing, dctx: DrawCtx): void;
|
|
32
|
+
export declare function drawChannel(d: Drawing, dctx: DrawCtx): void;
|
|
33
|
+
export declare function drawBrush(d: Drawing, dctx: DrawCtx): void;
|
|
34
|
+
/** Single dispatch entry point. Switches on `type` and calls the
|
|
35
|
+
* per-type primitive. Dispatch via discriminated
|
|
36
|
+
* union - no Object.keys / iteration / typeof checks. */
|
|
37
|
+
export declare function drawDrawing(d: Drawing, dctx: DrawCtx): void;
|
|
38
|
+
/** Distance from point (px, py) to the closest pixel on drawing `d`.
|
|
39
|
+
* Used by the chart's hit-test path. Returns Infinity when the point
|
|
40
|
+
* is outside the drawing's bounding region. */
|
|
41
|
+
export declare function distanceToDrawing(d: Drawing, px: number, py: number, dctx: DrawCtx): number;
|
|
42
|
+
/** Fast bounding-box pre-filter for hit-test pipelines that iterate
|
|
43
|
+
* many drawings (100+). Returns the px-space bbox of `d` plus a small
|
|
44
|
+
* margin equal to `hitRadius`. Drawings whose bbox excludes the pointer
|
|
45
|
+
* can skip the more expensive `distanceToDrawing` compute.
|
|
46
|
+
*
|
|
47
|
+
* Coarse spatial filter; full quadtree integration
|
|
48
|
+
* would need an async WASM Quadtree per drawings update which is heavier
|
|
49
|
+
* than this O(N) bbox scan justifies for typical N < 1000. */
|
|
50
|
+
export declare function drawingBoundsPx(d: Drawing, dctx: DrawCtx, hitRadius?: number): {
|
|
51
|
+
left: number;
|
|
52
|
+
top: number;
|
|
53
|
+
right: number;
|
|
54
|
+
bottom: number;
|
|
55
|
+
};
|
|
56
|
+
/** Optimized multi-drawing hit-test. Iterates drawings once, applying
|
|
57
|
+
* the bbox prefilter; only drawings whose bbox encloses the pointer
|
|
58
|
+
* fall through to the full `distanceToDrawing` compute. Returns the
|
|
59
|
+
* closest hit within `hitRadius` (CSS px), or null. */
|
|
60
|
+
export declare function findDrawingAt(drawings: readonly Drawing[], px: number, py: number, dctx: DrawCtx, hitRadius?: number): {
|
|
61
|
+
id: string;
|
|
62
|
+
distance: number;
|
|
63
|
+
} | null;
|
|
64
|
+
export declare function drawHandles(d: Drawing, dctx: DrawCtx): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LinearScale } from '../../viewport/scales/linear';
|
|
2
|
+
import { YAxisTickLike, XAxisTickLike } from './axis';
|
|
3
|
+
export type GridStyle = "solid" | "dashed" | "dotted";
|
|
4
|
+
export interface DrawGridArgs {
|
|
5
|
+
ctx: CanvasRenderingContext2D;
|
|
6
|
+
innerLeftPx: number;
|
|
7
|
+
innerRightPx: number;
|
|
8
|
+
innerTopPx: number;
|
|
9
|
+
innerBottomPx: number;
|
|
10
|
+
yTicks: readonly YAxisTickLike[];
|
|
11
|
+
yScale: LinearScale;
|
|
12
|
+
xTicks: readonly XAxisTickLike[];
|
|
13
|
+
xToPx: (tMs: number) => number;
|
|
14
|
+
color: string;
|
|
15
|
+
width: number;
|
|
16
|
+
style: GridStyle;
|
|
17
|
+
horizontalsVisible: boolean;
|
|
18
|
+
verticalsVisible: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function drawGrid(args: DrawGridArgs): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface DrawIndicatorBandArgs {
|
|
2
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
3
|
+
readonly times: Float64Array;
|
|
4
|
+
/** Upper bound (e.g. Bollinger +2σ). */
|
|
5
|
+
readonly upper: Float64Array;
|
|
6
|
+
/** Lower bound (e.g. Bollinger -2σ). */
|
|
7
|
+
readonly lower: Float64Array;
|
|
8
|
+
readonly startIdx: number;
|
|
9
|
+
readonly endIdx: number;
|
|
10
|
+
readonly xToPx: (t: number) => number;
|
|
11
|
+
readonly yScale: {
|
|
12
|
+
toPx(v: number): number;
|
|
13
|
+
};
|
|
14
|
+
/** Pre-resolved CSS color (rgba) - caller picks the alpha. */
|
|
15
|
+
readonly fillStyle: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function drawIndicatorBand(args: DrawIndicatorBandArgs): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LinearScale } from '../../viewport/scales/linear';
|
|
2
|
+
export interface DrawIndicatorLineArgs {
|
|
3
|
+
ctx: CanvasRenderingContext2D;
|
|
4
|
+
times: Float64Array;
|
|
5
|
+
values: Float64Array;
|
|
6
|
+
startIdx: number;
|
|
7
|
+
endIdx: number;
|
|
8
|
+
xToPx: (t: number) => number;
|
|
9
|
+
yScale: LinearScale;
|
|
10
|
+
strokeStyle: string;
|
|
11
|
+
lineWidth: number;
|
|
12
|
+
/** Reusable Path2D - caller-owned. */
|
|
13
|
+
path: Path2D;
|
|
14
|
+
}
|
|
15
|
+
export declare function drawIndicatorLine(args: DrawIndicatorLineArgs): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { VisualStyle } from '../../personalization';
|
|
2
|
+
export type LastPriceLineStyle = "off" | "solid" | "dashed" | "dotted";
|
|
3
|
+
export interface DrawLastPriceLineArgs {
|
|
4
|
+
ctx: CanvasRenderingContext2D;
|
|
5
|
+
innerLeftPx: number;
|
|
6
|
+
innerRightPx: number;
|
|
7
|
+
yPx: number;
|
|
8
|
+
style: Exclude<LastPriceLineStyle, "off">;
|
|
9
|
+
color: string;
|
|
10
|
+
lineWidth: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function drawLastPriceLine(args: DrawLastPriceLineArgs): void;
|
|
13
|
+
export type PillSide = "left" | "right";
|
|
14
|
+
export interface DrawLastPricePillArgs {
|
|
15
|
+
ctx: CanvasRenderingContext2D;
|
|
16
|
+
spineXPx: number;
|
|
17
|
+
side: PillSide;
|
|
18
|
+
yPx: number;
|
|
19
|
+
text: string;
|
|
20
|
+
directionColor: string;
|
|
21
|
+
chartBgColor: string;
|
|
22
|
+
fillTextColor: string;
|
|
23
|
+
visualStyle: VisualStyle;
|
|
24
|
+
font: string;
|
|
25
|
+
fontSize: number;
|
|
26
|
+
paddingX?: number;
|
|
27
|
+
paddingY?: number;
|
|
28
|
+
cornerRadius?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface PillBox {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}
|
|
36
|
+
export declare function drawLastPricePill(args: DrawLastPricePillArgs): PillBox;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LinearScale } from '../../viewport/scales/linear';
|
|
2
|
+
export interface DrawSparklineLineArgs {
|
|
3
|
+
ctx: CanvasRenderingContext2D;
|
|
4
|
+
times: Float64Array;
|
|
5
|
+
values: Float64Array;
|
|
6
|
+
startIdx: number;
|
|
7
|
+
endIdx: number;
|
|
8
|
+
xToPx: (t: number) => number;
|
|
9
|
+
yScale: LinearScale;
|
|
10
|
+
strokeStyle: string;
|
|
11
|
+
lineWidth: number;
|
|
12
|
+
path: Path2D;
|
|
13
|
+
areaBaselineY?: number | undefined;
|
|
14
|
+
areaFillStyle?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function drawSparklineLine(args: DrawSparklineLineArgs): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LiveBarIndicator } from '../../personalization/personalization';
|
|
2
|
+
export interface DrawLiveBarArgs {
|
|
3
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
4
|
+
readonly mode: LiveBarIndicator;
|
|
5
|
+
/** Pixel position of the live point. */
|
|
6
|
+
readonly lastX: number;
|
|
7
|
+
readonly lastY: number;
|
|
8
|
+
/** Pre-resolved CSS color string for the directional accent (palette up/down). */
|
|
9
|
+
readonly directionColor: string;
|
|
10
|
+
/** Pre-resolved CSS color string for the palette accent tint (used by `outline`). */
|
|
11
|
+
readonly accentColor: string;
|
|
12
|
+
/** Chart background color (used by `outline` core cap + `badge` Outline fill). */
|
|
13
|
+
readonly bgColor: string;
|
|
14
|
+
/** Pre-resolved foreground / contrast color (used by `badge` Fill text). */
|
|
15
|
+
readonly fgColor: string;
|
|
16
|
+
/** visualStyle - Fill or Outline (only consumed by `badge`). */
|
|
17
|
+
readonly visualStyle: "Fill" | "Outline";
|
|
18
|
+
/** ms clock for animation phase. */
|
|
19
|
+
readonly now: number;
|
|
20
|
+
/** When true, collapse pulses to a static appearance. */
|
|
21
|
+
readonly reducedMotion: boolean;
|
|
22
|
+
/** Inner draw rect - used by `badge` to clamp pill placement. */
|
|
23
|
+
readonly innerLeft: number;
|
|
24
|
+
readonly innerRight: number;
|
|
25
|
+
readonly innerTop: number;
|
|
26
|
+
readonly innerBottom: number;
|
|
27
|
+
/** Font and size for `badge` text. */
|
|
28
|
+
readonly font: string;
|
|
29
|
+
readonly fontSize: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function drawLiveBarIndicator(args: DrawLiveBarArgs): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SignalMarker, OrderMarker, PositionMarker, EventMarker } from '../../domain/markers';
|
|
2
|
+
export type SignalMarkerMode = "off" | "arrows + letter" | "arrows" | "flags" | "dots" | "arrows + label";
|
|
3
|
+
export type OrderMarkerMode = "off" | "lines" | "arrows-only" | "lines + zone";
|
|
4
|
+
export type PositionMarkerMode = "off" | "line + pnl-pill" | "arrows-only";
|
|
5
|
+
export type EventMarkerMode = "off" | "glyph-axis" | "vertical-line" | "banner-strip";
|
|
6
|
+
export interface MarkerPaintCtx {
|
|
7
|
+
ctx: CanvasRenderingContext2D;
|
|
8
|
+
toPxX: (t: number) => number;
|
|
9
|
+
toPxY: (y: number) => number;
|
|
10
|
+
innerLeft: number;
|
|
11
|
+
innerRight: number;
|
|
12
|
+
innerTop: number;
|
|
13
|
+
innerBottom: number;
|
|
14
|
+
upColor: string;
|
|
15
|
+
downColor: string;
|
|
16
|
+
neutralColor: string;
|
|
17
|
+
warnColor: string;
|
|
18
|
+
font: string;
|
|
19
|
+
fontSize: number;
|
|
20
|
+
/** Pre-formatted `${fontSize}px ${font}` for marker draws that don't
|
|
21
|
+
* need bold/size variants. Caller pre-computes once per draw call.
|
|
22
|
+
* Avoids per-marker template-string
|
|
23
|
+
* allocation on charts with many markers. */
|
|
24
|
+
fontSpec: string;
|
|
25
|
+
/** Pre-formatted `bold ${fontSize}px ${font}`. */
|
|
26
|
+
fontSpecBold: string;
|
|
27
|
+
/** Pre-formatted `${fontSize - 1}px ${font}` - signal label size. */
|
|
28
|
+
fontSpecSmall: string;
|
|
29
|
+
/** Pre-formatted `bold ${fontSize - 2}px ${font}` - event/order ticker
|
|
30
|
+
* badge size. */
|
|
31
|
+
fontSpecBoldSmaller: string;
|
|
32
|
+
/** Event-kind colors. When the host's palette includes `events.{kind}`
|
|
33
|
+
* the chart resolves them; otherwise these default to the built-in
|
|
34
|
+
* E=blue / D=green / S=purple / N=amber set. */
|
|
35
|
+
eventColors?: {
|
|
36
|
+
earnings?: string | undefined;
|
|
37
|
+
dividend?: string | undefined;
|
|
38
|
+
split?: string | undefined;
|
|
39
|
+
news?: string | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
}
|
|
42
|
+
export declare function drawSignalMarker(m: SignalMarker, mode: SignalMarkerMode, pctx: MarkerPaintCtx,
|
|
43
|
+
/** Bar's high y in px (where ▲ is anchored for sell). */
|
|
44
|
+
barHighY: number,
|
|
45
|
+
/** Bar's low y in px (where ▲ is anchored for buy). */
|
|
46
|
+
barLowY: number): void;
|
|
47
|
+
export declare function drawOrderMarker(m: OrderMarker, mode: OrderMarkerMode, pctx: MarkerPaintCtx,
|
|
48
|
+
/** When true, draw the entry/SL/TP zone tints. */
|
|
49
|
+
outlineFillOpacity: number): void;
|
|
50
|
+
export declare function drawPositionMarker(m: PositionMarker, mode: PositionMarkerMode, pctx: MarkerPaintCtx,
|
|
51
|
+
/** Live last close - used to compute P&L pill. */
|
|
52
|
+
lastClose: number): void;
|
|
53
|
+
export declare function drawEventMarker(m: EventMarker, mode: EventMarkerMode, pctx: MarkerPaintCtx): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface DrawPaneDividerArgs {
|
|
2
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
3
|
+
/** Divider y in CSS px. */
|
|
4
|
+
readonly yPx: number;
|
|
5
|
+
/** Inner-chart left edge. */
|
|
6
|
+
readonly innerLeftPx: number;
|
|
7
|
+
/** Inner-chart right edge. */
|
|
8
|
+
readonly innerRightPx: number;
|
|
9
|
+
/** Stroke color (typically a muted neutral from the palette). */
|
|
10
|
+
readonly lineColor: string;
|
|
11
|
+
/** Base stroke width. */
|
|
12
|
+
readonly lineWidth: number;
|
|
13
|
+
/** When `true`, an accent stroke is drawn underneath the line to
|
|
14
|
+
* hint at the drag affordance. */
|
|
15
|
+
readonly hovered: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function drawPaneDivider(args: DrawPaneDividerArgs): void;
|
|
18
|
+
/** Returns `true` if `pointerY` is within `dragHandlePx` of the divider's
|
|
19
|
+
* y-coordinate. Used by the pointer handler to decide whether the
|
|
20
|
+
* cursor is over the drag-affordance band (cursor:row-resize, drag
|
|
21
|
+
* starts on pointerdown). */
|
|
22
|
+
export declare function paneDividerHitTest(pointerY: number, dividerY: number, dragHandlePx: number): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MarkerStyle, ResolvedMarkerConfig } from '../../personalization/axes/point-markers';
|
|
2
|
+
export declare function getShapePath(style: Exclude<MarkerStyle, "direction" | "custom">): Path2D;
|
|
3
|
+
export declare function drawShapeAt(ctx: CanvasRenderingContext2D, shape: Path2D, x: number, y: number, halfSize: number, fillStyle: string | "none", strokeStyle: string | "none", strokeWidthPx: number): void;
|
|
4
|
+
export interface DrawPointMarkersArgs {
|
|
5
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
6
|
+
readonly times: Float64Array;
|
|
7
|
+
readonly values: Float64Array;
|
|
8
|
+
readonly startIdx: number;
|
|
9
|
+
readonly endIdx: number;
|
|
10
|
+
readonly xToPx: (t: number) => number;
|
|
11
|
+
readonly yScale: {
|
|
12
|
+
toPx(v: number): number;
|
|
13
|
+
};
|
|
14
|
+
readonly config: ResolvedMarkerConfig;
|
|
15
|
+
/** Pre-resolved CSS color for `'auto'` fill / stroke. Typically the
|
|
16
|
+
* series line's resolved direction color. */
|
|
17
|
+
readonly autoColor: string;
|
|
18
|
+
/** Resolved palette.up color for `'direction'` style up-icons. */
|
|
19
|
+
readonly upColor: string;
|
|
20
|
+
/** Resolved palette.down color for `'direction'` style down-icons. */
|
|
21
|
+
readonly downColor: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function drawPointMarkers(args: DrawPointMarkersArgs): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Theme } from '../../personalization/palette';
|
|
2
|
+
import { ResolvedGlow } from '../../personalization/axes/glow';
|
|
3
|
+
/** Plot-rect (CSS px) - the glow's offscreen surface matches this region
|
|
4
|
+
* exactly so blur stays clipped to the plot. */
|
|
5
|
+
export interface GlowPlotRect {
|
|
6
|
+
readonly x: number;
|
|
7
|
+
readonly y: number;
|
|
8
|
+
readonly w: number;
|
|
9
|
+
readonly h: number;
|
|
10
|
+
}
|
|
11
|
+
/** Glow-pass draw callback. Called once per pass:
|
|
12
|
+
* - `isGlowPass = true` → the caller draws into `ctx` using the halo
|
|
13
|
+
* color resolver (or a constant color when `glow.color !== 'auto'`).
|
|
14
|
+
* The draw should produce only the *shape mass* of the marks; strokes
|
|
15
|
+
* can be thicker than normal for a fuller aura, but no axis chrome.
|
|
16
|
+
* - `isGlowPass = false` → the caller draws the actual marks normally on
|
|
17
|
+
* top of the glow.
|
|
18
|
+
* The `ctx` is already translated so plot-rect origin maps to (0,0) on
|
|
19
|
+
* glow passes; the caller does not need to re-apply the translate.
|
|
20
|
+
*/
|
|
21
|
+
export type GlowDrawCallback = (ctx: CanvasRenderingContext2D, isGlowPass: boolean) => void;
|
|
22
|
+
export interface GlowOptions {
|
|
23
|
+
readonly glow: ResolvedGlow;
|
|
24
|
+
readonly theme: Theme;
|
|
25
|
+
readonly plotRect: GlowPlotRect;
|
|
26
|
+
/** Device-pixel ratio multiplier for the offscreen surface. Passed
|
|
27
|
+
* separately so glow renders crisp on high-DPR displays without
|
|
28
|
+
* forcing the caller to re-apply `setTransform`. */
|
|
29
|
+
readonly dpr: number;
|
|
30
|
+
}
|
|
31
|
+
/** Drop every cached offscreen surface. Hosts call this on
|
|
32
|
+
* `onLowMemory` / `didReceiveMemoryWarning`. */
|
|
33
|
+
export declare function clearGlowPool(): void;
|
|
34
|
+
/** Run the glow compositor. When `glow.strength === 0`, this is a thin
|
|
35
|
+
* pass-through that only invokes the sharp pass on the main context. */
|
|
36
|
+
export declare function drawWithGlow(mainCtx: CanvasRenderingContext2D, opts: GlowOptions, draw: GlowDrawCallback): void;
|
|
37
|
+
/** Resolve the halo stroke/fill color used in glow passes for a given
|
|
38
|
+
* mark direction. Returns a CSS color string ready to assign to
|
|
39
|
+
* `ctx.strokeStyle` / `ctx.fillStyle`. */
|
|
40
|
+
export declare function resolveGlowHaloColor(glow: ResolvedGlow, theme: Theme, directionRgba: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { mountCanvas, type MountedCanvas } from './canvas';
|
|
2
|
+
export { Slot, type SlotValue, COLOR_TABLE_SIZE, buildColorTable, packedToCssRgba, oklchToCssRgba, } from './color-tables';
|
|
3
|
+
export { drawSparklineLine, type DrawSparklineLineArgs } from './draw/line';
|
|
4
|
+
export { drawYAxis, drawXAxis, type DrawYAxisArgs, type DrawXAxisArgs, type YAxisPosition, type XAxisPosition, type XAxisTick, } from './draw/axis';
|
|
5
|
+
export { drawGrid, type DrawGridArgs, type GridStyle, } from './draw/grid';
|
|
6
|
+
export { drawCrosshair, type DrawCrosshairArgs, type CrosshairMarker, } from './draw/crosshair';
|
|
7
|
+
export { drawIndicatorLine, type DrawIndicatorLineArgs, } from './draw/indicator-line';
|
|
8
|
+
export { RenderPipeline, type FrameContext, type PipelineMiddleware, type DrawStage, } from './pipeline';
|
|
9
|
+
export { DirtyRectAccumulator, type Rect } from './dirty-rect';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const SPLIT_MIN_PX = 200;
|
|
2
|
+
export interface LayerSplitOptions {
|
|
3
|
+
readonly cssWidth: number;
|
|
4
|
+
readonly cssHeight: number;
|
|
5
|
+
/** When `true`, the chart is in sparkline mode; sparklines never use
|
|
6
|
+
* the dynamic layer (no hover affordances). */
|
|
7
|
+
readonly sparkline?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Decide whether to engage the two-canvas split. Returns `false` when
|
|
10
|
+
* the chart is too small or in sparkline mode; `true` otherwise. */
|
|
11
|
+
export declare function shouldUseLayerSplit(opts: LayerSplitOptions): boolean;
|
|
12
|
+
export { SPLIT_MIN_PX };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Create or reuse a cross-hatch `CanvasPattern` for the given theme + DPR.
|
|
2
|
+
* The pattern transforms with the receiving canvas's transform, so callers
|
|
3
|
+
* use it directly as a fillStyle on the chart context. */
|
|
4
|
+
export declare function getCrossHatchPattern(ctx: CanvasRenderingContext2D, themeIsDark: boolean, dpr: number): CanvasPattern | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ResolvedPattern } from '../../personalization/axes/pattern';
|
|
2
|
+
export declare function clearPatternTileCache(): void;
|
|
3
|
+
/** Resolve a `CanvasPattern` for the given resolved pattern. Caches the
|
|
4
|
+
* tile app-wide. Returns `null` for `'solid'` (no pattern → caller uses
|
|
5
|
+
* the mark's plain fill style).
|
|
6
|
+
*
|
|
7
|
+
* `colorOverride` lets the caller supply a per-mark resolved color
|
|
8
|
+
* (e.g. computed via `resolvePatternColorAuto`) WITHOUT having to
|
|
9
|
+
* spread/clone the whole `resolved` config. This
|
|
10
|
+
* eliminates the per-mark `{ ...personalization.pattern, color }`
|
|
11
|
+
* object literal that previously sat inside the candle / bar / pie /
|
|
12
|
+
* histogram / sunburst / treemap draw loops.
|
|
13
|
+
* - `colorOverride === null`: behave as before - use `resolved.color`,
|
|
14
|
+
* falling back to `fillColor` when `resolved.color === "auto"`.
|
|
15
|
+
* - `colorOverride !== null`: use it directly. */
|
|
16
|
+
export declare function getPattern(ctx: CanvasRenderingContext2D, resolved: ResolvedPattern, fillColor: string, dpr: number, colorOverride?: string | null): CanvasPattern | null;
|
|
17
|
+
/** OKLCH `L`-shift for `patternColor: 'auto'` resolution. In
|
|
18
|
+
* Fill mode: shift up ~0.30 in light, down ~0.30 in dark, at ~40-45%
|
|
19
|
+
* alpha. In Outline mode: ~55% alpha, no `L` shift.
|
|
20
|
+
*
|
|
21
|
+
* For v1 we approximate via simple rgba math; the OKLCH-accurate
|
|
22
|
+
* helper lands with 14.4 custom-palette helpers. The caller passes the
|
|
23
|
+
* mark's CSS fill string and we return a shifted CSS color.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolvePatternColorAuto(fillCss: string, themeIsDark: boolean, outlineMode: boolean): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface FrameContext {
|
|
2
|
+
ctx: CanvasRenderingContext2D;
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
dpr: number;
|
|
6
|
+
nowMs: number;
|
|
7
|
+
}
|
|
8
|
+
export type DrawStage = (ctx: FrameContext) => void;
|
|
9
|
+
export interface PipelineMiddleware {
|
|
10
|
+
name: string;
|
|
11
|
+
before?: DrawStage;
|
|
12
|
+
after?: DrawStage;
|
|
13
|
+
}
|
|
14
|
+
export declare class RenderPipeline {
|
|
15
|
+
private readonly middleware;
|
|
16
|
+
private primary;
|
|
17
|
+
use(mw: PipelineMiddleware): void;
|
|
18
|
+
setPrimary(fn: DrawStage): void;
|
|
19
|
+
run(ctx: FrameContext): void;
|
|
20
|
+
reset(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type StackingResolved = "additive" | "normalized";
|
|
2
|
+
export interface StackingInput {
|
|
3
|
+
/** Per-series values arrays. All MUST share the same length (validated at
|
|
4
|
+
* the public API boundary by `validateStackingAlignment`). */
|
|
5
|
+
readonly values: readonly Float64Array[];
|
|
6
|
+
}
|
|
7
|
+
export interface StackingLayout {
|
|
8
|
+
/** Cumulative-top per series (same shape as input). NaN at column j when
|
|
9
|
+
* any input series had NaN at j. */
|
|
10
|
+
readonly tops: readonly Float64Array[];
|
|
11
|
+
/** Cumulative-bottom per series. `baselines[0]` is all-zeros (or all-NaN
|
|
12
|
+
* where a column is invalidated). */
|
|
13
|
+
readonly baselines: readonly Float64Array[];
|
|
14
|
+
/** Final cumulative top across all series at each column - i.e., the
|
|
15
|
+
* topmost edge of the stack. Used for y-domain extension. NaN-propagating. */
|
|
16
|
+
readonly stackTop: Float64Array;
|
|
17
|
+
/** Mode used to build this layout (mirrors caller intent). */
|
|
18
|
+
readonly mode: StackingResolved;
|
|
19
|
+
}
|
|
20
|
+
/** Build a stacked layout from aligned series. `mode` derives from the
|
|
21
|
+
* user-facing `stacked` axis - call sites translate `true` → 'additive'
|
|
22
|
+
* and `'normalized'` → 'normalized'. */
|
|
23
|
+
export declare function computeStackedLayout(input: StackingInput, mode: StackingResolved): StackingLayout;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Minimum gap (in CSS px) between adjacent rectangular marks at slot
|
|
2
|
+
* widths that allow it. Below this gap, the gap rule is suppressed
|
|
3
|
+
* (the lib doesn't shrink bars below `MIN_MARK_SIZE_PX` to satisfy gap). */
|
|
4
|
+
export declare const GAP_UNIT_PX = 2;
|
|
5
|
+
/** Floor for any single visible mark in CSS px. Below this, marks would
|
|
6
|
+
* go sub-pixel and disappear at deep zoom-out. The lib enforces this
|
|
7
|
+
* even when the requested ratio would produce a smaller mark. */
|
|
8
|
+
export declare const MIN_MARK_SIZE_PX = 1.5;
|
|
9
|
+
/** Ceiling for any single mark in CSS px. Above this, the user is at
|
|
10
|
+
* extreme zoom-in and individual marks become absurdly fat. The lib
|
|
11
|
+
* caps here even when the slot would allow more. */
|
|
12
|
+
export declare const MAX_MARK_SIZE_PX = 32;
|
|
13
|
+
/** Resolve the visible width (CSS px) of a single mark inside a slot.
|
|
14
|
+
* Used by BarChart, CandleChart, HistogramChart, RenkoChart bricks,
|
|
15
|
+
* etc. - anything that lives in a per-x-slot rhythm.
|
|
16
|
+
*
|
|
17
|
+
* Priority (highest first):
|
|
18
|
+
* 1. `MIN_MARK_SIZE_PX` floor - visible always wins over absent.
|
|
19
|
+
* 2. `MAX_MARK_SIZE_PX` ceiling - cap at extreme zoom-in.
|
|
20
|
+
* 3. `GAP_UNIT_PX` gap rule - if the slot has room, leave a 2px gap.
|
|
21
|
+
* 4. The user-supplied ratio.
|
|
22
|
+
*
|
|
23
|
+
* At very small slots (`slotWidth < MIN + GAP`) the gap rule is
|
|
24
|
+
* suppressed and the lib favors mark visibility over inter-mark gap.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveMarkWidth(slotWidth: number, ratio: number): number;
|