@bazza-ui/react 0.1.0-canary.4 → 0.1.0-canary.6
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/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +2 -1
- package/dist/adapters/index.d.ts +2 -1
- package/dist/chunk-BGJJC6GX.cjs.map +1 -1
- package/dist/chunk-FWWOE2SW.cjs.map +1 -1
- package/dist/chunk-JSPKF52O.cjs.map +1 -1
- package/dist/chunk-M4G6J7DP.cjs.map +1 -1
- package/dist/combobox/index.cjs.map +1 -1
- package/dist/combobox/index.d.cts +4 -3
- package/dist/combobox/index.d.ts +4 -3
- package/dist/context-menu/index.cjs.map +1 -1
- package/dist/context-menu/index.d.cts +9 -8
- package/dist/context-menu/index.d.ts +9 -8
- package/dist/{data-surface-B-eIGTBi.d.cts → data-surface-CvJ9KHPs.d.cts} +3 -2
- package/dist/{data-surface-D1OilMDu.d.ts → data-surface-wC_Jb6Rh.d.ts} +3 -2
- package/dist/dropdown-menu/index.cjs.map +1 -1
- package/dist/dropdown-menu/index.d.cts +11 -10
- package/dist/dropdown-menu/index.d.ts +11 -10
- package/dist/{input-DF7D8YzW.d.ts → input-CVeZtOCC.d.ts} +1 -1
- package/dist/{input-BoIK003I.d.cts → input-K7sWcc-E.d.cts} +1 -1
- package/dist/internal/listbox/index.cjs.map +1 -1
- package/dist/internal/popup-menu/index.cjs.map +1 -1
- package/dist/internal/popup-menu/index.d.cts +9 -8
- package/dist/internal/popup-menu/index.d.ts +9 -8
- package/dist/{loading-TsgH6v92.d.ts → loading-Bb7G_pQp.d.ts} +1 -1
- package/dist/{loading-DphSt8MY.d.cts → loading-CbSVZlwi.d.cts} +1 -1
- package/dist/select/index.cjs.map +1 -1
- package/dist/select/index.d.cts +6 -5
- package/dist/select/index.d.ts +6 -5
- package/dist/{separator-BmbUeeaT.d.cts → separator-BzYYn73e.d.cts} +2 -1
- package/dist/{separator-B4Ot84B0.d.ts → separator-C9c1Jo6A.d.ts} +2 -1
- package/dist/{types-9vS1uLIK.d.cts → types-Cggz7pEl.d.cts} +2 -35
- package/dist/types-DT4FOOa2.d.cts +51 -0
- package/dist/types-DT4FOOa2.d.ts +51 -0
- package/dist/{types-lQCIvWW8.d.ts → types-M2vBIhdB.d.ts} +2 -35
- package/dist/video-player/index.cjs +2 -2
- package/dist/video-player/index.cjs.map +1 -1
- package/dist/video-player/index.d.cts +25 -18
- package/dist/video-player/index.d.ts +25 -18
- package/dist/video-player/index.js +2 -2
- package/dist/video-player/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/video-player/index.cjs","../../src/video-player/contexts/video-player-context.ts","../../src/video-player/hooks/use-video-player.ts","../../src/video-player/index.parts.ts","../../src/video-player/components/buffered-indicator/buffered-indicator.tsx","../../src/video-player/hooks/use-transition-status.ts"],"names":["VideoPlayerContext","useVideoPlayerContext","component","context","useVideoPlayer","index_parts_exports","__export","BufferedIndicator","Captions","CaptionsButton","CaptionsDataAttributes","CaptionsMenu","CaptionsMenuItem","Controls","ControlsDataAttributes","FullscreenButton","MuteButton","Overlay","OverlayDataAttributes","PictureInPictureButton","PlayButton","PlaybackRateButton","PlaybackRateMenu","PlaybackRateMenuItem","Portal","Poster","QualityMenu","QualityMenuItem","VideoPlayerRoot","RootDataAttributes","SeekSlider","SeekSliderBuffered","SeekSliderControl","SeekSliderCssVars","SeekSliderDataAttributes","SeekSliderHover","SeekSliderPreviewThumb","SeekSliderPreviewThumbDataAttributes","SeekSliderPreviewTooltip","SeekSliderPreviewTooltipPopup","SeekSliderPreviewTooltipPortal","SeekSliderPreviewTooltipPositioner","SeekSliderProgress","SeekSliderThumb","SeekSliderTrack","Thumbnail","ThumbnailDataAttributes","TimeDisplay","TimeDisplayDataAttributes","Track","Video","VolumeSlider","VolumeSliderControl","VolumeSliderCssVars","VolumeSliderDataAttributes","VolumeSliderRange","VolumeSliderThumb","VolumeSliderTrack","useTransitionStatus","props","forwardedRef","render","divProps","bufferedEnd","i","bufferedPercentage","state","style"],"mappings":"AAAA,4/BAA0C,gjCCEnB,IAGVA,EAAAA,CACL,EAAA,CAAA,aAAA,CAA8C,IAAI,CAAA,CAEnD,SAASC,CAAAA,CACdC,CAAAA,CACyB,CACzB,IAAMC,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWH,EAAkB,CAAA,CACnD,EAAA,CAAI,CAACG,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,CAAA,aAAA,EAAgBD,CAAS,CAAA,wCAAA,CAC3B,CAAA,CAEF,OAAOC,CACT,CCIO,SAASC,EAAAA,CAAAA,CAA0C,CACxD,OAAOH,CAAAA,CAAsB,gBAAgB,CAC/C,CCxBA,IAAAI,EAAAA,CAAA,CAAA,CAAA,CAAAC,iCAAAA,EAAAD,CAAA,CAAA,iBAAA,CAAA,CAAA,CAAA,EAAAE,EAAAA,CAAA,QAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,cAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,sBAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,YAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,gBAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,QAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,sBAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,gBAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,UAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,OAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,qBAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,sBAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,UAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,kBAAA,CAAA,CAAA,CA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GAAA,CAAI6D,CAAC,CAAA,CAE7C,OAAO7D,CAAAA,CAAQ,QAAA,CAAS,GAAA,CAAI6D,CAAC,CAAA,CAKjC,OAAO7D,CAAAA,CAAQ,QAAA,CAAS,GAAA,CAAI,CAAC,CAC/B,CAAA,CAAG,CAACA,CAAAA,CAAQ,QAAA,CAAUA,CAAAA,CAAQ,WAAW,CAAC,CAAA,CAEpC8D,CAAAA,CACJ9D,CAAAA,CAAQ,QAAA,CAAW,CAAA,CAAK4D,CAAAA,CAAc5D,CAAAA,CAAQ,QAAA,CAAY,GAAA,CAAM,CAAA,CAE5D+D,CAAAA,CAAgC,CACpC,QAAA,CAAU/D,CAAAA,CAAQ,QAAA,CAClB,QAAA,CAAUA,CAAAA,CAAQ,QAAA,CAClB,kBAAA,CAAA8D,CAAAA,CACA,WAAA,CAAAF,CACF,CAAA,CAGMI,CAAAA,CAAQ,CACZ,uBAAA,CAAyB,CAAA,EAAA;ACbH","file":"/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/video-player/index.cjs","sourcesContent":[null,"'use client'\n\nimport * as React from 'react'\nimport type { VideoPlayerContextValue } from '../types.js'\n\nexport const VideoPlayerContext =\n React.createContext<VideoPlayerContextValue | null>(null)\n\nexport function useVideoPlayerContext(\n component: string,\n): VideoPlayerContextValue {\n const context = React.useContext(VideoPlayerContext)\n if (!context) {\n throw new Error(\n `<VideoPlayer.${component}> must be used within <VideoPlayer.Root>`,\n )\n }\n return context\n}\n","'use client'\n\nimport { useVideoPlayerContext } from '../contexts/video-player-context.js'\nimport type { VideoPlayerContextValue } from '../types.js'\n\n/**\n * Hook to access the VideoPlayer context from custom components.\n *\n * @example\n * ```tsx\n * function CustomControl() {\n * const { playing, toggle, currentTime, duration } = useVideoPlayer()\n *\n * return (\n * <div>\n * {playing ? 'Playing' : 'Paused'} - {currentTime}s / {duration}s\n * <button onClick={toggle}>Toggle</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useVideoPlayer(): VideoPlayerContextValue {\n return useVideoPlayerContext('useVideoPlayer')\n}\n","// ============================================================================\n// VideoPlayer Composable Parts\n// ============================================================================\n//\n// Import like: import * as VideoPlayer from './video-player/index.parts.js'\n//\n// Usage:\n// <VideoPlayer.Root>\n// <VideoPlayer.Video src=\"...\" />\n// <VideoPlayer.Controls>\n// <VideoPlayer.PlayButton />\n// <VideoPlayer.SeekSlider />\n// <VideoPlayer.TimeDisplay />\n// </VideoPlayer.Controls>\n// </VideoPlayer.Root>\n//\n\nexport { BufferedIndicator } from './components/buffered-indicator/buffered-indicator.js'\nexport { CaptionsDataAttributes } from './components/captions/captions.data-attributes.js'\nexport { Captions } from './components/captions/captions.js'\n// Captions\nexport { CaptionsButton } from './components/captions-button/captions-button.js'\nexport {\n CaptionsMenu,\n CaptionsMenuItem,\n} from './components/captions-menu/captions-menu.js'\nexport { ControlsDataAttributes } from './components/controls/controls.data-attributes.js'\nexport { Controls } from './components/controls/controls.js'\n// Display Controls\nexport { FullscreenButton } from './components/fullscreen-button/fullscreen-button.js'\nexport { MuteButton } from './components/mute-button/mute-button.js'\nexport { OverlayDataAttributes } from './components/overlay/overlay.data-attributes.js'\nexport { Overlay } from './components/overlay/overlay.js'\nexport { PictureInPictureButton } from './components/picture-in-picture-button/picture-in-picture-button.js'\n// Playback Controls\nexport { PlayButton } from './components/play-button/play-button.js'\n// Playback Rate\nexport { PlaybackRateButton } from './components/playback-rate-button/playback-rate-button.js'\nexport {\n PlaybackRateMenu,\n PlaybackRateMenuItem,\n} from './components/playback-rate-menu/playback-rate-menu.js'\n// Layout\nexport { Portal } from './components/portal/portal.js'\nexport { Poster } from './components/poster/poster.js'\n// Quality\nexport {\n QualityMenu,\n QualityMenuItem,\n} from './components/quality-menu/quality-menu.js'\n// Data Attributes & CSS Variables\nexport { RootDataAttributes } from './components/root/root.data-attributes.js'\n// Core\nexport { VideoPlayerRoot as Root } from './components/root/root.js'\nexport { SeekSliderCssVars } from './components/seek-slider/seek-slider.css-vars.js'\nexport { SeekSliderDataAttributes } from './components/seek-slider/seek-slider.data-attributes.js'\nexport {\n SeekSlider,\n SeekSliderBuffered,\n SeekSliderControl,\n SeekSliderHover,\n SeekSliderPreviewThumb,\n SeekSliderPreviewTooltip,\n SeekSliderPreviewTooltipPopup,\n SeekSliderPreviewTooltipPortal,\n SeekSliderPreviewTooltipPositioner,\n SeekSliderProgress,\n SeekSliderThumb,\n SeekSliderTrack,\n} from './components/seek-slider/seek-slider.js'\nexport { SeekSliderPreviewThumbDataAttributes } from './components/seek-slider/seek-slider-preview-thumb.data-attributes.js'\nexport { ThumbnailDataAttributes } from './components/thumbnail/thumbnail.data-attributes.js'\nexport { Thumbnail } from './components/thumbnail/thumbnail.js'\nexport { TimeDisplayDataAttributes } from './components/time-display/time-display.data-attributes.js'\nexport { TimeDisplay } from './components/time-display/time-display.js'\nexport { Track } from './components/track/track.js'\nexport { Video } from './components/video/video.js'\nexport { VolumeSliderCssVars } from './components/volume-slider/volume-slider.css-vars.js'\nexport { VolumeSliderDataAttributes } from './components/volume-slider/volume-slider.data-attributes.js'\n// Audio Controls\nexport {\n VolumeSlider,\n VolumeSliderControl,\n VolumeSliderRange,\n VolumeSliderThumb,\n VolumeSliderTrack,\n} from './components/volume-slider/volume-slider.js'\nexport {\n type TransitionStatus,\n type UseTransitionStatusOptions,\n type UseTransitionStatusReturn,\n useTransitionStatus,\n} from './hooks/use-transition-status.js'\n// Hooks\nexport { useVideoPlayer } from './hooks/use-video-player.js'\n// Types\nexport type {\n PlaybackIntent,\n PlaybackStatus,\n RenderProp,\n TrackInfo,\n VideoPlayerActions,\n VideoPlayerContextValue,\n VideoPlayerRootProps,\n VideoPlayerState,\n VideoQuality,\n VideoTextTrack,\n} from './types.js'\n","'use client'\n\nimport * as React from 'react'\nimport { useVideoPlayerContext } from '../../contexts/video-player-context.js'\nimport type { RenderProp } from '../../types.js'\n\n// ============================================================================\n// BufferedIndicator Props\n// ============================================================================\n\nexport interface BufferedIndicatorProps\n extends React.ComponentPropsWithRef<'div'> {\n render?: RenderProp<BufferedIndicatorRenderProps, BufferedIndicatorState>\n}\n\nexport interface BufferedIndicatorRenderProps {\n ref: React.Ref<HTMLElement>\n style: React.CSSProperties\n 'aria-hidden': true\n}\n\nexport interface BufferedIndicatorState {\n buffered: TimeRanges | null\n duration: number\n bufferedPercentage: number\n bufferedEnd: number\n}\n\n// ============================================================================\n// BufferedIndicator Component\n// ============================================================================\n\nexport const BufferedIndicator = React.forwardRef<\n HTMLDivElement,\n BufferedIndicatorProps\n>(function BufferedIndicator(props, forwardedRef) {\n const { render, ...divProps } = props\n const context = useVideoPlayerContext('BufferedIndicator')\n\n // Calculate buffered end position (for progress bar display)\n const bufferedEnd = React.useMemo(() => {\n if (!context.buffered || context.buffered.length === 0) return 0\n\n // Find the buffer range that contains current playback position\n for (let i = 0; i < context.buffered.length; i++) {\n if (\n context.buffered.start(i) <= context.currentTime &&\n context.currentTime <= context.buffered.end(i)\n ) {\n return context.buffered.end(i)\n }\n }\n\n // Fallback to end of first range\n return context.buffered.end(0)\n }, [context.buffered, context.currentTime])\n\n const bufferedPercentage =\n context.duration > 0 ? (bufferedEnd / context.duration) * 100 : 0\n\n const state: BufferedIndicatorState = {\n buffered: context.buffered,\n duration: context.duration,\n bufferedPercentage,\n bufferedEnd,\n }\n\n // CSS custom properties for styling\n const style = {\n '--buffered-percentage': `${bufferedPercentage}%`,\n '--buffered-end': bufferedEnd,\n ...divProps.style,\n } as React.CSSProperties\n\n const renderProps: BufferedIndicatorRenderProps = {\n ref: forwardedRef,\n style,\n 'aria-hidden': true,\n }\n\n if (render) {\n return render(renderProps, state)\n }\n\n return (\n <div ref={forwardedRef} aria-hidden=\"true\" {...divProps} style={style} />\n )\n})\n\n// ============================================================================\n// Namespace\n// ============================================================================\n\nexport namespace BufferedIndicator {\n export type Props = BufferedIndicatorProps\n export type State = BufferedIndicatorState\n}\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type TransitionStatus = 'starting' | 'ending' | undefined\n\nexport interface UseTransitionStatusOptions {\n /**\n * Whether the element should be visible/open.\n */\n open: boolean\n /**\n * Keep the element always mounted in the DOM, even when closed.\n * Only needed for JavaScript animation libraries (e.g., Framer Motion).\n * CSS transitions and animations work automatically without this.\n * @default false\n */\n keepMounted?: boolean\n}\n\nexport interface UseTransitionStatusReturn {\n /**\n * Whether the element should be rendered in the DOM.\n * Stays true during exit animations.\n */\n mounted: boolean\n /**\n * Current transition status:\n * - 'starting': First frame of enter animation\n * - 'ending': Exit animation in progress\n * - undefined: Idle state\n */\n transitionStatus: TransitionStatus\n /**\n * Ref to attach to the animated element.\n * Used to detect when CSS animations/transitions complete.\n */\n elementRef: React.RefObject<HTMLElement | null>\n}\n\n// ============================================================================\n// Utility: Wait for Animations\n// ============================================================================\n\n/**\n * Returns a promise that resolves when all CSS animations and transitions\n * on the element and its descendants have completed.\n */\nfunction waitForAnimations(element: HTMLElement): Promise<void> {\n // Collect animations from the element and all descendants\n const animations = [\n ...element.getAnimations(),\n ...Array.from(element.querySelectorAll('*')).flatMap((el) =>\n (el as HTMLElement).getAnimations(),\n ),\n ]\n\n if (animations.length === 0) {\n return Promise.resolve()\n }\n return Promise.all(animations.map((a) => a.finished))\n .then(() => {})\n .catch(() => {\n // Animation was cancelled (e.g., element removed or animation interrupted)\n })\n}\n\n// ============================================================================\n// Hook: useTransitionStatus\n// ============================================================================\n\nexport function useTransitionStatus(\n options: UseTransitionStatusOptions,\n): UseTransitionStatusReturn {\n const { open, keepMounted = false } = options\n\n const [mounted, setMounted] = React.useState(open || keepMounted)\n const [transitionStatus, setTransitionStatus] =\n React.useState<TransitionStatus>(open ? 'starting' : undefined)\n\n const elementRef = React.useRef<HTMLElement | null>(null)\n\n // Track if we're currently waiting for animations\n const waitingForAnimationsRef = React.useRef(false)\n\n // Handle open → true (enter)\n React.useEffect(() => {\n if (open) {\n // Cancel any pending exit\n waitingForAnimationsRef.current = false\n\n setMounted(true)\n setTransitionStatus('starting')\n\n // Clear starting style after first paint (double RAF for reliability)\n const raf = requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n setTransitionStatus(undefined)\n })\n })\n\n return () => cancelAnimationFrame(raf)\n }\n }, [open])\n\n // Handle open → false (exit)\n React.useEffect(() => {\n if (!open && mounted && !waitingForAnimationsRef.current) {\n setTransitionStatus('ending')\n\n const element = elementRef.current\n\n if (!element) {\n // No element ref, unmount immediately\n setTransitionStatus(undefined)\n if (!keepMounted) {\n setMounted(false)\n }\n return\n }\n\n waitingForAnimationsRef.current = true\n\n // Wait a frame for the browser to process style changes and start animations\n const raf = requestAnimationFrame(() => {\n // Double RAF for reliability (like enter animation)\n requestAnimationFrame(() => {\n waitForAnimations(element).then(() => {\n // Check if we're still supposed to be unmounting\n // (user might have re-opened during animation)\n if (!waitingForAnimationsRef.current) return\n\n waitingForAnimationsRef.current = false\n setTransitionStatus(undefined)\n\n if (!keepMounted) {\n setMounted(false)\n }\n })\n })\n })\n\n return () => {\n cancelAnimationFrame(raf)\n }\n }\n }, [open, mounted, keepMounted])\n\n // Handle keepMounted change\n React.useEffect(() => {\n if (keepMounted && !mounted && !open) {\n setMounted(true)\n }\n }, [keepMounted, mounted, open])\n\n return {\n mounted: mounted || keepMounted,\n transitionStatus,\n elementRef,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/video-player/index.cjs","../../src/video-player/contexts/video-player-context.ts","../../src/video-player/hooks/use-video-player.ts","../../src/video-player/index.parts.ts","../../src/video-player/components/buffered-indicator/buffered-indicator.tsx","../../src/video-player/components/controls/controls.data-attributes.ts"],"names":["VideoPlayerContext","useVideoPlayerContext","component","context","useVideoPlayer","index_parts_exports","__export","BufferedIndicator","Captions","CaptionsButton","CaptionsDataAttributes","CaptionsMenu","CaptionsMenuItem","Controls","ControlsDataAttributes","FullscreenButton","MuteButton","Overlay","OverlayDataAttributes","PictureInPictureButton","PlayButton","PlaybackRateButton","PlaybackRateMenu","PlaybackRateMenuItem","Portal","Poster","QualityMenu","QualityMenuItem","VideoPlayerRoot","RootDataAttributes","SeekSlider","SeekSliderBuffered","SeekSliderControl","SeekSliderCssVars","SeekSliderDataAttributes","SeekSliderHover","SeekSliderPreviewThumb","SeekSliderPreviewThumbDataAttributes","SeekSliderPreviewTooltip","SeekSliderPreviewTooltipPopup","SeekSliderPreviewTooltipPortal","SeekSliderPreviewTooltipPositioner","SeekSliderProgress","SeekSliderThumb","SeekSliderTrack","Thumbnail","ThumbnailDataAttributes","TimeDisplay","TimeDisplayDataAttributes","Track","Video","VolumeSlider","VolumeSliderControl","VolumeSliderCssVars","VolumeSliderDataAttributes","VolumeSliderRange","VolumeSliderThumb","VolumeSliderTrack","useTransitionStatus","props","forwardedRef","render","divProps","bufferedEnd","bufferedPercentage","state","style"],"mappings":"AAAA,4/BAA0C,kjCCEnB,IAGVA,EAAAA,CACL,EAAA,CAAA,aAAA,CAA8C,IAAI,CAAA,CAEnD,SAASC,CAAAA,CACdC,CAAAA,CACyB,CACzB,IAAMC,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWH,EAAkB,CAAA,CACnD,EAAA,CAAI,CAACG,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,CAAA,aAAA,EAAgBD,CAAS,CAAA,wCAAA,CAC3B,CAAA,CAEF,OAAOC,CACT,CCIO,SAASC,EAAAA,CAAAA,CAA0C,CACxD,OAAOH,CAAAA,CAAsB,gBAAgB,CAC/C,CCxBA,IAAAI,EAAAA,CAAA,CAAA,CAAA,CAAAC,iCAAAA,EAAAD,CAAA,CAAA,iBAAA,CAAA,CAAA,CAAA,EAAAE,EAAAA,CAAA,QAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,cAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,sBAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,YAAA,CAAA,CAAA,CAAA,EAAAC,EAAAA,CAAA,gBAAA,CAAA,CAAA,CAAA,EAAAC,EAAA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I,CAAC5D,CAAAA,CAAQ,QAAA,EAAYA,CAAAA,CAAQ,QAAA,CAAS,MAAA,GAAW,CAAA,CAAG,OAAO,CAAA,CAG/D,GAAA,CAAA,IAAS,CAAA,CAAI,CAAA,CAAG,CAAA,CAAIA,CAAAA,CAAQ,QAAA,CAAS,MAAA,CAAQ,CAAA,EAAA,CAC3C,EAAA,CACEA,CAAAA,CAAQ,QAAA,CAAS,KAAA,CAAM,CAAC,CAAA,EAAKA,CAAAA,CAAQ,WAAA,EACrCA,CAAAA,CAAQ,WAAA,EAAeA,CAAAA,CAAQ,QAAA,CAAS,GAAA,CAAI,CAAC,CAAA,CAE7C,OAAOA,CAAAA,CAAQ,QAAA,CAAS,GAAA,CAAI,CAAC,CAAA,CAKjC,OAAOA,CAAAA,CAAQ,QAAA,CAAS,GAAA,CAAI,CAAC,CAC/B,CAAA,CAAG,CAACA,CAAAA,CAAQ,QAAA,CAAUA,CAAAA,CAAQ,WAAW,CAAC,CAAA,CAEpC6D,CAAAA,CACJ7D,CAAAA,CAAQ,QAAA,CAAW,CAAA,CAAK4D,CAAAA,CAAc5D,CAAAA,CAAQ,QAAA,CAAY,GAAA,CAAM,CAAA,CAE5D8D,CAAAA,CAAgC,CACpC,QAAA,CAAU9D,CAAAA,CAAQ,QAAA,CAClB,QAAA,CAAUA,CAAAA,CAAQ,QAAA,CAClB,kBAAA,CAAA6D,CAAAA,CACA,WAAA,CAAAD,CACF,CAAA,CAGMG,CAAAA,CAAQ,CACZ,uBAAA,CAAyB,CAAA,EAAA;AC3DlB","file":"/home/runner/work/ui/ui/packages/react/dist/video-player/index.cjs","sourcesContent":[null,"'use client'\n\nimport * as React from 'react'\nimport type { VideoPlayerContextValue } from '../types.js'\n\nexport const VideoPlayerContext =\n React.createContext<VideoPlayerContextValue | null>(null)\n\nexport function useVideoPlayerContext(\n component: string,\n): VideoPlayerContextValue {\n const context = React.useContext(VideoPlayerContext)\n if (!context) {\n throw new Error(\n `<VideoPlayer.${component}> must be used within <VideoPlayer.Root>`,\n )\n }\n return context\n}\n","'use client'\n\nimport { useVideoPlayerContext } from '../contexts/video-player-context.js'\nimport type { VideoPlayerContextValue } from '../types.js'\n\n/**\n * Hook to access the VideoPlayer context from custom components.\n *\n * @example\n * ```tsx\n * function CustomControl() {\n * const { playing, toggle, currentTime, duration } = useVideoPlayer()\n *\n * return (\n * <div>\n * {playing ? 'Playing' : 'Paused'} - {currentTime}s / {duration}s\n * <button onClick={toggle}>Toggle</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useVideoPlayer(): VideoPlayerContextValue {\n return useVideoPlayerContext('useVideoPlayer')\n}\n","// ============================================================================\n// VideoPlayer Composable Parts\n// ============================================================================\n//\n// Import like: import * as VideoPlayer from './video-player/index.parts.js'\n//\n// Usage:\n// <VideoPlayer.Root>\n// <VideoPlayer.Video src=\"...\" />\n// <VideoPlayer.Controls>\n// <VideoPlayer.PlayButton />\n// <VideoPlayer.SeekSlider />\n// <VideoPlayer.TimeDisplay />\n// </VideoPlayer.Controls>\n// </VideoPlayer.Root>\n//\n\nexport { BufferedIndicator } from './components/buffered-indicator/buffered-indicator.js'\nexport { CaptionsDataAttributes } from './components/captions/captions.data-attributes.js'\nexport { Captions } from './components/captions/captions.js'\n// Captions\nexport { CaptionsButton } from './components/captions-button/captions-button.js'\nexport {\n CaptionsMenu,\n CaptionsMenuItem,\n} from './components/captions-menu/captions-menu.js'\nexport { ControlsDataAttributes } from './components/controls/controls.data-attributes.js'\nexport { Controls } from './components/controls/controls.js'\n// Display Controls\nexport { FullscreenButton } from './components/fullscreen-button/fullscreen-button.js'\nexport { MuteButton } from './components/mute-button/mute-button.js'\nexport { OverlayDataAttributes } from './components/overlay/overlay.data-attributes.js'\nexport { Overlay } from './components/overlay/overlay.js'\nexport { PictureInPictureButton } from './components/picture-in-picture-button/picture-in-picture-button.js'\n// Playback Controls\nexport { PlayButton } from './components/play-button/play-button.js'\n// Playback Rate\nexport { PlaybackRateButton } from './components/playback-rate-button/playback-rate-button.js'\nexport {\n PlaybackRateMenu,\n PlaybackRateMenuItem,\n} from './components/playback-rate-menu/playback-rate-menu.js'\n// Layout\nexport { Portal } from './components/portal/portal.js'\nexport { Poster } from './components/poster/poster.js'\n// Quality\nexport {\n QualityMenu,\n QualityMenuItem,\n} from './components/quality-menu/quality-menu.js'\n// Data Attributes & CSS Variables\nexport { RootDataAttributes } from './components/root/root.data-attributes.js'\n// Core\nexport { VideoPlayerRoot as Root } from './components/root/root.js'\nexport { SeekSliderCssVars } from './components/seek-slider/seek-slider.css-vars.js'\nexport { SeekSliderDataAttributes } from './components/seek-slider/seek-slider.data-attributes.js'\nexport {\n SeekSlider,\n SeekSliderBuffered,\n SeekSliderControl,\n SeekSliderHover,\n SeekSliderPreviewThumb,\n SeekSliderPreviewTooltip,\n SeekSliderPreviewTooltipPopup,\n SeekSliderPreviewTooltipPortal,\n SeekSliderPreviewTooltipPositioner,\n SeekSliderProgress,\n SeekSliderThumb,\n SeekSliderTrack,\n} from './components/seek-slider/seek-slider.js'\nexport { SeekSliderPreviewThumbDataAttributes } from './components/seek-slider/seek-slider-preview-thumb.data-attributes.js'\nexport { ThumbnailDataAttributes } from './components/thumbnail/thumbnail.data-attributes.js'\nexport { Thumbnail } from './components/thumbnail/thumbnail.js'\nexport { TimeDisplayDataAttributes } from './components/time-display/time-display.data-attributes.js'\nexport { TimeDisplay } from './components/time-display/time-display.js'\nexport { Track } from './components/track/track.js'\nexport { Video } from './components/video/video.js'\nexport { VolumeSliderCssVars } from './components/volume-slider/volume-slider.css-vars.js'\nexport { VolumeSliderDataAttributes } from './components/volume-slider/volume-slider.data-attributes.js'\n// Audio Controls\nexport {\n VolumeSlider,\n VolumeSliderControl,\n VolumeSliderRange,\n VolumeSliderThumb,\n VolumeSliderTrack,\n} from './components/volume-slider/volume-slider.js'\nexport {\n type TransitionStatus,\n type UseTransitionStatusOptions,\n type UseTransitionStatusReturn,\n useTransitionStatus,\n} from './hooks/use-transition-status.js'\n// Hooks\nexport { useVideoPlayer } from './hooks/use-video-player.js'\n// Types\nexport type {\n PlaybackIntent,\n PlaybackStatus,\n RenderProp,\n TrackInfo,\n VideoPlayerActions,\n VideoPlayerContextValue,\n VideoPlayerRootProps,\n VideoPlayerState,\n VideoQuality,\n VideoTextTrack,\n} from './types.js'\n","'use client'\n\nimport * as React from 'react'\nimport { useVideoPlayerContext } from '../../contexts/video-player-context.js'\nimport type { RenderProp } from '../../types.js'\n\n// ============================================================================\n// BufferedIndicator Props\n// ============================================================================\n\nexport interface BufferedIndicatorProps\n extends React.ComponentPropsWithRef<'div'> {\n render?: RenderProp<BufferedIndicatorRenderProps, BufferedIndicatorState>\n}\n\nexport interface BufferedIndicatorRenderProps {\n ref: React.Ref<HTMLElement>\n style: React.CSSProperties\n 'aria-hidden': true\n}\n\nexport interface BufferedIndicatorState {\n buffered: TimeRanges | null\n duration: number\n bufferedPercentage: number\n bufferedEnd: number\n}\n\n// ============================================================================\n// BufferedIndicator Component\n// ============================================================================\n\nexport const BufferedIndicator = React.forwardRef<\n HTMLDivElement,\n BufferedIndicatorProps\n>(function BufferedIndicator(props, forwardedRef) {\n const { render, ...divProps } = props\n const context = useVideoPlayerContext('BufferedIndicator')\n\n // Calculate buffered end position (for progress bar display)\n const bufferedEnd = React.useMemo(() => {\n if (!context.buffered || context.buffered.length === 0) return 0\n\n // Find the buffer range that contains current playback position\n for (let i = 0; i < context.buffered.length; i++) {\n if (\n context.buffered.start(i) <= context.currentTime &&\n context.currentTime <= context.buffered.end(i)\n ) {\n return context.buffered.end(i)\n }\n }\n\n // Fallback to end of first range\n return context.buffered.end(0)\n }, [context.buffered, context.currentTime])\n\n const bufferedPercentage =\n context.duration > 0 ? (bufferedEnd / context.duration) * 100 : 0\n\n const state: BufferedIndicatorState = {\n buffered: context.buffered,\n duration: context.duration,\n bufferedPercentage,\n bufferedEnd,\n }\n\n // CSS custom properties for styling\n const style = {\n '--buffered-percentage': `${bufferedPercentage}%`,\n '--buffered-end': bufferedEnd,\n ...divProps.style,\n } as React.CSSProperties\n\n const renderProps: BufferedIndicatorRenderProps = {\n ref: forwardedRef,\n style,\n 'aria-hidden': true,\n }\n\n if (render) {\n return render(renderProps, state)\n }\n\n return (\n <div ref={forwardedRef} aria-hidden=\"true\" {...divProps} style={style} />\n )\n})\n\n// ============================================================================\n// Namespace\n// ============================================================================\n\nexport namespace BufferedIndicator {\n export type Props = BufferedIndicatorProps\n export type State = BufferedIndicatorState\n}\n","export enum ControlsDataAttributes {\n /** Applied when the controls are visible. */\n open = 'data-open',\n /** Applied when the controls are hidden. */\n closed = 'data-closed',\n /** Applied when the player is idle (no user interaction). */\n idle = 'data-idle',\n /** Applied when the video is playing. */\n playing = 'data-playing',\n /** Applied when the video is paused. */\n paused = 'data-paused',\n /** Applied when the video has ended. */\n ended = 'data-ended',\n /** Applied on the first frame when entering. Use for CSS enter animations. */\n startingStyle = 'data-starting-style',\n /** Applied during exit animation. Use for CSS exit animations. */\n endingStyle = 'data-ending-style',\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { W as WithPreventableBaseHandlers } from '../types-DT4FOOa2.cjs';
|
|
2
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import * as _base_ui_react_slider from '@base-ui/react/slider';
|
|
4
5
|
import { Slider } from '@base-ui/react/slider';
|
|
@@ -134,6 +135,7 @@ interface VideoPlayerInternalHandlers {
|
|
|
134
135
|
onSeeked: () => void;
|
|
135
136
|
onVolumeChange: () => void;
|
|
136
137
|
onLoadedMetadata: () => void;
|
|
138
|
+
onVideoMount: () => void;
|
|
137
139
|
onRootMouseLeave: () => void;
|
|
138
140
|
}
|
|
139
141
|
interface VideoPlayerContextValue extends VideoPlayerState, VideoPlayerActions {
|
|
@@ -149,7 +151,7 @@ interface VideoPlayerExternalActions {
|
|
|
149
151
|
setVolume: (volume: number) => void;
|
|
150
152
|
toggleFullscreen: () => Promise<void>;
|
|
151
153
|
}
|
|
152
|
-
type DivPropsWithoutConflicts = Omit<React.ComponentPropsWithRef<'div'
|
|
154
|
+
type DivPropsWithoutConflicts = Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'div'>>, 'onVolumeChange' | 'onEnded' | 'onWaiting' | 'onSeeking' | 'onSeeked'>;
|
|
153
155
|
interface VideoPlayerRootProps extends DivPropsWithoutConflicts {
|
|
154
156
|
/**
|
|
155
157
|
* Ref to expose programmatic control actions.
|
|
@@ -165,6 +167,11 @@ interface VideoPlayerRootProps extends DivPropsWithoutConflicts {
|
|
|
165
167
|
*/
|
|
166
168
|
keyboardShortcuts?: 'focused' | 'global' | 'none';
|
|
167
169
|
defaultPlaying?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Attempts to start playback automatically when the video element mounts.
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
autoPlay?: boolean;
|
|
168
175
|
defaultVolume?: number;
|
|
169
176
|
defaultMuted?: boolean;
|
|
170
177
|
defaultPlaybackRate?: number;
|
|
@@ -354,12 +361,12 @@ declare enum CaptionsButtonDataAttributes {
|
|
|
354
361
|
available = "data-available"
|
|
355
362
|
}
|
|
356
363
|
|
|
357
|
-
interface CaptionsButtonProps extends React.ComponentPropsWithRef<'button'
|
|
364
|
+
interface CaptionsButtonProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
358
365
|
render?: RenderProp<CaptionsButtonRenderProps, CaptionsButtonState>;
|
|
359
366
|
}
|
|
360
367
|
interface CaptionsButtonRenderProps {
|
|
361
368
|
ref: React.Ref<HTMLButtonElement>;
|
|
362
|
-
type: '
|
|
369
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
363
370
|
'aria-label': string;
|
|
364
371
|
'aria-pressed': boolean;
|
|
365
372
|
disabled: boolean;
|
|
@@ -396,7 +403,7 @@ interface CaptionsMenuState {
|
|
|
396
403
|
registeredTracks: TrackInfo[];
|
|
397
404
|
activeTextTrack: TextTrack | null;
|
|
398
405
|
}
|
|
399
|
-
interface CaptionsMenuItemProps extends React.ComponentPropsWithRef<'button'
|
|
406
|
+
interface CaptionsMenuItemProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
400
407
|
track: TextTrack | null;
|
|
401
408
|
}
|
|
402
409
|
declare const CaptionsMenuItem: React.ForwardRefExoticComponent<Omit<CaptionsMenuItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -476,13 +483,13 @@ declare enum FullscreenButtonDataAttributes {
|
|
|
476
483
|
supported = "data-supported"
|
|
477
484
|
}
|
|
478
485
|
|
|
479
|
-
interface FullscreenButtonProps extends Omit<React.ComponentPropsWithRef<'button'
|
|
486
|
+
interface FullscreenButtonProps extends Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>>, 'children'> {
|
|
480
487
|
render?: RenderProp<FullscreenButtonRenderProps, FullscreenButtonState>;
|
|
481
488
|
children?: React.ReactNode;
|
|
482
489
|
}
|
|
483
490
|
interface FullscreenButtonRenderProps {
|
|
484
491
|
ref: React.Ref<HTMLButtonElement>;
|
|
485
|
-
type: '
|
|
492
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
486
493
|
'aria-label': string;
|
|
487
494
|
'aria-pressed': boolean;
|
|
488
495
|
disabled: boolean;
|
|
@@ -514,12 +521,12 @@ declare enum MuteButtonDataAttributes {
|
|
|
514
521
|
volumeHigh = "data-volume-high"
|
|
515
522
|
}
|
|
516
523
|
|
|
517
|
-
interface MuteButtonProps extends React.ComponentPropsWithRef<'button'
|
|
524
|
+
interface MuteButtonProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
518
525
|
render?: RenderProp<MuteButtonRenderProps, MuteButtonState>;
|
|
519
526
|
}
|
|
520
527
|
interface MuteButtonRenderProps {
|
|
521
528
|
ref: React.Ref<HTMLButtonElement>;
|
|
522
|
-
type: '
|
|
529
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
523
530
|
'aria-label': string;
|
|
524
531
|
'aria-pressed': boolean;
|
|
525
532
|
[MuteButtonDataAttributes.muted]?: boolean;
|
|
@@ -564,7 +571,7 @@ declare enum OverlayDataAttributes {
|
|
|
564
571
|
endingStyle = "data-ending-style"
|
|
565
572
|
}
|
|
566
573
|
|
|
567
|
-
interface OverlayProps extends Omit<React.ComponentPropsWithRef<'div'
|
|
574
|
+
interface OverlayProps extends Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'div'>>, 'children'> {
|
|
568
575
|
/**
|
|
569
576
|
* Delay before hiding after player becomes idle (ms).
|
|
570
577
|
* Defaults to Root's idleTimeout. Set to 0 to disable auto-hide.
|
|
@@ -620,12 +627,12 @@ declare enum PictureInPictureButtonDataAttributes {
|
|
|
620
627
|
supported = "data-supported"
|
|
621
628
|
}
|
|
622
629
|
|
|
623
|
-
interface PictureInPictureButtonProps extends React.ComponentPropsWithRef<'button'
|
|
630
|
+
interface PictureInPictureButtonProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
624
631
|
render?: RenderProp<PictureInPictureButtonRenderProps, PictureInPictureButtonState>;
|
|
625
632
|
}
|
|
626
633
|
interface PictureInPictureButtonRenderProps {
|
|
627
634
|
ref: React.Ref<HTMLButtonElement>;
|
|
628
|
-
type: '
|
|
635
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
629
636
|
'aria-label': string;
|
|
630
637
|
'aria-pressed': boolean;
|
|
631
638
|
disabled: boolean;
|
|
@@ -654,13 +661,13 @@ declare enum PlayButtonDataAttributes {
|
|
|
654
661
|
waiting = "data-waiting"
|
|
655
662
|
}
|
|
656
663
|
|
|
657
|
-
interface PlayButtonProps extends Omit<React.ComponentPropsWithRef<'button'
|
|
664
|
+
interface PlayButtonProps extends Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>>, 'children'> {
|
|
658
665
|
render?: RenderProp<PlayButtonRenderProps, PlayButtonState>;
|
|
659
666
|
children?: React.ReactNode;
|
|
660
667
|
}
|
|
661
668
|
interface PlayButtonRenderProps {
|
|
662
669
|
ref: React.Ref<HTMLButtonElement>;
|
|
663
|
-
type: '
|
|
670
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
664
671
|
'aria-label': string;
|
|
665
672
|
[PlayButtonDataAttributes.playing]?: boolean;
|
|
666
673
|
[PlayButtonDataAttributes.paused]?: boolean;
|
|
@@ -686,7 +693,7 @@ declare enum PlaybackRateButtonDataAttributes {
|
|
|
686
693
|
rate = "data-rate"
|
|
687
694
|
}
|
|
688
695
|
|
|
689
|
-
interface PlaybackRateButtonProps extends React.ComponentPropsWithRef<'button'
|
|
696
|
+
interface PlaybackRateButtonProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
690
697
|
/**
|
|
691
698
|
* Available playback rates to cycle through.
|
|
692
699
|
* @default [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]
|
|
@@ -696,7 +703,7 @@ interface PlaybackRateButtonProps extends React.ComponentPropsWithRef<'button'>
|
|
|
696
703
|
}
|
|
697
704
|
interface PlaybackRateButtonRenderProps {
|
|
698
705
|
ref: React.Ref<HTMLButtonElement>;
|
|
699
|
-
type: '
|
|
706
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
700
707
|
'aria-label': string;
|
|
701
708
|
[PlaybackRateButtonDataAttributes.rate]: number;
|
|
702
709
|
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -734,7 +741,7 @@ interface PlaybackRateMenuState {
|
|
|
734
741
|
playbackRate: number;
|
|
735
742
|
rates: readonly number[];
|
|
736
743
|
}
|
|
737
|
-
interface PlaybackRateMenuItemProps extends React.ComponentPropsWithRef<'button'
|
|
744
|
+
interface PlaybackRateMenuItemProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
738
745
|
rate: number;
|
|
739
746
|
}
|
|
740
747
|
declare const PlaybackRateMenuItem: React.ForwardRefExoticComponent<Omit<PlaybackRateMenuItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -818,7 +825,7 @@ interface QualityMenuState {
|
|
|
818
825
|
qualities: VideoQuality[];
|
|
819
826
|
activeQuality: VideoQuality | null;
|
|
820
827
|
}
|
|
821
|
-
interface QualityMenuItemProps extends React.ComponentPropsWithRef<'button'
|
|
828
|
+
interface QualityMenuItemProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
822
829
|
quality: VideoQuality;
|
|
823
830
|
}
|
|
824
831
|
declare const QualityMenuItem: React.ForwardRefExoticComponent<Omit<QualityMenuItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1194,7 +1201,7 @@ declare namespace Track {
|
|
|
1194
1201
|
type Props = TrackProps;
|
|
1195
1202
|
}
|
|
1196
1203
|
|
|
1197
|
-
interface VideoProps extends Omit<React.ComponentPropsWithRef<'video'
|
|
1204
|
+
interface VideoProps extends Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'video'>>, 'onTimeUpdate' | 'onDurationChange' | 'onProgress' | 'onPlay' | 'onPause' | 'onEnded' | 'onWaiting' | 'onCanPlay' | 'onSeeking' | 'onSeeked' | 'onVolumeChange' | 'onLoadedMetadata'> {
|
|
1198
1205
|
/**
|
|
1199
1206
|
* Toggle play/pause when clicking on the video.
|
|
1200
1207
|
* @default true
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { W as WithPreventableBaseHandlers } from '../types-DT4FOOa2.js';
|
|
2
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import * as _base_ui_react_slider from '@base-ui/react/slider';
|
|
4
5
|
import { Slider } from '@base-ui/react/slider';
|
|
@@ -134,6 +135,7 @@ interface VideoPlayerInternalHandlers {
|
|
|
134
135
|
onSeeked: () => void;
|
|
135
136
|
onVolumeChange: () => void;
|
|
136
137
|
onLoadedMetadata: () => void;
|
|
138
|
+
onVideoMount: () => void;
|
|
137
139
|
onRootMouseLeave: () => void;
|
|
138
140
|
}
|
|
139
141
|
interface VideoPlayerContextValue extends VideoPlayerState, VideoPlayerActions {
|
|
@@ -149,7 +151,7 @@ interface VideoPlayerExternalActions {
|
|
|
149
151
|
setVolume: (volume: number) => void;
|
|
150
152
|
toggleFullscreen: () => Promise<void>;
|
|
151
153
|
}
|
|
152
|
-
type DivPropsWithoutConflicts = Omit<React.ComponentPropsWithRef<'div'
|
|
154
|
+
type DivPropsWithoutConflicts = Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'div'>>, 'onVolumeChange' | 'onEnded' | 'onWaiting' | 'onSeeking' | 'onSeeked'>;
|
|
153
155
|
interface VideoPlayerRootProps extends DivPropsWithoutConflicts {
|
|
154
156
|
/**
|
|
155
157
|
* Ref to expose programmatic control actions.
|
|
@@ -165,6 +167,11 @@ interface VideoPlayerRootProps extends DivPropsWithoutConflicts {
|
|
|
165
167
|
*/
|
|
166
168
|
keyboardShortcuts?: 'focused' | 'global' | 'none';
|
|
167
169
|
defaultPlaying?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Attempts to start playback automatically when the video element mounts.
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
autoPlay?: boolean;
|
|
168
175
|
defaultVolume?: number;
|
|
169
176
|
defaultMuted?: boolean;
|
|
170
177
|
defaultPlaybackRate?: number;
|
|
@@ -354,12 +361,12 @@ declare enum CaptionsButtonDataAttributes {
|
|
|
354
361
|
available = "data-available"
|
|
355
362
|
}
|
|
356
363
|
|
|
357
|
-
interface CaptionsButtonProps extends React.ComponentPropsWithRef<'button'
|
|
364
|
+
interface CaptionsButtonProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
358
365
|
render?: RenderProp<CaptionsButtonRenderProps, CaptionsButtonState>;
|
|
359
366
|
}
|
|
360
367
|
interface CaptionsButtonRenderProps {
|
|
361
368
|
ref: React.Ref<HTMLButtonElement>;
|
|
362
|
-
type: '
|
|
369
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
363
370
|
'aria-label': string;
|
|
364
371
|
'aria-pressed': boolean;
|
|
365
372
|
disabled: boolean;
|
|
@@ -396,7 +403,7 @@ interface CaptionsMenuState {
|
|
|
396
403
|
registeredTracks: TrackInfo[];
|
|
397
404
|
activeTextTrack: TextTrack | null;
|
|
398
405
|
}
|
|
399
|
-
interface CaptionsMenuItemProps extends React.ComponentPropsWithRef<'button'
|
|
406
|
+
interface CaptionsMenuItemProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
400
407
|
track: TextTrack | null;
|
|
401
408
|
}
|
|
402
409
|
declare const CaptionsMenuItem: React.ForwardRefExoticComponent<Omit<CaptionsMenuItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -476,13 +483,13 @@ declare enum FullscreenButtonDataAttributes {
|
|
|
476
483
|
supported = "data-supported"
|
|
477
484
|
}
|
|
478
485
|
|
|
479
|
-
interface FullscreenButtonProps extends Omit<React.ComponentPropsWithRef<'button'
|
|
486
|
+
interface FullscreenButtonProps extends Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>>, 'children'> {
|
|
480
487
|
render?: RenderProp<FullscreenButtonRenderProps, FullscreenButtonState>;
|
|
481
488
|
children?: React.ReactNode;
|
|
482
489
|
}
|
|
483
490
|
interface FullscreenButtonRenderProps {
|
|
484
491
|
ref: React.Ref<HTMLButtonElement>;
|
|
485
|
-
type: '
|
|
492
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
486
493
|
'aria-label': string;
|
|
487
494
|
'aria-pressed': boolean;
|
|
488
495
|
disabled: boolean;
|
|
@@ -514,12 +521,12 @@ declare enum MuteButtonDataAttributes {
|
|
|
514
521
|
volumeHigh = "data-volume-high"
|
|
515
522
|
}
|
|
516
523
|
|
|
517
|
-
interface MuteButtonProps extends React.ComponentPropsWithRef<'button'
|
|
524
|
+
interface MuteButtonProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
518
525
|
render?: RenderProp<MuteButtonRenderProps, MuteButtonState>;
|
|
519
526
|
}
|
|
520
527
|
interface MuteButtonRenderProps {
|
|
521
528
|
ref: React.Ref<HTMLButtonElement>;
|
|
522
|
-
type: '
|
|
529
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
523
530
|
'aria-label': string;
|
|
524
531
|
'aria-pressed': boolean;
|
|
525
532
|
[MuteButtonDataAttributes.muted]?: boolean;
|
|
@@ -564,7 +571,7 @@ declare enum OverlayDataAttributes {
|
|
|
564
571
|
endingStyle = "data-ending-style"
|
|
565
572
|
}
|
|
566
573
|
|
|
567
|
-
interface OverlayProps extends Omit<React.ComponentPropsWithRef<'div'
|
|
574
|
+
interface OverlayProps extends Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'div'>>, 'children'> {
|
|
568
575
|
/**
|
|
569
576
|
* Delay before hiding after player becomes idle (ms).
|
|
570
577
|
* Defaults to Root's idleTimeout. Set to 0 to disable auto-hide.
|
|
@@ -620,12 +627,12 @@ declare enum PictureInPictureButtonDataAttributes {
|
|
|
620
627
|
supported = "data-supported"
|
|
621
628
|
}
|
|
622
629
|
|
|
623
|
-
interface PictureInPictureButtonProps extends React.ComponentPropsWithRef<'button'
|
|
630
|
+
interface PictureInPictureButtonProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
624
631
|
render?: RenderProp<PictureInPictureButtonRenderProps, PictureInPictureButtonState>;
|
|
625
632
|
}
|
|
626
633
|
interface PictureInPictureButtonRenderProps {
|
|
627
634
|
ref: React.Ref<HTMLButtonElement>;
|
|
628
|
-
type: '
|
|
635
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
629
636
|
'aria-label': string;
|
|
630
637
|
'aria-pressed': boolean;
|
|
631
638
|
disabled: boolean;
|
|
@@ -654,13 +661,13 @@ declare enum PlayButtonDataAttributes {
|
|
|
654
661
|
waiting = "data-waiting"
|
|
655
662
|
}
|
|
656
663
|
|
|
657
|
-
interface PlayButtonProps extends Omit<React.ComponentPropsWithRef<'button'
|
|
664
|
+
interface PlayButtonProps extends Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>>, 'children'> {
|
|
658
665
|
render?: RenderProp<PlayButtonRenderProps, PlayButtonState>;
|
|
659
666
|
children?: React.ReactNode;
|
|
660
667
|
}
|
|
661
668
|
interface PlayButtonRenderProps {
|
|
662
669
|
ref: React.Ref<HTMLButtonElement>;
|
|
663
|
-
type: '
|
|
670
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
664
671
|
'aria-label': string;
|
|
665
672
|
[PlayButtonDataAttributes.playing]?: boolean;
|
|
666
673
|
[PlayButtonDataAttributes.paused]?: boolean;
|
|
@@ -686,7 +693,7 @@ declare enum PlaybackRateButtonDataAttributes {
|
|
|
686
693
|
rate = "data-rate"
|
|
687
694
|
}
|
|
688
695
|
|
|
689
|
-
interface PlaybackRateButtonProps extends React.ComponentPropsWithRef<'button'
|
|
696
|
+
interface PlaybackRateButtonProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
690
697
|
/**
|
|
691
698
|
* Available playback rates to cycle through.
|
|
692
699
|
* @default [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]
|
|
@@ -696,7 +703,7 @@ interface PlaybackRateButtonProps extends React.ComponentPropsWithRef<'button'>
|
|
|
696
703
|
}
|
|
697
704
|
interface PlaybackRateButtonRenderProps {
|
|
698
705
|
ref: React.Ref<HTMLButtonElement>;
|
|
699
|
-
type: '
|
|
706
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
700
707
|
'aria-label': string;
|
|
701
708
|
[PlaybackRateButtonDataAttributes.rate]: number;
|
|
702
709
|
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -734,7 +741,7 @@ interface PlaybackRateMenuState {
|
|
|
734
741
|
playbackRate: number;
|
|
735
742
|
rates: readonly number[];
|
|
736
743
|
}
|
|
737
|
-
interface PlaybackRateMenuItemProps extends React.ComponentPropsWithRef<'button'
|
|
744
|
+
interface PlaybackRateMenuItemProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
738
745
|
rate: number;
|
|
739
746
|
}
|
|
740
747
|
declare const PlaybackRateMenuItem: React.ForwardRefExoticComponent<Omit<PlaybackRateMenuItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -818,7 +825,7 @@ interface QualityMenuState {
|
|
|
818
825
|
qualities: VideoQuality[];
|
|
819
826
|
activeQuality: VideoQuality | null;
|
|
820
827
|
}
|
|
821
|
-
interface QualityMenuItemProps extends React.ComponentPropsWithRef<'button'
|
|
828
|
+
interface QualityMenuItemProps extends WithPreventableBaseHandlers<React.ComponentPropsWithRef<'button'>> {
|
|
822
829
|
quality: VideoQuality;
|
|
823
830
|
}
|
|
824
831
|
declare const QualityMenuItem: React.ForwardRefExoticComponent<Omit<QualityMenuItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1194,7 +1201,7 @@ declare namespace Track {
|
|
|
1194
1201
|
type Props = TrackProps;
|
|
1195
1202
|
}
|
|
1196
1203
|
|
|
1197
|
-
interface VideoProps extends Omit<React.ComponentPropsWithRef<'video'
|
|
1204
|
+
interface VideoProps extends Omit<WithPreventableBaseHandlers<React.ComponentPropsWithRef<'video'>>, 'onTimeUpdate' | 'onDurationChange' | 'onProgress' | 'onPlay' | 'onPause' | 'onEnded' | 'onWaiting' | 'onCanPlay' | 'onSeeking' | 'onSeeked' | 'onVolumeChange' | 'onLoadedMetadata'> {
|
|
1198
1205
|
/**
|
|
1199
1206
|
* Toggle play/pause when clicking on the video.
|
|
1200
1207
|
* @default true
|