@rfkit/charts 1.3.12 → 1.4.0
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 +57 -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/AxisYByCanvas/useCanvasAxisY.d.ts +2 -2
- package/components/Cursor/registry.d.ts +7 -0
- package/components/DragSelectBox/index.d.ts +3 -1
- package/components/FrequencyAllocation/index.d.ts +2 -2
- package/components/FrequencyAllocation/model/index.d.ts +4 -0
- package/components/FrequencyAllocation/model/resolveFrequencyAllocationData.d.ts +2 -0
- package/components/FrequencyAllocation/model/resolver.d.ts +18 -0
- package/components/FrequencyAllocation/model/useAllocationAtCursor.d.ts +6 -0
- package/components/FrequencyAllocation/model/useFrequencyAllocationData.d.ts +1 -0
- package/components/FrequencyAllocation/overlays/Tooltip/index.d.ts +4 -0
- package/components/FrequencyAllocation/overlays/index.d.ts +1 -0
- package/components/FrequencyAllocation/{AllocationInfo → presenters/AllocationInfo}/index.d.ts +1 -1
- package/components/FrequencyAllocation/presenters/AllocationSegments/index.d.ts +12 -0
- package/components/FrequencyAllocation/presenters/index.d.ts +2 -0
- package/components/FrequencyDataBoard/hooks/index.d.ts +1 -0
- package/components/FrequencyDataBoard/hooks/useStationInfoAtCursor.d.ts +1 -0
- package/components/FrequencyDataBoard/index.d.ts +1 -0
- package/components/FrequencyDataBoard/{StationInfo → panels/StationInfoPanel}/index.d.ts +1 -1
- package/components/FrequencyDataBoard/panels/index.d.ts +1 -0
- package/components/FrequencyTagLine/index.d.ts +1 -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/Signal/index.d.ts +2 -1
- package/components/Signal/metadata/index.d.ts +1 -0
- package/components/Signal/model/index.d.ts +3 -0
- package/components/Signal/model/resolver.d.ts +40 -0
- package/components/Signal/model/useStationInfoAtCursor.d.ts +7 -0
- package/components/Signal/model/useUnifiedSignals.d.ts +6 -0
- package/components/Signal/presenters/SignalSegments/index.d.ts +10 -0
- package/components/Signal/presenters/index.d.ts +1 -0
- package/components/Signal/utils.d.ts +13 -1
- package/components/ToolsBar/{SeriesControl → controls/SeriesControl}/index.d.ts +1 -1
- package/components/ToolsBar/controls/index.d.ts +4 -0
- package/components/ToolsBar/{GradientRibbon → decorations/GradientRibbon}/index.d.ts +1 -1
- package/components/ToolsBar/decorations/index.d.ts +2 -0
- package/components/ToolsBar/primitives/IconBox.d.ts +11 -0
- package/components/ToolsBar/primitives/ToolbarContentBox.d.ts +11 -0
- package/components/ToolsBar/primitives/ToolbarDropdown.d.ts +16 -0
- package/components/ToolsBar/primitives/ToolbarGlyph.d.ts +10 -0
- package/components/ToolsBar/primitives/ToolbarGroup.d.ts +10 -0
- package/components/ToolsBar/primitives/ToolbarGroupIconBox.d.ts +5 -0
- package/components/ToolsBar/primitives/ToolbarSurface.d.ts +15 -0
- package/components/ToolsBar/primitives/index.d.ts +8 -0
- package/components/ToolsBar/primitives/styles.d.ts +41 -0
- package/components/ToolsBar/registry.d.ts +12 -0
- package/components/ToolsBar/toggles/index.d.ts +10 -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/setting.d.ts +3 -3
- package/hooks/index.d.ts +2 -2
- package/hooks/publish/enhancedPublish.d.ts +17 -0
- package/hooks/publish/index.d.ts +1 -0
- package/hooks/publish/useSafePublish.d.ts +2 -8
- package/hooks/useChartComponent.d.ts +0 -6
- package/hooks/useDragSelect.d.ts +2 -0
- package/index.d.ts +4 -0
- package/index.js +19460 -7822
- package/lib/index.d.ts +1 -1
- package/package.json +8 -1
- package/store/Params.d.ts +2 -1
- package/store/constants.d.ts +2 -3
- package/store/context.d.ts +1 -1
- package/store/globalState.d.ts +4 -0
- package/store/hooks/index.d.ts +1 -0
- package/store/index.d.ts +1 -1
- package/store/reducer.d.ts +0 -34
- package/tailwind-bridge.css +123 -0
- package/theme/charts-theme-controller.d.ts +27 -0
- package/theme/charts-theme-environment.d.ts +7 -0
- package/theme/init-charts-theme.d.ts +16 -0
- package/theme/shadcn-theme-config.d.ts +221 -0
- package/theme/style-scope.d.ts +21 -0
- package/types/store/ui.d.ts +15 -1
- package/utils/cn.d.ts +2 -0
- package/utils/converter.d.ts +1 -1
- package/utils/cursor.d.ts +12 -0
- package/utils/frequency.d.ts +1 -0
- package/utils/frequencyCalculation.d.ts +8 -0
- package/utils/index.d.ts +1 -0
- package/utils/subscription.d.ts +3 -2
- package/utils/theme.d.ts +2 -2
- 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/ToolsBar/IconBox.d.ts +0 -12
- /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/Cursor/{Popover → popovers}/index.d.ts +0 -0
- /package/components/{GuageBox → GaugeBox}/index.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/Signal/{type.d.ts → metadata/signalType.d.ts} +0 -0
- /package/components/ToolsBar/{Reset.d.ts → controls/Reset.d.ts} +0 -0
- /package/components/ToolsBar/{SegmentsDisplayControl → controls/SegmentsDisplayControl}/index.d.ts +0 -0
- /package/components/ToolsBar/{SeriesDisplayControl → controls/SeriesDisplayControl}/index.d.ts +0 -0
- /package/components/ToolsBar/{SpacerLine.d.ts → decorations/SpacerLine.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -8,6 +8,63 @@
|
|
|
8
8
|
pnpm add @rfkit/charts
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## 主题与 Tailwind 集成
|
|
12
|
+
|
|
13
|
+
默认情况下,消费方只需要安装并直接使用组件:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Spectrum } from '@rfkit/charts';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
本库发布产物已经默认携带新 UI 所需的样式,并会自动注入 charts 侧需要的主题 / 尺寸变量定义。外部项目不需要再额外引入 `tailwind-bridge.css` 才能让组件正常显示。
|
|
20
|
+
|
|
21
|
+
也就是说,默认推荐接法仍然是:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { Spectrum } from '@rfkit/charts';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
如果你的应用已经在使用 `@rfkit/theme`,接法也不需要改。charts 会只读根节点上的这两个契约标识:
|
|
28
|
+
|
|
29
|
+
- `theme`
|
|
30
|
+
- `theme-follow-OS`
|
|
31
|
+
|
|
32
|
+
也就是说,外部继续这样初始化即可:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import {
|
|
36
|
+
initTheme,
|
|
37
|
+
toggleTheme,
|
|
38
|
+
toggleThemeMode
|
|
39
|
+
} from '@rfkit/theme';
|
|
40
|
+
|
|
41
|
+
initTheme();
|
|
42
|
+
toggleTheme();
|
|
43
|
+
toggleThemeMode();
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`initChartsTheme()` 现在主要用于两个场景:
|
|
47
|
+
|
|
48
|
+
- 你想覆盖 charts 默认的 `themeConfigs` / `sizeConfigs`
|
|
49
|
+
- 你想通过 `subscribeThemeChange` 订阅 charts 解析后的主题状态
|
|
50
|
+
|
|
51
|
+
只有在外部项目自己也使用 `Tailwind CSS v4 + shadcn/ui`,并且希望复用本库这套语义 token 时,才需要额外引入 bridge:
|
|
52
|
+
|
|
53
|
+
```css
|
|
54
|
+
@import "tailwindcss";
|
|
55
|
+
@import "@rfkit/charts/tailwind-bridge.css";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
说明:
|
|
59
|
+
|
|
60
|
+
- 默认包入口已经自动携带组件运行所需样式,并自动注入 charts 侧默认主题 / 尺寸变量
|
|
61
|
+
- charts 默认只读取 `theme` / `theme-follow-OS`,不再把自己当主题真源
|
|
62
|
+
- `@rfkit/charts/tailwind-bridge.css` 只提供 Tailwind/shadcn 语义 token 复用能力,不包含全局 reset
|
|
63
|
+
- 如果外部项目继续使用 `@rfkit/theme` 的 `initTheme()` / `toggleTheme()` / `toggleThemeMode()`,charts 会自动跟随刷新
|
|
64
|
+
- 更完整的主题桥接说明见 [docs/theme-migration.md](/Users/hugh/workspace/github/rfkit-charts/docs/theme-migration.md)
|
|
65
|
+
|
|
66
|
+
更多项目说明见:[docs/README.md](/Users/hugh/workspace/github/rfkit-charts/docs/README.md)
|
|
67
|
+
|
|
11
68
|
## 基本使用
|
|
12
69
|
|
|
13
70
|
```jsx
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { RenderChartType } from '../../../types';
|
|
3
|
-
import { useRangeAutoFocus } from './useRanging/ranging';
|
|
4
3
|
interface Props {
|
|
5
4
|
chart: RenderChartType;
|
|
6
5
|
}
|
|
7
6
|
declare const AxisYSpectrum: React.FC<Props>;
|
|
8
7
|
export default AxisYSpectrum;
|
|
9
|
-
export
|
|
8
|
+
export * from './controls';
|
|
9
|
+
export * from './presenters';
|
|
10
|
+
export * from './useRanging';
|
|
@@ -7,12 +7,12 @@ interface RangeProps {
|
|
|
7
7
|
isHand: string;
|
|
8
8
|
}) => void;
|
|
9
9
|
moveBoundary?: (isUP: boolean, isTop: boolean) => void;
|
|
10
|
-
setAxisY(
|
|
10
|
+
setAxisY(event: {
|
|
11
11
|
realRange: AxisYRange;
|
|
12
12
|
}): unknown;
|
|
13
13
|
}
|
|
14
14
|
interface Props {
|
|
15
15
|
ranging: RangeProps;
|
|
16
16
|
}
|
|
17
|
-
declare const
|
|
18
|
-
export default
|
|
17
|
+
declare const TicksPanel: React.FC<Props>;
|
|
18
|
+
export default TicksPanel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TicksPanel } from './TicksPanel';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { useVirtualRange } from './tools';
|
|
1
2
|
import type { RenderChartType } from '../../../../types';
|
|
2
|
-
import Ranging from './ranging';
|
|
3
|
+
import Ranging, { RangeController, useRangeAutoFocus, useRangeMove, useRangeSet } from './ranging';
|
|
4
|
+
import { getVirtualLevel, range2realRange } from './tools';
|
|
3
5
|
interface Props {
|
|
4
6
|
chart: RenderChartType;
|
|
5
7
|
}
|
|
6
8
|
declare const useRange: ({ chart }: Props) => Ranging;
|
|
7
9
|
export default useRange;
|
|
10
|
+
export { getVirtualLevel, RangeController, range2realRange, useRangeAutoFocus, useRangeMove, useRangeSet, useVirtualRange };
|
|
@@ -4,7 +4,7 @@ import type { AxisYRange, RecursiveFunction, RecursiveObject } from '../../../..
|
|
|
4
4
|
*
|
|
5
5
|
* @class Range
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
declare class RangeController {
|
|
8
8
|
state: RecursiveObject;
|
|
9
9
|
constructor(props: RecursiveObject);
|
|
10
10
|
/**
|
|
@@ -47,3 +47,5 @@ export default class Range {
|
|
|
47
47
|
export declare const useRangeAutoFocus: (id: string, func?: RecursiveFunction) => (...args: any[]) => void;
|
|
48
48
|
export declare const useRangeMove: (globalID: string, func?: RecursiveFunction) => (...args: any[]) => void;
|
|
49
49
|
export declare const useRangeSet: (globalID: string, func?: RecursiveFunction) => (...args: any[]) => void;
|
|
50
|
+
export { RangeController };
|
|
51
|
+
export default RangeController;
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* 用于创建可拖拽、可调整大小的矩形框
|
|
4
4
|
*/
|
|
5
5
|
import type React from 'react';
|
|
6
|
-
import type
|
|
6
|
+
import { type ReactNode } from 'react';
|
|
7
7
|
import { type RectPosition } from '../../hooks/useDragSelect';
|
|
8
8
|
export interface DragSelectBoxProps {
|
|
9
9
|
enabled: boolean;
|
|
10
10
|
defaultRect?: Partial<RectPosition>;
|
|
11
11
|
minSize?: number;
|
|
12
|
+
minWidth?: number;
|
|
13
|
+
minHeight?: number;
|
|
12
14
|
maxSize?: number;
|
|
13
15
|
snapThreshold?: number;
|
|
14
16
|
onChange?: (rect: RectPosition) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import AllocationInfo from './
|
|
2
|
+
import { AllocationInfo } from './presenters';
|
|
3
|
+
export { useAllocationFinder } from './model';
|
|
3
4
|
export { AllocationInfo };
|
|
4
|
-
export { useAllocationFinder } from './useAllocationFinder';
|
|
5
5
|
declare const FrequencyAllocation: React.FC;
|
|
6
6
|
export default FrequencyAllocation;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { resolveFrequencyAllocationData } from './resolveFrequencyAllocationData';
|
|
2
|
+
export { type FrequencyAllocationSegmentData, findFrequencyAllocationAtCursor, resolveFrequencyAllocationRange, resolveFrequencyAllocationSegments } from './resolver';
|
|
3
|
+
export { useAllocationAtCursor, useAllocationFinder } from './useAllocationAtCursor';
|
|
4
|
+
export { useFrequencyAllocationData } from './useFrequencyAllocationData';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { FrequencyAllocationItem, SegmentType } from '../../../types';
|
|
3
|
+
import type { BandPosition, FrequencyRange } from '../types';
|
|
4
|
+
export interface FrequencyAllocationSegmentData {
|
|
5
|
+
segment: SegmentType;
|
|
6
|
+
segmentIndex: number;
|
|
7
|
+
bandPositions: BandPosition[];
|
|
8
|
+
style: CSSProperties;
|
|
9
|
+
}
|
|
10
|
+
export declare const resolveFrequencyAllocationRange: (band: FrequencyAllocationItem) => FrequencyRange | null;
|
|
11
|
+
export declare const resolveFrequencyAllocationSegments: ({ segments, allocations }: {
|
|
12
|
+
segments: SegmentType[];
|
|
13
|
+
allocations: FrequencyAllocationItem[];
|
|
14
|
+
}) => FrequencyAllocationSegmentData[];
|
|
15
|
+
export declare const findFrequencyAllocationAtCursor: ({ allocations, frequency }: {
|
|
16
|
+
allocations: FrequencyAllocationItem[];
|
|
17
|
+
frequency: number;
|
|
18
|
+
}) => FrequencyAllocationItem | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface UseAllocationFinderProps {
|
|
2
|
+
frequency: string;
|
|
3
|
+
}
|
|
4
|
+
export declare function useAllocationAtCursor({ frequency }: UseAllocationFinderProps): import("../../..").FrequencyAllocationItem;
|
|
5
|
+
export declare const useAllocationFinder: typeof useAllocationAtCursor;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useFrequencyAllocationData(): import("../../..").FrequencyAllocationItem[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AllocationTooltip } from './Tooltip';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { BandPosition, FrequencyRange } from '../../types';
|
|
3
|
+
import type { FrequencyAllocationItem } from '../../../../types';
|
|
4
|
+
interface AllocationSegmentsProps {
|
|
5
|
+
style: React.CSSProperties;
|
|
6
|
+
bandPositions: BandPosition[];
|
|
7
|
+
onMouseEnter: (band: FrequencyAllocationItem, range: FrequencyRange) => (event: React.MouseEvent) => void;
|
|
8
|
+
onMouseMove: (event: React.MouseEvent) => void;
|
|
9
|
+
onMouseLeave: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const AllocationSegments: React.FC<AllocationSegmentsProps>;
|
|
12
|
+
export default AllocationSegments;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useStationFinder, useStationInfoAtCursor } from './useStationInfoAtCursor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useStationFinder, useStationInfoAtCursor } from '../../Signal/model';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as StationInfoPanel } from './StationInfoPanel';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ToolType } from '../../config';
|
|
3
3
|
import FrequencyTagLineBoard from './Board';
|
|
4
4
|
import FrequencyTagLineSwitch from './Switch';
|
|
5
|
-
export {
|
|
5
|
+
export { FrequencyTagLineBoard, FrequencyTagLineSwitch };
|
|
6
6
|
export declare const COMPONENT_KEY = ToolType.FrequencyTagLine;
|
|
7
7
|
interface Props {
|
|
8
8
|
id: string;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
export interface DropdownOption {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type?: 'item' | 'separator';
|
|
4
|
+
value?: string | number | null;
|
|
5
|
+
label?: string;
|
|
5
6
|
style?: React.CSSProperties;
|
|
6
7
|
render?: () => React.ReactNode;
|
|
7
8
|
disabled?: boolean;
|
|
9
|
+
onSelect?: (value: string | number | null) => void;
|
|
8
10
|
}
|
|
9
11
|
interface DropdownProps {
|
|
10
12
|
value: string | number | null;
|
|
11
13
|
options: DropdownOption[];
|
|
12
14
|
onChange?: (value: string | number | null) => void;
|
|
13
15
|
placeholder?: string | React.ReactNode;
|
|
16
|
+
triggerContent?: React.ReactNode;
|
|
17
|
+
triggerTitle?: React.ReactNode;
|
|
14
18
|
closeOnSelect?: boolean;
|
|
19
|
+
triggerVariant?: 'default' | 'plain';
|
|
20
|
+
showChevron?: boolean;
|
|
21
|
+
triggerClassName?: string;
|
|
22
|
+
contentClassName?: string;
|
|
15
23
|
}
|
|
16
24
|
declare const Dropdown: React.FC<DropdownProps>;
|
|
17
25
|
export default Dropdown;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import SignalSwitch from './Switch';
|
|
3
|
+
export { useStationFinder } from './model';
|
|
4
|
+
export { useSignalDataManager } from './useSignalDataManager';
|
|
3
5
|
export { SignalSwitch };
|
|
4
|
-
export { useStationFinder } from './useStationFinder';
|
|
5
6
|
interface Props {
|
|
6
7
|
left?: number;
|
|
7
8
|
show?: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SIGNAL_TYPE_MAP, SignalType, signalTypeMap } from './signalType';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { findStationAtCursor, resolveSignalMatchCandidates, resolveSignalPositions, resolveSignalSegments, type SignalPosition, type SignalSegmentData } from './resolver';
|
|
2
|
+
export { useStationFinder, useStationInfoAtCursor } from './useStationInfoAtCursor';
|
|
3
|
+
export { useUnifiedSignals } from './useUnifiedSignals';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { SegmentType, StationInfoType } from '../../../types';
|
|
3
|
+
import { type SignalMatchCandidate, type UnifiedSignalItem } from '../utils';
|
|
4
|
+
export interface SignalPosition extends SignalMatchCandidate {
|
|
5
|
+
key: string;
|
|
6
|
+
position: {
|
|
7
|
+
left: string;
|
|
8
|
+
width: string;
|
|
9
|
+
};
|
|
10
|
+
color: string;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SignalSegmentData {
|
|
14
|
+
segment: SegmentType;
|
|
15
|
+
segmentIndex: number;
|
|
16
|
+
signalPositions: SignalPosition[];
|
|
17
|
+
activeSignalKey?: string;
|
|
18
|
+
style: CSSProperties;
|
|
19
|
+
}
|
|
20
|
+
export declare const resolveSignalMatchCandidates: (signalItems: UnifiedSignalItem[], segment: SegmentType) => SignalMatchCandidate[];
|
|
21
|
+
export declare const resolveSignalPositions: (signalItems: UnifiedSignalItem[], segment: SegmentType) => SignalPosition[];
|
|
22
|
+
export declare const resolveSignalSegments: ({ segments, signalItems, isCursorActive, currentFrequency, currentPosition }: {
|
|
23
|
+
segments: SegmentType[];
|
|
24
|
+
signalItems: UnifiedSignalItem[];
|
|
25
|
+
isCursorActive: boolean;
|
|
26
|
+
currentFrequency: number;
|
|
27
|
+
currentPosition: {
|
|
28
|
+
segmentIndex: number;
|
|
29
|
+
pointIndex: number;
|
|
30
|
+
};
|
|
31
|
+
}) => SignalSegmentData[];
|
|
32
|
+
export declare const findStationAtCursor: ({ frequency, signalItems, segments, currentPosition }: {
|
|
33
|
+
frequency: number;
|
|
34
|
+
signalItems: UnifiedSignalItem[];
|
|
35
|
+
segments: SegmentType[];
|
|
36
|
+
currentPosition: {
|
|
37
|
+
segmentIndex: number;
|
|
38
|
+
pointIndex: number;
|
|
39
|
+
};
|
|
40
|
+
}) => StationInfoType | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface UseStationFinderProps {
|
|
2
|
+
frequency: string;
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useStationInfoAtCursor({ frequency, enabled }: UseStationFinderProps): import("../../..").StationInfoType;
|
|
6
|
+
export declare const useStationFinder: typeof useStationInfoAtCursor;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { SignalPosition } from '../../model';
|
|
3
|
+
interface SignalSegmentsProps {
|
|
4
|
+
style: React.CSSProperties;
|
|
5
|
+
signalPositions: SignalPosition[];
|
|
6
|
+
activeSignalKey?: string;
|
|
7
|
+
segmentIndex: number;
|
|
8
|
+
}
|
|
9
|
+
declare const SignalSegments: React.FC<SignalSegmentsProps>;
|
|
10
|
+
export default SignalSegments;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SignalSegments } from './SignalSegments';
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import type { StationInfoType } from '../../types';
|
|
2
2
|
import type { SignalData } from '../../types/store';
|
|
3
|
-
import type { FrequencyRangeInput } from '../../utils';
|
|
3
|
+
import type { FrequencyRange, FrequencyRangeInput } from '../../utils';
|
|
4
4
|
/**
|
|
5
5
|
* 统一的信号数据类型(兼容 StationInfo 和 SignalData)
|
|
6
6
|
*/
|
|
7
7
|
export type UnifiedSignalItem = StationInfoType | SignalData;
|
|
8
|
+
export interface SignalMatchCandidate {
|
|
9
|
+
item: UnifiedSignalItem;
|
|
10
|
+
range: FrequencyRange;
|
|
11
|
+
startIndex: number;
|
|
12
|
+
stopIndex: number;
|
|
13
|
+
}
|
|
8
14
|
/**
|
|
9
15
|
* 判断是否为完整的台站信息
|
|
10
16
|
*/
|
|
11
17
|
export declare function isStationInfo(item: UnifiedSignalItem): item is StationInfoType;
|
|
18
|
+
export declare function getUnifiedSignalKey(item: UnifiedSignalItem): string;
|
|
12
19
|
/**
|
|
13
20
|
* 将统一的信号数据转换为频率范围输入(处理 string | number 类型)
|
|
14
21
|
*/
|
|
15
22
|
export declare function toFrequencyRangeInput(item: UnifiedSignalItem): FrequencyRangeInput;
|
|
23
|
+
export declare function resolveBestSignalMatch<T extends SignalMatchCandidate>(candidates: T[], options: {
|
|
24
|
+
currentFrequency: number;
|
|
25
|
+
currentPointIndex: number;
|
|
26
|
+
indexTolerance?: number;
|
|
27
|
+
}): T | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type CSMCallback } from '
|
|
2
|
+
import { type CSMCallback } from '../../../../utils/subscription';
|
|
3
3
|
export declare const handleColor: (globalID?: string, name?: string, func?: CSMCallback) => (...args: any[]) => void;
|
|
4
4
|
declare const _default: React.NamedExoticComponent<{}>;
|
|
5
5
|
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { type ToolbarTone } from './styles';
|
|
4
|
+
import { type ToolbarSurfaceProps } from './ToolbarSurface';
|
|
5
|
+
export interface IconBoxProps extends Pick<ToolbarSurfaceProps, 'style' | 'className' | 'title' | 'disabled' | 'onClick' | 'onDoubleClick'> {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
tone?: ToolbarTone;
|
|
9
|
+
}
|
|
10
|
+
declare const IconBox: React.FC<IconBoxProps>;
|
|
11
|
+
export default IconBox;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type ToolbarTone } from './styles';
|
|
3
|
+
import { type ToolbarSurfaceProps } from './ToolbarSurface';
|
|
4
|
+
export interface ToolbarContentBoxProps extends Pick<ToolbarSurfaceProps, 'style' | 'className' | 'title' | 'disabled' | 'onClick' | 'onDoubleClick' | 'onWheel'> {
|
|
5
|
+
contentClassName?: string;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
tone?: ToolbarTone;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare const ToolbarContentBox: React.FC<ToolbarContentBoxProps>;
|
|
11
|
+
export default ToolbarContentBox;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { Dropdown } from '../../Overlay';
|
|
3
|
+
type BaseDropdownProps = React.ComponentProps<typeof Dropdown>;
|
|
4
|
+
type ToolbarDropdownProps = Omit<BaseDropdownProps, 'triggerVariant'>;
|
|
5
|
+
interface ToolbarIconDropdownProps extends Omit<BaseDropdownProps, 'triggerVariant' | 'triggerContent'> {
|
|
6
|
+
icon: React.ReactNode;
|
|
7
|
+
title?: string;
|
|
8
|
+
}
|
|
9
|
+
interface ToolbarDropdownGroupProps extends Omit<BaseDropdownProps, 'triggerVariant' | 'triggerClassName'> {
|
|
10
|
+
leading: React.ReactNode;
|
|
11
|
+
triggerClassName?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const ToolbarDropdown: React.FC<ToolbarDropdownProps>;
|
|
14
|
+
declare const ToolbarIconDropdown: React.FC<ToolbarIconDropdownProps>;
|
|
15
|
+
declare const ToolbarDropdownGroup: React.FC<ToolbarDropdownGroupProps>;
|
|
16
|
+
export { ToolbarDropdown, ToolbarDropdownGroup, ToolbarIconDropdown };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
interface ToolbarGlyphProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
opticalOffsetX?: number;
|
|
6
|
+
opticalOffsetY?: number;
|
|
7
|
+
opticalScale?: number;
|
|
8
|
+
}
|
|
9
|
+
declare const ToolbarGlyph: React.FC<ToolbarGlyphProps>;
|
|
10
|
+
export default ToolbarGlyph;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
interface ToolbarGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
interface ToolbarGroupSeparatorProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const ToolbarGroup: React.FC<ToolbarGroupProps>;
|
|
9
|
+
declare const ToolbarGroupSeparator: React.FC<ToolbarGroupSeparatorProps>;
|
|
10
|
+
export { ToolbarGroup, ToolbarGroupSeparator };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ToolbarSurfaceElement = HTMLElement;
|
|
3
|
+
export interface ToolbarSurfaceProps {
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
className?: string;
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
onClick?: (e: React.SyntheticEvent<ToolbarSurfaceElement>) => void;
|
|
10
|
+
onDoubleClick?: (e: React.SyntheticEvent<ToolbarSurfaceElement>) => void;
|
|
11
|
+
onWheel?: (e: React.WheelEvent<ToolbarSurfaceElement>) => void;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const ToolbarSurface: React.FC<ToolbarSurfaceProps>;
|
|
15
|
+
export default ToolbarSurface;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as IconBox, type IconBoxProps } from './IconBox';
|
|
2
|
+
export * from './styles';
|
|
3
|
+
export { default as ToolbarContentBox, type ToolbarContentBoxProps } from './ToolbarContentBox';
|
|
4
|
+
export { ToolbarDropdown, ToolbarDropdownGroup, ToolbarIconDropdown } from './ToolbarDropdown';
|
|
5
|
+
export { default as ToolbarGlyph } from './ToolbarGlyph';
|
|
6
|
+
export { ToolbarGroup, ToolbarGroupSeparator } from './ToolbarGroup';
|
|
7
|
+
export { default as ToolbarGroupIconBox } from './ToolbarGroupIconBox';
|
|
8
|
+
export { default as ToolbarSurface, type ToolbarSurfaceProps } from './ToolbarSurface';
|