@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.
Files changed (217) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +43 -0
  3. package/dist/animation/animator.d.ts +52 -0
  4. package/dist/animation/bar-entry.d.ts +44 -0
  5. package/dist/animation/bar-update.d.ts +38 -0
  6. package/dist/animation/easings.d.ts +22 -0
  7. package/dist/animation/index.d.ts +4 -0
  8. package/dist/charts/bar-chart-controller.d.ts +98 -0
  9. package/dist/charts/bar-chart-helpers.d.ts +334 -0
  10. package/dist/charts/candle-chart-controller.d.ts +353 -0
  11. package/dist/charts/candle-chart-helpers.d.ts +781 -0
  12. package/dist/charts/depth-chart-controller.d.ts +84 -0
  13. package/dist/charts/depth-chart-helpers.d.ts +185 -0
  14. package/dist/charts/depth-series.d.ts +41 -0
  15. package/dist/charts/heatmap-chart-controller.d.ts +78 -0
  16. package/dist/charts/heatmap-chart-helpers.d.ts +174 -0
  17. package/dist/charts/heatmap-color-compute.d.ts +11 -0
  18. package/dist/charts/hierarchy.d.ts +49 -0
  19. package/dist/charts/histogram-binning.d.ts +33 -0
  20. package/dist/charts/histogram-chart-controller.d.ts +82 -0
  21. package/dist/charts/histogram-chart-helpers.d.ts +199 -0
  22. package/dist/charts/kagi-chart-controller.d.ts +154 -0
  23. package/dist/charts/line-chart-controller.d.ts +209 -0
  24. package/dist/charts/line-chart-helpers.d.ts +606 -0
  25. package/dist/charts/mark-buffers.d.ts +105 -0
  26. package/dist/charts/pie-chart-controller.d.ts +83 -0
  27. package/dist/charts/pie-chart-helpers.d.ts +155 -0
  28. package/dist/charts/pie-slice-compute.d.ts +44 -0
  29. package/dist/charts/pnf-chart-controller.d.ts +153 -0
  30. package/dist/charts/renko-chart-controller.d.ts +151 -0
  31. package/dist/charts/sankey-chart-controller.d.ts +176 -0
  32. package/dist/charts/sankey-layout.d.ts +64 -0
  33. package/dist/charts/scatter-chart-controller.d.ts +90 -0
  34. package/dist/charts/scatter-chart-helpers.d.ts +257 -0
  35. package/dist/charts/scatter-density.d.ts +5 -0
  36. package/dist/charts/scatter-regression.d.ts +27 -0
  37. package/dist/charts/sunburst-chart-controller.d.ts +107 -0
  38. package/dist/charts/sunburst-chart-helpers.d.ts +143 -0
  39. package/dist/charts/sunburst-layout.d.ts +40 -0
  40. package/dist/charts/time-off-algorithms.d.ts +53 -0
  41. package/dist/charts/treemap-chart-controller.d.ts +103 -0
  42. package/dist/charts/treemap-chart-helpers.d.ts +163 -0
  43. package/dist/charts/treemap-layout.d.ts +29 -0
  44. package/dist/charts/types.d.ts +38 -0
  45. package/dist/clock/clock.d.ts +10 -0
  46. package/dist/composition/chart-group-state.d.ts +46 -0
  47. package/dist/composition/index.d.ts +1 -0
  48. package/dist/composition/pane.d.ts +33 -0
  49. package/dist/domain/concat.d.ts +18 -0
  50. package/dist/domain/drawings.d.ts +44 -0
  51. package/dist/domain/heikin-ashi.d.ts +9 -0
  52. package/dist/domain/index.d.ts +7 -0
  53. package/dist/domain/ingestion.d.ts +7 -0
  54. package/dist/domain/live-state.d.ts +12 -0
  55. package/dist/domain/markers.d.ts +38 -0
  56. package/dist/domain/series.d.ts +22 -0
  57. package/dist/domain/values.d.ts +32 -0
  58. package/dist/engine/aggregation.d.ts +15 -0
  59. package/dist/engine/downsampling.d.ts +3 -0
  60. package/dist/engine/events.d.ts +14 -0
  61. package/dist/engine/index.d.ts +13 -0
  62. package/dist/engine/indicators.d.ts +37 -0
  63. package/dist/engine/markets.d.ts +8 -0
  64. package/dist/engine/module.d.ts +8 -0
  65. package/dist/engine/quadtree.d.ts +18 -0
  66. package/dist/engine/session.d.ts +11 -0
  67. package/dist/engine/signals.d.ts +52 -0
  68. package/dist/engine/streaming.d.ts +20 -0
  69. package/dist/engine/time-axis.d.ts +16 -0
  70. package/dist/engine/version.d.ts +16 -0
  71. package/dist/engine/views.d.ts +3 -0
  72. package/dist/index.js +17026 -0
  73. package/dist/interaction/keyboard.d.ts +16 -0
  74. package/dist/interaction/touch.d.ts +27 -0
  75. package/dist/perf/adaptive-complexity.d.ts +45 -0
  76. package/dist/perf/memory-pressure.d.ts +16 -0
  77. package/dist/perf/offscreen-canvas-host.d.ts +32 -0
  78. package/dist/perf/offscreen-canvas.d.ts +50 -0
  79. package/dist/perf/offscreen-canvas.worker.d.ts +1 -0
  80. package/dist/perf/shared-array-buffer.d.ts +10 -0
  81. package/dist/perf/visibility.d.ts +39 -0
  82. package/dist/perf/webgl-renderer.d.ts +24 -0
  83. package/dist/perf/wire-memory-pressure.d.ts +2 -0
  84. package/dist/personalization/accessibility.d.ts +16 -0
  85. package/dist/personalization/axes/animation.d.ts +33 -0
  86. package/dist/personalization/axes/area-baseline.d.ts +8 -0
  87. package/dist/personalization/axes/axis-labels.d.ts +3 -0
  88. package/dist/personalization/axes/bin-algorithm.d.ts +3 -0
  89. package/dist/personalization/axes/box-sizing.d.ts +22 -0
  90. package/dist/personalization/axes/cell-shape.d.ts +3 -0
  91. package/dist/personalization/axes/curve-type.d.ts +11 -0
  92. package/dist/personalization/axes/density.d.ts +4 -0
  93. package/dist/personalization/axes/depth-fill-type.d.ts +3 -0
  94. package/dist/personalization/axes/depth-limit.d.ts +2 -0
  95. package/dist/personalization/axes/glow.d.ts +21 -0
  96. package/dist/personalization/axes/heatmap-color-scale.d.ts +31 -0
  97. package/dist/personalization/axes/histogram-overlay.d.ts +18 -0
  98. package/dist/personalization/axes/indicator-pane-spec.d.ts +85 -0
  99. package/dist/personalization/axes/label-behavior.d.ts +3 -0
  100. package/dist/personalization/axes/label-content.d.ts +17 -0
  101. package/dist/personalization/axes/label-placement.d.ts +3 -0
  102. package/dist/personalization/axes/label-rotation.d.ts +3 -0
  103. package/dist/personalization/axes/level-highlight.d.ts +14 -0
  104. package/dist/personalization/axes/line-dash.d.ts +2 -0
  105. package/dist/personalization/axes/mid-line.d.ts +14 -0
  106. package/dist/personalization/axes/node-alignment.d.ts +3 -0
  107. package/dist/personalization/axes/null-behavior.d.ts +3 -0
  108. package/dist/personalization/axes/number-format.d.ts +18 -0
  109. package/dist/personalization/axes/pan-zoom.d.ts +42 -0
  110. package/dist/personalization/axes/pattern.d.ts +26 -0
  111. package/dist/personalization/axes/point-markers.d.ts +55 -0
  112. package/dist/personalization/axes/point-opacity.d.ts +6 -0
  113. package/dist/personalization/axes/point-size.d.ts +23 -0
  114. package/dist/personalization/axes/price-range.d.ts +9 -0
  115. package/dist/personalization/axes/radius-proportion.d.ts +3 -0
  116. package/dist/personalization/axes/regression-line.d.ts +36 -0
  117. package/dist/personalization/axes/sankey-link-color.d.ts +10 -0
  118. package/dist/personalization/axes/sankey-value-display.d.ts +4 -0
  119. package/dist/personalization/axes/small-slice-threshold.d.ts +15 -0
  120. package/dist/personalization/axes/sort-order.d.ts +3 -0
  121. package/dist/personalization/axes/spread-display.d.ts +4 -0
  122. package/dist/personalization/axes/stacking.d.ts +17 -0
  123. package/dist/personalization/axes/tile-layout.d.ts +3 -0
  124. package/dist/personalization/axes/time-off-axes.d.ts +19 -0
  125. package/dist/personalization/axes/treemap-color-scale.d.ts +3 -0
  126. package/dist/personalization/axes/value-labels.d.ts +21 -0
  127. package/dist/personalization/axes/view-mode.d.ts +3 -0
  128. package/dist/personalization/axes/volume-coloring.d.ts +24 -0
  129. package/dist/personalization/axes/y-axis-mode.d.ts +3 -0
  130. package/dist/personalization/index.d.ts +38 -0
  131. package/dist/personalization/locale/formatter.d.ts +45 -0
  132. package/dist/personalization/locale/resolver.d.ts +22 -0
  133. package/dist/personalization/palette/built-ins.d.ts +10 -0
  134. package/dist/personalization/palette/derive.d.ts +35 -0
  135. package/dist/personalization/palette/index.d.ts +6 -0
  136. package/dist/personalization/palette/oklch.d.ts +19 -0
  137. package/dist/personalization/palette/registry.d.ts +7 -0
  138. package/dist/personalization/palette/tonal-symmetry.d.ts +32 -0
  139. package/dist/personalization/palette/types.d.ts +63 -0
  140. package/dist/personalization/personalization.d.ts +137 -0
  141. package/dist/personalization/tooltip-props.d.ts +40 -0
  142. package/dist/rendering/canvas.d.ts +6 -0
  143. package/dist/rendering/color-tables.d.ts +52 -0
  144. package/dist/rendering/dirty-rect-tracker.d.ts +49 -0
  145. package/dist/rendering/dirty-rect.d.ts +17 -0
  146. package/dist/rendering/draw/area-fill-threshold.d.ts +19 -0
  147. package/dist/rendering/draw/area-fill.d.ts +47 -0
  148. package/dist/rendering/draw/area-gradient.d.ts +35 -0
  149. package/dist/rendering/draw/axis.d.ts +65 -0
  150. package/dist/rendering/draw/bar.d.ts +31 -0
  151. package/dist/rendering/draw/candle-live-treatment.d.ts +43 -0
  152. package/dist/rendering/draw/candle.d.ts +101 -0
  153. package/dist/rendering/draw/connection-indicator.d.ts +30 -0
  154. package/dist/rendering/draw/crosshair.d.ts +27 -0
  155. package/dist/rendering/draw/drawings.d.ts +64 -0
  156. package/dist/rendering/draw/grid.d.ts +20 -0
  157. package/dist/rendering/draw/indicator-band.d.ts +17 -0
  158. package/dist/rendering/draw/indicator-line.d.ts +15 -0
  159. package/dist/rendering/draw/last-price.d.ts +36 -0
  160. package/dist/rendering/draw/line.d.ts +16 -0
  161. package/dist/rendering/draw/live-bar.d.ts +31 -0
  162. package/dist/rendering/draw/markers.d.ts +53 -0
  163. package/dist/rendering/draw/pane-divider.d.ts +22 -0
  164. package/dist/rendering/draw/point-markers.d.ts +23 -0
  165. package/dist/rendering/glow/glow.d.ts +40 -0
  166. package/dist/rendering/index.d.ts +9 -0
  167. package/dist/rendering/layers/should-split.d.ts +12 -0
  168. package/dist/rendering/patterns/cross-hatch.d.ts +4 -0
  169. package/dist/rendering/patterns/pattern-tiles.d.ts +25 -0
  170. package/dist/rendering/pipeline.d.ts +21 -0
  171. package/dist/rendering/stacked-layout.d.ts +23 -0
  172. package/dist/rendering/standardization-tokens.d.ts +26 -0
  173. package/dist/rendering/static-layer-cache.d.ts +34 -0
  174. package/dist/rendering/threshold-split.d.ts +14 -0
  175. package/dist/shared/binary-search.d.ts +2 -0
  176. package/dist/shared/typed.d.ts +8 -0
  177. package/dist/solid/chart-group.d.ts +16 -0
  178. package/dist/solid/charts-provider.d.ts +38 -0
  179. package/dist/solid/components/area-chart.d.ts +21 -0
  180. package/dist/solid/components/bar-chart.d.ts +84 -0
  181. package/dist/solid/components/candle-chart.d.ts +142 -0
  182. package/dist/solid/components/chart-group-brush.d.ts +13 -0
  183. package/dist/solid/components/chart-group-navigator.d.ts +12 -0
  184. package/dist/solid/components/depth-chart.d.ts +8 -0
  185. package/dist/solid/components/heatmap-chart.d.ts +8 -0
  186. package/dist/solid/components/histogram-chart.d.ts +8 -0
  187. package/dist/solid/components/kagi-chart.d.ts +8 -0
  188. package/dist/solid/components/line-chart.d.ts +110 -0
  189. package/dist/solid/components/pie-chart.d.ts +20 -0
  190. package/dist/solid/components/point-figure-chart.d.ts +8 -0
  191. package/dist/solid/components/renko-chart.d.ts +8 -0
  192. package/dist/solid/components/sankey-chart.d.ts +8 -0
  193. package/dist/solid/components/scatter-chart.d.ts +8 -0
  194. package/dist/solid/components/sunburst-chart.d.ts +8 -0
  195. package/dist/solid/components/treemap-chart.d.ts +8 -0
  196. package/dist/solid/hooks/use-chart-theme.d.ts +2 -0
  197. package/dist/solid/hooks/use-streaming-candles.d.ts +33 -0
  198. package/dist/solid/index.d.ts +73 -0
  199. package/dist/solid/tooltips/default-candle-tooltip.d.ts +4 -0
  200. package/dist/solid/tooltips/default-extreme-tooltip.d.ts +6 -0
  201. package/dist/solid/tooltips/default-tooltip.d.ts +4 -0
  202. package/dist/solid/tooltips/default-volume-bar-tooltip.d.ts +4 -0
  203. package/dist/solid/tooltips/index.d.ts +4 -0
  204. package/dist/tickyr_charts_wasm-C-sFYtmv.js +828 -0
  205. package/dist/viewport/category-axis.d.ts +32 -0
  206. package/dist/viewport/clip-ticks.d.ts +8 -0
  207. package/dist/viewport/index.d.ts +6 -0
  208. package/dist/viewport/nice-ticks.d.ts +9 -0
  209. package/dist/viewport/nice-time-ticks.d.ts +7 -0
  210. package/dist/viewport/orientation.d.ts +56 -0
  211. package/dist/viewport/padded-domain.d.ts +16 -0
  212. package/dist/viewport/scales/linear.d.ts +9 -0
  213. package/dist/viewport/scales/log.d.ts +9 -0
  214. package/dist/viewport/scales/time.d.ts +7 -0
  215. package/dist/viewport/viewport-sizer.d.ts +15 -0
  216. package/dist/viewport/visible-window.d.ts +5 -0
  217. package/package.json +41 -0
