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.
- package/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/branding/TickUpAttribution.d.ts +11 -0
- package/dist/branding/TickUpMark.d.ts +15 -0
- package/dist/branding/tickupBrandAssets.d.ts +12 -0
- package/dist/branding/tickupWatermark.d.ts +28 -0
- package/dist/components/Canvas/Axes/XAxis.d.ts +18 -0
- package/dist/components/Canvas/Axes/YAxis.d.ts +12 -0
- package/dist/components/Canvas/ChartCanvas.d.ts +40 -0
- package/dist/components/Canvas/ChartStage.d.ts +5 -0
- package/dist/components/Canvas/TickUpStage.d.ts +122 -0
- package/dist/components/Canvas/utils/GraphDraw.d.ts +13 -0
- package/dist/components/Canvas/utils/GraphHelpers.d.ts +60 -0
- package/dist/components/Canvas/utils/drawDrawings.d.ts +4 -0
- package/dist/components/Canvas/utils/drawOverlay.d.ts +44 -0
- package/dist/components/Canvas/utils/formatters.d.ts +34 -0
- package/dist/components/Canvas/utils/generateTicks.d.ts +9 -0
- package/dist/components/Canvas/utils/helpers.d.ts +6 -0
- package/dist/components/Common/AlertModal.d.ts +13 -0
- package/dist/components/Common/AlertModal.styles.d.ts +13 -0
- package/dist/components/DefaultData.d.ts +3 -0
- package/dist/components/Drawing/AngleShape.d.ts +37 -0
- package/dist/components/Drawing/ArrowShape.d.ts +32 -0
- package/dist/components/Drawing/CircleShape.d.ts +29 -0
- package/dist/components/Drawing/CustomSymbolShape.d.ts +31 -0
- package/dist/components/Drawing/IDrawingShape.d.ts +32 -0
- package/dist/components/Drawing/LineShape.d.ts +29 -0
- package/dist/components/Drawing/Polyline.d.ts +29 -0
- package/dist/components/Drawing/RectangleShape.d.ts +29 -0
- package/dist/components/Drawing/TriangleShape.d.ts +34 -0
- package/dist/components/Drawing/drawHelper.d.ts +35 -0
- package/dist/components/Drawing/drawingQuery.d.ts +44 -0
- package/dist/components/Drawing/types.d.ts +21 -0
- package/dist/components/SettingsModal/SettingsModal.d.ts +73 -0
- package/dist/components/SettingsModal/SettingsModal.styles.d.ts +62 -0
- package/dist/components/ShapePropertiesModal/ShapePropertiesModal.d.ts +13 -0
- package/dist/components/ShapePropertiesModal/applyShapeProperties.d.ts +16 -0
- package/dist/components/TickUpHost.d.ts +162 -0
- package/dist/components/TickUpProducts.d.ts +23 -0
- package/dist/components/Toolbar/Buttons.d.ts +4 -0
- package/dist/components/Toolbar/ChartTypeSelectDropdown.d.ts +9 -0
- package/dist/components/Toolbar/IntervalSelect.d.ts +15 -0
- package/dist/components/Toolbar/RangeSelector.d.ts +9 -0
- package/dist/components/Toolbar/SettingsToolbar.d.ts +50 -0
- package/dist/components/Toolbar/Toolbar.d.ts +10 -0
- package/dist/components/Toolbar/icons.d.ts +79 -0
- package/dist/components/Tooltip.d.ts +17 -0
- package/dist/contexts/ModeContext.d.ts +24 -0
- package/dist/engines/TickUpEngine.d.ts +12 -0
- package/dist/engines/prime/PrimeRenderer.d.ts +4 -0
- package/dist/engines/prime/TickUpPrime.d.ts +15 -0
- package/dist/full.d.ts +71 -0
- package/dist/hooks/useChartData.d.ts +15 -0
- package/dist/hooks/useElementSize.d.ts +13 -0
- package/dist/hooks/usePanAndZoom.d.ts +12 -0
- package/dist/index.d.ts +47 -0
- package/dist/main.d.ts +1 -0
- package/dist/services/FormattingService.d.ts +36 -0
- package/dist/styles/App.styles.d.ts +11 -0
- package/dist/styles/ChartCanvas.styles.d.ts +26 -0
- package/dist/styles/ChartTypeSelectDropdown.styles.d.ts +13 -0
- package/dist/styles/IntervalSelect.styles.d.ts +25 -0
- package/dist/styles/RangeSelector.styles.d.ts +10 -0
- package/dist/styles/SettingsToolbar.styles.d.ts +19 -0
- package/dist/styles/TickUpStage.styles.d.ts +31 -0
- package/dist/styles/Toolbar.styles.d.ts +12 -0
- package/dist/styles/Tooltip.styles.d.ts +22 -0
- package/dist/styles/XAxis.styles.d.ts +5 -0
- package/dist/styles/YAxis.styles.d.ts +6 -0
- package/dist/test-utils/assetUrlStub.d.ts +3 -0
- package/dist/test-utils/svgRawStub.d.ts +3 -0
- package/dist/tickup-full.cjs.js +1417 -0
- package/dist/tickup-full.es.js +6699 -0
- package/dist/tickup-icon.svg +5 -0
- package/dist/tickup.cjs.js +1417 -0
- package/dist/tickup.es.js +6427 -0
- package/dist/types/Drawings.d.ts +54 -0
- package/dist/types/Graph.d.ts +45 -0
- package/dist/types/Interval.d.ts +11 -0
- package/dist/types/buttons.d.ts +30 -0
- package/dist/types/chartContext.d.ts +52 -0
- package/dist/types/chartOptions.d.ts +161 -0
- package/dist/types/liveData.d.ts +14 -0
- package/dist/types/overlay.d.ts +64 -0
- package/dist/types/tickupProducts.d.ts +18 -0
- package/dist/types/types.d.ts +36 -0
- package/dist/utils/LocaleResolver.d.ts +15 -0
- package/dist/utils/captureChartRegion.d.ts +34 -0
- package/dist/utils/deepEqual.d.ts +1 -0
- package/dist/utils/deepMerge.d.ts +2 -0
- package/dist/utils/i18n.d.ts +26 -0
- package/dist/utils/liveDataMerge.d.ts +21 -0
- package/dist/utils/marketData.d.ts +8 -0
- package/dist/utils/timeUtils.d.ts +9 -0
- package/dist/vite.svg +1 -0
- package/documentation/01-glossary.md +61 -0
- package/documentation/01-introduction.md +7 -0
- package/documentation/02-installation.md +48 -0
- package/documentation/03-quick-start.md +86 -0
- package/documentation/04-products-and-layout.md +51 -0
- package/documentation/05-props-and-chart-options.md +109 -0
- package/documentation/06-imperative-api.md +117 -0
- package/documentation/07-data-and-live-updates.md +62 -0
- package/documentation/08-drawings-and-shapes.md +132 -0
- package/documentation/09-settings-modal.md +37 -0
- package/documentation/10-toolbar-and-interactions.md +85 -0
- package/documentation/11-exports-and-advanced.md +142 -0
- package/documentation/12-overlays-and-indicators.md +65 -0
- package/documentation/13-internationalization-and-axes.md +56 -0
- package/documentation/14-legal-and-policies.md +32 -0
- package/documentation/README.md +33 -0
- package/legal/ACCEPTABLE_USE_POLICY.md +79 -0
- package/legal/PRIVACY_POLICY.md +131 -0
- package/legal/README.md +21 -0
- package/legal/TERMS_OF_SERVICE.md +153 -0
- package/package.json +98 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IDrawingShape } from "./IDrawingShape";
|
|
2
|
+
import { ChartRenderContext } from "../../types/chartOptions";
|
|
3
|
+
import { PriceRange } from "../../types/Graph";
|
|
4
|
+
import { ArrowShapeArgs, DrawingPoint, DrawingStyleOptions, FinalDrawingStyle } from "../../types/Drawings";
|
|
5
|
+
import { ShapeType } from "./types";
|
|
6
|
+
export declare class ArrowShape implements IDrawingShape {
|
|
7
|
+
args: ArrowShapeArgs;
|
|
8
|
+
styleOverride: DrawingStyleOptions;
|
|
9
|
+
id: string;
|
|
10
|
+
type: ShapeType;
|
|
11
|
+
style: DrawingStyleOptions;
|
|
12
|
+
points: DrawingPoint[];
|
|
13
|
+
constructor(args: ArrowShapeArgs, styleOverride: DrawingStyleOptions, id?: string | undefined);
|
|
14
|
+
/**
|
|
15
|
+
* Draws the arrow shape on the canvas using a provided style.
|
|
16
|
+
* @param ctx The canvas 2D rendering context.
|
|
17
|
+
* @param renderContext The context containing canvas dimensions and visible ranges.
|
|
18
|
+
* @param visiblePriceRange The currently visible price range for price-axis scaling.
|
|
19
|
+
* @param style The final, calculated style object to apply.
|
|
20
|
+
*/
|
|
21
|
+
draw(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if a point (in pixel coordinates) is hitting the shape's line.
|
|
24
|
+
*/
|
|
25
|
+
isHit(px: number, py: number, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): boolean;
|
|
26
|
+
addPoint(point: DrawingPoint): void;
|
|
27
|
+
setPoints(points: DrawingPoint[]): void;
|
|
28
|
+
setPointAt(index: number, point: DrawingPoint): void;
|
|
29
|
+
getPoints(): DrawingPoint[];
|
|
30
|
+
setFirstPoint(point: DrawingPoint): void;
|
|
31
|
+
updateLastPoint(point: DrawingPoint): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IDrawingShape } from "./IDrawingShape";
|
|
2
|
+
import { ChartRenderContext } from "../../types/chartOptions";
|
|
3
|
+
import { PriceRange } from "../../types/Graph";
|
|
4
|
+
import { CircleShapeArgs, DrawingPoint, DrawingStyleOptions, FinalDrawingStyle } from "../../types/Drawings";
|
|
5
|
+
import { ShapeType } from "./types";
|
|
6
|
+
export declare class CircleShape implements IDrawingShape {
|
|
7
|
+
args: CircleShapeArgs;
|
|
8
|
+
styleOverride: DrawingStyleOptions;
|
|
9
|
+
id: string;
|
|
10
|
+
type: ShapeType;
|
|
11
|
+
style: DrawingStyleOptions;
|
|
12
|
+
points: DrawingPoint[];
|
|
13
|
+
constructor(args: CircleShapeArgs, styleOverride: DrawingStyleOptions, id?: string | undefined);
|
|
14
|
+
/**
|
|
15
|
+
* Draws the circle/ellipse shape on the canvas using a provided style.
|
|
16
|
+
* @param ctx The canvas 2D rendering context.
|
|
17
|
+
* @param renderContext The context containing canvas dimensions and visible ranges.
|
|
18
|
+
* @param visiblePriceRange The currently visible price range for price-axis scaling.
|
|
19
|
+
* @param style The final, calculated style object to apply.
|
|
20
|
+
*/
|
|
21
|
+
draw(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
|
|
22
|
+
isHit(px: number, py: number, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): boolean;
|
|
23
|
+
addPoint(point: DrawingPoint): void;
|
|
24
|
+
setPoints(points: DrawingPoint[]): void;
|
|
25
|
+
setPointAt(index: number, point: DrawingPoint): void;
|
|
26
|
+
getPoints(): DrawingPoint[];
|
|
27
|
+
setFirstPoint(point: DrawingPoint): void;
|
|
28
|
+
updateLastPoint(point: DrawingPoint): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IDrawingShape } from "./IDrawingShape";
|
|
2
|
+
import { ChartRenderContext } from "../../types/chartOptions";
|
|
3
|
+
import { PriceRange } from "../../types/Graph";
|
|
4
|
+
import { CustomSymbolShapeArgs, DrawingPoint, DrawingStyleOptions, FinalDrawingStyle } from "../../types/Drawings";
|
|
5
|
+
import { ShapeType } from "./types";
|
|
6
|
+
export declare class CustomSymbolShape implements IDrawingShape {
|
|
7
|
+
args: CustomSymbolShapeArgs;
|
|
8
|
+
styleOverride: DrawingStyleOptions;
|
|
9
|
+
id: string;
|
|
10
|
+
type: ShapeType;
|
|
11
|
+
style: DrawingStyleOptions;
|
|
12
|
+
points: DrawingPoint[];
|
|
13
|
+
symbol: string;
|
|
14
|
+
size: number;
|
|
15
|
+
constructor(args: CustomSymbolShapeArgs, styleOverride: DrawingStyleOptions, id?: string | undefined);
|
|
16
|
+
/**
|
|
17
|
+
* Draws the symbol on the canvas using a provided style.
|
|
18
|
+
* @param ctx The canvas 2D rendering context.
|
|
19
|
+
* @param renderContext The context containing canvas dimensions and visible ranges.
|
|
20
|
+
* @param visiblePriceRange The currently visible price range for price-axis scaling.
|
|
21
|
+
* @param style The final, calculated style object to apply.
|
|
22
|
+
*/
|
|
23
|
+
draw(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
|
|
24
|
+
isHit(px: number, py: number, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): boolean;
|
|
25
|
+
addPoint(point: DrawingPoint): void;
|
|
26
|
+
setPoints(points: DrawingPoint[]): void;
|
|
27
|
+
setPointAt(index: number, point: DrawingPoint): void;
|
|
28
|
+
getPoints(): DrawingPoint[];
|
|
29
|
+
setFirstPoint(point: DrawingPoint): void;
|
|
30
|
+
updateLastPoint(point: DrawingPoint): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ChartRenderContext } from "../../types/chartOptions";
|
|
2
|
+
import { PriceRange } from "../../types/Graph";
|
|
3
|
+
import { DrawingPoint, DrawingStyleOptions, FinalDrawingStyle } from "../../types/Drawings";
|
|
4
|
+
import { ShapeType } from "./types";
|
|
5
|
+
export interface IDrawingShape {
|
|
6
|
+
id: string;
|
|
7
|
+
type: ShapeType;
|
|
8
|
+
style: DrawingStyleOptions;
|
|
9
|
+
points: DrawingPoint[];
|
|
10
|
+
/**
|
|
11
|
+
* Draws the shape on the canvas.
|
|
12
|
+
* @param ctx
|
|
13
|
+
* @param renderContext
|
|
14
|
+
* @param visiblePriceRange
|
|
15
|
+
* @param style The final, calculated style object to use for drawing.
|
|
16
|
+
*/
|
|
17
|
+
draw(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a point (in pixel coordinates) is hitting the shape.
|
|
20
|
+
*/
|
|
21
|
+
isHit(px: number, py: number, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): boolean;
|
|
22
|
+
setPoints(points: DrawingPoint[]): void;
|
|
23
|
+
setPointAt(index: number, point: DrawingPoint): void;
|
|
24
|
+
setFirstPoint(point: DrawingPoint): void;
|
|
25
|
+
addPoint(point: DrawingPoint): void;
|
|
26
|
+
updateLastPoint(point: DrawingPoint): void;
|
|
27
|
+
getPoints(): DrawingPoint[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Helper to generate a unique id string for drawing shapes.
|
|
31
|
+
*/
|
|
32
|
+
export declare function generateDrawingShapeId(): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IDrawingShape } from "./IDrawingShape";
|
|
2
|
+
import { ChartRenderContext } from "../../types/chartOptions";
|
|
3
|
+
import { PriceRange } from "../../types/Graph";
|
|
4
|
+
import { DrawingPoint, DrawingStyleOptions, FinalDrawingStyle, LineShapeArgs } from "../../types/Drawings";
|
|
5
|
+
import { ShapeType } from "./types";
|
|
6
|
+
export declare class LineShape implements IDrawingShape {
|
|
7
|
+
args: LineShapeArgs;
|
|
8
|
+
styleOverride: DrawingStyleOptions;
|
|
9
|
+
id: string;
|
|
10
|
+
type: ShapeType;
|
|
11
|
+
style: DrawingStyleOptions;
|
|
12
|
+
points: DrawingPoint[];
|
|
13
|
+
constructor(args: LineShapeArgs, styleOverride: DrawingStyleOptions, id?: string | undefined);
|
|
14
|
+
/**
|
|
15
|
+
* Draws the line shape on the canvas using a provided style.
|
|
16
|
+
* @param ctx The canvas 2D rendering context.
|
|
17
|
+
* @param renderContext The context containing canvas dimensions and visible ranges.
|
|
18
|
+
* @param visiblePriceRange The currently visible price range for price-axis scaling.
|
|
19
|
+
* @param style The final, calculated style object to apply.
|
|
20
|
+
*/
|
|
21
|
+
draw(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
|
|
22
|
+
isHit(px: number, py: number, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): boolean;
|
|
23
|
+
setPoints(points: DrawingPoint[]): void;
|
|
24
|
+
addPoint(point: DrawingPoint): void;
|
|
25
|
+
setPointAt(index: number, point: DrawingPoint): void;
|
|
26
|
+
getPoints(): DrawingPoint[];
|
|
27
|
+
updateLastPoint(point: DrawingPoint): void;
|
|
28
|
+
setFirstPoint(point: DrawingPoint): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IDrawingShape } from "./IDrawingShape";
|
|
2
|
+
import { ChartRenderContext } from "../../types/chartOptions";
|
|
3
|
+
import { PriceRange } from "../../types/Graph";
|
|
4
|
+
import { DrawingPoint, DrawingStyleOptions, FinalDrawingStyle, PolylineShapeArgs } from "../../types/Drawings";
|
|
5
|
+
import { ShapeType } from "./types";
|
|
6
|
+
export declare class Polyline implements IDrawingShape {
|
|
7
|
+
styleOverride: DrawingStyleOptions;
|
|
8
|
+
id: string;
|
|
9
|
+
type: ShapeType;
|
|
10
|
+
style: DrawingStyleOptions;
|
|
11
|
+
points: DrawingPoint[];
|
|
12
|
+
args: PolylineShapeArgs;
|
|
13
|
+
constructor(argsIn: PolylineShapeArgs, styleOverride: DrawingStyleOptions, id?: string | undefined);
|
|
14
|
+
addPoint(point: DrawingPoint): void;
|
|
15
|
+
/**
|
|
16
|
+
* Draws the polyline/polygon shape on the canvas using a provided style.
|
|
17
|
+
* @param ctx The canvas 2D rendering context.
|
|
18
|
+
* @param renderContext The context containing canvas dimensions and visible ranges.
|
|
19
|
+
* @param visiblePriceRange The currently visible price range for price-axis scaling.
|
|
20
|
+
* @param style The final, calculated style object to apply.
|
|
21
|
+
*/
|
|
22
|
+
draw(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
|
|
23
|
+
isHit(px: number, py: number, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): boolean;
|
|
24
|
+
setPoints(points: DrawingPoint[]): void;
|
|
25
|
+
setPointAt(index: number, point: DrawingPoint): void;
|
|
26
|
+
getPoints(): DrawingPoint[];
|
|
27
|
+
setFirstPoint(point: DrawingPoint): void;
|
|
28
|
+
updateLastPoint(point: DrawingPoint): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IDrawingShape } from "./IDrawingShape";
|
|
2
|
+
import { ChartRenderContext } from "../../types/chartOptions";
|
|
3
|
+
import { PriceRange } from "../../types/Graph";
|
|
4
|
+
import { DrawingPoint, DrawingStyleOptions, FinalDrawingStyle, RectangleShapeArgs } from "../../types/Drawings";
|
|
5
|
+
import { ShapeType } from "./types";
|
|
6
|
+
export declare class RectangleShape implements IDrawingShape {
|
|
7
|
+
args: RectangleShapeArgs;
|
|
8
|
+
styleOverride: DrawingStyleOptions;
|
|
9
|
+
id: string;
|
|
10
|
+
type: ShapeType;
|
|
11
|
+
style: DrawingStyleOptions;
|
|
12
|
+
points: DrawingPoint[];
|
|
13
|
+
constructor(args: RectangleShapeArgs, styleOverride: DrawingStyleOptions, id?: string | undefined);
|
|
14
|
+
/**
|
|
15
|
+
* Draws the rectangle shape on the canvas using a provided style.
|
|
16
|
+
* @param ctx The canvas 2D rendering context.
|
|
17
|
+
* @param renderContext The context containing canvas dimensions and visible ranges.
|
|
18
|
+
* @param visiblePriceRange The currently visible price range for price-axis scaling.
|
|
19
|
+
* @param style The final, calculated style object to apply.
|
|
20
|
+
*/
|
|
21
|
+
draw(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
|
|
22
|
+
isHit(px: number, py: number, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): boolean;
|
|
23
|
+
addPoint(point: DrawingPoint): void;
|
|
24
|
+
setPoints(points: DrawingPoint[]): void;
|
|
25
|
+
setPointAt(index: number, point: DrawingPoint): void;
|
|
26
|
+
getPoints(): DrawingPoint[];
|
|
27
|
+
setFirstPoint(point: DrawingPoint): void;
|
|
28
|
+
updateLastPoint(point: DrawingPoint): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IDrawingShape } from "./IDrawingShape";
|
|
2
|
+
import { ChartRenderContext } from "../../types/chartOptions";
|
|
3
|
+
import { PriceRange } from "../../types/Graph";
|
|
4
|
+
import { DrawingPoint, DrawingStyleOptions, FinalDrawingStyle, TriangleShapeArgs } from "../../types/Drawings";
|
|
5
|
+
import { ShapeType } from "./types";
|
|
6
|
+
export declare class TriangleShape implements IDrawingShape {
|
|
7
|
+
styleOverride: DrawingStyleOptions;
|
|
8
|
+
id: string;
|
|
9
|
+
type: ShapeType;
|
|
10
|
+
style: DrawingStyleOptions;
|
|
11
|
+
points: DrawingPoint[];
|
|
12
|
+
args: TriangleShapeArgs;
|
|
13
|
+
constructor(argsIn: TriangleShapeArgs, styleOverride: DrawingStyleOptions, id?: string | undefined);
|
|
14
|
+
/**
|
|
15
|
+
* Draws the triangle shape on the canvas using a provided style.
|
|
16
|
+
* @param ctx The canvas 2D rendering context.
|
|
17
|
+
* @param renderContext The context containing canvas dimensions and visible ranges.
|
|
18
|
+
* @param visiblePriceRange The currently visible price range for price-axis scaling.
|
|
19
|
+
* @param style The final, calculated style object to apply.
|
|
20
|
+
*/
|
|
21
|
+
draw(ctx: CanvasRenderingContext2D, renderContext: ChartRenderContext, visiblePriceRange: PriceRange, style: FinalDrawingStyle): void;
|
|
22
|
+
isHit(px: number, py: number, renderContext: ChartRenderContext, visiblePriceRange: PriceRange): boolean;
|
|
23
|
+
/** Visible time span (sec) and price range — set from chart before dragging so the third vertex is not collinear with the base. */
|
|
24
|
+
private normTimeSpan;
|
|
25
|
+
private normPriceSpan;
|
|
26
|
+
setNormalizationSpans(visibleTimeSec: number, priceRange: number): void;
|
|
27
|
+
recalculateThirdVertex(): void;
|
|
28
|
+
addPoint(point: DrawingPoint): void;
|
|
29
|
+
setPoints(points: DrawingPoint[]): void;
|
|
30
|
+
setPointAt(index: number, point: DrawingPoint): void;
|
|
31
|
+
getPoints(): DrawingPoint[];
|
|
32
|
+
setFirstPoint(point: DrawingPoint): void;
|
|
33
|
+
updateLastPoint(point: DrawingPoint): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CanvasPoint, DrawingPoint, DrawingStyleOptions } from "../../types/Drawings";
|
|
2
|
+
import { Drawing, ShapeType } from "./types";
|
|
3
|
+
import { IDrawingShape } from "./IDrawingShape";
|
|
4
|
+
import { DeepPartial, DeepRequired } from "../../types/types";
|
|
5
|
+
import { ChartOptions } from "../../types/chartOptions";
|
|
6
|
+
export declare const pointerTolerance = 5;
|
|
7
|
+
export declare function pointInTriangle(px: number, py: number, a: CanvasPoint, b: CanvasPoint, c: CanvasPoint): boolean;
|
|
8
|
+
export declare function createShape(newDraw: Drawing): IDrawingShape;
|
|
9
|
+
/** Plain-object description for creating drawings from host code (see {@link drawingFromSpec}). */
|
|
10
|
+
export type DrawingSpec = {
|
|
11
|
+
id?: string;
|
|
12
|
+
type: ShapeType;
|
|
13
|
+
points: DrawingPoint[];
|
|
14
|
+
style?: DeepPartial<DrawingStyleOptions>;
|
|
15
|
+
symbol?: string;
|
|
16
|
+
size?: number;
|
|
17
|
+
};
|
|
18
|
+
/** Partial update applied in-place to an existing drawing (geometry, style, or custom symbol fields). */
|
|
19
|
+
export type DrawingPatch = {
|
|
20
|
+
style?: DeepPartial<DrawingStyleOptions>;
|
|
21
|
+
points?: DrawingPoint[];
|
|
22
|
+
symbol?: string;
|
|
23
|
+
size?: number;
|
|
24
|
+
};
|
|
25
|
+
export type DrawingInput = IDrawingShape | DrawingSpec;
|
|
26
|
+
/**
|
|
27
|
+
* Builds a drawing class instance from a plain spec (type + points + optional style).
|
|
28
|
+
* Use with {@link TickUpStageHandle.addShape} / {@link TickUpHostHandle.addShape} or {@link setDrawingsFromSpecs}.
|
|
29
|
+
*/
|
|
30
|
+
export declare function drawingFromSpec(spec: DrawingSpec, chartOptions: DeepRequired<ChartOptions>): IDrawingShape | null;
|
|
31
|
+
/** True when the payload should be treated as a partial patch (not a full replacement spec). */
|
|
32
|
+
export declare function isDrawingPatch(data: unknown): data is DrawingPatch;
|
|
33
|
+
/** Mutates {@code shape} in place: merges style, replaces points (and args) where needed, updates custom symbol fields. */
|
|
34
|
+
export declare function applyDrawingPatch(shape: IDrawingShape, patch: DrawingPatch): void;
|
|
35
|
+
export declare function validateAndNormalizeShape(shape: any, chartOptions: DeepRequired<ChartOptions>): IDrawingShape | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DrawingPoint, DrawingStyleOptions } from '../../types/Drawings';
|
|
2
|
+
import type { IDrawingShape } from './IDrawingShape';
|
|
3
|
+
import { ShapeType } from './types';
|
|
4
|
+
/** Plain, JSON-friendly view of a drawing (ids, geometry, style) for querying and persistence. */
|
|
5
|
+
export type DrawingSnapshot = {
|
|
6
|
+
id: string;
|
|
7
|
+
type: ShapeType;
|
|
8
|
+
points: DrawingPoint[];
|
|
9
|
+
style: DrawingStyleOptions;
|
|
10
|
+
/** Order in the draw stack (0 = drawn first / underneath). */
|
|
11
|
+
zIndex: number;
|
|
12
|
+
symbol?: string;
|
|
13
|
+
size?: number;
|
|
14
|
+
};
|
|
15
|
+
/** Criteria for {@link queryDrawingsToSnapshots} / {@link filterDrawingsWithMeta}. All set filters are AND-combined. */
|
|
16
|
+
export type DrawingQuery = {
|
|
17
|
+
types?: ShapeType[];
|
|
18
|
+
ids?: string[];
|
|
19
|
+
idPrefix?: string;
|
|
20
|
+
/** Any point must fall in the time window (unix seconds) when bounds are set. */
|
|
21
|
+
timeMin?: number;
|
|
22
|
+
timeMax?: number;
|
|
23
|
+
/** Any point must fall in the price window when bounds are set. */
|
|
24
|
+
priceMin?: number;
|
|
25
|
+
priceMax?: number;
|
|
26
|
+
/**
|
|
27
|
+
* When true, every point must satisfy time/price bounds (when those bounds are set).
|
|
28
|
+
* When false (default), at least one point must satisfy all active bounds.
|
|
29
|
+
*/
|
|
30
|
+
strictBounds?: boolean;
|
|
31
|
+
predicate?: (shape: IDrawingShape, zIndex: number) => boolean;
|
|
32
|
+
};
|
|
33
|
+
export type DrawingWithZIndex = {
|
|
34
|
+
shape: IDrawingShape;
|
|
35
|
+
zIndex: number;
|
|
36
|
+
};
|
|
37
|
+
export declare function shapeToSnapshot(shape: IDrawingShape, zIndex: number): DrawingSnapshot;
|
|
38
|
+
/**
|
|
39
|
+
* Returns drawings that match {@link DrawingQuery}, preserving stack order.
|
|
40
|
+
*/
|
|
41
|
+
export declare function filterDrawingsWithMeta(drawings: IDrawingShape[], query?: DrawingQuery): DrawingWithZIndex[];
|
|
42
|
+
export declare function queryDrawingsToSnapshots(drawings: IDrawingShape[], query?: DrawingQuery): DrawingSnapshot[];
|
|
43
|
+
/** Filtered live instances (same references as in chart state). Use for imperative updates after locating an id. */
|
|
44
|
+
export declare function filterDrawingInstances(drawings: IDrawingShape[], query?: DrawingQuery): IDrawingShape[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Mode } from "../../contexts/ModeContext";
|
|
2
|
+
import { AngleShapeArgs, ArrowShapeArgs, CircleShapeArgs, CustomSymbolShapeArgs, DrawingPoint, DrawingStyleOptions, LineShapeArgs, PolylineShapeArgs, RectangleShapeArgs, TriangleShapeArgs } from "../../types/Drawings";
|
|
3
|
+
export type ShapeBaseArgs = {
|
|
4
|
+
points: DrawingPoint[];
|
|
5
|
+
};
|
|
6
|
+
export type ShapeArgs = LineShapeArgs | RectangleShapeArgs | CircleShapeArgs | TriangleShapeArgs | AngleShapeArgs | PolylineShapeArgs | ArrowShapeArgs | CustomSymbolShapeArgs;
|
|
7
|
+
export type Drawing = {
|
|
8
|
+
mode: Mode;
|
|
9
|
+
args?: ShapeArgs;
|
|
10
|
+
style?: DrawingStyleOptions;
|
|
11
|
+
};
|
|
12
|
+
export declare enum ShapeType {
|
|
13
|
+
Line = "Line",
|
|
14
|
+
Rectangle = "Rectangle",
|
|
15
|
+
Circle = "Circle",
|
|
16
|
+
Triangle = "Triangle",
|
|
17
|
+
Angle = "Angle",
|
|
18
|
+
Arrow = "Arrow",
|
|
19
|
+
Polyline = "Polyline",
|
|
20
|
+
CustomSymbol = "CustomSymbol"
|
|
21
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ModalThemeVariant } from './SettingsModal.styles';
|
|
3
|
+
import { AxesPosition } from '../../types/types';
|
|
4
|
+
import { AxesUnitPlacement, CurrencyDisplay, NumberNotation } from '../../types/chartOptions';
|
|
5
|
+
import { StrokeLineStyle } from '../../types/overlay';
|
|
6
|
+
export declare enum SettingsCategoryId {
|
|
7
|
+
chart = "chart",
|
|
8
|
+
axes = "axes",
|
|
9
|
+
time = "time",
|
|
10
|
+
layout = "layout",
|
|
11
|
+
colors = "colors",
|
|
12
|
+
drawings = "drawings",
|
|
13
|
+
globalization = "globalization",
|
|
14
|
+
financial = "financial"
|
|
15
|
+
}
|
|
16
|
+
export interface SettingsState {
|
|
17
|
+
showSidebar: boolean;
|
|
18
|
+
showTopBar: boolean;
|
|
19
|
+
showHistogram: boolean;
|
|
20
|
+
showGrid: boolean;
|
|
21
|
+
timeFormat12h: boolean;
|
|
22
|
+
yAxisPosition: AxesPosition;
|
|
23
|
+
numberOfYTicks: number;
|
|
24
|
+
backgroundColor: string;
|
|
25
|
+
textColor: string;
|
|
26
|
+
bullColor: string;
|
|
27
|
+
bearColor: string;
|
|
28
|
+
lineColor: string;
|
|
29
|
+
fractionDigits: number;
|
|
30
|
+
decimalSeparator: string;
|
|
31
|
+
thousandsSeparator: string;
|
|
32
|
+
dateFormat: string;
|
|
33
|
+
locale: string;
|
|
34
|
+
language: string;
|
|
35
|
+
currency: string;
|
|
36
|
+
useCurrency: boolean;
|
|
37
|
+
currencyDisplay: CurrencyDisplay;
|
|
38
|
+
numberNotation: NumberNotation;
|
|
39
|
+
minimumFractionDigits: number;
|
|
40
|
+
maximumFractionDigits: number;
|
|
41
|
+
maximumSignificantDigits: number;
|
|
42
|
+
tickSize: number;
|
|
43
|
+
autoPrecision: boolean;
|
|
44
|
+
unit: string;
|
|
45
|
+
unitPlacement: AxesUnitPlacement;
|
|
46
|
+
drawingLineColor: string;
|
|
47
|
+
drawingLineWidth: number;
|
|
48
|
+
drawingLineStyle: StrokeLineStyle;
|
|
49
|
+
drawingFillColor: string;
|
|
50
|
+
drawingSelectedLineColor: string;
|
|
51
|
+
drawingSelectedLineStyle: StrokeLineStyle;
|
|
52
|
+
drawingSelectedLineWidthAdd: number;
|
|
53
|
+
showCandleTooltip: boolean;
|
|
54
|
+
showCrosshair: boolean;
|
|
55
|
+
showCrosshairValues: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface SettingsModalProps {
|
|
58
|
+
isOpen: boolean;
|
|
59
|
+
onClose: () => void;
|
|
60
|
+
onSave: (newSettings: SettingsState) => void;
|
|
61
|
+
initialSettings: SettingsState;
|
|
62
|
+
/** Matches chart app light/dark toggle */
|
|
63
|
+
themeVariant?: ModalThemeVariant;
|
|
64
|
+
/** When true, the Layout category (toolbar toggles) is hidden; toolbar chrome is product-controlled. */
|
|
65
|
+
lockToolbarLayout?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* When true, the overlay is `position: absolute` within the nearest positioned ancestor
|
|
68
|
+
* (e.g. the chart host wrapper) instead of covering the full viewport.
|
|
69
|
+
*/
|
|
70
|
+
contained?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare const SettingsModal: React.FC<SettingsModalProps>;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ChartTheme } from '../../types/types';
|
|
2
|
+
/** Pass from app theme (e.g. TickUpHost `themeVariant`). */
|
|
3
|
+
export type ModalThemeVariant = ChartTheme;
|
|
4
|
+
/** Header icon buttons (back / close). */
|
|
5
|
+
export declare enum SettingsModalIconRole {
|
|
6
|
+
back = "back",
|
|
7
|
+
close = "close"
|
|
8
|
+
}
|
|
9
|
+
export declare const ModalOverlay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
10
|
+
$variant?: ModalThemeVariant;
|
|
11
|
+
$contained?: boolean;
|
|
12
|
+
}>> & string;
|
|
13
|
+
export declare const ModalContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
14
|
+
$variant?: ModalThemeVariant;
|
|
15
|
+
}>> & string;
|
|
16
|
+
export declare const ModalHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
17
|
+
$variant?: ModalThemeVariant;
|
|
18
|
+
}>> & string;
|
|
19
|
+
export declare const HeaderLeft: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
20
|
+
export declare const IconButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
21
|
+
$variant?: SettingsModalIconRole;
|
|
22
|
+
$theme?: ModalThemeVariant;
|
|
23
|
+
}>> & string;
|
|
24
|
+
export declare const BackArrowIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
25
|
+
export declare const ModalBody: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
26
|
+
export declare const CategoryTile: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
27
|
+
$variant?: ModalThemeVariant;
|
|
28
|
+
}>> & string;
|
|
29
|
+
export declare const SubMenuPane: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
30
|
+
$back?: boolean;
|
|
31
|
+
}>> & string;
|
|
32
|
+
export declare const FormRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
33
|
+
$variant?: ModalThemeVariant;
|
|
34
|
+
}>> & string;
|
|
35
|
+
export declare const FormLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {
|
|
36
|
+
$variant?: ModalThemeVariant;
|
|
37
|
+
}>> & string;
|
|
38
|
+
export declare const ModalFooter: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
39
|
+
$variant?: ModalThemeVariant;
|
|
40
|
+
}>> & string;
|
|
41
|
+
export declare const ModalButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
42
|
+
$primary?: boolean;
|
|
43
|
+
$variant?: ModalThemeVariant;
|
|
44
|
+
}>> & string;
|
|
45
|
+
export declare const SwitchToggle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
46
|
+
$checked: boolean;
|
|
47
|
+
$disabled?: boolean;
|
|
48
|
+
}>> & string;
|
|
49
|
+
export declare const NumberInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {
|
|
50
|
+
$variant?: ModalThemeVariant;
|
|
51
|
+
}>> & string;
|
|
52
|
+
export declare const ColorInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
|
|
53
|
+
export declare const SelectDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, {
|
|
54
|
+
$variant?: ModalThemeVariant;
|
|
55
|
+
}>> & string;
|
|
56
|
+
export declare const SectionTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
|
|
57
|
+
$variant?: ModalThemeVariant;
|
|
58
|
+
}>> & string;
|
|
59
|
+
/** Themed text field (e.g. rgba / hex fill colors) */
|
|
60
|
+
export declare const ModalTextInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {
|
|
61
|
+
$variant?: ModalThemeVariant;
|
|
62
|
+
}>> & string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ModalThemeVariant } from '../SettingsModal/SettingsModal.styles';
|
|
3
|
+
import { IDrawingShape } from '../Drawing/IDrawingShape';
|
|
4
|
+
import { type ShapePropertiesFormState } from './applyShapeProperties';
|
|
5
|
+
export interface ShapePropertiesModalProps {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
/** Drawing under edit; modal reads initial fields when opened */
|
|
9
|
+
shape: IDrawingShape | null;
|
|
10
|
+
onApply: (shape: IDrawingShape, form: ShapePropertiesFormState) => void;
|
|
11
|
+
themeVariant?: ModalThemeVariant;
|
|
12
|
+
}
|
|
13
|
+
export declare const ShapePropertiesModal: React.FC<ShapePropertiesModalProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IDrawingShape } from '../Drawing/IDrawingShape';
|
|
2
|
+
import { StrokeLineStyle } from '../../types/overlay';
|
|
3
|
+
export type ShapePropertiesFormState = {
|
|
4
|
+
lineColor: string;
|
|
5
|
+
lineWidth: number;
|
|
6
|
+
lineStyle: StrokeLineStyle;
|
|
7
|
+
fillColor: string;
|
|
8
|
+
selectedLineColor: string;
|
|
9
|
+
selectedLineWidthAdd: number;
|
|
10
|
+
selectedLineStyle: StrokeLineStyle;
|
|
11
|
+
selectedFillColor: string;
|
|
12
|
+
symbolText: string;
|
|
13
|
+
symbolSize: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function shapeToFormState(shape: IDrawingShape): ShapePropertiesFormState;
|
|
16
|
+
export declare function applyShapePropertiesForm(shape: IDrawingShape, f: ShapePropertiesFormState): void;
|