@waveform-playlist/ui-components 7.1.1 → 7.1.3

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
@@ -669,13 +669,6 @@ interface TrackMenuProps {
669
669
  }
670
670
  declare const TrackMenu: react__default.FC<TrackMenuProps>;
671
671
 
672
- /**
673
- * Maximum width in CSS pixels for a single canvas chunk.
674
- * Canvas elements are split into chunks of this width to enable
675
- * horizontal virtual scrolling — only visible chunks are mounted.
676
- */
677
- declare const MAX_CANVAS_WIDTH = 1000;
678
-
679
672
  type Props$1 = {
680
673
  children: ReactNode;
681
674
  };
@@ -738,7 +731,7 @@ type ScrollViewportProviderProps = {
738
731
  containerRef: react__default.RefObject<HTMLElement | null>;
739
732
  children: ReactNode;
740
733
  };
741
- declare const ScrollViewportProvider: ({ containerRef, children, }: ScrollViewportProviderProps) => react_jsx_runtime.JSX.Element;
734
+ declare const ScrollViewportProvider: ({ containerRef, children }: ScrollViewportProviderProps) => react_jsx_runtime.JSX.Element;
742
735
  /**
743
736
  * Full viewport hook — re-renders on every viewport update (after threshold).
744
737
  * Use useScrollViewportSelector() instead when you only need derived state.
@@ -753,6 +746,37 @@ declare const useScrollViewport: () => ScrollViewport | null;
753
746
  * the set of visible chunks actually changes, not on every scroll update.
754
747
  */
755
748
  declare function useScrollViewportSelector<T>(selector: (viewport: ScrollViewport | null) => T): T;
749
+ /**
750
+ * Returns the indices of canvas chunks that are currently visible (plus overscan buffer).
751
+ * Only triggers a re-render when the set of visible chunks changes, not on every scroll pixel.
752
+ *
753
+ * @param totalWidth Total width in CSS pixels of the content being chunked.
754
+ * @param chunkWidth Width of each chunk in CSS pixels (typically MAX_CANVAS_WIDTH, 1000).
755
+ * @param originX Pixel offset of this content's origin within the global scroll container.
756
+ * Clips not starting at position 0 must provide their left offset so chunk visibility
757
+ * is computed in global viewport coordinates. Defaults to 0 (e.g., TimeScale).
758
+ */
759
+ declare function useVisibleChunkIndices(totalWidth: number, chunkWidth: number, originX?: number): number[];
760
+
761
+ interface ClipViewportOriginProviderProps {
762
+ originX: number;
763
+ children: ReactNode;
764
+ }
765
+ /**
766
+ * Provides the clip's pixel-space origin (left offset) to descendant Channel
767
+ * and SpectrogramChannel components so they can convert local chunk coordinates
768
+ * to global viewport coordinates for virtual scrolling visibility checks.
769
+ *
770
+ * Without this, chunks are compared against the viewport in local (clip-relative)
771
+ * space, which causes them to be culled incorrectly when a clip doesn't start
772
+ * at position 0 on the timeline.
773
+ */
774
+ declare const ClipViewportOriginProvider: ({ originX, children, }: ClipViewportOriginProviderProps) => react_jsx_runtime.JSX.Element;
775
+ /**
776
+ * Returns the clip's pixel-space left offset within the timeline.
777
+ * Defaults to 0 when used outside a ClipViewportOriginProvider (e.g., TimeScale).
778
+ */
779
+ declare const useClipViewportOrigin: () => number;
756
780
 
757
781
  declare function samplesToSeconds(samples: number, sampleRate: number): number;
758
782
  declare function secondsToSamples(seconds: number, sampleRate: number): number;
@@ -827,4 +851,4 @@ declare const BaseSlider: styled_components_dist_types.IStyledComponentBase<"web
827
851
  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;
828
852
  }>, never>, never>> & string;
829
853
 
830
- 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, 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, MAX_CANVAS_WIDTH, 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, useDevicePixelRatio, usePlaylistInfo, usePlayoutStatus, usePlayoutStatusUpdate, useScrollViewport, useScrollViewportSelector, useTheme, useTrackControls, waveformColorToCss };
854
+ 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 };
package/dist/index.d.ts CHANGED
@@ -669,13 +669,6 @@ interface TrackMenuProps {
669
669
  }
