hyperprop-charting-library 0.1.133 → 0.1.135
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/dist/hyperprop-charting-library.cjs +1690 -1479
- package/dist/hyperprop-charting-library.d.ts +82 -64
- package/dist/hyperprop-charting-library.js +1689 -1480
- package/dist/index.cjs +1690 -1479
- package/dist/index.d.cts +82 -64
- package/dist/index.d.ts +82 -64
- package/dist/index.js +1689 -1480
- package/docs/API.md +18 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -90,7 +90,15 @@ interface ChartOptions {
|
|
|
90
90
|
drawings?: DrawingObjectOptions[];
|
|
91
91
|
}
|
|
92
92
|
type IndicatorPane = "overlay" | "separate";
|
|
93
|
-
type DrawingToolType = "horizontal-line" | "vertical-line" | "trendline" | "ray" | "fib-retracement" | "fib-extension" | "long-position" | "short-position" | "price-range" | "rectangle" | "text" | "note"
|
|
93
|
+
type DrawingToolType = "horizontal-line" | "vertical-line" | "trendline" | "ray" | "fib-retracement" | "fib-extension" | "long-position" | "short-position" | "price-range" | "rectangle" | "text" | "note"
|
|
94
|
+
/**
|
|
95
|
+
* TradingView-style ruler. Unlike every other tool it is transient: the
|
|
96
|
+
* measurement overlay is never added to the drawings list (no
|
|
97
|
+
* `onDrawingsChange`), and it clears on the next click, on Escape, or when
|
|
98
|
+
* the tool changes. Also reachable without arming the tool via Shift+drag
|
|
99
|
+
* on the plot.
|
|
100
|
+
*/
|
|
101
|
+
| "measure";
|
|
94
102
|
interface DrawingPoint {
|
|
95
103
|
index: number;
|
|
96
104
|
price: number;
|
|
@@ -501,69 +509,6 @@ interface LabelsOptions {
|
|
|
501
509
|
labelHeight?: number;
|
|
502
510
|
labelPaddingX?: number;
|
|
503
511
|
}
|
|
504
|
-
interface ScriptIndicatorInputDef {
|
|
505
|
-
key: string;
|
|
506
|
-
label?: string;
|
|
507
|
-
type?: "number" | "color" | "boolean" | "select" | "string";
|
|
508
|
-
default: unknown;
|
|
509
|
-
min?: number;
|
|
510
|
-
max?: number;
|
|
511
|
-
step?: number;
|
|
512
|
-
options?: Array<{
|
|
513
|
-
value: string;
|
|
514
|
-
label: string;
|
|
515
|
-
}>;
|
|
516
|
-
}
|
|
517
|
-
interface ScriptIndicatorDefinition {
|
|
518
|
-
/** Unique indicator id, e.g. "script:my-rsi". */
|
|
519
|
-
id: string;
|
|
520
|
-
name: string;
|
|
521
|
-
/** Defaults to "separate". */
|
|
522
|
-
pane?: IndicatorPane;
|
|
523
|
-
paneHeightRatio?: number;
|
|
524
|
-
inputs?: ScriptIndicatorInputDef[];
|
|
525
|
-
/**
|
|
526
|
-
* JavaScript source that must define `function compute(bars, inputs, hp)`.
|
|
527
|
-
* `bars` is an array of `{ time, o, h, l, c, v }`, `inputs` the resolved
|
|
528
|
-
* input values, and `hp` a bundle of TA helpers (sma, ema, rma, highest,
|
|
529
|
-
* lowest, change, stdev, atr). It must return `{ plots: [...] }`.
|
|
530
|
-
*/
|
|
531
|
-
source: string;
|
|
532
|
-
}
|
|
533
|
-
interface ScriptPlotSpec {
|
|
534
|
-
title?: string;
|
|
535
|
-
values: Array<number | null>;
|
|
536
|
-
color?: string;
|
|
537
|
-
width?: number;
|
|
538
|
-
style?: "line" | "histogram";
|
|
539
|
-
negativeColor?: string;
|
|
540
|
-
}
|
|
541
|
-
interface ScriptComputeResult {
|
|
542
|
-
plots: ScriptPlotSpec[];
|
|
543
|
-
range?: {
|
|
544
|
-
min?: number;
|
|
545
|
-
max?: number;
|
|
546
|
-
};
|
|
547
|
-
guides?: number[];
|
|
548
|
-
decimals?: number;
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Compile-check a script without registering it: returns an error message, or
|
|
552
|
-
* `null` when the script compiles. Runs with the same execution guard as the
|
|
553
|
-
* chart, so a top-level infinite loop returns a budget error instead of
|
|
554
|
-
* hanging the caller (e.g. an editor's save validation).
|
|
555
|
-
*/
|
|
556
|
-
declare const validateScriptSource: (source: string) => string | null;
|
|
557
|
-
/**
|
|
558
|
-
* Compile a user-authored script into a regular indicator plugin. The plugin
|
|
559
|
-
* can then be registered with `chart.registerIndicator(...)` and behaves like
|
|
560
|
-
* a built-in: separate panes get the shared grid, legends, value lines,
|
|
561
|
-
* drag-resize and hover controls; overlays autoscale with price.
|
|
562
|
-
*
|
|
563
|
-
* Compile/runtime errors never throw during rendering; they render as an
|
|
564
|
-
* inline error message in the pane instead.
|
|
565
|
-
*/
|
|
566
|
-
declare const compileScriptIndicator: (definition: ScriptIndicatorDefinition) => IndicatorPlugin;
|
|
567
512
|
interface ChartInstance {
|
|
568
513
|
updateOptions: (options: ChartOptions) => void;
|
|
569
514
|
/** Switch the main series rendering style (candles, bars, line, ...). */
|
|
@@ -615,6 +560,14 @@ interface ChartInstance {
|
|
|
615
560
|
removeDrawing: (id: string) => void;
|
|
616
561
|
clearDrawings: () => void;
|
|
617
562
|
onDrawingsChange: (handler: ((drawings: DrawingObjectOptions[]) => void) | null) => void;
|
|
563
|
+
/**
|
|
564
|
+
* Fires whenever the active drawing tool changes — including when the chart
|
|
565
|
+
* auto-reverts to the cursor after a tool completes (every drawing tool does
|
|
566
|
+
* this once its shape is placed; the transient `measure` tool does it after
|
|
567
|
+
* every measurement). Lets host toolbars stay in sync without polling
|
|
568
|
+
* `getActiveDrawingTool()`.
|
|
569
|
+
*/
|
|
570
|
+
onActiveDrawingToolChange: (handler: ((tool: DrawingToolType | null) => void) | null) => void;
|
|
618
571
|
onDrawingSelect: (handler: ((event: DrawingSelectEvent) => void) | null) => void;
|
|
619
572
|
onDrawingDoubleClick: (handler: ((event: DrawingSelectEvent) => void) | null) => void;
|
|
620
573
|
onDrawingEditText: (handler: ((event: DrawingSelectEvent) => void) | null) => void;
|
|
@@ -658,6 +611,71 @@ interface ViewportState {
|
|
|
658
611
|
/** Manual Y-axis max override (null = auto-scale). */
|
|
659
612
|
yMax: number | null;
|
|
660
613
|
}
|
|
614
|
+
|
|
615
|
+
interface ScriptIndicatorInputDef {
|
|
616
|
+
key: string;
|
|
617
|
+
label?: string;
|
|
618
|
+
type?: "number" | "color" | "boolean" | "select" | "string";
|
|
619
|
+
default: unknown;
|
|
620
|
+
min?: number;
|
|
621
|
+
max?: number;
|
|
622
|
+
step?: number;
|
|
623
|
+
options?: Array<{
|
|
624
|
+
value: string;
|
|
625
|
+
label: string;
|
|
626
|
+
}>;
|
|
627
|
+
}
|
|
628
|
+
interface ScriptIndicatorDefinition {
|
|
629
|
+
/** Unique indicator id, e.g. "script:my-rsi". */
|
|
630
|
+
id: string;
|
|
631
|
+
name: string;
|
|
632
|
+
/** Defaults to "separate". */
|
|
633
|
+
pane?: IndicatorPane;
|
|
634
|
+
paneHeightRatio?: number;
|
|
635
|
+
inputs?: ScriptIndicatorInputDef[];
|
|
636
|
+
/**
|
|
637
|
+
* JavaScript source that must define `function compute(bars, inputs, hp)`.
|
|
638
|
+
* `bars` is an array of `{ time, o, h, l, c, v }`, `inputs` the resolved
|
|
639
|
+
* input values, and `hp` a bundle of TA helpers (sma, ema, rma, highest,
|
|
640
|
+
* lowest, change, stdev, atr). It must return `{ plots: [...] }`.
|
|
641
|
+
*/
|
|
642
|
+
source: string;
|
|
643
|
+
}
|
|
644
|
+
interface ScriptPlotSpec {
|
|
645
|
+
title?: string;
|
|
646
|
+
values: Array<number | null>;
|
|
647
|
+
color?: string;
|
|
648
|
+
width?: number;
|
|
649
|
+
style?: "line" | "histogram";
|
|
650
|
+
negativeColor?: string;
|
|
651
|
+
}
|
|
652
|
+
interface ScriptComputeResult {
|
|
653
|
+
plots: ScriptPlotSpec[];
|
|
654
|
+
range?: {
|
|
655
|
+
min?: number;
|
|
656
|
+
max?: number;
|
|
657
|
+
};
|
|
658
|
+
guides?: number[];
|
|
659
|
+
decimals?: number;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Compile-check a script without registering it: returns an error message, or
|
|
663
|
+
* `null` when the script compiles. Runs with the same execution guard as the
|
|
664
|
+
* chart, so a top-level infinite loop returns a budget error instead of
|
|
665
|
+
* hanging the caller (e.g. an editor's save validation).
|
|
666
|
+
*/
|
|
667
|
+
declare const validateScriptSource: (source: string) => string | null;
|
|
668
|
+
/**
|
|
669
|
+
* Compile a user-authored script into a regular indicator plugin. The plugin
|
|
670
|
+
* can then be registered with `chart.registerIndicator(...)` and behaves like
|
|
671
|
+
* a built-in: separate panes get the shared grid, legends, value lines,
|
|
672
|
+
* drag-resize and hover controls; overlays autoscale with price.
|
|
673
|
+
*
|
|
674
|
+
* Compile/runtime errors never throw during rendering; they render as an
|
|
675
|
+
* inline error message in the pane instead.
|
|
676
|
+
*/
|
|
677
|
+
declare const compileScriptIndicator: (definition: ScriptIndicatorDefinition) => IndicatorPlugin;
|
|
678
|
+
|
|
661
679
|
declare function createChart(element: HTMLElement, options?: ChartOptions): ChartInstance;
|
|
662
680
|
|
|
663
681
|
export { type AxisOptions, type BuiltInIndicatorInfo, type ChartClickEvent, type ChartInstance, type ChartOptions, type ChartType, type CrosshairMoveEvent, type CrosshairOptions, type CrosshairPriceActionEvent, type DashPatternOptions, type DrawingDefaults, type DrawingHoverEvent, type DrawingObjectOptions, type DrawingPoint, type DrawingSelectEvent, type DrawingToolType, FIB_DEFAULT_PALETTE, type GridOptions, type IndicatorInstanceOptions, type IndicatorPane, type IndicatorPaneActionEvent, type IndicatorPaneAxisOptions, type IndicatorPaneGuideLine, type IndicatorPaneHeightChangeEvent, type IndicatorPaneRenderInfo, type IndicatorPaneValue, type IndicatorPaneValueLabel, type IndicatorPlugin, type IndicatorRenderContext, type LabelsOptions, type OhlcDataPoint, type OrderActionButton, type OrderActionEvent, type OrderLineOptions, POSITION_DEFAULT_COLORS, type PriceLineOptions, type ScriptComputeResult, type ScriptIndicatorDefinition, type ScriptIndicatorInputDef, type ScriptPlotSpec, type TickerLineOptions, type TradeMarkerOptions, type ViewportState, type WatermarkOptions, compileScriptIndicator, createChart, validateScriptSource };
|
package/dist/index.d.ts
CHANGED
|
@@ -90,7 +90,15 @@ interface ChartOptions {
|
|
|
90
90
|
drawings?: DrawingObjectOptions[];
|
|
91
91
|
}
|
|
92
92
|
type IndicatorPane = "overlay" | "separate";
|
|
93
|
-
type DrawingToolType = "horizontal-line" | "vertical-line" | "trendline" | "ray" | "fib-retracement" | "fib-extension" | "long-position" | "short-position" | "price-range" | "rectangle" | "text" | "note"
|
|
93
|
+
type DrawingToolType = "horizontal-line" | "vertical-line" | "trendline" | "ray" | "fib-retracement" | "fib-extension" | "long-position" | "short-position" | "price-range" | "rectangle" | "text" | "note"
|
|
94
|
+
/**
|
|
95
|
+
* TradingView-style ruler. Unlike every other tool it is transient: the
|
|
96
|
+
* measurement overlay is never added to the drawings list (no
|
|
97
|
+
* `onDrawingsChange`), and it clears on the next click, on Escape, or when
|
|
98
|
+
* the tool changes. Also reachable without arming the tool via Shift+drag
|
|
99
|
+
* on the plot.
|
|
100
|
+
*/
|
|
101
|
+
| "measure";
|
|
94
102
|
interface DrawingPoint {
|
|
95
103
|
index: number;
|
|
96
104
|
price: number;
|
|
@@ -501,69 +509,6 @@ interface LabelsOptions {
|
|
|
501
509
|
labelHeight?: number;
|
|
502
510
|
labelPaddingX?: number;
|
|
503
511
|
}
|
|
504
|
-
interface ScriptIndicatorInputDef {
|
|
505
|
-
key: string;
|
|
506
|
-
label?: string;
|
|
507
|
-
type?: "number" | "color" | "boolean" | "select" | "string";
|
|
508
|
-
default: unknown;
|
|
509
|
-
min?: number;
|
|
510
|
-
max?: number;
|
|
511
|
-
step?: number;
|
|
512
|
-
options?: Array<{
|
|
513
|
-
value: string;
|
|
514
|
-
label: string;
|
|
515
|
-
}>;
|
|
516
|
-
}
|
|
517
|
-
interface ScriptIndicatorDefinition {
|
|
518
|
-
/** Unique indicator id, e.g. "script:my-rsi". */
|
|
519
|
-
id: string;
|
|
520
|
-
name: string;
|
|
521
|
-
/** Defaults to "separate". */
|
|
522
|
-
pane?: IndicatorPane;
|
|
523
|
-
paneHeightRatio?: number;
|
|
524
|
-
inputs?: ScriptIndicatorInputDef[];
|
|
525
|
-
/**
|
|
526
|
-
* JavaScript source that must define `function compute(bars, inputs, hp)`.
|
|
527
|
-
* `bars` is an array of `{ time, o, h, l, c, v }`, `inputs` the resolved
|
|
528
|
-
* input values, and `hp` a bundle of TA helpers (sma, ema, rma, highest,
|
|
529
|
-
* lowest, change, stdev, atr). It must return `{ plots: [...] }`.
|
|
530
|
-
*/
|
|
531
|
-
source: string;
|
|
532
|
-
}
|
|
533
|
-
interface ScriptPlotSpec {
|
|
534
|
-
title?: string;
|
|
535
|
-
values: Array<number | null>;
|
|
536
|
-
color?: string;
|
|
537
|
-
width?: number;
|
|
538
|
-
style?: "line" | "histogram";
|
|
539
|
-
negativeColor?: string;
|
|
540
|
-
}
|
|
541
|
-
interface ScriptComputeResult {
|
|
542
|
-
plots: ScriptPlotSpec[];
|
|
543
|
-
range?: {
|
|
544
|
-
min?: number;
|
|
545
|
-
max?: number;
|
|
546
|
-
};
|
|
547
|
-
guides?: number[];
|
|
548
|
-
decimals?: number;
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Compile-check a script without registering it: returns an error message, or
|
|
552
|
-
* `null` when the script compiles. Runs with the same execution guard as the
|
|
553
|
-
* chart, so a top-level infinite loop returns a budget error instead of
|
|
554
|
-
* hanging the caller (e.g. an editor's save validation).
|
|
555
|
-
*/
|
|
556
|
-
declare const validateScriptSource: (source: string) => string | null;
|
|
557
|
-
/**
|
|
558
|
-
* Compile a user-authored script into a regular indicator plugin. The plugin
|
|
559
|
-
* can then be registered with `chart.registerIndicator(...)` and behaves like
|
|
560
|
-
* a built-in: separate panes get the shared grid, legends, value lines,
|
|
561
|
-
* drag-resize and hover controls; overlays autoscale with price.
|
|
562
|
-
*
|
|
563
|
-
* Compile/runtime errors never throw during rendering; they render as an
|
|
564
|
-
* inline error message in the pane instead.
|
|
565
|
-
*/
|
|
566
|
-
declare const compileScriptIndicator: (definition: ScriptIndicatorDefinition) => IndicatorPlugin;
|
|
567
512
|
interface ChartInstance {
|
|
568
513
|
updateOptions: (options: ChartOptions) => void;
|
|
569
514
|
/** Switch the main series rendering style (candles, bars, line, ...). */
|
|
@@ -615,6 +560,14 @@ interface ChartInstance {
|
|
|
615
560
|
removeDrawing: (id: string) => void;
|
|
616
561
|
clearDrawings: () => void;
|
|
617
562
|
onDrawingsChange: (handler: ((drawings: DrawingObjectOptions[]) => void) | null) => void;
|
|
563
|
+
/**
|
|
564
|
+
* Fires whenever the active drawing tool changes — including when the chart
|
|
565
|
+
* auto-reverts to the cursor after a tool completes (every drawing tool does
|
|
566
|
+
* this once its shape is placed; the transient `measure` tool does it after
|
|
567
|
+
* every measurement). Lets host toolbars stay in sync without polling
|
|
568
|
+
* `getActiveDrawingTool()`.
|
|
569
|
+
*/
|
|
570
|
+
onActiveDrawingToolChange: (handler: ((tool: DrawingToolType | null) => void) | null) => void;
|
|
618
571
|
onDrawingSelect: (handler: ((event: DrawingSelectEvent) => void) | null) => void;
|
|
619
572
|
onDrawingDoubleClick: (handler: ((event: DrawingSelectEvent) => void) | null) => void;
|
|
620
573
|
onDrawingEditText: (handler: ((event: DrawingSelectEvent) => void) | null) => void;
|
|
@@ -658,6 +611,71 @@ interface ViewportState {
|
|
|
658
611
|
/** Manual Y-axis max override (null = auto-scale). */
|
|
659
612
|
yMax: number | null;
|
|
660
613
|
}
|
|
614
|
+
|
|
615
|
+
interface ScriptIndicatorInputDef {
|
|
616
|
+
key: string;
|
|
617
|
+
label?: string;
|
|
618
|
+
type?: "number" | "color" | "boolean" | "select" | "string";
|
|
619
|
+
default: unknown;
|
|
620
|
+
min?: number;
|
|
621
|
+
max?: number;
|
|
622
|
+
step?: number;
|
|
623
|
+
options?: Array<{
|
|
624
|
+
value: string;
|
|
625
|
+
label: string;
|
|
626
|
+
}>;
|
|
627
|
+
}
|
|
628
|
+
interface ScriptIndicatorDefinition {
|
|
629
|
+
/** Unique indicator id, e.g. "script:my-rsi". */
|
|
630
|
+
id: string;
|
|
631
|
+
name: string;
|
|
632
|
+
/** Defaults to "separate". */
|
|
633
|
+
pane?: IndicatorPane;
|
|
634
|
+
paneHeightRatio?: number;
|
|
635
|
+
inputs?: ScriptIndicatorInputDef[];
|
|
636
|
+
/**
|
|
637
|
+
* JavaScript source that must define `function compute(bars, inputs, hp)`.
|
|
638
|
+
* `bars` is an array of `{ time, o, h, l, c, v }`, `inputs` the resolved
|
|
639
|
+
* input values, and `hp` a bundle of TA helpers (sma, ema, rma, highest,
|
|
640
|
+
* lowest, change, stdev, atr). It must return `{ plots: [...] }`.
|
|
641
|
+
*/
|
|
642
|
+
source: string;
|
|
643
|
+
}
|
|
644
|
+
interface ScriptPlotSpec {
|
|
645
|
+
title?: string;
|
|
646
|
+
values: Array<number | null>;
|
|
647
|
+
color?: string;
|
|
648
|
+
width?: number;
|
|
649
|
+
style?: "line" | "histogram";
|
|
650
|
+
negativeColor?: string;
|
|
651
|
+
}
|
|
652
|
+
interface ScriptComputeResult {
|
|
653
|
+
plots: ScriptPlotSpec[];
|
|
654
|
+
range?: {
|
|
655
|
+
min?: number;
|
|
656
|
+
max?: number;
|
|
657
|
+
};
|
|
658
|
+
guides?: number[];
|
|
659
|
+
decimals?: number;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Compile-check a script without registering it: returns an error message, or
|
|
663
|
+
* `null` when the script compiles. Runs with the same execution guard as the
|
|
664
|
+
* chart, so a top-level infinite loop returns a budget error instead of
|
|
665
|
+
* hanging the caller (e.g. an editor's save validation).
|
|
666
|
+
*/
|
|
667
|
+
declare const validateScriptSource: (source: string) => string | null;
|
|
668
|
+
/**
|
|
669
|
+
* Compile a user-authored script into a regular indicator plugin. The plugin
|
|
670
|
+
* can then be registered with `chart.registerIndicator(...)` and behaves like
|
|
671
|
+
* a built-in: separate panes get the shared grid, legends, value lines,
|
|
672
|
+
* drag-resize and hover controls; overlays autoscale with price.
|
|
673
|
+
*
|
|
674
|
+
* Compile/runtime errors never throw during rendering; they render as an
|
|
675
|
+
* inline error message in the pane instead.
|
|
676
|
+
*/
|
|
677
|
+
declare const compileScriptIndicator: (definition: ScriptIndicatorDefinition) => IndicatorPlugin;
|
|
678
|
+
|
|
661
679
|
declare function createChart(element: HTMLElement, options?: ChartOptions): ChartInstance;
|
|
662
680
|
|
|
663
681
|
export { type AxisOptions, type BuiltInIndicatorInfo, type ChartClickEvent, type ChartInstance, type ChartOptions, type ChartType, type CrosshairMoveEvent, type CrosshairOptions, type CrosshairPriceActionEvent, type DashPatternOptions, type DrawingDefaults, type DrawingHoverEvent, type DrawingObjectOptions, type DrawingPoint, type DrawingSelectEvent, type DrawingToolType, FIB_DEFAULT_PALETTE, type GridOptions, type IndicatorInstanceOptions, type IndicatorPane, type IndicatorPaneActionEvent, type IndicatorPaneAxisOptions, type IndicatorPaneGuideLine, type IndicatorPaneHeightChangeEvent, type IndicatorPaneRenderInfo, type IndicatorPaneValue, type IndicatorPaneValueLabel, type IndicatorPlugin, type IndicatorRenderContext, type LabelsOptions, type OhlcDataPoint, type OrderActionButton, type OrderActionEvent, type OrderLineOptions, POSITION_DEFAULT_COLORS, type PriceLineOptions, type ScriptComputeResult, type ScriptIndicatorDefinition, type ScriptIndicatorInputDef, type ScriptPlotSpec, type TickerLineOptions, type TradeMarkerOptions, type ViewportState, type WatermarkOptions, compileScriptIndicator, createChart, validateScriptSource };
|