tickup 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.
Files changed (117) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +21 -0
  3. package/README.md +55 -0
  4. package/dist/branding/TickUpAttribution.d.ts +11 -0
  5. package/dist/branding/TickUpMark.d.ts +15 -0
  6. package/dist/branding/tickupBrandAssets.d.ts +12 -0
  7. package/dist/branding/tickupWatermark.d.ts +28 -0
  8. package/dist/components/Canvas/Axes/XAxis.d.ts +18 -0
  9. package/dist/components/Canvas/Axes/YAxis.d.ts +12 -0
  10. package/dist/components/Canvas/ChartCanvas.d.ts +40 -0
  11. package/dist/components/Canvas/ChartStage.d.ts +5 -0
  12. package/dist/components/Canvas/TickUpStage.d.ts +122 -0
  13. package/dist/components/Canvas/utils/GraphDraw.d.ts +13 -0
  14. package/dist/components/Canvas/utils/GraphHelpers.d.ts +60 -0
  15. package/dist/components/Canvas/utils/drawDrawings.d.ts +4 -0
  16. package/dist/components/Canvas/utils/drawOverlay.d.ts +44 -0
  17. package/dist/components/Canvas/utils/formatters.d.ts +34 -0
  18. package/dist/components/Canvas/utils/generateTicks.d.ts +9 -0
  19. package/dist/components/Canvas/utils/helpers.d.ts +6 -0
  20. package/dist/components/Common/AlertModal.d.ts +13 -0
  21. package/dist/components/Common/AlertModal.styles.d.ts +13 -0
  22. package/dist/components/DefaultData.d.ts +3 -0
  23. package/dist/components/Drawing/AngleShape.d.ts +37 -0
  24. package/dist/components/Drawing/ArrowShape.d.ts +32 -0
  25. package/dist/components/Drawing/CircleShape.d.ts +29 -0
  26. package/dist/components/Drawing/CustomSymbolShape.d.ts +31 -0
  27. package/dist/components/Drawing/IDrawingShape.d.ts +32 -0
  28. package/dist/components/Drawing/LineShape.d.ts +29 -0
  29. package/dist/components/Drawing/Polyline.d.ts +29 -0
  30. package/dist/components/Drawing/RectangleShape.d.ts +29 -0
  31. package/dist/components/Drawing/TriangleShape.d.ts +34 -0
  32. package/dist/components/Drawing/drawHelper.d.ts +35 -0
  33. package/dist/components/Drawing/drawingQuery.d.ts +44 -0
  34. package/dist/components/Drawing/types.d.ts +21 -0
  35. package/dist/components/SettingsModal/SettingsModal.d.ts +73 -0
  36. package/dist/components/SettingsModal/SettingsModal.styles.d.ts +62 -0
  37. package/dist/components/ShapePropertiesModal/ShapePropertiesModal.d.ts +13 -0
  38. package/dist/components/ShapePropertiesModal/applyShapeProperties.d.ts +16 -0
  39. package/dist/components/TickUpHost.d.ts +162 -0
  40. package/dist/components/TickUpProducts.d.ts +23 -0
  41. package/dist/components/Toolbar/Buttons.d.ts +4 -0
  42. package/dist/components/Toolbar/ChartTypeSelectDropdown.d.ts +9 -0
  43. package/dist/components/Toolbar/IntervalSelect.d.ts +15 -0
  44. package/dist/components/Toolbar/RangeSelector.d.ts +9 -0
  45. package/dist/components/Toolbar/SettingsToolbar.d.ts +50 -0
  46. package/dist/components/Toolbar/Toolbar.d.ts +10 -0
  47. package/dist/components/Toolbar/icons.d.ts +79 -0
  48. package/dist/components/Tooltip.d.ts +17 -0
  49. package/dist/contexts/ModeContext.d.ts +24 -0
  50. package/dist/engines/TickUpEngine.d.ts +12 -0
  51. package/dist/engines/prime/PrimeRenderer.d.ts +4 -0
  52. package/dist/engines/prime/TickUpPrime.d.ts +15 -0
  53. package/dist/full.d.ts +71 -0
  54. package/dist/hooks/useChartData.d.ts +15 -0
  55. package/dist/hooks/useElementSize.d.ts +13 -0
  56. package/dist/hooks/usePanAndZoom.d.ts +12 -0
  57. package/dist/index.d.ts +47 -0
  58. package/dist/main.d.ts +1 -0
  59. package/dist/services/FormattingService.d.ts +36 -0
  60. package/dist/styles/App.styles.d.ts +11 -0
  61. package/dist/styles/ChartCanvas.styles.d.ts +26 -0
  62. package/dist/styles/ChartTypeSelectDropdown.styles.d.ts +13 -0
  63. package/dist/styles/IntervalSelect.styles.d.ts +25 -0
  64. package/dist/styles/RangeSelector.styles.d.ts +10 -0
  65. package/dist/styles/SettingsToolbar.styles.d.ts +19 -0
  66. package/dist/styles/TickUpStage.styles.d.ts +31 -0
  67. package/dist/styles/Toolbar.styles.d.ts +12 -0
  68. package/dist/styles/Tooltip.styles.d.ts +22 -0
  69. package/dist/styles/XAxis.styles.d.ts +5 -0
  70. package/dist/styles/YAxis.styles.d.ts +6 -0
  71. package/dist/test-utils/assetUrlStub.d.ts +3 -0
  72. package/dist/test-utils/svgRawStub.d.ts +3 -0
  73. package/dist/tickup-full.cjs.js +1417 -0
  74. package/dist/tickup-full.es.js +6699 -0
  75. package/dist/tickup-icon.svg +5 -0
  76. package/dist/tickup.cjs.js +1417 -0
  77. package/dist/tickup.es.js +6427 -0
  78. package/dist/types/Drawings.d.ts +54 -0
  79. package/dist/types/Graph.d.ts +45 -0
  80. package/dist/types/Interval.d.ts +11 -0
  81. package/dist/types/buttons.d.ts +30 -0
  82. package/dist/types/chartContext.d.ts +52 -0
  83. package/dist/types/chartOptions.d.ts +161 -0
  84. package/dist/types/liveData.d.ts +14 -0
  85. package/dist/types/overlay.d.ts +64 -0
  86. package/dist/types/tickupProducts.d.ts +18 -0
  87. package/dist/types/types.d.ts +36 -0
  88. package/dist/utils/LocaleResolver.d.ts +15 -0
  89. package/dist/utils/captureChartRegion.d.ts +34 -0
  90. package/dist/utils/deepEqual.d.ts +1 -0
  91. package/dist/utils/deepMerge.d.ts +2 -0
  92. package/dist/utils/i18n.d.ts +26 -0
  93. package/dist/utils/liveDataMerge.d.ts +21 -0
  94. package/dist/utils/marketData.d.ts +8 -0
  95. package/dist/utils/timeUtils.d.ts +9 -0
  96. package/dist/vite.svg +1 -0
  97. package/documentation/01-glossary.md +61 -0
  98. package/documentation/01-introduction.md +7 -0
  99. package/documentation/02-installation.md +48 -0
  100. package/documentation/03-quick-start.md +86 -0
  101. package/documentation/04-products-and-layout.md +51 -0
  102. package/documentation/05-props-and-chart-options.md +109 -0
  103. package/documentation/06-imperative-api.md +117 -0
  104. package/documentation/07-data-and-live-updates.md +62 -0
  105. package/documentation/08-drawings-and-shapes.md +132 -0
  106. package/documentation/09-settings-modal.md +37 -0
  107. package/documentation/10-toolbar-and-interactions.md +85 -0
  108. package/documentation/11-exports-and-advanced.md +142 -0
  109. package/documentation/12-overlays-and-indicators.md +65 -0
  110. package/documentation/13-internationalization-and-axes.md +56 -0
  111. package/documentation/14-legal-and-policies.md +32 -0
  112. package/documentation/README.md +33 -0
  113. package/legal/ACCEPTABLE_USE_POLICY.md +79 -0
  114. package/legal/PRIVACY_POLICY.md +131 -0
  115. package/legal/README.md +21 -0
  116. package/legal/TERMS_OF_SERVICE.md +153 -0
  117. package/package.json +98 -0
