@rfkit/charts 1.3.13 → 1.4.1

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 (223) hide show
  1. package/README.md +169 -229
  2. package/{lib → charts}/index.d.ts +1 -1
  3. package/components/AxisY/heatmap/index.d.ts +1 -1
  4. package/components/AxisY/heatmap/variants/standard/index.d.ts +6 -0
  5. package/components/AxisY/spectrum/controls/index.d.ts +3 -0
  6. package/components/AxisY/spectrum/index.d.ts +3 -2
  7. package/components/AxisY/spectrum/{components/Ticks → presenters/TicksPanel}/index.d.ts +3 -3
  8. package/components/AxisY/spectrum/presenters/index.d.ts +1 -0
  9. package/components/AxisY/spectrum/useRanging/index.d.ts +4 -1
  10. package/components/AxisY/spectrum/useRanging/ranging.d.ts +3 -1
  11. package/components/Container/runtime.d.ts +10 -0
  12. package/components/Cursor/popover-support.d.ts +8 -0
  13. package/components/Cursor/registry.d.ts +7 -0
  14. package/components/DragSelectBox/index.d.ts +3 -1
  15. package/components/GridLines/OccupancyDashed/index.d.ts +3 -0
  16. package/components/{Dropdown → Overlay/Dropdown}/index.d.ts +10 -2
  17. package/components/{Tooltip → Overlay/Tooltip}/index.d.ts +1 -1
  18. package/components/Overlay/index.d.ts +4 -0
  19. package/components/{ToolsBar → Toolbar/controls}/SeriesControl/index.d.ts +1 -1
  20. package/components/Toolbar/controls/index.d.ts +4 -0
  21. package/components/{ToolsBar → Toolbar/decorations}/GradientRibbon/index.d.ts +1 -1
  22. package/components/Toolbar/decorations/index.d.ts +2 -0
  23. package/components/Toolbar/primitives/IconBox.d.ts +11 -0
  24. package/components/Toolbar/primitives/ToolbarContentBox.d.ts +11 -0
  25. package/components/Toolbar/primitives/ToolbarDropdown.d.ts +16 -0
  26. package/components/Toolbar/primitives/ToolbarGlyph.d.ts +10 -0
  27. package/components/Toolbar/primitives/ToolbarGroup.d.ts +10 -0
  28. package/components/Toolbar/primitives/ToolbarGroupIconBox.d.ts +5 -0
  29. package/components/Toolbar/primitives/ToolbarSurface.d.ts +15 -0
  30. package/components/Toolbar/primitives/index.d.ts +8 -0
  31. package/components/Toolbar/primitives/styles.d.ts +41 -0
  32. package/components/Toolbar/registry.d.ts +12 -0
  33. package/components/Toolbar/toggles/index.d.ts +10 -0
  34. package/components/Zoom/ZoomViewportLayer.d.ts +7 -0
  35. package/components/ui/button.d.ts +16 -0
  36. package/components/ui/checkbox.d.ts +4 -0
  37. package/components/ui/cursor-follow-layer.d.ts +10 -0
  38. package/components/ui/dialog.d.ts +12 -0
  39. package/components/ui/dropdown-menu.d.ts +9 -0
  40. package/components/ui/input.d.ts +1 -0
  41. package/components/ui/number-input.d.ts +10 -0
  42. package/components/ui/panel.d.ts +9 -0
  43. package/components/ui/popover.d.ts +7 -0
  44. package/components/ui/scroll-area.d.ts +5 -0
  45. package/components/ui/select.d.ts +11 -0
  46. package/components/ui/separator.d.ts +4 -0
  47. package/components/ui/slider.d.ts +2 -0
  48. package/components/ui/switch.d.ts +2 -0
  49. package/components/ui/tabs.d.ts +7 -0
  50. package/components/ui/tooltip.d.ts +7 -0
  51. package/components/ui/useChartsPortalContainer.d.ts +1 -0
  52. package/config/constants.d.ts +2 -2
  53. package/config/setting.d.ts +3 -3
  54. package/hooks/index.d.ts +2 -3
  55. package/hooks/module-subscription-core.d.ts +23 -0
  56. package/hooks/publish/enhancedPublish.d.ts +17 -0
  57. package/hooks/publish/index.d.ts +1 -1
  58. package/hooks/publish/publish-event.d.ts +9 -0
  59. package/hooks/publish/useSafePublish.d.ts +2 -8
  60. package/hooks/useChartComponent.d.ts +0 -6
  61. package/hooks/useDragSelect.d.ts +2 -0
  62. package/hooks/useLevelStreamAnalyzer.d.ts +1 -1
  63. package/hooks/useModuleSubscription.d.ts +21 -23
  64. package/index.d.ts +7 -3
  65. package/index.js +23912 -11942
  66. package/modules/Gauge/render.d.ts +0 -2
  67. package/{components/HeatmapCapture → modules/Heatmap/Capture}/tools.d.ts +1 -1
  68. package/modules/Heatmap/CursorPopover.d.ts +6 -0
  69. package/modules/Heatmap/render.d.ts +2 -0
  70. package/modules/Level/CursorPopover.d.ts +6 -0
  71. package/modules/Occupancy/CursorPopover.d.ts +3 -0
  72. package/modules/Occupancy/TotalLine/index.d.ts +1 -1
  73. package/modules/Occupancy/total-line-runtime.d.ts +4 -0
  74. package/modules/Spectrum/AxisYCanvas/index.d.ts +6 -0
  75. package/{components/AxisYByCanvas → modules/Spectrum/AxisYCanvas}/useCanvasAxisY.d.ts +2 -2
  76. package/modules/Spectrum/BandLayer/index.d.ts +5 -0
  77. package/modules/Spectrum/BandLayer/useBandLayerController.d.ts +2 -0
  78. package/{components → modules/Spectrum}/Blaze/tools.d.ts +1 -1
  79. package/modules/Spectrum/CursorPopover.d.ts +6 -0
  80. package/{components → modules/Spectrum}/FrequencyAllocation/color.d.ts +1 -1
  81. package/{components → modules/Spectrum}/FrequencyAllocation/index.d.ts +2 -2
  82. package/modules/Spectrum/FrequencyAllocation/model/index.d.ts +4 -0
  83. package/modules/Spectrum/FrequencyAllocation/model/resolveFrequencyAllocationData.d.ts +2 -0
  84. package/modules/Spectrum/FrequencyAllocation/model/resolver.d.ts +18 -0
  85. package/modules/Spectrum/FrequencyAllocation/model/useAllocationAtCursor.d.ts +6 -0
  86. package/modules/Spectrum/FrequencyAllocation/model/useFrequencyAllocationData.d.ts +1 -0
  87. package/modules/Spectrum/FrequencyAllocation/overlays/Tooltip/index.d.ts +4 -0
  88. package/modules/Spectrum/FrequencyAllocation/overlays/index.d.ts +1 -0
  89. package/{components/FrequencyAllocation → modules/Spectrum/FrequencyAllocation/presenters}/AllocationInfo/index.d.ts +1 -1
  90. package/modules/Spectrum/FrequencyAllocation/presenters/AllocationSegments/index.d.ts +12 -0
  91. package/modules/Spectrum/FrequencyAllocation/presenters/index.d.ts +2 -0
  92. package/{components → modules/Spectrum}/FrequencyAllocation/tools.d.ts +1 -1
  93. package/{components → modules/Spectrum}/FrequencyAllocation/types.d.ts +1 -1
  94. package/modules/Spectrum/FrequencyDataBoard/hooks/index.d.ts +1 -0
  95. package/modules/Spectrum/FrequencyDataBoard/hooks/useStationInfoAtCursor.d.ts +1 -0
  96. package/{components → modules/Spectrum}/FrequencyDataBoard/index.d.ts +1 -0
  97. package/{components/FrequencyDataBoard/StationInfo → modules/Spectrum/FrequencyDataBoard/panels/StationInfoPanel}/index.d.ts +1 -1
  98. package/modules/Spectrum/FrequencyDataBoard/panels/index.d.ts +1 -0
  99. package/{components → modules/Spectrum}/FrequencyTagLine/index.d.ts +2 -2
  100. package/{components → modules/Spectrum}/Markers/MarkerItem/index.d.ts +1 -1
  101. package/{components → modules/Spectrum}/Markers/hooks/useMarkerEvents.d.ts +1 -1
  102. package/{components → modules/Spectrum}/Markers/hooks/useMarkers.d.ts +2 -2
  103. package/{components → modules/Spectrum}/Markers/tools.d.ts +1 -1
  104. package/{components → modules/Spectrum}/Scope/useScope.d.ts +1 -1
  105. package/{components → modules/Spectrum}/Signal/index.d.ts +2 -1
  106. package/modules/Spectrum/Signal/metadata/index.d.ts +1 -0
  107. package/modules/Spectrum/Signal/model/index.d.ts +3 -0
  108. package/modules/Spectrum/Signal/model/resolver.d.ts +40 -0
  109. package/modules/Spectrum/Signal/model/useStationInfoAtCursor.d.ts +7 -0
  110. package/modules/Spectrum/Signal/model/useUnifiedSignals.d.ts +6 -0
  111. package/modules/Spectrum/Signal/presenters/SignalSegments/index.d.ts +10 -0
  112. package/modules/Spectrum/Signal/presenters/index.d.ts +1 -0
  113. package/{components → modules/Spectrum}/Signal/tools.d.ts +1 -1
  114. package/{components → modules/Spectrum}/Signal/useSignalDataManager.d.ts +1 -1
  115. package/modules/Spectrum/Signal/utils.d.ts +27 -0
  116. package/modules/Spectrum/render.d.ts +31 -52
  117. package/{hooks → modules/Spectrum}/useSpectrumAnalyzer/index.d.ts +1 -1
  118. package/modules/base/BaseRenderer.d.ts +63 -0
  119. package/modules/base/CircularRenderer.d.ts +4 -5
  120. package/package.json +28 -4
  121. package/{modules/tools.d.ts → runtime/passThrough.d.ts} +1 -1
  122. package/store/Params.d.ts +2 -1
  123. package/store/chart-store.d.ts +11 -0
  124. package/store/constants.d.ts +2 -3
  125. package/store/context.d.ts +6 -3
  126. package/store/globalState.d.ts +4 -0
  127. package/store/hooks/index.d.ts +1 -0
  128. package/store/hooks/useStore.d.ts +11 -1
  129. package/store/index.d.ts +1 -1
  130. package/store/reducer.d.ts +1 -67
  131. package/store/runtime.d.ts +16 -0
  132. package/tailwind-bridge.css +50 -0
  133. package/theme/init-charts-theme.d.ts +12 -0
  134. package/theme/style-scope.d.ts +20 -0
  135. package/theme/theme-color.d.ts +7 -0
  136. package/theme/theme-contract.d.ts +28 -0
  137. package/theme/theme-runtime.d.ts +14 -0
  138. package/theme/theme-styles.d.ts +10 -0
  139. package/theme/theme-tokens.d.ts +85 -0
  140. package/types/common.d.ts +1 -1
  141. package/types/store/index.d.ts +6 -4
  142. package/types/store/ui.d.ts +19 -5
  143. package/utils/cn.d.ts +2 -0
  144. package/utils/converter.d.ts +1 -1
  145. package/utils/cursor.d.ts +12 -0
  146. package/utils/frequencyCalculation.d.ts +8 -0
  147. package/utils/index.d.ts +1 -1
  148. package/utils/subscription.d.ts +18 -2
  149. package/components/AxisY/heatmap/type/Default/index.d.ts +0 -6
  150. package/components/AxisYByCanvas/index.d.ts +0 -6
  151. package/components/Band/index.d.ts +0 -5
  152. package/components/Band/useBand.d.ts +0 -2
  153. package/components/Cursor/Popover/index.d.ts +0 -10
  154. package/components/FrequencyAllocation/SegmentContainer.d.ts +0 -12
  155. package/components/FrequencyAllocation/Tooltip/index.d.ts +0 -8
  156. package/components/FrequencyAllocation/useAllocationFinder.d.ts +0 -10
  157. package/components/GridLines/Occdahsed/index.d.ts +0 -3
  158. package/components/Signal/SegmentContainer.d.ts +0 -26
  159. package/components/Signal/useStationFinder.d.ts +0 -12
  160. package/components/Signal/utils.d.ts +0 -15
  161. package/components/SignalAnalysis/Switch/index.d.ts +0 -3
  162. package/components/ToolsBar/IconBox.d.ts +0 -12
  163. package/components/Zoom/ZoomOffsetContainer/index.d.ts +0 -7
  164. package/lib/LevelStream/useAxisY.d.ts +0 -1
  165. package/utils/theme.d.ts +0 -18
  166. /package/{lib → charts}/Dial/Chart.d.ts +0 -0
  167. /package/{lib → charts}/Dial/index.d.ts +0 -0
  168. /package/{lib → charts}/Gauge/Chart.d.ts +0 -0
  169. /package/{lib → charts}/Gauge/index.d.ts +0 -0
  170. /package/{lib → charts}/Heatmap/Chart.d.ts +0 -0
  171. /package/{lib → charts}/Heatmap/index.d.ts +0 -0
  172. /package/{lib → charts}/IQ/Chart.d.ts +0 -0
  173. /package/{lib → charts}/IQ/index.d.ts +0 -0
  174. /package/{lib → charts}/LevelStream/Chart.d.ts +0 -0
  175. /package/{lib → charts}/LevelStream/index.d.ts +0 -0
  176. /package/{lib → charts}/Occupancy/Chart.d.ts +0 -0
  177. /package/{lib → charts}/Occupancy/index.d.ts +0 -0
  178. /package/{lib → charts}/SpatialSpectrum/Chart.d.ts +0 -0
  179. /package/{lib → charts}/SpatialSpectrum/index.d.ts +0 -0
  180. /package/{lib → charts}/Spectrum/Chart.d.ts +0 -0
  181. /package/{lib → charts}/Spectrum/index.d.ts +0 -0
  182. /package/components/AxisY/heatmap/{type/Default → variants/standard}/GradientRibbon/index.d.ts +0 -0
  183. /package/components/AxisY/occupancy/{type/Default → variants/standard}/index.d.ts +0 -0
  184. /package/components/AxisY/spectrum/{components/Autoranging/index.d.ts → controls/AutorangingControl.d.ts} +0 -0
  185. /package/components/AxisY/spectrum/{components/Step/index.d.ts → controls/StepControl.d.ts} +0 -0
  186. /package/components/AxisY/spectrum/{components/Unit/index.d.ts → controls/UnitControl.d.ts} +0 -0
  187. /package/components/{Popover → Overlay/Popover}/index.d.ts +0 -0
  188. /package/components/{Portal → Overlay/Portal}/index.d.ts +0 -0
  189. /package/components/{ToolsBar → Toolbar/controls}/Reset.d.ts +0 -0
  190. /package/components/{ToolsBar → Toolbar/controls}/SegmentsDisplayControl/index.d.ts +0 -0
  191. /package/components/{ToolsBar → Toolbar/controls}/SeriesDisplayControl/index.d.ts +0 -0
  192. /package/components/{ToolsBar → Toolbar/decorations}/SpacerLine.d.ts +0 -0
  193. /package/components/{ToolsBar → Toolbar}/index.d.ts +0 -0
  194. /package/{components/GuageBox/index.d.ts → modules/Gauge/InteractionSurface.d.ts} +0 -0
  195. /package/{components/HeatmapCapture → modules/Heatmap/Capture}/Area/index.d.ts +0 -0
  196. /package/{components/HeatmapCapture → modules/Heatmap/Capture}/RowIndex/index.d.ts +0 -0
  197. /package/{components/HeatmapCapture → modules/Heatmap/Capture}/Slider/index.d.ts +0 -0
  198. /package/{components/FrequencyTagLine → modules/Heatmap/Capture}/Switch/index.d.ts +0 -0
  199. /package/{components/HeatmapCapture → modules/Heatmap/Capture}/index.d.ts +0 -0
  200. /package/{components/HeatmapCapture → modules/Heatmap/TimeRange}/Switch/index.d.ts +0 -0
  201. /package/{components → modules/Heatmap}/TimeRange/useTimeRange.d.ts +0 -0
  202. /package/{components → modules/Spectrum}/Blaze/index.d.ts +0 -0
  203. /package/{components → modules/Spectrum}/DeltaMeasurement/Switch.d.ts +0 -0
  204. /package/{components → modules/Spectrum}/DeltaMeasurement/index.d.ts +0 -0
  205. /package/{components → modules/Spectrum}/DragFrame/index.d.ts +0 -0
  206. /package/{components → modules/Spectrum}/FrequencyAllocation/Switch/index.d.ts +0 -0
  207. /package/{components → modules/Spectrum}/FrequencyAllocation/data.d.ts +0 -0
  208. /package/{components → modules/Spectrum}/FrequencyTagLine/Board/index.d.ts +0 -0
  209. /package/{components/Limit → modules/Spectrum/FrequencyTagLine}/Switch/index.d.ts +0 -0
  210. /package/{components → modules/Spectrum}/Legend/index.d.ts +0 -0
  211. /package/{components → modules/Spectrum}/Limit/Item.d.ts +0 -0
  212. /package/{components/TimeRange → modules/Spectrum/Limit}/Switch/index.d.ts +0 -0
  213. /package/{components → modules/Spectrum}/Limit/index.d.ts +0 -0
  214. /package/{components → modules/Spectrum}/Markers/Switch/index.d.ts +0 -0
  215. /package/{components → modules/Spectrum}/Markers/index.d.ts +0 -0
  216. /package/{components → modules/Spectrum}/Scope/index.d.ts +0 -0
  217. /package/{components → modules/Spectrum}/SegmentsZebra/index.d.ts +0 -0
  218. /package/{components → modules/Spectrum}/Signal/Switch/index.d.ts +0 -0
  219. /package/{components/Signal/type.d.ts → modules/Spectrum/Signal/metadata/signalType.d.ts} +0 -0
  220. /package/{components → modules/Spectrum}/Stripe/Switch/index.d.ts +0 -0
  221. /package/{components → modules/Spectrum}/Stripe/index.d.ts +0 -0
  222. /package/{hooks/publish → modules/Spectrum}/useMarkerPublish.d.ts +0 -0
  223. /package/{hooks → modules/Spectrum}/useSpectrumAnalyzer/useTemplateComparison.d.ts +0 -0
