@waveform-playlist/browser 5.0.0-alpha.15 → 5.0.0-alpha.17

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 CHANGED
@@ -59,6 +59,19 @@ export declare interface AnnotationData {
59
59
  language?: string;
60
60
  }
61
61
 
62
+ /**
63
+ * Shared annotation types used across Waveform components
64
+ */
65
+ /**
66
+ * Base annotation data structure
67
+ */
68
+ declare interface AnnotationData_2 {
69
+ id: string;
70
+ start: number;
71
+ end: number;
72
+ lines: string[];
73
+ }
74
+
62
75
  /**
63
76
  * Represents a single audio clip on the timeline
64
77
  *
@@ -411,6 +424,21 @@ export declare const FastForwardButton: default_2.FC<{
411
424
  className?: string;
412
425
  }>;
413
426
 
427
+ /**
428
+ * Custom function to generate the label shown on annotation boxes in the waveform.
429
+ * Receives the annotation data and its index in the list, returns a string label.
430
+ * Default behavior: displays annotation.id
431
+ *
432
+ * @example
433
+ * // Show sequence numbers
434
+ * getAnnotationBoxLabel={(annotation, index) => String(index + 1)}
435
+ *
436
+ * @example
437
+ * // Show formatted time
438
+ * getAnnotationBoxLabel={(annotation) => formatTime(annotation.start)}
439
+ */
440
+ export declare type GetAnnotationBoxLabelFn = (annotation: AnnotationData_2, index: number) => string;
441
+
414
442
  export declare const getEffectDefinition: (id: string) => EffectDefinition | undefined;
415
443
 
416
444
  export declare const getEffectsByCategory: (category: EffectDefinition["category"]) => EffectDefinition[];
@@ -546,6 +574,9 @@ export declare interface MediaElementControlsContextValue {
546
574
  setContinuousPlay: (enabled: boolean) => void;
547
575
  setAnnotations: (annotations: AnnotationData[]) => void;
548
576
  setActiveAnnotationId: (id: string | null) => void;
577
+ setAutomaticScroll: (enabled: boolean) => void;
578
+ setScrollContainer: (element: HTMLDivElement | null) => void;
579
+ scrollContainerRef: default_2.RefObject<HTMLDivElement | null>;
549
580
  }
550
581
 
551
582
  export declare interface MediaElementDataContextValue {
@@ -594,6 +625,8 @@ declare interface MediaElementPlaylistProviderProps {
594
625
  timescale?: boolean;
595
626
  /** Initial playback rate (0.5 to 2.0) */
596
627
  playbackRate?: number;
628
+ /** Enable automatic scroll to keep playhead centered */
629
+ automaticScroll?: boolean;
597
630
  /** Theme configuration */
598
631
  theme?: Partial<WaveformPlaylistTheme>;
599
632
  /** Track controls configuration */
@@ -622,6 +655,7 @@ export declare interface MediaElementStateContextValue {
622
655
  annotations: AnnotationData[];
623
656
  activeAnnotationId: string | null;
624
657
  playbackRate: number;
658
+ isAutomaticScroll: boolean;
625
659
  }
626
660
 
627
661
  export declare interface MediaElementTrackConfig {
@@ -651,12 +685,7 @@ export declare interface MediaElementWaveformProps {
651
685
  /** Height in pixels for the annotation text list */
652
686
  annotationTextHeight?: number;
653
687
  /** Custom function to generate the label shown on annotation boxes */
654
- getAnnotationBoxLabel?: (annotation: {
655
- id: string;
656
- start: number;
657
- end: number;
658
- lines: string[];
659
- }) => string;
688
+ getAnnotationBoxLabel?: GetAnnotationBoxLabelFn;
660
689
  /**
661
690
  * Custom render function for annotation items in the text list.
662
691
  * When provided, completely replaces the default annotation item rendering.
@@ -669,12 +698,9 @@ export declare interface MediaElementWaveformProps {
669
698
  * Callback when annotations are updated (e.g., boundaries dragged).
670
699
  * Called with the full updated annotations array.
671
700
  */
672
- onAnnotationUpdate?: (annotations: {
673
- id: string;
674
- start: number;
675
- end: number;
676
- lines: string[];
677
- }[]) => void;
701
+ onAnnotationUpdate?: OnAnnotationUpdateFn;
702
+ /** Where to position the active annotation when auto-scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */
703
+ scrollActivePosition?: ScrollLogicalPosition;
678
704
  className?: string;
679
705
  }
680
706
 
@@ -684,6 +710,12 @@ declare interface MicrophoneDevice {
684
710
  groupId: string;
685
711
  }
686
712
 
713
+ /**
714
+ * Callback when annotations are updated (e.g., boundaries dragged).
715
+ * Called with the full updated annotations array.
716
+ */
717
+ export declare type OnAnnotationUpdateFn = (annotations: AnnotationData_2[]) => void;
718
+
687
719
  /**
688
720
  * Effect definitions for all available Tone.js effects
689
721
  * Each effect has parameters with min/max/default values for UI controls
@@ -1827,15 +1859,12 @@ export declare interface WaveformProps {
1827
1859
  renderAnnotationItem?: (props: RenderAnnotationItemProps) => ReactNode;
1828
1860
  /**
1829
1861
  * Custom function to generate the label shown on annotation boxes in the waveform.
1830
- * Receives the annotation data and should return a string label.
1862
+ * Receives the annotation data and its index, returns a string label.
1831
1863
  * Default: annotation.id
1832
1864
  */
1833
- getAnnotationBoxLabel?: (annotation: {
1834
- id: string;
1835
- start: number;
1836
- end: number;
1837
- lines: string[];
1838
- }) => string;
1865
+ getAnnotationBoxLabel?: GetAnnotationBoxLabelFn;
1866
+ /** Where to position the active annotation when auto-scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */
1867
+ scrollActivePosition?: ScrollLogicalPosition;
1839
1868
  className?: string;
1840
1869
  showClipHeaders?: boolean;
1841
1870
  interactiveClips?: boolean;