@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
package/README.md CHANGED
@@ -11,8 +11,6 @@
11
11
  pnpm add @rfkit/charts
12
12
  ```
13
13
 
14
- 正式版本由源码仓库内的 Release PR 自动发布到 npm;仓库里的本地 `publish:*` 脚本只作为维护调试或应急入口,不属于常规发布流程。
15
-
16
14
  ## 发布入口
17
15
 
18
16
  当前对外正式入口只有两个:
@@ -94,7 +92,7 @@ export function GaugeDemo() {
94
92
  - `SetSegments`
95
93
  - `SetMarker`
96
94
 
97
- `PublishDial` 支持推送 `series`、`range`、`yawAngle`、`isNorthFacing`,以及可选 `polygon: DialPolygon[]` 绘制雷达多边形:每个多边形提供 `values`(各方向归一化值 0-1,长度即方向数,按 0..360 度均匀分布)与可选 `color`(缺省走主题主色)。各方向值决定半径,连成闭合多边形,半透明填充 + 同色描边;`series` 已改为可选,纯雷达数据可以只传 `polygon`。
95
+ `PublishDial` 支持推送 `series`、`range`、`yawAngle`、`isNorthFacing`,以及可选 `polygon: DialPolygon[]` 绘制雷达多边形:每个多边形提供 `values`(各方向归一化值 0-1,长度即方向数,按 0..360 度均匀分布)、可选 `color`(缺省走主题主色)与可选 `showDots`(是否绘制顶点小圆点,缺省 true)。各方向值决定半径,连成闭合多边形,径向渐变填充 + 细描边 + 顶点圆点;`series` 已改为可选,纯雷达数据可以只传 `polygon`。
98
96
 
99
97
  ```tsx
100
98
  import { Dial, PSType, type Publish } from '@rfkit/charts';
