@waveform-playlist/browser 5.0.0-alpha.14 → 5.0.0-alpha.16

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[];
@@ -651,18 +679,20 @@ export declare interface MediaElementWaveformProps {
651
679
  /** Height in pixels for the annotation text list */
652
680
  annotationTextHeight?: number;
653
681
  /** 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;
682
+ getAnnotationBoxLabel?: GetAnnotationBoxLabelFn;
660
683
  /**
661
684
  * Custom render function for annotation items in the text list.
662
685
  * When provided, completely replaces the default annotation item rendering.
663
686
  * Use this to customize the appearance of each annotation (e.g., add furigana).
664
687
  */
665
688
  renderAnnotationItem?: (props: RenderAnnotationItemProps) => default_2.ReactNode;
689
+ /** Whether annotation boundaries can be edited by dragging. Defaults to false. */
690
+ editable?: boolean;
691
+ /**
692
+ * Callback when annotations are updated (e.g., boundaries dragged).
693
+ * Called with the full updated annotations array.
694
+ */
695
+ onAnnotationUpdate?: OnAnnotationUpdateFn;
666
696
  className?: string;
667
697
  }
668
698
 
@@ -672,6 +702,12 @@ declare interface MicrophoneDevice {
672
702
  groupId: string;
673
703
  }
674
704
 
705
+ /**
706
+ * Callback when annotations are updated (e.g., boundaries dragged).
707
+ * Called with the full updated annotations array.
708
+ */
709
+ export declare type OnAnnotationUpdateFn = (annotations: AnnotationData_2[]) => void;
710
+
675
711
  /**
676
712
  * Effect definitions for all available Tone.js effects
677
713
  * Each effect has parameters with min/max/default values for UI controls
@@ -1815,15 +1851,10 @@ export declare interface WaveformProps {
1815
1851
  renderAnnotationItem?: (props: RenderAnnotationItemProps) => ReactNode;
1816
1852
  /**
1817
1853
  * Custom function to generate the label shown on annotation boxes in the waveform.
1818
- * Receives the annotation data and should return a string label.
1854
+ * Receives the annotation data and its index, returns a string label.
1819
1855
  * Default: annotation.id
1820
1856
  */
1821
- getAnnotationBoxLabel?: (annotation: {
1822
- id: string;
1823
- start: number;
1824
- end: number;
1825
- lines: string[];
1826
- }) => string;
1857
+ getAnnotationBoxLabel?: GetAnnotationBoxLabelFn;
1827
1858
  className?: string;
1828
1859
  showClipHeaders?: boolean;
1829
1860
  interactiveClips?: boolean;