@rfkit/charts 1.3.1 → 1.3.3

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.
@@ -1,3 +1,20 @@
1
+ /**
2
+ * 集成 @rfkit/spectrum-analyzer 的峰值检测能力
3
+ *
4
+ * 改造要点:
5
+ * 1. 优先使用 SpectrumAnalyzer 预处理好的峰值数据(realData.peaks.peaks)
6
+ * 2. 如果没有预处理数据,回退到本地计算(findTopPeaks/findMaxPeak)
7
+ * 3. 保持向后兼容,现有功能不受影响
8
+ *
9
+ * 性能提升:
10
+ * - 消除 updateByData 中的重复峰值计算(每次数据更新都调用)
11
+ * - 峰值检测在 SpectrumAnalyzer 的重采样过程中完成,零额外开销
12
+ *
13
+ * 数据来源:
14
+ * - realData.peaks.peaks[0] = 主峰
15
+ * - realData.peaks.peaks[1] = 次峰
16
+ * - realData.peaks.peaks[n] = 第 n+1 峰(可扩展)
17
+ */
1
18
  import { MarkerEventType } from '../../../config';
2
19
  import type { MarkerType, SetMarker } from '../../../types';
3
20
  interface UseMarkersProps {
@@ -41,7 +58,13 @@ export declare const useMarkers: (props: UseMarkersProps) => {
41
58
  }) => string;
42
59
  resetHover: () => void;
43
60
  toggleMainSecondaryPeaks: () => void;
61
+ toggleMainPeak: () => void;
44
62
  moveToAdjacentPeak: (direction: "left" | "right", markerId: string) => void;
63
+ findMainPeak: (markerId: string) => void;
64
+ findSecondaryPeak: (markerId: string) => void;
65
+ moveToStep: (direction: "left" | "right", markerId: string) => void;
66
+ createMainPeakMarker: () => void;
67
+ createSecondaryPeakMarker: () => void;
45
68
  setState: import("react").Dispatch<import("react").SetStateAction<MarkerState>>;
46
69
  };
47
70
  export {};
@@ -11,6 +11,8 @@ export declare const MARKER_SELECTION_CHANGE: (id: string, func?: RecursiveFunct
11
11
  selectedId: string | null;
12
12
  }]>) => (...args: any[]) => void;
13
13
  export type MarkerCommand = {
14
+ type: 'main-peak';
15
+ } | {
14
16
  type: 'main-secondary-peaks';
15
17
  } | {
16
18
  type: 'left-peak';
@@ -18,6 +20,18 @@ export type MarkerCommand = {
18
20
  } | {
19
21
  type: 'right-peak';
20
22
  selectedId: string;
23
+ } | {
24
+ type: 'find-main-peak';
25
+ selectedId: string;
26
+ } | {
27
+ type: 'find-secondary-peak';
28
+ selectedId: string;
29
+ } | {
30
+ type: 'create-main-peak';
31
+ } | {
32
+ type: 'create-secondary-peak';
33
+ } | {
34
+ type: 'clear-all';
21
35
  };
22
36
  export declare const MARKER_COMMAND: (id: string, func?: RecursiveFunction) => (...args: any[]) => void;
23
37
  export declare const leftDataSelectMax: (left: number, data: Float32Array) => number;
package/index.d.ts CHANGED
@@ -7,5 +7,5 @@ RecursiveObject, // 递归对象 后期会删除
7
7
  Render, Reset, SegmentsOriginal, SeriesConfig, SetAntennaFactor, SetChannels, SetMarker, SetSegments, SetSeries, SetSpectrumBandwidth, SpectrumBandwidth, SpectrumExtraData, StationInfoType } from './types';
8
8
  export { HeatmapCaptureType, MarkerMode } from './types';
9
9
  export { SignalDataType } from './types/store';
10
- export { formatFrequencyUnit, formatFrequencyUnitFromHz, formatFrequencyUnitFromMHz } from './utils';
11
10
  export type { FrequencyUnitResult } from './utils';
11
+ export { formatFrequencyUnit, formatFrequencyUnitFromHz, formatFrequencyUnitFromMHz } from './utils';