package/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # rfkit-charts
2
2
 
3
- 服务于无线电监测产品的 web 图表组件库
3
+ 服务于无线电监测产品的 Web 图表组件库。
4
+
5
+ - 仓库名:`rfkit-charts`
6
+ - npm 发布名:`@rfkit/charts`
4
7
 
5
8
  ## 安装
6
9
 
@@ -8,262 +11,199 @@
8
11
  pnpm add @rfkit/charts
9
12
  ```
10
13
 
11
- ## 基本使用
14
+ 正式版本由源码仓库内的 Release PR 自动发布到 npm;仓库里的本地 `publish:*` 脚本只作为维护调试或应急入口,不属于常规发布流程。
15
+
16
+ ## 发布入口
17
+
18
+ 当前对外正式入口只有两个:
19
+
20
+ - JS / TS:`@rfkit/charts`
21
+ - CSS bridge:`@rfkit/charts/tailwind-bridge.css`
22
+
23
+ 默认直接从包根导入组件即可。组件运行所需样式会随包根入口自动加载,普通消费方不需要额外引 CSS。
24
+
25
+ ## 快速开始
26
+
27
+ 公开组件默认通过 `ref` 暴露 `Publish` 能力,不走 `publish` prop。
12
28
 
13
- ```jsx
29
+ ```tsx
30
+ import { useEffect, useRef } from 'react';
14
31
  import {
15
- // 频谱图
32
+ ChartType,
33
+ PSType,
16
34
  Spectrum,
17
- LevelStream,
18
- // IQ图
19
- IQ,
20
- // 仪表图
21
- Gauge,
22
- Dial,
23
- // 辅助图形
24
- Heatmap,
25
- Occupancy,
35
+ type Publish
26
36
  } from '@rfkit/charts';
27
37
 
28
- // 行为推送
29
- const publishRef = useRef(null);
30
- const handlePublishChange = (publish) => {
31
- publishRef.current? = publish;
32
- };
33
-
34
- // 图表类型
35
- export enum ChartType {
36
- // 频谱图
37
- SingleFrequency = 'singleFrequency',
38
- Scan = 'scan',
39
- MScan = 'mscan',
40
- ScanDF360 = 'ScanDF360',
41
- DDC = 'ddc',
42
- Lite = 'lite',
43
- LiteNormalized = 'liteNormalized',
44
- LevelStream = 'levelStream',
45
- // IQ图
46
- IQEye = 'iqEye',
47
- IQLine = 'iqLine',
48
- IQPlanisphere = 'iqPlanisphere',
49
- IQStream = 'iqStream',
50
- // 辅助图形
51
- Heatmap = 'heatmap',
52
- Occupancy = 'occupancy',
53
- }
38
+ export function Demo() {
39
+ const chartRef = useRef<Publish>(null);
40
+
41
+ useEffect(() => {
42
+ chartRef.current?.({
43
+ pstype: PSType.Spectrum,
44
+ data: new Float32Array([12, 28, 19, 35, 17])
45
+ });
46
+ }, []);
54
47
 
55
- // 频谱图
56
- <Spectrum type="singleFrequency" publish={handlePublishChange} /> // 单频频谱
57
- <Spectrum type="scan" publish={handlePublishChange} /> // 扫描频谱
58
- <Spectrum type="scanDF360" publish={handlePublishChange} /> // 扫描测向概率统计
59
- <Spectrum type="ddc" publish={handlePublishChange} channel onChannelChange /> // DCC
60
- <Spectrum type="lite" publish={handlePublishChange} /> // 精简模式
61
- <Spectrum type="liteNormalized" publish={handlePublishChange} /> // 精简模式(Y轴范围0-1)
62
-
63
- // DDC特殊参数
64
- export interface Props {
65
- channel?: number; // 默认32
66
- onChannelChange?: (c: {
67
- frequency: number;
68
- type: MarkerEventType;
69
- list: number[];
70
- }) => void;
48
+ return <Spectrum ref={chartRef} type={ChartType.SingleFrequency} />;
71
49
  }
50
+ ```
72
51
 
