@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,16 @@
1
+ export type KeyboardIntent = "pan-left" | "pan-right" | "pan-up" | "pan-down" | "zoom-in" | "zoom-out" | "reset-zoom" | "reset-domain" | "go-end" | "escape";
2
+ /** Translate a `KeyboardEvent.key` into an intent. Returns `null` when
3
+ * the key isn't bound (caller passes through). */
4
+ export declare function intentFromKey(key: string): KeyboardIntent | null;
5
+ export interface KeyboardHandlerOptions {
6
+ /** Called with the resolved intent. Caller decides which intents to
7
+ * honor (e.g. ScatterChart ignores `go-end` since it has no time axis). */
8
+ readonly onIntent: (intent: KeyboardIntent, ev: KeyboardEvent) => void;
9
+ /** When `true` (default), the handler calls `preventDefault()` on the
10
+ * bound keys so the browser doesn't scroll. */
11
+ readonly preventDefault?: boolean;
12
+ }
13
+ /** Build a keyboard listener that funnels mapped keys into `onIntent`.
14
+ * Unmapped keys pass through (no preventDefault). Returns a function
15
+ * the caller can `removeEventListener` to dispose. */
16
+ export declare function makeKeyboardHandler(opts: KeyboardHandlerOptions): (ev: KeyboardEvent) => void;
@@ -0,0 +1,27 @@
1
+ /** Heuristic - when `true`, treat the device as primarily touch
2
+ * (collapses crosshair to pin-on-click, opt-in pinch zoom, etc.). */
3
+ export declare function detectTouchOnly(): boolean;
4
+ export type LongPressBehavior = "crosshair" | "context-menu" | "none";
5
+ export declare const DEFAULT_LONG_PRESS_BEHAVIOR: LongPressBehavior;
6
+ export interface PinchEvent {
7
+ /** Scale ratio relative to the gesture start (`1 = no change`,
8
+ * `>1 = zoom in`, `<1 = zoom out`). */
9
+ readonly scale: number;
10
+ /** Midpoint of the two pointers, in CSS px on the host element. */
11
+ readonly centerX: number;
12
+ readonly centerY: number;
13
+ }
14
+ export interface PinchHandlerOptions {
15
+ readonly onPinch: (ev: PinchEvent) => void;
16
+ readonly onPinchEnd?: () => void;
17
+ }
18
+ export interface PinchHandler {
19
+ onPointerDown(ev: PointerEvent): void;
20
+ onPointerMove(ev: PointerEvent): void;
21
+ onPointerUp(ev: PointerEvent): void;
22
+ /** Force-clear the active gesture (e.g. on unmount). */
23
+ dispose(): void;
24
+ }
25
+ /** Build a pinch handler. Tracks active pointers and emits scale deltas
26
+ * on every pointermove during a two-finger gesture. */
27
+ export declare function makePinchHandler(opts: PinchHandlerOptions): PinchHandler;
@@ -0,0 +1,45 @@
1
+ export type FastModeInput = boolean | "auto";
2
+ export interface FastModeContext {
3
+ /** From `navigator.connection.effectiveType` if present. */
4
+ readonly effectiveType?: string;
5
+ /** From `navigator.deviceMemory` (GB). */
6
+ readonly deviceMemory?: number;
7
+ /** From `matchMedia('(prefers-reduced-motion: reduce)').matches`. */
8
+ readonly prefersReducedMotion?: boolean;
9
+ }
10
+ /** Translate `fastMode: 'auto'` into a concrete boolean using the
11
+ * context. Three triggers:
12
+ * - effectiveType is "slow-2g" / "2g"
13
+ * - deviceMemory ≤ 2 GB
14
+ * - prefersReducedMotion is set
15
+ * Any one trigger flips fastMode on. */
16
+ export declare function resolveFastModeAuto(input: FastModeInput | undefined, ctx: FastModeContext): boolean;
17
+ /** Detect the FastModeContext from `navigator` + `matchMedia`. Safe to
18
+ * call during SSR (returns an empty context). */
19
+ export declare function detectFastModeContext(): FastModeContext;
20
+ export type DowngradeLevel = 0 | 1 | 2 | 3;
21
+ export declare class FrameTimeMonitor {
22
+ private buf;
23
+ private idx;
24
+ private filled;
25
+ private level;
26
+ /** Cooldown counter - frames since the last level change. Prevents
27
+ * the monitor from chasing its tail and downgrading multiple levels
28
+ * in successive frames. */
29
+ private cooldown;
30
+ /** Record one frame's duration (ms). Returns the (possibly new) downgrade
31
+ * level. Caller checks against the previous level to decide whether to
32
+ * bust caches / re-render. */
33
+ recordFrame(ms: number): DowngradeLevel;
34
+ /** Current downgrade level (caller reads to apply to render config). */
35
+ currentLevel(): DowngradeLevel;
36
+ reset(): void;
37
+ private computeP95;
38
+ }
39
+ /** Map a downgrade level to the render config the chart should apply. */
40
+ export interface RenderConfigOverrides {
41
+ readonly disableGlow: boolean;
42
+ readonly disableAnimations: boolean;
43
+ readonly capDpr: boolean;
44
+ }
45
+ export declare function downgradeOverrides(level: DowngradeLevel): RenderConfigOverrides;
@@ -0,0 +1,16 @@
1
+ type Listener = () => void;
2
+ /** Register a callback that fires whenever `notifyMemoryPressure()` is
3
+ * called. Returns an unsubscribe function. Caches register at module
4
+ * load time. Order of dispatch is registration order. */
5
+ export declare function onMemoryPressure(cb: Listener): () => void;
6
+ /** Fire all registered listeners. Hosts call this when the platform
7
+ * signals memory pressure (e.g. iOS `didReceiveMemoryWarning` bridged
8
+ * through to web, or a manual host-side throttle). The lib also calls
9
+ * it internally from the visibility helper when a chart returns from
10
+ * > 5 minutes of background time (TODO - wire from VisibilityGate). */
11
+ export declare function notifyMemoryPressure(): void;
12
+ /** Test-only - current listener count. */
13
+ export declare function memoryPressureListenerCount(): number;
14
+ /** Test-only - drop all listeners. */
15
+ export declare function resetMemoryPressureListenersForTests(): void;
16
+ export {};
@@ -0,0 +1,32 @@
1
+ import { OffscreenContext } from './offscreen-canvas';
2
+ /** Returns `true` if this chart's workload + the runtime should route
3
+ * through the worker. Mirrors `shouldEngageOffscreenWorker` with the
4
+ * additional gates that the worker can actually be constructed and
5
+ * the canvas can transfer control. */
6
+ export declare function canEngageOffscreenWorker(canvas: HTMLCanvasElement, ctx: OffscreenContext): boolean;
7
+ export interface PaintRequest {
8
+ canvas: HTMLCanvasElement;
9
+ dpr: number;
10
+ cssWidth: number;
11
+ cssHeight: number;
12
+ times: Float64Array;
13
+ values: Float64Array;
14
+ /** Stroke / fill / line-width - anything that affects rendered
15
+ * pixels. Serialized into the postMessage clone. */
16
+ payload: Record<string, unknown>;
17
+ }
18
+ /** Dispatch a paint to the worker. Returns `true` on success, `false`
19
+ * when the host should fall back to main-thread rendering (worker
20
+ * unavailable, transfer failed, etc.). The function does NOT throw -
21
+ * errors decay to `false` so the caller's fallback path stays simple. */
22
+ export declare function tryPaintWithWorker(req: PaintRequest): boolean;
23
+ /** Tear down the worker globally. Charts call this on dispose if they
24
+ * were the last consumer; the next `tryPaintWithWorker` re-spawns. */
25
+ export declare function tearDownOffscreenWorker(): void;
26
+ /** Recent paint frame times reported by the worker - caller can fold
27
+ * into adaptive-complexity heuristics. */
28
+ export declare function recentWorkerFrameMs(): readonly number[];
29
+ /** For tests + the memory-pressure dispatcher - clear the recent-
30
+ * frame buffer + reset spawn-failed flag without terminating the
31
+ * worker. */
32
+ export declare function resetWorkerStats(): void;
@@ -0,0 +1,50 @@
1
+ declare const BULK_BAR_THRESHOLD = 5000;
2
+ declare const MULTI_CHART_THRESHOLD = 4;
3
+ declare const VISIBLE_MARK_THRESHOLD = 50000;
4
+ export interface OffscreenContext {
5
+ /** Total bars in the dataset. */
6
+ readonly bulkBarCount?: number;
7
+ /** Charts mounted on the same page sharing the engine. */
8
+ readonly mountedChartCount?: number;
9
+ /** Currently-visible marks (after downsampling). */
10
+ readonly visibleMarkCount?: number;
11
+ /** Honor host opt-outs (e.g. SSR snapshot mode). */
12
+ readonly disabled?: boolean;
13
+ }
14
+ /** Should the chart engage the offscreen-worker render path? */
15
+ export declare function shouldEngageOffscreenWorker(ctx: OffscreenContext): boolean;
16
+ export { BULK_BAR_THRESHOLD, MULTI_CHART_THRESHOLD, VISIBLE_MARK_THRESHOLD };
17
+ /** Host → worker. The host transfers the `OffscreenCanvas` reference
18
+ * once during `init`; subsequent paints reuse the same canvas. Numeric
19
+ * buffers are transferable typed arrays. */
20
+ export type WorkerInput = {
21
+ readonly kind: "init";
22
+ readonly canvas: OffscreenCanvas;
23
+ readonly dpr: number;
24
+ } | {
25
+ readonly kind: "resize";
26
+ readonly cssWidth: number;
27
+ readonly cssHeight: number;
28
+ readonly dpr: number;
29
+ } | {
30
+ readonly kind: "paint";
31
+ readonly times: Float64Array;
32
+ readonly values: Float64Array;
33
+ readonly payload: Record<string, unknown>;
34
+ } | {
35
+ readonly kind: "dispose";
36
+ };
37
+ /** Worker → host. The host updates UI based on these. */
38
+ export type WorkerOutput = {
39
+ readonly kind: "ready";
40
+ } | {
41
+ readonly kind: "painted";
42
+ readonly frameMs: number;
43
+ } | {
44
+ readonly kind: "error";
45
+ readonly message: string;
46
+ };
47
+ /** Reusable transferable-list builder. Caller passes the typed arrays
48
+ * whose backing buffers should be transferred (zero-copy), and we
49
+ * return the `Transferable[]` array `postMessage` consumes. */
50
+ export declare function transferablesFor(arrs: readonly ArrayBufferView[]): Transferable[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ /** Is `SharedArrayBuffer` available + the page is cross-origin-isolated? */
2
+ export declare function isSharedMemoryAvailable(): boolean;
3
+ /** Allocate a Float64-backed buffer using `SharedArrayBuffer` when
4
+ * available, falling back to a regular `Float64Array`. The returned
5
+ * array's `.buffer` is `SharedArrayBuffer` in the fast path; callers
6
+ * that want to be sure should check `.buffer instanceof SharedArrayBuffer`. */
7
+ export declare function allocSharedFloat64(length: number): Float64Array;
8
+ /** Allocate a Uint32-backed buffer using `SharedArrayBuffer` when
9
+ * available, falling back to a regular `Uint32Array`. */
10
+ export declare function allocSharedUint32(length: number): Uint32Array;
@@ -0,0 +1,39 @@
1
+ export interface VisibilitySource {
2
+ /** Current visibility state - true while page is visible AND element
3
+ * is intersecting. */
4
+ isVisible(): boolean;
5
+ /** Subscribe to changes. Returns an unsubscribe function. The callback
6
+ * fires AFTER `isVisible()` updates to its new value. */
7
+ onChange(cb: (visible: boolean) => void): () => void;
8
+ /** Tear down all observers + listeners. Idempotent. */
9
+ dispose(): void;
10
+ }
11
+ /** Higher-level helper that wraps a `VisibilitySource` + a single "the
12
+ * chart wants to draw, but maybe later" deferral state. Static-draw
13
+ * controllers (those without a persistent rAF loop) compose this so
14
+ * the visibility wiring is a one-liner.
15
+ *
16
+ * Usage in a controller:
17
+ * ```ts
18
+ * this.visGate = new VisibilityGate(opts.container ?? null, () => this.runStaticDraw())
19
+ * // In runStaticDraw entry: if (this.visGate.tryDefer()) return
20
+ * // In dispose: this.visGate.dispose()
21
+ * ```
22
+ * `tryDefer()` returns `true` when the chart is hidden - the caller
23
+ * short-circuits its draw, and the gate re-runs the callback on the
24
+ * next visibility wake. Returns `false` when visible - caller proceeds. */
25
+ export declare class VisibilityGate {
26
+ private readonly onWake;
27
+ private readonly source;
28
+ private readonly unsubscribe;
29
+ private deferred;
30
+ private disposed;
31
+ constructor(container: HTMLElement | null, onWake: () => void);
32
+ /** Returns true when the chart is hidden - caller short-circuits its
33
+ * draw. The gate remembers and will fire `onWake` when visibility
34
+ * flips back to visible. */
35
+ tryDefer(): boolean;
36
+ isVisible(): boolean;
37
+ dispose(): void;
38
+ }
39
+ export declare function createChartVisibility(target: HTMLElement): VisibilitySource;
@@ -0,0 +1,24 @@
1
+ declare const GPU_ENGAGE_THRESHOLD = 50000;
2
+ export type GpuRendererInput = "auto" | "on" | "off";
3
+ export declare const DEFAULT_GPU_RENDERER: GpuRendererInput;
4
+ export declare function resolveGpuRenderer(input: GpuRendererInput | undefined): GpuRendererInput;
5
+ export interface GpuEngageContext {
6
+ /** Visible mark count after downsampling. */
7
+ readonly visibleMarkCount: number;
8
+ /** Host-resolved `gpuRenderer`. */
9
+ readonly gpuRenderer: GpuRendererInput;
10
+ }
11
+ /** Decide whether the chart should engage the WebGL2 renderer.
12
+ * Returns false when WebGL2 is unavailable in this environment. */
13
+ export declare function shouldEngageWebgl(ctx: GpuEngageContext): boolean;
14
+ /** Cheap probe - returns true if `WebGL2RenderingContext` exists in the
15
+ * current realm. Doesn't actually allocate a context. */
16
+ export declare function isWebgl2Available(): boolean;
17
+ /** Try to obtain a WebGL2 context. Wraps the `getContext` call in
18
+ * try/catch + reports `null` on any error so the chart can fall back
19
+ * to canvas2d without crashing. */
20
+ export declare function tryGetWebgl2(canvas: HTMLCanvasElement): WebGL2RenderingContext | null;
21
+ /** Compile + link a shader program with try/catch - returns `null` on
22
+ * failure so the caller can fall back to canvas2d. */
23
+ export declare function compileShaderProgram(gl: WebGL2RenderingContext, vsSource: string, fsSource: string): WebGLProgram | null;
24
+ export { GPU_ENGAGE_THRESHOLD };
@@ -0,0 +1,2 @@
1
+ /** Idempotent - calling more than once is a no-op. */
2
+ export declare function wireBuiltInMemoryPressureClears(): void;
@@ -0,0 +1,16 @@
1
+ export type ChartKind = "line" | "area" | "candle" | "bar" | "renko" | "kagi" | "pnf" | "pie" | "donut" | "treemap" | "sunburst" | "heatmap" | "histogram" | "scatter" | "depth" | "sankey";
2
+ /** Default `aria-label` template. Concise + readable; hosts
3
+ * override via `ariaLabel` prop when they have more context. */
4
+ export declare function defaultAriaLabel(opts: {
5
+ readonly kind: ChartKind;
6
+ readonly seriesCount?: number;
7
+ readonly markCount?: number;
8
+ readonly symbol?: string;
9
+ }): string;
10
+ /** Apply ARIA attributes to a canvas host element. Idempotent - safe to
11
+ * call on every render. */
12
+ export declare function applyAriaAttributes(el: HTMLElement | undefined, opts: {
13
+ readonly label: string;
14
+ readonly role?: "img" | "figure";
15
+ readonly description?: string;
16
+ }): void;
@@ -0,0 +1,33 @@
1
+ export type BarEntryAnimation = "none" | "spring" | "fade" | "fade-stagger-left" | "fade-stagger-right" | "grow-from-baseline" | "rise-from-low" | "slide-from-right" | "slide-from-top" | "scale" | "expand-x" | "wave" | "wipe" | "random-fade";
2
+ export type BarUpdateAnimation = "none" | "morph + flash-direction" | "morph" | "flash-neutral" | "flash-direction" | "pulse" | "glow" | "tick-line" | "flicker" | "rise";
3
+ export type ThemeSwitchTransition = "fade" | "none";
4
+ export interface AnimationAxes {
5
+ barEntryAnimation: BarEntryAnimation;
6
+ barUpdateAnimation: BarUpdateAnimation;
7
+ /** ms ≥ 0; clamps to 0 under reduced-motion. */
8
+ crosshairFadeDuration: number;
9
+ /** ms ≥ 0; clamps to 0 under reduced-motion. */
10
+ tooltipFadeDuration: number;
11
+ panZoomSmoothing: boolean;
12
+ themeSwitchTransition: ThemeSwitchTransition;
13
+ }
14
+ export declare const ANIMATION_DEFAULTS: AnimationAxes;
15
+ export interface AnimationInputs {
16
+ barEntryAnimation?: BarEntryAnimation;
17
+ barUpdateAnimation?: BarUpdateAnimation;
18
+ crosshairFadeDuration?: number;
19
+ tooltipFadeDuration?: number;
20
+ panZoomSmoothing?: boolean;
21
+ themeSwitchTransition?: ThemeSwitchTransition;
22
+ }
23
+ export declare function resolveAnimation(input: AnimationInputs, reducedMotion: boolean): AnimationAxes;
24
+ /** Total entry-animation duration (cap 600ms). Stagger
25
+ * presets per-bar window is 220ms but total wall-clock cap is 600ms. */
26
+ export declare const ENTRY_DURATION_CAP_MS = 600;
27
+ export declare const ENTRY_STAGGER_PER_BAR_MS: number;
28
+ export declare const UPDATE_DURATION_DEFAULT_MS = 250;
29
+ export declare const PULSE_DURATION_MS = 250;
30
+ export declare const GLOW_DURATION_MS = 500;
31
+ export declare const TICK_LINE_DURATION_MS = 600;
32
+ export declare const FLICKER_DURATION_MS = 400;
33
+ export declare const RISE_DURATION_MS = 350;
@@ -0,0 +1,8 @@
1
+ export type AreaBaseline = "zero" | "first-value" | "last-value" | "min" | "max" | "mean" | "average" | "median" | number | ((window: Float64Array) => number);
2
+ export interface ResolveAreaBaselineArgs {
3
+ readonly baseline: AreaBaseline;
4
+ readonly values: Float64Array;
5
+ readonly startIdx: number;
6
+ readonly endIdx: number;
7
+ }
8
+ export declare function resolveAreaBaseline(args: ResolveAreaBaselineArgs): number;
@@ -0,0 +1,3 @@
1
+ export type AxisLabelsMode = "both" | "x-only" | "y-only" | "none";
2
+ export declare const DEFAULT_AXIS_LABELS: AxisLabelsMode;
3
+ export declare function resolveAxisLabels(input: AxisLabelsMode | undefined): AxisLabelsMode;
@@ -0,0 +1,3 @@
1
+ export type BinAlgorithm = "sturges" | "freedman-diaconis" | "scott" | "fixed";
2
+ export declare const DEFAULT_BIN_ALGORITHM: BinAlgorithm;
3
+ export declare function resolveBinAlgorithm(input: BinAlgorithm | undefined): BinAlgorithm;
@@ -0,0 +1,22 @@
1
+ export type BoxSizingInput = number | `atr-${number}` | `percent-${number}` | {
2
+ readonly type: "fixed";
3
+ readonly value: number;
4
+ } | {
5
+ readonly type: "atr";
6
+ readonly period: number;
7
+ } | {
8
+ readonly type: "percent";
9
+ readonly value: number;
10
+ };
11
+ export type ResolvedBoxSizing = {
12
+ readonly type: "fixed";
13
+ readonly value: number;
14
+ } | {
15
+ readonly type: "atr";
16
+ readonly period: number;
17
+ } | {
18
+ readonly type: "percent";
19
+ readonly value: number;
20
+ };
21
+ export declare const DEFAULT_BOX_SIZING: ResolvedBoxSizing;
22
+ export declare function resolveBoxSizing(input: BoxSizingInput | undefined): ResolvedBoxSizing;
@@ -0,0 +1,3 @@
1
+ export type CellShape = "rect" | "circle";
2
+ export declare const DEFAULT_CELL_SHAPE: CellShape;
3
+ export declare function resolveCellShape(input: CellShape | undefined): CellShape;
@@ -0,0 +1,11 @@
1
+ import { CurveFactory } from 'd3-shape';
2
+ export type CurveTypeName = "linear" | "monotone" | "monotone-x" | "monotone-y" | "step" | "step-before" | "step-after" | "bump" | "bump-x" | "bump-y" | "natural" | "basis" | "cardinal" | "catmull-rom";
3
+ export interface CurveTypeConfig {
4
+ readonly type: CurveTypeName;
5
+ /** 0–1 - only honored for `cardinal`. Default 0. Higher = looser curve. */
6
+ readonly tension?: number;
7
+ /** 0–1 - only honored for `catmull-rom`. Default 0.5 (centripetal). */
8
+ readonly alpha?: number;
9
+ }
10
+ export type CurveType = CurveTypeName | CurveTypeConfig;
11
+ export declare function resolveCurveFactory(curveType: CurveType, stepEdgeRadius: number): CurveFactory;
@@ -0,0 +1,4 @@
1
+ export type DensityInput = "off" | "auto" | "on";
2
+ export type DensityRenderMode = "points" | "heatmap";
3
+ export declare const DENSITY_AUTO_THRESHOLD = 50000;
4
+ export declare function resolveDensityMode(input: DensityInput | undefined, pointCount: number): DensityRenderMode;
@@ -0,0 +1,3 @@
1
+ export type DepthFillType = "flat" | "gradient";
2
+ export declare const DEFAULT_DEPTH_FILL_TYPE: DepthFillType;
3
+ export declare function resolveDepthFillType(input: DepthFillType | undefined): DepthFillType;
@@ -0,0 +1,2 @@
1
+ export type DepthLimitInput = number | "all";
2
+ export declare function resolveDepthLimit(input: DepthLimitInput | undefined): number;
@@ -0,0 +1,21 @@
1
+ export type GlowPreset = "off" | "subtle" | "standard" | "intense";
2
+ /** Host-supplied input. Named presets resolve to fixed strengths; numeric
3
+ * values clamp to `[0, 1]`. */
4
+ export type GlowInput = GlowPreset | number;
5
+ /** `'auto'` (default) = each mark glows in its own direction color
6
+ * (`up`/`down`/`doji` from the palette). A literal color (any CSS-color
7
+ * string, hex, or `oklch(...)`) overrides for uniform brand glow. */
8
+ export type GlowColorInput = "auto" | string;
9
+ export interface ResolvedGlow {
10
+ /** Normalized strength 0..1. Zero means glow is off; the rendering
11
+ * primitive short-circuits and avoids the offscreen pass entirely. */
12
+ readonly strength: number;
13
+ /** Direction-aware or literal. `'auto'` triggers direction resolution at
14
+ * draw time using the chart's palette. */
15
+ readonly color: "auto" | string;
16
+ }
17
+ export declare const DEFAULT_GLOW: GlowInput;
18
+ export declare const DEFAULT_GLOW_COLOR: GlowColorInput;
19
+ /** Resolve glow inputs to a normalized form. `fastMode` forces strength
20
+ * to zero regardless of input. */
21
+ export declare function resolveGlow(input: GlowInput | undefined, color: GlowColorInput | undefined, fastMode: boolean): ResolvedGlow;
@@ -0,0 +1,31 @@
1
+ export type HeatmapColorScaleType = "sequential" | "diverging" | "qualitative";
2
+ interface DivergingConfig {
3
+ readonly type: "diverging";
4
+ /** Value mapped to the neutral mid-point. Default 0. */
5
+ readonly midpoint?: number;
6
+ /** `[low, high]` data range. When omitted, auto-fits to the data's
7
+ * symmetric extent at compute time. */
8
+ readonly domain?: readonly [number, number];
9
+ }
10
+ interface SequentialConfig {
11
+ readonly type: "sequential";
12
+ /** `[low, high]` data range. When omitted, auto-fits to data extent. */
13
+ readonly domain?: readonly [number, number];
14
+ }
15
+ interface QualitativeConfig {
16
+ readonly type: "qualitative";
17
+ }
18
+ export type HeatmapColorScaleInput = HeatmapColorScaleType | DivergingConfig | SequentialConfig | QualitativeConfig;
19
+ export type ResolvedHeatmapColorScale = {
20
+ readonly type: "diverging";
21
+ readonly midpoint: number;
22
+ readonly domain: readonly [number, number] | null;
23
+ } | {
24
+ readonly type: "sequential";
25
+ readonly domain: readonly [number, number] | null;
26
+ } | {
27
+ readonly type: "qualitative";
28
+ };
29
+ export declare const DEFAULT_HEATMAP_COLOR_SCALE: HeatmapColorScaleType;
30
+ export declare function resolveHeatmapColorScale(input: HeatmapColorScaleInput | undefined): ResolvedHeatmapColorScale;
31
+ export {};
@@ -0,0 +1,18 @@
1
+ export type HistogramOverlayType = "normal" | "cumulative-line";
2
+ interface OverlayStyle {
3
+ /** `'auto'` resolves to `palette.neutral` at draw time. */
4
+ readonly color?: "auto" | string;
5
+ readonly lineWidth?: number;
6
+ readonly lineDash?: readonly number[];
7
+ }
8
+ export type HistogramOverlayInput = false | "normal" | "cumulative-line" | (OverlayStyle & {
9
+ readonly type: HistogramOverlayType;
10
+ });
11
+ export interface ResolvedHistogramOverlay {
12
+ readonly type: HistogramOverlayType;
13
+ readonly color: "auto" | string;
14
+ readonly lineWidth: number;
15
+ readonly lineDash: readonly number[] | null;
16
+ }
17
+ export declare function resolveHistogramOverlay(input: HistogramOverlayInput | undefined): ResolvedHistogramOverlay | null;
18
+ export {};
@@ -0,0 +1,85 @@
1
+ export type IndicatorLineStyle = "solid" | "dashed" | "dotted";
2
+ export interface IndicatorPaneCommon {
3
+ /** `'auto'` resolves from `palette.indicators.<type>` at draw time. */
4
+ color?: "auto" | string;
5
+ /** Overrides global `indicatorLineWidth`. */
6
+ lineWidth?: number;
7
+ /** Overrides global `indicatorLineStyle`. */
8
+ lineStyle?: IndicatorLineStyle;
9
+ /** Overrides global `indicatorOpacity`. */
10
+ opacity?: number;
11
+ }
12
+ export interface RsiSpecInput extends IndicatorPaneCommon {
13
+ type: "rsi";
14
+ period?: number;
15
+ overbought?: number;
16
+ oversold?: number;
17
+ }
18
+ export interface MacdSpecInput extends IndicatorPaneCommon {
19
+ type: "macd";
20
+ fastPeriod?: number;
21
+ slowPeriod?: number;
22
+ signalPeriod?: number;
23
+ histogramVisible?: boolean;
24
+ }
25
+ export interface StochasticSpecInput extends IndicatorPaneCommon {
26
+ type: "stochastic";
27
+ kPeriod?: number;
28
+ dPeriod?: number;
29
+ smoothing?: number;
30
+ overbought?: number;
31
+ oversold?: number;
32
+ }
33
+ export interface AtrSpecInput extends IndicatorPaneCommon {
34
+ type: "atr";
35
+ period?: number;
36
+ }
37
+ export type IndicatorPaneSpec = RsiSpecInput | MacdSpecInput | StochasticSpecInput | AtrSpecInput;
38
+ export interface ResolvedRsiSpec {
39
+ type: "rsi";
40
+ period: number;
41
+ overbought: number;
42
+ oversold: number;
43
+ color: "auto" | string;
44
+ lineWidth: number;
45
+ lineStyle: IndicatorLineStyle;
46
+ opacity: number;
47
+ }
48
+ export interface ResolvedMacdSpec {
49
+ type: "macd";
50
+ fastPeriod: number;
51
+ slowPeriod: number;
52
+ signalPeriod: number;
53
+ histogramVisible: boolean;
54
+ color: "auto" | string;
55
+ lineWidth: number;
56
+ lineStyle: IndicatorLineStyle;
57
+ opacity: number;
58
+ }
59
+ export interface ResolvedStochasticSpec {
60
+ type: "stochastic";
61
+ kPeriod: number;
62
+ dPeriod: number;
63
+ smoothing: number;
64
+ overbought: number;
65
+ oversold: number;
66
+ color: "auto" | string;
67
+ lineWidth: number;
68
+ lineStyle: IndicatorLineStyle;
69
+ opacity: number;
70
+ }
71
+ export interface ResolvedAtrSpec {
72
+ type: "atr";
73
+ period: number;
74
+ color: "auto" | string;
75
+ lineWidth: number;
76
+ lineStyle: IndicatorLineStyle;
77
+ opacity: number;
78
+ }
79
+ export type ResolvedIndicatorPaneSpec = ResolvedRsiSpec | ResolvedMacdSpec | ResolvedStochasticSpec | ResolvedAtrSpec;
80
+ export interface IndicatorGlobalDefaults {
81
+ lineWidth: number;
82
+ lineStyle: IndicatorLineStyle;
83
+ opacity: number;
84
+ }
85
+ export declare function resolveIndicatorPaneSpec(spec: IndicatorPaneSpec, globals: IndicatorGlobalDefaults): ResolvedIndicatorPaneSpec;
@@ -0,0 +1,3 @@
1
+ export type LabelBehavior = "show-all" | "truncate" | "wrap" | "hide-on-overflow" | "auto";
2
+ export declare const DEFAULT_LABEL_BEHAVIOR: LabelBehavior;
3
+ export declare function resolveLabelBehavior(input: LabelBehavior | undefined): LabelBehavior;
@@ -0,0 +1,17 @@
1
+ export type LabelContentPreset = "name" | "value" | "percent" | "name + value" | "name + percent" | "all";
2
+ export interface SliceLabelData {
3
+ readonly name: string;
4
+ readonly value: number;
5
+ /** 0–1 fraction of the total. */
6
+ readonly percent: number;
7
+ }
8
+ export type LabelContentInput = LabelContentPreset | ((slice: SliceLabelData) => string);
9
+ export type ResolvedLabelContent = {
10
+ readonly kind: "preset";
11
+ readonly preset: LabelContentPreset;
12
+ } | {
13
+ readonly kind: "function";
14
+ readonly fn: (slice: SliceLabelData) => string;
15
+ };
16
+ export declare const DEFAULT_LABEL_CONTENT: LabelContentPreset;
17
+ export declare function resolveLabelContent(input: LabelContentInput | undefined): ResolvedLabelContent;
@@ -0,0 +1,3 @@
1
+ export type LabelPlacement = "inside" | "outside" | "leader-line" | "auto" | "off";
2
+ export declare const DEFAULT_LABEL_PLACEMENT: LabelPlacement;
3
+ export declare function resolveLabelPlacement(input: LabelPlacement | undefined): LabelPlacement;
@@ -0,0 +1,3 @@
1
+ export type LabelRotation = "horizontal" | "radial" | "tangent" | "auto";
2
+ export declare const DEFAULT_LABEL_ROTATION: LabelRotation;
3
+ export declare function resolveLabelRotation(input: LabelRotation | undefined): LabelRotation;
@@ -0,0 +1,14 @@
1
+ interface LevelHighlightConfig {
2
+ /** `'auto'` resolves to `palette.warn` at draw time (visual urgency). */
3
+ readonly color?: "auto" | string;
4
+ readonly lineWidth?: number;
5
+ readonly lineDash?: readonly number[];
6
+ }
7
+ export type LevelHighlightInput = false | true | LevelHighlightConfig;
8
+ export interface ResolvedLevelHighlight {
9
+ readonly color: "auto" | string;
10
+ readonly lineWidth: number;
11
+ readonly lineDash: readonly number[] | null;
12
+ }
13
+ export declare function resolveLevelHighlight(input: LevelHighlightInput | undefined): ResolvedLevelHighlight | null;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ export type LineDash = "solid" | "dashed" | "dotted" | readonly number[];
2
+ export declare function resolveLineDash(lineDash: LineDash, lineDashSpacing: number): number[];
@@ -0,0 +1,14 @@
1
+ export type MidLineStyle = "solid" | "dashed";
2
+ interface MidLineConfig {
3
+ readonly style?: MidLineStyle;
4
+ readonly color?: "auto" | string;
5
+ readonly lineWidth?: number;
6
+ }
7
+ export type MidLineInput = false | true | "dashed" | MidLineConfig;
8
+ export interface ResolvedMidLine {
9
+ readonly style: MidLineStyle;
10
+ readonly color: "auto" | string;
11
+ readonly lineWidth: number;
12
+ }
13
+ export declare function resolveMidLine(input: MidLineInput | undefined): ResolvedMidLine | null;
14
+ export {};
@@ -0,0 +1,3 @@
1
+ export type NodeAlignment = "justify" | "left" | "right" | "center";
2
+ export declare const DEFAULT_NODE_ALIGNMENT: NodeAlignment;
3
+ export declare function resolveNodeAlignment(input: NodeAlignment | undefined): NodeAlignment;