react-klinecharts-ui 0.5.0 → 0.6.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/dist/index.d.cts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as react from 'react';
2
2
  import { Dispatch, RefObject, ReactNode, ReactElement } from 'react';
3
- import { Period, SymbolInfo, KLineData, Chart, DeepPartial, Styles, OverlayTemplate, YAxisOverride, DataLoader, IndicatorTemplate } from 'react-klinecharts';
4
- import { OrderLineExtendData } from './extensions.cjs';
5
- export { DepthOverlayExtendData, DepthOverlayRow, OrderLineFontStyle, OrderLineLabelStyle, OrderLineLineStyle, OrderLineMarkStyle, OrderLinePadding, depthOverlay, indicators, orderLine, overlays, registerExtensions } from './extensions.cjs';
3
+ import { Period, SymbolInfo, KLineData, Chart, DeepPartial, Styles, OverlayTemplate, YAxisOverride, HotkeyTemplate, Hotkey, XAxisOverride, DataLoader, IndicatorTemplate } from 'react-klinecharts';
4
+ export { Hotkey, HotkeyActionParams, HotkeyTemplate, XAxisOverride, YAxisOverride } from 'react-klinecharts';
5
+ import { AlertLineExtendData, OrderLineExtendData } from './extensions.cjs';
6
+ export { DepthOverlayExtendData, DepthOverlayRow, OrderLineFontStyle, OrderLineLabelStyle, OrderLineLineStyle, OrderLineMarkStyle, OrderLinePadding, alertLine, depthOverlay, indicators, orderLine, overlays, registerExtensions } from './extensions.cjs';
6
7
 