73
- // 电平瀑布图
74
- <LevelStream />
52
+ ## Publish 使用方式
75
53
 
76
- // IQ类型
77
- <IQ type={ChartType} publish={handlePublishChange} />
54
+ 大多数图表的数据输入都通过组件 `ref` 返回的 `Publish` 函数完成。
78
55
 
79
- // 仪表盘
80
- <Gauge publish={handlePublishChange} />
81
- <Dial axisY={{range}} onChange={onChange} publish={handlePublishChange} />
82
- ```
56
+ ```tsx
57
+ import { useEffect, useRef } from 'react';
58
+ import {
59
+ Gauge,
60
+ PSType,
61
+ type Publish
62
+ } from '@rfkit/charts';
83
63
 
84
- **publish(行为推送工具)**
85
-
86
- ```typescript
87
- export enum PSType {
88
- // 频谱数据
89
- SPECTRUM = 'spectrum',
90
- // 天线因子数据
91
- ANTENNA_FACTOR = 'antennaFactor',
92
- // 占用度数据
93
- OCCUPANCY = 'occupancy',
94
- // 电平流数据
95
- LEVEL_STREAM = 'levelStream',
96
- // 瀑布图数据
97
- HEATMAP = 'heatmap',
98
- // IQ数据
99
- IQ = 'IQ',
100
- // 示向度盘
101
- DIAL = 'dial',
102
- // 刻度尺
103
- GAUGE = 'gauge',
104
-
105
- // 频谱线属性
106
- SERIES = 'series',
107
- // 频谱带宽规则:一般用于单频频谱
108
- SPECTRUM_BANDWIDTH = 'spectrumBandwidth',
109
- // 多段扫描规则:一般用于扫描数据的多段组合
110
- SEGMENTS = 'segments',
111
- // 多路DCC
112
- CHANNELS = 'channels',
113
- // Marker
114
- MARKER = 'marker',
115
-
116
- // 图形操作
117
- RESET = 'reset',
118
- }
64
+ export function GaugeDemo() {
65
+ const gaugeRef = useRef<Publish>(null);
119
66
 
120
- // 系列配置
121
- interface SeriesConfig {
122
- readonly name: string;
123
- // 内外可设置属性
124
- label?: string;
125
- color?: string;
126
- }
67
+ useEffect(() => {
68
+ gaugeRef.current?.({
69
+ pstype: PSType.Gauge,
70
+ value: 42,
71
+ limit: 60
72
+ });
127
73
 
128
- // 推送频谱线属性
129
- export interface SetSeries extends SeriesConfig {
130
- pstype: PSType.Series;
131
- }
74
+ gaugeRef.current?.({
75
+ pstype: PSType.Reset
76
+ });
77
+ }, []);
132
78
 
133
- // 设置频谱带宽规则
134
- export interface SetSpectrumBandwidth extends SpectrumBandwidth {
135
- pstype: PSType.SpectrumBandwidth;
79
+ return <Gauge ref={gaugeRef} />;
136
80
  }
81
+ ```
137
82
 
