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
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ - **Rebrand:** npm package **`tickup`** with React surface **`TickUp*`** (`TickUpStage`, `TickUpHost`, `TickUpCommand`, …). Bundles: `dist/tickup.{es,cjs}.js`, `dist/tickup-full.{es,cjs}.js`. Build env: `TICKUP_LIB_ENTRY`, `TICKUP_SKIP_OBFUSCATE`.
11
+ - **Prime:** `chartOptions.base.engine` (`standard` \| `prime`), **`TickUpPrime`** / **`TickUpStandardEngine`** exports, **`ref.setEngine`**, neon canvas + glass toolbars; **`TickUpPrimeTier`** (`productId: 'prime'`) replaces the previous licensed shell name.
12
+ - **Public release scope:** docs and the reference example emphasize **Pulse, Flow, Command, Desk**; Prime engine/tier are documented in the Prime repository docs.
13
+ - Documentation shipped in the npm package under `documentation/` for offline / IDE browsing.
14
+ - Symbol search: `onSymbolSearch` may return `false` or reject to revert the toolbar to the last good symbol.
15
+ - **Advanced Interval Selection:** Categorized, searchable dropdown in the top bar; supports numerous timeframes (Intraday, Daily, Weekly, Monthly) with Portal-based rendering.
16
+ - **Data-feed handler:** `onIntervalSearch` callback for intercepting timeframe changes; supports asynchronous data replacement with built-in UI revert logic on failure.
17
+ - **Drawing API Extensions:** Added `getSelectedDrawing`, `getSelectedDrawingId`, `selectShape`, `unselectShape`, and `updateSelectedShape` to the imperative handle; `setInteractionMode(Mode)` now fully supports programmatically starting any interactive drawing tool.
18
+
19
+ ## [0.1.0] - 2026
20
+
21
+ - Initial public release on npm: dual entry `tickup` and `tickup/full`, TypeScript declarations in `dist/`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bar Damri
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # 🚀 TickUp Charts
2
+
3
+ ## High-Performance React Financial Charts for the Modern Web
4
+
5
+ TickUp is a lightning-fast, Canvas 2D-based charting library for React. Built for speed and precision, it handles thousands of data points with zero lag, providing a professional trading experience out of the box.
6
+
7
+ ## 🌐 VIEW LIVE SHOWCASE & DOCUMENTATION
8
+
9
+ [Experience the performance and explore the full API documentation.](https://github.com/BARDAMRI/tickup-charts/blob/main/documentation/README.md)
10
+
11
+ ## 📸 Visual Showcase
12
+
13
+ ### 💎 The Prime Experience
14
+
15
+ The optional Prime engine adds high-fidelity neon aesthetics and professional rendering profiles.
16
+
17
+ ![Prime Hero](./assets/showcase/hero-prime-neon.png)
18
+
19
+ ### 📊 Core vs. Prime
20
+
21
+ | Standard Core | Prime Turbo Mode |
22
+ | --- | --- |
23
+ | Clean, functional, and fast. | Neon glow, pro indicators, and high-density mode. |
24
+ | ![Core](./assets/showcase/compare-standard.png) | ![Prime](./assets/showcase/compare-prime.png) |
25
+
26
+ ## ✨ Key Features
27
+
28
+ - Canvas 2D Engine: Ultra-smooth rendering without WebGL complexity.
29
+ - Pro Drawing Tools: Trend lines, Fibonacci, shapes, and full imperative API.
30
+ - Live Data Flow: Seamless WebSocket integration (replace/append/merge).
31
+ - Financial Tier Layouts: Built-in products like Pulse, Flow, Command, and Desk.
32
+
33
+ ## 🛠️ Quick Start
34
+
35
+ ```bash
36
+ npm install tickup react react-dom styled-components
37
+ ```
38
+
39
+ ## 📖 Documentation
40
+
41
+ - [Quick Start Guide](./documentation/03-quick-start.md)
42
+ - [Imperative API Reference](./documentation/06-imperative-api.md)
43
+ - [Live Data & Updates](./documentation/07-data-and-live-updates.md)
44
+
45
+ ## 💎 Go Premium
46
+
47
+ Need the neon glow and advanced pro indicators? Check out [TickUp Prime](https://github.com/BARDAMRI/tickup-prime).
48
+
49
+ ## 🗺️ Roadmap
50
+
51
+ - Q2 2026: Advanced Indicators (Ichimoku, SuperTrend).
52
+ - Q3 2026: WebGL Rendering Engine for 1M+ points.
53
+ - Q4 2026: Collaborative Drawing Tools.
54
+
55
+ Contact: [bardamri1702@gmail.com](mailto:bardamri1702@gmail.com) | [GitHub](https://github.com/BARDAMRI)
@@ -0,0 +1,11 @@
1
+ import { ChartTheme } from '../types/types';
2
+ export type TickUpAttributionProps = {
3
+ themeVariant: ChartTheme;
4
+ /** e.g. product label shown next to the mark */
5
+ productLabel?: string;
6
+ className?: string;
7
+ };
8
+ /**
9
+ * Footer attribution for embedded charts (copyright + brand mark). Theme-aware.
10
+ */
11
+ export declare function TickUpAttribution({ themeVariant, productLabel, className }: TickUpAttributionProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { ChartTheme } from '../types/types';
2
+ /** @deprecated Use {@link ChartTheme} */
3
+ export type TickUpThemeVariant = ChartTheme;
4
+ type TickUpMarkProps = {
5
+ variant: ChartTheme;
6
+ /** Total height in px */
7
+ height?: number;
8
+ className?: string;
9
+ 'aria-hidden'?: boolean;
10
+ };
11
+ /**
12
+ * Optional DOM wordmark (e.g. marketing). Theme-aware full logos.
13
+ */
14
+ export declare function TickUpMark({ variant, height, className, 'aria-hidden': ariaHidden, }: TickUpMarkProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,12 @@
1
+ /** Toolbar / attribution wordmark — light surfaces */
2
+ export declare const TICKUP_WORDMARK_URL_LIGHT: string;
3
+ /** Mid-tone / grey shell or marketing blocks */
4
+ export declare const TICKUP_WORDMARK_URL_GREY: string;
5
+ /** Toolbar / attribution wordmark — dark surfaces */
6
+ export declare const TICKUP_WORDMARK_URL_DARK: string;
7
+ /** In-canvas watermark on light / grey plot */
8
+ export declare const TICKUP_WATERMARK_URL_LIGHT: string;
9
+ /** In-canvas watermark on dark plot */
10
+ export declare const TICKUP_WATERMARK_URL_DARK: string;
11
+ /** Grey chart theme — same glyph weight as light plots */
12
+ export declare const TICKUP_WATERMARK_URL_GREY: string;
@@ -0,0 +1,28 @@
1
+ import { ChartTheme } from '../types/types';
2
+ export type TickUpWatermarkTheme = ChartTheme;
3
+ export declare enum TickUpWatermarkPlacement {
4
+ center = "center",
5
+ bottomRight = "bottom-right",
6
+ bottomLeft = "bottom-left",
7
+ topRight = "top-right",
8
+ topLeft = "top-left"
9
+ }
10
+ export type TickUpWatermarkImages = {
11
+ light: HTMLImageElement;
12
+ dark: HTMLImageElement;
13
+ grey: HTMLImageElement;
14
+ };
15
+ /**
16
+ * Loads the bundled TickUp mark images once (for canvas drawImage).
17
+ */
18
+ export declare function loadTickUpWatermarkImages(): Promise<TickUpWatermarkImages | null>;
19
+ export type DrawWatermarkOptions = {
20
+ maxWidthFrac?: number;
21
+ opacity?: number;
22
+ padding?: number;
23
+ placement?: TickUpWatermarkPlacement;
24
+ };
25
+ /**
26
+ * Draws the mark on the canvas (before series). Opacity is caller-controlled.
27
+ */
28
+ export declare function drawTickUpWatermark(ctx: CanvasRenderingContext2D, cssWidth: number, cssHeight: number, theme: TickUpWatermarkTheme, images: TickUpWatermarkImages | null, options?: DrawWatermarkOptions): void;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { TimeRange } from "../../../types/Graph";
3
+ import { AxesStyleOptions, TimeDetailLevel } from "../../../types/chartOptions";
4
+ import { CanvasSizes } from "../../../types/types";
5
+ interface XAxisProps {
6
+ canvasSizes: CanvasSizes;
7
+ parentContainerRef: React.RefObject<HTMLDivElement | null>;
8
+ xAxisHeight: number;
9
+ visibleRange: TimeRange;
10
+ timeDetailLevel: TimeDetailLevel;
11
+ timeFormat12h: boolean;
12
+ formatting: AxesStyleOptions;
13
+ dateFormat?: string;
14
+ locale: string;
15
+ timezone?: string;
16
+ }
17
+ export default function XAxis({ canvasSizes, xAxisHeight, visibleRange, timeDetailLevel, timeFormat12h, formatting, dateFormat, locale, timezone }: XAxisProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,12 @@
1
+ import { AxesStyleOptions } from "../../../types/chartOptions";
2
+ import { AxesPosition } from "../../../types/types";
3
+ interface YAxisProps {
4
+ yAxisPosition: AxesPosition;
5
+ xAxisHeight: number;
6
+ minPrice: number;
7
+ maxPrice: number;
8
+ numberOfYTicks: number;
9
+ formatting: AxesStyleOptions;
10
+ }
11
+ export default function YAxis({ yAxisPosition, minPrice, maxPrice, numberOfYTicks, formatting }: YAxisProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { ChartOptions } from "../../types/chartOptions";
3
+ import { Interval } from "../../types/Interval";
4
+ import { PriceRange, TimeRange } from "../../types/Graph";
5
+ import { CanvasSizes, ChartTheme, DeepRequired, WindowSpreadOptions } from "../../types/types";
6
+ import { IDrawingShape } from "../Drawing/IDrawingShape";
7
+ interface ChartCanvasProps {
8
+ intervalsArray: Interval[];
9
+ drawings: IDrawingShape[];
10
+ setDrawings: (drawings: IDrawingShape[] | ((prev: IDrawingShape[]) => IDrawingShape[])) => void;
11
+ selectedIndex: number | null;
12
+ /** Hit-tested on mousedown in Select / Edit shape modes (top-most drawing wins). */
13
+ setSelectedIndex?: (index: number | null) => void;
14
+ /** Double-click shape, or context-menu on selected shape — opens properties UI. */
15
+ onRequestShapeProperties?: (drawingIndex: number) => void;
16
+ visibleRange: TimeRange;
17
+ setVisibleRange: (range: TimeRange | ((prev: TimeRange) => TimeRange)) => void;
18
+ visiblePriceRange: PriceRange;
19
+ chartOptions: DeepRequired<ChartOptions>;
20
+ canvasSizes: CanvasSizes;
21
+ parentContainerRef?: React.RefObject<HTMLDivElement>;
22
+ windowSpread: WindowSpreadOptions;
23
+ /** Draw bundled TickUp marks inside plot / histogram (no DOM footer). */
24
+ showBrandWatermark?: boolean;
25
+ /** Matches chart `base.theme` for choosing light / dark / grey mark artwork. */
26
+ brandTheme?: ChartTheme;
27
+ }
28
+ export interface ChartCanvasHandle {
29
+ getCanvasSize(): {
30
+ width: number;
31
+ height: number;
32
+ dpr: number;
33
+ };
34
+ /** Main OHLC canvas (for snapshots); does not include histogram or drawings layers. */
35
+ getMainCanvasElement(): HTMLCanvasElement | null;
36
+ clearCanvas(): void;
37
+ redrawCanvas(): void;
38
+ }
39
+ export declare const ChartCanvas: React.ForwardRefExoticComponent<ChartCanvasProps & React.RefAttributes<ChartCanvasHandle>>;
40
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @deprecated Use {@link TickUpStage} from the same folder. Kept for backward compatibility.
3
+ */
4
+ export { TickUpStage as ChartStage, type TickUpStageHandle as ChartStageHandle } from './TickUpStage';
5
+ export type { TickUpStageProps as ChartStageProps } from './TickUpStage';
@@ -0,0 +1,122 @@
1
+ import React from 'react';
2
+ import { PriceRange, TimeRange } from "../../types/Graph";
3
+ import { Interval } from "../../types/Interval";
4
+ import { ChartOptions, ChartType, TimeDetailLevel } from "../../types/chartOptions";
5
+ import { DeepRequired, ChartTheme } from "../../types/types";
6
+ import { IDrawingShape } from "../Drawing/IDrawingShape";
7
+ import { type DrawingInput, type DrawingPatch, type DrawingSpec } from "../Drawing/drawHelper";
8
+ import { RangeKey } from '../Toolbar/RangeSelector';
9
+ import { Mode } from '../../contexts/ModeContext';
10
+ import type { LiveDataPlacement, LiveDataApplyResult } from "../../types/liveData";
11
+ import type { ChartContextInfo } from "../../types/chartContext";
12
+ import { type DrawingQuery, type DrawingSnapshot } from "../Drawing/drawingQuery";
13
+ export interface TickUpStageProps {
14
+ intervalsArray: Interval[];
15
+ numberOfYTicks: number;
16
+ timeDetailLevel: TimeDetailLevel;
17
+ timeFormat12h: boolean;
18
+ selectedIndex: number | null;
19
+ setSelectedIndex?: (index: number | null) => void;
20
+ chartOptions: DeepRequired<ChartOptions>;
21
+ showTopBar?: boolean;
22
+ showLeftBar?: boolean;
23
+ handleChartTypeChange: (newType: ChartType) => void;
24
+ openSettingsMenu: () => void;
25
+ showSettingsBar: boolean;
26
+ /** Called when the toolbar refresh control is used; parent can reload remote data. */
27
+ onRefreshRequest?: () => void | Promise<void>;
28
+ /** Toggles app/chart theme (wired from host, e.g. TickUp shell). */
29
+ onToggleTheme?: () => void;
30
+ symbol?: string;
31
+ defaultSymbol?: string;
32
+ onSymbolChange?: (symbol: string) => void;
33
+ onSymbolSearch?: (symbol: string) => void | boolean | Promise<void | boolean>;
34
+ /** Current interval (e.g. '5m') */
35
+ interval?: string;
36
+ /** Notified when user picks a timeframe button or code calls setInterval(...) */
37
+ onIntervalChange?: (tf: string) => void;
38
+ /** Current range (e.g. '1M') */
39
+ range?: RangeKey;
40
+ /** Notified when user picks a range button or code calls setRange(...) */
41
+ onRangeChange?: (range: RangeKey) => void;
42
+ /** Optional explicit initial range name if any. */
43
+ initialRange?: RangeKey;
44
+ /** Sync with app chart theme for fullscreen modals */
45
+ themeVariant?: ChartTheme;
46
+ showBrandWatermark?: boolean;
47
+ /** Search/validation flow for interval changes (e.g. swap data feed). */
48
+ onIntervalSearch?: (tf: string) => void | boolean | Promise<void | boolean>;
49
+ }
50
+ export interface TickUpStageHandle {
51
+ /** Accepts a shape class instance or a plain {@link DrawingSpec} (`{ type, points, style?, id? }`). */
52
+ addShape: (shape: DrawingInput) => void;
53
+ /**
54
+ * Full replace: pass an instance or a {@link DrawingSpec} (id in spec is ignored; {@code shapeId} wins).
55
+ * Partial update: pass a {@link DrawingPatch} only (`{ style?, points?, symbol?, size? }`) — same as {@link patchShape}.
56
+ */
57
+ updateShape: (shapeId: string, newShape: DrawingInput | DrawingPatch) => void;
58
+ /** Merge geometry/style into the drawing with the given id (in-place mutation + state refresh). */
59
+ patchShape: (shapeId: string, patch: DrawingPatch) => void;
60
+ /** Replace all drawings with instances built from specs (e.g. hydrate from saved JSON). */
61
+ setDrawingsFromSpecs: (specs: DrawingSpec[]) => void;
62
+ deleteShape: (shapeId: string) => void;
63
+ addInterval: (interval: Interval) => void;
64
+ updateInterval: (index: number, newInterval: Interval) => void;
65
+ deleteInterval: (index: number) => void;
66
+ applyLiveData: (updates: Interval | Interval[], placement: LiveDataPlacement) => LiveDataApplyResult;
67
+ /** Pans/zooms the time axis so the full loaded series is visible. */
68
+ fitVisibleRangeToData: () => void;
69
+ /**
70
+ * If the last bar sits past the right edge of the visible window, pans the window right by the
71
+ * smallest amount that brings it into view while keeping the same time span when possible.
72
+ * No-op when the latest data is already visible — avoids the jump of {@link fitVisibleRangeToData}.
73
+ */
74
+ nudgeVisibleTimeRangeToLatest: (options?: {
75
+ trailingPaddingSec?: number;
76
+ }) => void;
77
+ getMainCanvasElement: () => HTMLCanvasElement | null;
78
+ getViewInfo: () => {
79
+ intervals: Interval[];
80
+ drawings: IDrawingShape[];
81
+ visibleRange: TimeRange & {
82
+ startIndex: number;
83
+ endIndex: number;
84
+ };
85
+ visiblePriceRange: PriceRange;
86
+ canvasSize: {
87
+ width: number;
88
+ height: number;
89
+ dpr: number;
90
+ };
91
+ };
92
+ /** Plain snapshots (safe to JSON.stringify). Omit query to return all, in z-order. */
93
+ getDrawings: (query?: DrawingQuery) => DrawingSnapshot[];
94
+ getDrawingById: (id: string) => DrawingSnapshot | null;
95
+ /** Live shape instances matching the query (same references as chart state). */
96
+ getDrawingInstances: (query?: DrawingQuery) => IDrawingShape[];
97
+ /** Get the snapshot of the currently selected drawing (if any). */
98
+ getSelectedDrawing: () => DrawingSnapshot | null;
99
+ /** Get the ID of the currently selected drawing (if any). */
100
+ getSelectedDrawingId: () => string | null;
101
+ /** Select a drawing by its unique ID. */
102
+ selectShape: (id: string) => void;
103
+ /** Clear any currently active drawing selection. */
104
+ unselectShape: () => void;
105
+ /** Update the properties of the currently selected drawing (shortcut for patchShape + getSelectedDrawingId). */
106
+ updateSelectedShape: (patch: DrawingPatch) => void;
107
+ /** Layout, visible ranges, symbol, canvas metrics — for host analysis. */
108
+ getChartContext: () => ChartContextInfo;
109
+ getCanvasSize: () => {
110
+ width: number;
111
+ height: number;
112
+ dpr: number;
113
+ };
114
+ clearCanvas: () => void;
115
+ redrawCanvas: () => void;
116
+ reloadCanvas: () => void;
117
+ /** Same behavior as the package drawing toolbar; requires {@link ModeProvider} above the stage. */
118
+ setInteractionMode: (mode: Mode) => void;
119
+ /** Deletes the shape at {@link selectedIndex}, if any, and clears selection. */
120
+ deleteSelectedDrawing: () => void;
121
+ }
122
+ export declare const TickUpStage: React.ForwardRefExoticComponent<TickUpStageProps & React.RefAttributes<TickUpStageHandle>>;
@@ -0,0 +1,13 @@
1
+ import type { ChartOptions, ChartRenderContext } from "../../../types/chartOptions";
2
+ import { PriceRange } from "../../../types/Graph";
3
+ import { DeepRequired } from "../../../types/types";
4
+ /**
5
+ * Draws horizontal and vertical grid lines on the canvas.
6
+ * Respects options.base.style.showGrid to be shown or hidden.
7
+ */
8
+ export declare function drawGrid(ctx: CanvasRenderingContext2D, canvasWidth: number, canvasHeight: number, options: DeepRequired<ChartOptions>): void;
9
+ export declare function drawCandlestickChart(ctx: CanvasRenderingContext2D, context: ChartRenderContext, options: DeepRequired<ChartOptions>, visiblePriceRange: PriceRange): void;
10
+ export declare function drawLineChart(ctx: CanvasRenderingContext2D, context: ChartRenderContext, style: DeepRequired<ChartOptions>, visiblePriceRange: PriceRange): void;
11
+ export declare function drawAreaChart(ctx: CanvasRenderingContext2D, context: ChartRenderContext, options: DeepRequired<ChartOptions>, visiblePriceRange: PriceRange): void;
12
+ export declare function drawBarChart(ctx: CanvasRenderingContext2D, context: ChartRenderContext, options: DeepRequired<ChartOptions>, visiblePriceRange: PriceRange): void;
13
+ export declare function drawHistogramChart(ctx: CanvasRenderingContext2D, context: ChartRenderContext, options: DeepRequired<ChartOptions>): void;
@@ -0,0 +1,60 @@
1
+ import { PriceRange, TimeRange } from "../../../types/Graph";
2
+ import type { Interval } from "../../../types/Interval";
3
+ /**
4
+ * Calculates the startTime coordinate of the start of a time interval.
5
+ * @param tStart - start time of the interval (timestamp in seconds)
6
+ * @param clientWidth - endTime of the canvas in pixels
7
+ * @param visibleRange - currently visible time range
8
+ */
9
+ export declare const xFromStart: (tStart: number, clientWidth: number, visibleRange: TimeRange) => number;
10
+ /**
11
+ * Calculates the startTime coordinate of the center of a time interval.
12
+ * @param tStart - start time of the interval (timestamp in seconds)
13
+ * @param intervalSeconds - duration of the interval in seconds
14
+ * @param clientWidth - endTime of the canvas in pixels
15
+ * @param visibleRange - currently visible time range
16
+ */
17
+ export declare const xFromCenter: (tStart: number, intervalSeconds: number, clientWidth: number, visibleRange: TimeRange) => number;
18
+ /**
19
+ * Converts a price value into a vertical pixel coordinate.
20
+ * The startPrice=0 is at the top of the canvas, so higher prices map to lower startPrice values.
21
+ * @param p - price to convert
22
+ * @param clientHeight - endPrice of the canvas in pixels
23
+ * @param price - currently visible price range
24
+ */
25
+ export declare const priceToY: (p: number, clientHeight: number, price: PriceRange) => number;
26
+ /**
27
+ * Converts a time value (timestamp) into a horizontal pixel coordinate.
28
+ * @param time - timestamp to convert
29
+ * @param clientWidth - endTime of the canvas in pixels
30
+ * @param visibleRange - currently visible time range
31
+ */
32
+ export declare const timeToX: (time: number, clientWidth: number, visibleRange: TimeRange) => number;
33
+ /**
34
+ * Converts a horizontal pixel coordinate (from a mouse event) into a time value (timestamp).
35
+ * This is the inverse of timeToX.
36
+ */
37
+ export declare const xToTime: (x: number, clientWidth: number, visibleRange: TimeRange) => number;
38
+ /**
39
+ * Converts a vertical pixel coordinate (from a mouse event) into a price value.
40
+ * This is the inverse of priceToY.
41
+ */
42
+ export declare const yToPrice: (y: number, clientHeight: number, priceRange: PriceRange) => number;
43
+ /**
44
+ * Linear interpolation between startPrice and endPrice by a factor of t (0 <= t <= 1)
45
+ * @param y1 - start value
46
+ * @param y2 - end value
47
+ * @param t - interpolation factor (0 = startPrice, 1 = endPrice)
48
+ */
49
+ export declare function lerp(y1: number, y2: number, t: number): number;
50
+ /**
51
+ * Given a sorted array of intervals, an interval duration, and a time,
52
+ * returns the interpolated close value at that time.
53
+ * If the time is before the first interval or after the last, returns the closest close value.
54
+ * Uses binary search for efficiency.
55
+ * @param all - sorted array of intervals
56
+ * @param intervalSeconds - duration of each interval in seconds
57
+ * @param timeSec - time to interpolate at (timestamp in seconds)
58
+ * @returns interpolated close value
59
+ */
60
+ export declare const interpolatedCloseAtTime: (all: Interval[], intervalSeconds: number, timeSec: number) => number;
@@ -0,0 +1,4 @@
1
+ import { ChartRenderContext } from '../../../types/chartOptions';
2
+ import { PriceRange } from '../../../types/Graph';
3
+ import { IDrawingShape } from "../../Drawing/IDrawingShape";
4
+ export declare function drawDrawings(ctx: CanvasRenderingContext2D, drawings: IDrawingShape[], selectedIndex: number | null, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): void;
@@ -0,0 +1,44 @@
1
+ import { OverlayCalcSpec, OverlayKind, OverlayOptions, OverlayPriceKey, OverlaySeries, OverlayWithCalc } from "../../../types/overlay";
2
+ import type { Interval } from "../../../types/Interval";
3
+ import type { ChartRenderContext } from "../../../types/chartOptions";
4
+ import type { PriceRange } from "../../../types/Graph";
5
+ import { DeepPartial, DeepRequired } from "../../../types/types";
6
+ /** Factory helpers for calculation specs */
7
+ export declare const OverlaySpecs: {
8
+ readonly close: () => OverlayCalcSpec;
9
+ readonly open: () => OverlayCalcSpec;
10
+ readonly high: () => OverlayCalcSpec;
11
+ readonly low: () => OverlayCalcSpec;
12
+ readonly sma: (period: number, price?: OverlayPriceKey) => OverlayCalcSpec;
13
+ readonly ema: (period: number, price?: OverlayPriceKey) => OverlayCalcSpec;
14
+ readonly wma: (period: number, price?: OverlayPriceKey) => OverlayCalcSpec;
15
+ readonly vwap: () => OverlayCalcSpec;
16
+ readonly bbandsMid: (period: number, price?: OverlayPriceKey) => OverlayCalcSpec;
17
+ readonly bbandsUpper: (period: number, stddev?: number, price?: OverlayPriceKey) => OverlayCalcSpec;
18
+ readonly bbandsLower: (period: number, stddev?: number, price?: OverlayPriceKey) => OverlayCalcSpec;
19
+ };
20
+ /**
21
+ * Build an OverlayWithCalc from style + calc, with optional flags.
22
+ * Example:
23
+ * makeOverlay({ lineColor: '#f90', lineWidth: 2, lineStyle: 'solid' }, OverlaySpecs.sma(20))
24
+ */
25
+ export declare function makeOverlay(style?: DeepRequired<OverlayOptions>, calc?: OverlayCalcSpec, extras?: Pick<OverlayWithCalc, 'connectNulls' | 'useCenterX'>): OverlayWithCalc;
26
+ /**
27
+ * Currying helper: create a family of overlays sharing the same style.
28
+ * Example:
29
+ * const withOrange = withOverlayStyle({ lineColor: '#f90', lineWidth: 2, lineStyle: 'solid' });
30
+ * const sma20 = withOrange(OverlaySpecs.sma(20));
31
+ */
32
+ export declare function withOverlayStyle(style?: DeepPartial<OverlayOptions>): (calc?: OverlayCalcSpec, extras?: Pick<OverlayWithCalc, "connectNulls" | "useCenterX">) => OverlayWithCalc;
33
+ export declare function computeSeriesBySpec(intervals: Interval[], spec: OverlayCalcSpec): (number | null)[];
34
+ export declare function drawOverlays(ctx: CanvasRenderingContext2D, context: ChartRenderContext, visiblePriceRange: PriceRange, seriesList: OverlaySeries[]): void;
35
+ /**
36
+ * Draw overlays directly from user options (OverlayWithCalc[]).
37
+ * Computes series values internally from intervals and forwards them to drawOverlays.
38
+ */
39
+ export declare function drawOverlaysFromOptions(ctx: CanvasRenderingContext2D, context: ChartRenderContext, visiblePriceRange: PriceRange, overlays: OverlayWithCalc[] | undefined): void;
40
+ /** Convenience: quick overlay creator with defaults.
41
+ * Example: overlay('sma', { lineColor: '#f90' }, { connectNulls: false })
42
+ */
43
+ export declare function overlay(kindOrSpec?: OverlayCalcSpec | OverlayKind | OverlayPriceKey, style?: DeepPartial<OverlayOptions>, extras?: Pick<OverlayWithCalc, 'connectNulls' | 'useCenterX'>): OverlayWithCalc;
44
+ export declare function drawOverlay(ctx: CanvasRenderingContext2D, context: ChartRenderContext, visiblePriceRange: PriceRange, overlaysOrKind?: OverlayWithCalc[] | OverlayCalcSpec | OverlayKind, style?: DeepRequired<OverlayOptions>, extras?: Pick<OverlayWithCalc, 'connectNulls' | 'useCenterX'>): void;
@@ -0,0 +1,34 @@
1
+ import { AxesUnitPlacement, CurrencyDisplay, NumberNotation, PriceMetricKind } from '../../../types/chartOptions';
2
+ export interface FormatNumberOptions {
3
+ fractionDigits?: number;
4
+ decimalSeparator?: string;
5
+ thousandsSeparator?: string;
6
+ locale?: string;
7
+ style?: 'decimal' | 'currency' | 'percent';
8
+ currency?: string;
9
+ currencyDisplay?: CurrencyDisplay;
10
+ minimumFractionDigits?: number;
11
+ maximumFractionDigits?: number;
12
+ maximumSignificantDigits?: number;
13
+ notation?: NumberNotation;
14
+ tickSize?: number;
15
+ unit?: string;
16
+ unitPlacement?: AxesUnitPlacement;
17
+ conversionRate?: number;
18
+ displayCurrency?: string;
19
+ metricType?: PriceMetricKind;
20
+ showSign?: boolean;
21
+ }
22
+ /**
23
+ * Powerful number formatter using Intl.NumberFormat with custom separator support.
24
+ */
25
+ export declare function formatNumber(value: number, options?: FormatNumberOptions): string;
26
+ /**
27
+ * Handle localized numeric input.
28
+ * Example: '1.200,50' in de-DE -> 1200.5
29
+ */
30
+ export declare function parseNumber(input: string, locale?: string, decimalSeparator?: string): number | null;
31
+ /**
32
+ * Normalize a value for the clipboard, stripping all formatting for programmatic use.
33
+ */
34
+ export declare function normalizeClipboardValue(value: string | number): string;
@@ -0,0 +1,9 @@
1
+ import { DrawTicksOptions, Tick, TimeRange } from "../../../types/Graph";
2
+ import { TimeDetailLevel, AxesStyleOptions } from "../../../types/chartOptions";
3
+ import { AxesPosition } from "../../../types/types";
4
+ export declare function generateAndDrawTimeTicks(canvas: HTMLCanvasElement, timeRange: TimeRange, numberOfXTicks: number,
5
+ /** User's regional date format string (e.g. 'dd/MM/yyyy', 'MMM d, yyyy'). Used to determine date order on day-level ticks. */
6
+ dateFormat: string, timeFormat12h: boolean, xAxisHeight: number, strokeStyle: string, timeDetailLevel: TimeDetailLevel, options: DrawTicksOptions, locale?: string, timezone?: string,
7
+ /** Prefer layout width from {@link getBoundingClientRect} so ticks match the visible span even when `clientWidth` is briefly 0. */
8
+ cssWidthOverride?: number): Tick[];
9
+ export declare function generateAndDrawYTicks(canvas: HTMLCanvasElement, minValue: number, maxValue: number, numberOfYTicks: number, yAxisPosition?: AxesPosition, tickColor?: string, labelColor?: string, labelFont?: string, tickLength?: number, labelOffset?: number, formatting?: Partial<AxesStyleOptions>): void;
@@ -0,0 +1,6 @@
1
+ import { Interval } from "../../../types/Interval";
2
+ import { PriceRange } from "../../../types/Graph";
3
+ /** Typical bar spacing in seconds (median of successive `t` deltas), aligned with {@link TickUpStage} / pan-zoom. */
4
+ export declare function getBarIntervalSeconds(arr: Interval[], fallbackSeconds?: number): number;
5
+ export declare function findPriceRange(allCandles: Interval[], startIndex: number, endIndex: number): PriceRange;
6
+ export declare function isPointNearLine(px: number, py: number, x1: number, y1: number, x2: number, y2: number, tolerance: number): boolean;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { type AlertThemeVariant } from './AlertModal.styles';
3
+ interface AlertModalProps {
4
+ isOpen: boolean;
5
+ onClose: () => void;
6
+ title: string;
7
+ message: string | React.ReactNode;
8
+ themeVariant?: AlertThemeVariant;
9
+ /** If true, the modal renders within a portal to the document body. Defaults to true. */
10
+ usePortal?: boolean;
11
+ }
12
+ export declare const AlertModal: React.FC<AlertModalProps>;
13
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ChartTheme } from '../../types/types';
2
+ export type AlertThemeVariant = ChartTheme;
3
+ interface ThemeProps {
4
+ $variant: AlertThemeVariant;
5
+ }
6
+ export declare const AlertOverlay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ThemeProps>> & string;
7
+ export declare const AlertContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ThemeProps>> & string;
8
+ export declare const AlertHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ThemeProps>> & string;
9
+ export declare const AlertTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, ThemeProps>> & string;
10
+ export declare const AlertBody: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ThemeProps>> & string;
11
+ export declare const AlertFooter: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ThemeProps>> & string;
12
+ export declare const AlertButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ThemeProps>> & string;
13
+ export {};
@@ -0,0 +1,3 @@
1
+ import { DeepRequired } from "../types/types";
2
+ import { ChartOptions } from "../types/chartOptions";
3
+ export declare const DEFAULT_GRAPH_OPTIONS: DeepRequired<ChartOptions>;
@@ -0,0 +1,37 @@
1
+ import { IDrawingShape } from './IDrawingShape';
2
+ import { ChartRenderContext } from '../../types/chartOptions';
3
+ import { PriceRange } from '../../types/Graph';
4
+ import { AngleShapeArgs, DrawingPoint, DrawingStyleOptions, FinalDrawingStyle } from '../../types/Drawings';
5
+ import { ShapeType } from './types';
6
+ export declare class AngleShape implements IDrawingShape {
7
+ args: AngleShapeArgs;
8
+ styleOptions: DrawingStyleOptions;
9
+ id: string;
10
+ type: ShapeType;
11
+ style: DrawingStyleOptions;
12
+ points: DrawingPoint[];
13
+ constructor(args: AngleShapeArgs, styleOptions: DrawingStyleOptions, id?: string | undefined);
14
+ /**
15
+ * Strokes only (legs + arc). Labels are drawn via {@link drawLabelOverlay} so they can render
16
+ * after other shapes and stay above crossing lines.
17
+ */
18
+ drawGeometry(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
19
+ /** Degree label + legible backing; call after all shape geometry (see drawDrawings). */
20
+ drawLabelOverlay(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
21
+ draw(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
22
+ isHit(px: number, py: number, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): boolean;
23
+ private angleArcParams;
24
+ private drawAngleArcOnly;
25
+ private drawAngleLabelOnly;
26
+ private isPointNearLine;
27
+ private calculateAngle;
28
+ addPoint(point: DrawingPoint): void;
29
+ /** After vertex + first ray are fixed (2 points), track the second ray endpoint. */
30
+ updateSecondRayEnd(point: DrawingPoint): void;
31
+ setPoints(points: DrawingPoint[]): void;
32
+ setPointAt(index: number, point: DrawingPoint): void;
33
+ getPoints(): DrawingPoint[];
34
+ setFirstPoint(point: DrawingPoint): void;
35
+ /** Phase 1: vertex (index 0) + first ray end (index 1), same behavior as a 2-point line. */
36
+ updateLastPoint(point: DrawingPoint): void;
37
+ }