chartgpu 0.2.2 → 0.2.3

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 (47) hide show
  1. package/README.md +21 -3
  2. package/dist/core/createRenderCoordinator.d.ts.map +1 -1
  3. package/dist/core/renderCoordinator/animation/animationHelpers.d.ts +183 -0
  4. package/dist/core/renderCoordinator/animation/animationHelpers.d.ts.map +1 -0
  5. package/dist/core/renderCoordinator/annotations/processAnnotations.d.ts +88 -0
  6. package/dist/core/renderCoordinator/annotations/processAnnotations.d.ts.map +1 -0
  7. package/dist/core/renderCoordinator/axis/axisLabelHelpers.d.ts +91 -0
  8. package/dist/core/renderCoordinator/axis/axisLabelHelpers.d.ts.map +1 -0
  9. package/dist/core/renderCoordinator/axis/computeAxisTicks.d.ts +53 -0
  10. package/dist/core/renderCoordinator/axis/computeAxisTicks.d.ts.map +1 -0
  11. package/dist/core/renderCoordinator/data/computeVisibleSlice.d.ts +68 -0
  12. package/dist/core/renderCoordinator/data/computeVisibleSlice.d.ts.map +1 -0
  13. package/dist/core/renderCoordinator/gpu/textureManager.d.ts +69 -0
  14. package/dist/core/renderCoordinator/gpu/textureManager.d.ts.map +1 -0
  15. package/dist/core/renderCoordinator/interaction/interactionHelpers.d.ts +160 -0
  16. package/dist/core/renderCoordinator/interaction/interactionHelpers.d.ts.map +1 -0
  17. package/dist/core/renderCoordinator/render/renderAnnotationLabels.d.ts +36 -0
  18. package/dist/core/renderCoordinator/render/renderAnnotationLabels.d.ts.map +1 -0
  19. package/dist/core/renderCoordinator/render/renderAxisLabels.d.ts +40 -0
  20. package/dist/core/renderCoordinator/render/renderAxisLabels.d.ts.map +1 -0
  21. package/dist/core/renderCoordinator/render/renderOverlays.d.ts +70 -0
  22. package/dist/core/renderCoordinator/render/renderOverlays.d.ts.map +1 -0
  23. package/dist/core/renderCoordinator/render/renderSeries.d.ts +146 -0
  24. package/dist/core/renderCoordinator/render/renderSeries.d.ts.map +1 -0
  25. package/dist/core/renderCoordinator/renderers/rendererPool.d.ts +112 -0
  26. package/dist/core/renderCoordinator/renderers/rendererPool.d.ts.map +1 -0
  27. package/dist/core/renderCoordinator/types.d.ts +19 -0
  28. package/dist/core/renderCoordinator/types.d.ts.map +1 -0
  29. package/dist/core/renderCoordinator/ui/tooltipLegendHelpers.d.ts +104 -0
  30. package/dist/core/renderCoordinator/ui/tooltipLegendHelpers.d.ts.map +1 -0
  31. package/dist/core/renderCoordinator/utils/axisUtils.d.ts +122 -0
  32. package/dist/core/renderCoordinator/utils/axisUtils.d.ts.map +1 -0
  33. package/dist/core/renderCoordinator/utils/boundsComputation.d.ts +69 -0
  34. package/dist/core/renderCoordinator/utils/boundsComputation.d.ts.map +1 -0
  35. package/dist/core/renderCoordinator/utils/canvasUtils.d.ts +52 -0
  36. package/dist/core/renderCoordinator/utils/canvasUtils.d.ts.map +1 -0
  37. package/dist/core/renderCoordinator/utils/dataPointUtils.d.ts +71 -0
  38. package/dist/core/renderCoordinator/utils/dataPointUtils.d.ts.map +1 -0
  39. package/dist/core/renderCoordinator/utils/index.d.ts +12 -0
  40. package/dist/core/renderCoordinator/utils/index.d.ts.map +1 -0
  41. package/dist/core/renderCoordinator/utils/timeAxisUtils.d.ts +149 -0
  42. package/dist/core/renderCoordinator/utils/timeAxisUtils.d.ts.map +1 -0
  43. package/dist/core/renderCoordinator/zoom/zoomHelpers.d.ts +129 -0
  44. package/dist/core/renderCoordinator/zoom/zoomHelpers.d.ts.map +1 -0
  45. package/dist/index.js +5726 -5347
  46. package/dist/index.js.map +1 -1
  47. package/package.json +4 -2
package/README.md CHANGED
@@ -38,7 +38,7 @@ ChartGPU is a TypeScript charting library built on WebGPU for smooth, interactiv
38
38
 