138
- // 设置多段扫描规则
139
- export interface SetSegments {
140
- pstype: PSType.Segments;
141
- event?: SegmentsEvent; // 事件类型:默认覆盖数据
142
- data?: SegmentsOriginal[]; // 多段扫描规则:设置数据才使用
143
- index?: number; // 段索引:需要外部聚焦某段才使用
144
- }
83
+ 常用公开类型:
145
84
 
146
- // 设置天线因子
147
- export interface SetAntennaFactor {
148
- pstype: PSType.AntennaFactor;
149
- data: Float32Array;
150
- }
85
+ - `Publish`
86
+ - `PublishData`
87
+ - `PublishSpectrum`
88
+ - `PublishHeatmap`
89
+ - `PublishIQ`
90
+ - `PublishLevelStream`
91
+ - `PublishDial`
92
+ - `PublishGauge`
93
+ - `SetSeries`
94
+ - `SetSegments`
95
+ - `SetMarker`
151
96
 
152
- // 设置台站库信息
153
- export interface SetStationInfo {
154
- pstype: PSType.StationInfo;
155
- data: StationInfoType[];
156
- }
97
+ 工具栏相关命名统一使用:
157
98
 
158
- // 设置多路DCC信道
159
- export interface SetChannels {
160
- pstype: PSType.Channels;
161
- event: MarkerEventType;
162
- frequency?: number;
163
- }
99
+ - 工具栏枚举使用 `ToolbarItemType`
100
+ - 组件参数使用 `toolbar`
164
101
 
