@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.
Files changed (175) hide show
  1. package/README.md +156 -273
  2. package/components/AxisY/heatmap/index.d.ts +1 -1
  3. package/components/AxisY/heatmap/variants/standard/index.d.ts +6 -0
  4. package/components/Container/runtime.d.ts +10 -0
  5. package/components/Cursor/popover-support.d.ts +8 -0
  6. package/components/Toolbar/registry.d.ts +12 -0
  7. package/components/Toolbar/toggles/index.d.ts +10 -0
  8. package/components/Zoom/ZoomViewportLayer.d.ts +7 -0
  9. package/components/ui/button.d.ts +2 -2
  10. package/config/constants.d.ts +2 -2
  11. package/hooks/index.d.ts +1 -2
  12. package/hooks/module-subscription-core.d.ts +23 -0
  13. package/hooks/publish/enhancedPublish.d.ts +1 -1
  14. package/hooks/publish/index.d.ts +0 -1
  15. package/hooks/publish/publish-event.d.ts +9 -0
  16. package/hooks/useLevelStreamAnalyzer.d.ts +1 -1
  17. package/hooks/useModuleSubscription.d.ts +21 -23
  18. package/index.d.ts +5 -5
  19. package/index.js +7378 -6950
  20. package/modules/Gauge/render.d.ts +0 -2
  21. package/{components/HeatmapCapture → modules/Heatmap/Capture}/tools.d.ts +1 -1
  22. package/modules/Heatmap/CursorPopover.d.ts +6 -0
  23. package/modules/Heatmap/render.d.ts +2 -0
  24. package/modules/Level/CursorPopover.d.ts +6 -0
  25. package/modules/Occupancy/CursorPopover.d.ts +3 -0
  26. package/modules/Occupancy/TotalLine/index.d.ts +1 -1
  27. package/modules/Occupancy/total-line-runtime.d.ts +4 -0
  28. package/modules/Spectrum/AxisYCanvas/index.d.ts +6 -0
  29. package/{components/AxisYByCanvas → modules/Spectrum/AxisYCanvas}/useCanvasAxisY.d.ts +1 -1
  30. package/modules/Spectrum/BandLayer/index.d.ts +5 -0
  31. package/modules/Spectrum/BandLayer/useBandLayerController.d.ts +2 -0
  32. package/{components → modules/Spectrum}/Blaze/tools.d.ts +1 -1
  33. package/modules/Spectrum/CursorPopover.d.ts +6 -0
  34. package/{components → modules/Spectrum}/FrequencyAllocation/color.d.ts +1 -1
  35. package/{components → modules/Spectrum}/FrequencyAllocation/model/resolveFrequencyAllocationData.d.ts +1 -1
  36. package/{components → modules/Spectrum}/FrequencyAllocation/model/resolver.d.ts +1 -1
  37. package/{components → modules/Spectrum}/FrequencyAllocation/model/useAllocationAtCursor.d.ts +1 -1
  38. package/{components → modules/Spectrum}/FrequencyAllocation/model/useFrequencyAllocationData.d.ts +1 -1
  39. package/{components → modules/Spectrum}/FrequencyAllocation/presenters/AllocationInfo/index.d.ts +1 -1
  40. package/{components → modules/Spectrum}/FrequencyAllocation/presenters/AllocationSegments/index.d.ts +1 -1
  41. package/{components → modules/Spectrum}/FrequencyAllocation/tools.d.ts +1 -1
  42. package/{components → modules/Spectrum}/FrequencyAllocation/types.d.ts +1 -1
  43. package/{components → modules/Spectrum}/FrequencyDataBoard/panels/StationInfoPanel/index.d.ts +1 -1
  44. package/{components → modules/Spectrum}/FrequencyTagLine/index.d.ts +1 -1
  45. package/{components → modules/Spectrum}/Markers/MarkerItem/index.d.ts +1 -1
  46. package/{components → modules/Spectrum}/Markers/hooks/useMarkerEvents.d.ts +1 -1
  47. package/{components → modules/Spectrum}/Markers/hooks/useMarkers.d.ts +2 -2
  48. package/{components → modules/Spectrum}/Markers/tools.d.ts +1 -1
  49. package/{components → modules/Spectrum}/Scope/useScope.d.ts +1 -1
  50. package/{components → modules/Spectrum}/Signal/model/resolver.d.ts +1 -1
  51. package/{components → modules/Spectrum}/Signal/model/useStationInfoAtCursor.d.ts +1 -1
  52. package/{components → modules/Spectrum}/Signal/tools.d.ts +1 -1
  53. package/{components → modules/Spectrum}/Signal/useSignalDataManager.d.ts +1 -1
  54. package/{components → modules/Spectrum}/Signal/utils.d.ts +3 -3
  55. package/modules/Spectrum/render.d.ts +31 -52
  56. package/{hooks → modules/Spectrum}/useSpectrumAnalyzer/index.d.ts +1 -1
  57. package/modules/base/BaseRenderer.d.ts +63 -0
  58. package/modules/base/CircularRenderer.d.ts +4 -5
  59. package/package.json +21 -4
  60. package/{modules/tools.d.ts → runtime/passThrough.d.ts} +1 -1
  61. package/store/chart-store.d.ts +11 -0
  62. package/store/context.d.ts +5 -2
  63. package/store/hooks/index.d.ts +1 -1
  64. package/store/hooks/useStore.d.ts +11 -1
  65. package/store/index.d.ts +1 -1
  66. package/store/reducer.d.ts +1 -33
  67. package/store/runtime.d.ts +16 -0
  68. package/tailwind-bridge.css +28 -101
  69. package/theme/init-charts-theme.d.ts +7 -11
  70. package/theme/style-scope.d.ts +0 -1
  71. package/{utils/theme.d.ts → theme/theme-color.d.ts} +0 -11
  72. package/theme/theme-contract.d.ts +28 -0
  73. package/theme/theme-runtime.d.ts +14 -0
  74. package/theme/theme-styles.d.ts +10 -0
  75. package/theme/theme-tokens.d.ts +85 -0
  76. package/types/common.d.ts +1 -1
  77. package/types/store/index.d.ts +6 -4
  78. package/types/store/ui.d.ts +4 -4
  79. package/utils/index.d.ts +0 -1
  80. package/utils/subscription.d.ts +18 -3
  81. package/components/AxisY/heatmap/type/Default/index.d.ts +0 -6
  82. package/components/AxisYByCanvas/index.d.ts +0 -6
  83. package/components/Band/index.d.ts +0 -5
  84. package/components/Band/useBand.d.ts +0 -2
  85. package/components/Cursor/popovers/index.d.ts +0 -10
  86. package/components/SignalAnalysis/Switch/index.d.ts +0 -3
  87. package/components/ToolsBar/registry.d.ts +0 -12
  88. package/components/ToolsBar/toggles/index.d.ts +0 -10
  89. package/components/Zoom/ZoomOffsetContainer/index.d.ts +0 -7
  90. package/lib/LevelStream/useAxisY.d.ts +0 -1
  91. package/theme/charts-theme-controller.d.ts +0 -27
  92. package/theme/charts-theme-environment.d.ts +0 -7
  93. package/theme/shadcn-theme-config.d.ts +0 -221
  94. /package/{lib → charts}/Dial/Chart.d.ts +0 -0
  95. /package/{lib → charts}/Dial/index.d.ts +0 -0
  96. /package/{lib → charts}/Gauge/Chart.d.ts +0 -0
  97. /package/{lib → charts}/Gauge/index.d.ts +0 -0
  98. /package/{lib → charts}/Heatmap/Chart.d.ts +0 -0
  99. /package/{lib → charts}/Heatmap/index.d.ts +0 -0
  100. /package/{lib → charts}/IQ/Chart.d.ts +0 -0
  101. /package/{lib → charts}/IQ/index.d.ts +0 -0
  102. /package/{lib → charts}/LevelStream/Chart.d.ts +0 -0
  103. /package/{lib → charts}/LevelStream/index.d.ts +0 -0
  104. /package/{lib → charts}/Occupancy/Chart.d.ts +0 -0
  105. /package/{lib → charts}/Occupancy/index.d.ts +0 -0
  106. /package/{lib → charts}/SpatialSpectrum/Chart.d.ts +0 -0
  107. /package/{lib → charts}/SpatialSpectrum/index.d.ts +0 -0
  108. /package/{lib → charts}/Spectrum/Chart.d.ts +0 -0
  109. /package/{lib → charts}/Spectrum/index.d.ts +0 -0
  110. /package/{lib → charts}/index.d.ts +0 -0
  111. /package/components/AxisY/heatmap/{type/Default → variants/standard}/GradientRibbon/index.d.ts +0 -0
  112. /package/components/AxisY/occupancy/{type/Default → variants/standard}/index.d.ts +0 -0
  113. /package/components/{ToolsBar → Toolbar}/controls/Reset.d.ts +0 -0
  114. /package/components/{ToolsBar → Toolbar}/controls/SegmentsDisplayControl/index.d.ts +0 -0
  115. /package/components/{ToolsBar → Toolbar}/controls/SeriesControl/index.d.ts +0 -0
  116. /package/components/{ToolsBar → Toolbar}/controls/SeriesDisplayControl/index.d.ts +0 -0
  117. /package/components/{ToolsBar → Toolbar}/controls/index.d.ts +0 -0
  118. /package/components/{ToolsBar → Toolbar}/decorations/GradientRibbon/index.d.ts +0 -0
  119. /package/components/{ToolsBar → Toolbar}/decorations/SpacerLine.d.ts +0 -0
  120. /package/components/{ToolsBar → Toolbar}/decorations/index.d.ts +0 -0
  121. /package/components/{ToolsBar → Toolbar}/index.d.ts +0 -0
  122. /package/components/{ToolsBar → Toolbar}/primitives/IconBox.d.ts +0 -0
  123. /package/components/{ToolsBar → Toolbar}/primitives/ToolbarContentBox.d.ts +0 -0
  124. /package/components/{ToolsBar → Toolbar}/primitives/ToolbarDropdown.d.ts +0 -0
  125. /package/components/{ToolsBar → Toolbar}/primitives/ToolbarGlyph.d.ts +0 -0
  126. /package/components/{ToolsBar → Toolbar}/primitives/ToolbarGroup.d.ts +0 -0
  127. /package/components/{ToolsBar → Toolbar}/primitives/ToolbarGroupIconBox.d.ts +0 -0
  128. /package/components/{ToolsBar → Toolbar}/primitives/ToolbarSurface.d.ts +0 -0
  129. /package/components/{ToolsBar → Toolbar}/primitives/index.d.ts +0 -0
  130. /package/components/{ToolsBar → Toolbar}/primitives/styles.d.ts +0 -0
  131. /package/{components/GaugeBox/index.d.ts → modules/Gauge/InteractionSurface.d.ts} +0 -0
  132. /package/{components/HeatmapCapture → modules/Heatmap/Capture}/Area/index.d.ts +0 -0
  133. /package/{components/HeatmapCapture → modules/Heatmap/Capture}/RowIndex/index.d.ts +0 -0
  134. /package/{components/HeatmapCapture → modules/Heatmap/Capture}/Slider/index.d.ts +0 -0
  135. /package/{components/FrequencyTagLine → modules/Heatmap/Capture}/Switch/index.d.ts +0 -0
  136. /package/{components/HeatmapCapture → modules/Heatmap/Capture}/index.d.ts +0 -0
  137. /package/{components/HeatmapCapture → modules/Heatmap/TimeRange}/Switch/index.d.ts +0 -0
  138. /package/{components → modules/Heatmap}/TimeRange/useTimeRange.d.ts +0 -0
  139. /package/{components → modules/Spectrum}/Blaze/index.d.ts +0 -0
  140. /package/{components → modules/Spectrum}/DeltaMeasurement/Switch.d.ts +0 -0
  141. /package/{components → modules/Spectrum}/DeltaMeasurement/index.d.ts +0 -0
  142. /package/{components → modules/Spectrum}/DragFrame/index.d.ts +0 -0
  143. /package/{components → modules/Spectrum}/FrequencyAllocation/Switch/index.d.ts +0 -0
  144. /package/{components → modules/Spectrum}/FrequencyAllocation/data.d.ts +0 -0
  145. /package/{components → modules/Spectrum}/FrequencyAllocation/index.d.ts +0 -0
  146. /package/{components → modules/Spectrum}/FrequencyAllocation/model/index.d.ts +0 -0
  147. /package/{components → modules/Spectrum}/FrequencyAllocation/overlays/Tooltip/index.d.ts +0 -0
  148. /package/{components → modules/Spectrum}/FrequencyAllocation/overlays/index.d.ts +0 -0
  149. /package/{components → modules/Spectrum}/FrequencyAllocation/presenters/index.d.ts +0 -0
  150. /package/{components → modules/Spectrum}/FrequencyDataBoard/hooks/index.d.ts +0 -0
  151. /package/{components → modules/Spectrum}/FrequencyDataBoard/hooks/useStationInfoAtCursor.d.ts +0 -0
  152. /package/{components → modules/Spectrum}/FrequencyDataBoard/index.d.ts +0 -0
  153. /package/{components → modules/Spectrum}/FrequencyDataBoard/panels/index.d.ts +0 -0
  154. /package/{components → modules/Spectrum}/FrequencyTagLine/Board/index.d.ts +0 -0
  155. /package/{components/Limit → modules/Spectrum/FrequencyTagLine}/Switch/index.d.ts +0 -0
  156. /package/{components → modules/Spectrum}/Legend/index.d.ts +0 -0
  157. /package/{components → modules/Spectrum}/Limit/Item.d.ts +0 -0
  158. /package/{components/TimeRange → modules/Spectrum/Limit}/Switch/index.d.ts +0 -0
  159. /package/{components → modules/Spectrum}/Limit/index.d.ts +0 -0
  160. /package/{components → modules/Spectrum}/Markers/Switch/index.d.ts +0 -0
  161. /package/{components → modules/Spectrum}/Markers/index.d.ts +0 -0
  162. /package/{components → modules/Spectrum}/Scope/index.d.ts +0 -0
  163. /package/{components → modules/Spectrum}/SegmentsZebra/index.d.ts +0 -0
  164. /package/{components → modules/Spectrum}/Signal/Switch/index.d.ts +0 -0
  165. /package/{components → modules/Spectrum}/Signal/index.d.ts +0 -0
  166. /package/{components → modules/Spectrum}/Signal/metadata/index.d.ts +0 -0
  167. /package/{components → modules/Spectrum}/Signal/metadata/signalType.d.ts +0 -0
  168. /package/{components → modules/Spectrum}/Signal/model/index.d.ts +0 -0
  169. /package/{components → modules/Spectrum}/Signal/model/useUnifiedSignals.d.ts +0 -0
  170. /package/{components → modules/Spectrum}/Signal/presenters/SignalSegments/index.d.ts +0 -0
  171. /package/{components → modules/Spectrum}/Signal/presenters/index.d.ts +0 -0
  172. /package/{components → modules/Spectrum}/Stripe/Switch/index.d.ts +0 -0
  173. /package/{components → modules/Spectrum}/Stripe/index.d.ts +0 -0
  174. /package/{hooks/publish → modules/Spectrum}/useMarkerPublish.d.ts +0 -0
  175. /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 {};
