import { type SharedValue } from "react-native-reanimated"; import type { SeriesConfig } from "../types"; import { type MultiEngineTickInput, type MultiEngineTickMutable } from "./liveChartSeriesEngineTick"; import type { ChartEngineScroll, MultiEngineState } from "./useLiveChartEngine"; export interface MultiSeriesEngineConfig { series: SharedValue; timeWindow: number; smoothing: number; /** Extra catch-up speed added to `smoothing` when a series tip lags. */ adaptiveSpeedBoost?: number; exaggerate?: boolean; referenceValue?: number; referenceValues?: number[]; nonNegative?: boolean; maxValue?: number; /** Positive, finite live Y-range multiplier (1 = auto-fit); read each frame. */ yRangeScale?: SharedValue; nowOverride?: number; windowBuffer?: number; paused?: boolean; /** * Whether the `timeScroll` gesture is active. Flipping to `false` while scrolled * back clears {@link ChartEngineScroll.viewEnd} and **glides** the window back to * the live edge (eased, not an instant jump), so disabling time-scroll never * strands the chart at a past position. See #164. */ scrollEnabled?: boolean; /** * Honor a `viewEnd` parked at or past the live edge — set when * `timeScroll.overscroll` is active so the pan/pinch gestures can drag into * blank future space. See {@link MultiEngineTickInput.allowFutureViewEnd}. */ allowFutureViewEnd?: boolean; /** * Duration (ms) of the return-to-live glide when {@link scrollEnabled} flips to * `false` while scrolled back. `0` snaps instantly. Defaults to * {@link RETURN_TO_LIVE_MS}. Resolved from `timeScroll.returnToLive`. See #164. */ returnToLiveMs?: number; /** * Opaque key that snaps the framing to its target in one frame whenever it * changes (the next tick bypasses `smoothing` for the window, Y-range, and * series tips, then normal easing resumes). Lets a timeframe / dataset switch * land instantly while live ticks stay smooth. See {@link LiveChartSeriesProps.snapKey}. */ snapKey?: string | number; } export interface MultiEngineFrameRefs { series: SharedValue; displaySeriesValues: SharedValue; seriesOpacities: SharedValue; displayMin: SharedValue; displayMax: SharedValue; displayWindow: SharedValue; timestamp: SharedValue; canvasWidth: SharedValue; canvasHeight: SharedValue; timeWindow: SharedValue; smoothing: SharedValue; adaptiveSpeedBoostSV?: SharedValue; exaggerateSV: SharedValue; referenceValue: SharedValue; referenceValues?: SharedValue; nonNegativeSV?: SharedValue; maxValueSV?: SharedValue; yRangeScaleSV?: SharedValue; nowOverrideSV?: SharedValue; windowBufferSV?: SharedValue; pausedSV: SharedValue; /** Pan-scroll right-edge override (null = follow live). Optional for callers/tests. */ viewEndSV?: SharedValue; /** Honor a `viewEnd` past the live edge (timeScroll.overscroll). Optional. */ allowFutureViewEndSV?: SharedValue; /** "Return to live" glide progress (0→1); the right edge eases to live. Optional. */ returnTSV?: SharedValue; /** Frozen right-edge time the return glide starts from. Optional. */ returnFromSV?: SharedValue; /** Pinch-zoom window-width override (null = follow timeWindow). Optional for callers/tests. */ viewWindowSV?: SharedValue; /** Receives the computed live edge each frame. Optional for callers/tests. */ liveEdgeSV?: SharedValue; /** * One-shot "snap the framing this frame" flag (set by the `snapKey` effect). * Consumed and cleared by {@link applyLiveChartSeriesEngineFrame} after the * tick. Optional for callers/tests. */ snapSV?: SharedValue; extremaMinValue: SharedValue; extremaMaxValue: SharedValue; extremaMinTime: SharedValue; extremaMaxTime: SharedValue; } /** * Reusable per-frame scratch for {@link applyLiveChartSeriesEngineFrame}. The * output arrays ping-pong so the assigned reference still changes each frame * (Reanimated propagates on reference change), while the state/input containers * are mutated in place. Create one per engine. */ export interface MultiSeriesEngineScratch { dvA: number[]; dvB: number[]; opA: number[]; opB: number[]; tick: boolean; state: MultiEngineTickMutable; input: MultiEngineTickInput; } /** Allocate one multi-series frame scratch. Call once per engine instance. */ export declare function makeMultiSeriesEngineScratch(): MultiSeriesEngineScratch; /** * One frame of the multi-series chart engine. * Mirrors `applyLiveChartEngineFrame` but iterates over each series * to lerp per-series display values and opacities. Extracted as a * pure function so it can be called from both `useFrameCallback` and tests. * * Pass `scratch` to reuse the output arrays plus state/input containers across * frames; omit it (tests) to retain the standalone allocation fallback. */ export declare function applyLiveChartSeriesEngineFrame(frameInfo: { timeSincePreviousFrame?: number | null; }, sv: MultiEngineFrameRefs, scratch?: MultiSeriesEngineScratch): void; /** * UI-thread engine for multi-series charts. Dummies `data` / `value` / `displayValue` * mirror single-series fields for hooks that still read them. */ export declare function useLiveChartSeriesEngine(config: MultiSeriesEngineConfig): MultiEngineState & ChartEngineScroll; //# sourceMappingURL=useLiveChartSeriesEngine.d.ts.map