165
- // 设置Marker
166
- export interface SetMarker {
167
- pstype: PSType.Marker;
168
- event: MarkerEventType;
169
- marker?: Partial<MarkerType>;
170
- frequencies?: number[]; // 设计规定:frequencies必须是频率数据
171
- silent?: boolean; // 是否通知外部onChange回调
172
- }
102
+ ## 主题接入
173
103
 
174
- // 额外的频谱数据
175
- export interface SpectrumExtraData {
176
- [key: string]: Float32Array;
177
- }
178
- // 推送频谱数据
179
- export interface PublishSpectrum {
180
- pstype: PSType.Spectrum;
181
- data?: Float32Array;
182
- // 一般仅在静态绘制
183
- maxData?: Float32Array;
184
- minData?: Float32Array;
185
- avgData?: Float32Array;
186
- backgroundNoiseData?: Float32Array;
187
- templateData?: Float32Array;
188
- extraData?: SpectrumExtraData;
189
- // 瀑布图可选参数
190
- timestamp?: string;
191
- // 扫描可选参数
192
- offset?: number; // 当前段的点偏移量
193
- segmentOffset?: number; // 当前段的索引
194
- }
104
+ charts 只读取根节点上的两个契约:
195
105
 
196
- // 推送瀑布图数据
197
- export interface PublishHeatmap {
198
- pstype: PSType.Heatmap;
199
- data: TimestampedFloat32Array[];
200
- timestamps: number[];
201
- }
106
+ - `theme="light" | "dark"`
107
+ - `theme-follow-OS="true" | "false"`
202
108
 
