@rfkit/charts 1.10.12 → 1.11.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.
Files changed (87) hide show
  1. package/README.md +7 -30
  2. package/charts/Spectrum/Chart.d.ts +1 -0
  3. package/components/AxisY/spectrum/tools.d.ts +0 -6
  4. package/components/AxisY/spectrum/useRanging/index.d.ts +2 -2
  5. package/components/AxisY/spectrum/useRanging/ranging.d.ts +2 -30
  6. package/components/AxisY/spectrum/useRanging/tools.d.ts +0 -15
  7. package/components/Cursor/tools.d.ts +0 -6
  8. package/components/DragSelectBox/index.d.ts +0 -4
  9. package/components/EventBus/tools.d.ts +0 -29
  10. package/components/Toolbar/primitives/styles.d.ts +10 -10
  11. package/components/Zoom/tools.d.ts +5 -0
  12. package/components/ui/button.d.ts +4 -4
  13. package/components/ui/panel.d.ts +2 -2
  14. package/config/constants.d.ts +0 -2
  15. package/config/setting.d.ts +1 -27
  16. package/hooks/data/index.d.ts +0 -3
  17. package/hooks/index.d.ts +0 -3
  18. package/hooks/publish/index.d.ts +0 -3
  19. package/hooks/spectrum/index.d.ts +1 -3
  20. package/hooks/spectrum/useTouchMode.d.ts +1 -0
  21. package/hooks/useChart/index.d.ts +0 -4
  22. package/hooks/useChartComponent.d.ts +0 -6
  23. package/hooks/useDragSelect.d.ts +0 -7
  24. package/hooks/useModuleSubscription.d.ts +0 -50
  25. package/hooks/useSeriesManager/index.d.ts +0 -4
  26. package/hooks/useSeriesManager/useFilteredSeries.d.ts +1 -9
  27. package/hooks/useSeriesManager/useSeriesManager.d.ts +0 -18
  28. package/index.d.ts +1 -3
  29. package/index.js +62 -31109
  30. package/index.js.LICENSE.txt +1 -1
  31. package/modules/Dial/render.d.ts +0 -3
  32. package/modules/Fluorescence/render.d.ts +0 -3
  33. package/modules/Gauge/render.d.ts +0 -9
  34. package/modules/Heatmap/Capture/sliderInfo.d.ts +3 -6
  35. package/modules/Heatmap/render.d.ts +0 -3
  36. package/modules/SpatialSpectrum/render.d.ts +0 -3
  37. package/modules/Spectrum/AxisYCanvas/layout.d.ts +2 -2
  38. package/modules/Spectrum/FrequencyAllocation/tools.d.ts +0 -23
  39. package/modules/Spectrum/Markers/hooks/useMarkers.d.ts +2 -19
  40. package/modules/Spectrum/Markers/tools.d.ts +0 -3
  41. package/modules/Spectrum/Signal/Switch/index.d.ts +0 -5
  42. package/modules/Spectrum/Signal/metadata/level.d.ts +1 -9
  43. package/modules/Spectrum/Signal/metadata/signalType.d.ts +5 -8
  44. package/modules/Spectrum/Signal/model/match.d.ts +0 -1
  45. package/modules/Spectrum/Signal/model/resolver.d.ts +1 -1
  46. package/modules/Spectrum/Signal/model/tree.d.ts +0 -30
  47. package/modules/Spectrum/Signal/tools.d.ts +0 -8
  48. package/modules/Spectrum/Signal/useSignalDataManager.d.ts +0 -5
  49. package/modules/Spectrum/TouchBus/index.d.ts +6 -0
  50. package/modules/Spectrum/index.d.ts +1 -0
  51. package/modules/Spectrum/useSpectrumAnalyzer/useTemplateComparison.d.ts +1 -5
  52. package/modules/base/BaseRenderer.d.ts +0 -89
  53. package/modules/base/CircularRenderer.d.ts +1 -29
  54. package/modules/base/GradientRenderer.d.ts +0 -25
  55. package/modules/base/IQRenderer.d.ts +0 -21
  56. package/modules/base/index.d.ts +0 -3
  57. package/package.json +1 -1
  58. package/runtime/interaction/index.d.ts +4 -2
  59. package/runtime/passThrough.d.ts +1 -1
  60. package/store/Params.d.ts +0 -7
  61. package/store/bandState.d.ts +0 -4
  62. package/store/defaultState.d.ts +0 -4
  63. package/store/globalState.d.ts +0 -9
  64. package/store/hooks/useStore.d.ts +0 -9
  65. package/theme/style-scope.d.ts +11 -11
  66. package/theme/theme-color.d.ts +0 -1
  67. package/theme/theme-contract.d.ts +4 -4
  68. package/theme/theme-tokens.d.ts +36 -36
  69. package/types/publish.d.ts +1 -3
  70. package/types/store/index.d.ts +0 -12
  71. package/types/store/marker.d.ts +5 -5
  72. package/types/store/signal.d.ts +1 -2
  73. package/types/store/ui.d.ts +3 -8
  74. package/types/store.d.ts +0 -12
  75. package/utils/array.d.ts +0 -18
  76. package/utils/cursor.d.ts +1 -1
  77. package/utils/frequency.d.ts +0 -48
  78. package/utils/frequencyCalculation.d.ts +0 -139
  79. package/utils/index.d.ts +0 -9
  80. package/utils/object.d.ts +0 -9
  81. package/utils/series/events.d.ts +7 -29
  82. package/utils/series/index.d.ts +0 -53
  83. package/utils/series/modes.d.ts +0 -25
  84. package/utils/series/subscription.d.ts +0 -30
  85. package/utils/subscription.d.ts +0 -5
  86. package/utils/throttle.d.ts +0 -26
  87. package/utils/time.d.ts +0 -20
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license lucide-react v0.577.0 - ISC
2
+ * @license lucide-react v1.31.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
@@ -1,6 +1,3 @@
1
- /**
2
- * Dial 渲染器
3
- */
4
1
  import { Dial } from '@rfkit/renderer';
