@supersolutions/super-chart-react-native 0.0.0 → 0.17.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.
@@ -0,0 +1,3 @@
1
+ export declare function formatPrice(value: number, precision: number, locale?: string): string;
2
+ /** The engine supplies a raw or transformed percent label, including the percent precision. */
3
+ export declare function formatScaleLabel(raw: string, locale?: string): string;
@@ -0,0 +1,13 @@
1
+ import { type DrawingBounds, type EngineFrame } from '@supersolutions/super-chart-core';
2
+ import { type NativeChartMarker, type MarkerCluster } from './overlaysModel';
3
+ /** Bind the grid to candle indices. Panning selects already indexed buckets. */
4
+ export declare function markerBucketSpan(frame: EngineFrame): number;
5
+ interface MarkerBucket {
6
+ members: NativeChartMarker[];
7
+ representative: NativeChartMarker;
8
+ }
9
+ export declare function indexMarkers(bars: readonly {
10
+ timestamp: number;
11
+ }[], markers: readonly NativeChartMarker[], span: number): Map<number, MarkerBucket>;
12
+ export declare function visibleMarkerClusters(frame: EngineFrame, buckets: ReadonlyMap<number, MarkerBucket>, span: number, bounds?: DrawingBounds): MarkerCluster[];
13
+ export {};
@@ -0,0 +1,31 @@
1
+ import { type EngineIndicatorSpec, type MarketBar, type RealtimeViewSnapshot, type Timespan, type Viewport } from '@supersolutions/super-chart-core';
2
+ export { createStudyComputer } from './studies';
3
+ export interface ChartTheme {
4
+ background: string;
5
+ text: string;
6
+ muted: string;
7
+ grid: string;
8
+ up: string;
9
+ down: string;
10
+ accent: string;
11
+ }
12
+ export declare const LIGHT_THEME: ChartTheme;
13
+ export declare const DARK_THEME: ChartTheme;
14
+ export type NativeChartMode = 'candles' | 'heikin-ashi' | 'line';
15
+ export declare const CHART_LIMITS: {
16
+ minBars: number;
17
+ maxBars: number;
18
+ rightPaddingBars: number;
19
+ };
20
+ export declare const DEFAULT_STUDIES: readonly EngineIndicatorSpec[];
21
+ /** Store a time anchor so prepending history does not move the reader away from the selected dates. */
22
+ export interface ViewAnchor {
23
+ time: number;
24
+ offset: number;
25
+ span: number;
26
+ following: boolean;
27
+ }
28
+ export declare function resolveWindow(bars: readonly MarketBar[], anchor: ViewAnchor | null, width: number): Viewport;
29
+ export declare function windowAnchor(bars: readonly MarketBar[], viewport: Viewport): ViewAnchor | null;
30
+ export declare function snapshotForWindow(bars: readonly MarketBar[], viewport: Viewport, mode: NativeChartMode): RealtimeViewSnapshot;
31
+ export declare function periodTimespan(period: string): Timespan;
@@ -0,0 +1,28 @@
1
+ import { type EngineFrame, type Viewport } from '@supersolutions/super-chart-core';
2
+ import { type drawingRegions } from './precision';
3
+ import type { createChartGestures, InteractionMode } from './gestures';
4
+ type Input = ReturnType<typeof createChartGestures>;
5
+ interface Options {
6
+ frame: EngineFrame | null;
7
+ input: Input;
8
+ mode: InteractionMode;
9
+ drawing: boolean;
10
+ regions: ReturnType<typeof drawingRegions>;
11
+ extra: number;
12
+ commit: (viewport: Viewport) => void;
13
+ navigation?: (active: boolean) => void;
14
+ axisStart: (y: number) => void;
15
+ axisMove: (dy: number) => void;
16
+ axisTap: () => void;
17
+ }
18
+ /** Native pointer arbitration and camera. Only editing, inspection, scale changes and buffer refills enter JS. */
19
+ export declare function useChartMotion(options: Options): {
20
+ gesture: import("react-native-gesture-handler").ManualGesture;
21
+ animatedStyle: import("react-native-reanimated/lib/typescript/hook/commonTypes").AnimatedStyleHandle<{
22
+ transform: {
23
+ translateX: number;
24
+ }[];
25
+ }>;
26
+ stop: () => void;
27
+ };
28
+ export {};
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import type { AnnotationTone, DrawingPoint, EngineFrame } from '@supersolutions/super-chart-core';
3
+ import { type NativeDrawingProps } from './drawings';
4
+ import { type NativeAnnotation, type NativeChartMarker } from './overlaysModel';
5
+ export type { NativeAnnotation, NativeChartMarker } from './overlaysModel';
6
+ export type { NativeDrawingProps } from './drawings';
7
+ export interface NativeLayerProps extends NativeDrawingProps {
8
+ readonly locale?: string;
9
+ readonly precision?: number;
10
+ readonly interactionMode?: 'chart' | 'scroll' | 'none';
11
+ readonly annotations?: readonly NativeAnnotation[];
12
+ readonly markers?: readonly NativeChartMarker[];
13
+ readonly onAnnotationPress?: (annotation: NativeAnnotation) => void;
14
+ readonly onMarkerPress?: (markers: readonly NativeChartMarker[]) => void;
15
+ /** Match the host's red-up/green-up convention and chart surface in both color schemes. */
16
+ readonly layerColors?: Partial<Record<AnnotationTone | 'surface', string>>;
17
+ }
18
+ /** Optional native SVG layers. Picking runs only after the chart has distinguished a tap from a pan/pinch. */
19
+ export declare function useNativeLayers(frame: EngineFrame | null, props: NativeLayerProps, window?: {
20
+ left: number;
21
+ right: number;
22
+ offsetX: number;
23
+ }): {
24
+ tap: (point: DrawingPoint) => boolean;
25
+ controls: false | React.JSX.Element | undefined;
26
+ nodes: React.JSX.Element | undefined;
27
+ begin: (p: DrawingPoint) => boolean;
28
+ move: (p: DrawingPoint) => void;
29
+ end: (p: DrawingPoint) => void;
30
+ cancel: () => void;
31
+ finishPath: () => void;
32
+ regions: {
33
+ line: boolean;
34
+ x1: number;
35
+ x2: number;
36
+ y1: number;
37
+ y2: number;
38
+ tolerance: number;
39
+ }[];
40
+ editingHandle: () => boolean;
41
+ };
@@ -0,0 +1,50 @@
1
+ import { type AnnotationFigure, type AnnotationParams, type AnnotationTone, type DrawingBounds, type DrawingPoint, type EngineFrame } from '@supersolutions/super-chart-core';
2
+ export interface NativeAnnotation {
3
+ readonly key: string;
4
+ readonly kind: 'level' | 'zone' | 'marker' | 'trend' | 'ray' | 'fibonacci' | 'plan' | 'arrow' | 'event' | 'callout';
5
+ readonly anchors: readonly {
6
+ readonly time: number;
7
+ readonly price?: number;
8
+ }[];
9
+ readonly text?: string;
10
+ readonly tone?: AnnotationTone;
11
+ readonly color?: string;
12
+ readonly params?: AnnotationParams;
13
+ }
14
+ export interface NativeChartMarker {
15
+ readonly id: string;
16
+ /** Unix milliseconds on the chart's trading timeline. */
17
+ readonly time: number;
18
+ readonly price: number;
19
+ readonly label: string;
20
+ readonly avatarUri?: string;
21
+ readonly color?: string;
22
+ }
23
+ export interface MarkerCluster {
24
+ slot: number;
25
+ x: number;
26
+ y: number;
27
+ anchor: DrawingPoint;
28
+ representative: NativeChartMarker;
29
+ members: NativeChartMarker[];
30
+ }
31
+ export declare function contains(bounds: DrawingBounds, p: DrawingPoint): boolean;
32
+ export interface ProjectedAnnotation {
33
+ spec: NativeAnnotation;
34
+ figures: readonly AnnotationFigure[];
35
+ color: string;
36
+ }
37
+ /** Keep the first legible caption at each location. Every underlying price/shape remains tappable. */
38
+ export declare function layoutAnnotationLabels(annotations: ProjectedAnnotation[], bounds: DrawingBounds, fontScale?: number): {
39
+ visible: {
40
+ figures: AnnotationFigure[];
41
+ spec: NativeAnnotation;
42
+ color: string;
43
+ }[];
44
+ hidden: NativeAnnotation[];
45
+ };
46
+ export declare function projectAnnotation(frame: EngineFrame, spec: NativeAnnotation, palette: Readonly<Record<AnnotationTone, string>>, locale?: string, bounds?: DrawingBounds, precision?: number): ProjectedAnnotation | null;
47
+ /** Mobile paint and picking share the same clipped figures, including plan bands and fibonacci levels. */
48
+ export declare function hitsAnnotation(annotation: ProjectedAnnotation, p: DrawingPoint, fontScale?: number): boolean;
49
+ /** One focus position per on-screen annotation. */
50
+ export declare function annotationPosition(entry: ProjectedAnnotation, bounds: DrawingBounds): DrawingPoint | null;
package/dist/plot.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { type EngineFrame, type EnginePane, type Timespan } from '@supersolutions/super-chart-core';
3
+ import type { ChartTheme, NativeChartMode } from './model';
4
+ export declare function seriesColor(pane: EnginePane, id: string, theme: ChartTheme): string;
5
+ export interface PlotProps {
6
+ part?: 'plot' | 'axis';
7
+ frame: EngineFrame;
8
+ mode: NativeChartMode;
9
+ theme: ChartTheme;
10
+ precision: number;
11
+ timespan: Timespan;
12
+ locale?: string;
13
+ timeZone?: string;
14
+ symbolTimezone?: string;
15
+ clipPrefix: string;
16
+ }
17
+ export declare const ChartPlot: React.NamedExoticComponent<PlotProps>;
@@ -0,0 +1,30 @@
1
+ import type { DrawingGeometry, DrawingPoint, EngineFrame } from '@supersolutions/super-chart-core';
2
+ /** Move the sight above the finger, keeping both precision and free placement reachable at plot edges. */
3
+ export declare function drawingSight(frame: EngineFrame, finger: DrawingPoint, lifted: boolean): {
4
+ x: number;
5
+ y: number;
6
+ };
7
+ /** Use a pixel threshold: a magnet which is useful on a phone should still allow arbitrary prices. */
8
+ export declare function nearestOHLC(frame: EngineFrame, point: DrawingPoint, radius?: number): {
9
+ x: number;
10
+ y: number;
11
+ timestamp: number;
12
+ price: number;
13
+ } | null;
14
+ /** Limit a candle wick or rectangular body to a chord of the circular magnifier. */
15
+ export declare function lensSegment(x: number, top: number, bottom: number, radius: number, halfWidth: number): {
16
+ from: number;
17
+ to: number;
18
+ } | null;
19
+ type HitRegion = {
20
+ line: boolean;
21
+ x1: number;
22
+ x2: number;
23
+ y1: number;
24
+ y2: number;
25
+ tolerance: number;
26
+ };
27
+ /** Transfer only the selected object's hit regions to the UI runtime. A miss can start panning even if JS is busy. */
28
+ export declare function drawingRegions(item: DrawingGeometry | undefined): HitRegion[];
29
+ export declare function mayEditAt(regions: readonly HitRegion[], x: number, y: number): boolean;
30
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type EngineIndicatorSpec, type FrameIndicator, type IndicatorDefinition, type MarketBar } from '@supersolutions/super-chart-core';
2
+ /** Adapt snapshot-style React props to the shared indicator engine's change notifications. */
3
+ export declare function createStudyComputer(specs: readonly EngineIndicatorSpec[], showVolume: boolean, definitions?: readonly IndicatorDefinition[]): (bars: readonly MarketBar[]) => FrameIndicator[];
package/package.json CHANGED
@@ -1,9 +1,61 @@
1
1
  {
2
2
  "name": "@supersolutions/super-chart-react-native",
3
- "version": "0.0.0",
4
- "description": "Placeholder for trusted publishing setup.",
3
+ "version": "0.17.0",
4
+ "description": "Interactive native financial charts for iOS and Android with shared Super Chart models.",
5
5
  "license": "GPL-3.0-or-later",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/Super-Solution/super-chart.git",
13
+ "directory": "packages/bindings/react-native"
14
+ },
15
+ "homepage": "https://github.com/Super-Solution/super-chart#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/Super-Solution/super-chart/issues"
18
+ },
19
+ "sideEffects": false,
20
+ "files": [
21
+ "dist",
22
+ "LICENSE",
23
+ "README.md"
24
+ ],
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "react-native": "./dist/index.js",
29
+ "import": "./dist/index.js"
30
+ }
31
+ },
32
+ "main": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
6
34
  "publishConfig": {
7
- "access": "public"
35
+ "access": "public",
36
+ "registry": "https://registry.npmjs.org/",
37
+ "tag": "latest"
38
+ },
39
+ "dependencies": {
40
+ "@supersolutions/super-chart-core": "0.17.0"
41
+ },
42
+ "peerDependencies": {
43
+ "react": ">=19",
44
+ "react-native": ">=0.81 <1",
45
+ "react-native-svg": ">=15 <16",
46
+ "react-native-gesture-handler": ">=3.3 <4",
47
+ "react-native-reanimated": ">=4.7 <5",
48
+ "react-native-worklets": ">=0.13 <1"
49
+ },
50
+ "author": "SUPER SOLUTION LABS INC",
51
+ "devDependencies": {
52
+ "react": "19.3.0",
53
+ "@types/react": "~19.3.0",
54
+ "react-native": "0.88.1",
55
+ "react-native-svg": "15.16.0",
56
+ "typescript": "5.9.3",
57
+ "react-native-gesture-handler": "~3.3.0",
58
+ "react-native-reanimated": "4.7.1",
59
+ "react-native-worklets": "0.13.0"
8
60
  }
9
61
  }