@waveform-playlist/browser 5.3.1 → 6.0.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/dist/index.d.ts +80 -98
- package/dist/index.js +80 -534
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2659 -3816
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -10
package/dist/index.d.ts
CHANGED
|
@@ -25,14 +25,9 @@ export declare interface ActiveEffect {
|
|
|
25
25
|
bypassed: boolean;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
end: number;
|
|
32
|
-
lines: string[];
|
|
33
|
-
lang?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
28
|
+
/**
|
|
29
|
+
* An action control shown on annotation items (e.g., delete, split).
|
|
30
|
+
*/
|
|
36
31
|
declare interface AnnotationAction {
|
|
37
32
|
class?: string;
|
|
38
33
|
text?: string;
|
|
@@ -41,7 +36,8 @@ declare interface AnnotationAction {
|
|
|
41
36
|
}
|
|
42
37
|
|
|
43
38
|
/**
|
|
44
|
-
* Configuration options passed to annotation action handlers
|
|
39
|
+
* Configuration options passed to annotation action handlers.
|
|
40
|
+
* Used by both browser and annotations packages.
|
|
45
41
|
*/
|
|
46
42
|
declare interface AnnotationActionOptions {
|
|
47
43
|
/** Whether annotation endpoints are linked (moving one endpoint moves the other) */
|
|
@@ -52,6 +48,12 @@ declare interface AnnotationActionOptions {
|
|
|
52
48
|
[key: string]: unknown;
|
|
53
49
|
}
|
|
54
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Shared annotation types used across waveform-playlist packages
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* Base annotation data structure
|
|
56
|
+
*/
|
|
55
57
|
export declare interface AnnotationData {
|
|
56
58
|
id: string;
|
|
57
59
|
start: number;
|
|
@@ -61,18 +63,41 @@ export declare interface AnnotationData {
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
66
|
+
* Interface for annotation integration provided by @waveform-playlist/annotations.
|
|
67
|
+
*
|
|
68
|
+
* The browser package defines what it needs, and the optional annotations package
|
|
69
|
+
* provides it via <AnnotationProvider>.
|
|
68
70
|
*/
|
|
69
|
-
declare interface
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
export declare interface AnnotationIntegration {
|
|
72
|
+
parseAeneas: (data: unknown) => AnnotationData;
|
|
73
|
+
serializeAeneas: (annotation: AnnotationData) => unknown;
|
|
74
|
+
AnnotationText: React.ComponentType<any>;
|
|
75
|
+
AnnotationBox: React.ComponentType<any>;
|
|
76
|
+
AnnotationBoxesWrapper: React.ComponentType<any>;
|
|
77
|
+
ContinuousPlayCheckbox: React.ComponentType<{
|
|
78
|
+
checked: boolean;
|
|
79
|
+
onChange: (checked: boolean) => void;
|
|
80
|
+
className?: string;
|
|
81
|
+
}>;
|
|
82
|
+
LinkEndpointsCheckbox: React.ComponentType<{
|
|
83
|
+
checked: boolean;
|
|
84
|
+
onChange: (checked: boolean) => void;
|
|
85
|
+
className?: string;
|
|
86
|
+
}>;
|
|
87
|
+
EditableCheckbox: React.ComponentType<{
|
|
88
|
+
checked: boolean;
|
|
89
|
+
onChange: (checked: boolean) => void;
|
|
90
|
+
className?: string;
|
|
91
|
+
}>;
|
|
92
|
+
DownloadAnnotationsButton: React.ComponentType<{
|
|
93
|
+
annotations: AnnotationData[];
|
|
94
|
+
filename?: string;
|
|
95
|
+
className?: string;
|
|
96
|
+
}>;
|
|
74
97
|
}
|
|
75
98
|
|
|
99
|
+
export declare const AnnotationIntegrationProvider: Provider<AnnotationIntegration | null>;
|
|
100
|
+
|
|
76
101
|
/**
|
|
77
102
|
* Represents a single audio clip on the timeline
|
|
78
103
|
*
|
|
@@ -250,8 +275,8 @@ declare type ColorMapName = 'viridis' | 'magma' | 'inferno' | 'grayscale' | 'igr
|
|
|
250
275
|
declare type ColorMapValue = ColorMapName | ColorMapEntry[];
|
|
251
276
|
|
|
252
277
|
/**
|
|
253
|
-
* Continuous play checkbox that uses the playlist context
|
|
254
|
-
*
|
|
278
|
+
* Continuous play checkbox that uses the playlist context.
|
|
279
|
+
* Must be used within <AnnotationProvider>.
|
|
255
280
|
*/
|
|
256
281
|
export declare const ContinuousPlayCheckbox: default_2.FC<{
|
|
257
282
|
className?: string;
|
|
@@ -272,8 +297,8 @@ export declare function createEffectChain(effects: EffectInstance[]): {
|
|
|
272
297
|
export declare function createEffectInstance(definition: EffectDefinition, initialParams?: Record<string, number | string | boolean>): EffectInstance;
|
|
273
298
|
|
|
274
299
|
/**
|
|
275
|
-
* Download annotations button that uses the playlist context
|
|
276
|
-
*
|
|
300
|
+
* Download annotations button that uses the playlist context.
|
|
301
|
+
* Must be used within <AnnotationProvider>.
|
|
277
302
|
*/
|
|
278
303
|
export declare const DownloadAnnotationsButton: default_2.FC<{
|
|
279
304
|
filename?: string;
|
|
@@ -312,8 +337,8 @@ declare interface DragSensorOptions {
|
|
|
312
337
|
}
|
|
313
338
|
|
|
314
339
|
/**
|
|
315
|
-
* Editable annotations checkbox that uses the playlist context
|
|
316
|
-
*
|
|
340
|
+
* Editable annotations checkbox that uses the playlist context.
|
|
341
|
+
* Must be used within <AnnotationProvider>.
|
|
317
342
|
*/
|
|
318
343
|
export declare const EditableCheckbox: default_2.FC<{
|
|
319
344
|
className?: string;
|
|
@@ -458,16 +483,8 @@ declare type FFTSize = 256 | 512 | 1024 | 2048 | 4096 | 8192;
|
|
|
458
483
|
* Custom function to generate the label shown on annotation boxes in the waveform.
|
|
459
484
|
* Receives the annotation data and its index in the list, returns a string label.
|
|
460
485
|
* Default behavior: displays annotation.id
|
|
461
|
-
*
|
|
462
|
-
* @example
|
|
463
|
-
* // Show sequence numbers
|
|
464
|
-
* getAnnotationBoxLabel={(annotation, index) => String(index + 1)}
|
|
465
|
-
*
|
|
466
|
-
* @example
|
|
467
|
-
* // Show formatted time
|
|
468
|
-
* getAnnotationBoxLabel={(annotation) => formatTime(annotation.start)}
|
|
469
486
|
*/
|
|
470
|
-
export declare type GetAnnotationBoxLabelFn = (annotation:
|
|
487
|
+
export declare type GetAnnotationBoxLabelFn = (annotation: AnnotationData, index: number) => string;
|
|
471
488
|
|
|
472
489
|
export declare const getEffectDefinition: (id: string) => EffectDefinition | undefined;
|
|
473
490
|
|
|
@@ -509,29 +526,6 @@ declare interface GradientStop {
|
|
|
509
526
|
color: string;
|
|
510
527
|
}
|
|
511
528
|
|
|
512
|
-
export declare interface IntegratedRecordingOptions {
|
|
513
|
-
/**
|
|
514
|
-
* Current playback/cursor position in seconds
|
|
515
|
-
* Recording will start from max(currentTime, lastClipEndTime)
|
|
516
|
-
*/
|
|
517
|
-
currentTime?: number;
|
|
518
|
-
/**
|
|
519
|
-
* MediaTrackConstraints for audio recording
|
|
520
|
-
* These will override the recording-optimized defaults (echo cancellation off, low latency)
|
|
521
|
-
*/
|
|
522
|
-
audioConstraints?: MediaTrackConstraints;
|
|
523
|
-
/**
|
|
524
|
-
* Number of channels to record (1 = mono, 2 = stereo)
|
|
525
|
-
* Default: 1 (mono)
|
|
526
|
-
*/
|
|
527
|
-
channelCount?: number;
|
|
528
|
-
/**
|
|
529
|
-
* Samples per pixel for peak generation
|
|
530
|
-
* Default: 1024
|
|
531
|
-
*/
|
|
532
|
-
samplesPerPixel?: number;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
529
|
declare interface KeyboardShortcut {
|
|
536
530
|
key: string;
|
|
537
531
|
ctrlKey?: boolean;
|
|
@@ -544,8 +538,8 @@ declare interface KeyboardShortcut {
|
|
|
544
538
|
}
|
|
545
539
|
|
|
546
540
|
/**
|
|
547
|
-
* Link endpoints checkbox that uses the playlist context
|
|
548
|
-
*
|
|
541
|
+
* Link endpoints checkbox that uses the playlist context.
|
|
542
|
+
* Must be used within <AnnotationProvider>.
|
|
549
543
|
*/
|
|
550
544
|
export declare const LinkEndpointsCheckbox: default_2.FC<{
|
|
551
545
|
className?: string;
|
|
@@ -598,8 +592,8 @@ export declare interface MediaElementAnimationContextValue {
|
|
|
598
592
|
/**
|
|
599
593
|
* Standalone annotation text list component for MediaElementPlaylistProvider.
|
|
600
594
|
*
|
|
601
|
-
*
|
|
602
|
-
*
|
|
595
|
+
* Requires @waveform-playlist/annotations with AnnotationProvider.
|
|
596
|
+
* Throws if used without `<AnnotationProvider>` wrapping the component tree.
|
|
603
597
|
*/
|
|
604
598
|
export declare const MediaElementAnnotationList: default_2.FC<MediaElementAnnotationListProps>;
|
|
605
599
|
|
|
@@ -808,17 +802,11 @@ export declare interface MediaElementWaveformProps {
|
|
|
808
802
|
className?: string;
|
|
809
803
|
}
|
|
810
804
|
|
|
811
|
-
declare interface MicrophoneDevice {
|
|
812
|
-
deviceId: string;
|
|
813
|
-
label: string;
|
|
814
|
-
groupId: string;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
805
|
/**
|
|
818
806
|
* Callback when annotations are updated (e.g., boundaries dragged).
|
|
819
807
|
* Called with the full updated annotations array.
|
|
820
808
|
*/
|
|
821
|
-
export declare type OnAnnotationUpdateFn = (annotations:
|
|
809
|
+
export declare type OnAnnotationUpdateFn = (annotations: AnnotationData[]) => void;
|
|
822
810
|
|
|
823
811
|
/**
|
|
824
812
|
* Effect definitions for all available Tone.js effects
|
|
@@ -888,8 +876,8 @@ declare interface PlayheadProps {
|
|
|
888
876
|
/**
|
|
889
877
|
* Standalone annotation text list component for WaveformPlaylistProvider (WebAudio).
|
|
890
878
|
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
879
|
+
* Requires @waveform-playlist/annotations with AnnotationProvider.
|
|
880
|
+
* Throws if used without `<AnnotationProvider>` wrapping the component tree.
|
|
893
881
|
*/
|
|
894
882
|
export declare const PlaylistAnnotationList: default_2.FC<PlaylistAnnotationListProps>;
|
|
895
883
|
|
|
@@ -1044,9 +1032,9 @@ export declare interface PlaylistVisualizationProps {
|
|
|
1044
1032
|
}
|
|
1045
1033
|
|
|
1046
1034
|
/**
|
|
1047
|
-
* Props passed to the renderAnnotationItem function for custom rendering
|
|
1035
|
+
* Props passed to the renderAnnotationItem function for custom rendering.
|
|
1048
1036
|
*/
|
|
1049
|
-
|
|
1037
|
+
declare interface RenderAnnotationItemProps {
|
|
1050
1038
|
annotation: AnnotationData;
|
|
1051
1039
|
index: number;
|
|
1052
1040
|
isActive: boolean;
|
|
@@ -1409,14 +1397,23 @@ export declare function useAnnotationDragHandlers({ annotations, onAnnotationsCh
|
|
|
1409
1397
|
};
|
|
1410
1398
|
|
|
1411
1399
|
declare interface UseAnnotationDragHandlersOptions {
|
|
1412
|
-
annotations:
|
|
1413
|
-
onAnnotationsChange: (annotations:
|
|
1400
|
+
annotations: AnnotationData[];
|
|
1401
|
+
onAnnotationsChange: (annotations: AnnotationData[]) => void;
|
|
1414
1402
|
samplesPerPixel: number;
|
|
1415
1403
|
sampleRate: number;
|
|
1416
1404
|
duration: number;
|
|
1417
1405
|
linkEndpoints: boolean;
|
|
1418
1406
|
}
|
|
1419
1407
|
|
|
1408
|
+
/**
|
|
1409
|
+
* Hook to access annotation integration provided by @waveform-playlist/annotations.
|
|
1410
|
+
* Throws if used without <AnnotationProvider> wrapping the component tree.
|
|
1411
|
+
*
|
|
1412
|
+
* Follows the Kent C. Dodds pattern:
|
|
1413
|
+
* https://kentcdodds.com/blog/how-to-use-react-context-effectively
|
|
1414
|
+
*/
|
|
1415
|
+
export declare function useAnnotationIntegration(): AnnotationIntegration;
|
|
1416
|
+
|
|
1420
1417
|
/**
|
|
1421
1418
|
* Hook for keyboard-based annotation navigation and boundary editing
|
|
1422
1419
|
*
|
|
@@ -1461,9 +1458,9 @@ export declare function useAnnotationKeyboardControls({ annotations, activeAnnot
|
|
|
1461
1458
|
};
|
|
1462
1459
|
|
|
1463
1460
|
declare interface UseAnnotationKeyboardControlsOptions {
|
|
1464
|
-
annotations:
|
|
1461
|
+
annotations: AnnotationData[];
|
|
1465
1462
|
activeAnnotationId: string | null;
|
|
1466
|
-
onAnnotationsChange: (annotations:
|
|
1463
|
+
onAnnotationsChange: (annotations: AnnotationData[]) => void;
|
|
1467
1464
|
/** Callback to set the active annotation ID for selection */
|
|
1468
1465
|
onActiveAnnotationChange?: (id: string | null) => void;
|
|
1469
1466
|
duration: number;
|
|
@@ -1703,28 +1700,6 @@ export declare interface UseExportWavReturn {
|
|
|
1703
1700
|
error: string | null;
|
|
1704
1701
|
}
|
|
1705
1702
|
|
|
1706
|
-
export declare function useIntegratedRecording(tracks: ClipTrack[], setTracks: (tracks: ClipTrack[]) => void, selectedTrackId: string | null, options?: IntegratedRecordingOptions): UseIntegratedRecordingReturn;
|
|
1707
|
-
|
|
1708
|
-
export declare interface UseIntegratedRecordingReturn {
|
|
1709
|
-
isRecording: boolean;
|
|
1710
|
-
isPaused: boolean;
|
|
1711
|
-
duration: number;
|
|
1712
|
-
level: number;
|
|
1713
|
-
peakLevel: number;
|
|
1714
|
-
error: Error | null;
|
|
1715
|
-
stream: MediaStream | null;
|
|
1716
|
-
devices: MicrophoneDevice[];
|
|
1717
|
-
hasPermission: boolean;
|
|
1718
|
-
selectedDevice: string | null;
|
|
1719
|
-
startRecording: () => void;
|
|
1720
|
-
stopRecording: () => void;
|
|
1721
|
-
pauseRecording: () => void;
|
|
1722
|
-
resumeRecording: () => void;
|
|
1723
|
-
requestMicAccess: () => Promise<void>;
|
|
1724
|
-
changeDevice: (deviceId: string) => Promise<void>;
|
|
1725
|
-
recordingPeaks: Int8Array | Int16Array;
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
1703
|
/**
|
|
1729
1704
|
* Hook for managing keyboard shortcuts
|
|
1730
1705
|
*
|
|
@@ -1867,7 +1842,14 @@ export declare const usePlaylistData: () => PlaylistDataContextValue;
|
|
|
1867
1842
|
|
|
1868
1843
|
export declare const usePlaylistState: () => PlaylistStateContextValue;
|
|
1869
1844
|
|
|
1870
|
-
|
|
1845
|
+
/**
|
|
1846
|
+
* Hook to access spectrogram integration provided by @waveform-playlist/spectrogram.
|
|
1847
|
+
* Throws if used without <SpectrogramProvider> wrapping the component tree.
|
|
1848
|
+
*
|
|
1849
|
+
* Follows the Kent C. Dodds pattern:
|
|
1850
|
+
* https://kentcdodds.com/blog/how-to-use-react-context-effectively
|
|
1851
|
+
*/
|
|
1852
|
+
export declare function useSpectrogramIntegration(): SpectrogramIntegration;
|
|
1871
1853
|
|
|
1872
1854
|
/**
|
|
1873
1855
|
* Hook to manage time format state
|