203
- // 推送占用度数据
204
- export interface PublishOccupancy {
205
- pstype: PSType.Occupancy;
206
- data: Float32Array;
207
- totalOccupancy: number;
208
- }
109
+ 应用层直接写这两个属性即可:
209
110
 
210
- // 推送电平流数据
211
- export interface PublishLevelStream {
212
- pstype: PSType.LevelStream;
213
- data: number;
214
- }
111
+ ```ts
112
+ document.documentElement.setAttribute('theme', 'dark');
113
+ document.documentElement.setAttribute('theme-follow-OS', 'false');
114
+ ```
215
115
 
216
- // 推送IQ数据
217
- export interface PublishIQ {
218
- pstype: PSType.IQ;
219
- IData: number[];
220
- Qdata: number[];
221
- }
116
+ 如果宿主已经在用 `@rfkit/theme`,通常不需要额外迁移,因为它写的也是同一套根契约。
117
+
118
+ ### `initChartsTheme()`
119
+
120
+ `initChartsTheme()` 现在只承担三件事:
121
+
122
+ - 覆盖 charts 默认 `tokens`
123
+ - 覆盖默认 `sizes`
124
+ - 通过 `onChange` 订阅解析后的主题状态
125
+
126
+ ```ts
127
+ import { initChartsTheme } from '@rfkit/charts';
128
+
129
+ initChartsTheme({
130
+ onChange: ({ followOS, theme, contractTheme }) => {
131
+ console.log(followOS, theme, contractTheme);
132
+ },
133
+ tokens: {
134
+ semantic: {
135
+ primary: {
136
+ light: '#2A51F7',
137
+ dark: '#4371F8'
138
+ }
139
+ }
140
+ },
141
+ sizes: {
142
+ spacing: {
143
+ base: {
144
+ middle: '8px',
145
+ small: '4px'
146
+ }
147
+ }
148
+ }
149
+ });
150
+ ```
222
151
 
223
- // 推送Dial数据
224
- export interface PublishDial {
225
- pstype?: PSType.Dial;
226
- series: Array<{
227
- value: number;
228
- color: string;
229
- }>;
230
- range?: number[]; // 概率范围 0-360
231
- yawAngle?: number; // 偏航角 0-360
232
- isNorthFacing?: boolean; // 是否朝北
233
- }
152
+ ### 读取和订阅主题状态
234
153
 
235
- // 推送Gauge数据
236
- export interface PublishGauge {
237
- pstype?: PSType.Gauge;
238
- value: number; // 值
239
- limit: number; // 门限值
240
- }
154
+ ```ts
155
+ import {
156
+ getChartsThemeState,
157
+ subscribeChartsThemeChange
158
+ } from '@rfkit/charts';
241
159
 
242
- // 推送图形操作
243
- export interface Reset {
244
- pstype: PSType.Reset;
245
- }
160
+ const state = getChartsThemeState();
161
+ console.log(state.theme, state.preference);
246
162
 
247
- // 推送渲染数据(内部)
248
- export interface Render {
249
- pstype: PSType.Render;
250
- [key: string]: unknown;
251
- }
163
+ const cleanup = subscribeChartsThemeChange((nextState) => {
164
+ console.log(nextState.followOS, nextState.contractTheme);
165
+ });
166
+
167
+ cleanup();
168
+ ```
169
+
170
+ ### `tailwind-bridge.css`
252
171
 
253
- export type PublishData =
254
- | SetSeries
255
- | SetSpectrumBandwidth
256
- | SetSegments
257
- | SetChannels
258
- | SetMarker
259
- | SetAntennaFactor
260
- | PublishSpectrum
261
- | PublishHeatmap
262
- | PublishOccupancy
263
- | PublishLevelStream
264
- | PublishIQ
265
- | PublishDial
266
- | PublishGauge
267
- | Reset
268
- | Render;
172
+ 只有当宿主自己也在用 `Tailwind CSS v4 + shadcn/ui`,并且想复用 charts 的 canonical token 时,才需要额外引入:
173
+
174
+ ```css
175
+ @import "tailwindcss";
176
+ @import "@rfkit/charts/tailwind-bridge.css";
269
177
  ```