@@ -0,0 +1,54 @@
1
+ import { ShapeBaseArgs } from "../components/Drawing/types";
2
+ import { StrokeLineStyle } from "./overlay";
3
+ export interface DrawingPoint {
4
+ time: number;
5
+ price: number;
6
+ }
7
+ export interface CanvasPoint {
8
+ x: number;
9
+ y: number;
10
+ }
11
+ export interface DrawingStyleOptions {
12
+ lineColor: string;
13
+ lineWidth: number;
14
+ lineStyle: StrokeLineStyle;
15
+ fillColor: string;
16
+ selected: {
17
+ lineColor: string;
18
+ lineWidthAdd?: number;
19
+ lineStyle?: StrokeLineStyle;
20
+ fillColor?: string;
21
+ };
22
+ }
23
+ export type FinalDrawingStyle = {
24
+ lineColor: string;
25
+ lineWidth: number;
26
+ lineStyle: StrokeLineStyle;
27
+ fillColor: string | 'transparent';
28
+ };
29
+ export interface AngleShapeArgs extends ShapeBaseArgs {
30
+ points: DrawingPoint[];
31
+ }
32
+ export interface PolylineShapeArgs extends ShapeBaseArgs {
33
+ points: DrawingPoint[];
34
+ }
35
+ export interface LineShapeArgs extends ShapeBaseArgs {
36
+ points: DrawingPoint[];
37
+ }
38
+ export interface RectangleShapeArgs extends ShapeBaseArgs {
39
+ points: DrawingPoint[];
40
+ }
41
+ export interface CircleShapeArgs extends ShapeBaseArgs {
42
+ points: DrawingPoint[];
43
+ }
44
+ export interface TriangleShapeArgs extends ShapeBaseArgs {
45
+ points: DrawingPoint[];
46
+ }
47
+ export interface ArrowShapeArgs extends ShapeBaseArgs {
48
+ points: DrawingPoint[];
49
+ }
50
+ export interface CustomSymbolShapeArgs extends ShapeBaseArgs {
51
+ points: DrawingPoint[];
52
+ symbol: string;
53
+ size: number;
54
+ }
@@ -0,0 +1,45 @@
1
+ export interface TimeRange {
2
+ start: number;
3
+ end: number;
4
+ }
5
+ export interface Tick {
6
+ position: number;
7
+ label: string;
8
+ }
9
+ export interface PriceRange {
10
+ min: number;
11
+ max: number;
12
+ range: number;
13
+ }
14
+ /**
15
+ * Visible time window (unix **seconds**) with bar index span, plus the price band used for Y scaling.
16
+ * Use `ref.getVisibleRanges()` on the stage or product host (same numbers as `getViewInfo()` / `getChartContext().data`).
17
+ */
18
+ export type VisibleViewRanges = {
19
+ time: TimeRange & {
20
+ startIndex: number;
21
+ endIndex: number;
22
+ };
23
+ price: PriceRange;
24
+ };
25
+ export interface DrawTicksOptions {
26
+ tickHeight: number;
27
+ tickColor: string;
28
+ labelColor: string;
29
+ labelFont: string;
30
+ labelOffset: number;
31
+ axisY: number;
32
+ }
33
+ export type IndexRangePair = {
34
+ startIndex: number;
35
+ endIndex: number;
36
+ };
37
+ export type ChartDimensionsData = {
38
+ cssWidth: number;
39
+ cssHeight: number;
40
+ dpr: number;
41
+ width: number;
42
+ height: number;
43
+ clientWidth: number;
44
+ clientHeight: number;
45
+ };
@@ -0,0 +1,11 @@
1
+ export interface Interval {
2
+ t: number;
3
+ o: number;
4
+ c: number;
5
+ l: number;
6
+ h: number;
7
+ v?: number;
8
+ }
9
+ export interface CandleWithIndex extends Interval {
10
+ index: number;
11
+ }
@@ -0,0 +1,30 @@
1
+ import type { ReactNode } from 'react';
2
+ import { Mode } from "../contexts/ModeContext";
3
+ export interface ModeButtonProps {
4
+ mode: Mode;
5
+ currentMode: Mode;
6
+ onClickHandler: any;
7
+ children?: ReactNode;
8
+ className?: string;
9
+ }
10
+ export interface ButtonProps {
11
+ onClickHandler: any;
12
+ children?: ReactNode;
13
+ className?: string;
14
+ }
15
+ export declare enum Placement {
16
+ top = 0,
17
+ right = 1,
18
+ bottom = 2,
19
+ left = 3,
20
+ auto = 4
21
+ }
22
+ export declare enum TooltipAlign {
23
+ start = 0,
24
+ center = 1,
25
+ end = 2
26
+ }
27
+ export declare enum TooltipAxis {
28
+ horizontal = 0,
29
+ vertical = 1
30
+ }
@@ -0,0 +1,52 @@
1
+ import type { ChartType, TimeDetailLevel } from './chartOptions';
2
+ import type { AxesPosition, ChartTheme } from './types';
3
+ /**
4
+ * Serializable snapshot of chart layout, data window, and interaction state for host-side analysis
5
+ * (sizing, visible ranges, symbol, selection). Obtain via {@link TickUpHostHandle.getChartContext}
6
+ * or {@link TickUpStageHandle.getChartContext}. The **`data`** fields for visible time/price match
7
+ * {@link TickUpHostHandle.getVisibleRanges} / {@link TickUpStageHandle.getVisibleRanges} (`time` ↔ `visibleTime*`, `price` ↔ `visiblePrice*`).
8
+ */
9
+ export type ChartContextInfo = {
10
+ /** Toolbar symbol if controlled/initial value is known */
11
+ symbol: string | null;
12
+ chartType: ChartType;
13
+ themeVariant: ChartTheme;
14
+ layout: {
15
+ /** Measured CSS size of the canvas container (the main plot host element). */
16
+ canvasContainer: {
17
+ width: number;
18
+ height: number;
19
+ };
20
+ yAxisWidthPx: number;
21
+ xAxisHeightPx: number;
22
+ yAxisPosition: AxesPosition;
23
+ };
24
+ /** Backing canvas pixel dimensions and device pixel ratio (from the chart canvas handle). */
25
+ canvas: {
26
+ width: number;
27
+ height: number;
28
+ dpr: number;
29
+ };
30
+ data: {
31
+ intervalCount: number;
32
+ firstBarTime: number | null;
33
+ lastBarTime: number | null;
34
+ visibleTimeStart: number;
35
+ visibleTimeEnd: number;
36
+ visibleTimeStartIndex: number;
37
+ visibleTimeEndIndex: number;
38
+ visiblePriceMin: number;
39
+ visiblePriceMax: number;
40
+ visiblePriceRange: number;
41
+ };
42
+ drawings: {
43
+ count: number;
44
+ };
45
+ interaction: {
46
+ /** Drawing index in the internal stack, or null if none selected */
47
+ selectedShapeIndex: number | null;
48
+ };
49
+ timeDetailLevel: TimeDetailLevel;
50
+ timeFormat12h: boolean;
51
+ numberOfYTicks: number;
52
+ };
@@ -0,0 +1,161 @@
1
+ import { AxesOptions, AxesPosition, ChartTheme } from "./types";
2
+ import type { Interval } from "./Interval";
3
+ import type { TimeRange } from "./Graph";
4
+ import { OverlayCalcSpec, OverlayKind, OverlayOptions, OverlayWithCalc } from "./overlay";
5
+ import { DrawingStyleOptions } from "./Drawings";
6
+ export declare enum TimeDetailLevel {
7
+ Auto = "auto",
8
+ Low = "low",
9
+ Medium = "medium",
10
+ High = "high"
11
+ }
12
+ export interface TradingSession {
13
+ dayOfWeek: number;
14
+ start: string;
15
+ end: string;
16
+ }
17
+ export declare enum ChartType {
18
+ Candlestick = "Candlestick",
19
+ Line = "Line",
20
+ Area = "Area",
21
+ Bar = "Bar"
22
+ }
23
+ export declare enum TickUpRenderEngine {
24
+ standard = "standard",
25
+ prime = "prime"
26
+ }
27
+ export declare enum NumberNotation {
28
+ standard = "standard",
29
+ scientific = "scientific",
30
+ /** Compact form (short scale) */
31
+ compact = "compact"
32
+ }
33
+ export declare enum CurrencyDisplay {
34
+ symbol = "symbol",
35
+ narrowSymbol = "narrowSymbol",
36
+ code = "code",
37
+ name = "name"
38
+ }
39
+ export declare enum AxesUnitPlacement {
40
+ prefix = "prefix",
41
+ suffix = "suffix"
42
+ }
43
+ /** Axis / tooltip price display mode (basis points, P&L, yields, vol). */
44
+ export declare enum PriceMetricKind {
45
+ basisPoints = "basisPoints",
46
+ pnl = "pnl",
47
+ /** Yield as a rate (value matches API string `yield`). */
48
+ Yield = "yield",
49
+ volatility = "volatility"
50
+ }
51
+ export interface ChartRenderContext {
52
+ allIntervals: Interval[];
53
+ visibleStartIndex: number;
54
+ visibleEndIndex: number;
55
+ visibleRange: TimeRange;
56
+ intervalSeconds: number;
57
+ canvasWidth: number;
58
+ canvasHeight: number;
59
+ }
60
+ export interface CandleStyleOptions {
61
+ bullColor: string;
62
+ bearColor: string;
63
+ upColor: string;
64
+ downColor: string;
65
+ borderColor: string;
66
+ borderWidth: number;
67
+ bodyWidthFactor: number;
68
+ spacingFactor: number;
69
+ }
70
+ export interface LineStyleOptions {
71
+ color: string;
72
+ lineWidth: number;
73
+ }
74
+ export interface AreaStyleOptions {
75
+ fillColor: string;
76
+ strokeColor: string;
77
+ lineWidth: number;
78
+ }
79
+ export interface HistogramStyleOptions {
80
+ bullColor: string;
81
+ bearColor: string;
82
+ opacity: number;
83
+ heightRatio: number;
84
+ }
85
+ export interface BarStyleOptions {
86
+ bullColor: string;
87
+ bearColor: string;
88
+ opacity: number;
89
+ }
90
+ export interface GridStyleOptions {
91
+ color: string;
92
+ lineWidth: number;
93
+ gridSpacing: number;
94
+ lineColor: string;
95
+ lineDash: number[];
96
+ }
97
+ export interface AxesStyleOptions {
98
+ axisPosition: AxesPosition;
99
+ textColor: string;
100
+ font: string;
101
+ lineColor: string;
102
+ lineWidth: number;
103
+ locale: string;
104
+ language: string;
105
+ numberFractionDigits: number;
106
+ decimalSeparator: string;
107
+ thousandsSeparator: string;
108
+ dateFormat: string;
109
+ numberNotation?: NumberNotation;
110
+ currency?: string;
111
+ useCurrency?: boolean;
112
+ currencyDisplay?: CurrencyDisplay;
113
+ minimumFractionDigits?: number;
114
+ maximumFractionDigits?: number;
115
+ maximumSignificantDigits?: number;
116
+ tickSize?: number;
117
+ autoPrecision?: boolean;
118
+ unit?: string;
119
+ unitPlacement?: AxesUnitPlacement;
120
+ timezone?: string;
121
+ exchange?: string;
122
+ tradingSessions?: TradingSession[];
123
+ holidays?: string[];
124
+ displayCurrency?: string;
125
+ conversionRate?: number;
126
+ }
127
+ export type StyleOptions = {
128
+ candles: CandleStyleOptions;
129
+ line: LineStyleOptions;
130
+ area: AreaStyleOptions;
131
+ histogram: HistogramStyleOptions;
132
+ bar: BarStyleOptions;
133
+ grid: GridStyleOptions;
134
+ overlay: OverlayOptions;
135
+ axes: AxesStyleOptions;
136
+ drawings: DrawingStyleOptions;
137
+ showGrid: boolean;
138
+ backgroundColor: string;
139
+ };
140
+ interface BaseChartOptions {
141
+ chartType?: ChartType;
142
+ /** Visual / render profile. `prime` enables neon styling, glass toolbars, and Prime crosshair. */
143
+ engine?: TickUpRenderEngine;
144
+ theme: ChartTheme;
145
+ showOverlayLine: boolean;
146
+ showHistogram: boolean;
147
+ /** Hover crosshair lines (vertical + horizontal) in navigation modes */
148
+ showCrosshair?: boolean;
149
+ /** Formatted time (along X) and price (along Y) drawn on the crosshair */
150
+ showCrosshairValues?: boolean;
151
+ /** OHLC / change panel while hovering a candle */
152
+ showCandleTooltip?: boolean;
153
+ style: StyleOptions;
154
+ overlays?: OverlayWithCalc[];
155
+ overlayKinds?: (OverlayKind | OverlayCalcSpec)[];
156
+ }
157
+ export type ChartOptions = {
158
+ base: BaseChartOptions;
159
+ axes: AxesOptions;
160
+ };
161
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { Interval } from './Interval';
2
+ /** How incoming bars are combined with the series already on the chart. */
3
+ export declare enum LiveDataPlacement {
4
+ replace = "replace",
5
+ append = "append",
6
+ prepend = "prepend",
7
+ mergeByTime = "mergeByTime"
8
+ }
9
+ export interface LiveDataApplyResult {
10
+ ok: boolean;
11
+ intervals: Interval[];
12
+ errors: string[];
13
+ warnings: string[];
14
+ }
@@ -0,0 +1,64 @@
1
+ /** Stroke pattern for overlay / drawing lines (canvas). */
2
+ export declare enum StrokeLineStyle {
3
+ solid = "solid",
4
+ dashed = "dashed",
5
+ dotted = "dotted"
6
+ }
7
+ export interface OverlayOptions {
8
+ lineColor: string;
9
+ lineWidth: number;
10
+ lineStyle: StrokeLineStyle;
11
+ }
12
+ export interface OverlayWithCalc extends OverlayOptions {
13
+ calc: OverlayCalcSpec;
14
+ connectNulls?: boolean;
15
+ useCenterX?: boolean;
16
+ }
17
+ /**
18
+ * Represents a fully computed overlay series, ready to be drawn on the canvas.
19
+ */
20
+ export interface OverlaySeries {
21
+ id?: string;
22
+ source: (number | null)[];
23
+ options: OverlayOptions;
24
+ connectNulls: boolean;
25
+ useCenterX: boolean;
26
+ }
27
+ export declare enum OverlayPriceKey {
28
+ close = "close",
29
+ open = "open",
30
+ high = "high",
31
+ low = "low"
32
+ }
33
+ export declare enum OverlayKind {
34
+ sma = "sma",
35
+ ema = "ema",
36
+ wma = "wma",
37
+ vwap = "vwap",
38
+ bbands_mid = "bbands_mid",
39
+ bbands_upper = "bbands_upper",
40
+ bbands_lower = "bbands_lower"
41
+ }
42
+ export type OverlayCalcSpec = {
43
+ kind: OverlayPriceKey;
44
+ } | {
45
+ kind: OverlayKind.sma | OverlayKind.ema | OverlayKind.wma;
46
+ period: number;
47
+ price?: OverlayPriceKey;
48
+ } | {
49
+ kind: OverlayKind.vwap;
50
+ } | {
51
+ kind: OverlayKind.bbands_mid;
52
+ period: number;
53
+ price?: OverlayPriceKey;
54
+ } | {
55
+ kind: OverlayKind.bbands_upper;
56
+ period: number;
57
+ stddev?: number;
58
+ price?: OverlayPriceKey;
59
+ } | {
60
+ kind: OverlayKind.bbands_lower;
61
+ period: number;
62
+ stddev?: number;
63
+ price?: OverlayPriceKey;
64
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * TickUp product lines (tiered charting shells).
3
+ *
4
+ * - **pulse** — minimal embed: plot + axes only (no toolbars). Toolbar chrome is locked; cannot be enabled via props.
5
+ * - **flow** — analysis: symbol bar & settings, no drawing sidebar. Chrome locked.
6
+ * - **command** — full trader UI: drawings, modals, live API. Chrome locked to full toolbars.
7
+ * - **desk** — broker / embedded terminal: same as command + attribution required. Chrome locked.
8
+ * - **prime** — licensed / eval tier: same chrome as command + optional `licenseKey` banner when unset.
9
+ *
10
+ * Product components omit `showSidebar` / `showTopBar` / `showSettingsBar` from their props; use `TickUpHost` without `productId` for a custom layout.
11
+ */
12
+ export declare enum TickUpProductId {
13
+ pulse = "pulse",
14
+ flow = "flow",
15
+ command = "command",
16
+ desk = "desk",
17
+ prime = "prime"
18
+ }
@@ -0,0 +1,36 @@
1
+ export declare enum AxesPosition {
2
+ left = 0,
3
+ right = 1
4
+ }
5
+ export declare enum AlignOptions {
6
+ left = "left",
7
+ center = "center",
8
+ right = "right"
9
+ }
10
+ export declare enum ChartTheme {
11
+ light = "light",
12
+ dark = "dark",
13
+ grey = "grey"
14
+ }
15
+ export type AxesOptions = {
16
+ yAxisPosition: AxesPosition;
17
+ currency: string;
18
+ numberOfYTicks: number;
19
+ };
20
+ export type CanvasSizes = {
21
+ width: number;
22
+ height: number;
23
+ };
24
+ export type DeepPartial<T> = {
25
+ [K in keyof T]?: T[K] extends (string | number | boolean | symbol | Function | any[]) ? T[K] : T[K] extends object ? DeepPartial<NonNullable<T[K]>> : T[K];
26
+ };
27
+ export type DeepRequired<T> = {
28
+ [K in keyof T]-?: T[K] extends (string | number | boolean | symbol | Function | any[]) ? NonNullable<T[K]> : T[K] extends object ? DeepRequired<NonNullable<T[K]>> : NonNullable<T[K]>;
29
+ };
30
+ export type WindowSpreadOptions = {
31
+ TOP_BAR_PX: number;
32
+ LEFT_BAR_PX: number;
33
+ INITIAL_X_AXIS_HEIGHT: number;
34
+ INITIAL_Y_AXIS_WIDTH: number;
35
+ };
36
+ export declare const windowSpread: WindowSpreadOptions;
@@ -0,0 +1,15 @@
1
+ import { AxesStyleOptions } from '../types/chartOptions';
2
+ import { LocaleDefaults } from './i18n';
3
+ export interface ResolvedLocaleSettings extends LocaleDefaults {
4
+ decimalSeparator: string;
5
+ thousandsSeparator: string;
6
+ dateFormat: string;
7
+ locale: string;
8
+ language: string;
9
+ currency: string;
10
+ useCurrency: boolean;
11
+ }
12
+ /**
13
+ * Resolves the effective locale settings, considering both locale defaults and user overrides.
14
+ */
15
+ export declare const resolveLocaleSettings: (options: AxesStyleOptions) => ResolvedLocaleSettings;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Metadata embedded in snapshot images and encoded into suggested download file names.
3
+ */
4
+ export interface ChartSnapshotMeta {
5
+ symbol: string;
6
+ visibleTimeStartSec: number;
7
+ visibleTimeEndSec: number;
8
+ intervalSeconds: number;
9
+ chartType: string;
10
+ barsInView: number;
11
+ totalBarsInSeries: number;
12
+ /** Y-axis visible range at capture time (analysis context). */
13
+ visiblePriceMin: number;
14
+ visiblePriceMax: number;
15
+ capturedAtMs: number;
16
+ }
17
+ export declare function contrastingFooterTextColor(backgroundCss: string, axesTextFallback?: string): string;
18
+ /** Safe single token for file names (ASCII, no path chars). */
19
+ export declare function sanitizeChartSnapshotToken(raw: string, maxLen: number): string;
20
+ /**
21
+ * File name encodes symbol, unix time range, bar period, chart kind, Y window (min/max × 1000, int), and capture instant.
22
+ * Example: `AAPL_t1688000000-1688060000_iv300s_y98765-102340_candle_cap2025-03-28T12-34-56-789Z.png`
23
+ */
24
+ export declare function buildChartSnapshotFileName(meta: ChartSnapshotMeta): string;
25
+ export interface CaptureChartRegionOptions {
26
+ /** When set, a footer strip with human-readable metadata is drawn under the chart bitmap. */
27
+ meta?: ChartSnapshotMeta | null;
28
+ footerTextColor?: string;
29
+ }
30
+ /**
31
+ * Rasterize all descendant canvases inside `root` into one PNG (axes + stacked chart layers).
32
+ * Skips the interaction overlay canvas (crosshair / pan), which is not part of the data display.
33
+ */
34
+ export declare function captureChartRegionToPngDataUrl(root: HTMLElement | null, backgroundColor: string, options?: CaptureChartRegionOptions): string | null;
@@ -0,0 +1 @@
1
+ export declare function deepEqual(obj1: any, obj2: any): boolean;
@@ -0,0 +1,2 @@
1
+ import type { DeepPartial, DeepRequired } from "../types/types";
2
+ export declare function deepMerge<T>(base: DeepRequired<T>, patch?: DeepPartial<T>): DeepRequired<T>;
@@ -0,0 +1,26 @@
1
+ export interface LocaleDefaults {
2
+ decimalSeparator: string;
3
+ thousandsSeparator: string;
4
+ dateFormat: string;
5
+ direction: 'ltr' | 'rtl';
6
+ language: string;
7
+ label: string;
8
+ defaultCurrency?: string;
9
+ isUpSuccess?: boolean;
10
+ }
11
+ export declare const SUPPORTED_LOCALES: Record<string, LocaleDefaults>;
12
+ export declare const SUPPORTED_CURRENCIES: {
13
+ code: string;
14
+ label: string;
15
+ }[];
16
+ export declare const getDateFnsLocale: (localeStr: string) => any;
17
+ export declare const SUPPORTED_LANGUAGES: {
18
+ code: string;
19
+ label: string;
20
+ }[];
21
+ export declare const getLocaleDefaults: (locale: string) => LocaleDefaults;
22
+ export declare const translate: (key: string, lang: string) => string;
23
+ /**
24
+ * Perform locale-aware string comparison for sorting.
25
+ */
26
+ export declare const compareStrings: (a: string, b: string, locale?: string) => number;
@@ -0,0 +1,21 @@
1
+ import type { Interval } from '../types/Interval';
2
+ import { LiveDataPlacement, type LiveDataApplyResult } from '../types/liveData';
3
+ /**
4
+ * Validates fields, coerces OHLC consistency, drops bad volume.
5
+ * Returns null if the row cannot be represented as an interval.
6
+ */
7
+ export declare function normalizeInterval(raw: Partial<Interval>, sourceLabel?: string): {
8
+ value: Interval | null;
9
+ notes: string[];
10
+ };
11
+ export declare function normalizeIntervals(items: Array<Partial<Interval>>): {
12
+ intervals: Interval[];
13
+ errors: string[];
14
+ warnings: string[];
15
+ };
16
+ /** Later rows with the same timestamp overwrite earlier ones (typical live tick update). */
17
+ export declare function dedupeByTimePreferLast(chronological: Interval[]): Interval[];
18
+ /**
19
+ * Applies live / partial updates with explicit placement rules and normalized OHLC.
20
+ */
21
+ export declare function applyLiveDataMerge(existing: Interval[], incomingRaw: Interval | Interval[], placement: LiveDataPlacement): LiveDataApplyResult;
@@ -0,0 +1,8 @@
1
+ import { TradingSession } from "../types/chartOptions";
2
+ export interface ExchangeConfig {
3
+ name: string;
4
+ timezone: string;
5
+ sessions: TradingSession[];
6
+ }
7
+ export declare const EXCHANGES: Record<string, ExchangeConfig>;
8
+ export declare function getExchangeConfig(exchange: string): ExchangeConfig | undefined;
@@ -0,0 +1,9 @@
1
+ import { TradingSession } from "../types/chartOptions";
2
+ /**
3
+ * Formats a timestamp into a human-readable date/time string with timezone support.
4
+ */
5
+ export declare function formatWithTimezone(timestamp: number, formatOptions: Intl.DateTimeFormatOptions, locale?: string, timezone?: string): string;
6
+ /**
7
+ * Checks if a given timestamp is within any of the provided trading sessions.
8
+ */
9
+ export declare function isWithinTradingSession(timestamp: number, sessions: TradingSession[], timezone?: string): boolean;
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>