7
8
  interface TerminalPeriod extends Period {
8
9
  label: string;
@@ -19,6 +20,7 @@ declare const DEFAULT_PERIODS: TerminalPeriod[];
19
20
  * re-export them so the public API surface (consumed via the package root)
20
21
  * stays unchanged.
21
22
  */
23
+
22
24
  type AlertCondition = "crossing_up" | "crossing_down" | "crossing";
23
25
  interface Alert {
24
26
  id: string;
@@ -26,6 +28,12 @@ interface Alert {
26
28
  condition: AlertCondition;
27
29
  message?: string;
28
30
  triggered: boolean;
31
+ /**
32
+ * Visual style for the alert line overlay (color, label text, line/mark
33
+ * styling, bell marker). Persisted in the store so it survives undo/redo
34
+ * and layout presets.
35
+ */
36
+ extendData?: AlertLineExtendData;
29
37
  }
30
38
  interface MeasurePoint {
31
39
  price: number;
@@ -508,6 +516,58 @@ interface UseScreenshotReturn {
508
516
  }
509
517
  declare function useScreenshot(): UseScreenshotReturn;
510
518
 
519
+ interface UseHotkeysReturn {
520
+ /**
521
+ * Register a custom hotkey globally. Idempotent per `template.name` — calling
522
+ * again with the same name replaces the previous handler. The `action`
523
+ * callback receives the chart instance, the keyboard event and the matched
524
+ * hotkey template (see klinecharts `HotkeyActionParams`).
525
+ */
526
+ registerHotkey: (template: HotkeyTemplate) => void;
527
+ /** Look up a registered hotkey template by name (built-in or custom). */
528
+ getHotkey: (name: string) => HotkeyTemplate | null;
529
+ /** Names of every registered hotkey (built-in + custom). */
530
+ supportedHotkeys: string[];
531
+ /**
532
+ * Enable or disable hotkey handling for the current chart. Pass `exclude`
533
+ * to keep hotkeys on but silence specific ones by name.
534
+ */
535
+ setHotkeysEnabled: (enabled: boolean, exclude?: string[]) => void;
536
+ /** The current hotkey config (`{ enabled, exclude }`) for the chart, or null. */
537
+ getHotkeysConfig: () => Hotkey | null;
538
+ }
539
+ /**
540
+ * Headless hook for klinecharts v10 keyboard shortcuts (added in
541
+ * klinecharts 10.0.0-beta3).
542
+ *
543
+ * Custom hotkeys are registered **globally** via klinecharts `registerHotkey`,
544
+ * so a shortcut defined here is shared by every chart in the page; the
545
+ * per-chart enable/exclude switches operate on the provider's chart instance.
546
+ */
547
+ declare function useHotkeys(): UseHotkeysReturn;
548
+
549
+ interface UseChartAxesReturn {
550
+ /**
551
+ * Override the main pane's X (time) axis — e.g. `scrollZoomEnabled`,
552
+ * `name`, or a custom `createTicks` generator. Added in klinecharts
553
+ * 10.0.0-beta2.
554
+ */
555
+ overrideXAxis: (override: XAxisOverride) => void;
556
+ /**
557
+ * Override a Y (value) axis — e.g. `reverse` to flip the price scale,
558
+ * `inside` to draw labels inside the pane, `position`, or a custom
559
+ * `createRange` / `createTicks`. Target a specific axis with `id` / `paneId`.
560
+ * Added in klinecharts 10.0.0-beta2.
561
+ */
562
+ overrideYAxis: (override: YAxisOverride) => void;
563
+ }
564
+ /**
565
+ * Headless hook for overriding the chart's built-in X / Y axes (klinecharts
566
+ * v10 `overrideXAxis` / `overrideYAxis`). For binding indicators to additional
567
+ * secondary Y-axes, use {@link useIndicators} instead.
568
+ */
569
+ declare function useChartAxes(): UseChartAxesReturn;
570
+
511
571
  interface UseFullscreenReturn {
512
572
  isFullscreen: boolean;
513
573
  toggle: () => void;
@@ -698,7 +758,7 @@ declare function useCrosshair(): UseCrosshairReturn;
698
758
 
699
759
  interface UseAlertsReturn {
700
760
  alerts: Alert[];
701
- addAlert: (price: number, condition: AlertCondition, message?: string) => string;
761
+ addAlert: (price: number, condition: AlertCondition, message?: string, extendData?: AlertLineExtendData) => string;
702
762
  removeAlert: (id: string) => void;
703
763
  clearAlerts: () => void;
704
764
  onAlertTriggered: (callback: (alert: Alert) => void) => void;
@@ -1026,4 +1086,4 @@ declare const superTrend: IndicatorTemplate;
1026
1086
 
1027
1087
  declare const vwap: IndicatorTemplate;
1028
1088
 
1029
- export { type AddIndicatorOptions, type Alert, type AlertCondition, type Annotation, CANDLE_TYPES, COMPARE_RULES, type CandleTypeItem, type CandleTypeOption, type ChartLayoutState, type CompareRule, type CompareSymbol, type CrosshairBarData, DEFAULT_PERIODS, DRAWING_CATEGORIES, type Datafeed, type DrawingCategoryItem, type DrawingTool, type DrawingToolCategory, type DrawingToolItem, type ExportFormat, INDICATOR_PARAMS, type IndicatorDefinition, type IndicatorInfo, type IndicatorParamConfig, type KlinechartsUIAction, type KlinechartsUIContextValue, KlinechartsUIDispatchContext, type KlinechartsUIDispatchValue, type KlinechartsUIOptions, KlinechartsUIProvider, type KlinechartsUISettingsState, type KlinechartsUIState, KlinechartsUIStateContext, type LayoutEntry, MAIN_INDICATORS, type MagnetMode, type MeasurePoint, type MeasureResult, OrderLineExtendData, type OrderLineOptions, PRICE_AXIS_TYPES, type PartialSymbolInfo, type PriceAxisType, type ReplaySpeed, SUB_INDICATORS, type ScriptPlacement, TA, TIMEZONES, TOOLTIP_SHOW_RULES, type TerminalPeriod, type TimezoneItem, type TimezoneOption, type TooltipShowRule, type UndoRedoAction, type UndoRedoActionType, type UseAlertsReturn, type UseAnnotationsReturn, type UseCompareReturn, type UseCrosshairReturn, type UseDataExportReturn, type UseDrawingToolsReturn, type UseFullscreenReturn, type UseIndicatorsReturn, type UseKlinechartsUILoadingReturn, type UseKlinechartsUISettingsReturn, type UseKlinechartsUIThemeReturn, type UseLayoutManagerReturn, type UseMeasureReturn, type UseOrderLinesReturn, type UsePeriodsReturn, type UseReplayReturn, type UseScreenshotReturn, type UseScriptEditorReturn, type UseSymbolSearchReturn, type UseTimezoneReturn, type UseUndoRedoReturn, type UseWatchlistReturn, type WatchlistItem, YAXIS_POSITIONS, type YAxisPosition, abcd, anyWaves, arrow, bollTv, brush, cci, circle, createDataLoader, eightWaves, elliottWave, fibRetracement, fibonacciCircle, fibonacciExtension, fibonacciSegment, fibonacciSpeedResistanceFan, fibonacciSpiral, fiveWaves, gannBox, gannFan, hma, ichimoku, longPosition, maRibbon, macdTv, measure, parallelChannel, parallelogram, pivotPoints, ray, rect, rsiTv, shortPosition, stochastic, superTrend, threeWaves, triangle, useAlerts, useAnnotations, useCompare, useCrosshair, useDataExport, useDrawingTools, useFullscreen, useIndicators, useKlinechartsUI, useKlinechartsUILoading, useKlinechartsUISettings, useKlinechartsUITheme, useLayoutManager, useMeasure, useOrderLines, usePeriods, useReplay, useScreenshot, useScriptEditor, useSymbolSearch, useTimezone, useUndoRedo, useWatchlist, vwap, xabcd };
1089
+ export { type AddIndicatorOptions, type Alert, type AlertCondition, AlertLineExtendData, type Annotation, CANDLE_TYPES, COMPARE_RULES, type CandleTypeItem, type CandleTypeOption, type ChartLayoutState, type CompareRule, type CompareSymbol, type CrosshairBarData, DEFAULT_PERIODS, DRAWING_CATEGORIES, type Datafeed, type DrawingCategoryItem, type DrawingTool, type DrawingToolCategory, type DrawingToolItem, type ExportFormat, INDICATOR_PARAMS, type IndicatorDefinition, type IndicatorInfo, type IndicatorParamConfig, type KlinechartsUIAction, type KlinechartsUIContextValue, KlinechartsUIDispatchContext, type KlinechartsUIDispatchValue, type KlinechartsUIOptions, KlinechartsUIProvider, type KlinechartsUISettingsState, type KlinechartsUIState, KlinechartsUIStateContext, type LayoutEntry, MAIN_INDICATORS, type MagnetMode, type MeasurePoint, type MeasureResult, OrderLineExtendData, type OrderLineOptions, PRICE_AXIS_TYPES, type PartialSymbolInfo, type PriceAxisType, type ReplaySpeed, SUB_INDICATORS, type ScriptPlacement, TA, TIMEZONES, TOOLTIP_SHOW_RULES, type TerminalPeriod, type TimezoneItem, type TimezoneOption, type TooltipShowRule, type UndoRedoAction, type UndoRedoActionType, type UseAlertsReturn, type UseAnnotationsReturn, type UseChartAxesReturn, type UseCompareReturn, type UseCrosshairReturn, type UseDataExportReturn, type UseDrawingToolsReturn, type UseFullscreenReturn, type UseHotkeysReturn, type UseIndicatorsReturn, type UseKlinechartsUILoadingReturn, type UseKlinechartsUISettingsReturn, type UseKlinechartsUIThemeReturn, type UseLayoutManagerReturn, type UseMeasureReturn, type UseOrderLinesReturn, type UsePeriodsReturn, type UseReplayReturn, type UseScreenshotReturn, type UseScriptEditorReturn, type UseSymbolSearchReturn, type UseTimezoneReturn, type UseUndoRedoReturn, type UseWatchlistReturn, type WatchlistItem, YAXIS_POSITIONS, type YAxisPosition, abcd, anyWaves, arrow, bollTv, brush, cci, circle, createDataLoader, eightWaves, elliottWave, fibRetracement, fibonacciCircle, fibonacciExtension, fibonacciSegment, fibonacciSpeedResistanceFan, fibonacciSpiral, fiveWaves, gannBox, gannFan, hma, ichimoku, longPosition, maRibbon, macdTv, measure, parallelChannel, parallelogram, pivotPoints, ray, rect, rsiTv, shortPosition, stochastic, superTrend, threeWaves, triangle, useAlerts, useAnnotations, useChartAxes, useCompare, useCrosshair, useDataExport, useDrawingTools, useFullscreen, useHotkeys, useIndicators, useKlinechartsUI, useKlinechartsUILoading, useKlinechartsUISettings, useKlinechartsUITheme, useLayoutManager, useMeasure, useOrderLines, usePeriods, useReplay, useScreenshot, useScriptEditor, useSymbolSearch, useTimezone, useUndoRedo, useWatchlist, vwap, xabcd };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as react from 'react';
2
2
  import { Dispatch, RefObject, ReactNode, ReactElement } from 'react';
3
- import { Period, SymbolInfo, KLineData, Chart, DeepPartial, Styles, OverlayTemplate, YAxisOverride, DataLoader, IndicatorTemplate } from 'react-klinecharts';
4
- import { OrderLineExtendData } from './extensions.js';
5
- export { DepthOverlayExtendData, DepthOverlayRow, OrderLineFontStyle, OrderLineLabelStyle, OrderLineLineStyle, OrderLineMarkStyle, OrderLinePadding, depthOverlay, indicators, orderLine, overlays, registerExtensions } from './extensions.js';
3
+ import { Period, SymbolInfo, KLineData, Chart, DeepPartial, Styles, OverlayTemplate, YAxisOverride, HotkeyTemplate, Hotkey, XAxisOverride, DataLoader, IndicatorTemplate } from 'react-klinecharts';
4
+ export { Hotkey, HotkeyActionParams, HotkeyTemplate, XAxisOverride, YAxisOverride } from 'react-klinecharts';
5
+ import { AlertLineExtendData, OrderLineExtendData } from './extensions.js';
6
+ export { DepthOverlayExtendData, DepthOverlayRow, OrderLineFontStyle, OrderLineLabelStyle, OrderLineLineStyle, OrderLineMarkStyle, OrderLinePadding, alertLine, depthOverlay, indicators, orderLine, overlays, registerExtensions } from './extensions.js';
6
7
 
7
8
  interface TerminalPeriod extends Period {
8
9
  label: string;
@@ -19,6 +20,7 @@ declare const DEFAULT_PERIODS: TerminalPeriod[];
19
20
  * re-export them so the public API surface (consumed via the package root)
20
21
  * stays unchanged.
21
22
  */
23
+
22
24
  type AlertCondition = "crossing_up" | "crossing_down" | "crossing";
23
25
  interface Alert {
24
26
  id: string;
@@ -26,6 +28,12 @@ interface Alert {
26
28
  condition: AlertCondition;
27
29
  message?: string;
28
30
  triggered: boolean;
31
+ /**
32
+ * Visual style for the alert line overlay (color, label text, line/mark
33
+ * styling, bell marker). Persisted in the store so it survives undo/redo
34
+ * and layout presets.
35
+ */
36
+ extendData?: AlertLineExtendData;
29
37
  }
30
38
  interface MeasurePoint {
31
39
  price: number;
@@ -508,6 +516,58 @@ interface UseScreenshotReturn {
508
516
  }
509
517
  declare function useScreenshot(): UseScreenshotReturn;
510
518
 
519
+ interface UseHotkeysReturn {
520
+ /**
521
+ * Register a custom hotkey globally. Idempotent per `template.name` — calling
522
+ * again with the same name replaces the previous handler. The `action`
523
+ * callback receives the chart instance, the keyboard event and the matched
524
+ * hotkey template (see klinecharts `HotkeyActionParams`).
525
+ */
526
+ registerHotkey: (template: HotkeyTemplate) => void;
527
+ /** Look up a registered hotkey template by name (built-in or custom). */
528
+ getHotkey: (name: string) => HotkeyTemplate | null;
529
+ /** Names of every registered hotkey (built-in + custom). */
530
+ supportedHotkeys: string[];
531
+ /**
532
+ * Enable or disable hotkey handling for the current chart. Pass `exclude`
533
+ * to keep hotkeys on but silence specific ones by name.
534
+ */
535
+ setHotkeysEnabled: (enabled: boolean, exclude?: string[]) => void;
536
+ /** The current hotkey config (`{ enabled, exclude }`) for the chart, or null. */
537
+ getHotkeysConfig: () => Hotkey | null;
538
+ }
539
+ /**
540
+ * Headless hook for klinecharts v10 keyboard shortcuts (added in
541
+ * klinecharts 10.0.0-beta3).
542
+ *
543
+ * Custom hotkeys are registered **globally** via klinecharts `registerHotkey`,
544
+ * so a shortcut defined here is shared by every chart in the page; the
545
+ * per-chart enable/exclude switches operate on the provider's chart instance.
546
+ */
547
+ declare function useHotkeys(): UseHotkeysReturn;
548
+
549
+ interface UseChartAxesReturn {
550
+ /**
551
+ * Override the main pane's X (time) axis — e.g. `scrollZoomEnabled`,
552
+ * `name`, or a custom `createTicks` generator. Added in klinecharts
553
+ * 10.0.0-beta2.
554
+ */
555
+ overrideXAxis: (override: XAxisOverride) => void;
556
+ /**
557
+ * Override a Y (value) axis — e.g. `reverse` to flip the price scale,
558
+ * `inside` to draw labels inside the pane, `position`, or a custom
559
+ * `createRange` / `createTicks`. Target a specific axis with `id` / `paneId`.
560
+ * Added in klinecharts 10.0.0-beta2.
561
+ */
562
+ overrideYAxis: (override: YAxisOverride) => void;
563
+ }
564
+ /**
565
+ * Headless hook for overriding the chart's built-in X / Y axes (klinecharts
566
+ * v10 `overrideXAxis` / `overrideYAxis`). For binding indicators to additional
567
+ * secondary Y-axes, use {@link useIndicators} instead.
568
+ */
569
+ declare function useChartAxes(): UseChartAxesReturn;
570
+
511
571
  interface UseFullscreenReturn {
512
572
  isFullscreen: boolean;
513
573
  toggle: () => void;
@@ -698,7 +758,7 @@ declare function useCrosshair(): UseCrosshairReturn;
698
758
 
699
759
  interface UseAlertsReturn {
700
760
  alerts: Alert[];
701
- addAlert: (price: number, condition: AlertCondition, message?: string) => string;
761
+ addAlert: (price: number, condition: AlertCondition, message?: string, extendData?: AlertLineExtendData) => string;
702
762
  removeAlert: (id: string) => void;
703
763
  clearAlerts: () => void;
704
764
  onAlertTriggered: (callback: (alert: Alert) => void) => void;
@@ -1026,4 +1086,4 @@ declare const superTrend: IndicatorTemplate;
1026
1086
 
1027
1087
  declare const vwap: IndicatorTemplate;
1028
1088
 
1029
- export { type AddIndicatorOptions, type Alert, type AlertCondition, type Annotation, CANDLE_TYPES, COMPARE_RULES, type CandleTypeItem, type CandleTypeOption, type ChartLayoutState, type CompareRule, type CompareSymbol, type CrosshairBarData, DEFAULT_PERIODS, DRAWING_CATEGORIES, type Datafeed, type DrawingCategoryItem, type DrawingTool, type DrawingToolCategory, type DrawingToolItem, type ExportFormat, INDICATOR_PARAMS, type IndicatorDefinition, type IndicatorInfo, type IndicatorParamConfig, type KlinechartsUIAction, type KlinechartsUIContextValue, KlinechartsUIDispatchContext, type KlinechartsUIDispatchValue, type KlinechartsUIOptions, KlinechartsUIProvider, type KlinechartsUISettingsState, type KlinechartsUIState, KlinechartsUIStateContext, type LayoutEntry, MAIN_INDICATORS, type MagnetMode, type MeasurePoint, type MeasureResult, OrderLineExtendData, type OrderLineOptions, PRICE_AXIS_TYPES, type PartialSymbolInfo, type PriceAxisType, type ReplaySpeed, SUB_INDICATORS, type ScriptPlacement, TA, TIMEZONES, TOOLTIP_SHOW_RULES, type TerminalPeriod, type TimezoneItem, type TimezoneOption, type TooltipShowRule, type UndoRedoAction, type UndoRedoActionType, type UseAlertsReturn, type UseAnnotationsReturn, type UseCompareReturn, type UseCrosshairReturn, type UseDataExportReturn, type UseDrawingToolsReturn, type UseFullscreenReturn, type UseIndicatorsReturn, type UseKlinechartsUILoadingReturn, type UseKlinechartsUISettingsReturn, type UseKlinechartsUIThemeReturn, type UseLayoutManagerReturn, type UseMeasureReturn, type UseOrderLinesReturn, type UsePeriodsReturn, type UseReplayReturn, type UseScreenshotReturn, type UseScriptEditorReturn, type UseSymbolSearchReturn, type UseTimezoneReturn, type UseUndoRedoReturn, type UseWatchlistReturn, type WatchlistItem, YAXIS_POSITIONS, type YAxisPosition, abcd, anyWaves, arrow, bollTv, brush, cci, circle, createDataLoader, eightWaves, elliottWave, fibRetracement, fibonacciCircle, fibonacciExtension, fibonacciSegment, fibonacciSpeedResistanceFan, fibonacciSpiral, fiveWaves, gannBox, gannFan, hma, ichimoku, longPosition, maRibbon, macdTv, measure, parallelChannel, parallelogram, pivotPoints, ray, rect, rsiTv, shortPosition, stochastic, superTrend, threeWaves, triangle, useAlerts, useAnnotations, useCompare, useCrosshair, useDataExport, useDrawingTools, useFullscreen, useIndicators, useKlinechartsUI, useKlinechartsUILoading, useKlinechartsUISettings, useKlinechartsUITheme, useLayoutManager, useMeasure, useOrderLines, usePeriods, useReplay, useScreenshot, useScriptEditor, useSymbolSearch, useTimezone, useUndoRedo, useWatchlist, vwap, xabcd };
1089
+ export { type AddIndicatorOptions, type Alert, type AlertCondition, AlertLineExtendData, type Annotation, CANDLE_TYPES, COMPARE_RULES, type CandleTypeItem, type CandleTypeOption, type ChartLayoutState, type CompareRule, type CompareSymbol, type CrosshairBarData, DEFAULT_PERIODS, DRAWING_CATEGORIES, type Datafeed, type DrawingCategoryItem, type DrawingTool, type DrawingToolCategory, type DrawingToolItem, type ExportFormat, INDICATOR_PARAMS, type IndicatorDefinition, type IndicatorInfo, type IndicatorParamConfig, type KlinechartsUIAction, type KlinechartsUIContextValue, KlinechartsUIDispatchContext, type KlinechartsUIDispatchValue, type KlinechartsUIOptions, KlinechartsUIProvider, type KlinechartsUISettingsState, type KlinechartsUIState, KlinechartsUIStateContext, type LayoutEntry, MAIN_INDICATORS, type MagnetMode, type MeasurePoint, type MeasureResult, OrderLineExtendData, type OrderLineOptions, PRICE_AXIS_TYPES, type PartialSymbolInfo, type PriceAxisType, type ReplaySpeed, SUB_INDICATORS, type ScriptPlacement, TA, TIMEZONES, TOOLTIP_SHOW_RULES, type TerminalPeriod, type TimezoneItem, type TimezoneOption, type TooltipShowRule, type UndoRedoAction, type UndoRedoActionType, type UseAlertsReturn, type UseAnnotationsReturn, type UseChartAxesReturn, type UseCompareReturn, type UseCrosshairReturn, type UseDataExportReturn, type UseDrawingToolsReturn, type UseFullscreenReturn, type UseHotkeysReturn, type UseIndicatorsReturn, type UseKlinechartsUILoadingReturn, type UseKlinechartsUISettingsReturn, type UseKlinechartsUIThemeReturn, type UseLayoutManagerReturn, type UseMeasureReturn, type UseOrderLinesReturn, type UsePeriodsReturn, type UseReplayReturn, type UseScreenshotReturn, type UseScriptEditorReturn, type UseSymbolSearchReturn, type UseTimezoneReturn, type UseUndoRedoReturn, type UseWatchlistReturn, type WatchlistItem, YAXIS_POSITIONS, type YAxisPosition, abcd, anyWaves, arrow, bollTv, brush, cci, circle, createDataLoader, eightWaves, elliottWave, fibRetracement, fibonacciCircle, fibonacciExtension, fibonacciSegment, fibonacciSpeedResistanceFan, fibonacciSpiral, fiveWaves, gannBox, gannFan, hma, ichimoku, longPosition, maRibbon, macdTv, measure, parallelChannel, parallelogram, pivotPoints, ray, rect, rsiTv, shortPosition, stochastic, superTrend, threeWaves, triangle, useAlerts, useAnnotations, useChartAxes, useCompare, useCrosshair, useDataExport, useDrawingTools, useFullscreen, useHotkeys, useIndicators, useKlinechartsUI, useKlinechartsUILoading, useKlinechartsUISettings, useKlinechartsUITheme, useLayoutManager, useMeasure, useOrderLines, usePeriods, useReplay, useScreenshot, useScriptEditor, useSymbolSearch, useTimezone, useUndoRedo, useWatchlist, vwap, xabcd };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { registerExtensions, TA_default } from './chunk-DTBNTO4M.js';
2
- export { TA_default as TA, abcd_default as abcd, anyWaves_default as anyWaves, arrow_default as arrow, bollTv_default as bollTv, brush_default as brush, cci_default as cci, circle_default as circle, depthOverlay_default as depthOverlay, eightWaves_default as eightWaves, elliottWave_default as elliottWave, fibRetracement_default as fibRetracement, fibonacciCircle_default as fibonacciCircle, fibonacciExtension_default as fibonacciExtension, fibonacciSegment_default as fibonacciSegment, fibonacciSpeedResistanceFan_default as fibonacciSpeedResistanceFan, fibonacciSpiral_default as fibonacciSpiral, fiveWaves_default as fiveWaves, gannBox_default as gannBox, gannFan_default as gannFan, hma_default as hma, ichimoku_default as ichimoku, indicators, longPosition_default as longPosition, maRibbon_default as maRibbon, macdTv_default as macdTv, measure_default as measure, orderLine_default as orderLine, overlays, parallelChannel_default as parallelChannel, parallelogram_default as parallelogram, pivotPoints_default as pivotPoints, ray_default as ray, rect_default as rect, registerExtensions, rsiTv_default as rsiTv, shortPosition_default as shortPosition, stochastic_default as stochastic, superTrend_default as superTrend, threeWaves_default as threeWaves, triangle_default as triangle, vwap_default as vwap, xabcd_default as xabcd } from './chunk-DTBNTO4M.js';
1
+ import { registerExtensions, TA_default, ensureAlertLineRegistered } from './chunk-MVD3ILJT.js';
2
+ export { TA_default as TA, abcd_default as abcd, alertLine_default as alertLine, anyWaves_default as anyWaves, arrow_default as arrow, bollTv_default as bollTv, brush_default as brush, cci_default as cci, circle_default as circle, depthOverlay_default as depthOverlay, eightWaves_default as eightWaves, elliottWave_default as elliottWave, fibRetracement_default as fibRetracement, fibonacciCircle_default as fibonacciCircle, fibonacciExtension_default as fibonacciExtension, fibonacciSegment_default as fibonacciSegment, fibonacciSpeedResistanceFan_default as fibonacciSpeedResistanceFan, fibonacciSpiral_default as fibonacciSpiral, fiveWaves_default as fiveWaves, gannBox_default as gannBox, gannFan_default as gannFan, hma_default as hma, ichimoku_default as ichimoku, indicators, longPosition_default as longPosition, maRibbon_default as maRibbon, macdTv_default as macdTv, measure_default as measure, orderLine_default as orderLine, overlays, parallelChannel_default as parallelChannel, parallelogram_default as parallelogram, pivotPoints_default as pivotPoints, ray_default as ray, rect_default as rect, registerExtensions, rsiTv_default as rsiTv, shortPosition_default as shortPosition, stochastic_default as stochastic, superTrend_default as superTrend, threeWaves_default as threeWaves, triangle_default as triangle, vwap_default as vwap, xabcd_default as xabcd } from './chunk-MVD3ILJT.js';
3
3
  import { createContext, useContext, useReducer, useRef, useCallback, useEffect, useMemo, useState } from 'react';
4
- import { registerOverlay, registerIndicator } from 'react-klinecharts';
4
+ import { registerOverlay, registerHotkey, getHotkey, getSupportedHotkeys, registerIndicator } from 'react-klinecharts';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  var KlinechartsUIStateContext = createContext(null);
@@ -1677,6 +1677,53 @@ function useScreenshot() {
1677
1677
  clear
1678
1678
  };
1679
1679
  }
1680
+ function useHotkeys() {
1681
+ const { state } = useKlinechartsUI();
1682
+ const registerHotkey$1 = useCallback((template) => {
1683
+ registerHotkey(template);
1684
+ }, []);
1685
+ const getHotkey$1 = useCallback(
1686
+ (name) => getHotkey(name) ?? null,
1687
+ []
1688
+ );
1689
+ const setHotkeysEnabled = useCallback(
1690
+ (enabled, exclude) => {
1691
+ state.chart?.setHotkey(
1692
+ exclude ? { enabled, exclude } : { enabled }
1693
+ );
1694
+ },
1695
+ [state.chart]
1696
+ );
1697
+ const getHotkeysConfig = useCallback(
1698
+ () => state.chart?.getHotkey() ?? null,
1699
+ [state.chart]
1700
+ );
1701
+ return {
1702
+ registerHotkey: registerHotkey$1,
1703
+ getHotkey: getHotkey$1,
1704
+ supportedHotkeys: getSupportedHotkeys(),
1705
+ setHotkeysEnabled,
1706
+ getHotkeysConfig
1707
+ };
1708
+ }
1709
+ function useChartAxes() {
1710
+ const { state } = useKlinechartsUI();
1711
+ const overrideXAxis = useCallback(
1712
+ (override) => {
1713
+ if (!state.chart) return;
1714
+ state.chart.overrideXAxis(override);
1715
+ },
1716
+ [state.chart]
1717
+ );
1718
+ const overrideYAxis = useCallback(
1719
+ (override) => {
1720
+ if (!state.chart) return;
1721
+ state.chart.overrideYAxis(override);
1722
+ },
1723
+ [state.chart]
1724
+ );
1725
+ return { overrideXAxis, overrideYAxis };
1726
+ }
1680
1727
  function useFullscreen() {
1681
1728
  const { fullscreenContainerRef } = useKlinechartsUIDispatch();
1682
1729
  const [isFullscreen, setIsFullscreen] = useState(false);
@@ -2665,29 +2712,30 @@ function useAlerts() {
2665
2712
  const { alertTriggeredListenerRef } = useKlinechartsUIDispatch();
2666
2713
  const alerts = state.alerts;
2667
2714
  const addAlert = useCallback(
2668
- (price, condition, message) => {
2715
+ (price, condition, message, extendData) => {
2669
2716
  const id = `alert_${++alertCounter}`;
2717
+ const precision = state.chart?.getSymbol()?.pricePrecision ?? 2;
2718
+ const resolvedExtendData = {
2719
+ ...extendData,
2720
+ text: extendData?.text ?? message ?? price.toFixed(precision)
2721
+ };
2670
2722
  const alert = {
2671
2723
  id,
2672
2724
  price,
2673
2725
  condition,
2674
2726
  message,
2675
- triggered: false
2727
+ triggered: false,
2728
+ extendData: resolvedExtendData
2676
2729
  };
2677
2730
  dispatch({ type: "SET_ALERTS", alerts: [...state.alerts, alert] });
2678
2731
  if (state.chart) {
2732
+ ensureAlertLineRegistered();
2679
2733
  state.chart.createOverlay({
2680
- name: "horizontalStraightLine",
2734
+ name: "alertLine",
2681
2735
  id,
2682
2736
  groupId: "price_alerts",
2683
2737
  points: [{ value: price }],
2684
- styles: {
2685
- line: {
2686
- style: "dashed",
2687
- color: "#ff9800",
2688
- size: 1
2689
- }
2690
- },
2738
+ extendData: resolvedExtendData,
2691
2739
  lock: true
2692
2740
  });
2693
2741
  }
@@ -3372,6 +3420,6 @@ function createDataLoader(datafeed, dispatch) {
3372
3420
  };
3373
3421
  }
3374
3422
 
3375
- export { CANDLE_TYPES, COMPARE_RULES, DEFAULT_PERIODS, DRAWING_CATEGORIES, INDICATOR_PARAMS, KlinechartsUIDispatchContext, KlinechartsUIProvider, KlinechartsUIStateContext, MAIN_INDICATORS, PRICE_AXIS_TYPES, SUB_INDICATORS, TIMEZONES, TOOLTIP_SHOW_RULES, YAXIS_POSITIONS, createDataLoader, useAlerts, useAnnotations, useCompare, useCrosshair, useDataExport, useDrawingTools, useFullscreen, useIndicators, useKlinechartsUI, useKlinechartsUILoading, useKlinechartsUISettings, useKlinechartsUITheme, useLayoutManager, useMeasure, useOrderLines, usePeriods, useReplay, useScreenshot, useScriptEditor, useSymbolSearch, useTimezone, useUndoRedo, useWatchlist };
3423
+ export { CANDLE_TYPES, COMPARE_RULES, DEFAULT_PERIODS, DRAWING_CATEGORIES, INDICATOR_PARAMS, KlinechartsUIDispatchContext, KlinechartsUIProvider, KlinechartsUIStateContext, MAIN_INDICATORS, PRICE_AXIS_TYPES, SUB_INDICATORS, TIMEZONES, TOOLTIP_SHOW_RULES, YAXIS_POSITIONS, createDataLoader, useAlerts, useAnnotations, useChartAxes, useCompare, useCrosshair, useDataExport, useDrawingTools, useFullscreen, useHotkeys, useIndicators, useKlinechartsUI, useKlinechartsUILoading, useKlinechartsUISettings, useKlinechartsUITheme, useLayoutManager, useMeasure, useOrderLines, usePeriods, useReplay, useScreenshot, useScriptEditor, useSymbolSearch, useTimezone, useUndoRedo, useWatchlist };
3376
3424
  //# sourceMappingURL=index.js.map
3377
3425
  //# sourceMappingURL=index.js.map