@@ -0,0 +1,63 @@
1
+ import { Oklch } from './oklch';
2
+ export type Theme = "light" | "dark";
3
+ export type ThemeInput = "inherit" | "light" | "dark" | "system";
4
+ export type VisualStyle = "Fill" | "Outline";
5
+ export interface PaletteVariant {
6
+ up: Oklch;
7
+ down: Oklch;
8
+ doji: Oklch;
9
+ neutral: Oklch;
10
+ /** Caution / amber - used for stale state (connection indicator + stale
11
+ * banner). Must read as "warning" without competing with `up`/`down`. */
12
+ warn: Oklch;
13
+ accentTint: Oklch;
14
+ categorical: readonly Oklch[];
15
+ indicators: {
16
+ sma: Oklch;
17
+ ema: Oklch;
18
+ wma: Oklch;
19
+ bb: Oklch;
20
+ fib: Oklch;
21
+ rsi: Oklch;
22
+ macd: Oklch;
23
+ stochastic: Oklch;
24
+ atr: Oklch;
25
+ vwap: Oklch;
26
+ };
27
+ drawings: {
28
+ stroke: Oklch;
29
+ fill: Oklch;
30
+ handle: Oklch;
31
+ label: Oklch;
32
+ };
33
+ /** Optional event-kind colors. When absent,
34
+ * the chart falls back to a built-in default for each kind. */
35
+ events?: {
36
+ earnings?: Oklch;
37
+ dividend?: Oklch;
38
+ split?: Oklch;
39
+ news?: Oklch;
40
+ };
41
+ }
42
+ /** Per-palette declaration of the tonal-symmetry rule.
43
+ * When `'positive'` or `'negative'`, the
44
+ * chosen direction renders with the opposite-direction's color as
45
+ * its stroke and a fully-transparent interior (regardless of
46
+ * `visualStyle`). The non-chosen direction renders normally per
47
+ * `visualStyle`. `'none'` disables the rule - both directions render
48
+ * by their own palette color per `visualStyle`. */
49
+ export type TonalSymmetrySide = "positive" | "negative" | "none";
50
+ export interface Palette {
51
+ name: string;
52
+ light: PaletteVariant;
53
+ dark: PaletteVariant;
54
+ tonalSymmetrySide: TonalSymmetrySide;
55
+ tonalSymmetryFlipInDarkMode: boolean;
56
+ }
57
+ export declare class PaletteValidationError extends Error {
58
+ readonly paletteName: string;
59
+ readonly missingSlot: string;
60
+ readonly name = "PaletteValidationError";
61
+ constructor(paletteName: string, missingSlot: string);
62
+ }
63
+ export declare function validatePaletteOrThrow(palette: Palette): void;
@@ -0,0 +1,137 @@
1
+ import { Palette, Theme, ThemeInput, VisualStyle } from './palette';
2
+ import { DigitGrouping, NumberAbbreviation, DecimalPlaces, CurrencyDisplay, PercentPrecision, DateFormat, TimeFormat } from './locale/formatter';
3
+ import { BarEntryAnimation, BarUpdateAnimation, ThemeSwitchTransition } from './axes/animation';
4
+ import { GlowInput, GlowColorInput, ResolvedGlow } from './axes/glow';
5
+ import { PatternInput, PatternColorInput, ResolvedPattern } from './axes/pattern';
6
+ import { NumberFormatInput, ResolvedNumberFormat } from './axes/number-format';
7
+ /** Live-bar indicator modes. */
8
+ export type LiveBarIndicator = "none" | "dot" | "badge" | "glow" | "outline" | "pulse-bar";
9
+ /** Connection-indicator modes. */
10
+ export type ConnectionIndicator = "off" | "dot" | "pill";
11
+ /** Corner anchor for the legend. */
12
+ export type LegendPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
13
+ /** Legend visibility. */
14
+ export type LegendVisibility = "always" | "on-hover" | "off";
15
+ /** Chart-wide stale-state visual treatment. */
16
+ export type StaleVisualization = "none" | "desaturate-pulse" | "banner" | "desaturate-pulse + banner";
17
+ export interface PersonalizationInput {
18
+ theme?: ThemeInput;
19
+ palette?: string;
20
+ osTheme?: Theme;
21
+ appTheme?: Theme;
22
+ visualStyle?: VisualStyle;
23
+ /** Interior fill color for outline-style marks.
24
+ * `'auto'` derives from each mark's own stroke (up bodies tint up-color,
25
+ * down tint down-color, etc.); a literal hex gives a uniform tint
26
+ * regardless of direction. */
27
+ outlineFillColor?: "auto" | string | undefined;
28
+ /** Interior fill opacity for outline-style
29
+ * marks, expressed as 0–100 (percent). Default 15. The lib internally
30
+ * doubles the effective opacity in dark mode (so `15` renders at 30%
31
+ * in dark) for perceived-contrast parity with light mode. */
32
+ outlineFillOpacity?: number | undefined;
33
+ /** Corner roundness in CSS px for rectangular
34
+ * + arc-segment marks (BarChart bars, CandleChart bodies, RenkoChart
35
+ * bricks, TreemapChart tiles, Pie/Donut arc tips, etc.). Default `3`
36
+ * - modern aesthetic; bar-on-baseline / stacked-segment / Renko
37
+ * adjacency rules suppress rounding on edges that meet a neighbor or
38
+ * the axis baseline, so the visible result reads as one cohesive
39
+ * shape regardless of grouping. `0` = sharp (legacy broker look). */
40
+ cornerRadius?: number | undefined;
41
+ /** Body / segment border width (CSS px,
42
+ * ≥ 0). Default `1.4`. Applied uniformly in BOTH `Fill` and
43
+ * `Outline` visualStyles: Fill mode strokes with the same color as
44
+ * the fill (visual uniform), Outline mode strokes with the direction
45
+ * color around the faintly-tinted interior. `0` = no border. */
46
+ borderWidth?: number | undefined;
47
+ liveBarIndicator?: LiveBarIndicator | undefined;
48
+ /** ms; 0 disables auto-detection. */
49
+ staleThreshold?: number | undefined;
50
+ connectionIndicator?: ConnectionIndicator | undefined;
51
+ legendPosition?: LegendPosition | undefined;
52
+ staleVisualization?: StaleVisualization | undefined;
53
+ legend?: LegendVisibility | undefined;
54
+ /** ISO 3166-1 alpha-3 country code. */
55
+ locale?: string | undefined;
56
+ digitGrouping?: DigitGrouping | undefined;
57
+ numberAbbreviation?: NumberAbbreviation | undefined;
58
+ decimalPlaces?: DecimalPlaces | undefined;
59
+ /** ISO 4217. Defaults to the country's default currency from the resolver. */
60
+ currency?: string | undefined;
61
+ currencyDisplay?: CurrencyDisplay | undefined;
62
+ percentPrecision?: PercentPrecision | undefined;
63
+ dateFormat?: DateFormat | undefined;
64
+ timeFormat?: TimeFormat | undefined;
65
+ /** IANA TZ identifier; falls through to the platform's default. */
66
+ timeZone?: string | undefined;
67
+ barEntryAnimation?: BarEntryAnimation | undefined;
68
+ barUpdateAnimation?: BarUpdateAnimation | undefined;
69
+ crosshairFadeDuration?: number | undefined;
70
+ tooltipFadeDuration?: number | undefined;
71
+ panZoomSmoothing?: boolean | undefined;
72
+ themeSwitchTransition?: ThemeSwitchTransition | undefined;
73
+ glow?: GlowInput | undefined;
74
+ glowColor?: GlowColorInput | undefined;
75
+ /** Host signal - when true, every "extra GPU work" axis collapses to its
76
+ * cheapest setting. Glow is the first axis to honor this; later sweeps
77
+ * (pattern, animations, DPR cap) follow the same convention. */
78
+ fastMode?: boolean | undefined;
79
+ pattern?: PatternInput | undefined;
80
+ patternScale?: number | undefined;
81
+ patternColor?: PatternColorInput | undefined;
82
+ numberFormat?: NumberFormatInput | undefined;
83
+ /** IANA TZ for market hours / session boundaries. Distinct from
84
+ * `timeZone` (which formats user-facing labels). */
85
+ marketTimeZone?: string | undefined;
86
+ /** CSS font-family override for chart text. */
87
+ font?: string | undefined;
88
+ }
89
+ export interface Personalization {
90
+ theme: Theme;
91
+ palette: Palette;
92
+ visualStyle: VisualStyle;
93
+ outlineFillColor: "auto" | string;
94
+ /** 0–100. The dark-mode doubling rule is applied at draw time, not here
95
+ * - consumers read this value as-is and call `effectiveOutlineAlpha`. */
96
+ outlineFillOpacity: number;
97
+ /** Corner roundness in CSS px (≥ 0). */
98
+ cornerRadius: number;
99
+ /** Body / segment border width in CSS px (≥ 0). */
100
+ borderWidth: number;
101
+ liveBarIndicator: LiveBarIndicator;
102
+ staleThreshold: number;
103
+ connectionIndicator: ConnectionIndicator;
104
+ legendPosition: LegendPosition;
105
+ staleVisualization: StaleVisualization;
106
+ legend: LegendVisibility;
107
+ /** ISO 3166-1 alpha-3 country code. */
108
+ locale: string;
109
+ digitGrouping: DigitGrouping;
110
+ numberAbbreviation: NumberAbbreviation;
111
+ decimalPlaces: DecimalPlaces;
112
+ /** ISO 4217. */
113
+ currency: string | undefined;
114
+ currencyDisplay: CurrencyDisplay;
115
+ percentPrecision: PercentPrecision;
116
+ dateFormat: DateFormat;
117
+ timeFormat: TimeFormat;
118
+ timeZone: string | undefined;
119
+ barEntryAnimation: BarEntryAnimation;
120
+ barUpdateAnimation: BarUpdateAnimation;
121
+ crosshairFadeDuration: number;
122
+ tooltipFadeDuration: number;
123
+ panZoomSmoothing: boolean;
124
+ themeSwitchTransition: ThemeSwitchTransition;
125
+ glow: ResolvedGlow;
126
+ fastMode: boolean;
127
+ pattern: ResolvedPattern;
128
+ numberFormat: ResolvedNumberFormat;
129
+ marketTimeZone: string | undefined;
130
+ font: string | undefined;
131
+ }
132
+ /** Apply the dark-mode-doubling rule to the
133
+ * configured `outlineFillOpacity` (0–100) and clamp to [0, 1]. Returns the
134
+ * alpha consumers should pass to color resolvers. */
135
+ export declare function effectiveOutlineAlpha(personalization: Personalization): number;
136
+ export declare function resolveTheme(input: ThemeInput, app: Theme, os: Theme): Theme;
137
+ export declare function resolvePersonalization(input: PersonalizationInput): Personalization;
@@ -0,0 +1,40 @@
1
+ /** Common props every tooltip in the lib receives. Chart-specific
2
+ * tooltips extend this with their `target` payload (hovered point,
3
+ * candle, slice, etc.). */
4
+ export interface BaseTooltipProps {
5
+ /** Pointer position relative to the chart container, CSS px. */
6
+ readonly pointerX: number;
7
+ readonly pointerY: number;
8
+ /** Container dimensions, CSS px. */
9
+ readonly containerWidth: number;
10
+ readonly containerHeight: number;
11
+ /** Active theme + palette at the time of hover. */
12
+ readonly theme: import('./palette').Theme;
13
+ readonly palette: import('./palette').Palette;
14
+ /** Active locale + timezone for value formatting. */
15
+ readonly locale: string;
16
+ readonly timeZone: string | undefined;
17
+ }
18
+ /** A tooltip slot's polymorphic input form. Used uniformly across
19
+ * every tooltip prop (`tooltip`, `markerTooltip`, `signalTooltip`,
20
+ * `orderTooltip`, `positionTooltip`, `eventTooltip`, `drawingTooltip`,
21
+ * `extremeTooltip`, `volumeBarTooltip`, `livePriceLineTooltip`,
22
+ * `indicatorTooltip`). Generic `P` is the chart-specific tooltip
23
+ * props extending `BaseTooltipProps`. */
24
+ export type TooltipInput<P> = false | true | ((props: P) => unknown);
25
+ /** Resolved + normalized tooltip slot - the chart calls `mode === 'render'`
26
+ * and invokes `render(props)` to materialise the tooltip, or skips when
27
+ * `mode === 'off'`. */
28
+ export type ResolvedTooltip<P> = {
29
+ readonly mode: "off";
30
+ } | {
31
+ readonly mode: "default";
32
+ } | {
33
+ readonly mode: "render";
34
+ readonly render: (p: P) => unknown;
35
+ };
36
+ export declare function resolveTooltip<P>(input: TooltipInput<P> | undefined): ResolvedTooltip<P>;
37
+ /** Canonical list of tooltip-slot names the lib exposes.
38
+ * Stored for audit + documentation; not used at runtime. */
39
+ export declare const TOOLTIP_SLOT_NAMES: readonly ["tooltip", "markerTooltip", "signalTooltip", "orderTooltip", "positionTooltip", "eventTooltip", "drawingTooltip", "extremeTooltip", "volumeBarTooltip", "livePriceLineTooltip", "indicatorTooltip"];
40
+ export type TooltipSlotName = (typeof TOOLTIP_SLOT_NAMES)[number];
@@ -0,0 +1,6 @@
1
+ import { Viewport } from '../viewport';
2
+ export interface MountedCanvas {
3
+ ctx: CanvasRenderingContext2D;
4
+ viewport: Viewport;
5
+ }
6
+ export declare function mountCanvas(canvas: HTMLCanvasElement, viewport: Viewport): MountedCanvas;
@@ -0,0 +1,52 @@
1
+ import { Oklch } from '../personalization/palette/oklch';
2
+ import { Palette, Theme } from '../personalization/palette/types';
3
+ export declare const Slot: {
4
+ readonly Up: 0;
5
+ readonly Down: 1;
6
+ readonly Doji: 2;
7
+ readonly Neutral: 3;
8
+ readonly AccentTint: 4;
9
+ readonly Warn: 5;
10
+ readonly IndicatorSma: 6;
11
+ readonly IndicatorEma: 7;
12
+ readonly IndicatorWma: 8;
13
+ readonly IndicatorBb: 9;
14
+ readonly IndicatorVwap: 10;
15
+ readonly IndicatorRsi: 11;
16
+ readonly IndicatorMacd: 12;
17
+ readonly IndicatorStochastic: 13;
18
+ readonly IndicatorAtr: 14;
19
+ readonly IndicatorFib: 15;
20
+ readonly DrawingStroke: 16;
21
+ readonly DrawingFill: 17;
22
+ readonly DrawingHandle: 18;
23
+ readonly DrawingLabel: 19;
24
+ };
25
+ export type SlotValue = (typeof Slot)[keyof typeof Slot];
26
+ export declare const COLOR_TABLE_SIZE: number;
27
+ export declare function buildColorTable(palette: Palette, theme: Theme): Uint32Array;
28
+ /** Pre-cached CSS strings keyed by Slot enum + lazy per-alpha. Built
29
+ * once per palette/theme change in each controller. Per-frame draws
30
+ * read `get(slot)` (zero-alloc - returns the same cached string ref)
31
+ * or `withAlpha(slot, alpha)` (cached per `(slot, alpha)` tuple after
32
+ * the first call). Replaces ~100 per-draw `oklchToCssRgba(variant.X)`
33
+ * call sites with one indexed read.
34
+ *
35
+ * Contiguous Memory + Data-Oriented Design
36
+ * (color packing as Uint32Array → string array) + Zero-Allocation
37
+ * Fast Paths (no per-frame string allocation). */
38
+ export declare class ColorStringTable {
39
+ private readonly fullAlpha;
40
+ private readonly alphaCache;
41
+ constructor(packed: Uint32Array);
42
+ /** Zero-alloc fast-path - returns the cached `rgba(r,g,b,1)` string. */
43
+ get(slot: SlotValue): string;
44
+ /** Allocating once per `(slot, alpha)` pair; cached thereafter. Use
45
+ * when alpha varies per chart (e.g. faint fills, gradient stops). */
46
+ withAlpha(slot: SlotValue, alpha: number): string;
47
+ }
48
+ /** Convenience - build a packed table + string table together. */
49
+ export declare function buildColorStringTable(palette: Palette, theme: Theme): ColorStringTable;
50
+ export declare function packedToCssRgba(packed: number): string;
51
+ export declare function oklchToCssRgba(o: Oklch, alpha?: number): string;
52
+ export declare function withAlpha(css: string, alpha: number): string;
@@ -0,0 +1,49 @@
1
+ export interface Rect {
2
+ readonly x: number;
3
+ readonly y: number;
4
+ readonly w: number;
5
+ readonly h: number;
6
+ }
7
+ /** Fixed-capacity ring of dirty rects. Caller pushes rects throughout
8
+ * the frame; the consumer calls `flushCoalesced()` to get the merged
9
+ * rect (null when empty). */
10
+ export declare class DirtyRectRing {
11
+ private xs;
12
+ private ys;
13
+ private ws;
14
+ private hs;
15
+ private idx;
16
+ private filled;
17
+ push(x: number, y: number, w: number, h: number): void;
18
+ /** Merge all pending rects into a single bounding box. Resets the
19
+ * ring. Returns `null` when there's nothing pending. */
20
+ flushCoalesced(): Rect | null;
21
+ /** Flush all pending rects into `out` (length = number of rects).
22
+ * The caller owns the array - pass a reused
23
+ * scratch to avoid allocation. Returns count of populated entries.
24
+ * Resets the ring. */
25
+ flushAll(out: Rect[]): number;
26
+ /** Discard any pending rects without producing a flush. */
27
+ clear(): void;
28
+ size(): number;
29
+ }
30
+ /** Centralised decision - should this chart use partial dirty-rect
31
+ * repaints? Same threshold as the two-layer split for consistency. */
32
+ export declare function shouldUseDirtyRects(cssWidth: number, cssHeight: number): boolean;
33
+ /** Clip the canvas to the given rect + clear it. Caller must follow with
34
+ * the draw commands, then `restoreDirtyClip(ctx)` once done. The
35
+ * dynamic layer's per-frame clear is scoped to
36
+ * the union of dirty rects, not the full canvas. */
37
+ export declare function applyDirtyClip(ctx: CanvasRenderingContext2D, r: Rect): void;
38
+ /** Multi-rect variant of `applyDirtyClip`. Composes N disjoint rects
39
+ * into a single clip region by adding each as a sub-path before
40
+ * `ctx.clip()` (canvas2d unions sub-paths into the clip). Clears each
41
+ * rect individually so non-clipped pixels stay untouched.
42
+ *
43
+ * This is the win-path for crosshair-style overlays where the bbox of
44
+ * the union spans the whole plot area but the actual disturbed pixels
45
+ * fit in a thin V-strip + H-strip + small marker dot. */
46
+ export declare function applyDirtyClipMulti(ctx: CanvasRenderingContext2D, rects: readonly Rect[], count: number): void;
47
+ /** Tear down the matching `ctx.save()` paired with `applyDirtyClip`
48
+ * or `applyDirtyClipMulti`. */
49
+ export declare function restoreDirtyClip(ctx: CanvasRenderingContext2D): void;
@@ -0,0 +1,17 @@
1
+ export interface Rect {
2
+ x: number;
3
+ y: number;
4
+ w: number;
5
+ h: number;
6
+ }
7
+ export declare class DirtyRectAccumulator {
8
+ private dirty;
9
+ private minX;
10
+ private minY;
11
+ private maxX;
12
+ private maxY;
13
+ add(x: number, y: number, w: number, h: number): void;
14
+ get isDirty(): boolean;
15
+ union(out: Rect): boolean;
16
+ reset(): void;
17
+ }
@@ -0,0 +1,19 @@
1
+ import { CurveFactory } from 'd3-shape';
2
+ export interface DrawAreaFillThresholdArgs {
3
+ readonly ctx: CanvasRenderingContext2D;
4
+ readonly times: Float64Array;
5
+ readonly values: Float64Array;
6
+ readonly startIdx: number;
7
+ readonly endIdx: number;
8
+ readonly xToPx: (t: number) => number;
9
+ readonly yScale: {
10
+ toPx(v: number): number;
11
+ };
12
+ /** Domain-space threshold y. Polygons close down/up to this y. */
13
+ readonly thresholdY: number;
14
+ readonly aboveFill: string | CanvasGradient | CanvasPattern;
15
+ readonly belowFill: string | CanvasGradient | CanvasPattern;
16
+ /** Curve interpolator. Defaults to `curveLinear` if omitted. */
17
+ readonly curveFactory?: CurveFactory;
18
+ }
19
+ export declare function drawAreaFillThreshold(args: DrawAreaFillThresholdArgs): void;
@@ -0,0 +1,47 @@
1
+ import { CurveFactory } from 'd3-shape';
2
+ export interface DrawAreaFillArgs {
3
+ readonly ctx: CanvasRenderingContext2D;
4
+ readonly times: Float64Array;
5
+ readonly values: Float64Array;
6
+ readonly startIdx: number;
7
+ readonly endIdx: number;
8
+ readonly xToPx: (t: number) => number;
9
+ readonly yScale: {
10
+ toPx(v: number): number;
11
+ };
12
+ /** Domain-space y baseline. Same value used for every column in the run. */
13
+ readonly baselineY: number;
14
+ /** Pre-resolved CSS color (rgba / hex / CanvasGradient string). */
15
+ readonly fillStyle: string | CanvasGradient | CanvasPattern;
16
+ /** Curve interpolator. Defaults to `curveLinear` if omitted. */
17
+ readonly curveFactory?: CurveFactory;
18
+ /** Pattern overlay. When non-null, drawn on top of
19
+ * `fillStyle` using the same shape path. */
20
+ readonly patternFill?: CanvasPattern | null;
21
+ }
22
+ /** Stacked-band fill: per-x top + bottom (both curve-interpolated so the
23
+ * two edges align cleanly). NaN at any column splits the band into
24
+ * separate runs (same semantics as `drawAreaFill` for the top edge -
25
+ * the upstream `computeStackedLayout` propagates NaN to both arrays so a
26
+ * bad column shows on both edges).
27
+ *
28
+ * Args are pre-validated parallel arrays; render
29
+ * loop trusts the contract and emits canvas calls directly. */
30
+ export interface DrawStackedAreaFillArgs {
31
+ readonly ctx: CanvasRenderingContext2D;
32
+ readonly times: Float64Array;
33
+ readonly tops: Float64Array;
34
+ readonly baselines: Float64Array;
35
+ readonly startIdx: number;
36
+ readonly endIdx: number;
37
+ readonly xToPx: (t: number) => number;
38
+ readonly yScale: {
39
+ toPx(v: number): number;
40
+ };
41
+ readonly fillStyle: string | CanvasGradient | CanvasPattern;
42
+ readonly curveFactory?: CurveFactory;
43
+ /** Pattern overlay. */
44
+ readonly patternFill?: CanvasPattern | null;
45
+ }
46
+ export declare function drawAreaFill(args: DrawAreaFillArgs): void;
47
+ export declare function drawStackedAreaFill(args: DrawStackedAreaFillArgs): void;
@@ -0,0 +1,35 @@
1
+ export interface CreateAreaGradientArgs {
2
+ readonly ctx: CanvasRenderingContext2D;
3
+ readonly values: Float64Array;
4
+ readonly startIdx: number;
5
+ readonly endIdx: number;
6
+ readonly yScale: {
7
+ toPx(v: number): number;
8
+ };
9
+ /** Domain-space baseline y. Resolved upstream. */
10
+ readonly baselineY: number;
11
+ /** Line color at full opacity (rgba string). Top stop alpha is
12
+ * multiplied by `fillOpacity`. */
13
+ readonly fullColor: string;
14
+ /** Same line color at zero alpha (rgba string). */
15
+ readonly transparentColor: string;
16
+ }
17
+ /** Returns null if the value range is empty (no finite values in window). */
18
+ export declare function createAreaGradient(args: CreateAreaGradientArgs): CanvasGradient | null;
19
+ /** Stacked-band gradient - fades from `fullColor` at the band's top edge
20
+ * toward `transparentColor` at the band's bottom edge. Bounds derive from
21
+ * the per-x `tops` and `baselines` (the band's pixel-y extent across the
22
+ * visible window). NaN columns skipped. */
23
+ export interface CreateStackedAreaGradientArgs {
24
+ readonly ctx: CanvasRenderingContext2D;
25
+ readonly tops: Float64Array;
26
+ readonly baselines: Float64Array;
27
+ readonly startIdx: number;
28
+ readonly endIdx: number;
29
+ readonly yScale: {
30
+ toPx(v: number): number;
31
+ };
32
+ readonly fullColor: string;
33
+ readonly transparentColor: string;
34
+ }
35
+ export declare function createStackedAreaGradient(args: CreateStackedAreaGradientArgs): CanvasGradient | null;
@@ -0,0 +1,65 @@
1
+ import { LinearScale } from '../../viewport/scales/linear';
2
+ export type YAxisPosition = "left" | "right";
3
+ export type XAxisPosition = "top" | "bottom";
4
+ /** Polymorphic tick shape accepted by `drawYAxis` + `drawGrid`'s `yTicks`.
5
+ * Lets callers pass either `NiceTick { value, label }` or a tick with
6
+ * `atMs` (category ticks projected as y-axis labels on horizontal bar
7
+ * charts) without per-static-draw `.map()` adaptation. */
8
+ export interface YAxisTickLike {
9
+ readonly value?: number;
10
+ readonly atMs?: number;
11
+ readonly label: string;
12
+ }
13
+ export interface DrawYAxisArgs {
14
+ ctx: CanvasRenderingContext2D;
15
+ ticks: readonly YAxisTickLike[];
16
+ yScale: LinearScale;
17
+ position: YAxisPosition;
18
+ innerLeftPx: number;
19
+ innerRightPx: number;
20
+ labelGap: number;
21
+ tickLength: number;
22
+ spineColor: string;
23
+ textColor: string;
24
+ font: string;
25
+ fontSize: number;
26
+ spineVisible: boolean;
27
+ ticksVisible: boolean;
28
+ }
29
+ export declare function drawYAxis(args: DrawYAxisArgs): void;
30
+ export interface XAxisTick {
31
+ atMs: number;
32
+ label: string;
33
+ kind: number;
34
+ }
35
+ /** Polymorphic tick shape accepted by `drawXAxis`. Lets callers pass
36
+ * either the engine's `XAxisTick { atMs, kind, label }` or a `NiceTick
37
+ * { value, label }` without per-static-draw `.map()` adaptation
38
+ * (zero-allocation static-draw paths). The function
39
+ * reads `atMs ?? value` to resolve the numeric position. */
40
+ export interface XAxisTickLike {
41
+ readonly atMs?: number;
42
+ readonly value?: number;
43
+ readonly label: string;
44
+ readonly kind?: number;
45
+ }
46
+ export interface DrawXAxisArgs {
47
+ ctx: CanvasRenderingContext2D;
48
+ ticks: readonly XAxisTickLike[];
49
+ xToPx: (tMs: number) => number;
50
+ position: XAxisPosition;
51
+ innerLeftPx: number;
52
+ innerRightPx: number;
53
+ innerTopPx: number;
54
+ innerBottomPx: number;
55
+ labelGap: number;
56
+ tickLength: number;
57
+ spineColor: string;
58
+ textColor: string;
59
+ font: string;
60
+ fontSize: number;
61
+ spineVisible: boolean;
62
+ ticksVisible: boolean;
63
+ rotationDeg: number;
64
+ }
65
+ export declare function drawXAxis(args: DrawXAxisArgs): void;
@@ -0,0 +1,31 @@
1
+ export interface DrawBarArgs {
2
+ readonly ctx: CanvasRenderingContext2D;
3
+ /** Top-left x in CSS px. */
4
+ readonly x: number;
5
+ /** Top-left y in CSS px. */
6
+ readonly y: number;
7
+ /** Width in CSS px. Must be ≥ 0 (caller-clamped). */
8
+ readonly w: number;
9
+ /** Height in CSS px. Must be ≥ 0. */
10
+ readonly h: number;
11
+ /** Per-corner radii in CSS px. 0 = sharp. */
12
+ readonly tl: number;
13
+ readonly tr: number;
14
+ readonly br: number;
15
+ readonly bl: number;
16
+ /** Fill style. `null` skips the fill (e.g. Outline mode could go fill-
17
+ * free, though by default Outline still draws the tinted interior). */
18
+ readonly fillStyle: string | CanvasGradient | CanvasPattern | null;
19
+ /** Stroke color. `null` skips the stroke. */
20
+ readonly strokeStyle: string | null;
21
+ /** Stroke width in CSS px. Ignored when strokeStyle is null. */
22
+ readonly strokeWidth: number;
23
+ /** Optional pattern overlay. When non-null, drawn on top
24
+ * of `fillStyle` using the same shape path, letting both layers read
25
+ * (base color + textured tile). The pattern's own alpha
26
+ * ensures the base color shows through. */
27
+ readonly patternFill?: CanvasPattern | null;
28
+ }
29
+ /** @ZeroAlloc - per-bar draw primitive. No heap allocation per call.
30
+ * Verified by `bun run lint:zero-alloc`. */
31
+ export declare function drawBar(args: DrawBarArgs): void;
@@ -0,0 +1,43 @@
1
+ import { LiveBarIndicator, VisualStyle } from '../../personalization';
2
+ export interface CandleLiveTreatmentArgs {
3
+ ctx: CanvasRenderingContext2D;
4
+ mode: LiveBarIndicator;
5
+ /** Last bar's center x in CSS px. */
6
+ lastX: number;
7
+ /** Last bar's close y in CSS px. */
8
+ lastY: number;
9
+ /** Resolved body top y (after doji floor). */
10
+ bodyTop: number;
11
+ /** Resolved body bottom y. */
12
+ bodyBottom: number;
13
+ /** Last bar's wick top (= y of high). */
14
+ wickTop: number;
15
+ /** Last bar's wick bottom (= y of low). */
16
+ wickBottom: number;
17
+ /** Half body width in CSS px. */
18
+ halfBodyW: number;
19
+ /** Candle body's `cornerRadius` (in CSS px). The dotted-border
20
+ * treatment matches this so the border traces the candle's actual
21
+ * rounded silhouette instead of cutting across with sharp corners. */
22
+ cornerRadius: number;
23
+ /** Direction-aware accent color (already routed through tonal symmetry). */
24
+ directionColor: string;
25
+ /** Palette accent for badges. */
26
+ accentColor: string;
27
+ /** Chart background color (for badge fills). */
28
+ bgColor: string;
29
+ visualStyle: VisualStyle;
30
+ /** Current rAF time for animated modes. */
31
+ now: number;
32
+ /** When true, animated modes collapse to a static / non-pulsing form. */
33
+ reducedMotion: boolean;
34
+ /** Plot-rect bounds for badge clamping. */
35
+ innerLeft: number;
36
+ innerRight: number;
37
+ innerTop: number;
38
+ innerBottom: number;
39
+ /** Font + size for badge labels. */
40
+ font: string;
41
+ fontSize: number;
42
+ }
43
+ export declare function drawCandleLiveTreatment(args: CandleLiveTreatmentArgs): void;