@rfkit/charts 1.14.2 → 1.16.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 +39 -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/AxisY/spectrum/useRanging/tools.d.ts +2 -1
- package/components/AxisY/tools.d.ts +1 -1
- package/config/constants.d.ts +5 -2
- package/hooks/module-subscription-core.d.ts +2 -1
- package/index.d.ts +3 -2
- package/index.js +214 -46
- 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/Markers/capacity.d.ts +7 -0
- package/modules/Spectrum/Markers/tools.d.ts +1 -1
- package/package.json +2 -2
- package/store/Params.d.ts +1 -0
- package/theme/theme-color.d.ts +1 -0
- package/types/publish.d.ts +11 -1
- package/types/store/axis.d.ts +1 -0
- package/types/store/marker.d.ts +1 -0
- package/types/store/ui.d.ts +1 -0
- package/utils/throttle.d.ts +4 -1
|
@@ -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,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.16.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/store/Params.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { AxisYProps, ParamsProps, StoreState } from '../types/index.js';
|
|
3
|
+
export declare const initializeAxisYProps: (axisY?: Partial<AxisYProps>) => Partial<AxisYProps> | undefined;
|
|
3
4
|
export declare function mergeParameter<K extends keyof StoreState>(key: K, params: StoreState[K] | Partial<StoreState[K]> | null | undefined, state?: StoreState): StoreState[K];
|
|
4
5
|
export declare function normalizeAxisYProps(axisY?: Partial<AxisYProps>): Partial<AxisYProps> | undefined;
|
|
5
6
|
declare const Params: React.FC<ParamsProps>;
|
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/axis.d.ts
CHANGED
package/types/store/marker.d.ts
CHANGED
package/types/store/ui.d.ts
CHANGED
package/utils/throttle.d.ts
CHANGED
|
@@ -17,7 +17,10 @@ interface ReactLikeEvent {
|
|
|
17
17
|
clientY?: number;
|
|
18
18
|
buttons?: number;
|
|
19
19
|
}
|
|
20
|
-
export declare function throttleRequestAnimationFrame<T = unknown>(func?: (e?: T | EventSnapshot) => void): (e?: T | ReactLikeEvent) => void
|
|
20
|
+
export declare function throttleRequestAnimationFrame<T = unknown>(func?: (e?: T | EventSnapshot) => void): ((e?: T | ReactLikeEvent) => void) & {
|
|
21
|
+
flush: () => void;
|
|
22
|
+
cancel: () => void;
|
|
23
|
+
};
|
|
21
24
|
export declare function throttleTimer<T = unknown>(func?: (e?: T) => void, wait?: number): (e?: T) => void;
|
|
22
25
|
export declare const debounce: <T extends (...args: unknown[]) => unknown>(fn: T, delay?: number) => ((...args: Parameters<T>) => void) & {
|
|
23
26
|
cancel: () => void;
|