178
+
179
+ 这份 bridge 的边界是:
180
+
181
+ - 只做 canonical charts token 到 Tailwind / shadcn 语义色板的映射
182
+ - 不包含全局 reset
183
+ - 不再兜底旧 `--theme-*` 变量
184
+ - 不负责替宿主生成 `:root` 上的 canonical token
185
+
186
+ ## 非公开边界
187
+
188
+ 以下内容不属于对外源码 API:
189
+
190
+ - 任意 `src/**` 源码路径
191
+ - `test/**` preview / example 宿主
192
+ - 仓库内部工程文档
193
+
194
+ ## 主题变更摘要
195
+
196
+ 当前主题系统已经完成二阶段收口,外部需要注意的 breaking change 主要有:
197
+
198
+ - `initChartsTheme()` 不再接受 `themeConfigs` / `sizeConfigs` / `subscribeThemeChange`
199
+ - 新配置入口改为 `tokens` / `sizes` / `onChange`
200
+ - `applyChartsTheme()` 与 `applyChartsThemePreference()` 已移除
201
+ - 默认运行时不再输出旧 `--theme-*` alias
202
+ - `@rfkit/charts/tailwind-bridge.css` 不再暴露 deprecated bridge token
203
+
204
+ ## 文档边界
205
+
206
+ - 对外安装、接入方式、主题契约和常用用法以本文为准。
207
+ - 精确公开 API 以 `@rfkit/charts` 包根导出的类型声明和编辑器智能提示为准。
208
+ - npm 打包产物只同步根 `README.md`,不会把仓库内的 `docs/*` 一并作为公开文档入口发布。
209
+ - 仓库内部专题文档只在源码仓库内维护,不属于发布包对外文档入口。
@@ -5,4 +5,4 @@ import IQ from './IQ';
5
5
  import LevelStream from './LevelStream';
6
6
  import Occupancy from './Occupancy';
7
7
  import Spectrum from './Spectrum';
8
- export { Spectrum, LevelStream, IQ, Gauge, Dial, Heatmap, Occupancy };
8
+ export { Dial, Gauge, Heatmap, IQ, LevelStream, Occupancy, Spectrum };
@@ -1,6 +1,6 @@
1
1
  import type React from 'react';
2
2
  import type { RenderChartType } from '../../../types';
3
- import GradientRibbon from './type/Default/GradientRibbon';
3
+ import GradientRibbon from './variants/standard/GradientRibbon';
4
4
  export { GradientRibbon };
5
5
  interface Props {
6
6
  id: string;
@@ -0,0 +1,6 @@
1
+ import type React from 'react';
2
+ interface Props {
3
+ id: string;
4
+ }
5
+ declare const StandardHeatmapAxisYVariant: React.FC<Props>;
6
+ export default StandardHeatmapAxisYVariant;
@@ -0,0 +1,3 @@
1
+ export { default as AutorangingControl } from './AutorangingControl';
2
+ export { default as StepControl } from './StepControl';
3
+ export { default as UnitControl } from './UnitControl';
@@ -1,9 +1,10 @@
1
1
  import type React from 'react';
2
2
  import type { RenderChartType } from '../../../types';
3
- import { useRangeAutoFocus } from './useRanging/ranging';
4
3
  interface Props {
5
4
  chart: RenderChartType;
6
5
  }
7
6
  declare const AxisYSpectrum: React.FC<Props>;
8
7
  export default AxisYSpectrum;
9
- export { useRangeAutoFocus };
8
+ export * from './controls';
9
+ export * from './presenters';
10
+ export * from './useRanging';
@@ -7,12 +7,12 @@ interface RangeProps {
7
7
  isHand: string;
8
8
  }) => void;
9
9
  moveBoundary?: (isUP: boolean, isTop: boolean) => void;
