@rfkit/charts 1.15.0 → 1.17.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 +63 -0
- package/charts/AudioWaveform/Chart.d.ts +12 -0
- package/charts/AudioWaveform/index.d.ts +5 -0
- package/charts/index.d.ts +2 -1
- package/components/Toolbar/primitives/styles.d.ts +3 -2
- package/config/constants.d.ts +5 -2
- package/hooks/module-subscription-core.d.ts +2 -1
- package/hooks/useDragSelect.d.ts +2 -0
- package/index.d.ts +3 -2
- package/index.js +252 -58
- package/modules/AudioWaveform/buffer.d.ts +25 -0
- package/modules/AudioWaveform/index.d.ts +9 -0
- package/modules/AudioWaveform/render.d.ts +43 -0
- package/modules/Spectrum/BandLayer/InfoPanel.d.ts +9 -0
- package/modules/Spectrum/BandLayer/bandState.d.ts +3 -0
- package/modules/Spectrum/DeltaMeasurement/geometry.d.ts +15 -0
- package/modules/Spectrum/FrequencyDataBoard/index.d.ts +1 -0
- package/modules/Spectrum/Markers/capacity.d.ts +7 -0
- package/modules/Spectrum/Markers/tools.d.ts +1 -1
- package/package.json +2 -2
- package/theme/theme-color.d.ts +1 -0
- package/types/publish.d.ts +11 -1
- package/types/store/marker.d.ts +1 -0
- package/types/store/ui.d.ts +9 -0
- package/utils/index.d.ts +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AudioWaveformFrame } from '../../types/index.js';
|
|
2
|
+
export interface AudioFrameValidation {
|
|
3
|
+
valid: boolean;
|
|
4
|
+
reason?: string;
|
|
5
|
+
sampleFrames: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const validateAudioWaveformFrame: (frame: AudioWaveformFrame) => AudioFrameValidation;
|
|
8
|
+
export declare class Float32RingBuffer {
|
|
9
|
+
private storage;
|
|
10
|
+
private head;
|
|
11
|
+
private size;
|
|
12
|
+
capacity: number;
|
|
13
|
+
constructor(capacity: number);
|
|
14
|
+
get length(): number;
|
|
15
|
+
clear(): void;
|
|
16
|
+
resize(nextCapacity: number): void;
|
|
17
|
+
append(data: Float32Array): void;
|
|
18
|
+
at(index: number): number;
|
|
19
|
+
}
|
|
20
|
+
export interface EnvelopeData {
|
|
21
|
+
minData: Float32Array;
|
|
22
|
+
maxData: Float32Array;
|
|
23
|
+
xOffset?: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const aggregateEnvelope: (samples: Float32RingBuffer, bins: number, visibleSamples?: number, totalSamplesReceived?: number) => EnvelopeData;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface AudioWaveformModuleProps {
|
|
3
|
+
maxSamples?: number;
|
|
4
|
+
visibleSeconds?: number;
|
|
5
|
+
channel?: number;
|
|
6
|
+
palette?: 'level' | 'monochrome';
|
|
7
|
+
}
|
|
8
|
+
declare const AudioWaveform: React.FC<AudioWaveformModuleProps>;
|
|
9
|
+
export default AudioWaveform;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ISeries } from '@rfkit/renderer';
|
|
2
|
+
import type { AudioWaveformFrame } from '../../types/index.js';
|
|
3
|
+
import { BaseRenderer, type BaseRenderState } from '../base/BaseRenderer.js';
|
|
4
|
+
export type AudioWaveformPalette = 'level' | 'monochrome';
|
|
5
|
+
export interface AudioWaveformRenderProps {
|
|
6
|
+
id: string;
|
|
7
|
+
globalID: string;
|
|
8
|
+
maxSamples?: number;
|
|
9
|
+
visibleSeconds?: number;
|
|
10
|
+
channel?: number;
|
|
11
|
+
palette?: AudioWaveformPalette;
|
|
12
|
+
}
|
|
13
|
+
interface AudioWaveformRenderState extends BaseRenderState<ISeries> {
|
|
14
|
+
globalID: string;
|
|
15
|
+
maxSamples: number;
|
|
16
|
+
visibleSeconds: number;
|
|
17
|
+
channel: number;
|
|
18
|
+
palette: AudioWaveformPalette;
|
|
19
|
+
}
|
|
20
|
+
export default class AudioWaveform extends BaseRenderer<ISeries, AudioWaveformRenderState, AudioWaveformFrame> {
|
|
21
|
+
private samples;
|
|
22
|
+
private sampleRate;
|
|
23
|
+
private channels;
|
|
24
|
+
private totalSamplesReceived;
|
|
25
|
+
private drawHandle;
|
|
26
|
+
private drawHandleIsAnimationFrame;
|
|
27
|
+
private dirty;
|
|
28
|
+
private paletteConfig;
|
|
29
|
+
constructor(props: AudioWaveformRenderProps);
|
|
30
|
+
protected init(): void;
|
|
31
|
+
updateSeries(frame: AudioWaveformFrame): void;
|
|
32
|
+
private resolvePaletteConfig;
|
|
33
|
+
private scheduleDraw;
|
|
34
|
+
private cancelScheduledDraw;
|
|
35
|
+
private drawIfNeeded;
|
|
36
|
+
clear(): void;
|
|
37
|
+
protected initializeChartWhenReady(): void;
|
|
38
|
+
reset(): void;
|
|
39
|
+
resize(): void;
|
|
40
|
+
updateParams(params: Partial<AudioWaveformRenderState>): void;
|
|
41
|
+
protected beforeDestroy(): void;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AxisXProps } from '../../../types/index.js';
|
|
3
|
+
import type { BandState } from '../../../types/store/ui.js';
|
|
4
|
+
interface Props {
|
|
5
|
+
band?: BandState;
|
|
6
|
+
frequencyFormat?: AxisXProps['frequencyFormat'];
|
|
7
|
+
}
|
|
8
|
+
declare const _default: React.NamedExoticComponent<Props>;
|
|
9
|
+
export default _default;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { SegmentType } from '../../../types/common.js';
|
|
2
2
|
import { type BandState } from '../../../types/store/ui.js';
|
|
3
|
+
import { type FrequencyRange } from '../../../utils/frequencyCalculation.js';
|
|
3
4
|
export { resolveBandState } from '../../../store/bandState.js';
|
|
4
5
|
export interface BandPosition {
|
|
5
6
|
key: string;
|
|
6
7
|
left: number;
|
|
7
8
|
width: number;
|
|
8
9
|
}
|
|
10
|
+
export declare function resolveBandFrequencyRange(band: BandState, frequencyFormat?: (left: number) => string): FrequencyRange | null;
|
|
9
11
|
export declare function resolveBandPositions(band: BandState, segments: SegmentType[]): BandPosition[];
|
|
12
|
+
export declare function resolveBandAtPosition(band: BandState, segments: SegmentType[], left: number): BandState | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RectBounds, RectPosition } from '../../../hooks/useDragSelect.js';
|
|
2
|
+
import type { AxisXRange, DeltaMeasurementData } from '../../../types/index.js';
|
|
3
|
+
export interface MeasurementViewport {
|
|
4
|
+
x: readonly [number, number];
|
|
5
|
+
y: readonly [number, number];
|
|
6
|
+
}
|
|
7
|
+
export interface MeasurementSelection {
|
|
8
|
+
x: readonly [number, number];
|
|
9
|
+
y: readonly [number, number];
|
|
10
|
+
}
|
|
11
|
+
export declare const createMeasurementViewport: (totalPoints: number, interval: AxisXRange, range: readonly number[]) => MeasurementViewport | null;
|
|
12
|
+
export declare const selectionFromRect: (rect: RectPosition, viewport: MeasurementViewport) => MeasurementSelection;
|
|
13
|
+
export declare const rectFromSelection: (selection: MeasurementSelection, viewport: MeasurementViewport) => RectPosition;
|
|
14
|
+
export declare const measurementBounds: (rect: RectPosition, viewport: MeasurementViewport) => RectBounds;
|
|
15
|
+
export declare const calculateMeasurement: (selection: MeasurementSelection, frequencyFormat: (left: number) => string, amplitudeOffset?: number) => DeltaMeasurementData | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface MarkerEvictionPlan<TCurrent, TNew> {
|
|
2
|
+
allowed: boolean;
|
|
3
|
+
keptMarkers: TCurrent[];
|
|
4
|
+
itemsToAdd: TNew[];
|
|
5
|
+
evictCount: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function planMarkerAddition<TCurrent, TNew>(currentMarkers: readonly TCurrent[], newItems: readonly TNew[], maxCount: number, fifo?: boolean): MarkerEvictionPlan<TCurrent, TNew>;
|
|
@@ -53,6 +53,7 @@ export declare function findTopPeaks(data: Float32Array, count?: number, thresho
|
|
|
53
53
|
export declare function findMultiplePeaks(data: Float32Array, threshold?: number, minDistance?: number): PeakPoint[];
|
|
54
54
|
export declare function findNearbyPeak(data: Float32Array, targetIndex: number, searchRadius?: number): PeakPoint | null;
|
|
55
55
|
export declare const setMarkerMove: (marker: MarkerType, segments: SegmentsType, callback: RecursiveFunction) => void;
|
|
56
|
+
export * from './capacity.js';
|
|
56
57
|
export declare const setMarkerBatchAdd: (params: {
|
|
57
58
|
data: number[];
|
|
58
59
|
clear?: boolean;
|
|
@@ -64,4 +65,3 @@ export declare const setMarkerBatchAdd: (params: {
|
|
|
64
65
|
}) => void) => void;
|
|
65
66
|
export declare const validateMarkerPosition: (left: number, segments: SegmentsType) => boolean;
|
|
66
67
|
export declare const calculateMarkerFrequency: (left: number, segments: SegmentsType) => number | null;
|
|
67
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rfkit/charts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Chart components for wireless monitoring web applications",
|
|
6
6
|
"exports": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"types": "./index.d.ts",
|
|
15
15
|
"author": "Hxgh",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@rfkit/renderer": "^0.
|
|
17
|
+
"@rfkit/renderer": "^0.5.1",
|
|
18
18
|
"@rfkit/spectrum-analyzer": "^0.9.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
package/theme/theme-color.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface ThemeFillStyle {
|
|
|
3
3
|
fillStylePrimary: string;
|
|
4
4
|
fillStyleTransparentBase: string;
|
|
5
5
|
}
|
|
6
|
+
export declare const withAlpha: (value: string, opacity: number) => string;
|
|
6
7
|
export declare const toOpaqueCssColor: (value: string) => string;
|
|
7
8
|
export declare function getThemeFillStyle(scopeTarget?: Element | null): ThemeFillStyle;
|
|
8
9
|
export declare const getThemeColor: (property: string, opacity?: number, scopeTarget?: Element | null) => string;
|
package/types/publish.d.ts
CHANGED
|
@@ -127,6 +127,16 @@ export interface ScopeEvent extends RecursiveObject {
|
|
|
127
127
|
bandwidth: number;
|
|
128
128
|
index?: number;
|
|
129
129
|
}
|
|
130
|
+
export interface AudioWaveformFrame {
|
|
131
|
+
samples: Float32Array;
|
|
132
|
+
sampleRate: number;
|
|
133
|
+
channels: number;
|
|
134
|
+
startSample?: number;
|
|
135
|
+
}
|
|
136
|
+
export interface PublishAudioWaveform {
|
|
137
|
+
pstype: PSType.AudioWaveform;
|
|
138
|
+
data: AudioWaveformFrame;
|
|
139
|
+
}
|
|
130
140
|
export interface Reset extends Finally {
|
|
131
141
|
pstype: PSType.Reset;
|
|
132
142
|
}
|
|
@@ -140,7 +150,7 @@ export interface Render {
|
|
|
140
150
|
pstype: PSType.Render;
|
|
141
151
|
[key: string]: unknown;
|
|
142
152
|
}
|
|
143
|
-
export type PublishData = SetOption | SetSeries | SetSpectrumBandwidth | SetSegments | SetChannels | SetMarker | SetAntennaFactor | SetSignal | PublishSpectrum | PublishHeatmap | PublishFluorescence | PublishOccupancy | PublishLevelStream | PublishIQ | PublishDial | PublishGauge | AutorangingEvent | PointsEvent | BandEvent | ScopeEvent | Reset | Clear | Resize | Render;
|
|
153
|
+
export type PublishData = SetOption | SetSeries | SetSpectrumBandwidth | SetSegments | SetChannels | SetMarker | SetAntennaFactor | SetSignal | PublishSpectrum | PublishHeatmap | PublishFluorescence | PublishOccupancy | PublishLevelStream | PublishIQ | PublishAudioWaveform | PublishDial | PublishGauge | AutorangingEvent | PointsEvent | BandEvent | ScopeEvent | Reset | Clear | Resize | Render;
|
|
144
154
|
export type Publish = ((p: PublishData) => void) & {
|
|
145
155
|
getSourceData: () => rawData;
|
|
146
156
|
resetViewport?: () => void;
|
package/types/store/marker.d.ts
CHANGED
package/types/store/ui.d.ts
CHANGED
|
@@ -63,6 +63,12 @@ export interface ZoomProps {
|
|
|
63
63
|
type BandSharedProps = {
|
|
64
64
|
show?: boolean;
|
|
65
65
|
color?: string;
|
|
66
|
+
details?: {
|
|
67
|
+
name?: string;
|
|
68
|
+
organization?: string;
|
|
69
|
+
modulation?: string;
|
|
70
|
+
remark?: string;
|
|
71
|
+
};
|
|
66
72
|
};
|
|
67
73
|
type BandPositionProps = {
|
|
68
74
|
left?: number;
|
|
@@ -99,18 +105,21 @@ export type BandState = {
|
|
|
99
105
|
kind: typeof BandKind.Position;
|
|
100
106
|
show: boolean;
|
|
101
107
|
color?: string;
|
|
108
|
+
details?: BandSharedProps['details'];
|
|
102
109
|
left?: number;
|
|
103
110
|
width: number;
|
|
104
111
|
} | {
|
|
105
112
|
kind: typeof BandKind.CenterBandwidth;
|
|
106
113
|
show: boolean;
|
|
107
114
|
color?: string;
|
|
115
|
+
details?: BandSharedProps['details'];
|
|
108
116
|
frequency: number;
|
|
109
117
|
bandwidth: number;
|
|
110
118
|
} | {
|
|
111
119
|
kind: typeof BandKind.FrequencyRange;
|
|
112
120
|
show: boolean;
|
|
113
121
|
color?: string;
|
|
122
|
+
details?: BandSharedProps['details'];
|
|
114
123
|
startFrequency: number;
|
|
115
124
|
stopFrequency: number;
|
|
116
125
|
};
|
package/utils/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export * from './object.js';
|
|
|
7
7
|
export * from './throttle.js';
|
|
8
8
|
export * from './time.js';
|
|
9
9
|
export declare const createGUID: () => string;
|
|
10
|
+
export declare const createRuntimeID: () => string;
|
|
10
11
|
export declare const convertToTimestampedArrays: (data: number[][], timestamps?: Array<string>) => TimestampedFloat32Array[];
|