5
2
  import { CircularRenderer, type CircularRenderState } from '../base';
6
3
  type DialRenderState = CircularRenderState<Dial>;
@@ -1,6 +1,3 @@
1
- /**
2
- * Fluorescence 渲染器
3
- */
4
1
  import { Fluorescence as Chart, type FluorescenceRenderMode } from '@rfkit/renderer';
5
2
  import { GradientRenderer, type GradientRenderState } from '../base';
6
3
  interface FluorescenceData {
@@ -1,6 +1,3 @@
1
- /**
2
- * Gauge 渲染器
3
- */
4
1
  import { Gauge } from '@rfkit/renderer';
5
2
  import { BaseRenderer, type BaseRenderState } from '../base';
6
3
  interface GaugeData {
@@ -14,12 +11,6 @@ interface GaugeRenderProps {
14
11
  interface GaugeRenderState extends BaseRenderState<Gauge> {
15
12
  props: GaugeRenderProps;
16
13
  }
17
- /**
18
- * Gauge 渲染器
19
- *
20
- * 由于 Gauge 有额外的 props 透传和 updateProps 方法,
21
- * 不完全继承 CircularRenderer,而是直接继承 BaseRenderer
22
- */
23
14
  export default class GaugeRender extends BaseRenderer<Gauge, GaugeRenderState, GaugeData> {
24
15
  constructor(props: GaugeRenderProps);
25
16
  protected init(): void;
@@ -2,11 +2,8 @@ import type { TimestampedFloat32Array, WaterfallSnapshot } from '@rfkit/spectrum
2
2
  import type { AxisXProps, HeatmapSlider2DData, SegmentsType } from '../../../types';
3
3
  import { type HeatmapContinuousSourceRange, type HeatmapSourceRange } from '../viewport.ts';
4
4
  export interface HeatmapSliderSelection {
5
- /** 业务频率。外部输入保持原值,指针交互按 axisX.frequencyFormat 解析。 */
6
5
  frequency: readonly [start: number, end: number] | null;
7
- /** 相对完整频率域的连续位置,不受瀑布矩阵列密度影响。 */
8
6
  x: readonly [start: number, end: number];
9
- /** 完整瀑布源数据中的连续行边界。 */
10
7
  y: readonly [start: number, end: number];
11
8
  }
12
9
  export type HeatmapSliderDragType = 'top' | 'bottom' | 'left' | 'right' | 'middle';
@@ -27,19 +24,19 @@ interface SliderInfoParams {
27
24
  waterfallSnapshot: Readonly<WaterfallSnapshot> | null;
28
25
  }
29
26
  export declare const resolveHeatmapSliderFrequencyRatioRange: ({ frequencyFormat, frequencyRange, segments }: {
30
- frequencyFormat: AxisXProps["frequencyFormat"];
27
+ frequencyFormat: AxisXProps['frequencyFormat'];
31
28
  frequencyRange: readonly [start: number, end: number];
32
29
  segments?: SegmentsType;
33
30
  }) => readonly [start: number, end: number] | null;
34
31
  export declare const resolveHeatmapSliderSelectionFromRect: ({ frequencyFormat, rect, segments, waterfallSnapshot }: {
35
- frequencyFormat: AxisXProps["frequencyFormat"];
32
+ frequencyFormat: AxisXProps['frequencyFormat'];
36
33
  rect: HeatmapSliderRect;
37
34
  segments?: SegmentsType;
38
35
  waterfallSnapshot: Readonly<WaterfallSnapshot>;
39
36
  }) => HeatmapSliderSelection | null;
40
37
  export declare const resolveHeatmapSliderSelectionFromInteraction: ({ dragType, frequencyFormat, rect, segments, startSelection, waterfallSnapshot }: {
41
38
  dragType: HeatmapSliderDragType;
42
- frequencyFormat: AxisXProps["frequencyFormat"];
39
+ frequencyFormat: AxisXProps['frequencyFormat'];
43
40
  rect: HeatmapSliderRect;
44
41
  segments?: SegmentsType;
45
42
  startSelection: Readonly<HeatmapSliderSelection> | null;
@@ -1,6 +1,3 @@
1
- /**
2
- * Heatmap 渲染器
3
- */
4
1
  import { type IHeatmap } from '@rfkit/renderer';
5
2
  import { GradientRenderer, type GradientRenderState } from '../base';
6
3
  interface HeatmapRenderProps {
@@ -1,6 +1,3 @@
1
- /**
2
- * SpatialSpectrum (Radar) 渲染器
3
- */
4
1
  import { Radar } from '@rfkit/renderer';
5
2
  import { CircularRenderer, type CircularRenderState } from '../base';
6
3
  type SpatialSpectrumRenderState = CircularRenderState<Radar>;
@@ -9,7 +9,7 @@ export declare const resolveAxisYCanvasHorizontalLayout: ({ axisLineWidth, insid
9
9
  majorTickStartX: number;
10
10
  minorTickEndX: number;
11
11
  minorTickStartX: number;
12
- textAlign: "left";
12
+ textAlign: 'left';
13
13
  textX: number;
14
14
  } | {
15
15
  axisX: number;
@@ -17,7 +17,7 @@ export declare const resolveAxisYCanvasHorizontalLayout: ({ axisLineWidth, insid
17
17
  majorTickStartX: number;
18
18
  minorTickEndX: number;
19
19
  minorTickStartX: number;
20
- textAlign: "right";
20
+ textAlign: 'right';
21
21
  textX: number;
22
22
  };
23
23
  export {};
@@ -1,30 +1,7 @@
1
1
  import type { FrequencyAllocationChannel, FrequencyAllocationItem } from '../../../types';
2
- /**
3
- * 从本地缓存读取FrequencyAllocation数据
4
- * @returns FrequencyAllocationItem数组或null
5
- */
6
2
  export declare const getFrequencyAllocationFromCache: () => FrequencyAllocationItem[] | null;
7
- /**
8
- * 从本地缓存读取多通道FrequencyAllocation数据
9
- * @returns FrequencyAllocationChannel数组或null
10
- */
11
3
  export declare const getFrequencyAllocationChannelsFromCache: () => FrequencyAllocationChannel[] | null;
12
- /**
13
- * 将FrequencyAllocation数据保存到本地缓存
14
- * @param data FrequencyAllocationItem数组
15
- */
16
4
  export declare const setFrequencyAllocationToCache: (data: FrequencyAllocationItem[]) => void;
17
- /**
18
- * 将多通道FrequencyAllocation数据保存到本地缓存
19
- * @param channels FrequencyAllocationChannel数组
20
- */
21
5
  export declare const setFrequencyAllocationChannelsToCache: (channels: FrequencyAllocationChannel[]) => void;
22
- /**
23
- * 清除本地缓存的FrequencyAllocation数据
24
- */
25
6
  export declare const clearFrequencyAllocationCache: () => void;
26
- /**
27
- * 检查本地缓存是否存在FrequencyAllocation数据
28
- * @returns boolean
29
- */
30
7
  export declare const hasFrequencyAllocationCache: () => boolean;
@@ -1,20 +1,3 @@
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
- */
18
1
  import { MarkerEventType } from '../../../../config';
19
2
  import type { MarkerType, SetMarker } from '../../../../types';
20
3
  interface UseMarkersProps {
@@ -59,10 +42,10 @@ export declare const useMarkers: (props: UseMarkersProps) => {
59
42
  resetHover: () => void;
60
43
  toggleMainSecondaryPeaks: () => void;
61
44
  toggleMainPeak: () => void;
62
- moveToAdjacentPeak: (direction: "left" | "right", markerId: string) => void;
45
+ moveToAdjacentPeak: (direction: 'left' | 'right', markerId: string) => void;
63
46
  findMainPeak: (markerId: string) => void;
64
47
  findSecondaryPeak: (markerId: string) => void;
65
- moveToStep: (direction: "left" | "right", markerId: string) => void;
48
+ moveToStep: (direction: 'left' | 'right', markerId: string) => void;
66
49
  createMainPeakMarker: () => void;
67
50
  createSecondaryPeakMarker: () => void;
68
51
  setState: import("react").Dispatch<import("react").SetStateAction<MarkerState>>;
@@ -1,7 +1,4 @@
1
1
  import type { MarkerType, RecursiveFunction, SegmentsType, SetMarker } from '../../../types';
2
- /**
3
- * Marker 工具函数集合 - 精简版
4
- */
5
2
  export declare const MARKER_UPDATE_ATTRIBUTE: (id: string, func?: RecursiveFunction<[SetMarker]>) => (...args: any[]) => void;
6
3
  export declare const MARKER_UPDATE_RESET: (id: string, func?: RecursiveFunction) => (...args: any[]) => void;
7
4
  export declare const MARKER_COUNT_CHANGE: (id: string, func?: RecursiveFunction<[{
@@ -1,8 +1,3 @@
1
1
  import type React from 'react';
2
- /**
3
- * Signal 开关组件
4
- * 控制 signal 的显示状态,并组合为“总开关 + 树形筛选”:
5
- * 台站库/信号库 → 信号类型 → 信号等级。
6
- */
7
2
  declare const Switch: React.FC;
8
3
  export default Switch;
@@ -8,17 +8,9 @@ export interface SignalLevelMeta {
8
8
  }
9
9
  export declare const SIGNAL_LEVEL_ORDER: readonly [-1, 0, 1, 2];
10
10
  export declare const SIGNAL_LEVEL_MAP: Record<number, SignalLevelMeta>;
11
- /**
12
- * 等级规范化:-1/0/1/2 分别对应未分配/一级/二级/三级;
13
- * 缺失、非整数或不在集合内的值统一归为 -1(未分配)
14
- */
15
11
  export declare const normalizeSignalLevel: (value: unknown) => number;
16
- /**
17
- * 颜色解析:外部显式 color 优先;信号库合法类型使用等级色,
18
- * 台站库与信号库其他类型均使用类型色。
19
- */
20
12
  export declare const resolveSignalColor: (item: {
21
- source: "station" | "simple";
13
+ source: 'station' | 'simple';
22
14
  color?: string;
23
15
  level?: number;
24
16
  signalType?: string;
@@ -1,9 +1,9 @@
1
1
  export declare const SignalType: {
2
- readonly LEGITIMATE: "Legitimate";
3
- readonly UNKNOWN: "UnKnown";
4
- readonly KNOWN: "Know";
5
- readonly VIOLATION: "Violation";
6
- readonly ILLEGAL: "Illegal";
2
+ readonly LEGITIMATE: 'Legitimate';
3
+ readonly UNKNOWN: 'UnKnown';
4
+ readonly KNOWN: 'Know';
5
+ readonly VIOLATION: 'Violation';
6
+ readonly ILLEGAL: 'Illegal';
7
7
  };
8
8
  export type SignalType = (typeof SignalType)[keyof typeof SignalType];
9
9
  export interface SignalTypeMeta {
@@ -14,8 +14,5 @@ export interface SignalTypeMeta {
14
14
  export declare const SIGNAL_TYPE_MAP: Record<string, SignalTypeMeta>;
15
15
  export type SignalTypeKey = keyof typeof SIGNAL_TYPE_MAP;
16
16
  export declare const SIGNAL_TYPE_ORDER: SignalTypeKey[];
17
- /**
18
- * 类型规范化:缺失或无法识别的类型统一归入 UnKnown
19
- */
20
17
  export declare const normalizeSignalType: (value: unknown) => SignalTypeKey;
21
18
  export declare const signalTypeMap: Record<string, SignalTypeMeta>;
@@ -6,7 +6,6 @@ export interface SignalMatchCandidate {
6
6
  startIndex: number;
7
7
  stopIndex: number;
8
8
  }
9
- /** 将统一信号转换为频率范围输入(兼容 string | number)。 */
10
9
  export declare function toFrequencyRangeInput(item: UnifiedSignalItem): FrequencyRangeInput;
11
10
  export declare function resolveBestSignalMatch<T extends SignalMatchCandidate>(candidates: T[], options: {
12
11
  currentFrequency: number;
@@ -18,7 +18,7 @@ export interface SignalSegmentData {
18
18
  activeSignalKey?: string;
19
19
  style: CSSProperties;
20
20
  }
21
- export declare const resolveSignalPresentation: (item: UnifiedSignalItem) => Pick<SignalPosition, "color" | "tooltip">;
21
+ export declare const resolveSignalPresentation: (item: UnifiedSignalItem) => Pick<SignalPosition, 'color' | 'tooltip'>;
22
22
  export declare const resolveSignalMatchCandidates: (signalItems: UnifiedSignalItem[], segment: SegmentType) => SignalMatchCandidate[];
23
23
  export declare const resolveSignalPositions: (signalItems: UnifiedSignalItem[], segment: SegmentType) => SignalPosition[];
24
24
  export declare const resolveSignalSegments: ({ segments, signalItems, isCursorActive, currentFrequency, currentPosition }: {
@@ -1,26 +1,12 @@
1
1
  import type { StationInfoType } from '../../../../types';
2
2
  import type { SignalData } from '../../../../types/store';
3
- /**
4
- * 统一的信号数据类型(兼容 StationInfo 和 SignalData)
5
- * 与 utils.ts 保持同一类型,此处作为树形筛选的独立纯函数模块载体
6
- */
7
3
  export type UnifiedSignalItem = StationInfoType | SignalData;
8
4
  export type SignalSource = 'station' | 'simple';
9
5
  export declare const SIGNAL_SOURCE_ORDER: SignalSource[];
10
6
  export declare const SIGNAL_SOURCE_LABEL: Record<SignalSource, string>;
11
- /**
12
- * 判断是否为完整的台站信息
13
- */
14
7
  export declare function isStationInfo(item: UnifiedSignalItem): item is StationInfoType;
15
8
  export declare const resolveSignalSource: (item: UnifiedSignalItem) => SignalSource;
16
- /**
17
- * 叶子键:source:signalType:level(类型与等级均为规范化后的值)
18
- */
19
9
  export declare const getSignalLeafKey: (item: UnifiedSignalItem) => string;
20
- /**
21
- * 统一渲染键始终带来源前缀:优先使用业务 id;无 id 时回退名称/频率范围,
22
- * 避免缺省数据在台站库和信号库之间产生 React 重复键。
23
- */
24
10
  export declare function getUnifiedSignalKey(item: UnifiedSignalItem): string;
25
11
  export interface SignalTreeLevelNode {
26
12
  level: number;
@@ -52,24 +38,8 @@ export interface SignalTreeSourceNode {
52
38
  export interface SignalTree {
53
39
  sources: SignalTreeSourceNode[];
54
40
  }
55
- /**
56
- * 从未过滤的统一信号数据构建数据驱动的树目录。
57
- * 来源与类型按固定顺序排列,但没有实际数据的节点不进入目录;
58
- * 台站库是独立来源,不继续展开类型和等级。
59
- */
60
41
  export declare const buildSignalTree: (signalItems: UnifiedSignalItem[]) => SignalTree;
61
42
  export type SignalNodeCheckState = 'checked' | 'indeterminate' | 'unchecked' | 'disabled';
62
- /**
63
- * 父节点依据当前有数据的后代计算:
64
- * 全部可见 checked、部分可见 indeterminate、全部隐藏 unchecked、没有可用后代 disabled。
65
- */
66
43
  export declare const resolveNodeCheckState: (leafKeysWithData: ReadonlySet<string>, hiddenCategoryKeys: ReadonlySet<string>, fixedLeafKeys: string[]) => SignalNodeCheckState;
67
- /**
68
- * 级联选择:取消父节点时记录其完整固定后代,使后续出现的数据仍遵循用户选择。
69
- * 全部数据后代可见时取消父节点(隐藏完整固定后代);否则恢复全部固定后代可见。
70
- */
71
44
  export declare const toggleNodeHiddenKeys: (hiddenCategoryKeys: string[], fixedLeafKeys: string[], leafKeysWithData: ReadonlySet<string>) => string[];
72
- /**
73
- * 隐藏集合过滤:默认全部显示,命中隐藏叶子键的条目被剔除。
74
- */
75
45
  export declare const filterSignalItemsByHiddenKeys: (signalItems: UnifiedSignalItem[], hiddenCategoryKeys: string[]) => UnifiedSignalItem[];
@@ -1,11 +1,3 @@
1
1
  import type { RecursiveFunction, StationInfoType } from '../../../types';
2
- /**
3
- * 台站数据更新订阅管理器
4
- * 用于通知组件台站数据已更新,触发重新渲染
5
- */
6
2
  export declare const withStationDataUpdate: (globalID: string, name?: string, func?: RecursiveFunction) => (...args: any[]) => void;
7
- /**
8
- * 全局台站信号数据存储
9
- * 用于在全局 openData 中存储和读取台站信号信息
10
- */
11
3
  export declare const STATION_DATA: (globalID: string, data?: StationInfoType[]) => StationInfoType[];
@@ -1,9 +1,4 @@
1
1
  import type { SignalData, SignalDataType, StationInfoType } from '../../../types';
2
- /**
3
- * Signal 数据管理 Hook
4
- * - 台站信息 → 全局 openData(通过 STATION_DATA)
5
- * - 简单信号 → store.signal.signalData
6
- */
7
2
  export declare function useSignalDataManager(): {
8
3
  updateSignalData: (params: {
9
4
  type: SignalDataType;
@@ -0,0 +1,6 @@
1
+ import type React from 'react';
2
+ interface Props {
3
+ id: string;
4
+ }
5
+ declare const TouchBus: React.FC<Props>;
6
+ export default TouchBus;
@@ -2,6 +2,7 @@ import type React from 'react';
2
2
  import { type ReactNode } from 'react';
3
3
  interface Props {
4
4
  children?: ReactNode;
5
+ touch?: boolean;
5
6
  }
6
7
  declare const Spectrum: React.FC<Props>;
7
8
  export default Spectrum;
@@ -1,8 +1,4 @@
1
1
  import type { SpectrumOutputData } from '@rfkit/spectrum-analyzer';
2
- /**
3
- * 模板数据比较 Hook
4
- * 用于处理模板超出数据的转换
5
- */
6
2
  export default function useTemplateComparison(): {
7
- updateTemplateOverData: (templateOverData: SpectrumOutputData["templateOverData"]) => void;
3
+ updateTemplateOverData: (templateOverData: SpectrumOutputData['templateOverData']) => void;
8
4
  };
@@ -1,11 +1,3 @@
1
- /**
2
- * 渲染器抽象基类
3
- *
4
- * 提供统一的生命周期管理和资源清理机制
5
- */
6
- /**
7
- * 渲染器接口
8
- */
9
1
  export interface IRenderer<TData = unknown> {
10
2
  updateSeries(data: TData): void;
11
3
  reset(): void;
@@ -13,18 +5,11 @@ export interface IRenderer<TData = unknown> {
13
5
  clear(): void;
14
6
  destroy(): void;
15
7
  }
16
- /**
17
- * 基础渲染状态
18
- * 添加索引签名以兼容 RenderChartType.state
19
- */
20
8
  export interface BaseRenderState<TChart = unknown> {
21
9
  id: string;
22
10
  chart: TChart | null;
23
11
  [key: string]: unknown;
24
12
  }
25
- /**
26
- * 具有 resize/clear/draw 方法的图表接口
27
- */
28
13
  interface ChartLike {
29
14
  resize?: () => void;
30
15
  clear?: () => void;
@@ -33,114 +18,40 @@ interface ChartLike {
33
18
  dispose?: () => void;
34
19
  }
35
20
  type RendererCleanup = () => void;
36
- /**
37
- * 渲染器抽象基类
38
- *
39
- * @template TChart - 内部图表引擎类型
40
- * @template TState - 渲染器状态类型
41
- * @template TData - 数据类型
42
- */
43
21
  export declare abstract class BaseRenderer<TChart extends ChartLike, TState extends BaseRenderState<TChart> = BaseRenderState<TChart>, TData = unknown> implements IRenderer<TData> {
44
- /** 公开 state 以兼容 RenderChartType 接口 */
45
22
  state: TState;
46
23
  protected resizeTimer: ReturnType<typeof setTimeout> | null;
47
24
  protected resizeObserver: ResizeObserver | null;
48
25
  private destroyed;
49
26
  private cleanupTasks;
50
27
  constructor(initialState: TState);
51
- /**
52
- * 初始化图表引擎(子类必须实现)
53
- */
54
28
  protected abstract init(): void;
55
- /**
56
- * 更新数据(子类必须实现)
57
- */
58
29
  abstract updateSeries(data: TData): void;
59
- /**
60
- * 更新运行时参数
61
- */
62
30
  updateParams(params: Partial<TState>): void;
63
- /**
64
- * 参数更新后的钩子,为子类提供 hook
65
- */
66
31
  protected onParamsUpdated(_params: Partial<TState>): void;
67
- /**
68
- * 重置(清空 + 调整大小)
69
- */
70
32
  reset(): void;
71
- /**
72
- * 调整大小
73
- */
74
33
  resize(): void;
75
- /**
76
- * 清空图表
77
- */
78
34
  clear(): void;
79
- /**
80
- * 销毁资源
81
- */
82
35
  destroy(): void;
83
- /**
84
- * dispose 别名,兼容 RenderChartType 接口
85
- */
86
36
  dispose(): (() => void) | undefined;
87
- /**
88
- * 延迟调整大小(用于初始化后的首次 resize)
89
- */
90
37
  protected scheduleResize(delay?: number): void;
91
- /**
92
- * 清理 resize 定时器
93
- */
94
38
  protected clearResizeTimer(): void;
95
- /**
96
- * 注册统一 cleanup,由基类在 destroy 时回收
97
- */
98
39
  protected trackCleanup(cleanup?: RendererCleanup | null): (() => void) | null;
99
- /**
100
- * 获取图表容器元素
101
- */
102
40
  protected getContainerElement(): HTMLElement | null;
103
- /**
104
- * 获取图表容器当前尺寸
105
- */
106
41
  protected getContainerSize(): {
107
42
  width: number;
108
43
  height: number;
109
44
  } | null;
110
- /**
111
- * 子类可覆盖最小可绘制尺寸
112
- */
113
45
  protected getMinimumContainerSize(): {
114
46
  width: number;
115
47
  height: number;
116
48
  };
117
- /**
118
- * 当前容器尺寸是否足以安全触发 renderer 绘制
119
- */
120
49
  protected hasRenderableContainerSize(): boolean;
121
- /**
122
- * 监听图表容器尺寸,避免只靠初始化阶段的一次性 resize
123
- */
124
50
  protected observeContainerResize(): void;
125
- /**
126
- * 清理容器尺寸监听
127
- */
128
51
  protected clearResizeObserver(): void;
129
- /**
130
- * 清理统一注册的 cleanup 任务
131
- */
132
52
  protected runCleanupTasks(): void;
133
- /**
134
- * 销毁前钩子,子类可覆盖
135
- */
136
53
  protected beforeDestroy(): void;
137
- /**
138
- * 释放底层 chart 实例,避免 renderer 引擎残留监听和 canvas/WebGL 资源
139
- */
140
54
  protected disposeChartInstance(): void;
141
- /**
142
- * 在容器尺寸满足条件后再初始化 chart,避免 renderer 在错误尺寸下提前绘制
143
- */
144
55
  protected initializeChartWhenReady(): void;
145
56
  }
146
57
  export {};
@@ -1,28 +1,15 @@
1
- /**
2
- * 圆形图表渲染器基类
3
- *
4
- * 提供主题订阅功能,适用于 Dial、Radar(SpatialSpectrum)、Gauge 等圆形图表
5
- */
6
1
  import { BaseRenderer, type BaseRenderState } from './BaseRenderer';
7
- /**
8
- * 圆形图表数据项
9
- */
10
2
  export interface CircularSeriesItem {
11
3
  value: number;
12
4
  color: string;
13
5
  lineWidth?: number;
14
6
  radio?: number;
15
7
  }
16
- /**
17
- * 雷达多边形数据项
18
- */
19
8
  export interface CircularPolygonItem {
20
9
  values: number[];
21
10
  color?: string;
11
+ showDots?: boolean;
22
12
  }
23
- /**
24
- * 圆形图表数据
25
- */
26
13
  export interface CircularData {
27
14
  series?: CircularSeriesItem[];
28
15
  range?: number[];
@@ -30,9 +17,6 @@ export interface CircularData {
30
17
  yawAngle?: number;
31
18
  isNorthFacing?: boolean;
32
19
  }
33
- /**
34
- * 具有 render/updateProps/draw 方法的圆形图表接口
35
- */
36
20
  interface CircularChartLike {
37
21
  resize?: () => void;
38
22
  clear?: () => void;
@@ -40,27 +24,15 @@ interface CircularChartLike {
40
24
  updateProps?: (props: Record<string, unknown>) => void;
41
25
  render?: (data: CircularData) => void;
42
26
  }
43
- /**
44
- * 圆形渲染状态
45
- */
46
27
  export interface CircularRenderState<TChart extends CircularChartLike> extends BaseRenderState<TChart> {
47
28
  id: string;
48
29
  }
49
- /**
50
- * 圆形图表渲染器基类
51
- */
52
30
  export declare abstract class CircularRenderer<TChart extends CircularChartLike, TState extends CircularRenderState<TChart> = CircularRenderState<TChart>> extends BaseRenderer<TChart, TState, CircularData> {
53
31
  protected getMinimumContainerSize(): {
54
32
  width: number;
55
33
  height: number;
56
34
  };
57
- /**
58
- * 订阅主题变化
59
- */
60
35
  protected subscribeToTheme(): void;
61
- /**
62
- * 更新数据
63
- */
64
36
  updateSeries(data: CircularData): void;
65
37
  }
66
38
  export {};
@@ -1,42 +1,17 @@
1
- /**
2
- * 颜色梯度渲染器基类
3
- *
4
- * 提供颜色梯度管理功能,适用于 Heatmap、Fluorescence 等热力图类图表
5
- */
6
1
  import { hexToRGBA } from '@rfkit/renderer';
7
2
  import { BaseRenderer, type BaseRenderState } from './BaseRenderer';
8
- /**
9
- * 具有 updateProps/render 方法的梯度图表接口
10
- */
11
3
  interface GradientChartLike {
12
4
  resize?(): void;
13
5
  clear?(): void;
14
6
  updateProps?(props: Record<string, unknown>): void;
15
7
  render?(data: unknown): void;
16
8
  }
17
- /**
18
- * 梯度渲染状态
19
- */
20
9
  export interface GradientRenderState<TChart extends GradientChartLike> extends BaseRenderState<TChart> {
21
10
  globalID: string;
22
11
  }
23
- /**
24
- * 颜色梯度渲染器基类
25
- */
26
12
  export declare abstract class GradientRenderer<TChart extends GradientChartLike, TState extends GradientRenderState<TChart> = GradientRenderState<TChart>, TData = unknown> extends BaseRenderer<TChart, TState, TData> {
27
- /**
28
- * 获取初始颜色配置
29
- */
30
13
  protected getInitialColors(): ReturnType<typeof hexToRGBA>[];
31
- /**
32
- * 订阅颜色变化
33
- *
34
- * @param key - 订阅标识符
35
- */
36
14
  protected subscribeToColor(key: string): void;
37
- /**
38
- * 参数发生改变时调用
39
- */
40
15
  updateParams(params: Partial<TState>): void;
41
16
  }
42
17
  export {};
@@ -1,39 +1,18 @@
1
- /**
2
- * IQ 渲染器
3
- *
4
- * 合并 IQEye、IQStream、IQPlanisphere 三个渲染器
5
- * 通过 type 参数区分不同的渲染模式
6
- */
7
1
  import { IQ, IQEye } from '@rfkit/renderer';
8
2
  import { BaseRenderer, type BaseRenderState } from './BaseRenderer';
9
- /**
10
- * IQ 图表类型
11
- */
12
3
  export type IQChartType = 'iqEye' | 'iqLine' | 'iqPlanisphere' | 'iqStream';
13
- /**
14
- * IQ 渲染状态
15
- */
16
4
  interface IQRenderState extends BaseRenderState<IQ | IQEye> {
17
5
  type: IQChartType;
18
6
  }
19
- /**
20
- * IQ 渲染器属性
21
- */
22
7
  interface IQRenderProps {
23
8
  id: string;
24
9
  type: IQChartType;
25
10
  }
26
- /**
27
- * IQ 渲染器
28
- */
29
11
  export default class IQRenderer extends BaseRenderer<IQ | IQEye, IQRenderState, IQData> {
30
12
  constructor(props: IQRenderProps);
31
13
  protected init(): void;
32
14
  updateSeries(data: IQData): void;
33
15
  }
34
- /**
35
- * IQ 数据类型
36
- */
37
16
  export interface IQData {
38
17
  IData: number[];
39
18
  QData: number[];