39
39
  ## Architecture
40
40
 
41
- At a high level, `ChartGPU.create(...)` owns the canvas + WebGPU lifecycle, and delegates render orchestration (layout/scales/data upload/render passes + internal overlays) to the render coordinator. For deeper internal notes, see [`docs/api/INTERNALS.md`](https://github.com/hunterg325/ChartGPU/blob/main/docs/api/INTERNALS.md) (especially Render coordinator).
41
+ At a high level, `ChartGPU.create(...)` owns the canvas + WebGPU lifecycle, and delegates render orchestration (layout/scales/data upload/render passes + internal overlays) to the render coordinator. For deeper internal notes, see [`docs/api/INTERNALS.md`](https://github.com/hunterg325/ChartGPU/blob/main/docs/api/INTERNALS.md) (especially "Render coordinator").
42
42
 
43
43
  ```mermaid
44
44
  flowchart TB
@@ -77,7 +77,23 @@ flowchart TB
77
77
  GPUInit --> CanvasConfig["canvasContext.configure(format)"]
78
78
  end
79
79
 
80
- subgraph RenderCoordinatorLayer["Render coordinator (src/core/createRenderCoordinator.ts)"]
80
+ subgraph RenderCoordinatorLayer["Render coordinator (src/core/createRenderCoordinator.ts)<br/>Modular architecture with specialized modules"]
81
+ subgraph CoordModules["Coordinator modules (src/core/renderCoordinator/*)"]
82
+ Utils["utils/ - Canvas, bounds, axes, time formatting"]
83
+ GPU["gpu/ - Texture management, MSAA"]
84
+ Renderers["renderers/ - Renderer pool management"]
85
+ DataMods["data/ - Visible slice computation"]
86
+ Zoom["zoom/ - Zoom state utilities"]
87
+ Anim["animation/ - Animation helpers"]
88
+ Interact["interaction/ - Pointer & hit-testing"]
89
+ UI["ui/ - Tooltip & legend helpers"]
90
+ AxisMods["axis/ - Tick computation & labels"]
91
+ Annot["annotations/ - Annotation processing"]
92
+ Render["render/ - Series, overlays, labels"]
93
+ end
94
+
95
+ Coordinator --> CoordModules
96
+
81
97
  Coordinator --> Layout["GridArea layout"]
82
98
  Coordinator --> Scales["xScale/yScale (clip space for render)"]
83
99
  Coordinator --> DataUpload["createDataStore(device) (GPU buffer upload/caching)"]
@@ -249,7 +265,9 @@ See the [chartgpu-react repository](https://github.com/ChartGPU/chartgpu-react)
249
265
 
250
266
  - Chrome 113+ or Edge 113+ (WebGPU enabled by default)
251
267
  - Safari 18+ (WebGPU enabled by default)
252
- - Firefox: not supported (WebGPU support in development)
268
+ - Firefox: Windows 114+, Mac 145+, Linux nightly
269
+
270
+ See the [gpuweb repository](https://github.com/gpuweb/gpuweb/wiki/Implementation-Status) for full Implementation Status
253
271
 
254
272
  ## Documentation
255
273
 
@@ -1 +1 @@
1
- {"version":3,"file":"createRenderCoordinator.d.ts","sourceRoot":"","sources":["../../src/core/createRenderCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,uBAAuB,EAExB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAGV,SAAS,EAET,aAAa,EAId,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAiD,MAAM,cAAc,CAAC;AAkEzF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChD,QAAQ,CAAC,eAAe,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AA4CD,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,eAAe,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC3D;;;;;OAKG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IAC1G;;;;;OAKG;IACH,eAAe,IAAI,MAAM,GAAG,IAAI,CAAC;IACjC;;;;OAIG;IACH,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1D;;;;OAIG;IACH,oBAAoB,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAA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I,CAAC;IAC7F,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD,CAAC,CAAC;AAo3BH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,uBAAuB,EAChC,SAAS,CAAC,EAAE,0BAA0B,GACrC,iBAAiB,CAorFnB"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Animation helper utilities for intro and update animations.
3
+ *
4
+ * Provides pure functions for animation config resolution, easing transformations,
5
+ * series interpolation, and animation state management. These utilities support
6
+ * both intro animations (initial reveal) and update animations (smooth transitions).
7
+ *
8
+ * @module animationHelpers
9
+ */
10
+ import type { AnimationConfig, DataPoint } from '../../../config/types';
11
+ import type { ResolvedPieSeriesConfig } from '../../../config/OptionResolver';
12
+ import type { EasingFunction } from '../../../utils/easing';
13
+ /**
14
+ * Intro animation phase state machine.
15
+ */
16
+ export type IntroPhase = 'pending' | 'running' | 'done';
17
+ /**
18
+ * Domain boundaries with min and max values.
19
+ */
20
+ export interface DomainBounds {
21
+ readonly min: number;
22
+ readonly max: number;
23
+ }
24
+ /**
25
+ * Resolved animation configuration with timing and easing.
26
+ */
27
+ export interface ResolvedAnimationConfig {
28
+ readonly delayMs: number;
29
+ readonly durationMs: number;
30
+ readonly easing: EasingFunction;
31
+ }
32
+ /**
33
+ * Series configuration type that supports all series types.
34
+ */
35
+ export type AnySeriesConfig = {
36
+ readonly type: 'line';
37
+ readonly data: ReadonlyArray<DataPoint>;
38
+ } | {
39
+ readonly type: 'area';
40
+ readonly data: ReadonlyArray<DataPoint>;
41
+ } | {
42
+ readonly type: 'bar';
43
+ readonly data: ReadonlyArray<DataPoint>;
44
+ } | {
45
+ readonly type: 'scatter';
46
+ readonly data: ReadonlyArray<DataPoint>;
47
+ } | {
48
+ readonly type: 'candlestick';
49
+ readonly data: ReadonlyArray<any>;
50
+ } | ResolvedPieSeriesConfig;
51
+ /**
52
+ * Clamps a value between 0 and 1.
53
+ *
54
+ * @param value - Value to clamp
55
+ * @returns Clamped value in [0, 1]
56
+ */
57
+ export declare function clamp01(value: number): number;
58
+ /**
59
+ * Resolves animation configuration from options.
60
+ *
61
+ * Returns null if animation is disabled (false or null).
62
+ * Returns default config if animation is true or an empty object.
63
+ * Converts duration/delay from user config to milliseconds.
64
+ *
65
+ * @param animation - Animation options from chart config
66
+ * @param getEasingFn - Function to resolve easing by name (to avoid circular deps)
67
+ * @returns Resolved animation config or null if disabled
68
+ */
69
+ export declare function resolveAnimationConfig(animation: boolean | AnimationConfig | null | undefined, getEasingFn: (name: string) => EasingFunction): ResolvedAnimationConfig | null;
70
+ /**
71
+ * Creates an easing function that incorporates delay.
72
+ *
73
+ * The returned function maps t ∈ [0, 1] to an output considering both delay
74
+ * and duration:
75
+ * - t in [0, delay]: output = 0 (delay phase)
76
+ * - t in [delay, delay+duration]: output = easing((t-delay)/duration)
77
+ * - t > delay+duration: output = 1 (complete)
78
+ *
79
+ * @param delayMs - Delay before animation starts (milliseconds)
80
+ * @param durationMs - Animation duration after delay (milliseconds)
81
+ * @param easing - Base easing function to apply after delay
82
+ * @returns Easing function with delay incorporated
83
+ */
84
+ export declare function createEasingWithDelay(delayMs: number, durationMs: number, easing: EasingFunction): EasingFunction;
85
+ /**
86
+ * Checks if a series configuration has drawable marks.
87
+ *
88
+ * Returns true if the series has data that will produce visible marks:
89
+ * - Pie: at least one slice with value > 0
90
+ * - Cartesian (line/area/bar/scatter/candlestick): at least one data point
91
+ *
92
+ * @param series - Series configuration to check
93
+ * @returns True if series has drawable content
94
+ */
95
+ export declare function hasDrawableMarks(series: AnySeriesConfig): boolean;
96
+ /**
97
+ * Checks if any series in the list has drawable marks.
98
+ *
99
+ * @param seriesList - Array of series configurations
100
+ * @returns True if at least one series has drawable marks
101
+ */
102
+ export declare function hasAnyDrawableMarks(seriesList: ReadonlyArray<AnySeriesConfig>): boolean;
103
+ /**
104
+ * Linearly interpolates between two domain bounds.
105
+ *
106
+ * @param from - Starting domain
107
+ * @param to - Ending domain
108
+ * @param t - Interpolation progress [0, 1]
109
+ * @returns Interpolated domain
110
+ */
111
+ export declare function lerpDomain(from: DomainBounds, to: DomainBounds, t: number): DomainBounds;
112
+ /**
113
+ * Linearly interpolates between two numbers.
114
+ *
115
+ * @param from - Starting value
116
+ * @param to - Ending value
117
+ * @param t - Interpolation progress [0, 1]
118
+ * @returns Interpolated value
119
+ */
120
+ export declare function lerp(from: number, to: number, t: number): number;
121
+ /**
122
+ * Interpolates cartesian series data between from and to states.
123
+ *
124
+ * Returns null if array lengths don't match (can't interpolate mismatched arrays).
125
+ * Reuses cache array if provided and same length.
126
+ *
127
+ * @param fromData - Starting data points
128
+ * @param toData - Ending data points
129
+ * @param t - Interpolation progress [0, 1]
130
+ * @param cache - Optional cache array to reuse
131
+ * @returns Interpolated data points or null if lengths mismatch
132
+ */
133
+ export declare function interpolateCartesianData(fromData: ReadonlyArray<DataPoint>, toData: ReadonlyArray<DataPoint>, t: number, cache: DataPoint[] | null): DataPoint[] | null;
134
+ /**
135
+ * Interpolates pie series data between from and to states.
136
+ *
137
+ * Returns the toSeries unchanged if data array lengths don't match.
138
+ * Only interpolates the value property; angles are recomputed by the renderer.
139
+ *
140
+ * @param fromSeries - Starting pie series
141
+ * @param toSeries - Ending pie series
142
+ * @param t - Interpolation progress [0, 1]
143
+ * @param cache - Optional cache array to reuse
144
+ * @returns Interpolated pie series
145
+ */
146
+ export declare function interpolatePieData(fromSeries: ResolvedPieSeriesConfig, toSeries: ResolvedPieSeriesConfig, t: number, cache: ResolvedPieSeriesConfig['data'] | null): ResolvedPieSeriesConfig;
147
+ /**
148
+ * Checks if two domain bounds are equal.
149
+ *
150
+ * @param a - First domain
151
+ * @param b - Second domain
152
+ * @returns True if domains have identical min and max
153
+ */
154
+ export declare function isDomainEqual(a: DomainBounds, b: DomainBounds): boolean;
155
+ /**
156
+ * Determines the next intro phase based on current state and conditions.
157
+ *
158
+ * State machine transitions:
159
+ * - pending → running: when has drawable marks and animation enabled
160
+ * - running → done: when animation completes
161
+ * - done → pending: when retriggering (e.g., visibility change)
162
+ *
163
+ * @param currentPhase - Current intro phase
164
+ * @param hasDrawable - Whether series have drawable marks
165
+ * @param animationEnabled - Whether animation is enabled
166
+ * @param retrigger - Whether to retrigger from done state
167
+ * @returns Next intro phase
168
+ */
169
+ export declare function computeNextIntroPhase(currentPhase: IntroPhase, hasDrawable: boolean, animationEnabled: boolean, retrigger?: boolean): IntroPhase;
170
+ /**
171
+ * Applies intro animation progress to create an animated bar Y scale.
172
+ *
173
+ * During intro, bars grow from the zero line (or domain min if no zero).
174
+ * This creates a scale that compresses bars based on progress.
175
+ *
176
+ * @param baseYScale - Original Y scale
177
+ * @param yMin - Domain minimum
178
+ * @param yMax - Domain maximum
179
+ * @param progress - Animation progress [0, 1]
180
+ * @returns Y coordinate adjusted for intro animation
181
+ */
182
+ export declare function applyBarIntroProgress(baseY: number, yMin: number, yMax: number, progress: number): number;
183
+ //# sourceMappingURL=animationHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animationHelpers.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/animation/animationHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAEx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GAAE,OAAe,GACzB,UAAU,CAUZ;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,MAAM,CAQR"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Annotation processing for the RenderCoordinator.
3
+ *
4
+ * Processes annotation configurations into GPU-renderable instances (reference lines,
5
+ * markers) and DOM label data. Supports layering (above/below series) and multiple
6
+ * annotation types (lineX, lineY, point, text).
7
+ *
8
+ * @module processAnnotations
9
+ */
10
+ import type { AnnotationConfig } from '../../../config/types';
11
+ import type { LinearScale } from '../../../utils/scales';
12
+ import type { ThemeConfig } from '../../../themes/types';
13
+ import type { ReferenceLineInstance } from '../../../renderers/createReferenceLineRenderer';
14
+ import type { AnnotationMarkerInstance } from '../../../renderers/createAnnotationMarkerRenderer';
15
+ /**
16
+ * Internal type for annotation label data (DOM overlay).
17
+ */
18
+ export interface AnnotationLabelData {
19
+ readonly text: string;
20
+ readonly x: number;
21
+ readonly y: number;
22
+ readonly anchor?: 'start' | 'middle' | 'end';
23
+ readonly color?: string;
24
+ readonly fontSize?: number;
25
+ readonly background?: Readonly<{
26
+ readonly backgroundColor: string;
27
+ readonly padding?: readonly [number, number, number, number];
28
+ readonly borderRadius?: number;
29
+ }>;
30
+ }
31
+ /**
32
+ * Plot bounds in CSS pixels.
33
+ */
34
+ export interface PlotBounds {
35
+ readonly leftCss: number;
36
+ readonly rightCss: number;
37
+ readonly topCss: number;
38
+ readonly bottomCss: number;
39
+ readonly widthCss: number;
40
+ readonly heightCss: number;
41
+ }
42
+ /**
43
+ * Context for annotation processing.
44
+ */
45
+ export interface AnnotationContext {
46
+ readonly annotations: ReadonlyArray<AnnotationConfig>;
47
+ readonly xScale: LinearScale;
48
+ readonly yScale: LinearScale;
49
+ readonly plotBounds: PlotBounds;
50
+ readonly canvasCssWidth: number;
51
+ readonly canvasCssHeight: number;
52
+ readonly theme: ThemeConfig;
53
+ readonly offsetX?: number;
54
+ readonly offsetY?: number;
55
+ }
56
+ /**
57
+ * Result of annotation processing.
58
+ */
59
+ export interface AnnotationResult {
60
+ readonly linesBelow: ReferenceLineInstance[];
61
+ readonly linesAbove: ReferenceLineInstance[];
62
+ readonly markersBelow: AnnotationMarkerInstance[];
63
+ readonly markersAbove: AnnotationMarkerInstance[];
64
+ readonly labels: AnnotationLabelData[];
65
+ }
66
+ /**
67
+ * Processes annotations into GPU-renderable instances and DOM labels.
68
+ *
69
+ * **Annotation Types:**
70
+ * - `lineX`: Vertical reference line at x coordinate
71
+ * - `lineY`: Horizontal reference line at y coordinate
72
+ * - `point`: Marker at (x, y) coordinate
73
+ * - `text`: Text annotation with flexible positioning
74
+ *
75
+ * **Layering:**
76
+ * - `belowSeries`: Rendered before series (occluded by data)
77
+ * - `aboveSeries`: Rendered after series (always visible, default)
78
+ *
79
+ * **Labels:**
80
+ * - Optional text labels for all annotation types
81
+ * - Template support with {x}, {y}, {value}, {name} placeholders
82
+ * - Background styling with padding and border radius
83
+ *
84
+ * @param context - Annotation processing context
85
+ * @returns Annotation result with lines, markers, and labels
86
+ */
87
+ export declare function processAnnotations(context: AnnotationContext): AnnotationResult;
88
+ //# sourceMappingURL=processAnnotations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processAnnotations.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/annotations/processAnnotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,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CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,qBAAqB,EAAE,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,qBAAqB,EAAE,CAAC;IAC7C,QAAQ,CAAC,YAAY,EAAE,wBAAwB,EAAE,CAAC;IAClD,QAAQ,CAAC,YAAY,EAAE,wBAAwB,EAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC;CACxC;AA8FD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAoP/E"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Axis label positioning and layout helpers.
3
+ *
4
+ * Provides pure functions for calculating axis label positions, anchor points,
5
+ * and title placements without DOM manipulation. These helpers are used by the
6
+ * render coordinator to position axis labels and titles correctly.
7
+ *
8
+ * @module axisLabelHelpers
9
+ */
10
+ import type { TextOverlayAnchor } from '../../../components/createTextOverlay';
11
+ /**
12
+ * Default label padding in CSS pixels.
13
+ */
14
+ export declare const LABEL_PADDING_CSS_PX = 4;
15
+ /**
16
+ * Calculates the anchor point for an x-axis tick label.
17
+ *
18
+ * - Single tick: centered
19
+ * - First tick: left-aligned (start)
20
+ * - Last tick: right-aligned (end)
21
+ * - Middle ticks: centered (middle)
22
+ *
23
+ * @param tickIndex - Index of the current tick
24
+ * @param totalTicks - Total number of ticks
25
+ * @returns Text anchor for label positioning
26
+ */
27
+ export declare function getXAxisTickLabelAnchor(tickIndex: number, totalTicks: number): TextOverlayAnchor;
28
+ /**
29
+ * Calculates the Y position for x-axis labels.
30
+ *
31
+ * X-axis labels are positioned below the plot area, with spacing for tick marks.
32
+ *
33
+ * @param plotBottomCss - Bottom edge of plot area in CSS pixels
34
+ * @param tickLengthCssPx - Length of tick marks
35
+ * @param fontSize - Font size for labels
36
+ * @returns Y position in CSS pixels (canvas-local)
37
+ */
38
+ export declare function getXAxisLabelY(plotBottomCss: number, tickLengthCssPx: number, fontSize: number): number;
39
+ /**
40
+ * Calculates the X position for y-axis labels.
41
+ *
42
+ * Y-axis labels are positioned to the left of the plot area, with spacing for tick marks.
43
+ *
44
+ * @param plotLeftCss - Left edge of plot area in CSS pixels
45
+ * @param tickLengthCssPx - Length of tick marks
46
+ * @returns X position in CSS pixels (canvas-local)
47
+ */
48
+ export declare function getYAxisLabelX(plotLeftCss: number, tickLengthCssPx: number): number;
49
+ /**
50
+ * Calculates the Y position for the x-axis title.
51
+ *
52
+ * The title is centered vertically between the tick labels and the bottom edge
53
+ * (or zoom slider if present).
54
+ *
55
+ * @param xLabelY - Y position of x-axis tick labels
56
+ * @param fontSize - Font size for tick labels
57
+ * @param canvasCssHeight - Canvas height in CSS pixels
58
+ * @param hasSliderZoom - Whether a slider zoom control is present
59
+ * @param sliderHeightCssPx - Height of slider zoom control (default: 32)
60
+ * @returns Y position for x-axis title in CSS pixels
61
+ */
62
+ export declare function getXAxisTitleY(xLabelY: number, fontSize: number, canvasCssHeight: number, hasSliderZoom: boolean, sliderHeightCssPx?: number): number;
63
+ /**
64
+ * Calculates the X position for the y-axis title.
65
+ *
66
+ * The title is positioned to the left of the tick labels, accounting for their width.
67
+ *
68
+ * @param yLabelX - X position of y-axis tick labels
69
+ * @param maxTickLabelWidth - Maximum width of tick labels in CSS pixels
70
+ * @param titleFontSize - Font size for axis title
71
+ * @returns X position for y-axis title in CSS pixels
72
+ */
73
+ export declare function getYAxisTitleX(yLabelX: number, maxTickLabelWidth: number, titleFontSize: number): number;
74
+ /**
75
+ * Measures the maximum width of a set of rendered labels.
76
+ *
77
+ * @param labelSpans - Array of HTMLSpanElement labels
78
+ * @returns Maximum width in CSS pixels, or 0 if no labels
79
+ */
80
+ export declare function measureMaxLabelWidth(labelSpans: readonly HTMLSpanElement[]): number;
81
+ /**
82
+ * Calculates the center position between two coordinates.
83
+ *
84
+ * Utility for centering axis titles within plot area.
85
+ *
86
+ * @param a - First coordinate
87
+ * @param b - Second coordinate
88
+ * @returns Midpoint between a and b
89
+ */
90
+ export declare function getCenterPosition(a: number, b: number): number;
91
+ //# sourceMappingURL=axisLabelHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axisLabelHelpers.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/axis/axisLabelHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,iBAAiB,CAKhG;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvG;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,OAAO,EACtB,iBAAiB,GAAE,MAAW,GAC7B,MAAM,CAUR;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAGxG;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,CAGnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9D"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Axis tick computation and formatting.
3
+ *
4
+ * Generates tick values and formatting for linear axes. Handles decimal precision
5
+ * determination based on tick step size and provides number formatting utilities.
6
+ *
7
+ * @module computeAxisTicks
8
+ */
9
+ /**
10
+ * Generates evenly-spaced tick values between domain min and max.
11
+ *
12
+ * @param domainMin - Minimum value of the domain
13
+ * @param domainMax - Maximum value of the domain
14
+ * @param tickCount - Number of ticks to generate (must be >= 1)
15
+ * @returns Array of tick values
16
+ */
17
+ export declare function generateLinearTicks(domainMin: number, domainMax: number, tickCount: number): number[];
18
+ /**
19
+ * Computes the maximum number of decimal places needed to display a tick step cleanly.
20
+ *
21
+ * Prefers "clean" decimal representations (e.g., 2.5, 0.25, 0.125) without relying on
22
+ * magnitude alone. Accepts floating-point noise and caps the search to keep formatting
23
+ * reasonable.
24
+ *
25
+ * @param tickStep - The step size between ticks
26
+ * @param cap - Maximum number of decimal places to consider (default: 8)
27
+ * @returns Number of decimal places (0 to cap)
28
+ */
29
+ export declare function computeMaxFractionDigitsFromStep(tickStep: number, cap?: number): number;
30
+ /**
31
+ * Creates an Intl.NumberFormat for tick value formatting.
32
+ *
33
+ * Automatically determines the appropriate number of decimal places based on the
34
+ * tick step size using `computeMaxFractionDigitsFromStep()`.
35
+ *
36
+ * @param tickStep - The step size between ticks
37
+ * @returns Intl.NumberFormat configured for tick formatting
38
+ */
39
+ export declare function createTickFormatter(tickStep: number): Intl.NumberFormat;
40
+ /**
41
+ * Formats a numeric tick value using the provided number formatter.
42
+ *
43
+ * Handles edge cases:
44
+ * - Non-finite values return null
45
+ * - Values near zero (< 1e-12) are normalized to 0 to avoid "-0" display
46
+ * - Unexpected "NaN" output from formatter is guarded against
47
+ *
48
+ * @param nf - Intl.NumberFormat to use for formatting
49
+ * @param v - Numeric value to format
50
+ * @returns Formatted string or null if value cannot be formatted
51
+ */
52
+ export declare function formatTickValue(nf: Intl.NumberFormat, v: number): string | null;
53
+ //# sourceMappingURL=computeAxisTicks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeAxisTicks.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/axis/computeAxisTicks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CASrG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAyC,GAAG,MAAM,CAiBzH;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC,YAAY,CAGvE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO/E"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Visible Slice Computation Utilities
3
+ *
4
+ * Provides efficient data slicing for zoom operations using binary search
5
+ * when data is monotonic, with fallback to linear filtering.
6
+ *
7
+ * Key features:
8
+ * - Binary search slicing for O(log n) performance on sorted data
9
+ * - WeakMap caching of monotonicity checks to avoid O(n) scans
10
+ * - Separate implementations for cartesian (x-based) and OHLC (timestamp-based) data
11
+ * - Support for both tuple and object data formats
12
+ */
13
+ import type { DataPoint, DataPointTuple, OHLCDataPoint, OHLCDataPointTuple } from '../../../config/types';
14
+ type TuplePoint = DataPointTuple;
15
+ export declare function isTuplePoint(p: DataPoint): p is TuplePoint;
16
+ export declare function isTupleDataArray(data: ReadonlyArray<DataPoint>): data is ReadonlyArray<TuplePoint>;
17
+ export declare function isTupleOHLCDataPoint(p: OHLCDataPoint): p is OHLCDataPointTuple;
18
+ /**
19
+ * Checks if cartesian data is monotonic non-decreasing by X coordinate with all finite values.
20
+ * Results are cached in a WeakMap to avoid repeated O(n) scans.
21
+ */
22
+ export declare function isMonotonicNonDecreasingFiniteX(data: ReadonlyArray<DataPoint>, isTuple: boolean): boolean;
23
+ /**
24
+ * Checks if OHLC data is monotonic non-decreasing by timestamp with all finite values.
25
+ * Results are cached in a WeakMap to avoid repeated O(n) scans.
26
+ */
27
+ export declare function isMonotonicNonDecreasingFiniteTimestamp(data: ReadonlyArray<OHLCDataPoint>): boolean;
28
+ /**
29
+ * Slices cartesian data to the visible X range [xMin, xMax].
30
+ *
31
+ * Uses binary search (O(log n)) when data is monotonic by X;
32
+ * otherwise falls back to linear filtering (O(n)).
33
+ *
34
+ * @param data - Cartesian data points (tuple or object format)
35
+ * @param xMin - Minimum X value (inclusive)
36
+ * @param xMax - Maximum X value (inclusive)
37
+ * @returns Sliced data array containing only points within [xMin, xMax]
38
+ */
39
+ export declare function sliceVisibleRangeByX(data: ReadonlyArray<DataPoint>, xMin: number, xMax: number): ReadonlyArray<DataPoint>;
40
+ /**
41
+ * Finds the index range of visible points in cartesian data.
42
+ *
43
+ * Returns { start, end } indices suitable for slicing or iteration.
44
+ * Only works correctly when data is monotonic; returns full range otherwise.
45
+ *
46
+ * @param data - Cartesian data points (tuple or object format)
47
+ * @param xMin - Minimum X value (inclusive)
48
+ * @param xMax - Maximum X value (inclusive)
49
+ * @returns Index range { start, end } for visible data
50
+ */
51
+ export declare function findVisibleRangeIndicesByX(data: ReadonlyArray<DataPoint>, xMin: number, xMax: number): {
52
+ readonly start: number;
53
+ readonly end: number;
54
+ };
55
+ /**
56
+ * Slices OHLC/candlestick data to the visible timestamp range [xMin, xMax].
57
+ *
58
+ * Uses binary search (O(log n)) when timestamps are monotonic;
59
+ * otherwise falls back to linear filtering (O(n)).
60
+ *
61
+ * @param data - OHLC data points (tuple or object format)
62
+ * @param xMin - Minimum timestamp (inclusive)
63
+ * @param xMax - Maximum timestamp (inclusive)
64
+ * @returns Sliced data array containing only points within [xMin, xMax]
65
+ */
66
+ export declare function sliceVisibleRangeByOHLC(data: ReadonlyArray<OHLCDataPoint>, xMin: number, xMax: number): ReadonlyArray<OHLCDataPoint>;
67
+ export {};
68
+ //# sourceMappingURL=computeVisibleSlice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeVisibleSlice.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/data/computeVisibleSlice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAK/B,KAAK,UAAU,GAAG,cAAc,CAAC;AAKjC,wBAAgB,YAAY,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,UAAU,CAE1D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,aAAa,CAAC,UAAU,CAAC,CAElG;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,aAAa,GAAG,CAAC,IAAI,kBAAkB,CAE9E;AAMD;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAuCzG;AAED;;;GAGG;AACH,wBAAgB,uCAAuC,CAAC,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,OAAO,CAqBnG;AAoGD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,aAAa,CAAC,SAAS,CAAC,CA8B1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAuBlD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,EAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,aAAa,CAAC,aAAa,CAAC,CA8B9B"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * GPU texture management for the RenderCoordinator.
3
+ *
4
+ * Handles lazy allocation of render target textures and MSAA overlay management.
5
+ * Uses a multi-pass rendering strategy:
6
+ * 1. Main scene → single-sample texture
7
+ * 2. Blit to MSAA target + draw annotations (MSAA overlay pass)
8
+ * 3. Draw UI overlays on resolved swapchain (single-sample)
9
+ *
10
+ * @module textureManager
11
+ */
12
+ /**
13
+ * Texture manager state exposed to the render coordinator.
14
+ */
15
+ export interface TextureManagerState {
16
+ readonly mainColorView: GPUTextureView | null;
17
+ readonly overlayMsaaView: GPUTextureView | null;
18
+ readonly overlayBlitBindGroup: GPUBindGroup | null;
19
+ readonly overlayBlitPipeline: GPURenderPipeline;
20
+ readonly msaaSampleCount: number;
21
+ }
22
+ /**
23
+ * Configuration for texture manager creation.
24
+ */
25
+ export interface TextureManagerConfig {
26
+ readonly device: GPUDevice;
27
+ readonly targetFormat: GPUTextureFormat;
28
+ }
29
+ /**
30
+ * Texture manager interface returned by factory function.
31
+ */
32
+ export interface TextureManager {
33
+ /**
34
+ * Ensures textures are allocated for the given dimensions.
35
+ * Reallocates if size or format changes.
36
+ *
37
+ * @param width - Canvas width in device pixels
38
+ * @param height - Canvas height in device pixels
39
+ */
40
+ ensureTextures(width: number, height: number): void;
41
+ /**
42
+ * Gets current texture manager state for rendering.
43
+ *
44
+ * @returns Current state with texture views and bind groups
45
+ */
46
+ getState(): TextureManagerState;
47
+ /**
48
+ * Disposes all GPU resources.
49
+ * Textures, views, and bind groups are destroyed.
50
+ */
51
+ dispose(): void;
52
+ }
53
+ /**
54
+ * Creates a texture manager for render target allocation and management.
55
+ *
56
+ * The texture manager uses lazy allocation: textures are only created when
57
+ * first requested via ensureTextures(), and are reallocated if dimensions
58
+ * or format change.
59
+ *
60
+ * **Architecture:**
61
+ * - Main color texture: Single-sample render target for main scene
62
+ * - Overlay MSAA texture: Multi-sample render target for annotations
63
+ * - Blit pipeline: Copies main color to MSAA target for overlay pass
64
+ *
65
+ * @param config - Configuration with device and target format
66
+ * @returns Texture manager instance
67
+ */
68
+ export declare function createTextureManager(config: TextureManagerConfig): TextureManager;
69
+ //# sourceMappingURL=textureManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textureManager.d.ts","sourceRoot":"","sources":["../../../../src/core/renderCoordinator/gpu/textureManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAuCH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,aAAa,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;IAChD,QAAQ,CAAC,oBAAoB,EAAE,YAAY,GAAG,IAAI,CAAC;IACnD,QAAQ,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;IAChD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAgBD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpD;;;;OAIG;IACH,QAAQ,IAAI,mBAAmB,CAAC;IAEhC;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAiBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CA+HjF"}