670
670
  declare const TrackMenu: react__default.FC<TrackMenuProps>;
671
671
 
672
- /**
673
- * Maximum width in CSS pixels for a single canvas chunk.
674
- * Canvas elements are split into chunks of this width to enable
675
- * horizontal virtual scrolling — only visible chunks are mounted.
676
- */
677
- declare const MAX_CANVAS_WIDTH = 1000;
678
-
679
672
  type Props$1 = {
680
673
  children: ReactNode;
681
674
  };
@@ -738,7 +731,7 @@ type ScrollViewportProviderProps = {
738
731
  containerRef: react__default.RefObject<HTMLElement | null>;
739
732
  children: ReactNode;
740
733
  };
741
- declare const ScrollViewportProvider: ({ containerRef, children, }: ScrollViewportProviderProps) => react_jsx_runtime.JSX.Element;
734
+ declare const ScrollViewportProvider: ({ containerRef, children }: ScrollViewportProviderProps) => react_jsx_runtime.JSX.Element;
742
735
  /**
743
736
  * Full viewport hook — re-renders on every viewport update (after threshold).
744
737
  * Use useScrollViewportSelector() instead when you only need derived state.
@@ -753,6 +746,37 @@ declare const useScrollViewport: () => ScrollViewport | null;
753
746
  * the set of visible chunks actually changes, not on every scroll update.
754
747
  */
755
748
  declare function useScrollViewportSelector<T>(selector: (viewport: ScrollViewport | null) => T): T;
749
+ /**
750
+ * Returns the indices of canvas chunks that are currently visible (plus overscan buffer).
751
+ * Only triggers a re-render when the set of visible chunks changes, not on every scroll pixel.
752
+ *
753
+ * @param totalWidth Total width in CSS pixels of the content being chunked.
754
+ * @param chunkWidth Width of each chunk in CSS pixels (typically MAX_CANVAS_WIDTH, 1000).
755
+ * @param originX Pixel offset of this content's origin within the global scroll container.
756
+ * Clips not starting at position 0 must provide their left offset so chunk visibility
757
+ * is computed in global viewport coordinates. Defaults to 0 (e.g., TimeScale).
758
+ */
759
+ declare function useVisibleChunkIndices(totalWidth: number, chunkWidth: number, originX?: number): number[];
760
+
761
+ interface ClipViewportOriginProviderProps {
762
+ originX: number;
763
+ children: ReactNode;
764
+ }
765
+ /**
766
+ * Provides the clip's pixel-space origin (left offset) to descendant Channel
767
+ * and SpectrogramChannel components so they can convert local chunk coordinates
768
+ * to global viewport coordinates for virtual scrolling visibility checks.
769
+ *
770
+ * Without this, chunks are compared against the viewport in local (clip-relative)
771
+ * space, which causes them to be culled incorrectly when a clip doesn't start
772
+ * at position 0 on the timeline.
773
+ */
774
+ declare const ClipViewportOriginProvider: ({ originX, children, }: ClipViewportOriginProviderProps) => react_jsx_runtime.JSX.Element;
775
+ /**
776
+ * Returns the clip's pixel-space left offset within the timeline.
777
+ * Defaults to 0 when used outside a ClipViewportOriginProvider (e.g., TimeScale).
778
+ */
779
+ declare const useClipViewportOrigin: () => number;
756
780
 
757
781
  declare function samplesToSeconds(samples: number, sampleRate: number): number;
758
782
  declare function secondsToSamples(seconds: number, sampleRate: number): number;
@@ -827,4 +851,4 @@ declare const BaseSlider: styled_components_dist_types.IStyledComponentBase<"web
827
851
  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;
828
852
  }>, never>, never>> & string;
829
853
 
830
- 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, 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, MAX_CANVAS_WIDTH, 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, useDevicePixelRatio, usePlaylistInfo, usePlayoutStatus, usePlayoutStatusUpdate, useScrollViewport, useScrollViewportSelector, useTheme, useTrackControls, waveformColorToCss };
854
+ 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 };