@waveform-playlist/ui-components 8.1.0 → 9.0.1

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.mts CHANGED
@@ -1,8 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { FunctionComponent, ReactNode, Dispatch, SetStateAction } from 'react';
3
3
  import { Peaks, Bits, Fade, FadeType, SpectrogramData, RenderMode } from '@waveform-playlist/core';
4
- import { DraggableAttributes } from '@dnd-kit/core';
5
- import { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities';
6
4
  import * as styled_components_dist_utils_hoist from 'styled-components/dist/utils/hoist';
7
5
  import * as styled_components from 'styled-components';
8
6
  import { DefaultTheme } from 'styled-components';
@@ -144,8 +142,8 @@ interface ChannelProps {
144
142
  transparentBackground?: boolean;
145
143
  /**
146
144
  * Drawing mode:
147
- * - 'inverted': Draw waveOutlineColor where there's NO audio (current default). Good for gradient bars.
148
- * - 'normal': Draw waveFillColor where there IS audio. Good for gradient backgrounds.
145
+ * - 'inverted': Canvas draws waveOutlineColor where there's NO audio, revealing waveFillColor background as bars (default). Good for gradient bars.
146
+ * - 'normal': Canvas draws waveFillColor where there IS audio. Use with transparentBackground for progress overlays.
149
147
  */
150
148
  drawMode?: WaveformDrawMode;
151
149
  }
@@ -208,23 +206,51 @@ interface ClipProps {
208
206
  /**
209
207
  * Clip component for rendering individual audio clips within a track
210
208
  *
211
- * Each clip is positioned based on its startTime and has a width based on its duration.
209
+ * Each clip is positioned based on its startSample and has a width based on its durationSamples.
212
210
  * This allows multiple clips to be arranged on a single track with gaps or overlaps.
213
211
  *
214
212
  * Includes a draggable ClipHeader at the top for repositioning clips on the timeline.
215
213
  */
216
214
  declare const Clip: FunctionComponent<ClipProps>;
217
215
 
216
+ declare const CLIP_BOUNDARY_WIDTH = 8;
217
+ declare const CLIP_BOUNDARY_WIDTH_TOUCH = 24;
218
+ type BoundaryEdge = 'left' | 'right';
219
+ interface BoundaryDragHandleProps {
220
+ ref: (element: Element | null) => void;
221
+ isDragging?: boolean;
222
+ }
223
+ interface ClipBoundaryProps {
224
+ clipId: string;
225
+ trackIndex: number;
226
+ clipIndex: number;
227
+ edge: BoundaryEdge;
228
+ dragHandleProps?: BoundaryDragHandleProps;
229
+ /**
230
+ * Enable larger touch targets for mobile devices.
231
+ * When true, boundary width increases from 8px to 24px for easier touch targeting.
232
+ */
233
+ touchOptimized?: boolean;
234
+ }
235
+ /**
236
+ * ClipBoundary component - Draggable edge for trimming clips
237
+ *
238
+ * Renders at the left or right edge of a clip.
239
+ * Drag to trim the clip (adjust offset and duration).
240
+ * Supports bidirectional trimming (trim in and out).
241
+ *
242
+ * On mobile (touchOptimized=true), boundaries are wider for easier targeting.
243
+ */
244
+ declare const ClipBoundary: FunctionComponent<ClipBoundaryProps>;
245
+
218
246
  declare const CLIP_HEADER_HEIGHT = 22;
219
247
  interface ClipHeaderPresentationalProps {
220
248
  trackName: string;
221
249
  isSelected?: boolean;
222
250
  }
223
251
  declare const ClipHeaderPresentational: FunctionComponent<ClipHeaderPresentationalProps>;
224
- interface DragHandleProps$1 {
225
- attributes: DraggableAttributes;
226
- listeners: SyntheticListenerMap | undefined;
227
- setActivatorNodeRef: (element: HTMLElement | null) => void;
252
+ interface DragHandleProps {
253
+ handleRef: (element: Element | null) => void;
228
254
  }
229
255
  interface ClipHeaderProps {
230
256
  clipId: string;
@@ -233,7 +259,7 @@ interface ClipHeaderProps {
233
259
  trackName: string;
234
260
  isSelected?: boolean;
235
261
  disableDrag?: boolean;
236
- dragHandleProps?: DragHandleProps$1;
262
+ dragHandleProps?: DragHandleProps;
237
263
  }
238
264
  /**
239
265
  * ClipHeader component - Draggable title bar for audio clips
@@ -249,35 +275,6 @@ interface ClipHeaderProps {
249
275
  */
250
276
  declare const ClipHeader: FunctionComponent<ClipHeaderProps>;
251
277
 
252
- declare const CLIP_BOUNDARY_WIDTH = 8;
253
- declare const CLIP_BOUNDARY_WIDTH_TOUCH = 24;
254
- type BoundaryEdge = 'left' | 'right';
255
- interface DragHandleProps extends DragHandleProps$1 {
256
- isDragging?: boolean;
257
- }
258
- interface ClipBoundaryProps {
259
- clipId: string;
260
- trackIndex: number;
261
- clipIndex: number;
262
- edge: BoundaryEdge;
263
- dragHandleProps?: DragHandleProps;
264
- /**
265
- * Enable larger touch targets for mobile devices.
266
- * When true, boundary width increases from 8px to 24px for easier touch targeting.
267
- */
268
- touchOptimized?: boolean;
269
- }
270
- /**
271
- * ClipBoundary component - Draggable edge for trimming clips
272
- *
273
- * Renders at the left or right edge of a clip.
274
- * Drag to trim the clip (adjust offset and duration).
275
- * Supports bidirectional trimming (trim in and out).
276
- *
277
- * On mobile (touchOptimized=true), boundaries are wider for easier targeting.
278
- */
279
- declare const ClipBoundary: FunctionComponent<ClipBoundaryProps>;
280
-
281
278
  interface FadeOverlayProps {
282
279
  /** Position in pixels from the start of the clip */
283
280
  left: number;
@@ -853,4 +850,4 @@ declare const BaseSlider: styled_components_dist_types.IStyledComponentBase<"web
853
850
  ref?: ((instance: HTMLInputElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLInputElement> | null | undefined;
854
851
  }>, never>, never>> & string;
855
852
 
856
- export { AudioPosition, type AudioPositionProps, AutomaticScrollCheckbox, type AutomaticScrollCheckboxProps, BaseButton, BaseCheckbox, BaseCheckboxLabel, BaseCheckboxWrapper, BaseControlButton, BaseInput, BaseLabel, BaseSelect, BaseSlider, Button, ButtonGroup, CLIP_BOUNDARY_WIDTH, CLIP_BOUNDARY_WIDTH_TOUCH, CLIP_HEADER_HEIGHT, Channel, type ChannelProps, Clip, ClipBoundary, type ClipBoundaryProps, ClipHeader, ClipHeaderPresentational, type ClipHeaderPresentationalProps, type ClipHeaderProps, type ClipProps, ClipViewportOriginProvider, CloseButton, Controls$1 as Controls, type ControlsWrapperProps, DevicePixelRatioProvider, DotsIcon, type DragHandleProps$1 as DragHandleProps, FadeOverlay, type FadeOverlayProps, type GradientStop, Header, InlineLabel, LoopRegion, LoopRegionMarkers, type LoopRegionMarkersProps, type LoopRegionProps, MasterVolumeControl, type MasterVolumeControlProps, Playhead, type PlayheadProps, PlayheadWithMarker, Playlist, PlaylistErrorBoundary, type PlaylistErrorBoundaryProps, PlaylistInfoContext, type PlaylistProps, PlayoutProvider, type RenderPlayheadFunction, ScreenReaderOnly, type ScrollViewport, ScrollViewportProvider, Selection, type SelectionProps, SelectionTimeInputs, type SelectionTimeInputsProps, Slider, SliderWrapper, SmartChannel, type SmartChannelProps, SmartScale, type SmartScaleProps, SpectrogramChannel, type SpectrogramChannelProps, SpectrogramLabels, type SpectrogramLabelsProps, type SpectrogramWorkerCanvasApi, StyledPlaylist, StyledTimeScale, type TimeFormat, TimeFormatSelect, type TimeFormatSelectProps, TimeInput, type TimeInputProps, TimeScale, type TimeScaleProps, TimescaleLoopRegion, type TimescaleLoopRegionProps, Track, TrackControlsContext, TrackMenu, type TrackMenuItem, type TrackMenuProps, type TrackProps, TrashIcon, VolumeDownIcon, VolumeUpIcon, type WaveformColor, type WaveformDrawMode, type WaveformGradient, type WaveformPlaylistTheme, darkTheme, defaultTheme, formatTime, isWaveformGradient, parseTime, pixelsToSamples, pixelsToSeconds, samplesToPixels, samplesToSeconds, secondsToPixels, secondsToSamples, useClipViewportOrigin, useDevicePixelRatio, usePlaylistInfo, usePlayoutStatus, usePlayoutStatusUpdate, useScrollViewport, useScrollViewportSelector, useTheme, useTrackControls, useVisibleChunkIndices, waveformColorToCss };
853
+ export { AudioPosition, type AudioPositionProps, AutomaticScrollCheckbox, type AutomaticScrollCheckboxProps, BaseButton, BaseCheckbox, BaseCheckboxLabel, BaseCheckboxWrapper, BaseControlButton, BaseInput, BaseLabel, BaseSelect, BaseSlider, Button, ButtonGroup, CLIP_BOUNDARY_WIDTH, CLIP_BOUNDARY_WIDTH_TOUCH, CLIP_HEADER_HEIGHT, Channel, type ChannelProps, Clip, ClipBoundary, type ClipBoundaryProps, ClipHeader, ClipHeaderPresentational, type ClipHeaderPresentationalProps, type ClipHeaderProps, type ClipProps, ClipViewportOriginProvider, CloseButton, Controls$1 as Controls, type ControlsWrapperProps, DevicePixelRatioProvider, DotsIcon, type DragHandleProps, FadeOverlay, type FadeOverlayProps, type GradientStop, Header, InlineLabel, LoopRegion, LoopRegionMarkers, type LoopRegionMarkersProps, type LoopRegionProps, MasterVolumeControl, type MasterVolumeControlProps, Playhead, type PlayheadProps, PlayheadWithMarker, Playlist, PlaylistErrorBoundary, type PlaylistErrorBoundaryProps, PlaylistInfoContext, type PlaylistProps, PlayoutProvider, type RenderPlayheadFunction, ScreenReaderOnly, type ScrollViewport, ScrollViewportProvider, Selection, type SelectionProps, SelectionTimeInputs, type SelectionTimeInputsProps, Slider, SliderWrapper, SmartChannel, type SmartChannelProps, SmartScale, type SmartScaleProps, SpectrogramChannel, type SpectrogramChannelProps, SpectrogramLabels, type SpectrogramLabelsProps, type SpectrogramWorkerCanvasApi, StyledPlaylist, StyledTimeScale, type TimeFormat, TimeFormatSelect, type TimeFormatSelectProps, TimeInput, type TimeInputProps, TimeScale, type TimeScaleProps, TimescaleLoopRegion, type TimescaleLoopRegionProps, Track, TrackControlsContext, TrackMenu, type TrackMenuItem, type TrackMenuProps, type TrackProps, TrashIcon, VolumeDownIcon, VolumeUpIcon, type WaveformColor, type WaveformDrawMode, type WaveformGradient, type WaveformPlaylistTheme, darkTheme, defaultTheme, formatTime, isWaveformGradient, parseTime, pixelsToSamples, pixelsToSeconds, samplesToPixels, samplesToSeconds, secondsToPixels, secondsToSamples, useClipViewportOrigin, useDevicePixelRatio, usePlaylistInfo, usePlayoutStatus, usePlayoutStatusUpdate, useScrollViewport, useScrollViewportSelector, useTheme, useTrackControls, useVisibleChunkIndices, waveformColorToCss };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { FunctionComponent, ReactNode, Dispatch, SetStateAction } from 'react';
3
3
  import { Peaks, Bits, Fade, FadeType, SpectrogramData, RenderMode } from '@waveform-playlist/core';
4
- import { DraggableAttributes } from '@dnd-kit/core';
5
- import { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities';
6
4
  import * as styled_components_dist_utils_hoist from 'styled-components/dist/utils/hoist';
7
5
  import * as styled_components from 'styled-components';
8
6
  import { DefaultTheme } from 'styled-components';
@@ -144,8 +142,8 @@ interface ChannelProps {
144
142
  transparentBackground?: boolean;
145
143
  /**
146
144
  * Drawing mode:
147
- * - 'inverted': Draw waveOutlineColor where there's NO audio (current default). Good for gradient bars.
148
- * - 'normal': Draw waveFillColor where there IS audio. Good for gradient backgrounds.
145
+ * - 'inverted': Canvas draws waveOutlineColor where there's NO audio, revealing waveFillColor background as bars (default). Good for gradient bars.
146
+ * - 'normal': Canvas draws waveFillColor where there IS audio. Use with transparentBackground for progress overlays.
149
147
  */
150
148
  drawMode?: WaveformDrawMode;
151
149
  }
@@ -208,23 +206,51 @@ interface ClipProps {
208
206
  /**
209
207
  * Clip component for rendering individual audio clips within a track
210
208
  *
211
- * Each clip is positioned based on its startTime and has a width based on its duration.
209
+ * Each clip is positioned based on its startSample and has a width based on its durationSamples.
212
210
  * This allows multiple clips to be arranged on a single track with gaps or overlaps.
213
211
  *
214
212
  * Includes a draggable ClipHeader at the top for repositioning clips on the timeline.
215
213
  */
216
214
  declare const Clip: FunctionComponent<ClipProps>;
217
215
 
216
+ declare const CLIP_BOUNDARY_WIDTH = 8;
217
+ declare const CLIP_BOUNDARY_WIDTH_TOUCH = 24;
218
+ type BoundaryEdge = 'left' | 'right';
219
+ interface BoundaryDragHandleProps {
220
+ ref: (element: Element | null) => void;
221
+ isDragging?: boolean;
222
+ }
223
+ interface ClipBoundaryProps {
224
+ clipId: string;
225
+ trackIndex: number;
226
+ clipIndex: number;
227
+ edge: BoundaryEdge;
228
+ dragHandleProps?: BoundaryDragHandleProps;
229
+ /**
230
+ * Enable larger touch targets for mobile devices.
231
+ * When true, boundary width increases from 8px to 24px for easier touch targeting.
232
+ */
233
+ touchOptimized?: boolean;
234
+ }
235
+ /**
236
+ * ClipBoundary component - Draggable edge for trimming clips
237
+ *
238
+ * Renders at the left or right edge of a clip.
239
+ * Drag to trim the clip (adjust offset and duration).
240
+ * Supports bidirectional trimming (trim in and out).
241
+ *
242
+ * On mobile (touchOptimized=true), boundaries are wider for easier targeting.
243
+ */
244
+ declare const ClipBoundary: FunctionComponent<ClipBoundaryProps>;
245
+
218
246
  declare const CLIP_HEADER_HEIGHT = 22;
219
247
  interface ClipHeaderPresentationalProps {
220
248
  trackName: string;
221
249
  isSelected?: boolean;
222
250
  }
223
251
  declare const ClipHeaderPresentational: FunctionComponent<ClipHeaderPresentationalProps>;
224
- interface DragHandleProps$1 {
225
- attributes: DraggableAttributes;
226
- listeners: SyntheticListenerMap | undefined;
227
- setActivatorNodeRef: (element: HTMLElement | null) => void;
252
+ interface DragHandleProps {
253
+ handleRef: (element: Element | null) => void;
228
254
  }
229
255
  interface ClipHeaderProps {
230
256
  clipId: string;
@@ -233,7 +259,7 @@ interface ClipHeaderProps {
233
259
  trackName: string;
234
260
  isSelected?: boolean;
235
261
  disableDrag?: boolean;
236
- dragHandleProps?: DragHandleProps$1;
262
+ dragHandleProps?: DragHandleProps;
237
263
  }
238
264
  /**
239
265
  * ClipHeader component - Draggable title bar for audio clips
@@ -249,35 +275,6 @@ interface ClipHeaderProps {
249
275
  */
250
276
  declare const ClipHeader: FunctionComponent<ClipHeaderProps>;
251
277
 
252
- declare const CLIP_BOUNDARY_WIDTH = 8;
253
- declare const CLIP_BOUNDARY_WIDTH_TOUCH = 24;
254
- type BoundaryEdge = 'left' | 'right';
255
- interface DragHandleProps extends DragHandleProps$1 {
256
- isDragging?: boolean;
257
- }
258
- interface ClipBoundaryProps {
259
- clipId: string;
260
- trackIndex: number;
261
- clipIndex: number;
262
- edge: BoundaryEdge;
263
- dragHandleProps?: DragHandleProps;
264
- /**
265
- * Enable larger touch targets for mobile devices.
266
- * When true, boundary width increases from 8px to 24px for easier touch targeting.
267
- */
268
- touchOptimized?: boolean;
269
- }
270
- /**
271
- * ClipBoundary component - Draggable edge for trimming clips
272
- *
273
- * Renders at the left or right edge of a clip.
274
- * Drag to trim the clip (adjust offset and duration).
275
- * Supports bidirectional trimming (trim in and out).
276
- *
277
- * On mobile (touchOptimized=true), boundaries are wider for easier targeting.
278
- */
279
- declare const ClipBoundary: FunctionComponent<ClipBoundaryProps>;
280
-
281
278
  interface FadeOverlayProps {
282
279
  /** Position in pixels from the start of the clip */
283
280
  left: number;
@@ -853,4 +850,4 @@ declare const BaseSlider: styled_components_dist_types.IStyledComponentBase<"web
853
850
  ref?: ((instance: HTMLInputElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLInputElement> | null | undefined;
854
851
  }>, never>, never>> & string;
855
852
 
856
- export { AudioPosition, type AudioPositionProps, AutomaticScrollCheckbox, type AutomaticScrollCheckboxProps, BaseButton, BaseCheckbox, BaseCheckboxLabel, BaseCheckboxWrapper, BaseControlButton, BaseInput, BaseLabel, BaseSelect, BaseSlider, Button, ButtonGroup, CLIP_BOUNDARY_WIDTH, CLIP_BOUNDARY_WIDTH_TOUCH, CLIP_HEADER_HEIGHT, Channel, type ChannelProps, Clip, ClipBoundary, type ClipBoundaryProps, ClipHeader, ClipHeaderPresentational, type ClipHeaderPresentationalProps, type ClipHeaderProps, type ClipProps, ClipViewportOriginProvider, CloseButton, Controls$1 as Controls, type ControlsWrapperProps, DevicePixelRatioProvider, DotsIcon, type DragHandleProps$1 as DragHandleProps, FadeOverlay, type FadeOverlayProps, type GradientStop, Header, InlineLabel, LoopRegion, LoopRegionMarkers, type LoopRegionMarkersProps, type LoopRegionProps, MasterVolumeControl, type MasterVolumeControlProps, Playhead, type PlayheadProps, PlayheadWithMarker, Playlist, PlaylistErrorBoundary, type PlaylistErrorBoundaryProps, PlaylistInfoContext, type PlaylistProps, PlayoutProvider, type RenderPlayheadFunction, ScreenReaderOnly, type ScrollViewport, ScrollViewportProvider, Selection, type SelectionProps, SelectionTimeInputs, type SelectionTimeInputsProps, Slider, SliderWrapper, SmartChannel, type SmartChannelProps, SmartScale, type SmartScaleProps, SpectrogramChannel, type SpectrogramChannelProps, SpectrogramLabels, type SpectrogramLabelsProps, type SpectrogramWorkerCanvasApi, StyledPlaylist, StyledTimeScale, type TimeFormat, TimeFormatSelect, type TimeFormatSelectProps, TimeInput, type TimeInputProps, TimeScale, type TimeScaleProps, TimescaleLoopRegion, type TimescaleLoopRegionProps, Track, TrackControlsContext, TrackMenu, type TrackMenuItem, type TrackMenuProps, type TrackProps, TrashIcon, VolumeDownIcon, VolumeUpIcon, type WaveformColor, type WaveformDrawMode, type WaveformGradient, type WaveformPlaylistTheme, darkTheme, defaultTheme, formatTime, isWaveformGradient, parseTime, pixelsToSamples, pixelsToSeconds, samplesToPixels, samplesToSeconds, secondsToPixels, secondsToSamples, useClipViewportOrigin, useDevicePixelRatio, usePlaylistInfo, usePlayoutStatus, usePlayoutStatusUpdate, useScrollViewport, useScrollViewportSelector, useTheme, useTrackControls, useVisibleChunkIndices, waveformColorToCss };
853
+ export { AudioPosition, type AudioPositionProps, AutomaticScrollCheckbox, type AutomaticScrollCheckboxProps, BaseButton, BaseCheckbox, BaseCheckboxLabel, BaseCheckboxWrapper, BaseControlButton, BaseInput, BaseLabel, BaseSelect, BaseSlider, Button, ButtonGroup, CLIP_BOUNDARY_WIDTH, CLIP_BOUNDARY_WIDTH_TOUCH, CLIP_HEADER_HEIGHT, Channel, type ChannelProps, Clip, ClipBoundary, type ClipBoundaryProps, ClipHeader, ClipHeaderPresentational, type ClipHeaderPresentationalProps, type ClipHeaderProps, type ClipProps, ClipViewportOriginProvider, CloseButton, Controls$1 as Controls, type ControlsWrapperProps, DevicePixelRatioProvider, DotsIcon, type DragHandleProps, FadeOverlay, type FadeOverlayProps, type GradientStop, Header, InlineLabel, LoopRegion, LoopRegionMarkers, type LoopRegionMarkersProps, type LoopRegionProps, MasterVolumeControl, type MasterVolumeControlProps, Playhead, type PlayheadProps, PlayheadWithMarker, Playlist, PlaylistErrorBoundary, type PlaylistErrorBoundaryProps, PlaylistInfoContext, type PlaylistProps, PlayoutProvider, type RenderPlayheadFunction, ScreenReaderOnly, type ScrollViewport, ScrollViewportProvider, Selection, type SelectionProps, SelectionTimeInputs, type SelectionTimeInputsProps, Slider, SliderWrapper, SmartChannel, type SmartChannelProps, SmartScale, type SmartScaleProps, SpectrogramChannel, type SpectrogramChannelProps, SpectrogramLabels, type SpectrogramLabelsProps, type SpectrogramWorkerCanvasApi, StyledPlaylist, StyledTimeScale, type TimeFormat, TimeFormatSelect, type TimeFormatSelectProps, TimeInput, type TimeInputProps, TimeScale, type TimeScaleProps, TimescaleLoopRegion, type TimescaleLoopRegionProps, Track, TrackControlsContext, TrackMenu, type TrackMenuItem, type TrackMenuProps, type TrackProps, TrashIcon, VolumeDownIcon, VolumeUpIcon, type WaveformColor, type WaveformDrawMode, type WaveformGradient, type WaveformPlaylistTheme, darkTheme, defaultTheme, formatTime, isWaveformGradient, parseTime, pixelsToSamples, pixelsToSeconds, samplesToPixels, samplesToSeconds, secondsToPixels, secondsToSamples, useClipViewportOrigin, useDevicePixelRatio, usePlaylistInfo, usePlayoutStatus, usePlayoutStatusUpdate, useScrollViewport, useScrollViewportSelector, useTheme, useTrackControls, useVisibleChunkIndices, waveformColorToCss };