@waveform-playlist/browser 6.0.1 → 7.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 +67 -95
- package/dist/index.js +75 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2502 -2460
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import { Analyser } from 'tone';
|
|
1
2
|
import { BaseContext } from 'tone';
|
|
2
3
|
import { default as default_2 } from 'react';
|
|
3
4
|
import { default as default_3 } from 'waveform-data';
|
|
4
5
|
import { DragEndEvent } from '@dnd-kit/core';
|
|
6
|
+
import { DragMoveEvent } from '@dnd-kit/core';
|
|
7
|
+
import { DragStartEvent } from '@dnd-kit/core';
|
|
5
8
|
import { Fade as Fade_2 } from '@waveform-playlist/core';
|
|
6
9
|
import { Gain } from 'tone';
|
|
10
|
+
import { InputNode } from 'tone';
|
|
7
11
|
import { MediaElementPlayout } from '@waveform-playlist/media-element-playout';
|
|
12
|
+
import { Modifier } from '@dnd-kit/core';
|
|
8
13
|
import { MutableRefObject } from 'react';
|
|
9
14
|
import { Provider } from 'react';
|
|
10
15
|
import react__default from 'react';
|
|
@@ -48,6 +53,32 @@ declare interface AnnotationActionOptions {
|
|
|
48
53
|
[key: string]: unknown;
|
|
49
54
|
}
|
|
50
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Props the browser package passes to the AnnotationBoxesWrapper component.
|
|
58
|
+
* Mirrors what PlaylistVisualization and MediaElementPlaylist actually use.
|
|
59
|
+
*/
|
|
60
|
+
declare interface AnnotationBoxesWrapperIntegrationProps {
|
|
61
|
+
children?: React.ReactNode;
|
|
62
|
+
height?: number;
|
|
63
|
+
width?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Props the browser package passes to the AnnotationBox component.
|
|
68
|
+
* Mirrors what PlaylistVisualization and MediaElementPlaylist actually use.
|
|
69
|
+
*/
|
|
70
|
+
declare interface AnnotationBoxIntegrationProps {
|
|
71
|
+
annotationId: string;
|
|
72
|
+
annotationIndex: number;
|
|
73
|
+
startPosition: number;
|
|
74
|
+
endPosition: number;
|
|
75
|
+
label?: string;
|
|
76
|
+
color?: string;
|
|
77
|
+
isActive?: boolean;
|
|
78
|
+
onClick?: () => void;
|
|
79
|
+
editable?: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
51
82
|
/**
|
|
52
83
|
* Shared annotation types used across waveform-playlist packages
|
|
53
84
|
*/
|
|
@@ -71,9 +102,9 @@ export declare interface AnnotationData {
|
|
|
71
102
|
export declare interface AnnotationIntegration {
|
|
72
103
|
parseAeneas: (data: unknown) => AnnotationData;
|
|
73
104
|
serializeAeneas: (annotation: AnnotationData) => unknown;
|
|
74
|
-
AnnotationText: React.ComponentType<
|
|
75
|
-
AnnotationBox: React.ComponentType<
|
|
76
|
-
AnnotationBoxesWrapper: React.ComponentType<
|
|
105
|
+
AnnotationText: React.ComponentType<AnnotationTextIntegrationProps>;
|
|
106
|
+
AnnotationBox: React.ComponentType<AnnotationBoxIntegrationProps>;
|
|
107
|
+
AnnotationBoxesWrapper: React.ComponentType<AnnotationBoxesWrapperIntegrationProps>;
|
|
77
108
|
ContinuousPlayCheckbox: React.ComponentType<{
|
|
78
109
|
checked: boolean;
|
|
79
110
|
onChange: (checked: boolean) => void;
|
|
@@ -98,6 +129,24 @@ export declare interface AnnotationIntegration {
|
|
|
98
129
|
|
|
99
130
|
export declare const AnnotationIntegrationProvider: Provider<AnnotationIntegration | null>;
|
|
100
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Props the browser package passes to the AnnotationText component.
|
|
134
|
+
* Mirrors what PlaylistAnnotationList and MediaElementAnnotationList actually use.
|
|
135
|
+
*/
|
|
136
|
+
declare interface AnnotationTextIntegrationProps {
|
|
137
|
+
annotations: AnnotationData[];
|
|
138
|
+
activeAnnotationId?: string;
|
|
139
|
+
shouldScrollToActive?: boolean;
|
|
140
|
+
scrollActivePosition?: ScrollLogicalPosition;
|
|
141
|
+
scrollActiveContainer?: 'nearest' | 'all';
|
|
142
|
+
editable?: boolean;
|
|
143
|
+
controls?: AnnotationAction[];
|
|
144
|
+
annotationListConfig?: AnnotationActionOptions;
|
|
145
|
+
height?: number;
|
|
146
|
+
onAnnotationUpdate?: (updatedAnnotations: AnnotationData[]) => void;
|
|
147
|
+
renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;
|
|
148
|
+
}
|
|
149
|
+
|
|
101
150
|
/**
|
|
102
151
|
* Represents a single audio clip on the timeline
|
|
103
152
|
*
|
|
@@ -286,8 +335,8 @@ export declare const ContinuousPlayCheckbox: default_2.FC<{
|
|
|
286
335
|
* Create a chain of effects connected in series
|
|
287
336
|
*/
|
|
288
337
|
export declare function createEffectChain(effects: EffectInstance[]): {
|
|
289
|
-
input:
|
|
290
|
-
output:
|
|
338
|
+
input: ToneAudioNode;
|
|
339
|
+
output: ToneAudioNode;
|
|
291
340
|
dispose: () => void;
|
|
292
341
|
};
|
|
293
342
|
|
|
@@ -360,13 +409,13 @@ export declare interface EffectDefinition {
|
|
|
360
409
|
export declare const effectDefinitions: EffectDefinition[];
|
|
361
410
|
|
|
362
411
|
export declare interface EffectInstance {
|
|
363
|
-
effect:
|
|
412
|
+
effect: ToneAudioNode;
|
|
364
413
|
id: string;
|
|
365
414
|
instanceId: string;
|
|
366
415
|
dispose: () => void;
|
|
367
416
|
setParameter: (name: string, value: number | string | boolean) => void;
|
|
368
417
|
getParameter: (name: string) => number | string | boolean | undefined;
|
|
369
|
-
connect: (destination:
|
|
418
|
+
connect: (destination: InputNode) => void;
|
|
370
419
|
disconnect: () => void;
|
|
371
420
|
}
|
|
372
421
|
|
|
@@ -728,7 +777,7 @@ declare interface MediaElementPlaylistProviderProps {
|
|
|
728
777
|
};
|
|
729
778
|
/** Annotations */
|
|
730
779
|
annotationList?: {
|
|
731
|
-
annotations?:
|
|
780
|
+
annotations?: AnnotationData[];
|
|
732
781
|
isContinuousPlay?: boolean;
|
|
733
782
|
};
|
|
734
783
|
/** Width of waveform bars */
|
|
@@ -957,7 +1006,7 @@ declare interface PlaylistDataContextValue {
|
|
|
957
1006
|
};
|
|
958
1007
|
playoutRef: default_2.RefObject<TonePlayout | null>;
|
|
959
1008
|
samplesPerPixel: number;
|
|
960
|
-
timeFormat:
|
|
1009
|
+
timeFormat: TimeFormat;
|
|
961
1010
|
masterVolume: number;
|
|
962
1011
|
canZoomIn: boolean;
|
|
963
1012
|
canZoomOut: boolean;
|
|
@@ -1383,16 +1432,8 @@ declare interface TrackState_2 {
|
|
|
1383
1432
|
* ```
|
|
1384
1433
|
*/
|
|
1385
1434
|
export declare function useAnnotationDragHandlers({ annotations, onAnnotationsChange, samplesPerPixel, sampleRate, duration, linkEndpoints, }: UseAnnotationDragHandlersOptions): {
|
|
1386
|
-
onDragStart: (event:
|
|
1387
|
-
|
|
1388
|
-
}) => void;
|
|
1389
|
-
onDragMove: (event: {
|
|
1390
|
-
active: any;
|
|
1391
|
-
delta: {
|
|
1392
|
-
x: number;
|
|
1393
|
-
y: number;
|
|
1394
|
-
};
|
|
1395
|
-
}) => void;
|
|
1435
|
+
onDragStart: (event: DragStartEvent) => void;
|
|
1436
|
+
onDragMove: (event: DragMoveEvent) => void;
|
|
1396
1437
|
onDragEnd: () => void;
|
|
1397
1438
|
};
|
|
1398
1439
|
|
|
@@ -1568,24 +1609,10 @@ declare interface UseAudioTracksOptions {
|
|
|
1568
1609
|
* ```
|
|
1569
1610
|
*/
|
|
1570
1611
|
export declare function useClipDragHandlers({ tracks, onTracksChange, samplesPerPixel, sampleRate, }: UseClipDragHandlersOptions): {
|
|
1571
|
-
onDragStart: (event:
|
|
1572
|
-
|
|
1573
|
-
}) => void;
|
|
1574
|
-
onDragMove: (event: {
|
|
1575
|
-
active: any;
|
|
1576
|
-
delta: {
|
|
1577
|
-
x: number;
|
|
1578
|
-
y: number;
|
|
1579
|
-
};
|
|
1580
|
-
}) => void;
|
|
1612
|
+
onDragStart: (event: DragStartEvent) => void;
|
|
1613
|
+
onDragMove: (event: DragMoveEvent) => void;
|
|
1581
1614
|
onDragEnd: (event: DragEndEvent) => void;
|
|
1582
|
-
collisionModifier: (args: {
|
|
1583
|
-
transform: {
|
|
1584
|
-
x: number;
|
|
1585
|
-
y: number;
|
|
1586
|
-
};
|
|
1587
|
-
active: any;
|
|
1588
|
-
}) => {
|
|
1615
|
+
collisionModifier: (args: Parameters<Modifier>[0]) => {
|
|
1589
1616
|
scaleX: number;
|
|
1590
1617
|
scaleY: number;
|
|
1591
1618
|
x: number;
|
|
@@ -1680,7 +1707,7 @@ export declare interface UseDynamicEffectsReturn {
|
|
|
1680
1707
|
* This creates new effect instances that work in the offline AudioContext.
|
|
1681
1708
|
*/
|
|
1682
1709
|
createOfflineEffectsFunction: () => EffectsFunction | undefined;
|
|
1683
|
-
analyserRef: React.RefObject<
|
|
1710
|
+
analyserRef: React.RefObject<Analyser | null>;
|
|
1684
1711
|
}
|
|
1685
1712
|
|
|
1686
1713
|
/**
|
|
@@ -1742,7 +1769,7 @@ declare interface UseKeyboardShortcutsOptions {
|
|
|
1742
1769
|
* For more advanced effects (reverb, delay, filters, etc.), use useDynamicEffects instead.
|
|
1743
1770
|
*/
|
|
1744
1771
|
export declare const useMasterAnalyser: (fftSize?: number) => {
|
|
1745
|
-
analyserRef: MutableRefObject<
|
|
1772
|
+
analyserRef: MutableRefObject<Analyser | null>;
|
|
1746
1773
|
masterEffects: EffectsFunction;
|
|
1747
1774
|
};
|
|
1748
1775
|
|
|
@@ -1889,8 +1916,6 @@ export declare interface UseTrackDynamicEffectsReturn {
|
|
|
1889
1916
|
availableEffects: EffectDefinition[];
|
|
1890
1917
|
}
|
|
1891
1918
|
|
|
1892
|
-
export declare const useWaveformPlaylist: () => WaveformPlaylistContextValue;
|
|
1893
|
-
|
|
1894
1919
|
export declare function useZoomControls({ initialSamplesPerPixel, zoomLevels, }: UseZoomControlsProps): ZoomControls;
|
|
1895
1920
|
|
|
1896
1921
|
declare interface UseZoomControlsProps {
|
|
@@ -1994,59 +2019,6 @@ declare interface WaveformGradient {
|
|
|
1994
2019
|
stops: GradientStop[];
|
|
1995
2020
|
}
|
|
1996
2021
|
|
|
1997
|
-
export declare interface WaveformPlaylistContextValue {
|
|
1998
|
-
isPlaying: boolean;
|
|
1999
|
-
currentTime: number;
|
|
2000
|
-
duration: number;
|
|
2001
|
-
audioBuffers: AudioBuffer[];
|
|
2002
|
-
peaksDataArray: TrackClipPeaks[];
|
|
2003
|
-
trackStates: TrackState[];
|
|
2004
|
-
annotations: AnnotationData[];
|
|
2005
|
-
activeAnnotationId: string | null;
|
|
2006
|
-
selectionStart: number;
|
|
2007
|
-
selectionEnd: number;
|
|
2008
|
-
isAutomaticScroll: boolean;
|
|
2009
|
-
continuousPlay: boolean;
|
|
2010
|
-
linkEndpoints: boolean;
|
|
2011
|
-
annotationsEditable: boolean;
|
|
2012
|
-
play: (startTime?: number, playDuration?: number) => Promise<void>;
|
|
2013
|
-
pause: () => void;
|
|
2014
|
-
stop: () => void;
|
|
2015
|
-
setCurrentTime: (time: number) => void;
|
|
2016
|
-
setTrackMute: (trackIndex: number, muted: boolean) => void;
|
|
2017
|
-
setTrackSolo: (trackIndex: number, soloed: boolean) => void;
|
|
2018
|
-
setTrackVolume: (trackIndex: number, volume: number) => void;
|
|
2019
|
-
setTrackPan: (trackIndex: number, pan: number) => void;
|
|
2020
|
-
setSelection: (start: number, end: number) => void;
|
|
2021
|
-
timeFormat: string;
|
|
2022
|
-
setTimeFormat: (format: TimeFormat) => void;
|
|
2023
|
-
formatTime: (seconds: number) => string;
|
|
2024
|
-
samplesPerPixel: number;
|
|
2025
|
-
zoomIn: () => void;
|
|
2026
|
-
zoomOut: () => void;
|
|
2027
|
-
canZoomIn: boolean;
|
|
2028
|
-
canZoomOut: boolean;
|
|
2029
|
-
masterVolume: number;
|
|
2030
|
-
setMasterVolume: (volume: number) => void;
|
|
2031
|
-
setAutomaticScroll: (enabled: boolean) => void;
|
|
2032
|
-
setScrollContainer: (element: HTMLDivElement | null) => void;
|
|
2033
|
-
setContinuousPlay: (enabled: boolean) => void;
|
|
2034
|
-
setLinkEndpoints: (enabled: boolean) => void;
|
|
2035
|
-
setAnnotationsEditable: (enabled: boolean) => void;
|
|
2036
|
-
setAnnotations: default_2.Dispatch<default_2.SetStateAction<AnnotationData[]>>;
|
|
2037
|
-
setActiveAnnotationId: (id: string | null) => void;
|
|
2038
|
-
playoutRef: default_2.RefObject<TonePlayout | null>;
|
|
2039
|
-
currentTimeRef: default_2.RefObject<number>;
|
|
2040
|
-
sampleRate: number;
|
|
2041
|
-
waveHeight: number;
|
|
2042
|
-
timeScaleHeight: number;
|
|
2043
|
-
minimumPlaylistHeight: number;
|
|
2044
|
-
controls: {
|
|
2045
|
-
show: boolean;
|
|
2046
|
-
width: number;
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
2022
|
export declare const WaveformPlaylistProvider: default_2.FC<WaveformPlaylistProviderProps>;
|
|
2051
2023
|
|
|
2052
2024
|
declare interface WaveformPlaylistProviderProps {
|
|
@@ -2063,11 +2035,11 @@ declare interface WaveformPlaylistProviderProps {
|
|
|
2063
2035
|
width: number;
|
|
2064
2036
|
};
|
|
2065
2037
|
annotationList?: {
|
|
2066
|
-
annotations?:
|
|
2038
|
+
annotations?: AnnotationData[];
|
|
2067
2039
|
editable?: boolean;
|
|
2068
2040
|
isContinuousPlay?: boolean;
|
|
2069
2041
|
linkEndpoints?: boolean;
|
|
2070
|
-
controls?:
|
|
2042
|
+
controls?: AnnotationAction[];
|
|
2071
2043
|
};
|
|
2072
2044
|
effects?: EffectsFunction;
|
|
2073
2045
|
onReady?: () => void;
|