@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
|
@@ -42,7 +42,10 @@ export interface CircularRenderState<TChart extends CircularChartLike> extends B
|
|
|
42
42
|
* 圆形图表渲染器基类
|
|
43
43
|
*/
|
|
44
44
|
export declare abstract class CircularRenderer<TChart extends CircularChartLike, TState extends CircularRenderState<TChart> = CircularRenderState<TChart>> extends BaseRenderer<TChart, TState, CircularData> {
|
|
45
|
-
protected
|
|
45
|
+
protected getMinimumContainerSize(): {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
};
|
|
46
49
|
/**
|
|
47
50
|
* 订阅主题变化
|
|
48
51
|
*/
|
|
@@ -51,9 +54,5 @@ export declare abstract class CircularRenderer<TChart extends CircularChartLike,
|
|
|
51
54
|
* 更新数据
|
|
52
55
|
*/
|
|
53
56
|
updateSeries(data: CircularData): void;
|
|
54
|
-
/**
|
|
55
|
-
* 销毁资源
|
|
56
|
-
*/
|
|
57
|
-
destroy(): void;
|
|
58
57
|
}
|
|
59
58
|
export {};
|
package/package.json
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rfkit/charts",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Chart components for wireless monitoring web applications",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"import": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"./tailwind-bridge.css": "./tailwind-bridge.css"
|
|
12
|
+
},
|
|
13
|
+
"module": "./index.js",
|
|
14
|
+
"types": "./index.d.ts",
|
|
6
15
|
"author": "Hxgh",
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"react": ">=16.9.0",
|
|
18
|
+
"react-dom": ">=16.9.0"
|
|
19
|
+
},
|
|
7
20
|
"license": "MIT",
|
|
8
|
-
"
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/Hxgh/rfkit-charts"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/Hxgh/rfkit-charts#readme",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/Hxgh/rfkit-charts/issues"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"packageManager": "pnpm@10.30.3",
|
|
9
33
|
"private": false
|
|
10
34
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type CSMCallback } from '../utils/subscription';
|
|
2
|
-
declare const _default: (globalID: string, name: string, func?: CSMCallback) => (...args: any[]) => void;
|
|
2
|
+
declare const _default: (globalID: string, name: string, func?: CSMCallback, subscriptionName?: string) => (...args: any[]) => void;
|
|
3
3
|
export default _default;
|
package/store/Params.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { ParamsProps, StoreState } from '../types';
|
|
2
|
+
import type { AxisYProps, ParamsProps, StoreState } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* 混合参数
|
|
5
5
|
* @param key 参数键名
|
|
@@ -8,5 +8,6 @@ import type { ParamsProps, StoreState } from '../types';
|
|
|
8
8
|
* @returns 混合后的参数
|
|
9
9
|
*/
|
|
10
10
|
export declare function mergeParameter<K extends keyof StoreState>(key: K, params: Partial<StoreState[K]>, state?: StoreState): StoreState[K];
|
|
11
|
+
export declare function normalizeAxisYProps(axisY?: Partial<AxisYProps>): Partial<AxisYProps> | undefined;
|
|
11
12
|
declare const Params: React.FC<ParamsProps>;
|
|
12
13
|
export default Params;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DispatchAction, StoreState } from '../types/store';
|
|
2
|
+
type StoreListener = () => void;
|
|
3
|
+
export interface ChartStore {
|
|
4
|
+
dispatch: (action: DispatchAction) => StoreState;
|
|
5
|
+
getState: () => StoreState;
|
|
6
|
+
setState: (nextState: StoreState) => StoreState;
|
|
7
|
+
subscribe: (listener: StoreListener) => () => void;
|
|
8
|
+
updateState: (updater: (state: StoreState) => StoreState) => StoreState;
|
|
9
|
+
}
|
|
10
|
+
export declare function createChartStore(initialState: StoreState): ChartStore;
|
|
11
|
+
export {};
|
package/store/constants.d.ts
CHANGED
|
@@ -14,9 +14,8 @@ export declare const axisYTypeList: {
|
|
|
14
14
|
default: string;
|
|
15
15
|
};
|
|
16
16
|
export declare const DEFAULT_MAX_POINTS = 1001;
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const ZOOM_INTERVAL_DEFAULT: {
|
|
18
18
|
start: number;
|
|
19
19
|
end: number;
|
|
20
20
|
};
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const HEATMAP_HEIGHT_DEFAULT = 100;
|
|
21
|
+
export declare const DATA_RATE_DEFAULT = 1;
|
package/store/context.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { DispatchAction
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { DispatchAction } from '../types/store';
|
|
3
|
+
import type { ChartStore } from './chart-store';
|
|
4
|
+
import type { ChartRuntime } from './runtime';
|
|
5
|
+
export interface AppContextType {
|
|
6
|
+
runtime: ChartRuntime;
|
|
7
|
+
store: ChartStore;
|
|
5
8
|
dispatch: (action: DispatchAction) => void;
|
|
6
9
|
}
|
|
7
10
|
declare const AppContext: React.Context<AppContextType>;
|
package/store/globalState.d.ts
CHANGED
|
@@ -7,3 +7,7 @@ export declare const setGlobalStoreState: (globalID: string, state: RecursiveObj
|
|
|
7
7
|
* 获取全局store状态
|
|
8
8
|
*/
|
|
9
9
|
export declare const getGlobalStoreState: (globalID: string) => RecursiveObject | null;
|
|
10
|
+
/**
|
|
11
|
+
* 清理指定图表实例的全局store状态
|
|
12
|
+
*/
|
|
13
|
+
export declare const clearGlobalStoreState: (globalID: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSelector, useStore, useStoreApi, useStoreDispatch } from './useStore';
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { DispatchAction, StoreState } from '../../types/store';
|
|
2
|
+
import type { ChartStore } from '../chart-store';
|
|
3
|
+
import type { ChartRuntime } from '../runtime';
|
|
2
4
|
/**
|
|
3
5
|
* 使用全局状态的 hook
|
|
4
6
|
* @returns 状态和 dispatch 函数
|
|
5
7
|
*/
|
|
6
8
|
export declare function useStore(): {
|
|
7
|
-
state: StoreState;
|
|
8
9
|
dispatch: (action: DispatchAction) => void;
|
|
10
|
+
runtime: ChartRuntime;
|
|
11
|
+
state: StoreState;
|
|
12
|
+
store: ChartStore;
|
|
9
13
|
};
|
|
10
14
|
/**
|
|
11
15
|
* 获取特定状态的 hook
|
|
@@ -13,3 +17,9 @@ export declare function useStore(): {
|
|
|
13
17
|
* @returns 选择的状态
|
|
14
18
|
*/
|
|
15
19
|
export declare function useSelector<T>(selector: (state: StoreState) => T): T;
|
|
20
|
+
export declare function useStoreApi(): {
|
|
21
|
+
dispatch: (action: DispatchAction) => void;
|
|
22
|
+
runtime: ChartRuntime;
|
|
23
|
+
store: ChartStore;
|
|
24
|
+
};
|
|
25
|
+
export declare function useStoreDispatch(): (action: DispatchAction) => void;
|
package/store/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import type React from 'react';
|
|
|
2
2
|
import type { StoreProps } from '../types/store';
|
|
3
3
|
declare const Store: React.FC<StoreProps>;
|
|
4
4
|
export default Store;
|
|
5
|
-
export { useSelector, useStore } from './hooks
|
|
5
|
+
export { useSelector, useStore, useStoreApi, useStoreDispatch } from './hooks';
|
package/store/reducer.d.ts
CHANGED
|
@@ -1,68 +1,2 @@
|
|
|
1
1
|
import type { DispatchAction, StoreState } from '../types/store';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const defaultState: () => {
|
|
4
|
-
[key: string]: unknown;
|
|
5
|
-
globalID: string;
|
|
6
|
-
config: unknown;
|
|
7
|
-
system: import("../types").SystemConfig;
|
|
8
|
-
eventBus: import("../types").EventBusProps;
|
|
9
|
-
axisY: import("../types").AxisYProps;
|
|
10
|
-
axisX: import("..").AxisXProps;
|
|
11
|
-
toolsBar: import("../types").ToolsBarProps;
|
|
12
|
-
series: import("../types").SeriesProps;
|
|
13
|
-
segments: import("../types").SegmentsType;
|
|
14
|
-
points: unknown[];
|
|
15
|
-
marker: import("..").MarkerProps;
|
|
16
|
-
limit: import("../types").LimitProps;
|
|
17
|
-
heatmapCapture: import("../types").HeatmapCaptureProps;
|
|
18
|
-
cursor: import("../types").CursorProps;
|
|
19
|
-
zoom: import("../types").ZoomProps;
|
|
20
|
-
signal: import("../types").SignalProps;
|
|
21
|
-
signalAnalysis: import("../types").SignalAnalysisProps;
|
|
22
|
-
band: import("../types").BandProps;
|
|
23
|
-
scope: import("../types").ScopeProps;
|
|
24
|
-
gridLines: boolean;
|
|
25
|
-
legend: import("../types").LegendProps;
|
|
26
|
-
frequencyTagLine: import("../types").FrequencyTagLineBoardProps;
|
|
27
|
-
stripe: import("../types").StripeProps;
|
|
28
|
-
blaze: import("../types").BlazeProps;
|
|
29
|
-
frequencyAllocation: import("../types").FrequencyAllocationProps;
|
|
30
|
-
levelStream?: import("../types").LevelStreamProps;
|
|
31
|
-
timeRange?: number;
|
|
32
|
-
fluorescence: import("../types").FluorescenceProps;
|
|
33
|
-
deltaMeasurement: import("../types").DeltaMeasurementProps;
|
|
34
|
-
publish?: import("..").Publish;
|
|
35
|
-
};
|
|
36
|
-
export declare const reducer: (state: StoreState, action: DispatchAction) => {
|
|
37
|
-
[x: string]: unknown;
|
|
38
|
-
globalID: string;
|
|
39
|
-
config: unknown;
|
|
40
|
-
system: import("../types").SystemConfig;
|
|
41
|
-
eventBus: import("../types").EventBusProps;
|
|
42
|
-
axisY: import("../types").AxisYProps;
|
|
43
|
-
axisX: import("..").AxisXProps;
|
|
44
|
-
toolsBar: import("../types").ToolsBarProps;
|
|
45
|
-
series: import("../types").SeriesProps;
|
|
46
|
-
segments: import("../types").SegmentsType;
|
|
47
|
-
points: unknown[];
|
|
48
|
-
marker: import("..").MarkerProps;
|
|
49
|
-
limit: import("../types").LimitProps;
|
|
50
|
-
heatmapCapture: import("../types").HeatmapCaptureProps;
|
|
51
|
-
cursor: import("../types").CursorProps;
|
|
52
|
-
zoom: import("../types").ZoomProps;
|
|
53
|
-
signal: import("../types").SignalProps;
|
|
54
|
-
signalAnalysis: import("../types").SignalAnalysisProps;
|
|
55
|
-
band: import("../types").BandProps;
|
|
56
|
-
scope: import("../types").ScopeProps;
|
|
57
|
-
gridLines: boolean;
|
|
58
|
-
legend: import("../types").LegendProps;
|
|
59
|
-
frequencyTagLine: import("../types").FrequencyTagLineBoardProps;
|
|
60
|
-
stripe: import("../types").StripeProps;
|
|
61
|
-
blaze: import("../types").BlazeProps;
|
|
62
|
-
frequencyAllocation: import("../types").FrequencyAllocationProps;
|
|
63
|
-
levelStream?: import("../types").LevelStreamProps;
|
|
64
|
-
timeRange?: number;
|
|
65
|
-
fluorescence: import("../types").FluorescenceProps;
|
|
66
|
-
deltaMeasurement: import("../types").DeltaMeasurementProps;
|
|
67
|
-
publish?: import("..").Publish;
|
|
68
|
-
};
|
|
2
|
+
export declare const reducer: (state: StoreState, action: DispatchAction) => StoreState;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DispatchAction, StoreState } from '../types/store';
|
|
2
|
+
import { type ChartStore } from './chart-store';
|
|
3
|
+
type RuntimeCleanup = () => void;
|
|
4
|
+
export interface ChartRuntime {
|
|
5
|
+
destroy: () => void;
|
|
6
|
+
dispatch: (action: DispatchAction) => StoreState;
|
|
7
|
+
getGlobalID: () => string;
|
|
8
|
+
getState: () => StoreState;
|
|
9
|
+
registerCleanup: (cleanup?: RuntimeCleanup | null) => RuntimeCleanup | null;
|
|
10
|
+
setGlobalID: (globalID: string) => void;
|
|
11
|
+
store: ChartStore;
|
|
12
|
+
subscribe: ChartStore['subscribe'];
|
|
13
|
+
}
|
|
14
|
+
export declare const getChartRuntime: (globalID: string) => ChartRuntime | null;
|
|
15
|
+
export declare function createChartRuntime(initialState: StoreState): ChartRuntime;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* Tailwind/shadcn semantic token bridge for rfkit-charts.
|
|
2
|
+
*
|
|
3
|
+
* Default package usage now loads the required component styles automatically.
|
|
4
|
+
* This file remains as an optional advanced entry for consumers that want to
|
|
5
|
+
* reuse the same semantic tokens in their own Tailwind v4 global CSS.
|
|
6
|
+
*
|
|
7
|
+
* This file intentionally does NOT include Tailwind preflight/reset.
|
|
8
|
+
* Theme values follow the shared `theme` / `theme-follow-OS` root contract.
|
|
9
|
+
* It only maps canonical charts tokens into Tailwind/shadcn semantic color
|
|
10
|
+
* names and does not ship legacy rfkit aliases or deprecated bridge extras.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/* Use the shared root `theme` / `theme-follow-OS` contract. */
|
|
14
|
+
@custom-variant dark (&:is(:root[theme="dark"] *));
|
|
15
|
+
|
|
16
|
+
@theme inline {
|
|
17
|
+
--color-background: var(--background);
|
|
18
|
+
--color-foreground: var(--foreground);
|
|
19
|
+
--color-card: var(--card);
|
|
20
|
+
--color-card-foreground: var(--card-foreground);
|
|
21
|
+
--color-popover: var(--popover);
|
|
22
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
23
|
+
--color-primary: var(--primary);
|
|
24
|
+
--color-primary-foreground: var(--primary-foreground, #ffffff);
|
|
25
|
+
--color-secondary: var(--secondary);
|
|
26
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
27
|
+
--color-muted: var(--muted);
|
|
28
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
29
|
+
--color-accent: var(--accent);
|
|
30
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
31
|
+
--color-warning: var(--warning);
|
|
32
|
+
--color-warning-foreground: var(--warning-foreground, #ffffff);
|
|
33
|
+
--color-success: var(--success);
|
|
34
|
+
--color-success-foreground: var(--success-foreground, #ffffff);
|
|
35
|
+
--color-destructive: var(--destructive);
|
|
36
|
+
--color-destructive-foreground: var(--destructive-foreground, #ffffff);
|
|
37
|
+
--color-border: var(--border);
|
|
38
|
+
--color-input: var(--input);
|
|
39
|
+
--color-ring: var(--ring);
|
|
40
|
+
--color-chart-panel: var(--chart-panel);
|
|
41
|
+
--color-chart-panel-foreground: var(--chart-panel-foreground);
|
|
42
|
+
--color-chart-grid: var(--chart-grid);
|
|
43
|
+
--color-chart-grid-strong: var(--chart-grid-strong);
|
|
44
|
+
--color-chart-highlight: var(--chart-highlight);
|
|
45
|
+
--color-chart-surface: var(--chart-surface);
|
|
46
|
+
--radius-sm: calc(var(--radius, var(--size-border-radius-base, 0px)) - 4px);
|
|
47
|
+
--radius-md: calc(var(--radius, var(--size-border-radius-base, 0px)) - 2px);
|
|
48
|
+
--radius-lg: var(--radius, var(--size-border-radius-base, 0px));
|
|
49
|
+
--radius-xl: calc(var(--radius, var(--size-border-radius-base, 0px)) + 4px);
|
|
50
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ChartsThemeState } from './theme-runtime.ts';
|
|
2
|
+
import type { ChartsSizeTokensConfig, ChartsThemeTokensConfig } from './theme-tokens.ts';
|
|
3
|
+
export type ChartsThemeChange = ChartsThemeState;
|
|
4
|
+
export interface InitChartsThemeOptions {
|
|
5
|
+
onChange?: (state: ChartsThemeChange) => void;
|
|
6
|
+
sizes?: ChartsSizeTokensConfig;
|
|
7
|
+
tokens?: ChartsThemeTokensConfig;
|
|
8
|
+
}
|
|
9
|
+
export interface InitChartsThemeResult extends ChartsThemeState {
|
|
10
|
+
cleanup?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function initChartsTheme(options?: InitChartsThemeOptions): InitChartsThemeResult;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CHARTS_STYLE_SCOPE_ATTRIBUTE = "data-rfkit-charts-root";
|
|
2
|
+
export declare const CHARTS_STYLE_SCOPE_SELECTOR = "[data-rfkit-charts-root]";
|
|
3
|
+
export declare const CHARTS_STYLE_SCOPE_VALUE = "true";
|
|
4
|
+
export declare const CHARTS_PORTAL_SLOT_ATTRIBUTE = "data-rfkit-charts-portal";
|
|
5
|
+
export declare const CHARTS_PORTAL_Z_INDEX: Record<string, number>;
|
|
6
|
+
export declare const CHARTS_SCOPE_STYLE_VARS: {
|
|
7
|
+
readonly '--radius': "0px";
|
|
8
|
+
readonly '--radius-sm': "0px";
|
|
9
|
+
readonly '--radius-md': "0px";
|
|
10
|
+
readonly '--radius-lg': "0px";
|
|
11
|
+
readonly '--radius-xl': "0px";
|
|
12
|
+
readonly '--radius-micro': "0px";
|
|
13
|
+
readonly '--radius-control': "0px";
|
|
14
|
+
readonly '--radius-group': "0px";
|
|
15
|
+
readonly '--radius-surface': "0px";
|
|
16
|
+
readonly '--radius-pill': "9999px";
|
|
17
|
+
readonly '--size-border-radius-second': "var(--radius-control)";
|
|
18
|
+
};
|
|
19
|
+
export declare const applyChartsScopeRoot: (element: HTMLElement) => void;
|
|
20
|
+
export declare const ensureChartsPortalRoot: (slot: string) => HTMLDivElement;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ThemeFillStyle {
|
|
2
|
+
fillStyle: string;
|
|
3
|
+
fillStylePrimary: string;
|
|
4
|
+
fillStyleTransparentBase: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function getThemeFillStyle(scopeTarget?: Element | null): ThemeFillStyle;
|
|
7
|
+
export declare const getThemeColor: (property: string, opacity?: number, scopeTarget?: Element | null) => string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const THEME_KEY = "theme";
|
|
2
|
+
export declare const THEME_FOLLOW_OS_KEY = "theme-follow-OS";
|
|
3
|
+
export declare const SIZE_KEY = "size";
|
|
4
|
+
export declare const ThemeType: {
|
|
5
|
+
readonly Dark: "dark";
|
|
6
|
+
readonly Light: "light";
|
|
7
|
+
};
|
|
8
|
+
export type ThemeType = (typeof ThemeType)[keyof typeof ThemeType];
|
|
9
|
+
export declare const SizeType: {
|
|
10
|
+
readonly Middle: "middle";
|
|
11
|
+
readonly Small: "small";
|
|
12
|
+
};
|
|
13
|
+
export type SizeType = (typeof SizeType)[keyof typeof SizeType];
|
|
14
|
+
export interface ChartsThemeContract {
|
|
15
|
+
followOS: boolean;
|
|
16
|
+
theme: ThemeType;
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_THEME: ThemeType;
|
|
19
|
+
export declare const DEFAULT_FOLLOW_OS = true;
|
|
20
|
+
export declare const DEFAULT_SIZE: SizeType;
|
|
21
|
+
export declare const canUseDOM: () => boolean;
|
|
22
|
+
export declare const getThemeMedia: () => MediaQueryList;
|
|
23
|
+
export declare const isThemeType: (value: string | null) => value is ThemeType;
|
|
24
|
+
export declare const getSystemTheme: () => ThemeType;
|
|
25
|
+
export declare const readThemeContract: () => ChartsThemeContract;
|
|
26
|
+
export declare const getRootTheme: () => ThemeType;
|
|
27
|
+
export declare const getRootThemeFollowOS: () => boolean;
|
|
28
|
+
export declare const writeThemeContract: ({ followOS, theme }: ChartsThemeContract) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ThemeType } from './theme-contract.ts';
|
|
2
|
+
export type ChartsThemePreference = 'system' | ThemeType;
|
|
3
|
+
export interface ChartsThemeState {
|
|
4
|
+
contractTheme: ThemeType;
|
|
5
|
+
followOS: boolean;
|
|
6
|
+
preference: ChartsThemePreference;
|
|
7
|
+
theme: ThemeType;
|
|
8
|
+
}
|
|
9
|
+
type ChartsThemeListener = (state: ChartsThemeState) => void;
|
|
10
|
+
export declare const resolveChartsThemeState: () => ChartsThemeState;
|
|
11
|
+
export declare const getChartsThemeState: () => ChartsThemeState;
|
|
12
|
+
export declare const subscribeChartsThemeChange: (listener: ChartsThemeListener) => () => void;
|
|
13
|
+
export declare const resetChartsThemeRuntimeForTests: () => void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ChartsSizeTokensConfig, type ChartsThemeTokensConfig } from './theme-tokens.ts';
|
|
2
|
+
export interface ThemeStyleOptions {
|
|
3
|
+
sizes?: ChartsSizeTokensConfig;
|
|
4
|
+
tokens?: ChartsThemeTokensConfig;
|
|
5
|
+
}
|
|
6
|
+
export declare const ensureRootThemeStyles: ({ tokens }?: ThemeStyleOptions) => void;
|
|
7
|
+
export declare const ensureChartsThemeStyles: ({ tokens }?: ThemeStyleOptions) => void;
|
|
8
|
+
export declare const ensureChartsSizeStyles: (sizes?: ChartsSizeTokensConfig) => void;
|
|
9
|
+
export declare const initializeRootThemeEnvironment: (options?: ThemeStyleOptions) => void;
|
|
10
|
+
export declare const initializeChartsThemeEnvironment: (options?: ThemeStyleOptions) => void;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export interface ThemeToneValues {
|
|
2
|
+
dark: string;
|
|
3
|
+
light: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SizeScaleValues {
|
|
6
|
+
middle: string;
|
|
7
|
+
small: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ThemeVariableDefinition extends ThemeToneValues {
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SizeVariableDefinition extends SizeScaleValues {
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const SEMANTIC_TOKEN_VARIABLES: {
|
|
16
|
+
readonly accent: "--accent";
|
|
17
|
+
readonly accentForeground: "--accent-foreground";
|
|
18
|
+
readonly background: "--background";
|
|
19
|
+
readonly border: "--border";
|
|
20
|
+
readonly card: "--card";
|
|
21
|
+
readonly cardForeground: "--card-foreground";
|
|
22
|
+
readonly destructive: "--destructive";
|
|
23
|
+
readonly destructiveForeground: "--destructive-foreground";
|
|
24
|
+
readonly foreground: "--foreground";
|
|
25
|
+
readonly input: "--input";
|
|
26
|
+
readonly muted: "--muted";
|
|
27
|
+
readonly mutedForeground: "--muted-foreground";
|
|
28
|
+
readonly popover: "--popover";
|
|
29
|
+
readonly popoverForeground: "--popover-foreground";
|
|
30
|
+
readonly primary: "--primary";
|
|
31
|
+
readonly primaryForeground: "--primary-foreground";
|
|
32
|
+
readonly radius: "--radius";
|
|
33
|
+
readonly ring: "--ring";
|
|
34
|
+
readonly secondary: "--secondary";
|
|
35
|
+
readonly secondaryForeground: "--secondary-foreground";
|
|
36
|
+
readonly success: "--success";
|
|
37
|
+
readonly successForeground: "--success-foreground";
|
|
38
|
+
readonly warning: "--warning";
|
|
39
|
+
readonly warningForeground: "--warning-foreground";
|
|
40
|
+
};
|
|
41
|
+
export declare const CHART_TOKEN_VARIABLES: {
|
|
42
|
+
readonly grid: "--chart-grid";
|
|
43
|
+
readonly gridStrong: "--chart-grid-strong";
|
|
44
|
+
readonly highlight: "--chart-highlight";
|
|
45
|
+
readonly panel: "--chart-panel";
|
|
46
|
+
readonly panelForeground: "--chart-panel-foreground";
|
|
47
|
+
readonly surface: "--chart-surface";
|
|
48
|
+
};
|
|
49
|
+
export declare const SIZE_TOKEN_VARIABLES: {
|
|
50
|
+
readonly font: {
|
|
51
|
+
readonly base: "--size-font-base";
|
|
52
|
+
readonly max: "--size-font-max";
|
|
53
|
+
readonly second: "--size-font-second";
|
|
54
|
+
};
|
|
55
|
+
readonly radius: {
|
|
56
|
+
readonly base: "--size-border-radius-base";
|
|
57
|
+
readonly second: "--size-border-radius-second";
|
|
58
|
+
};
|
|
59
|
+
readonly spacing: {
|
|
60
|
+
readonly base: "--size-gap-base";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export type SemanticTokenName = keyof typeof SEMANTIC_TOKEN_VARIABLES;
|
|
64
|
+
export type ChartTokenName = keyof typeof CHART_TOKEN_VARIABLES;
|
|
65
|
+
export type SemanticTokenConfig = Partial<Record<SemanticTokenName, Partial<ThemeToneValues>>>;
|
|
66
|
+
export type ChartTokenConfig = Partial<Record<ChartTokenName, Partial<ThemeToneValues>>>;
|
|
67
|
+
export interface ChartsThemeTokensConfig {
|
|
68
|
+
chart?: ChartTokenConfig;
|
|
69
|
+
semantic?: SemanticTokenConfig;
|
|
70
|
+
}
|
|
71
|
+
export interface ChartsSizeTokensConfig {
|
|
72
|
+
font?: Partial<Record<keyof typeof SIZE_TOKEN_VARIABLES.font, Partial<SizeScaleValues>>>;
|
|
73
|
+
radius?: Partial<Record<keyof typeof SIZE_TOKEN_VARIABLES.radius, Partial<SizeScaleValues>>>;
|
|
74
|
+
spacing?: Partial<Record<keyof typeof SIZE_TOKEN_VARIABLES.spacing, Partial<SizeScaleValues>>>;
|
|
75
|
+
}
|
|
76
|
+
export declare const getCanonicalThemeVariableDefinitions: (tokens?: ChartsThemeTokensConfig) => {
|
|
77
|
+
dark: string;
|
|
78
|
+
light: string;
|
|
79
|
+
name: string;
|
|
80
|
+
}[];
|
|
81
|
+
export declare const getSizeVariableDefinitions: (sizes?: ChartsSizeTokensConfig) => {
|
|
82
|
+
middle: string;
|
|
83
|
+
small: string;
|
|
84
|
+
name: string;
|
|
85
|
+
}[];
|
package/types/common.d.ts
CHANGED
|
@@ -20,13 +20,13 @@ export interface RenderChartType {
|
|
|
20
20
|
reset(): unknown;
|
|
21
21
|
resize(): unknown;
|
|
22
22
|
dispose(): (() => void) | undefined;
|
|
23
|
+
updateParams(params: RecursiveObject): void;
|
|
23
24
|
updateProps?(...arg: unknown[]): unknown;
|
|
24
25
|
updateSeries?(...arg: unknown[]): unknown;
|
|
25
26
|
setDisabledClearRect?(disabledClearRect: boolean): unknown;
|
|
26
27
|
useRangeAutoFocus?(): unknown;
|
|
27
28
|
setSeries?(s: SetSeries): unknown;
|
|
28
29
|
setRange?(range: AxisYRange): void;
|
|
29
|
-
updateParams?(params: RecursiveObject): void;
|
|
30
30
|
}
|
|
31
31
|
export interface SeriesConfig {
|
|
32
32
|
readonly name: string;
|
package/types/store/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import type { HeatmapCaptureProps } from './heatmap';
|
|
|
24
24
|
import type { MarkerProps } from './marker';
|
|
25
25
|
import type { LevelStreamProps, SeriesProps } from './series';
|
|
26
26
|
import type { SignalAnalysisProps, SignalProps } from './signal';
|
|
27
|
-
import type { BandProps, BlazeProps, CursorProps, DeltaMeasurementProps, EventBusProps, FluorescenceProps, FrequencyTagLineBoardProps, LegendProps, LimitProps, ScopeProps, StripeProps, SystemConfig,
|
|
27
|
+
import type { BandProps, BlazeProps, CursorProps, DeltaMeasurementProps, EventBusProps, FluorescenceProps, FrequencyTagLineBoardProps, LegendProps, LimitProps, ScopeProps, StripeProps, SystemConfig, ToolbarProps, ZoomProps } from './ui';
|
|
28
28
|
export interface StoreState {
|
|
29
29
|
globalID: string;
|
|
30
30
|
config: unknown;
|
|
@@ -32,7 +32,7 @@ export interface StoreState {
|
|
|
32
32
|
eventBus: EventBusProps;
|
|
33
33
|
axisY: AxisYProps;
|
|
34
34
|
axisX: AxisXProps;
|
|
35
|
-
|
|
35
|
+
toolbar: ToolbarProps;
|
|
36
36
|
series: SeriesProps;
|
|
37
37
|
segments: SegmentsType;
|
|
38
38
|
points: unknown[];
|
|
@@ -58,9 +58,11 @@ export interface StoreState {
|
|
|
58
58
|
[key: string]: unknown;
|
|
59
59
|
publish?: Publish;
|
|
60
60
|
}
|
|
61
|
+
export type StoreUpdatePayload = Record<string, unknown> | StoreState | ((state: StoreState) => Record<string, unknown> | StoreState | null | undefined);
|
|
61
62
|
export interface DispatchAction {
|
|
62
63
|
type?: string;
|
|
63
|
-
payload:
|
|
64
|
+
payload: StoreUpdatePayload;
|
|
65
|
+
replace?: boolean;
|
|
64
66
|
}
|
|
65
67
|
export interface StoreProps extends ParamsProps {
|
|
66
68
|
children: React.ReactNode;
|
|
@@ -86,7 +88,7 @@ export interface ParamsProps {
|
|
|
86
88
|
series?: Partial<SeriesProps>;
|
|
87
89
|
frequencyTagLine?: Partial<FrequencyTagLineBoardProps>;
|
|
88
90
|
frequencyAllocation?: Partial<FrequencyAllocationProps>;
|
|
89
|
-
|
|
91
|
+
toolbar?: Partial<ToolbarProps>;
|
|
90
92
|
band?: Partial<BandProps>;
|
|
91
93
|
levelStream?: Partial<LevelStreamProps>;
|
|
92
94
|
deltaMeasurement?: Partial<DeltaMeasurementProps>;
|
package/types/store/ui.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { FluorescenceRenderMode } from '@rfkit/renderer';
|
|
2
2
|
import type { ModuleType } from '../../config';
|
|
3
3
|
import type { AxisXRange, RecursiveObject, TopRightBottomLeft } from '..';
|
|
4
|
+
export interface ToolbarProps {
|
|
5
|
+
show: boolean;
|
|
6
|
+
hiddenTools?: string[];
|
|
7
|
+
}
|
|
4
8
|
export interface SystemConfig {
|
|
5
9
|
width: number;
|
|
6
10
|
height: number;
|
|
@@ -9,10 +13,6 @@ export interface SystemConfig {
|
|
|
9
13
|
borderRadius: boolean;
|
|
10
14
|
onChange: (e: RecursiveObject) => void;
|
|
11
15
|
}
|
|
12
|
-
export interface ToolsBarProps {
|
|
13
|
-
show: boolean;
|
|
14
|
-
hiddenTools?: string[];
|
|
15
|
-
}
|
|
16
16
|
export interface LimitProps {
|
|
17
17
|
show: boolean;
|
|
18
18
|
disabled?: boolean;
|
|
@@ -22,10 +22,24 @@ export interface LimitProps {
|
|
|
22
22
|
label?: string;
|
|
23
23
|
onChange: (l: number[]) => void;
|
|
24
24
|
}
|
|
25
|
+
export interface CursorEventSnapshot {
|
|
26
|
+
sourceId: string;
|
|
27
|
+
sourceType: ModuleType;
|
|
28
|
+
clientX: number;
|
|
29
|
+
clientY: number;
|
|
30
|
+
bounds: {
|
|
31
|
+
left: number;
|
|
32
|
+
top: number;
|
|
33
|
+
right: number;
|
|
34
|
+
bottom: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
25
39
|
export interface CursorProps {
|
|
26
40
|
show: boolean;
|
|
27
41
|
active: boolean;
|
|
28
|
-
event:
|
|
42
|
+
event: CursorEventSnapshot | null;
|
|
29
43
|
coord: TopRightBottomLeft;
|
|
30
44
|
timeout: number;
|
|
31
45
|
mode?: ModuleType;
|
package/utils/cn.d.ts
ADDED
package/utils/converter.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ declare const mW2dBm: (input: number) => number;
|
|
|
12
12
|
declare const mW2dBuV: (input: number) => number;
|
|
13
13
|
declare const mW2V: (input: number) => number;
|
|
14
14
|
declare const spectrum2dBm: (inputs: Array<number>) => number[];
|
|
15
|
-
export { dBm2dBuV,
|
|
15
|
+
export { dBm2dBuV, dBm2mW, dBm2V, dBuV2dBm, dBuV2mW, dBuV2uV, dBuV2V, mW2dBm, mW2dBuV, mW2V, spectrum2dBm, V2dBm, V2dBuV, V2mW };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ModuleType } from '../config';
|
|
2
|
+
import type { CursorEventSnapshot } from '../types/store';
|
|
3
|
+
interface CursorStateLike {
|
|
4
|
+
show: boolean;
|
|
5
|
+
active: boolean;
|
|
6
|
+
event?: {
|
|
7
|
+
sourceType?: ModuleType;
|
|
8
|
+
} | null;
|
|
9
|
+
}
|
|
10
|
+
export declare const hasActiveSpectrumCursor: (cursor: CursorStateLike) => boolean;
|
|
11
|
+
export declare const resolveCursorVisibleBounds: (target: HTMLElement) => CursorEventSnapshot["bounds"];
|
|
12
|
+
export {};
|
|
@@ -135,6 +135,14 @@ export declare function calculatePositionFromFrequencyRange(range: FrequencyRang
|
|
|
135
135
|
* @returns 光标位置信息
|
|
136
136
|
*/
|
|
137
137
|
export declare function calculateCursorPosition(left: number, segments: SegmentType[]): CursorPosition;
|
|
138
|
+
/**
|
|
139
|
+
* 根据当前光标段位和点索引,获取内部命中使用的精确频率。
|
|
140
|
+
*
|
|
141
|
+
* 注意:
|
|
142
|
+
* - 这里返回的是基于 frequencyCache 的采样频率,不是展示层格式化后的字符串
|
|
143
|
+
* - 用于 hover / active 命中,可以避免展示格式化或索引换算差异带来的误判
|
|
144
|
+
*/
|
|
145
|
+
export declare function getCursorFrequencyAtPosition(segments: SegmentType[], position: CursorPosition): number;
|
|
138
146
|
/**
|
|
139
147
|
* 判断光标是否在频率范围内(使用索引 + 容差)
|
|
140
148
|
*
|
package/utils/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { TimestampedFloat32Array } from '@rfkit/spectrum-analyzer';
|
|
5
5
|
export * from './array';
|
|
6
|
+
export * from './cursor';
|
|
6
7
|
export * from './frequency';
|
|
7
8
|
export * from './frequencyCalculation';
|
|
8
9
|
export * from './object';
|
|
9
|
-
export * from './theme';
|
|
10
10
|
export * from './throttle';
|
|
11
11
|
export * from './time';
|
|
12
12
|
/**
|