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 @@
|
|
|
1
|
+
{"version":3,"file":"pickCandle.d.ts","sourceRoot":"","sources":["../../src/math/pickCandle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,EAAE,EACtB,UAAU,EAAE,WAAW,GAAG,IAAI,EAC9B,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,GACtB,WAAW,GAAG,IAAI,CA6BpB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LiveChartPoint } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Compute visible Y range from data points + current value.
|
|
4
|
+
* Returns { min, max } with margin applied.
|
|
5
|
+
*/
|
|
6
|
+
export declare function computeRange(visible: LiveChartPoint[], currentValue: number, referenceValue?: number, exaggerate?: boolean, nonNegative?: boolean, maxValue?: number): {
|
|
7
|
+
min: number;
|
|
8
|
+
max: number;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../src/math/range.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,cAAc,EAAE,EACzB,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,EACvB,UAAU,CAAC,EAAE,OAAO,EACpB,WAAW,CAAC,EAAE,OAAO,EACrB,QAAQ,CAAC,EAAE,MAAM,GAChB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAwC9B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReferenceLine } from "../types";
|
|
2
|
+
/** Which of the three reference-line forms a `ReferenceLine` resolves to. */
|
|
3
|
+
export type ReferenceLineForm = "line" | "value-band" | "time-band" | "none";
|
|
4
|
+
/**
|
|
5
|
+
* Classify a `ReferenceLine` into one of its three forms, applying the
|
|
6
|
+
* documented precedence A (line) > B (value band) > C (time band).
|
|
7
|
+
*/
|
|
8
|
+
export declare function referenceLineForm(rl: ReferenceLine): ReferenceLineForm;
|
|
9
|
+
/**
|
|
10
|
+
* Gather every Y value a set of reference lines should contribute to the
|
|
11
|
+
* axis-range computation. Lines flagged `excludeFromRange` are skipped, as are
|
|
12
|
+
* time bands (Form C) which constrain time, not value.
|
|
13
|
+
*/
|
|
14
|
+
export declare function collectReferenceValues(lines: ReferenceLine[]): number[];
|
|
15
|
+
/**
|
|
16
|
+
* Where a Y value sits relative to the visible plot range:
|
|
17
|
+
* `"in"` (within [min, max]), `"above"` (greater than max), or `"below"`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function classifyReferenceEdge(value: number, min: number, max: number): "in" | "above" | "below";
|
|
20
|
+
//# sourceMappingURL=referenceLines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referenceLines.d.ts","sourceRoot":"","sources":["../../src/math/referenceLines.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,6EAA6E;AAC7E,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,MAAM,CAAC;AAE7E;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,aAAa,GAAG,iBAAiB,CAQtE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAgBvE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,IAAI,GAAG,OAAO,GAAG,OAAO,CAK1B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { SkPath } from "@shopify/react-native-skia";
|
|
2
|
+
import type { LiveChartPoint } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Reusable scratch buffers for {@link drawSpline}. Pass a persistent instance
|
|
5
|
+
* (created once per chart via `useMemo`) to avoid allocating three arrays sized
|
|
6
|
+
* to the point count on every frame — the per-frame garbage scales with the
|
|
7
|
+
* number of points (large `timeWindow`s push 1000+ points), so pooling these
|
|
8
|
+
* meaningfully cuts UI-thread GC pressure on live charts.
|
|
9
|
+
*/
|
|
10
|
+
export interface SplineScratch {
|
|
11
|
+
delta: number[];
|
|
12
|
+
h: number[];
|
|
13
|
+
m: number[];
|
|
14
|
+
}
|
|
15
|
+
/** Allocate an empty {@link SplineScratch} (arrays grow on demand). */
|
|
16
|
+
export declare function makeSplineScratch(): SplineScratch;
|
|
17
|
+
/**
|
|
18
|
+
* Fritsch-Carlson monotone cubic interpolation.
|
|
19
|
+
* Guarantees no overshoots — the curve never exceeds local min/max.
|
|
20
|
+
* Same approach documented in liveline for smooth live line charts (adapted code; MIT).
|
|
21
|
+
*
|
|
22
|
+
* pts is a flat number array with stride 2: [x0, y0, x1, y1, ...].
|
|
23
|
+
* Caller must moveTo the first point before calling.
|
|
24
|
+
*
|
|
25
|
+
* Pass `scratch` (see {@link makeSplineScratch}) to reuse the tangent/interval
|
|
26
|
+
* buffers across frames instead of allocating them each call. Only indices
|
|
27
|
+
* `0..n-1` are read after being written, so stale tail entries are harmless.
|
|
28
|
+
*
|
|
29
|
+
* @see https://github.com/benjitaylor/liveline
|
|
30
|
+
*/
|
|
31
|
+
export declare function drawSpline(path: SkPath, pts: number[], scratch?: SplineScratch): void;
|
|
32
|
+
/**
|
|
33
|
+
* Value of the Fritsch–Carlson monotone cubic — the same curve {@link drawSpline}
|
|
34
|
+
* renders — at `time`. Use this to anchor overlays (e.g. markers) exactly on the
|
|
35
|
+
* rendered line instead of on the straight chord between data points. Returns
|
|
36
|
+
* `null` for empty data; clamps to the endpoints outside the data range.
|
|
37
|
+
*
|
|
38
|
+
* The data→pixel mapping is affine, so evaluating the monotone cubic in data
|
|
39
|
+
* space and then projecting matches the pixel-space spline. Tangents use the
|
|
40
|
+
* immediate neighbors and the overshoot clamp is applied for this segment only
|
|
41
|
+
* (it does not cascade across segments as in `drawSpline`, which differs only on
|
|
42
|
+
* very steep runs where the clamp fires).
|
|
43
|
+
*/
|
|
44
|
+
export declare function splineValueAtTime(points: LiveChartPoint[], time: number): number | null;
|
|
45
|
+
//# sourceMappingURL=spline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spline.d.ts","sourceRoot":"","sources":["../../src/math/spline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,CAAC,EAAE,MAAM,EAAE,CAAC;CACb;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,IAAI,aAAa,CAEjD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,QA8D9E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EAAE,EACxB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,IAAI,CAoEf"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ChartPadding } from "../draw/line";
|
|
2
|
+
/**
|
|
3
|
+
* Composite sine squiggly — two overlapping frequencies with a breathing
|
|
4
|
+
* amplitude envelope. Matches the original web LiveChart loading animation.
|
|
5
|
+
*
|
|
6
|
+
* amplitude = 14 * (0.4 + 0.6 * sin(0.8 * t)) // 5.6 → 22.4px breathing range
|
|
7
|
+
* y = centerY + amplitude * (sin(0.035*x + 1.2*t) + 0.45*sin(0.08*x + 2.1*t))
|
|
8
|
+
*/
|
|
9
|
+
export declare function squigglyYAt(x: number, centerY: number, t: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* Build a flat [x0,y0,x1,y1,...] point array for a standalone squiggly line
|
|
12
|
+
* spanning the full chart area (used in loading / empty state).
|
|
13
|
+
* Points are spaced ~4px apart for smooth curves.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildSquigglyPts(canvasWidth: number, canvasHeight: number, padding: ChartPadding, t: number): number[];
|
|
16
|
+
/**
|
|
17
|
+
* Given a real flat-pts array (from buildLinePoints), replace each Y with the
|
|
18
|
+
* squiggly Y at the same X. Used during the morph reveal.
|
|
19
|
+
*/
|
|
20
|
+
export declare function squigglifyPts(flatPts: number[], t: number, centerY: number): number[];
|
|
21
|
+
/**
|
|
22
|
+
* Smoothstep — maps t ∈ [0,1] to a smooth 0→1 curve (no clamping required
|
|
23
|
+
* when t is already in range, but clamps gracefully outside).
|
|
24
|
+
*/
|
|
25
|
+
export declare function smoothstep(t: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Blend two flat-pts arrays center-out, driven by morphT ∈ [0,1].
|
|
28
|
+
* Points near the horizontal centre of the chart reveal first; edges last.
|
|
29
|
+
*
|
|
30
|
+
* For each point, a per-point weight is computed:
|
|
31
|
+
* distFromCentre = |x - chartCentreX| / (chartW / 2) // 0=centre, 1=edge
|
|
32
|
+
* weight = smoothstep((morphT - distFromCentre * 0.5) / 0.5)
|
|
33
|
+
* blendedY = fromY + (toY - fromY) * weight
|
|
34
|
+
*/
|
|
35
|
+
export declare function blendPtsY(from: number[], to: number[], morphT: number, padding: ChartPadding, canvasWidth: number): number[];
|
|
36
|
+
//# sourceMappingURL=squiggly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"squiggly.d.ts","sourceRoot":"","sources":["../../src/math/squiggly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAQzE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,YAAY,EACrB,CAAC,EAAE,MAAM,GACR,MAAM,EAAE,CAiBV;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EAAE,EACjB,CAAC,EAAE,MAAM,EACT,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CASV;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,EAAE,MAAM,EAAE,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,MAAM,GAClB,MAAM,EAAE,CAeV"}
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { LiveChartPalette, SeriesConfig, ThemeMode } from "./types";
|
|
2
|
+
/** Parse a CSS color string to [r, g, b]. Supports `#rgb`, `#rrggbb`, `rgb()`, and `rgba()`. */
|
|
3
|
+
export declare function parseColorRgb(color: string): [number, number, number];
|
|
4
|
+
/**
|
|
5
|
+
* Default left-edge fade gradient stops for `dstOut` blending: same RGB as the chart
|
|
6
|
+
* background (`palette.bgRgb`), opacity 1 → 0. Matches the container `backgroundColor`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function leftEdgeFadeColorsFromBgRgb(bgRgb: [number, number, number]): {
|
|
9
|
+
startColor: string;
|
|
10
|
+
endColor: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Derive a full palette from a single accent color + theme mode.
|
|
14
|
+
* Momentum colors are always semantic green/red regardless of accent.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveTheme(color: string, mode: ThemeMode): LiveChartPalette;
|
|
17
|
+
/**
|
|
18
|
+
* Merge caller palette overrides on top of a derived palette. Only the keys
|
|
19
|
+
* present on `override` are replaced; everything else keeps the derived value.
|
|
20
|
+
* Returns the original palette unchanged when no override is supplied.
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyPaletteOverride(palette: LiveChartPalette, override: Partial<LiveChartPalette> | undefined): LiveChartPalette;
|
|
23
|
+
/**
|
|
24
|
+
* Default multi-series line colors — Tailwind 500 scale, order: blue, red, green,
|
|
25
|
+
* amber, violet, pink, cyan, orange.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SERIES_COLORS: ("#22c55e" | "#ef4444" | "#3b82f6" | "#f59e0b" | "#8b5cf6" | "#ec4899" | "#06b6d4" | "#f97316")[];
|
|
28
|
+
/** Derive per-series palettes from series definitions. */
|
|
29
|
+
export declare function resolveSeriesPalettes(series: SeriesConfig[], mode: ThemeMode): Map<string, LiveChartPalette>;
|
|
30
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AA+EzE,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAcrE;AAMD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAMA;AAOD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,gBAAgB,CA6D7E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,SAAS,GAC9C,gBAAgB,CAGlB;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,mGASzB,CAAC;AAEF,0DAA0D;AAC1D,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EAAE,EACtB,IAAI,EAAE,SAAS,GACd,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAW/B"}
|