hyperprop-charting-library 0.1.132 → 0.1.134

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.
@@ -501,62 +501,6 @@ interface LabelsOptions {
501
501
  labelHeight?: number;
502
502
  labelPaddingX?: number;
503
503
  }
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 a user-authored script into a regular indicator plugin. The plugin
552
- * can then be registered with `chart.registerIndicator(...)` and behaves like
553
- * a built-in: separate panes get the shared grid, legends, value lines,
554
- * drag-resize and hover controls; overlays autoscale with price.
555
- *
556
- * Compile/runtime errors never throw during rendering; they render as an
557
- * inline error message in the pane instead.
558
- */
559
- declare const compileScriptIndicator: (definition: ScriptIndicatorDefinition) => IndicatorPlugin;
560
504
  interface ChartInstance {
561
505
  updateOptions: (options: ChartOptions) => void;
562
506
  /** Switch the main series rendering style (candles, bars, line, ...). */
@@ -651,6 +595,71 @@ interface ViewportState {
651
595
  /** Manual Y-axis max override (null = auto-scale). */
652
596
  yMax: number | null;
653
597
  }
598
+
599
+ interface ScriptIndicatorInputDef {
600
+ key: string;
601
+ label?: string;
602
+ type?: "number" | "color" | "boolean" | "select" | "string";
603
+ default: unknown;
604
+ min?: number;
605
+ max?: number;
606
+ step?: number;
607
+ options?: Array<{
608
+ value: string;
609
+ label: string;
610
+ }>;
611
+ }
612
+ interface ScriptIndicatorDefinition {
613
+ /** Unique indicator id, e.g. "script:my-rsi". */
614
+ id: string;
615
+ name: string;
616
+ /** Defaults to "separate". */
617
+ pane?: IndicatorPane;
618
+ paneHeightRatio?: number;
619
+ inputs?: ScriptIndicatorInputDef[];
620
+ /**
621
+ * JavaScript source that must define `function compute(bars, inputs, hp)`.
622
+ * `bars` is an array of `{ time, o, h, l, c, v }`, `inputs` the resolved
623
+ * input values, and `hp` a bundle of TA helpers (sma, ema, rma, highest,
624
+ * lowest, change, stdev, atr). It must return `{ plots: [...] }`.
625
+ */
626
+ source: string;
627
+ }
628
+ interface ScriptPlotSpec {
629
+ title?: string;
630
+ values: Array<number | null>;
631
+ color?: string;
632
+ width?: number;
633
+ style?: "line" | "histogram";
634
+ negativeColor?: string;
635
+ }
636
+ interface ScriptComputeResult {
637
+ plots: ScriptPlotSpec[];
638
+ range?: {
639
+ min?: number;
640
+ max?: number;
641
+ };
642
+ guides?: number[];
643
+ decimals?: number;
644
+ }
645
+ /**
646
+ * Compile-check a script without registering it: returns an error message, or
647
+ * `null` when the script compiles. Runs with the same execution guard as the
648
+ * chart, so a top-level infinite loop returns a budget error instead of
649
+ * hanging the caller (e.g. an editor's save validation).
650
+ */
651
+ declare const validateScriptSource: (source: string) => string | null;
652
+ /**
653
+ * Compile a user-authored script into a regular indicator plugin. The plugin
654
+ * can then be registered with `chart.registerIndicator(...)` and behaves like
655
+ * a built-in: separate panes get the shared grid, legends, value lines,
656
+ * drag-resize and hover controls; overlays autoscale with price.
657
+ *
658
+ * Compile/runtime errors never throw during rendering; they render as an
659
+ * inline error message in the pane instead.
660
+ */
661
+ declare const compileScriptIndicator: (definition: ScriptIndicatorDefinition) => IndicatorPlugin;
662
+
654
663
  declare function createChart(element: HTMLElement, options?: ChartOptions): ChartInstance;
655
664
 
656
- 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 };
665
+ 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 };