@@ -113,15 +111,14 @@ dialRef.current?.({
113
111
 
114
112
  ## 信号标注接入
115
113
 
116
- 信号标注数据由业务项目负责适配,图表只接收内部结构。外部常见的 `fromRSDBT`、`signalLevel` 字段不要原样传入:`fromRSDBT=true` 转为 `StationInfoType`,`false` 转为 `SignalData`;`signalLevel` 映射为 `level`(`-1/0/1/2`),`signalType` 映射为 `Legitimate`、`UnKnown`、`Know`、`Violation` 或 `Illegal`。有业务颜色时将 `color` 原样传入(包括 `rgba(...)`);没有显式颜色时,台站库和非合法信号使用内置类型色,信号库中的合法信号使用绿色等级色阶。
114
+ 信号标注数据由业务项目负责适配,图表只接收内部结构。有业务颜色时按约定传入,没有显式颜色时使用内置类型色。
117
115
 
118
116
  ```ts
119
117
  import { PSType, SignalDataType } from '@rfkit/charts';
120
118
 
121
- const { station, simple } = adaptBusinessAnnotations(items);
122
-
123
- publish({ pstype: PSType.Signal, type: SignalDataType.Station, data: station });
124
- publish({ pstype: PSType.Signal, type: SignalDataType.Simple, data: simple });
119
+ // 业务侧先把外部信号数据适配成 charts 内部结构(StationInfoType[] / SignalData[])
120
+ publish({ pstype: PSType.Signal, type: SignalDataType.Station, data: stationData });
121
+ publish({ pstype: PSType.Signal, type: SignalDataType.Simple, data: simpleData });
125
122
  ```
126
123
 
127
124
  同一来源后续发布会替换上一批数据,发布空数组可单独清空该来源。`SignalData.details` 可传入 `name`、`organization`、`modulation` 和 `remark`;频谱游标命中台站库或信号库时会展示两者共有的详情,合法信号库数据额外显示等级。
@@ -236,27 +233,7 @@ cleanup();
236
233
  - 不再兜底旧 `--theme-*` 变量
237
234
  - 不负责替宿主生成 `:root` 上的 canonical token
238
235
 
239
- ## 非公开边界
240
-
241
- 以下内容不属于对外源码 API:
242
-
243
- - 任意 `src/**` 源码路径
244
- - `test/**` preview / example 宿主
245
- - 仓库内部工程文档
246
-
247
- ## 主题变更摘要
248
-
249
- 当前主题系统已经完成二阶段收口,外部需要注意的 breaking change 主要有:
250
-
251
- - `initChartsTheme()` 不再接受 `themeConfigs` / `sizeConfigs` / `subscribeThemeChange`
252
- - 新配置入口改为 `tokens` / `sizes` / `onChange`
253
- - `applyChartsTheme()` 与 `applyChartsThemePreference()` 已移除
254
- - 默认运行时不再输出旧 `--theme-*` alias
255
- - `@rfkit/charts/tailwind-bridge.css` 不再暴露 deprecated bridge token
256
-
257
236
  ## 文档边界
258
237
 
259
- - 对外安装、接入方式、主题契约和常用用法以本文为准。
260
- - 精确公开 API 以 `@rfkit/charts` 包根导出的类型声明和编辑器智能提示为准。
261
- - npm 打包产物只同步根 `README.md`,不会把仓库内的 `docs/*` 一并作为公开文档入口发布。
262
- - 仓库内部专题文档只在源码仓库内维护,不属于发布包对外文档入口。
238
+ - 精确公开 API 以 `@rfkit/charts` 包根导出的类型声明为准。
239
+ - npm 打包产物只同步根 `README.md`。
@@ -4,6 +4,7 @@ import { type OccupancyPortalProps } from '../../modules/OccupancyPortal';
4
4
  import type { ParamsProps } from '../../types';
5
5
  export interface Props extends SpectrumChartTypeProps, ParamsProps, OccupancyPortalProps {
6
6
  children?: React.ReactNode;
7
+ touch?: boolean;
7
8
  processing?: Partial<ProcessingOptions>;
8
9
  }
9
10
  declare const Chart: React.FC<Props>;
@@ -1,8 +1,2 @@
1
- /**
2
- * 选择list中下一个item
3
- * @param {T} v - 当前值,可以是字符串或数字
4
- * @param {T[]} list - 值列表
5
- * @returns {T} 下一个值
6
- */
7
1
  export declare const nextItem: <T extends string | number>(v: T, list: T[]) => T;
8
2
  export declare function findNeighbors(currentValue: number, arr: number[], deltaY: number): number | null | undefined;
@@ -1,10 +1,10 @@
1
1
  import { useVirtualRange } from './tools';
2
2
  import type { RenderChartType } from '../../../../types';
3
- import Ranging, { RangeController, useRangeAutoFocus, useRangeMove, useRangeSet } from './ranging';
3
+ import Ranging, { RangeController, useRangeAutoFocus, useRangeMove, useRangeSet, useRangeZoom } from './ranging';
4
4
  import { getVirtualLevel, range2realRange } from './tools';
5
5
  interface Props {
6
6
  chart: RenderChartType | null;
7
7
  }
8
8
  declare const useRange: ({ chart }: Props) => Ranging;
9
9
  export default useRange;
10
- export { getVirtualLevel, RangeController, range2realRange, useRangeAutoFocus, useRangeMove, useRangeSet, useVirtualRange };
10
+ export { getVirtualLevel, RangeController, range2realRange, useRangeAutoFocus, useRangeMove, useRangeSet, useRangeZoom, useVirtualRange };
@@ -1,51 +1,23 @@
1
1
  import type { AxisYRange, RecursiveFunction, RecursiveObject } from '../../../../types';
2
- /**
3
- * 图表轴范围管理
4
- *
5
- * @class Range
6
- */
7
2
  declare class RangeController {
8
3
  state: RecursiveObject;
9
4
  constructor(props: RecursiveObject);
10
- /**
11
- * 更新状态
12
- */
13
5
  update(p: RecursiveObject): void;
14
6
  setAxisY(e: {
15
7
  step?: number;
16
8
  realRange: AxisYRange;
17
9
  }): void;
18
- /**
19
- * 聚焦
20
- */
21
10
  focus({ isHand, step: propsStep }?: RecursiveObject): void;
22
- /**
23
- * 移动
24
- */
25
11
  move(m: number): void;
26
- /**
27
- * 边界移动
28
- */
29
12
  moveBoundary(isUP: boolean, isTop: boolean): void;
30
13
  moveWheel(e: React.WheelEvent): void;
31
- /**
32
- * 根据步进移动
33
- */
14
+ zoom(factor: number, anchorValue: number): void;
34
15
  moveStep(isUp: boolean): void;
35
- /**
36
- * 通知外部
37
- */
38
16
  onChange(): void;
39
17
  }
40
- /**
41
- * 使用操作面板自动聚焦
42
- *
43
- * @param {*} id
44
- * @param {*} func
45
- * @returns
46
- */
47
18
  export declare const useRangeAutoFocus: (id: string, func?: RecursiveFunction<[]>) => (...args: any[]) => void;
48
19
  export declare const useRangeMove: (globalID: string, func?: RecursiveFunction<[number]>) => (...args: any[]) => void;
20
+ export declare const useRangeZoom: (globalID: string, func?: RecursiveFunction<[number, number]>) => (...args: any[]) => void;
49
21
  export declare const useRangeSet: (globalID: string, func?: RecursiveFunction<[AxisYRange]>) => (...args: any[]) => void;
50
22
  export { RangeController };
51
23
  export default RangeController;
@@ -1,15 +1,9 @@
1
- /**
2
- * 虚拟范围数据结构
3
- */
4
1
  interface VirtualRangeData {
5
2
  flaw: number;
6
3
  offset: number;
7
4
  range: [number, number];
8
5
  renderRange: [number, number];
9
6
  }
10
- /**
11
- * 全局共享的虚拟范围值
12
- */
13
7
  export declare const VIRTUAL_RANGE: (globalID: string, virtual?: VirtualRangeData) => VirtualRangeData;
14
8
  interface VirtualRangeParams {
15
9
  unit?: string;
@@ -17,24 +11,15 @@ interface VirtualRangeParams {
17
11
  step?: number;
18
12
  globalID: string;
19
13
  }
20
- /**
21
- * 虚拟范围管理器
22
- */
23
14
  export declare function useVirtualRange({ unit, realRange, step, globalID }: VirtualRangeParams): VirtualRangeData;
24
15
  interface Range2RealRangeParams {
25
16
  range: [number, number];
26
17
  unit?: string;
27
18
  globalID: string;
28
19
  }
29
- /**
30
- * 虚拟范围转真实范围
31
- */
32
20
  export declare function range2realRange({ range, unit, globalID }: Range2RealRangeParams): {
33
21
  realRange: [number, number];
34
22
  renderRange: [number, number];
35
23
  };
36
- /**
37
- * 获取虚拟电频值
38
- */
39
24
  export declare function getVirtualLevel(unit: string, v: number): number;
40
25
  export {};
@@ -2,9 +2,6 @@ import type { RecursiveFunction } from '../../types';
2
2
  type CursorTimer = ReturnType<typeof setTimeout> | null;
3
3
  export declare const CURSOR_TIMEOUT: (globalID: string, timer?: CursorTimer) => CursorTimer;
4
4
  export declare const CURSOR_SETACTIVE: (globalID: string, func?: RecursiveFunction) => (...args: any[]) => void;
5
- /**
6
- * 将位置信息转换为视觉left
7
- */
8
5
  export declare function convertCoordToVisualLeft({ coord, zoom, segments }: {
9
6
  coord: {
10
7
  left: number;
@@ -19,9 +16,6 @@ export declare function convertCoordToVisualLeft({ coord, zoom, segments }: {
19
16
  totalPoints: number;
20
17
  };
21
18
  }): number;
22
- /**
23
- * 将视觉left转换为真实left
24
- */
25
19
  export declare function convertVisualLeftToRealLeft({ visualLeft, zoom, segments }: {
26
20
  visualLeft: number;
27
21
  zoom: {
@@ -1,7 +1,3 @@
1
- /**
2
- * 通用拖拽框选组件
3
- * 用于创建可拖拽、可调整大小的矩形框
4
- */
5
1
  import type React from 'react';
6
2
  import { type ReactNode } from 'react';
7
3
  import { type DragType, type RectBounds, type RectPosition } from '../../hooks/useDragSelect';
@@ -9,17 +9,8 @@ export declare const createMouseUpEventManager: (id: string, name?: string, func
9
9
  export declare const createMouseLeaveEventManager: (id: string, name?: string, func?: CSMCallback) => (...args: any[]) => void;
10
10
  export declare const createMouseEnterEventManager: (id: string, name?: string, func?: CSMCallback) => (...args: any[]) => void;
11
11
  export declare const createWheelEventManager: (id: string, name?: string, func?: CSMCallback) => (...args: any[]) => void;
12
- /**
13
- * 创建拖拽事件管理器
14
- */
15
12
  export declare const createDragEventManager: (id: string, name?: string, func?: CSMCallback) => (...args: any[]) => void;
16
- /**
17
- * 创建缩放事件管理器
18
- */
19
13
  export declare const createZoomEventManager: (id: string, name?: string, func?: CSMCallback) => (...args: any[]) => void;
20
- /**
21
- * 创建长按事件管理器
22
- */
23
14
  export declare const createLongPressEventManager: (id: string, name?: string, func?: CSMCallback) => (...args: any[]) => void;
24
15
  export declare const calculateEventRelativePosition: (e: React.MouseEvent<HTMLElement> | React.WheelEvent<HTMLElement> | EventPositionSource) => TopRightBottomLeft;
25
16
  export declare const EVENT_PRIORITY_LEVELS: {
@@ -34,9 +25,6 @@ export declare const EVENT_PRIORITY_LEVELS: {
34
25
  stripe: number;
35
26
  frequencyTagLine: number;
36
27
  };
37
- /**
38
- * 事件样式映射
39
- */
40
28
  export declare const CURSOR_STYLE_MAP: {
41
29
  markers: string;
42
30
  stripe: string;
@@ -48,23 +36,6 @@ export declare const CURSOR_STYLE_MAP: {
48
36
  };
49
37
  export declare const getEventLevel: (id: string, level?: string) => string;
50
38
  export declare const getEventType: (id: string, type?: string) => string;
51
- /**
52
- * 比较事件优先级
53
- * @param id 事件ID
54
- * @param targetLevel 目标级别
55
- * @param type 事件类型
56
- * @returns 如果目标级别优先级大于等于当前级别,返回true
57
- */
58
39
  export declare function compareEventPriority(id: string, targetLevel: string, type?: string): boolean;
59
- /**
60
- * 获取事件对应的鼠标光标样式
61
- * @param id 事件ID
62
- * @returns 光标样式字符串
63
- */
64
40
  export declare function getEventCursor(id: string): string;
65
- /**
66
- * 重置事件级别
67
- * @param id 事件ID
68
- * @param level 要重置的级别
69
- */
70
41
  export declare function resetEventLevel(id: string, level: string): void;
@@ -1,7 +1,7 @@
1
1
  export declare const TOOLBAR_SHELL_CLASS_NAME = "relative flex h-10 w-full items-center justify-between pl-[var(--size-gap-base)] text-xs text-foreground";
2
2
  export declare const TOOLBAR_SHELL_STYLE: {
3
- readonly background: "linear-gradient(to bottom, color-mix(in srgb, var(--background) 100%, transparent), color-mix(in srgb, var(--background) 86%, transparent))";
4
- readonly boxShadow: "0 1px 4px color-mix(in srgb, var(--border) 72%, transparent)";
3
+ readonly background: 'linear-gradient(to bottom, color-mix(in srgb, var(--background) 100%, transparent), color-mix(in srgb, var(--background) 86%, transparent))';
4
+ readonly boxShadow: '0 1px 4px color-mix(in srgb, var(--border) 72%, transparent)';
5
5
  };
6
6
  export declare const TOOLBAR_ITEMS_CLASS_NAME = "flex h-full items-center gap-[var(--size-gap-base)]";
7
7
  export declare const TOOLBAR_SEPARATOR_BASE_CLASS_NAME = "self-center";
@@ -11,16 +11,16 @@ export declare const TOOLBAR_SURFACE_CLASS_NAME = "pointer-events-auto box-borde
11
11
  export declare const TOOLBAR_INTERACTIVE_SURFACE_CLASS_NAME = "cursor-pointer appearance-none border-0 hover:bg-accent/72 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70 focus-visible:ring-offset-1 focus-visible:ring-offset-background";
12
12
  export declare const TOOLBAR_DISABLED_SURFACE_CLASS_NAME = "cursor-not-allowed opacity-45 hover:bg-secondary";
13
13
  export declare const TOOLBAR_TONE_CLASS_NAME_MAP: {
14
- readonly default: "text-foreground";
15
- readonly primary: "text-primary";
16
- readonly warning: "text-warning";
17
- readonly destructive: "text-destructive";
14
+ readonly default: 'text-foreground';
15
+ readonly primary: 'text-primary';
16
+ readonly warning: 'text-warning';
17
+ readonly destructive: 'text-destructive';
18
18
  };
19
19
  export declare const TOOLBAR_ACTIVE_SURFACE_CLASS_NAME_MAP: {
20
- readonly default: "data-[active=true]:bg-accent/72 data-[active=true]:text-foreground data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[active=true]:hover:bg-accent/72";
21
- readonly primary: "data-[active=true]:bg-accent/72 data-[active=true]:text-primary data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[active=true]:hover:bg-accent/72";
22
- readonly warning: "data-[active=true]:bg-warning/10 data-[active=true]:text-warning data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--warning)_24%,transparent)] data-[active=true]:hover:bg-warning/12";
23
- readonly destructive: "data-[active=true]:bg-destructive/10 data-[active=true]:text-destructive data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--destructive)_24%,transparent)] data-[active=true]:hover:bg-destructive/12";
20
+ readonly default: 'data-[active=true]:bg-accent/72 data-[active=true]:text-foreground data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[active=true]:hover:bg-accent/72';
21
+ readonly primary: 'data-[active=true]:bg-accent/72 data-[active=true]:text-primary data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[active=true]:hover:bg-accent/72';
22
+ readonly warning: 'data-[active=true]:bg-warning/10 data-[active=true]:text-warning data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--warning)_24%,transparent)] data-[active=true]:hover:bg-warning/12';
23
+ readonly destructive: 'data-[active=true]:bg-destructive/10 data-[active=true]:text-destructive data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--destructive)_24%,transparent)] data-[active=true]:hover:bg-destructive/12';
24
24
  };
25
25
  export type ToolbarTone = keyof typeof TOOLBAR_TONE_CLASS_NAME_MAP;
26
26
  export declare const TOOLBAR_ICON_TRIGGER_CLASS_NAME = "inline-flex h-[26px] min-w-[26px] shrink-0 items-center justify-center";
@@ -0,0 +1,5 @@
1
+ import type { AxisXRange } from '../../types';
2
+ export declare const buildZoomFullRange: <T extends {
3
+ interval: AxisXRange;
4
+ isScanSegmentsUpdateMagnify: boolean;
5
+ }>(zoom: T, totalPoints: number) => T;
@@ -1,15 +1,15 @@
1
1
  import { type VariantProps } from 'class-variance-authority';
2
2
  import type { ButtonHTMLAttributes } from 'react';
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "link" | "destructive" | "secondary" | "default" | "outline" | "ghost" | null | undefined;
5
- size?: "default" | "icon" | "sm" | "lg" | null | undefined;
4
+ variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
5
+ size?: "default" | "icon" | "lg" | "sm" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants> & {
8
8
  asChild?: boolean;
9
9
  };
10
10
  export declare const Button: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<(props?: ({
11
- variant?: "link" | "destructive" | "secondary" | "default" | "outline" | "ghost" | null | undefined;
12
- size?: "default" | "icon" | "sm" | "lg" | null | undefined;
11
+ variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
12
+ size?: "default" | "icon" | "lg" | "sm" | null | undefined;
13
13
  } & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
14
14
  asChild?: boolean;
15
15
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,8 +1,8 @@
1
1
  import { type VariantProps } from 'class-variance-authority';
2
2
  import { type HTMLAttributes } from 'react';
3
3
  export declare const panelVariants: (props?: ({
4
- variant?: "default" | "ghost" | "subtle" | "floating" | null | undefined;
5
- size?: "sm" | "lg" | "xs" | "md" | null | undefined;
4
+ variant?: "default" | "floating" | "ghost" | "subtle" | null | undefined;
5
+ size?: "lg" | "md" | "sm" | "xs" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  export interface PanelProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof panelVariants> {
8
8
  }
@@ -9,9 +9,7 @@ export declare const SERIES: {
9
9
  };
10
10
  export declare const SERIES_NAMES: string[];
11
11
  export declare const REAL_DATA_NAME: string;
12
- /** @deprecated 使用 UI_CONFIG.ZOOM_MIN_RANGE */
13
12
  export declare const ZOOM_MIN_RANGE: 10;
14
- /** @deprecated 使用 UI_CONFIG.POPOVER_MARGIN */
15
13
  export declare const POPOVER_MARGIN: 16;
16
14
  export declare enum FrequencyUnit {
17
15
  Hz = "Hz",
@@ -1,10 +1,5 @@
1
- /**
2
- * UI 配置常量
3
- */
4
1
  export declare const UI_CONFIG: {
5
- /** 缩放最小范围 */
6
2
  readonly ZOOM_MIN_RANGE: 10;
7
- /** Popover 边距 */
8
3
  readonly POPOVER_MARGIN: 16;
9
4
  };
10
5
  export declare const SPECTRUM_THRESHOLD_COLOR = "#A855F7";
@@ -44,30 +39,9 @@ interface Config {
44
39
  marker: string[];
45
40
  }
46
41
  declare const defaultConfig: Config;
47
- /**
48
- * 更新配置到localStorage
49
- *
50
- * @param {Partial<Config>} [c={}]
51
- */
52
42
  declare const setConfig: (c?: Partial<Config>) => void;
53
- /**
54
- * 获取配置
55
- *
56
- * @param {keyof Config} [name]
57
- */
58
43
  declare function getConfig(): Config;
59
44
  declare function getConfig<K extends keyof Config>(name: K): Config[K];
60
- /**
61
- * 获取series的配置
62
- *
63
- * @returns {Config['line']}
64
- */
65
- declare const getSeriesConfig: () => Config["line"];
66
- /**
67
- * 获取当前色带
68
- *
69
- * @param {number} [i=0]
70
- * @returns {string[]}
71
- */
45
+ declare const getSeriesConfig: () => Config['line'];
72
46
  declare const getGradient: (i?: number) => string[];
73
47
  export { defaultConfig, getConfig, getGradient, getSeriesConfig, setConfig };
@@ -1,6 +1,3 @@
1
- /**
2
- * 数据处理相关 hooks
3
- */
4
1
  export { default as useChannel } from './useChannel';
5
2
  export { default as usePoints } from './usePoints';
6
3
  export { default as useSegments } from './useSegments';
package/hooks/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * Hooks 统一导出
3
- */
4
1
  export { useChannel, usePoints, useSegments } from './data';
5
2
  export { type EnhancedPublish, PUB_SUB, usePublish, useSafePublish } from './publish';
6
3
  export { SET_SEGMENTS_DISPLAY, type UseSpectrumChartTypeProps, useSpectrumChartType, useSpectrumRule } from './spectrum';
@@ -1,6 +1,3 @@
1
- /**
2
- * 发布相关 hooks
3
- */
4
1
  export type { EnhancedPublish } from './enhancedPublish';
5
2
  export { default as usePublish, PUB_SUB } from './usePublish';
6
3
  export { default as useSafePublish } from './useSafePublish';
@@ -1,7 +1,5 @@
1
- /**
2
- * 频谱相关 hooks
3
- */
4
1
  export type { Props as UseSpectrumChartTypeProps } from './useSpectrumChartType';
5
2
  export { default as useSpectrumChartType } from './useSpectrumChartType';
6
3
  export { default as useSpectrumRule, SET_SEGMENTS_DISPLAY } from './useSpectrumRule';
4
+ export { default as useTouchMode } from './useTouchMode';
7
5
  export { shouldEnableSpectrumWaterfall } from './waterfall';
@@ -0,0 +1 @@
1
+ export default function useTouchMode(touch?: boolean): void;
@@ -1,9 +1,5 @@
1
1
  import type React from 'react';
2
2
  import type { RecursiveObject, RenderChartType } from '../../types';
3
- /**
4
- * Render 类构造函数类型
5
- * 所有 render 类必须接受 id 和 globalID 参数,并实现 RenderChartType 接口
6
- */
7
3
  type RenderConstructor<T extends RenderChartType = RenderChartType> = new (props: {
8
4
  id: string;
9
5
  globalID: string;
@@ -1,11 +1,5 @@
1
1
  import React, { type ComponentType } from 'react';
2
2
  import type { Publish } from '../types';
3
- /**
4
- * 创建图表组件的高阶函数,提供安全的publish功能
5
- * @param ChartComponent 要包装的图表组件
6
- * @param componentName 组件名称,用于调试
7
- * @returns 包装后的forwardRef组件
8
- */
9
3
  export declare function withChartPublisher<TProps extends {
10
4
  publish?: Publish;
11
5
  }>(ChartComponent: ComponentType<TProps>, componentName: string): React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<TProps, "publish">> & React.RefAttributes<Publish>>;
@@ -1,7 +1,3 @@
1
- /**
2
- * 通用拖拽框选 Hook
3
- * 提炼自 HeatmapCapture/Slider 的框选能力
4
- */
5
1
  export type DragType = 'top' | 'bottom' | 'left' | 'right' | 'middle' | null;
6
2
  export interface RectPosition {
7
3
  position: number;
@@ -28,9 +24,6 @@ export interface UseDragSelectConfig {
28
24
  preserveDefaultRect?: boolean;
29
25
  bounds?: RectBounds;
30
26
  }
31
- /**
32
- * 通用拖拽框选 Hook
33
- */
34
27
  export declare const useDragSelect: (config?: UseDragSelectConfig) => {
35
28
  rect: RectPosition;
36
29
  isDragging: boolean;
@@ -2,63 +2,13 @@ import type { ModuleType } from '../config';
2
2
  import type { PublishData } from '../types';
3
3
  import { type ChartSubscriptionInterface, type DataExtractor, type ModuleEventHandler, type ModulePublishType } from './module-subscription-core';
4
4
  interface UseModuleSubscriptionOptions<TData = unknown> {
5
- /**
6
- * 模块类型
7
- */
8
5
  moduleType: ModuleType;
9
- /**
10
- * 图表实例
11
- */
12
6
  chart: ChartSubscriptionInterface<TData> | null | undefined;
13
- /**
14
- * 从 PublishData 中提取数据(默认直接传递整个 d)
15
- */
16
7
  extractData?: DataExtractor<TData, PublishData>;
17
- /**
18
- * 显式声明哪些 pstype 视作当前模块的渲染主路径
19
- */
20
8
  renderPSTypes?: ModulePublishType[];
21
- /**
22
- * 当事件没有 pstype 时,是否也视为 render 事件
23
- */
24
9
  treatMissingPSTypeAsRender?: boolean;
25
- /**
26
- * 自定义 render 处理逻辑;未提供时走 updateSeries + extractData 默认链路
27
- */
28
10
  handleRender?: ModuleEventHandler<TData, PublishData>;
29
- /**
30
- * 事件级处理器,优先级高于默认 Render/Reset/Resize 行为
31
- */
32
11
  eventHandlers?: Partial<Record<ModulePublishType, ModuleEventHandler<TData, PublishData>>>;
33
12
  }
34
- /**
35
- * 模块订阅 Hook
36
- *
37
- * 提供统一的数据订阅模式,处理 Render/Reset/Resize 事件
38
- *
39
- * @example
40
- * // 基础用法
41
- * useModuleSubscription({
42
- * moduleType: ModuleType.Dial,
43
- * chart
44
- * });
45
- *
46
- * @example
47
- * // 提取特定数据字段
48
- * useModuleSubscription({
49
- * moduleType: ModuleType.Occupancy,
50
- * chart,
51
- * extractData: (d) => d.data
52
- * });
53
- *
54
- * @example
55
- * // 自定义 render 类型或事件处理
56
- * useModuleSubscription({
57
- * moduleType: ModuleType.Gauge,
58
- * chart,
59
- * renderPSTypes: [PSType.Gauge],
60
- * treatMissingPSTypeAsRender: true
61
- * });
62
- */
63
13
  export declare function useModuleSubscription<TData = unknown>({ moduleType, chart, extractData, renderPSTypes, treatMissingPSTypeAsRender, handleRender, eventHandlers }: UseModuleSubscriptionOptions<TData>): void;
64
14
  export default useModuleSubscription;
@@ -1,6 +1,2 @@
1
- /**
2
- * useSeriesManager 统一导出
3
- * 提供所有 series 相关的 hooks
4
- */
5
1
  export { useFilteredSeries } from './useFilteredSeries';
6
2
  export { useSeriesForComponent, useSeriesManager } from './useSeriesManager';
@@ -1,19 +1,11 @@
1
- /**
2
- * 过滤的 Series Hook
3
- * 提供过滤后的 series 数据
4
- */
5
1
  import type { SeriesConfig } from '../../utils/series';
6
- /**
7
- * 过滤的 Series Hook
8
- * 提供过滤后的 series 数据,并保持稳定的顺序
9
- */
10
2
  export declare function useFilteredSeries(globalID: string | undefined, filter?: (config: SeriesConfig) => boolean): {
11
- originalIndex: number;
12
3
  name: string;
13
4
  label: string;
14
5
  color: string;
15
6
  thickness: number;
16
7
  display: boolean;
17
8
  type: import("@rfkit/renderer").GraphicType;
9
+ originalIndex: number;
18
10
  }[];
19
11
  export default useFilteredSeries;
@@ -1,34 +1,16 @@
1
- /**
2
- * 统一的 Series 管理 Hook
3
- * 整合所有 series 相关功能,避免多个分散的 hooks
4
- */
5
1
  import type { SeriesConfig } from '../../utils/series';
6
2
  import { type SeriesMode } from '../../utils/series';
7
3
  export interface UseSeriesManagerOptions {
8
- /** 是否订阅模式变化 */
9
4
  subscribeToMode?: boolean;
10
- /** 是否订阅series数据变化 */
11
5
  subscribeToData?: boolean;
12
- /** 特定要监听的series名称,如果不指定则监听所有 */
13
6
  watchSeries?: string[];
14
7
  }
15
8
  export interface UseSeriesManagerResult {
16
- /** 当前所有series数据 */
17
9
  series: Map<string, SeriesConfig>;
18
- /** 当前series模式 */
19
10
  mode: SeriesMode;
20
- /** 更新series配置 */
21
11
  updateSeries: (config: SeriesConfig) => void;
22
- /** 强制刷新数据 */
23
12
  forceUpdate: () => void;
24
- /** 获取特定series配置 */
25
13
  getSeries: (name: string) => SeriesConfig | undefined;
26
14
  }
27
- /**
28
- * 统一的 Series 管理 Hook
29
- */
30
15
  export declare function useSeriesManager(globalID: string | undefined, options?: UseSeriesManagerOptions): UseSeriesManagerResult;
31
- /**
32
- * 专门用于组件的版本 - 自动订阅所有变化
33
- */
34
16
  export declare function useSeriesForComponent(globalID: string | undefined): UseSeriesManagerResult;
package/index.d.ts CHANGED
@@ -6,9 +6,7 @@ export { setFrequencyAllocationChannelsToCache, setFrequencyAllocationToCache }
6
6
  export { type ChartsThemeChange, type InitChartsThemeOptions, type InitChartsThemeResult, initChartsTheme } from './theme/init-charts-theme';
7
7
  export { type ChartsThemePreference, type ChartsThemeState, getChartsThemeState, subscribeChartsThemeChange } from './theme/theme-runtime';
8
8
  export type { ChartsSizeTokensConfig, ChartsThemeTokensConfig } from './theme/theme-tokens';
9
- export type { AxisXProps, AxisYRange, BandProps, ChartRef, DialPolygon, FrequencyAllocationChannel, FrequencyAllocationDensity, FrequencyAllocationItem, MarkerProps, MarkerType, Publish, PublishData, PublishDial, PublishGauge, PublishHeatmap, PublishIQ, PublishLevelStream, PublishOccupancy, PublishSpectrum, RecursiveFunction, // 递归方法 后期会删除
10
- RecursiveObject, // 递归对象 后期会删除
11
- Render, Reset, SegmentsOriginal, SeriesConfig, SetAntennaFactor, SetChannels, SetMarker, SetSegments, SetSeries, SetSpectrumBandwidth, SignalData, SignalDetails, SpectrumBandwidth, SpectrumExtraData, StationInfoType } from './types';
9
+ export type { AxisXProps, AxisYRange, BandProps, ChartRef, DialPolygon, FrequencyAllocationChannel, FrequencyAllocationDensity, FrequencyAllocationItem, MarkerProps, MarkerType, Publish, PublishData, PublishDial, PublishGauge, PublishHeatmap, PublishIQ, PublishLevelStream, PublishOccupancy, PublishSpectrum, RecursiveFunction, RecursiveObject, Render, Reset, SegmentsOriginal, SeriesConfig, SetAntennaFactor, SetChannels, SetMarker, SetSegments, SetSeries, SetSpectrumBandwidth, SignalData, SignalDetails, SpectrumBandwidth, SpectrumExtraData, StationInfoType } from './types';
12
10
  export { HeatmapCaptureType, MarkerMode } from './types';
13
11
  export { SignalDataType } from './types/store';
14
12
  export type { FrequencyUnitResult } from './utils';