@@ -1,4 +1,4 @@
1
- import type { AxisXProps, HeatmapAreaData, HeatmapCaptureProps } from '../../types';
1
+ import type { AxisXProps, HeatmapAreaData, HeatmapCaptureProps } from '../../../types';
2
2
  interface Coordinates {
3
3
  startLeft: number;
4
4
  endLeft: number;
@@ -0,0 +1,6 @@
1
+ import type React from 'react';
2
+ interface HeatmapCursorPopoverProps {
3
+ id: string;
4
+ }
5
+ declare const HeatmapCursorPopover: React.FC<HeatmapCursorPopoverProps>;
6
+ export default HeatmapCursorPopover;
@@ -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,6 @@
1
+ import type React from 'react';
2
+ interface LevelCursorPopoverProps {
3
+ id: string;
4
+ }
5
+ declare const LevelCursorPopover: React.FC<LevelCursorPopoverProps>;
6
+ export default LevelCursorPopover;
@@ -0,0 +1,3 @@
1
+ import type React from 'react';
2
+ declare const OccupancyCursorPopover: React.FC;
3
+ export default OccupancyCursorPopover;
@@ -1,6 +1,6 @@
1
1
  import type React from 'react';
2
2
  interface Props {
3
- value?: number;
3
+ id: string;
4
4
  }
5
5
  declare const TotalLine: React.FC<Props>;
6
6
  export default TotalLine;
@@ -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;
@@ -0,0 +1,6 @@
1
+ import type { RenderChartType } from '../../../types';
2
+ interface AxisYCanvasProps {
3
+ chart: RenderChartType;
4
+ }
5
+ export default function AxisYCanvas(props: AxisYCanvasProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1,4 +1,4 @@
1
- import type { RangeController } from '../AxisY/spectrum/useRanging';
1
+ import type { RangeController } from '../../../components/AxisY/spectrum/useRanging';
2
2
  interface CanvasAxisYOptions {
3
3
  ranging?: RangeController;
4
4
  }
@@ -0,0 +1,5 @@
1
+ import type React from 'react';
2
+ import useBandLayerController from './useBandLayerController';
3
+ export { useBandLayerController };
4
+ declare const BandLayer: React.FC;
5
+ export default BandLayer;
@@ -0,0 +1,2 @@
1
+ import type { BandProps } from '../../../types';
2
+ export default function useBandLayerController(): (e: BandProps) => void;
@@ -1,2 +1,2 @@
1
- import { type CSMCallback } from '../../utils/subscription';
1
+ import { type CSMCallback } from '../../../utils/subscription';
2
2
  export declare const BLAZE_PROGRESS: (globalID: string, func?: CSMCallback) => (...args: any[]) => void;
@@ -0,0 +1,6 @@
1
+ import type React from 'react';
2
+ interface SpectrumCursorPopoverProps {
3
+ id: string;
4
+ }
5
+ declare const SpectrumCursorPopover: React.FC<SpectrumCursorPopoverProps>;
6
+ export default SpectrumCursorPopover;
@@ -1,4 +1,4 @@
1
- import type { FrequencyAllocationItem } from '../../types';
1
+ import type { FrequencyAllocationItem } from '../../../types';
2
2
  export declare const optimizedColors: string[];
3
3
  export declare function hexToHsl(hex: string): {
4
4
  h: number;
@@ -1,2 +1,2 @@
1
- import type { FrequencyAllocationItem } from '../../../types';
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 '../../../types';
2
+ import type { FrequencyAllocationItem, SegmentType } from '../../../../types';
3
3
  import type { BandPosition, FrequencyRange } from '../types';
4
4
  export interface FrequencyAllocationSegmentData {
5
5
  segment: SegmentType;
@@ -1,6 +1,6 @@
1
1
  interface UseAllocationFinderProps {
2
2
  frequency: string;
3
3
  }
4
- export declare function useAllocationAtCursor({ frequency }: UseAllocationFinderProps): import("../../..").FrequencyAllocationItem;
4
+ export declare function useAllocationAtCursor({ frequency }: UseAllocationFinderProps): import("../../../..").FrequencyAllocationItem;
5
5
  export declare const useAllocationFinder: typeof useAllocationAtCursor;
6
6
  export {};
@@ -1 +1 @@
1
- export declare function useFrequencyAllocationData(): import("../../..").FrequencyAllocationItem[];
1
+ export declare function useFrequencyAllocationData(): import("../../../..").FrequencyAllocationItem[];
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { FrequencyAllocationItem } from '../../../../types';
2
+ import type { FrequencyAllocationItem } from '../../../../../types';
3
3
  interface Props {
4
4
  allocationInfo?: FrequencyAllocationItem & {
5
5
  startFrequency?: string | number;
@@ -1,6 +1,6 @@
1
1
  import type React from 'react';
2
2
  import type { BandPosition, FrequencyRange } from '../../types';
3
- import type { FrequencyAllocationItem } from '../../../../types';
3
+ import type { FrequencyAllocationItem } from '../../../../../types';
4
4
  interface AllocationSegmentsProps {
5
5
  style: React.CSSProperties;
6
6
  bandPositions: BandPosition[];
@@ -1,4 +1,4 @@
1
- import type { FrequencyAllocationItem } from '../../types';
1
+ import type { FrequencyAllocationItem } from '../../../types';
2
2
  /**
3
3
  * 从本地缓存读取FrequencyAllocation数据
4
4
  * @returns FrequencyAllocationItem数组或null
@@ -1,4 +1,4 @@
1
- import type { FrequencyAllocationItem } from '../../types';
1
+ import type { FrequencyAllocationItem } from '../../../types';
2
2
  export interface TooltipState extends FrequencyAllocationItem {
3
3
  visible: boolean;
4
4
  x: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { StationInfoType } from '../../../../types';
2
+ import type { StationInfoType } from '../../../../../types';
3
3
  interface Props {
4
4
  stationInfo?: StationInfoType;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ToolType } from '../../config';
2
+ import { ToolType } from '../../../config';
3
3
  import FrequencyTagLineBoard from './Board';
4
4
  import FrequencyTagLineSwitch from './Switch';
5
5
  export { FrequencyTagLineBoard, FrequencyTagLineSwitch };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { MarkerType } from '../../../types';
2
+ import type { MarkerType } from '../../../../types';
3
3
  interface Props {
4
4
  marker: MarkerType;
5
5
  }
@@ -1,4 +1,4 @@
1
- import type { MarkerType, TopRightBottomLeft } from '../../../types';
1
+ import type { MarkerType, TopRightBottomLeft } from '../../../../types';
2
2
  interface UseMarkerEventsProps {
3
3
  id: string;
4
4
  markers: MarkerType[];
@@ -15,8 +15,8 @@
15
15
  * - realData.peaks.peaks[1] = 次峰
16
16
  * - realData.peaks.peaks[n] = 第 n+1 峰(可扩展)
17
17
  */
18
- import { MarkerEventType } from '../../../config';
19
- import type { MarkerType, SetMarker } from '../../../types';
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,4 +1,4 @@
1
- import type { MarkerType, RecursiveFunction, SegmentsType } from '../../types';
1
+ import type { MarkerType, RecursiveFunction, SegmentsType } from '../../../types';
2
2
  /**
3
3
  * Marker 工具函数集合 - 精简版
4
4
  */
@@ -1,2 +1,2 @@
1
- import type { RecursiveObject } from '../../types';
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 '../../../types';
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("../../..").StationInfoType;
5
+ export declare function useStationInfoAtCursor({ frequency, enabled }: UseStationFinderProps): import("../../../..").StationInfoType;
6
6
  export declare const useStationFinder: typeof useStationInfoAtCursor;
7
7
  export {};
@@ -1,4 +1,4 @@
1
- import type { RecursiveFunction, StationInfoType } from '../../types';
1
+ import type { RecursiveFunction, StationInfoType } from '../../../types';
2
2
  /**
3
3
  * 台站数据更新订阅管理器
4
4
  * 用于通知组件台站数据已更新,触发重新渲染
@@ -1,4 +1,4 @@
1
- import type { SignalData, SignalDataType, StationInfoType } from '../../types';
1
+ import type { SignalData, SignalDataType, StationInfoType } from '../../../types';
2
2
  /**
3
3
  * Signal 数据管理 Hook
4
4
  * - 台站信息 → 全局 openData(通过 STATION_DATA)
@@ -1,6 +1,6 @@
1
- import type { StationInfoType } from '../../types';
2
- import type { SignalData } from '../../types/store';
3
- import type { FrequencyRange, FrequencyRangeInput } from '../../utils';
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 { SeriesConfig } from '../../types';
3
- interface SpectrumState {
4
- chart: ISeries | null;
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
- prevAutoRangeTime: number;
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 default class Spectrum {
15
- state: SpectrumState;
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?: [number, number]): void;
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 {};
@@ -1,3 +1,3 @@
1
1
  import { type SpectrumConfig } from '@rfkit/spectrum-analyzer';
2
- import type { PublishData } from '../../types';
2
+ import type { PublishData } from '../../../types';
3
3
  export default function useSpectrumAnalyzer(props?: SpectrumConfig): (e: PublishData) => Promise<void>;
@@ -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 themeUnsubscribe: (() => void) | null;
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
- "description": "a chart library based on all",
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
- "version": "1.4.0",
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 {};
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
- import type { DispatchAction, StoreState } from '../types/store';
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
- state: StoreState;
6
+ runtime: ChartRuntime;
7
+ store: ChartStore;
5
8
  dispatch: (action: DispatchAction) => void;
6
9
  }
7
10
  declare const AppContext: React.Context<AppContextType>;
@@ -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';