@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.
- package/README.md +169 -229
- package/{lib → charts}/index.d.ts +1 -1
- package/components/AxisY/heatmap/index.d.ts +1 -1
- package/components/AxisY/heatmap/variants/standard/index.d.ts +6 -0
- package/components/AxisY/spectrum/controls/index.d.ts +3 -0
- package/components/AxisY/spectrum/index.d.ts +3 -2
- package/components/AxisY/spectrum/{components/Ticks → presenters/TicksPanel}/index.d.ts +3 -3
- package/components/AxisY/spectrum/presenters/index.d.ts +1 -0
- package/components/AxisY/spectrum/useRanging/index.d.ts +4 -1
- package/components/AxisY/spectrum/useRanging/ranging.d.ts +3 -1
- package/components/Container/runtime.d.ts +10 -0
- package/components/Cursor/popover-support.d.ts +8 -0
- package/components/Cursor/registry.d.ts +7 -0
- package/components/DragSelectBox/index.d.ts +3 -1
- package/components/GridLines/OccupancyDashed/index.d.ts +3 -0
- package/components/{Dropdown → Overlay/Dropdown}/index.d.ts +10 -2
- package/components/{Tooltip → Overlay/Tooltip}/index.d.ts +1 -1
- package/components/Overlay/index.d.ts +4 -0
- package/components/{ToolsBar → Toolbar/controls}/SeriesControl/index.d.ts +1 -1
- package/components/Toolbar/controls/index.d.ts +4 -0
- package/components/{ToolsBar → Toolbar/decorations}/GradientRibbon/index.d.ts +1 -1
- package/components/Toolbar/decorations/index.d.ts +2 -0
- package/components/Toolbar/primitives/IconBox.d.ts +11 -0
- package/components/Toolbar/primitives/ToolbarContentBox.d.ts +11 -0
- package/components/Toolbar/primitives/ToolbarDropdown.d.ts +16 -0
- package/components/Toolbar/primitives/ToolbarGlyph.d.ts +10 -0
- package/components/Toolbar/primitives/ToolbarGroup.d.ts +10 -0
- package/components/Toolbar/primitives/ToolbarGroupIconBox.d.ts +5 -0
- package/components/Toolbar/primitives/ToolbarSurface.d.ts +15 -0
- package/components/Toolbar/primitives/index.d.ts +8 -0
- package/components/Toolbar/primitives/styles.d.ts +41 -0
- package/components/Toolbar/registry.d.ts +12 -0
- package/components/Toolbar/toggles/index.d.ts +10 -0
- package/components/Zoom/ZoomViewportLayer.d.ts +7 -0
- package/components/ui/button.d.ts +16 -0
- package/components/ui/checkbox.d.ts +4 -0
- package/components/ui/cursor-follow-layer.d.ts +10 -0
- package/components/ui/dialog.d.ts +12 -0
- package/components/ui/dropdown-menu.d.ts +9 -0
- package/components/ui/input.d.ts +1 -0
- package/components/ui/number-input.d.ts +10 -0
- package/components/ui/panel.d.ts +9 -0
- package/components/ui/popover.d.ts +7 -0
- package/components/ui/scroll-area.d.ts +5 -0
- package/components/ui/select.d.ts +11 -0
- package/components/ui/separator.d.ts +4 -0
- package/components/ui/slider.d.ts +2 -0
- package/components/ui/switch.d.ts +2 -0
- package/components/ui/tabs.d.ts +7 -0
- package/components/ui/tooltip.d.ts +7 -0
- package/components/ui/useChartsPortalContainer.d.ts +1 -0
- package/config/constants.d.ts +2 -2
- package/config/setting.d.ts +3 -3
- package/hooks/index.d.ts +2 -3
- package/hooks/module-subscription-core.d.ts +23 -0
- package/hooks/publish/enhancedPublish.d.ts +17 -0
- package/hooks/publish/index.d.ts +1 -1
- package/hooks/publish/publish-event.d.ts +9 -0
- package/hooks/publish/useSafePublish.d.ts +2 -8
- package/hooks/useChartComponent.d.ts +0 -6
- package/hooks/useDragSelect.d.ts +2 -0
- package/hooks/useLevelStreamAnalyzer.d.ts +1 -1
- package/hooks/useModuleSubscription.d.ts +21 -23
- package/index.d.ts +7 -3
- package/index.js +23912 -11942
- package/modules/Gauge/render.d.ts +0 -2
- package/{components/HeatmapCapture → modules/Heatmap/Capture}/tools.d.ts +1 -1
- package/modules/Heatmap/CursorPopover.d.ts +6 -0
- package/modules/Heatmap/render.d.ts +2 -0
- package/modules/Level/CursorPopover.d.ts +6 -0
- package/modules/Occupancy/CursorPopover.d.ts +3 -0
- package/modules/Occupancy/TotalLine/index.d.ts +1 -1
- package/modules/Occupancy/total-line-runtime.d.ts +4 -0
- package/modules/Spectrum/AxisYCanvas/index.d.ts +6 -0
- package/{components/AxisYByCanvas → modules/Spectrum/AxisYCanvas}/useCanvasAxisY.d.ts +2 -2
- package/modules/Spectrum/BandLayer/index.d.ts +5 -0
- package/modules/Spectrum/BandLayer/useBandLayerController.d.ts +2 -0
- package/{components → modules/Spectrum}/Blaze/tools.d.ts +1 -1
- package/modules/Spectrum/CursorPopover.d.ts +6 -0
- package/{components → modules/Spectrum}/FrequencyAllocation/color.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyAllocation/index.d.ts +2 -2
- package/modules/Spectrum/FrequencyAllocation/model/index.d.ts +4 -0
- package/modules/Spectrum/FrequencyAllocation/model/resolveFrequencyAllocationData.d.ts +2 -0
- package/modules/Spectrum/FrequencyAllocation/model/resolver.d.ts +18 -0
- package/modules/Spectrum/FrequencyAllocation/model/useAllocationAtCursor.d.ts +6 -0
- package/modules/Spectrum/FrequencyAllocation/model/useFrequencyAllocationData.d.ts +1 -0
- package/modules/Spectrum/FrequencyAllocation/overlays/Tooltip/index.d.ts +4 -0
- package/modules/Spectrum/FrequencyAllocation/overlays/index.d.ts +1 -0
- package/{components/FrequencyAllocation → modules/Spectrum/FrequencyAllocation/presenters}/AllocationInfo/index.d.ts +1 -1
- package/modules/Spectrum/FrequencyAllocation/presenters/AllocationSegments/index.d.ts +12 -0
- package/modules/Spectrum/FrequencyAllocation/presenters/index.d.ts +2 -0
- package/{components → modules/Spectrum}/FrequencyAllocation/tools.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyAllocation/types.d.ts +1 -1
- package/modules/Spectrum/FrequencyDataBoard/hooks/index.d.ts +1 -0
- package/modules/Spectrum/FrequencyDataBoard/hooks/useStationInfoAtCursor.d.ts +1 -0
- package/{components → modules/Spectrum}/FrequencyDataBoard/index.d.ts +1 -0
- package/{components/FrequencyDataBoard/StationInfo → modules/Spectrum/FrequencyDataBoard/panels/StationInfoPanel}/index.d.ts +1 -1
- package/modules/Spectrum/FrequencyDataBoard/panels/index.d.ts +1 -0
- package/{components → modules/Spectrum}/FrequencyTagLine/index.d.ts +2 -2
- package/{components → modules/Spectrum}/Markers/MarkerItem/index.d.ts +1 -1
- package/{components → modules/Spectrum}/Markers/hooks/useMarkerEvents.d.ts +1 -1
- package/{components → modules/Spectrum}/Markers/hooks/useMarkers.d.ts +2 -2
- package/{components → modules/Spectrum}/Markers/tools.d.ts +1 -1
- package/{components → modules/Spectrum}/Scope/useScope.d.ts +1 -1
- package/{components → modules/Spectrum}/Signal/index.d.ts +2 -1
- package/modules/Spectrum/Signal/metadata/index.d.ts +1 -0
- package/modules/Spectrum/Signal/model/index.d.ts +3 -0
- package/modules/Spectrum/Signal/model/resolver.d.ts +40 -0
- package/modules/Spectrum/Signal/model/useStationInfoAtCursor.d.ts +7 -0
- package/modules/Spectrum/Signal/model/useUnifiedSignals.d.ts +6 -0
- package/modules/Spectrum/Signal/presenters/SignalSegments/index.d.ts +10 -0
- package/modules/Spectrum/Signal/presenters/index.d.ts +1 -0
- package/{components → modules/Spectrum}/Signal/tools.d.ts +1 -1
- package/{components → modules/Spectrum}/Signal/useSignalDataManager.d.ts +1 -1
- package/modules/Spectrum/Signal/utils.d.ts +27 -0
- package/modules/Spectrum/render.d.ts +31 -52
- package/{hooks → modules/Spectrum}/useSpectrumAnalyzer/index.d.ts +1 -1
- package/modules/base/BaseRenderer.d.ts +63 -0
- package/modules/base/CircularRenderer.d.ts +4 -5
- package/package.json +28 -4
- package/{modules/tools.d.ts → runtime/passThrough.d.ts} +1 -1
- package/store/Params.d.ts +2 -1
- package/store/chart-store.d.ts +11 -0
- package/store/constants.d.ts +2 -3
- package/store/context.d.ts +6 -3
- package/store/globalState.d.ts +4 -0
- package/store/hooks/index.d.ts +1 -0
- package/store/hooks/useStore.d.ts +11 -1
- package/store/index.d.ts +1 -1
- package/store/reducer.d.ts +1 -67
- package/store/runtime.d.ts +16 -0
- package/tailwind-bridge.css +50 -0
- package/theme/init-charts-theme.d.ts +12 -0
- package/theme/style-scope.d.ts +20 -0
- package/theme/theme-color.d.ts +7 -0
- package/theme/theme-contract.d.ts +28 -0
- package/theme/theme-runtime.d.ts +14 -0
- package/theme/theme-styles.d.ts +10 -0
- package/theme/theme-tokens.d.ts +85 -0
- package/types/common.d.ts +1 -1
- package/types/store/index.d.ts +6 -4
- package/types/store/ui.d.ts +19 -5
- package/utils/cn.d.ts +2 -0
- package/utils/converter.d.ts +1 -1
- package/utils/cursor.d.ts +12 -0
- package/utils/frequencyCalculation.d.ts +8 -0
- package/utils/index.d.ts +1 -1
- package/utils/subscription.d.ts +18 -2
- package/components/AxisY/heatmap/type/Default/index.d.ts +0 -6
- package/components/AxisYByCanvas/index.d.ts +0 -6
- package/components/Band/index.d.ts +0 -5
- package/components/Band/useBand.d.ts +0 -2
- package/components/Cursor/Popover/index.d.ts +0 -10
- package/components/FrequencyAllocation/SegmentContainer.d.ts +0 -12
- package/components/FrequencyAllocation/Tooltip/index.d.ts +0 -8
- package/components/FrequencyAllocation/useAllocationFinder.d.ts +0 -10
- package/components/GridLines/Occdahsed/index.d.ts +0 -3
- package/components/Signal/SegmentContainer.d.ts +0 -26
- package/components/Signal/useStationFinder.d.ts +0 -12
- package/components/Signal/utils.d.ts +0 -15
- package/components/SignalAnalysis/Switch/index.d.ts +0 -3
- package/components/ToolsBar/IconBox.d.ts +0 -12
- package/components/Zoom/ZoomOffsetContainer/index.d.ts +0 -7
- package/lib/LevelStream/useAxisY.d.ts +0 -1
- package/utils/theme.d.ts +0 -18
- /package/{lib → charts}/Dial/Chart.d.ts +0 -0
- /package/{lib → charts}/Dial/index.d.ts +0 -0
- /package/{lib → charts}/Gauge/Chart.d.ts +0 -0
- /package/{lib → charts}/Gauge/index.d.ts +0 -0
- /package/{lib → charts}/Heatmap/Chart.d.ts +0 -0
- /package/{lib → charts}/Heatmap/index.d.ts +0 -0
- /package/{lib → charts}/IQ/Chart.d.ts +0 -0
- /package/{lib → charts}/IQ/index.d.ts +0 -0
- /package/{lib → charts}/LevelStream/Chart.d.ts +0 -0
- /package/{lib → charts}/LevelStream/index.d.ts +0 -0
- /package/{lib → charts}/Occupancy/Chart.d.ts +0 -0
- /package/{lib → charts}/Occupancy/index.d.ts +0 -0
- /package/{lib → charts}/SpatialSpectrum/Chart.d.ts +0 -0
- /package/{lib → charts}/SpatialSpectrum/index.d.ts +0 -0
- /package/{lib → charts}/Spectrum/Chart.d.ts +0 -0
- /package/{lib → charts}/Spectrum/index.d.ts +0 -0
- /package/components/AxisY/heatmap/{type/Default → variants/standard}/GradientRibbon/index.d.ts +0 -0
- /package/components/AxisY/occupancy/{type/Default → variants/standard}/index.d.ts +0 -0
- /package/components/AxisY/spectrum/{components/Autoranging/index.d.ts → controls/AutorangingControl.d.ts} +0 -0
- /package/components/AxisY/spectrum/{components/Step/index.d.ts → controls/StepControl.d.ts} +0 -0
- /package/components/AxisY/spectrum/{components/Unit/index.d.ts → controls/UnitControl.d.ts} +0 -0
- /package/components/{Popover → Overlay/Popover}/index.d.ts +0 -0
- /package/components/{Portal → Overlay/Portal}/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar/controls}/Reset.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar/controls}/SegmentsDisplayControl/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar/controls}/SeriesDisplayControl/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar/decorations}/SpacerLine.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/index.d.ts +0 -0
- /package/{components/GuageBox/index.d.ts → modules/Gauge/InteractionSurface.d.ts} +0 -0
- /package/{components/HeatmapCapture → modules/Heatmap/Capture}/Area/index.d.ts +0 -0
- /package/{components/HeatmapCapture → modules/Heatmap/Capture}/RowIndex/index.d.ts +0 -0
- /package/{components/HeatmapCapture → modules/Heatmap/Capture}/Slider/index.d.ts +0 -0
- /package/{components/FrequencyTagLine → modules/Heatmap/Capture}/Switch/index.d.ts +0 -0
- /package/{components/HeatmapCapture → modules/Heatmap/Capture}/index.d.ts +0 -0
- /package/{components/HeatmapCapture → modules/Heatmap/TimeRange}/Switch/index.d.ts +0 -0
- /package/{components → modules/Heatmap}/TimeRange/useTimeRange.d.ts +0 -0
- /package/{components → modules/Spectrum}/Blaze/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/DeltaMeasurement/Switch.d.ts +0 -0
- /package/{components → modules/Spectrum}/DeltaMeasurement/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/DragFrame/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyAllocation/Switch/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyAllocation/data.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyTagLine/Board/index.d.ts +0 -0
- /package/{components/Limit → modules/Spectrum/FrequencyTagLine}/Switch/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Legend/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Limit/Item.d.ts +0 -0
- /package/{components/TimeRange → modules/Spectrum/Limit}/Switch/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Limit/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Markers/Switch/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Markers/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Scope/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/SegmentsZebra/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Signal/Switch/index.d.ts +0 -0
- /package/{components/Signal/type.d.ts → modules/Spectrum/Signal/metadata/signalType.d.ts} +0 -0
- /package/{components → modules/Spectrum}/Stripe/Switch/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Stripe/index.d.ts +0 -0
- /package/{hooks/publish → modules/Spectrum}/useMarkerPublish.d.ts +0 -0
- /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
|
-
服务于无线电监测产品的
|
|
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
|
-
```
|
|
29
|
+
```tsx
|
|
30
|
+
import { useEffect, useRef } from 'react';
|
|
14
31
|
import {
|
|
15
|
-
|
|
32
|
+
ChartType,
|
|
33
|
+
PSType,
|
|
16
34
|
Spectrum,
|
|
17
|
-
|
|
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
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
77
|
-
<IQ type={ChartType} publish={handlePublishChange} />
|
|
54
|
+
大多数图表的数据输入都通过组件 `ref` 返回的 `Publish` 函数完成。
|
|
78
55
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
gaugeRef.current?.({
|
|
69
|
+
pstype: PSType.Gauge,
|
|
70
|
+
value: 42,
|
|
71
|
+
limit: 60
|
|
72
|
+
});
|
|
127
73
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
pstype: PSType.Channels;
|
|
161
|
-
event: MarkerEventType;
|
|
162
|
-
frequency?: number;
|
|
163
|
-
}
|
|
99
|
+
- 工具栏枚举使用 `ToolbarItemType`
|
|
100
|
+
- 组件参数使用 `toolbar`
|
|
164
101
|
|
|
165
|
-
|
|
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
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
111
|
+
```ts
|
|
112
|
+
document.documentElement.setAttribute('theme', 'dark');
|
|
113
|
+
document.documentElement.setAttribute('theme-follow-OS', 'false');
|
|
114
|
+
```
|
|
215
115
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
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
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
154
|
+
```ts
|
|
155
|
+
import {
|
|
156
|
+
getChartsThemeState,
|
|
157
|
+
subscribeChartsThemeChange
|
|
158
|
+
} from '@rfkit/charts';
|
|
241
159
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
pstype: PSType.Reset;
|
|
245
|
-
}
|
|
160
|
+
const state = getChartsThemeState();
|
|
161
|
+
console.log(state.theme, state.preference);
|
|
246
162
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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 {
|
|
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 './
|
|
3
|
+
import GradientRibbon from './variants/standard/GradientRibbon';
|
|
4
4
|
export { GradientRibbon };
|
|
5
5
|
interface Props {
|
|
6
6
|
id: string;
|
|
@@ -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
|
|
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(
|
|
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
|
|
18
|
-
export default
|
|
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
|
-
|
|
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
|
+
}>;
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* 用于创建可拖拽、可调整大小的矩形框
|
|
4
4
|
*/
|
|
5
5
|
import type React from 'react';
|
|
6
|
-
import type
|
|
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;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
export interface DropdownOption {
|
|
3
|
-
|
|
4
|
-
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type CSMCallback } from '
|
|
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,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;
|