import { TimelineTimeValueFormatOptions } from "../../accessibility.mjs"; import { RangeScrollbarRootProps, RangeScrollbarValue, RangeScrollbarValueChangeDetails, UseRangeScrollbarResult } from "../../rangeScrollbar/RangeScrollbar.mjs"; import "../../rangeScrollbar/index.mjs"; //#region src/hooks/viewport/useTimelineViewportRangeControl.d.ts /** * Options for adapting a generic range scrollbar to the timeline viewport. */ interface TimelineViewportRangeControlOptions extends TimelineTimeValueFormatOptions { /** Smallest allowed visible timeline duration in seconds. Defaults to 0.1. */ minSpan?: number; } /** * Controlled props required by `RangeScrollbar.Root` for a timeline viewport. */ type TimelineViewportRangeControlRootProps = Pick & Required>; /** * State and control props for rendering a timeline viewport scrollbar. */ interface UseTimelineViewportRangeControlResult { /** Formatted visible range and duration. */ valueText: string; /** Formatted visible start time. */ startValueText: string; /** Formatted visible end time. */ endValueText: string; /** Generic range scrollbar state derived from timeline viewport state. */ range: UseRangeScrollbarResult; /** Props that wire `RangeScrollbar.Root` to timeline scroll and zoom state. */ rootProps: TimelineViewportRangeControlRootProps; /** Full timeline duration represented by the scrollbar domain, in seconds. */ totalDurationSeconds: number; /** Visible viewport start time in seconds. */ viewStartSeconds: number; /** Visible viewport end time in seconds. */ viewEndSeconds: number; /** Visible viewport duration in seconds. */ viewDurationSeconds: number; /** Measured timeline viewport width in pixels. */ viewportWidth: number; /** Current timeline zoom scale in pixels per second. */ zoomScale: number; /** Current horizontal timeline scroll offset in pixels. */ scrollLeft: number; /** Handles controlled range changes by panning or zooming the timeline engine. */ onValueChange: (value: RangeScrollbarValue, details: RangeScrollbarValueChangeDetails) => void; } /** * Adapts generic range scrollbar state to the current timeline viewport. * * The hook derives a controlled `{ start, end }` value from timeline * `scrollLeft`, `zoomScale`, `viewportWidth`, and content duration. Thumb * changes pan the engine, while handle changes update zoom and then restore the * requested range start. * * @param options - Timeline viewport range options. * @returns Timeline viewport metrics plus `RangeScrollbar.Root` control props. * * @example * ```tsx * const viewportScrollbar = useTimelineViewportRangeControl(); * * return ( * * * * * * * ); * ``` */ declare function useTimelineViewportRangeControl(options?: TimelineViewportRangeControlOptions): UseTimelineViewportRangeControlResult; //#endregion export { TimelineViewportRangeControlOptions, TimelineViewportRangeControlRootProps, UseTimelineViewportRangeControlResult, useTimelineViewportRangeControl }; //# sourceMappingURL=useTimelineViewportRangeControl.d.mts.map