10
- setAxisY(e: {
10
+ setAxisY(event: {
11
11
  realRange: AxisYRange;
12
12
  }): unknown;
13
13
  }
14
14
  interface Props {
15
15
  ranging: RangeProps;
16
16
  }
17
- declare const Ticks: React.FC<Props>;
18
- export default Ticks;
17
+ declare const TicksPanel: React.FC<Props>;
18
+ export default TicksPanel;
@@ -0,0 +1 @@
1
+ export { default as TicksPanel } from './TicksPanel';
@@ -1,7 +1,10 @@
1
+ import { useVirtualRange } from './tools';
1
2
  import type { RenderChartType } from '../../../../types';
2
- import Ranging from './ranging';
3
+ import Ranging, { RangeController, useRangeAutoFocus, useRangeMove, useRangeSet } from './ranging';
4
+ import { getVirtualLevel, range2realRange } from './tools';
3
5
  interface Props {
4
6
  chart: RenderChartType;
5
7
  }
6
8
  declare const useRange: ({ chart }: Props) => Ranging;
7
9
  export default useRange;
10
+ export { getVirtualLevel, RangeController, range2realRange, useRangeAutoFocus, useRangeMove, useRangeSet, useVirtualRange };
@@ -4,7 +4,7 @@ import type { AxisYRange, RecursiveFunction, RecursiveObject } from '../../../..
4
4
  *
5
5
  * @class Range
6
6
  */
7
- export default class Range {
7
+ declare class RangeController {
8
8
  state: RecursiveObject;
9
9
  constructor(props: RecursiveObject);
10
10
  /**
@@ -47,3 +47,5 @@ export default class Range {
47
47
  export declare const useRangeAutoFocus: (id: string, func?: RecursiveFunction) => (...args: any[]) => void;
48
48
  export declare const useRangeMove: (globalID: string, func?: RecursiveFunction) => (...args: any[]) => void;
49
49
  export declare const useRangeSet: (globalID: string, func?: RecursiveFunction) => (...args: any[]) => void;
50
+ export { RangeController };
51
+ export default RangeController;
@@ -0,0 +1,10 @@
1
+ import type { SystemConfig } from '../../types/store';
2
+ export interface ContainerSizeSnapshot {
3
+ height: number;
4
+ width: number;
5
+ }
6
+ type ContainerElementLike = Pick<HTMLElement, 'offsetHeight' | 'offsetWidth'>;
7
+ export declare const readContainerSize: (element: ContainerElementLike | null | undefined) => ContainerSizeSnapshot | null;
8
+ export declare const hasContainerSizeChanged: (previousSize: ContainerSizeSnapshot | null, nextSize: ContainerSizeSnapshot | null) => boolean;
9
+ export declare const createNextSystemConfig: (system: SystemConfig, size: ContainerSizeSnapshot) => SystemConfig;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ import type React from 'react';
2
+ export declare const POPOVER_ROW_CLASS = "mt-1 flex items-center justify-between gap-1 text-xs text-popover-foreground";
3
+ export declare const POPOVER_VALUE_CLASS = "inline-flex min-w-9 justify-end";
4
+ export declare const useCursorPopoverUpdateKey: (key: string, id: string) => number;
5
+ export declare const FrequencyDisplay: React.FC<{
6
+ frequency: string;
7
+ unit: string;
8
+ }>;
@@ -0,0 +1,7 @@
1
+ import type React from 'react';
2
+ import { ModuleType } from '../../config';
3
+ export declare const resolveCursorPopover: ({ id, mode, type }: {
4
+ id: string;
5
+ mode?: ModuleType;
6
+ type: ModuleType;
7
+ }) => React.ReactNode;
@@ -3,12 +3,14 @@
3
3
  * 用于创建可拖拽、可调整大小的矩形框
4
4
  */
5
5
  import type React from 'react';
6
- import type { ReactNode } from 'react';
6
+ import { type ReactNode } from 'react';
7
7
  import { type RectPosition } from '../../hooks/useDragSelect';
8
8
  export interface DragSelectBoxProps {
9
9
  enabled: boolean;
10
10
  defaultRect?: Partial<RectPosition>;
11
11
  minSize?: number;
12
+ minWidth?: number;
13
+ minHeight?: number;
12
14
  maxSize?: number;
13
15
  snapThreshold?: number;
14
16
  onChange?: (rect: RectPosition) => void;
@@ -0,0 +1,3 @@
1
+ import type React from 'react';
2
+ declare const OccupancyDashed: React.FC;
3
+ export default OccupancyDashed;
@@ -1,17 +1,25 @@
1
1
  import type React from 'react';
2
2
  export interface DropdownOption {
3
- value: string | number | null;
4
- label: string;
3
+ type?: 'item' | 'separator';
4
+ value?: string | number | null;
5
+ label?: string;
5
6
  style?: React.CSSProperties;
6
7
  render?: () => React.ReactNode;
7
8
  disabled?: boolean;
9
+ onSelect?: (value: string | number | null) => void;
8
10
  }
9
11
  interface DropdownProps {
10
12
  value: string | number | null;
11
13
  options: DropdownOption[];
12
14
  onChange?: (value: string | number | null) => void;
13
15
  placeholder?: string | React.ReactNode;
16
+ triggerContent?: React.ReactNode;
17
+ triggerTitle?: React.ReactNode;
14
18
  closeOnSelect?: boolean;
19
+ triggerVariant?: 'default' | 'plain';
20
+ showChevron?: boolean;
21
+ triggerClassName?: string;
22
+ contentClassName?: string;
15
23
  }
16
24
  declare const Dropdown: React.FC<DropdownProps>;
17
25
  export default Dropdown;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  type TooltipTriggerProps = React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>;
3
3
  type TooltipTriggerElement = React.ReactElement<TooltipTriggerProps>;
4
4
  interface TooltipProps {
@@ -0,0 +1,4 @@
1
+ export { type DropdownOption, default as Dropdown } from './Dropdown';
2
+ export { default as Popover } from './Popover';
3
+ export { default as Portal } from './Portal';
4
+ export { default as Tooltip } from './Tooltip';
@@ -1,4 +1,4 @@
1
- import { ChartType } from '../../../config';
1
+ import { ChartType } from '../../../../config';
2
2
  interface Props {
3
3
  type?: ChartType;
4
4
  }
@@ -0,0 +1,4 @@
1
+ export { default as Reset } from './Reset';
2
+ export { default as SegmentsDisplayControl } from './SegmentsDisplayControl';
3
+ export { default as SeriesControl } from './SeriesControl';
4
+ export { default as SeriesDisplayControl } from './SeriesDisplayControl';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type CSMCallback } from '../../../utils/subscription';
2
+ import { type CSMCallback } from '../../../../utils/subscription';
3
3
  export declare const handleColor: (globalID?: string, name?: string, func?: CSMCallback) => (...args: any[]) => void;
4
4
  declare const _default: React.NamedExoticComponent<{}>;
5
5
  export default _default;
@@ -0,0 +1,2 @@
1
+ export { default as GradientRibbon, handleColor } from './GradientRibbon';
2
+ export { default as SpacerLine } from './SpacerLine';
@@ -0,0 +1,11 @@
1
+ import type React from 'react';
2
+ import type { ReactNode } from 'react';
3
+ import { type ToolbarTone } from './styles';
4
+ import { type ToolbarSurfaceProps } from './ToolbarSurface';
5
+ export interface IconBoxProps extends Pick<ToolbarSurfaceProps, 'style' | 'className' | 'title' | 'disabled' | 'onClick' | 'onDoubleClick'> {
6
+ children: ReactNode;
7
+ active?: boolean;
8
+ tone?: ToolbarTone;
9
+ }
10
+ declare const IconBox: React.FC<IconBoxProps>;
11
+ export default IconBox;