@rfkit/charts 1.4.0 → 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 +156 -273
- package/components/AxisY/heatmap/index.d.ts +1 -1
- package/components/AxisY/heatmap/variants/standard/index.d.ts +6 -0
- package/components/Container/runtime.d.ts +10 -0
- package/components/Cursor/popover-support.d.ts +8 -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 +2 -2
- package/config/constants.d.ts +2 -2
- package/hooks/index.d.ts +1 -2
- package/hooks/module-subscription-core.d.ts +23 -0
- package/hooks/publish/enhancedPublish.d.ts +1 -1
- package/hooks/publish/index.d.ts +0 -1
- package/hooks/publish/publish-event.d.ts +9 -0
- package/hooks/useLevelStreamAnalyzer.d.ts +1 -1
- package/hooks/useModuleSubscription.d.ts +21 -23
- package/index.d.ts +5 -5
- package/index.js +7378 -6950
- 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 +1 -1
- 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/model/resolveFrequencyAllocationData.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyAllocation/model/resolver.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyAllocation/model/useAllocationAtCursor.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyAllocation/model/useFrequencyAllocationData.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyAllocation/presenters/AllocationInfo/index.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyAllocation/presenters/AllocationSegments/index.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyAllocation/tools.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyAllocation/types.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyDataBoard/panels/StationInfoPanel/index.d.ts +1 -1
- package/{components → modules/Spectrum}/FrequencyTagLine/index.d.ts +1 -1
- 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/model/resolver.d.ts +1 -1
- package/{components → modules/Spectrum}/Signal/model/useStationInfoAtCursor.d.ts +1 -1
- package/{components → modules/Spectrum}/Signal/tools.d.ts +1 -1
- package/{components → modules/Spectrum}/Signal/useSignalDataManager.d.ts +1 -1
- package/{components → modules/Spectrum}/Signal/utils.d.ts +3 -3
- 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 +21 -4
- package/{modules/tools.d.ts → runtime/passThrough.d.ts} +1 -1
- package/store/chart-store.d.ts +11 -0
- package/store/context.d.ts +5 -2
- package/store/hooks/index.d.ts +1 -1
- package/store/hooks/useStore.d.ts +11 -1
- package/store/index.d.ts +1 -1
- package/store/reducer.d.ts +1 -33
- package/store/runtime.d.ts +16 -0
- package/tailwind-bridge.css +28 -101
- package/theme/init-charts-theme.d.ts +7 -11
- package/theme/style-scope.d.ts +0 -1
- package/{utils/theme.d.ts → theme/theme-color.d.ts} +0 -11
- 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 +4 -4
- package/utils/index.d.ts +0 -1
- package/utils/subscription.d.ts +18 -3
- 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/popovers/index.d.ts +0 -10
- package/components/SignalAnalysis/Switch/index.d.ts +0 -3
- package/components/ToolsBar/registry.d.ts +0 -12
- package/components/ToolsBar/toggles/index.d.ts +0 -10
- package/components/Zoom/ZoomOffsetContainer/index.d.ts +0 -7
- package/lib/LevelStream/useAxisY.d.ts +0 -1
- package/theme/charts-theme-controller.d.ts +0 -27
- package/theme/charts-theme-environment.d.ts +0 -7
- package/theme/shadcn-theme-config.d.ts +0 -221
- /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/{lib → charts}/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/{ToolsBar → Toolbar}/controls/Reset.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/controls/SegmentsDisplayControl/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/controls/SeriesControl/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/controls/SeriesDisplayControl/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/controls/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/decorations/GradientRibbon/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/decorations/SpacerLine.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/decorations/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/primitives/IconBox.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/primitives/ToolbarContentBox.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/primitives/ToolbarDropdown.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/primitives/ToolbarGlyph.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/primitives/ToolbarGroup.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/primitives/ToolbarGroupIconBox.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/primitives/ToolbarSurface.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/primitives/index.d.ts +0 -0
- /package/components/{ToolsBar → Toolbar}/primitives/styles.d.ts +0 -0
- /package/{components/GaugeBox/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}/FrequencyAllocation/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyAllocation/model/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyAllocation/overlays/Tooltip/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyAllocation/overlays/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyAllocation/presenters/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyDataBoard/hooks/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyDataBoard/hooks/useStationInfoAtCursor.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyDataBoard/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/FrequencyDataBoard/panels/index.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 → modules/Spectrum}/Signal/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Signal/metadata/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Signal/metadata/signalType.d.ts +0 -0
- /package/{components → modules/Spectrum}/Signal/model/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Signal/model/useUnifiedSignals.d.ts +0 -0
- /package/{components → modules/Spectrum}/Signal/presenters/SignalSegments/index.d.ts +0 -0
- /package/{components → modules/Spectrum}/Signal/presenters/index.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
|
@@ -21,11 +21,9 @@ interface GaugeRenderState extends BaseRenderState<Gauge> {
|
|
|
21
21
|
* 不完全继承 CircularRenderer,而是直接继承 BaseRenderer
|
|
22
22
|
*/
|
|
23
23
|
export default class GaugeRender extends BaseRenderer<Gauge, GaugeRenderState, GaugeData> {
|
|
24
|
-
private themeUnsubscribe;
|
|
25
24
|
constructor(props: GaugeRenderProps);
|
|
26
25
|
protected init(): void;
|
|
27
26
|
updateProps(p: Record<string, unknown>): void;
|
|
28
27
|
updateSeries(data: GaugeData): void;
|
|
29
|
-
destroy(): void;
|
|
30
28
|
}
|
|
31
29
|
export {};
|
|
@@ -14,9 +14,11 @@ interface HeatmapRenderState extends GradientRenderState<IHeatmap> {
|
|
|
14
14
|
heatmapDefaultData: number[][];
|
|
15
15
|
}
|
|
16
16
|
export default class Heatmap extends GradientRenderer<IHeatmap, HeatmapRenderState, number[][]> {
|
|
17
|
+
private lastSeriesData;
|
|
17
18
|
constructor(props: HeatmapRenderProps);
|
|
18
19
|
protected init(): void;
|
|
19
20
|
updateSeries(data: number[][]): void;
|
|
21
|
+
updateParams(params: Partial<HeatmapRenderState>): void;
|
|
20
22
|
setRange(realRange?: [number, number]): void;
|
|
21
23
|
reset(): void;
|
|
22
24
|
resize(): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const TOTAL_LINE_HIDDEN_OFFSET = -200;
|
|
2
|
+
export declare const applyOccupancyTotalLineValue: (lineElement: HTMLDivElement | null, valueElement: HTMLDivElement | null, value?: number) => void;
|
|
3
|
+
export declare const withOccupancyTotalLine: (id: string, name?: string, func?: (value: number) => void) => (...args: any[]) => void;
|
|
4
|
+
export declare const publishOccupancyTotalLine: (id: string, value?: number) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type CSMCallback } from '
|
|
1
|
+
import { type CSMCallback } from '../../../utils/subscription';
|
|
2
2
|
export declare const BLAZE_PROGRESS: (globalID: string, func?: CSMCallback) => (...args: any[]) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { FrequencyAllocationItem } from '
|
|
1
|
+
import type { FrequencyAllocationItem } from '../../../../types';
|
|
2
2
|
export declare function resolveFrequencyAllocationData(data?: FrequencyAllocationItem[]): FrequencyAllocationItem[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
import type { FrequencyAllocationItem, SegmentType } from '
|
|
2
|
+
import type { FrequencyAllocationItem, SegmentType } from '../../../../types';
|
|
3
3
|
import type { BandPosition, FrequencyRange } from '../types';
|
|
4
4
|
export interface FrequencyAllocationSegmentData {
|
|
5
5
|
segment: SegmentType;
|
package/{components → modules/Spectrum}/FrequencyAllocation/model/useAllocationAtCursor.d.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface UseAllocationFinderProps {
|
|
2
2
|
frequency: string;
|
|
3
3
|
}
|
|
4
|
-
export declare function useAllocationAtCursor({ frequency }: UseAllocationFinderProps): import("
|
|
4
|
+
export declare function useAllocationAtCursor({ frequency }: UseAllocationFinderProps): import("../../../..").FrequencyAllocationItem;
|
|
5
5
|
export declare const useAllocationFinder: typeof useAllocationAtCursor;
|
|
6
6
|
export {};
|
package/{components → modules/Spectrum}/FrequencyAllocation/model/useFrequencyAllocationData.d.ts
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useFrequencyAllocationData(): import("
|
|
1
|
+
export declare function useFrequencyAllocationData(): import("../../../..").FrequencyAllocationItem[];
|
package/{components → modules/Spectrum}/FrequencyAllocation/presenters/AllocationSegments/index.d.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { BandPosition, FrequencyRange } from '../../types';
|
|
3
|
-
import type { FrequencyAllocationItem } from '
|
|
3
|
+
import type { FrequencyAllocationItem } from '../../../../../types';
|
|
4
4
|
interface AllocationSegmentsProps {
|
|
5
5
|
style: React.CSSProperties;
|
|
6
6
|
bandPositions: BandPosition[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ToolType } from '
|
|
2
|
+
import { ToolType } from '../../../config';
|
|
3
3
|
import FrequencyTagLineBoard from './Board';
|
|
4
4
|
import FrequencyTagLineSwitch from './Switch';
|
|
5
5
|
export { FrequencyTagLineBoard, FrequencyTagLineSwitch };
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* - realData.peaks.peaks[1] = 次峰
|
|
16
16
|
* - realData.peaks.peaks[n] = 第 n+1 峰(可扩展)
|
|
17
17
|
*/
|
|
18
|
-
import { MarkerEventType } from '
|
|
19
|
-
import type { MarkerType, SetMarker } from '
|
|
18
|
+
import { MarkerEventType } from '../../../../config';
|
|
19
|
+
import type { MarkerType, SetMarker } from '../../../../types';
|
|
20
20
|
interface UseMarkersProps {
|
|
21
21
|
id: string;
|
|
22
22
|
globalID: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { RecursiveObject } from '
|
|
1
|
+
import type { RecursiveObject } from '../../../types';
|
|
2
2
|
export default function useScope(): (e: RecursiveObject) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
import type { SegmentType, StationInfoType } from '
|
|
2
|
+
import type { SegmentType, StationInfoType } from '../../../../types';
|
|
3
3
|
import { type SignalMatchCandidate, type UnifiedSignalItem } from '../utils';
|
|
4
4
|
export interface SignalPosition extends SignalMatchCandidate {
|
|
5
5
|
key: string;
|
|
@@ -2,6 +2,6 @@ interface UseStationFinderProps {
|
|
|
2
2
|
frequency: string;
|
|
3
3
|
enabled?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare function useStationInfoAtCursor({ frequency, enabled }: UseStationFinderProps): import("
|
|
5
|
+
export declare function useStationInfoAtCursor({ frequency, enabled }: UseStationFinderProps): import("../../../..").StationInfoType;
|
|
6
6
|
export declare const useStationFinder: typeof useStationInfoAtCursor;
|
|
7
7
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { StationInfoType } from '
|
|
2
|
-
import type { SignalData } from '
|
|
3
|
-
import type { FrequencyRange, FrequencyRangeInput } from '
|
|
1
|
+
import type { StationInfoType } from '../../../types';
|
|
2
|
+
import type { SignalData } from '../../../types/store';
|
|
3
|
+
import type { FrequencyRange, FrequencyRangeInput } from '../../../utils';
|
|
4
4
|
/**
|
|
5
5
|
* 统一的信号数据类型(兼容 StationInfo 和 SignalData)
|
|
6
6
|
*/
|
|
@@ -1,69 +1,48 @@
|
|
|
1
1
|
import { type ISeries } from '@rfkit/renderer';
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { BaseRenderer, type BaseRenderState } from '../base/BaseRenderer';
|
|
3
|
+
import type { AxisYRange, SeriesConfig, SpectrumExtraData } from '../../types';
|
|
4
|
+
interface SpectrumChart extends ISeries {
|
|
5
|
+
clear(): void;
|
|
6
|
+
dispose(): void;
|
|
7
|
+
draw(): void;
|
|
8
|
+
render(config: {
|
|
9
|
+
data: Float32Array;
|
|
10
|
+
name: string;
|
|
11
|
+
} & Partial<SeriesConfig>): void;
|
|
12
|
+
resize(): void;
|
|
13
|
+
setIntervel(interval: number): void;
|
|
14
|
+
setRange(range: AxisYRange): void;
|
|
15
|
+
setSeries(config: Partial<SeriesConfig> & {
|
|
16
|
+
name: string;
|
|
17
|
+
}): void;
|
|
18
|
+
updateProps(props: Record<string, unknown>): void;
|
|
19
|
+
}
|
|
20
|
+
interface SpectrumState extends BaseRenderState<SpectrumChart> {
|
|
5
21
|
autoranging: boolean;
|
|
6
|
-
|
|
7
|
-
id: string;
|
|
8
|
-
renderRange: [number, number];
|
|
22
|
+
globalID: string;
|
|
9
23
|
interval: number;
|
|
24
|
+
prevAutoRangeTime: number;
|
|
25
|
+
renderRange: AxisYRange;
|
|
10
26
|
series: Record<string, SeriesConfig>;
|
|
11
|
-
globalID: string;
|
|
12
|
-
[key: string]: unknown;
|
|
13
27
|
}
|
|
14
|
-
export
|
|
15
|
-
|
|
28
|
+
export interface SpectrumRenderPayload {
|
|
29
|
+
data: Record<string | number, Float32Array>;
|
|
30
|
+
extraData?: SpectrumExtraData;
|
|
31
|
+
}
|
|
32
|
+
export default class Spectrum extends BaseRenderer<SpectrumChart, SpectrumState, SpectrumRenderPayload> {
|
|
16
33
|
useRangeAutoFocus: () => void;
|
|
17
|
-
useRangeSet: () => void;
|
|
18
34
|
firstRenderAutoFocus: boolean;
|
|
19
|
-
seriesUnsubscribe?: () => void;
|
|
20
35
|
constructor(props: Record<string, unknown>);
|
|
21
|
-
|
|
22
|
-
* 初始化 series 订阅机制
|
|
23
|
-
*/
|
|
24
|
-
initSeriesSubscription(): void;
|
|
25
|
-
init(): void;
|
|
36
|
+
protected init(): void;
|
|
26
37
|
initSeries(): void;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* TODO:可以自定义线
|
|
30
|
-
*/
|
|
31
|
-
updateSeries(d: Record<string | number, Float32Array>, extraData?: Map<string, {
|
|
32
|
-
outputData: Float32Array;
|
|
33
|
-
originalData: Float32Array;
|
|
34
|
-
}>): void;
|
|
35
|
-
updateMainSeries(data: {
|
|
36
|
-
length: number;
|
|
37
|
-
at: (arg0: number) => number | undefined;
|
|
38
|
-
}): void;
|
|
39
|
-
/**
|
|
40
|
-
* 更新参数
|
|
41
|
-
*/
|
|
42
|
-
updateParams(params: Record<string, unknown>): void;
|
|
43
|
-
/**
|
|
44
|
-
* 设置线信息
|
|
45
|
-
*/
|
|
38
|
+
updateSeries({ data, extraData }: SpectrumRenderPayload): void;
|
|
39
|
+
private updateMainSeries;
|
|
46
40
|
setSeries(config: SeriesConfig, skipEventEmit?: boolean): void;
|
|
47
41
|
setDisabledClearRect(disabledClearRect: boolean): void;
|
|
48
|
-
setRange(renderRange?:
|
|
42
|
+
setRange(renderRange?: AxisYRange): void;
|
|
49
43
|
zoom(): void;
|
|
50
44
|
reset(): void;
|
|
51
45
|
resize(): void;
|
|
52
|
-
/**
|
|
53
|
-
* 清除图表内容(不取消订阅)
|
|
54
|
-
*/
|
|
55
46
|
clearChart(): void;
|
|
56
|
-
/**
|
|
57
|
-
* 销毁实例(取消订阅)
|
|
58
|
-
*/
|
|
59
|
-
destroy(): void;
|
|
60
|
-
/**
|
|
61
|
-
* 组件卸载时的清理(useChart 会调用此方法)
|
|
62
|
-
*/
|
|
63
|
-
dispose(): () => void;
|
|
64
|
-
/**
|
|
65
|
-
* @deprecated 使用 clearChart() 或 destroy()
|
|
66
|
-
*/
|
|
67
|
-
clear(): void;
|
|
68
47
|
}
|
|
69
48
|
export {};
|
|
@@ -30,7 +30,9 @@ interface ChartLike {
|
|
|
30
30
|
clear?: () => void;
|
|
31
31
|
draw?: () => void;
|
|
32
32
|
updateProps?: (props: Record<string, unknown>) => void;
|
|
33
|
+
dispose?: () => void;
|
|
33
34
|
}
|
|
35
|
+
type RendererCleanup = () => void;
|
|
34
36
|
/**
|
|
35
37
|
* 渲染器抽象基类
|
|
36
38
|
*
|
|
@@ -42,6 +44,9 @@ export declare abstract class BaseRenderer<TChart extends ChartLike, TState exte
|
|
|
42
44
|
/** 公开 state 以兼容 RenderChartType 接口 */
|
|
43
45
|
state: TState;
|
|
44
46
|
protected resizeTimer: ReturnType<typeof setTimeout> | null;
|
|
47
|
+
protected resizeObserver: ResizeObserver | null;
|
|
48
|
+
private destroyed;
|
|
49
|
+
private cleanupTasks;
|
|
45
50
|
constructor(initialState: TState);
|
|
46
51
|
/**
|
|
47
52
|
* 初始化图表引擎(子类必须实现)
|
|
@@ -51,6 +56,14 @@ export declare abstract class BaseRenderer<TChart extends ChartLike, TState exte
|
|
|
51
56
|
* 更新数据(子类必须实现)
|
|
52
57
|
*/
|
|
53
58
|
abstract updateSeries(data: TData): void;
|
|
59
|
+
/**
|
|
60
|
+
* 更新运行时参数
|
|
61
|
+
*/
|
|
62
|
+
updateParams(params: Partial<TState>): void;
|
|
63
|
+
/**
|
|
64
|
+
* 参数更新后的钩子,为子类提供 hook
|
|
65
|
+
*/
|
|
66
|
+
protected onParamsUpdated(_params: Partial<TState>): void;
|
|
54
67
|
/**
|
|
55
68
|
* 重置(清空 + 调整大小)
|
|
56
69
|
*/
|
|
@@ -79,5 +92,55 @@ export declare abstract class BaseRenderer<TChart extends ChartLike, TState exte
|
|
|
79
92
|
* 清理 resize 定时器
|
|
80
93
|
*/
|
|
81
94
|
protected clearResizeTimer(): void;
|
|
95
|
+
/**
|
|
96
|
+
* 注册统一 cleanup,由基类在 destroy 时回收
|
|
97
|
+
*/
|
|
98
|
+
protected trackCleanup(cleanup?: RendererCleanup | null): () => void;
|
|
99
|
+
/**
|
|
100
|
+
* 获取图表容器元素
|
|
101
|
+
*/
|
|
102
|
+
protected getContainerElement(): HTMLElement | null;
|
|
103
|
+
/**
|
|
104
|
+
* 获取图表容器当前尺寸
|
|
105
|
+
*/
|
|
106
|
+
protected getContainerSize(): {
|
|
107
|
+
width: number;
|
|
108
|
+
height: number;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* 子类可覆盖最小可绘制尺寸
|
|
112
|
+
*/
|
|
113
|
+
protected getMinimumContainerSize(): {
|
|
114
|
+
width: number;
|
|
115
|
+
height: number;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* 当前容器尺寸是否足以安全触发 renderer 绘制
|
|
119
|
+
*/
|
|
120
|
+
protected hasRenderableContainerSize(): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* 监听图表容器尺寸,避免只靠初始化阶段的一次性 resize
|
|
123
|
+
*/
|
|
124
|
+
protected observeContainerResize(): void;
|
|
125
|
+
/**
|
|
126
|
+
* 清理容器尺寸监听
|
|
127
|
+
*/
|
|
128
|
+
protected clearResizeObserver(): void;
|
|
129
|
+
/**
|
|
130
|
+
* 清理统一注册的 cleanup 任务
|
|
131
|
+
*/
|
|
132
|
+
protected runCleanupTasks(): void;
|
|
133
|
+
/**
|
|
134
|
+
* 销毁前钩子,子类可覆盖
|
|
135
|
+
*/
|
|
136
|
+
protected beforeDestroy(): void;
|
|
137
|
+
/**
|
|
138
|
+
* 释放底层 chart 实例,避免 renderer 引擎残留监听和 canvas/WebGL 资源
|
|
139
|
+
*/
|
|
140
|
+
protected disposeChartInstance(): void;
|
|
141
|
+
/**
|
|
142
|
+
* 在容器尺寸满足条件后再初始化 chart,避免 renderer 在错误尺寸下提前绘制
|
|
143
|
+
*/
|
|
144
|
+
protected initializeChartWhenReady(): void;
|
|
82
145
|
}
|
|
83
146
|
export {};
|
|
@@ -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,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rfkit/charts",
|
|
3
|
-
"
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Chart components for wireless monitoring web applications",
|
|
4
6
|
"exports": {
|
|
5
7
|
".": {
|
|
6
8
|
"types": "./index.d.ts",
|
|
@@ -8,10 +10,25 @@
|
|
|
8
10
|
},
|
|
9
11
|
"./tailwind-bridge.css": "./tailwind-bridge.css"
|
|
10
12
|
},
|
|
11
|
-
"module": "index.js",
|
|
12
|
-
"types": "index.d.ts",
|
|
13
|
+
"module": "./index.js",
|
|
14
|
+
"types": "./index.d.ts",
|
|
13
15
|
"author": "Hxgh",
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"react": ">=16.9.0",
|
|
18
|
+
"react-dom": ">=16.9.0"
|
|
19
|
+
},
|
|
14
20
|
"license": "MIT",
|
|
15
|
-
"
|
|
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",
|
|
16
33
|
"private": false
|
|
17
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;
|
|
@@ -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/context.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { DispatchAction
|
|
2
|
+
import type { DispatchAction } from '../types/store';
|
|
3
|
+
import type { ChartStore } from './chart-store';
|
|
4
|
+
import type { ChartRuntime } from './runtime';
|
|
3
5
|
export interface AppContextType {
|
|
4
|
-
|
|
6
|
+
runtime: ChartRuntime;
|
|
7
|
+
store: ChartStore;
|
|
5
8
|
dispatch: (action: DispatchAction) => void;
|
|
6
9
|
}
|
|
7
10
|
declare const AppContext: React.Context<AppContextType>;
|
package/store/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useSelector, useStore } from './useStore';
|
|
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';
|