react-native-livechart 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +33 -0
- package/README.md +198 -0
- package/dist/components/AnimatedLabel.d.ts +21 -0
- package/dist/components/AnimatedLabel.d.ts.map +1 -0
- package/dist/components/BadgeOverlay.d.ts +16 -0
- package/dist/components/BadgeOverlay.d.ts.map +1 -0
- package/dist/components/CrosshairLine.d.ts +20 -0
- package/dist/components/CrosshairLine.d.ts.map +1 -0
- package/dist/components/CrosshairOverlay.d.ts +29 -0
- package/dist/components/CrosshairOverlay.d.ts.map +1 -0
- package/dist/components/DegenParticlesOverlay.d.ts +16 -0
- package/dist/components/DegenParticlesOverlay.d.ts.map +1 -0
- package/dist/components/DotOverlay.d.ts +17 -0
- package/dist/components/DotOverlay.d.ts.map +1 -0
- package/dist/components/LeftEdgeFade.d.ts +9 -0
- package/dist/components/LeftEdgeFade.d.ts.map +1 -0
- package/dist/components/LiveChart.d.ts +3 -0
- package/dist/components/LiveChart.d.ts.map +1 -0
- package/dist/components/LiveChartSeries.d.ts +3 -0
- package/dist/components/LiveChartSeries.d.ts.map +1 -0
- package/dist/components/LiveChartTransition.d.ts +28 -0
- package/dist/components/LiveChartTransition.d.ts.map +1 -0
- package/dist/components/LoadingOverlay.d.ts +24 -0
- package/dist/components/LoadingOverlay.d.ts.map +1 -0
- package/dist/components/MarkerOverlay.d.ts +25 -0
- package/dist/components/MarkerOverlay.d.ts.map +1 -0
- package/dist/components/MultiSeriesDots.d.ts +11 -0
- package/dist/components/MultiSeriesDots.d.ts.map +1 -0
- package/dist/components/MultiSeriesStroke.d.ts +14 -0
- package/dist/components/MultiSeriesStroke.d.ts.map +1 -0
- package/dist/components/MultiSeriesTooltipStack.d.ts +10 -0
- package/dist/components/MultiSeriesTooltipStack.d.ts.map +1 -0
- package/dist/components/MultiSeriesValueLabels.d.ts +11 -0
- package/dist/components/MultiSeriesValueLabels.d.ts.map +1 -0
- package/dist/components/MultiSeriesValueLines.d.ts +10 -0
- package/dist/components/MultiSeriesValueLines.d.ts.map +1 -0
- package/dist/components/ReferenceLineOverlay.d.ts +19 -0
- package/dist/components/ReferenceLineOverlay.d.ts.map +1 -0
- package/dist/components/SeriesToggleChips.d.ts +15 -0
- package/dist/components/SeriesToggleChips.d.ts.map +1 -0
- package/dist/components/TradeStreamOverlay.d.ts +14 -0
- package/dist/components/TradeStreamOverlay.d.ts.map +1 -0
- package/dist/components/ValueLineOverlay.d.ts +16 -0
- package/dist/components/ValueLineOverlay.d.ts.map +1 -0
- package/dist/components/ValueTextOverlay.d.ts +20 -0
- package/dist/components/ValueTextOverlay.d.ts.map +1 -0
- package/dist/components/XAxisOverlay.d.ts +14 -0
- package/dist/components/XAxisOverlay.d.ts.map +1 -0
- package/dist/components/YAxisOverlay.d.ts +23 -0
- package/dist/components/YAxisOverlay.d.ts.map +1 -0
- package/dist/components/seriesMetaSig.d.ts +4 -0
- package/dist/components/seriesMetaSig.d.ts.map +1 -0
- package/dist/constants.d.ts +38 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core/liveChartEngineTick.d.ts +45 -0
- package/dist/core/liveChartEngineTick.d.ts.map +1 -0
- package/dist/core/liveChartSeriesEngineTick.d.ts +38 -0
- package/dist/core/liveChartSeriesEngineTick.d.ts.map +1 -0
- package/dist/core/multiSeriesLayout.d.ts +22 -0
- package/dist/core/multiSeriesLayout.d.ts.map +1 -0
- package/dist/core/resolveConfig.d.ts +188 -0
- package/dist/core/resolveConfig.d.ts.map +1 -0
- package/dist/core/useLiveChartEngine.d.ts +79 -0
- package/dist/core/useLiveChartEngine.d.ts.map +1 -0
- package/dist/core/useLiveChartSeriesEngine.d.ts +68 -0
- package/dist/core/useLiveChartSeriesEngine.d.ts.map +1 -0
- package/dist/draw/candle.d.ts +25 -0
- package/dist/draw/candle.d.ts.map +1 -0
- package/dist/draw/grid.d.ts +24 -0
- package/dist/draw/grid.d.ts.map +1 -0
- package/dist/draw/line.d.ts +86 -0
- package/dist/draw/line.d.ts.map +1 -0
- package/dist/draw/trade.d.ts +38 -0
- package/dist/draw/trade.d.ts.map +1 -0
- package/dist/hooks/crosshairSeries.d.ts +13 -0
- package/dist/hooks/crosshairSeries.d.ts.map +1 -0
- package/dist/hooks/crosshairShared.d.ts +72 -0
- package/dist/hooks/crosshairShared.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +24 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/resolveChartLayout.d.ts +42 -0
- package/dist/hooks/resolveChartLayout.d.ts.map +1 -0
- package/dist/hooks/useBadge.d.ts +14 -0
- package/dist/hooks/useBadge.d.ts.map +1 -0
- package/dist/hooks/useCandlePaths.d.ts +19 -0
- package/dist/hooks/useCandlePaths.d.ts.map +1 -0
- package/dist/hooks/useCanvasLayout.d.ts +12 -0
- package/dist/hooks/useCanvasLayout.d.ts.map +1 -0
- package/dist/hooks/useChartColors.d.ts +20 -0
- package/dist/hooks/useChartColors.d.ts.map +1 -0
- package/dist/hooks/useChartPaths.d.ts +19 -0
- package/dist/hooks/useChartPaths.d.ts.map +1 -0
- package/dist/hooks/useChartReveal.d.ts +30 -0
- package/dist/hooks/useChartReveal.d.ts.map +1 -0
- package/dist/hooks/useChartSkiaFont.d.ts +8 -0
- package/dist/hooks/useChartSkiaFont.d.ts.map +1 -0
- package/dist/hooks/useCrosshair.d.ts +20 -0
- package/dist/hooks/useCrosshair.d.ts.map +1 -0
- package/dist/hooks/useCrosshairSeries.d.ts +10 -0
- package/dist/hooks/useCrosshairSeries.d.ts.map +1 -0
- package/dist/hooks/useDegen.d.ts +17 -0
- package/dist/hooks/useDegen.d.ts.map +1 -0
- package/dist/hooks/useLiveChartHasData.d.ts +17 -0
- package/dist/hooks/useLiveChartHasData.d.ts.map +1 -0
- package/dist/hooks/useLiveDot.d.ts +12 -0
- package/dist/hooks/useLiveDot.d.ts.map +1 -0
- package/dist/hooks/useMarkers.d.ts +15 -0
- package/dist/hooks/useMarkers.d.ts.map +1 -0
- package/dist/hooks/useModeBlend.d.ts +18 -0
- package/dist/hooks/useModeBlend.d.ts.map +1 -0
- package/dist/hooks/useMomentum.d.ts +16 -0
- package/dist/hooks/useMomentum.d.ts.map +1 -0
- package/dist/hooks/useMultiSeriesDegen.d.ts +25 -0
- package/dist/hooks/useMultiSeriesDegen.d.ts.map +1 -0
- package/dist/hooks/useMultiSeriesLinePaths.d.ts +15 -0
- package/dist/hooks/useMultiSeriesLinePaths.d.ts.map +1 -0
- package/dist/hooks/useReferenceLine.d.ts +32 -0
- package/dist/hooks/useReferenceLine.d.ts.map +1 -0
- package/dist/hooks/useReverseMorphEngineInputs.d.ts +24 -0
- package/dist/hooks/useReverseMorphEngineInputs.d.ts.map +1 -0
- package/dist/hooks/useTradeStream.d.ts +12 -0
- package/dist/hooks/useTradeStream.d.ts.map +1 -0
- package/dist/hooks/useXAxis.d.ts +32 -0
- package/dist/hooks/useXAxis.d.ts.map +1 -0
- package/dist/hooks/useYAxis.d.ts +13 -0
- package/dist/hooks/useYAxis.d.ts.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/format.d.ts +5 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/measureFontTextWidth.d.ts +7 -0
- package/dist/lib/measureFontTextWidth.d.ts.map +1 -0
- package/dist/lib/monoFontFamily.d.ts +6 -0
- package/dist/lib/monoFontFamily.d.ts.map +1 -0
- package/dist/math/color.d.ts +5 -0
- package/dist/math/color.d.ts.map +1 -0
- package/dist/math/degenTick.d.ts +57 -0
- package/dist/math/degenTick.d.ts.map +1 -0
- package/dist/math/interpolate.d.ts +7 -0
- package/dist/math/interpolate.d.ts.map +1 -0
- package/dist/math/intervals.d.ts +3 -0
- package/dist/math/intervals.d.ts.map +1 -0
- package/dist/math/lerp.d.ts +7 -0
- package/dist/math/lerp.d.ts.map +1 -0
- package/dist/math/markers.d.ts +44 -0
- package/dist/math/markers.d.ts.map +1 -0
- package/dist/math/momentum.d.ts +8 -0
- package/dist/math/momentum.d.ts.map +1 -0
- package/dist/math/pickCandle.d.ts +8 -0
- package/dist/math/pickCandle.d.ts.map +1 -0
- package/dist/math/range.d.ts +10 -0
- package/dist/math/range.d.ts.map +1 -0
- package/dist/math/referenceLines.d.ts +20 -0
- package/dist/math/referenceLines.d.ts.map +1 -0
- package/dist/math/spline.d.ts +45 -0
- package/dist/math/spline.d.ts.map +1 -0
- package/dist/math/squiggly.d.ts +36 -0
- package/dist/math/squiggly.d.ts.map +1 -0
- package/dist/theme.d.ts +30 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/types.d.ts +720 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +72 -0
- package/src/components/AnimatedLabel.tsx +41 -0
- package/src/components/BadgeOverlay.tsx +39 -0
- package/src/components/CrosshairLine.tsx +90 -0
- package/src/components/CrosshairOverlay.tsx +170 -0
- package/src/components/DegenParticlesOverlay.tsx +141 -0
- package/src/components/DotOverlay.tsx +69 -0
- package/src/components/LeftEdgeFade.tsx +36 -0
- package/src/components/LiveChart.tsx +821 -0
- package/src/components/LiveChartSeries.tsx +607 -0
- package/src/components/LiveChartTransition.tsx +135 -0
- package/src/components/LoadingOverlay.tsx +301 -0
- package/src/components/MarkerOverlay.tsx +331 -0
- package/src/components/MultiSeriesDots.tsx +117 -0
- package/src/components/MultiSeriesStroke.tsx +79 -0
- package/src/components/MultiSeriesTooltipStack.tsx +78 -0
- package/src/components/MultiSeriesValueLabels.tsx +103 -0
- package/src/components/MultiSeriesValueLines.tsx +115 -0
- package/src/components/ReferenceLineOverlay.tsx +317 -0
- package/src/components/SeriesToggleChips.tsx +201 -0
- package/src/components/TradeStreamOverlay.tsx +117 -0
- package/src/components/ValueLineOverlay.tsx +63 -0
- package/src/components/ValueTextOverlay.tsx +43 -0
- package/src/components/XAxisOverlay.tsx +109 -0
- package/src/components/YAxisOverlay.tsx +135 -0
- package/src/components/seriesMetaSig.ts +13 -0
- package/src/constants.ts +44 -0
- package/src/core/liveChartEngineTick.ts +185 -0
- package/src/core/liveChartSeriesEngineTick.ts +163 -0
- package/src/core/multiSeriesLayout.ts +80 -0
- package/src/core/resolveConfig.ts +538 -0
- package/src/core/useLiveChartEngine.ts +207 -0
- package/src/core/useLiveChartSeriesEngine.ts +215 -0
- package/src/draw/candle.ts +210 -0
- package/src/draw/grid.ts +174 -0
- package/src/draw/line.ts +257 -0
- package/src/draw/trade.ts +202 -0
- package/src/hooks/crosshairSeries.ts +78 -0
- package/src/hooks/crosshairShared.ts +296 -0
- package/src/hooks/index.ts +26 -0
- package/src/hooks/resolveChartLayout.ts +144 -0
- package/src/hooks/useBadge.ts +192 -0
- package/src/hooks/useCandlePaths.ts +165 -0
- package/src/hooks/useCanvasLayout.ts +22 -0
- package/src/hooks/useChartColors.ts +48 -0
- package/src/hooks/useChartPaths.ts +121 -0
- package/src/hooks/useChartReveal.ts +123 -0
- package/src/hooks/useChartSkiaFont.ts +34 -0
- package/src/hooks/useCrosshair.ts +250 -0
- package/src/hooks/useCrosshairSeries.ts +163 -0
- package/src/hooks/useDegen.ts +262 -0
- package/src/hooks/useLiveChartHasData.ts +31 -0
- package/src/hooks/useLiveDot.ts +31 -0
- package/src/hooks/useMarkers.ts +95 -0
- package/src/hooks/useModeBlend.ts +52 -0
- package/src/hooks/useMomentum.ts +37 -0
- package/src/hooks/useMultiSeriesDegen.ts +260 -0
- package/src/hooks/useMultiSeriesLinePaths.ts +76 -0
- package/src/hooks/useReferenceLine.ts +212 -0
- package/src/hooks/useReverseMorphEngineInputs.ts +154 -0
- package/src/hooks/useTradeStream.ts +64 -0
- package/src/hooks/useXAxis.ts +200 -0
- package/src/hooks/useYAxis.ts +48 -0
- package/src/index.ts +69 -0
- package/src/lib/format.ts +36 -0
- package/src/lib/measureFontTextWidth.ts +10 -0
- package/src/lib/monoFontFamily.ts +8 -0
- package/src/math/color.ts +31 -0
- package/src/math/degenTick.ts +151 -0
- package/src/math/interpolate.ts +32 -0
- package/src/math/intervals.ts +17 -0
- package/src/math/lerp.ts +17 -0
- package/src/math/markers.ts +175 -0
- package/src/math/momentum.ts +38 -0
- package/src/math/pickCandle.ts +42 -0
- package/src/math/range.ts +54 -0
- package/src/math/referenceLines.ts +56 -0
- package/src/math/spline.ts +183 -0
- package/src/math/squiggly.ts +108 -0
- package/src/theme.ts +231 -0
- package/src/types.ts +789 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type SharedValue } from "react-native-reanimated";
|
|
2
|
+
import type { SeriesConfig } from "../types";
|
|
3
|
+
import type { MultiEngineState } from "./useLiveChartEngine";
|
|
4
|
+
export interface MultiSeriesEngineConfig {
|
|
5
|
+
series: SharedValue<SeriesConfig[]>;
|
|
6
|
+
timeWindow: number;
|
|
7
|
+
smoothing: number;
|
|
8
|
+
exaggerate?: boolean;
|
|
9
|
+
referenceValue?: number;
|
|
10
|
+
referenceValues?: number[];
|
|
11
|
+
nonNegative?: boolean;
|
|
12
|
+
maxValue?: number;
|
|
13
|
+
nowOverride?: number;
|
|
14
|
+
windowBuffer?: number;
|
|
15
|
+
paused?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface MultiEngineFrameRefs {
|
|
18
|
+
series: SharedValue<SeriesConfig[]>;
|
|
19
|
+
displaySeriesValues: SharedValue<number[]>;
|
|
20
|
+
seriesOpacities: SharedValue<number[]>;
|
|
21
|
+
displayMin: SharedValue<number>;
|
|
22
|
+
displayMax: SharedValue<number>;
|
|
23
|
+
displayWindow: SharedValue<number>;
|
|
24
|
+
timestamp: SharedValue<number>;
|
|
25
|
+
canvasWidth: SharedValue<number>;
|
|
26
|
+
canvasHeight: SharedValue<number>;
|
|
27
|
+
timeWindow: SharedValue<number>;
|
|
28
|
+
smoothing: SharedValue<number>;
|
|
29
|
+
exaggerateSV: SharedValue<boolean>;
|
|
30
|
+
referenceValue: SharedValue<number | undefined>;
|
|
31
|
+
referenceValues?: SharedValue<number[] | undefined>;
|
|
32
|
+
nonNegativeSV?: SharedValue<boolean>;
|
|
33
|
+
maxValueSV?: SharedValue<number | undefined>;
|
|
34
|
+
nowOverrideSV?: SharedValue<number | undefined>;
|
|
35
|
+
windowBufferSV?: SharedValue<number>;
|
|
36
|
+
pausedSV: SharedValue<boolean>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Reusable per-frame scratch for {@link applyLiveChartSeriesEngineFrame}. The two
|
|
40
|
+
* output arrays ping-pong so the assigned reference still changes each frame
|
|
41
|
+
* (Reanimated propagates on reference change) without allocating a fresh array
|
|
42
|
+
* per frame. Create one per engine (the React Compiler keeps it stable).
|
|
43
|
+
*/
|
|
44
|
+
export interface MultiSeriesEngineScratch {
|
|
45
|
+
dvA: number[];
|
|
46
|
+
dvB: number[];
|
|
47
|
+
opA: number[];
|
|
48
|
+
opB: number[];
|
|
49
|
+
tick: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* One frame of the multi-series chart engine.
|
|
53
|
+
* Mirrors `applyLiveChartEngineFrame` but iterates over each series
|
|
54
|
+
* to lerp per-series display values and opacities. Extracted as a
|
|
55
|
+
* pure function so it can be called from both `useFrameCallback` and tests.
|
|
56
|
+
*
|
|
57
|
+
* Pass `scratch` to reuse the output arrays across frames instead of allocating
|
|
58
|
+
* two via `.slice()` each frame; omit it (tests) to fall back to allocation.
|
|
59
|
+
*/
|
|
60
|
+
export declare function applyLiveChartSeriesEngineFrame(frameInfo: {
|
|
61
|
+
timeSincePreviousFrame?: number | null;
|
|
62
|
+
}, sv: MultiEngineFrameRefs, scratch?: MultiSeriesEngineScratch): void;
|
|
63
|
+
/**
|
|
64
|
+
* UI-thread engine for multi-series charts. Dummies `data` / `value` / `displayValue`
|
|
65
|
+
* mirror single-series fields for hooks that still read them.
|
|
66
|
+
*/
|
|
67
|
+
export declare function useLiveChartSeriesEngine(config: MultiSeriesEngineConfig): MultiEngineState;
|
|
68
|
+
//# sourceMappingURL=useLiveChartSeriesEngine.d.ts.map
|
|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AU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACnC,cAAc,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACpD,aAAa,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACrC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE;IAAE,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACrD,EAAE,EAAE,oBAAoB,EACxB,OAAO,CAAC,EAAE,wBAAwB,GACjC,IAAI,CAmDN;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,uBAAuB,GAC9B,gBAAgB,CAgFlB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CandlePoint } from "../types";
|
|
2
|
+
import type { ChartPadding } from "./line";
|
|
3
|
+
export interface CandleRect {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
w: number;
|
|
7
|
+
h: number;
|
|
8
|
+
up: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface CandleWick {
|
|
11
|
+
x: number;
|
|
12
|
+
y1: number;
|
|
13
|
+
y2: number;
|
|
14
|
+
up: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface CandleGeometry {
|
|
17
|
+
bodies: CandleRect[];
|
|
18
|
+
wicks: CandleWick[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build screen-space candle bodies and wicks for a visible window.
|
|
22
|
+
* Pure worklet — no Skia imports, consumed by useCandlePaths.
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildCandleGeometry(candles: CandlePoint[], liveCandle: CandlePoint | null, padding: ChartPadding, canvasW: number, canvasH: number, winStart: number, windowSecs: number, displayMin: number, displayMax: number, candleWidthSecs: number): CandleGeometry;
|
|
25
|
+
//# sourceMappingURL=candle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candle.d.ts","sourceRoot":"","sources":["../../src/draw/candle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,OAAO,CAAC;CACb;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,OAAO,CAAC;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAkGD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EAAE,EACtB,UAAU,EAAE,WAAW,GAAG,IAAI,EAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,GACtB,cAAc,CA2EhB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface YAxisEntry {
|
|
2
|
+
y: number;
|
|
3
|
+
label: string;
|
|
4
|
+
alpha: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Pick a nice Y-axis interval using TradingView's cycling divisor approach.
|
|
8
|
+
* Hysteresis: once chosen, sticks until pixel spacing falls outside [0.5x, 4x] of minGap.
|
|
9
|
+
*/
|
|
10
|
+
export declare function pickInterval(valRange: number, pxPerUnit: number, minGap: number, prev: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Blend factor for fine (non-coarse) grid lines from pixel spacing.
|
|
13
|
+
* Exposed for unit tests; matches `computeGridEntries` behaviour.
|
|
14
|
+
*/
|
|
15
|
+
export declare function fineLineTargetAlpha(finePx: number, minGap?: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Compute grid entries with per-label alpha fading.
|
|
18
|
+
* `labelAlphas` is mutated in place (persistent state across frames).
|
|
19
|
+
*/
|
|
20
|
+
export declare function computeGridEntries(displayMin: number, displayMax: number, canvasHeight: number, padTop: number, padBottom: number, prevInterval: number, labelAlphas: Record<number, number>, formatValue: (v: number) => string, dt: number, minGap?: number): {
|
|
21
|
+
entries: YAxisEntry[];
|
|
22
|
+
interval: number;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/draw/grid.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,MAAM,CA2BR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,SAAK,GAAG,MAAM,CAOvE;AAwBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAClC,EAAE,EAAE,MAAM,EACV,MAAM,SAAK,GACV;IAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CA6E7C"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ChartInsets, LiveChartPoint } from "../types";
|
|
2
|
+
export { BADGE_DOT_GAP, BADGE_MARGIN_RIGHT, BADGE_PILL_PAD_X, BADGE_PILL_PAD_Y, BADGE_TAIL_LEN } from "../constants";
|
|
3
|
+
export interface ChartPadding {
|
|
4
|
+
top: number;
|
|
5
|
+
right: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
left: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const DEFAULT_PADDING: ChartPadding;
|
|
10
|
+
/**
|
|
11
|
+
* Combined tail + rounded-cap offset.
|
|
12
|
+
* The pill body starts `tl` px to the right of the gutter left edge (= dot x),
|
|
13
|
+
* so the tail spans the gap between the dot and the pill body.
|
|
14
|
+
*
|
|
15
|
+
* When `showTail` is false the tail spike is omitted and only the round cap
|
|
16
|
+
* radius is returned, letting callers shrink the right gutter.
|
|
17
|
+
*/
|
|
18
|
+
export declare function badgeTailAndCap(fontSize: number, showTail?: boolean): number;
|
|
19
|
+
/**
|
|
20
|
+
* Text left-edge X so the label is horizontally centered in the badge pill.
|
|
21
|
+
* Uses the ASYMMETRIC layout: tail gap (`tl`) on the left, `BADGE_MARGIN_RIGHT` on
|
|
22
|
+
* the right. Both `useBadge` and `GridOverlay` (when badge is shown) call this so
|
|
23
|
+
* the badge text and y-axis labels share the exact same horizontal position.
|
|
24
|
+
*
|
|
25
|
+
* Layout: |dot| tl |PAD_X| text |PAD_X| BADGE_MARGIN_RIGHT |canvas edge
|
|
26
|
+
* ↑ same x for grid labels and badge text
|
|
27
|
+
*/
|
|
28
|
+
export declare function pillTextLeftX(canvasWidth: number, paddingRight: number, tl: number, textWidth: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* Symmetric gutter centering — used for y-axis labels when badge is NOT shown.
|
|
31
|
+
* When badge IS shown, use `pillTextLeftX` instead so labels align with badge text.
|
|
32
|
+
*/
|
|
33
|
+
export declare function gutterCenteredTextLeftX(canvasWidth: number, paddingRight: number, textWidth: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Right-aligned text positioning — used for y-axis labels when inline series
|
|
36
|
+
* labels occupy the left portion of the right gutter.
|
|
37
|
+
*/
|
|
38
|
+
export declare function gutterRightAlignedTextLeftX(canvasWidth: number, textWidth: number, rightMargin?: number): number;
|
|
39
|
+
/**
|
|
40
|
+
* Minimum `padding.right` for the badge gutter.
|
|
41
|
+
*
|
|
42
|
+
* Layout: |dot| BADGE_DOT_GAP | tl | PAD_X | text | PAD_X | BADGE_MARGIN_RIGHT |canvas edge
|
|
43
|
+
*/
|
|
44
|
+
export declare function minPaddingRightForBadgeYAxisAlign(fontSize: number, textWidth: number, showTail?: boolean): number;
|
|
45
|
+
/** Auto-right-padding: badge needs space for the pill, y-axis labels need less. */
|
|
46
|
+
export declare function resolveAutoRight(yAxis: boolean, badge: boolean, showTail?: boolean): number;
|
|
47
|
+
/**
|
|
48
|
+
* Minimum `padding.left` for a badge pill drawn in the left chart margin (label width + horizontal padding + dot gap).
|
|
49
|
+
* `resolveChartLayout` does not call this; it remains available for custom layouts or `resolvePadding(..., badgeOnLeft: true)`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function minPaddingLeftForBadge(textWidth: number): number;
|
|
52
|
+
/** Default left inset, or a wider inset when `badgeOnLeft` is true (see `minPaddingLeftForBadge`). */
|
|
53
|
+
export declare function resolveAutoLeft(badgeOnLeft: boolean): number;
|
|
54
|
+
/**
|
|
55
|
+
* Minimum inset from the canvas edge so the live-dot pulse ring is not clipped.
|
|
56
|
+
* Matches `DotOverlay`: circle radius up to `maxRadius` with a centered stroke.
|
|
57
|
+
*
|
|
58
|
+
* Used by `resolveChartLayout` when `pulse` is set; keep in sync with `DotOverlay` pulse rendering.
|
|
59
|
+
*
|
|
60
|
+
* @see `resolveChartLayout` in `hooks/resolveChartLayout.ts`
|
|
61
|
+
* @see `DotOverlay` in `components/DotOverlay.tsx`
|
|
62
|
+
*/
|
|
63
|
+
export declare function pulseRadialOutset(maxRadius: number, strokeWidth: number): number;
|
|
64
|
+
/**
|
|
65
|
+
* Minimum `padding.right` when the live dot (and pulse) sit on the inner edge of the
|
|
66
|
+
* right gutter and y-axis labels are centered in that gutter (`gutterCenteredTextLeftX`).
|
|
67
|
+
* Otherwise the pulse can overlap labels to the right of the dot.
|
|
68
|
+
*/
|
|
69
|
+
export declare function minPaddingRightForYAxisWithPulse(pulseOutlet: number, yAxisLabelTextWidth: number, gap?: number): number;
|
|
70
|
+
export declare function resolvePadding(override?: ChartInsets, yAxis?: boolean, badge?: boolean, badgeOnLeft?: boolean, xAxis?: boolean, showTail?: boolean): ChartPadding;
|
|
71
|
+
/**
|
|
72
|
+
* Build screen-space points as a flat number array [x0, y0, x1, y1, ...].
|
|
73
|
+
* Includes one point before the window for smooth left-edge entry,
|
|
74
|
+
* and appends a live tip at (now, displayValue).
|
|
75
|
+
*
|
|
76
|
+
* Flat layout avoids ~150 tuple object allocations per frame.
|
|
77
|
+
*
|
|
78
|
+
* Pass `out` to reuse a persistent array instead of allocating a fresh one each
|
|
79
|
+
* frame (it is cleared and refilled). The per-frame allocation otherwise scales
|
|
80
|
+
* with the visible point count, so pooling it cuts UI-thread GC pressure on
|
|
81
|
+
* busy / wide-window charts. Callers that pool `out` must ping-pong two buffers
|
|
82
|
+
* so the returned reference still changes each frame (Reanimated's value-equality
|
|
83
|
+
* check skips notifying subscribers when the reference is unchanged).
|
|
84
|
+
*/
|
|
85
|
+
export declare function buildLinePoints(data: LiveChartPoint[], displayValue: number, now: number, windowSecs: number, displayMin: number, displayMax: number, canvasWidth: number, canvasHeight: number, padding: ChartPadding, out?: number[]): number[];
|
|
86
|
+
//# sourceMappingURL=line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../src/draw/line.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,eAAe,EAAE,YAK7B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,MAAM,CAIzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,YA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AE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,YAAY,EACrB,GAAG,CAAC,EAAE,MAAM,EAAE,GACb,MAAM,EAAE,CAsCV"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { TradeEvent } from "../types";
|
|
2
|
+
export interface TradeMarker {
|
|
3
|
+
y: number;
|
|
4
|
+
label: string;
|
|
5
|
+
green: boolean;
|
|
6
|
+
alpha: number;
|
|
7
|
+
}
|
|
8
|
+
export interface StreamLabel {
|
|
9
|
+
y: number;
|
|
10
|
+
text: string;
|
|
11
|
+
green: boolean;
|
|
12
|
+
life: number;
|
|
13
|
+
maxLife: number;
|
|
14
|
+
intensity: number;
|
|
15
|
+
}
|
|
16
|
+
export interface TradeStreamState {
|
|
17
|
+
labels: StreamLabel[];
|
|
18
|
+
spawnTimer: number;
|
|
19
|
+
smoothSpeed: number;
|
|
20
|
+
lastSeenTime: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function createTradeStreamState(): TradeStreamState;
|
|
23
|
+
export declare const MAX_LABELS = 50;
|
|
24
|
+
export declare const LABEL_LIFETIME = 6;
|
|
25
|
+
/**
|
|
26
|
+
* Advance the trade stream state by one frame.
|
|
27
|
+
* Spawns labels from new trades at `chartBottom`, scrolls them upward with
|
|
28
|
+
* deceleration, and expires labels that reach the top or run out of life.
|
|
29
|
+
*
|
|
30
|
+
* Pure worklet — no Skia imports. Mutates `state` in place.
|
|
31
|
+
*/
|
|
32
|
+
export declare function tickTradeStream(state: TradeStreamState, trades: TradeEvent[], dtMs: number, chartTop: number, chartBottom: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Convert internal StreamLabel state to TradeMarker array for the overlay.
|
|
35
|
+
* Computes per-label alpha from fadeIn, fadeOut, and intensity.
|
|
36
|
+
*/
|
|
37
|
+
export declare function projectLabels(state: TradeStreamState, chartTop: number, chartH: number): TradeMarker[];
|
|
38
|
+
//# sourceMappingURL=trade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade.d.ts","sourceRoot":"","sources":["../../src/draw/trade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAOzD;AAID,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,cAAc,IAAI,CAAC;AAiBhC;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,UAAU,EAAE,EACpB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,IAAI,CAkGN;AAID;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,WAAW,EAAE,CAoBf"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SkFont } from "@shopify/react-native-skia";
|
|
2
|
+
import { type ChartPadding } from "../draw/line";
|
|
3
|
+
import type { ScrubSeriesValue, SeriesConfig } from "../types";
|
|
4
|
+
import { type TooltipLayout } from "./crosshairShared";
|
|
5
|
+
export declare function interpolateSeriesAtTime(series: SeriesConfig[], time: number): {
|
|
6
|
+
primary: number | null;
|
|
7
|
+
seriesValues: ScrubSeriesValue[];
|
|
8
|
+
};
|
|
9
|
+
/** Series-chart scrub primary value at window time — extracted for tests. */
|
|
10
|
+
export declare function deriveScrubValueSeries(scrubActive: boolean, scrubTime: number, series: SeriesConfig[]): number | null;
|
|
11
|
+
/** Series-chart stacked tooltip at scrub time — extracted for tests. */
|
|
12
|
+
export declare function computeSeriesScrubTooltipLayout(scrubActive: boolean, scrubX: number, scrubTime: number, series: SeriesConfig[], padding: ChartPadding, canvasWidth: number, formatValue: (v: number) => string, formatTime: (t: number) => string, font: SkFont): TooltipLayout;
|
|
13
|
+
//# sourceMappingURL=crosshairSeries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crosshairSeries.d.ts","sourceRoot":"","sources":["../../src/hooks/crosshairSeries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,EAAE,EACtB,IAAI,EAAE,MAAM,GACX;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAgB9D;AAED,6EAA6E;AAC7E,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,EAAE,GACrB,MAAM,GAAG,IAAI,CAIf;AAED,wEAAwE;AACxE,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,EAAE,EACtB,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAClC,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EACjC,IAAI,EAAE,MAAM,GACX,aAAa,CAwBf"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type SkFont } from "@shopify/react-native-skia";
|
|
2
|
+
import { type Gesture } from "react-native-gesture-handler";
|
|
3
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
4
|
+
import { type ChartPadding } from "../draw/line";
|
|
5
|
+
export interface TooltipLayout {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
w: number;
|
|
9
|
+
h: number;
|
|
10
|
+
valueStr: string;
|
|
11
|
+
timeStr: string;
|
|
12
|
+
valueTextX: number;
|
|
13
|
+
timeTextX: number;
|
|
14
|
+
line1Y: number;
|
|
15
|
+
line2Y: number;
|
|
16
|
+
/** Multi-series tooltip: time + per-series rows (replaces valueStr/timeStr rendering). */
|
|
17
|
+
stackedLines?: {
|
|
18
|
+
text: string;
|
|
19
|
+
textX: number;
|
|
20
|
+
baselineY: number;
|
|
21
|
+
dim: boolean;
|
|
22
|
+
}[];
|
|
23
|
+
}
|
|
24
|
+
export declare const HIDDEN_TOOLTIP: TooltipLayout;
|
|
25
|
+
export interface CrosshairState {
|
|
26
|
+
scrubX: SharedValue<number>;
|
|
27
|
+
scrubActive: SharedValue<boolean>;
|
|
28
|
+
scrubTime: SharedValue<number>;
|
|
29
|
+
scrubValue: SharedValue<number | null>;
|
|
30
|
+
crosshairOpacity: SharedValue<number>;
|
|
31
|
+
tooltipLayout: SharedValue<TooltipLayout>;
|
|
32
|
+
gesture: ReturnType<typeof Gesture.Pan>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Maps a scrub X position to a window timestamp.
|
|
36
|
+
* Returns -1 when inactive or when the canvas is not yet laid out.
|
|
37
|
+
*/
|
|
38
|
+
export declare function computeScrubTime(scrubActive: boolean, scrubX: number, padding: ChartPadding, canvasWidth: number, timestamp: number, windowSecs: number): number;
|
|
39
|
+
/**
|
|
40
|
+
* Crosshair opacity: fades 1→0 over FADE_ZONE px as the crosshair
|
|
41
|
+
* approaches the live dot at the right chart edge.
|
|
42
|
+
*/
|
|
43
|
+
export declare function computeCrosshairOpacity(scrubActive: boolean, scrubX: number, canvasWidth: number, paddingRight: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* Full tooltip pill layout. Returns HIDDEN_TOOLTIP when the scrub is
|
|
46
|
+
* inactive or no value can be interpolated at the current time.
|
|
47
|
+
*/
|
|
48
|
+
export declare function computeTooltipLayout(scrubActive: boolean, scrubX: number, scrubValue: number | null, scrubTime: number, padding: ChartPadding, canvasWidth: number, formatValue: (v: number) => string, formatTime: (t: number) => string, font: SkFont): TooltipLayout;
|
|
49
|
+
/**
|
|
50
|
+
* Multi-series scrub tooltip — stacked lines (first row typically time, dim).
|
|
51
|
+
*/
|
|
52
|
+
export declare function computeTooltipLayoutMulti(scrubActive: boolean, scrubX: number, lines: {
|
|
53
|
+
text: string;
|
|
54
|
+
dim: boolean;
|
|
55
|
+
}[], padding: ChartPadding, canvasWidth: number, font: SkFont): TooltipLayout;
|
|
56
|
+
/**
|
|
57
|
+
* Candle-mode tooltip — 5 stacked rows: O, H, L, C (bright) + time (dim).
|
|
58
|
+
*/
|
|
59
|
+
export declare function computeCandleTooltipLayout(scrubActive: boolean, scrubX: number, candle: {
|
|
60
|
+
open: number;
|
|
61
|
+
high: number;
|
|
62
|
+
low: number;
|
|
63
|
+
close: number;
|
|
64
|
+
} | null, scrubTime: number, padding: ChartPadding, canvasWidth: number, formatValue: (v: number) => string, formatTime: (t: number) => string, font: SkFont): TooltipLayout;
|
|
65
|
+
/** Single-series scrub value at window time — extracted for tests. */
|
|
66
|
+
export declare function deriveScrubValueSingle(scrubActive: boolean, scrubTime: number, data: {
|
|
67
|
+
time: number;
|
|
68
|
+
value: number;
|
|
69
|
+
}[]): number | null;
|
|
70
|
+
/** Single-series crosshair tooltip — extracted for tests. */
|
|
71
|
+
export declare function deriveCrosshairTooltipSingle(scrubActive: boolean, scrubX: number, scrubTime: number, scrubValue: number | null, padding: ChartPadding, canvasWidth: number, formatValue: (v: number) => string, formatTime: (t: number) => string, font: SkFont): TooltipLayout;
|
|
72
|
+
//# sourceMappingURL=crosshairShared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crosshairShared.d.ts","sourceRoot":"","sources":["../../src/hooks/crosshairShared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAWjD,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EA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AAI,EAAE,MAAM,GACX,aAAa,CAcf"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { resolveChartLayout } from "./resolveChartLayout";
|
|
2
|
+
export { useBadge } from "./useBadge";
|
|
3
|
+
export { useCandlePaths } from "./useCandlePaths";
|
|
4
|
+
export { useCanvasLayout } from "./useCanvasLayout";
|
|
5
|
+
export { useChartColors } from "./useChartColors";
|
|
6
|
+
export { useChartPaths } from "./useChartPaths";
|
|
7
|
+
export { useChartReveal } from "./useChartReveal";
|
|
8
|
+
export { useChartSkiaFont } from "./useChartSkiaFont";
|
|
9
|
+
export { useCrosshair } from "./useCrosshair";
|
|
10
|
+
export { useCrosshairSeries } from "./useCrosshairSeries";
|
|
11
|
+
export { useDegen } from "./useDegen";
|
|
12
|
+
export { useLiveChartHasData } from "./useLiveChartHasData";
|
|
13
|
+
export { useLiveDot } from "./useLiveDot";
|
|
14
|
+
export { useMarkers } from "./useMarkers";
|
|
15
|
+
export { useModeBlend } from "./useModeBlend";
|
|
16
|
+
export { useMomentum } from "./useMomentum";
|
|
17
|
+
export { useMultiSeriesDegen } from "./useMultiSeriesDegen";
|
|
18
|
+
export { useMultiSeriesLinePaths } from "./useMultiSeriesLinePaths";
|
|
19
|
+
export { useReferenceLine } from "./useReferenceLine";
|
|
20
|
+
export { useMultiSeriesReverseMorphInputs, useSingleChartReverseMorphInputs, } from "./useReverseMorphEngineInputs";
|
|
21
|
+
export { useTradeStream } from "./useTradeStream";
|
|
22
|
+
export { useXAxis } from "./useXAxis";
|
|
23
|
+
export { useYAxis } from "./useYAxis";
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SkFont } from "@shopify/react-native-skia";
|
|
2
|
+
import { type ChartPadding } from "../draw/line";
|
|
3
|
+
import type { ChartInsets, LiveChartPalette } from "../types";
|
|
4
|
+
export interface ChartLayoutConfig {
|
|
5
|
+
palette: LiveChartPalette;
|
|
6
|
+
lineWidthOverride?: number;
|
|
7
|
+
insetsOverride?: ChartInsets;
|
|
8
|
+
yAxis: boolean;
|
|
9
|
+
badge: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When true (default if omitted and `badge` is true), reserve the wide right gutter for the badge.
|
|
12
|
+
* Set false when the badge is anchored left of the live dot (`position: "left"`).
|
|
13
|
+
*/
|
|
14
|
+
badgeUsesRightGutter?: boolean;
|
|
15
|
+
/** When false, bottom inset shrinks (no x-axis labels). Default true. */
|
|
16
|
+
xAxis?: boolean;
|
|
17
|
+
/** Skia font for measuring label width. When provided with formatValue + currentValue, padding auto-sizes. */
|
|
18
|
+
font?: SkFont;
|
|
19
|
+
/** Worklet formatter — called on JS thread here to measure label width */
|
|
20
|
+
formatValue?: (v: number) => string;
|
|
21
|
+
/** Current value read from SharedValue on JS thread — used to produce a sample label for measurement */
|
|
22
|
+
currentValue?: number;
|
|
23
|
+
/** Live dot pulse (LiveChart); expands top/right/bottom insets so the ring is not clipped. */
|
|
24
|
+
pulse?: {
|
|
25
|
+
maxRadius: number;
|
|
26
|
+
strokeWidth: number;
|
|
27
|
+
} | null;
|
|
28
|
+
/** When false and badge uses the right gutter, omit BADGE_TAIL_LEN from the right padding. */
|
|
29
|
+
badgeShowTail?: boolean;
|
|
30
|
+
/** Multi-series dot radius — used to add spacing between dots and Y-axis labels. */
|
|
31
|
+
multiSeriesDotRadius?: number;
|
|
32
|
+
/** When true, inline series labels sit right of dots and need extra right padding. */
|
|
33
|
+
multiSeriesValueLabel?: boolean;
|
|
34
|
+
/** Measured width of the widest series label (e.g. "Maybe"). Used when `multiSeriesValueLabel` is true. */
|
|
35
|
+
multiSeriesMaxLabelWidth?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ChartLayoutResult {
|
|
38
|
+
strokeWidth: number;
|
|
39
|
+
padding: ChartPadding;
|
|
40
|
+
}
|
|
41
|
+
export declare function resolveChartLayout(config: ChartLayoutConfig): ChartLayoutResult;
|
|
42
|
+
//# sourceMappingURL=resolveChartLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveChartLayout.d.ts","sourceRoot":"","sources":["../../src/hooks/resolveChartLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,yEAAyE;IACzE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8GAA8G;IAC9G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,wGAAwG;IACxG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,KAAK,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1D,8FAA8F;IAC9F,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oFAAoF;IACpF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sFAAsF;IACtF,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,2GAA2G;IAC3G,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,CA4FnB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type SkFont, type SkPath } from "@shopify/react-native-skia";
|
|
2
|
+
import { type SharedValue } from "react-native-reanimated";
|
|
3
|
+
import type { ChartEngineWithLiveValue } from "../core/useLiveChartEngine";
|
|
4
|
+
import { type ChartPadding } from "../draw/line";
|
|
5
|
+
import type { BadgeVariant, LiveChartPalette, Momentum } from "../types";
|
|
6
|
+
export declare function useBadge(engine: ChartEngineWithLiveValue, padding: ChartPadding, palette: LiveChartPalette, formatValue: (v: number) => string, font: SkFont, variant?: BadgeVariant, showTail?: boolean, momentum?: SharedValue<Momentum>, position?: "right" | "left", background?: string): import("react-native-reanimated").DerivedValue<{
|
|
7
|
+
path: SkPath;
|
|
8
|
+
textX: number;
|
|
9
|
+
textY: number;
|
|
10
|
+
text: string;
|
|
11
|
+
bgColor: string;
|
|
12
|
+
textColor: string;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=useBadge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBadge.d.ts","sourceRoot":"","sources":["../../src/hooks/useBadge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAUjC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzE,wBAAgB,QAAQ,CACtB,MAAM,EAAE,wBAAwB,EAChC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,gBAAgB,EACzB,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAClC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,YAAwB,EACjC,QAAQ,UAAO,EACf,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,EAChC,QAAQ,GAAE,OAAO,GAAG,MAAgB,EACpC,UAAU,CAAC,EAAE,MAAM;;;;;;;GAyJpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type SkPath } from "@shopify/react-native-skia";
|
|
2
|
+
import { type SharedValue } from "react-native-reanimated";
|
|
3
|
+
import type { SingleEngineState } from "../core/useLiveChartEngine";
|
|
4
|
+
import type { ChartPadding } from "../draw/line";
|
|
5
|
+
import type { CandlePoint } from "../types";
|
|
6
|
+
/**
|
|
7
|
+
* Persistent candle `SkPath`s — two per geometry slot (up/down bodies + up/down wicks).
|
|
8
|
+
* Each derived value ping-pongs between its pair and mutates the picked path in place
|
|
9
|
+
* so we don't allocate a new JSI-backed `SkPath` per frame. See {@link useChartPaths}
|
|
10
|
+
* for the rationale (this was the primary driver of the iOS memory climb under live
|
|
11
|
+
* ticking).
|
|
12
|
+
*/
|
|
13
|
+
export declare function useCandlePaths(engine: SingleEngineState, padding: ChartPadding, candles: SharedValue<CandlePoint[]> | undefined, liveCandle: SharedValue<CandlePoint | null> | undefined, candleWidthSecs: number, active: boolean): {
|
|
14
|
+
readonly upBodiesPath: import("react-native-reanimated").DerivedValue<SkPath>;
|
|
15
|
+
readonly downBodiesPath: import("react-native-reanimated").DerivedValue<SkPath>;
|
|
16
|
+
readonly upWicksPath: import("react-native-reanimated").DerivedValue<SkPath>;
|
|
17
|
+
readonly downWicksPath: import("react-native-reanimated").DerivedValue<SkPath>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useCandlePaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCandlePaths.d.ts","sourceRoot":"","sources":["../../src/hooks/useCandlePaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,GAAG,SAAS,EAC/C,UAAU,EAAE,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS,EACvD,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,OAAO;;;;;EAsIhB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LayoutChangeEvent } from "react-native";
|
|
2
|
+
import type { ChartEngineLayout } from "../core/useLiveChartEngine";
|
|
3
|
+
/**
|
|
4
|
+
* Track canvas dimensions via `onLayout` and sync them into engine shared values.
|
|
5
|
+
* Returns `{ layoutHeight, onLayout }` — pass `onLayout` to the container View
|
|
6
|
+
* and use `layoutHeight` for conditional rendering (e.g. minimum height guards).
|
|
7
|
+
*/
|
|
8
|
+
export declare function useCanvasLayout(engine: ChartEngineLayout): {
|
|
9
|
+
readonly layoutHeight: number;
|
|
10
|
+
readonly onLayout: (e: LayoutChangeEvent) => void;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useCanvasLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCanvasLayout.d.ts","sourceRoot":"","sources":["../../src/hooks/useCanvasLayout.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB;;2BAGlC,iBAAiB;EAQvC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ResolvedGradientConfig } from "../core/resolveConfig";
|
|
2
|
+
import type { ChartPadding } from "../draw/line";
|
|
3
|
+
import type { LiveChartPalette } from "../types";
|
|
4
|
+
export interface ChartColors {
|
|
5
|
+
/** Background color derived from the theme palette. */
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
/** Y coordinate of the gradient bottom edge — accounts for bottom inset. */
|
|
8
|
+
gradientEnd: number;
|
|
9
|
+
/** Top gradient stop — custom opacity or palette default. */
|
|
10
|
+
gradientTopColor: string;
|
|
11
|
+
/** Bottom gradient stop — custom opacity or palette default. */
|
|
12
|
+
gradientBottomColor: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Derives background and gradient colors from the resolved palette and
|
|
16
|
+
* optional GradientConfig opacities. The React Compiler memoizes the result
|
|
17
|
+
* so strings are only recomputed when inputs change.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useChartColors(palette: LiveChartPalette, gradientCfg: ResolvedGradientConfig | null, accentColor: string, layoutHeight: number, padding: ChartPadding): ChartColors;
|
|
20
|
+
//# sourceMappingURL=useChartColors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChartColors.d.ts","sourceRoot":"","sources":["../../src/hooks/useChartColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,gBAAgB,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,gBAAgB,EACzB,WAAW,EAAE,sBAAsB,GAAG,IAAI,EAC1C,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,YAAY,GACpB,WAAW,CAoBb"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type SkPath } from "@shopify/react-native-skia";
|
|
2
|
+
import { type SharedValue } from "react-native-reanimated";
|
|
3
|
+
import type { SingleEngineState } from "../core/useLiveChartEngine";
|
|
4
|
+
import { type ChartPadding } from "../draw/line";
|
|
5
|
+
/**
|
|
6
|
+
* Persistent `linePath` / `fillPath` `SkPath`s that are **mutated in place** each frame.
|
|
7
|
+
*
|
|
8
|
+
* Why not `useDerivedValue(() => Skia.Path.Make())`? Each call would allocate a brand-new
|
|
9
|
+
* JSI-backed `SkPath`, and on iOS the native GC lags the JS GC under a steady firehose —
|
|
10
|
+
* resident memory climbs steadily for as long as the chart is mounted. Here we allocate
|
|
11
|
+
* two paths per curve once and ping-pong the reference each frame so Reanimated's
|
|
12
|
+
* value-equality early-return still fires its subscribers (i.e. the Skia reanimated
|
|
13
|
+
* container re-records and repaints).
|
|
14
|
+
*/
|
|
15
|
+
export declare function useChartPaths(engine: SingleEngineState, padding: ChartPadding, morphT?: SharedValue<number>): {
|
|
16
|
+
readonly linePath: import("react-native-reanimated").DerivedValue<SkPath>;
|
|
17
|
+
readonly fillPath: import("react-native-reanimated").DerivedValue<SkPath>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useChartPaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChartPaths.d.ts","sourceRoot":"","sources":["../../src/hooks/useChartPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAIlE;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,YAAY,EACrB,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;;;EAmG7B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type SharedValue } from "react-native-reanimated";
|
|
2
|
+
/** Duration for chart reveal (loading/empty → live) and collapse (live → empty). */
|
|
3
|
+
export declare const CHART_REVEAL_DURATION_MS = 600;
|
|
4
|
+
/**
|
|
5
|
+
* Maps a [0,1] morphT to a [0,1] opacity, starting at `delay` and reaching
|
|
6
|
+
* 1 at morphT=1. Uses smoothstep for a polished ease-in/out.
|
|
7
|
+
*/
|
|
8
|
+
export declare function revealRamp(morphT: number, delay: number): number;
|
|
9
|
+
export interface ChartRevealState {
|
|
10
|
+
/** 0 = loading/empty shell, 1 = fully live chart (matches web chartReveal). */
|
|
11
|
+
morphT: SharedValue<number>;
|
|
12
|
+
/** True while loading=true */
|
|
13
|
+
isLoading: SharedValue<boolean>;
|
|
14
|
+
/** True when not loading and fewer than two samples. */
|
|
15
|
+
isEmpty: SharedValue<boolean>;
|
|
16
|
+
yAxisOpacity: SharedValue<number>;
|
|
17
|
+
fillOpacity: SharedValue<number>;
|
|
18
|
+
lineOpacity: SharedValue<number>;
|
|
19
|
+
dotOpacity: SharedValue<number>;
|
|
20
|
+
badgeOpacity: SharedValue<number>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Drives loading / empty / live visibility.
|
|
24
|
+
*
|
|
25
|
+
* Chart is fully revealed only when `!loading && hasData`. `morphT` animates
|
|
26
|
+
* between 0 and 1 when that condition changes. `isEmpty` is derived as
|
|
27
|
+
* `!loading && !hasData` for the empty overlay label.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useChartReveal(loading: boolean, hasData: SharedValue<boolean>): ChartRevealState;
|
|
30
|
+
//# sourceMappingURL=useChartReveal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChartReveal.d.ts","sourceRoot":"","sources":["../../src/hooks/useChartReveal.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAGjC,oFAAoF;AACpF,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAc5C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B,8BAA8B;IAC9B,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,wDAAwD;IACxD,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9B,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAC5B,gBAAgB,CA8DlB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SkFont } from "@shopify/react-native-skia";
|
|
2
|
+
import type { FontConfig } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves Skia text for charts: optional bundled `typeface` via `useFont`, otherwise
|
|
5
|
+
* `matchFont` with optional custom `fontManager`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useChartSkiaFont(fontProp: FontConfig | undefined, defaultFamily: string, defaultSize: number): SkFont;
|
|
8
|
+
//# sourceMappingURL=useChartSkiaFont.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChartSkiaFont.d.ts","sourceRoot":"","sources":["../../src/hooks/useChartSkiaFont.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,MAAM,EACZ,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,UAAU,GAAG,SAAS,EAChC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,MAAM,CAeR"}
|