@videojs/react 10.0.0-beta.15 → 10.0.0-beta.17
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/default/index.js +7 -1
- package/dist/default/media/dash-video/index.js +3 -2
- package/dist/default/media/dash-video/index.js.map +1 -1
- package/dist/default/media/hls-video/index.js +3 -2
- package/dist/default/media/hls-video/index.js.map +1 -1
- package/dist/default/media/mux-audio/index.js +20 -0
- package/dist/default/media/mux-audio/index.js.map +1 -0
- package/dist/default/media/mux-video/index.js +3 -2
- package/dist/default/media/mux-video/index.js.map +1 -1
- package/dist/default/media/native-hls-video/index.js +3 -2
- package/dist/default/media/native-hls-video/index.js.map +1 -1
- package/dist/default/media/simple-hls-video/index.js +3 -2
- package/dist/default/media/simple-hls-video/index.js.map +1 -1
- package/dist/default/player/context.js +9 -1
- package/dist/default/player/context.js.map +1 -1
- package/dist/default/presets/audio/minimal-skin.css +23 -0
- package/dist/default/presets/audio/skin.css +23 -0
- package/dist/default/presets/audio/skin.js +65 -0
- package/dist/default/presets/audio/skin.js.map +1 -1
- package/dist/default/presets/video/minimal-skin.css +23 -0
- package/dist/default/presets/video/skin.css +23 -0
- package/dist/default/presets/video/skin.js +107 -1
- package/dist/default/presets/video/skin.js.map +1 -1
- package/dist/default/ui/captions-button/captions-button.js +2 -1
- package/dist/default/ui/captions-button/captions-button.js.map +1 -1
- package/dist/default/ui/create-media-button.js +7 -2
- package/dist/default/ui/create-media-button.js.map +1 -1
- package/dist/default/ui/fullscreen-button/fullscreen-button.js +2 -1
- package/dist/default/ui/fullscreen-button/fullscreen-button.js.map +1 -1
- package/dist/default/ui/gesture/media-gesture.js +42 -0
- package/dist/default/ui/gesture/media-gesture.js.map +1 -0
- package/dist/default/ui/gesture/use-doubletap-gesture.js +29 -0
- package/dist/default/ui/gesture/use-doubletap-gesture.js.map +1 -0
- package/dist/default/ui/gesture/use-tap-gesture.js +29 -0
- package/dist/default/ui/gesture/use-tap-gesture.js.map +1 -0
- package/dist/default/ui/hooks/use-slider.js +1 -1
- package/dist/default/ui/hooks/use-slider.js.map +1 -1
- package/dist/default/ui/hotkey/media-hotkey.js +41 -0
- package/dist/default/ui/hotkey/media-hotkey.js.map +1 -0
- package/dist/default/ui/hotkey/use-aria-key-shortcuts.js +16 -0
- package/dist/default/ui/hotkey/use-aria-key-shortcuts.js.map +1 -0
- package/dist/default/ui/hotkey/use-hotkey.js +32 -0
- package/dist/default/ui/hotkey/use-hotkey.js.map +1 -0
- package/dist/default/ui/mute-button/mute-button.js +2 -1
- package/dist/default/ui/mute-button/mute-button.js.map +1 -1
- package/dist/default/ui/pip-button/pip-button.js +2 -1
- package/dist/default/ui/pip-button/pip-button.js.map +1 -1
- package/dist/default/ui/play-button/play-button.js +2 -1
- package/dist/default/ui/play-button/play-button.js.map +1 -1
- package/dist/default/ui/time-slider/time-slider-root.js +2 -2
- package/dist/default/ui/time-slider/time-slider-root.js.map +1 -1
- package/dist/dev/index.d.ts +7 -1
- package/dist/dev/index.js +7 -1
- package/dist/dev/media/dash-video/index.d.ts +4 -1
- package/dist/dev/media/dash-video/index.d.ts.map +1 -1
- package/dist/dev/media/dash-video/index.js +3 -2
- package/dist/dev/media/dash-video/index.js.map +1 -1
- package/dist/dev/media/hls-video/index.d.ts +4 -1
- package/dist/dev/media/hls-video/index.d.ts.map +1 -1
- package/dist/dev/media/hls-video/index.js +3 -2
- package/dist/dev/media/hls-video/index.js.map +1 -1
- package/dist/dev/media/mux-audio/index.d.ts +13 -0
- package/dist/dev/media/mux-audio/index.d.ts.map +1 -0
- package/dist/dev/media/mux-audio/index.js +20 -0
- package/dist/dev/media/mux-audio/index.js.map +1 -0
- package/dist/dev/media/mux-video/index.d.ts +4 -1
- package/dist/dev/media/mux-video/index.d.ts.map +1 -1
- package/dist/dev/media/mux-video/index.js +3 -2
- package/dist/dev/media/mux-video/index.js.map +1 -1
- package/dist/dev/media/native-hls-video/index.d.ts +4 -1
- package/dist/dev/media/native-hls-video/index.d.ts.map +1 -1
- package/dist/dev/media/native-hls-video/index.js +3 -2
- package/dist/dev/media/native-hls-video/index.js.map +1 -1
- package/dist/dev/media/simple-hls-video/index.d.ts +4 -1
- package/dist/dev/media/simple-hls-video/index.d.ts.map +1 -1
- package/dist/dev/media/simple-hls-video/index.js +3 -2
- package/dist/dev/media/simple-hls-video/index.js.map +1 -1
- package/dist/dev/player/context.d.ts.map +1 -1
- package/dist/dev/player/context.js +9 -1
- package/dist/dev/player/context.js.map +1 -1
- package/dist/dev/presets/audio/minimal-skin.css +23 -0
- package/dist/dev/presets/audio/skin.css +23 -0
- package/dist/dev/presets/audio/skin.d.ts.map +1 -1
- package/dist/dev/presets/audio/skin.js +65 -0
- package/dist/dev/presets/audio/skin.js.map +1 -1
- package/dist/dev/presets/video/minimal-skin.css +23 -0
- package/dist/dev/presets/video/skin.css +23 -0
- package/dist/dev/presets/video/skin.d.ts.map +1 -1
- package/dist/dev/presets/video/skin.js +107 -1
- package/dist/dev/presets/video/skin.js.map +1 -1
- package/dist/dev/ui/captions-button/captions-button.d.ts.map +1 -1
- package/dist/dev/ui/captions-button/captions-button.js +2 -1
- package/dist/dev/ui/captions-button/captions-button.js.map +1 -1
- package/dist/dev/ui/create-media-button.js +7 -2
- package/dist/dev/ui/create-media-button.js.map +1 -1
- package/dist/dev/ui/fullscreen-button/fullscreen-button.d.ts.map +1 -1
- package/dist/dev/ui/fullscreen-button/fullscreen-button.js +2 -1
- package/dist/dev/ui/fullscreen-button/fullscreen-button.js.map +1 -1
- package/dist/dev/ui/gesture/media-gesture.d.ts +23 -0
- package/dist/dev/ui/gesture/media-gesture.d.ts.map +1 -0
- package/dist/dev/ui/gesture/media-gesture.js +42 -0
- package/dist/dev/ui/gesture/media-gesture.js.map +1 -0
- package/dist/dev/ui/gesture/use-doubletap-gesture.d.ts +14 -0
- package/dist/dev/ui/gesture/use-doubletap-gesture.d.ts.map +1 -0
- package/dist/dev/ui/gesture/use-doubletap-gesture.js +29 -0
- package/dist/dev/ui/gesture/use-doubletap-gesture.js.map +1 -0
- package/dist/dev/ui/gesture/use-tap-gesture.d.ts +14 -0
- package/dist/dev/ui/gesture/use-tap-gesture.d.ts.map +1 -0
- package/dist/dev/ui/gesture/use-tap-gesture.js +29 -0
- package/dist/dev/ui/gesture/use-tap-gesture.js.map +1 -0
- package/dist/dev/ui/hooks/use-slider.d.ts +1 -1
- package/dist/dev/ui/hooks/use-slider.js +1 -1
- package/dist/dev/ui/hooks/use-slider.js.map +1 -1
- package/dist/dev/ui/hotkey/media-hotkey.d.ts +21 -0
- package/dist/dev/ui/hotkey/media-hotkey.d.ts.map +1 -0
- package/dist/dev/ui/hotkey/media-hotkey.js +41 -0
- package/dist/dev/ui/hotkey/media-hotkey.js.map +1 -0
- package/dist/dev/ui/hotkey/use-aria-key-shortcuts.d.ts +5 -0
- package/dist/dev/ui/hotkey/use-aria-key-shortcuts.d.ts.map +1 -0
- package/dist/dev/ui/hotkey/use-aria-key-shortcuts.js +16 -0
- package/dist/dev/ui/hotkey/use-aria-key-shortcuts.js.map +1 -0
- package/dist/dev/ui/hotkey/use-hotkey.d.ts +12 -0
- package/dist/dev/ui/hotkey/use-hotkey.d.ts.map +1 -0
- package/dist/dev/ui/hotkey/use-hotkey.js +32 -0
- package/dist/dev/ui/hotkey/use-hotkey.js.map +1 -0
- package/dist/dev/ui/mute-button/mute-button.d.ts.map +1 -1
- package/dist/dev/ui/mute-button/mute-button.js +2 -1
- package/dist/dev/ui/mute-button/mute-button.js.map +1 -1
- package/dist/dev/ui/pip-button/pip-button.d.ts.map +1 -1
- package/dist/dev/ui/pip-button/pip-button.js +2 -1
- package/dist/dev/ui/pip-button/pip-button.js.map +1 -1
- package/dist/dev/ui/play-button/play-button.d.ts.map +1 -1
- package/dist/dev/ui/play-button/play-button.js +2 -1
- package/dist/dev/ui/play-button/play-button.js.map +1 -1
- package/dist/dev/ui/time-slider/time-slider-root.js +2 -2
- package/dist/dev/ui/time-slider/time-slider-root.js.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GesturePointerType, GestureRegion } from "@videojs/core/dom";
|
|
2
|
+
import { RefObject } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/ui/gesture/use-doubletap-gesture.d.ts
|
|
5
|
+
interface UseDoubleTapGestureOptions {
|
|
6
|
+
pointer?: GesturePointerType;
|
|
7
|
+
region?: GestureRegion;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
target?: RefObject<HTMLElement | null>;
|
|
10
|
+
}
|
|
11
|
+
declare function useDoubleTapGesture(onActivate: (event: PointerEvent) => void, options?: UseDoubleTapGestureOptions): void;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { UseDoubleTapGestureOptions, useDoubleTapGesture };
|
|
14
|
+
//# sourceMappingURL=use-doubletap-gesture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-doubletap-gesture.d.ts","names":[],"sources":["../../../../src/ui/gesture/use-doubletap-gesture.ts"],"mappings":";;;;UASiB,0BAAA;EACf,OAAA,GAAU,kBAAA;EACV,MAAA,GAAS,aAAA;EACT,QAAA;EACA,MAAA,GAAS,SAAA,CAAU,WAAA;AAAA;AAAA,iBAGL,mBAAA,CACd,UAAA,GAAa,KAAA,EAAO,YAAA,WACpB,OAAA,GAAU,0BAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContainer } from "../../player/context.js";
|
|
3
|
+
import { useLatestRef } from "../../utils/use-latest-ref.js";
|
|
4
|
+
import { createDoubleTapGesture } from "@videojs/core/dom";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
//#region src/ui/gesture/use-doubletap-gesture.ts
|
|
7
|
+
function useDoubleTapGesture(onActivate, options) {
|
|
8
|
+
const { pointer, region, disabled = false, target } = options ?? {};
|
|
9
|
+
const contextContainer = useContainer();
|
|
10
|
+
const container = target?.current ?? contextContainer;
|
|
11
|
+
const onActivateRef = useLatestRef(onActivate);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!container || disabled) return;
|
|
14
|
+
return createDoubleTapGesture(container, (event) => onActivateRef.current(event), {
|
|
15
|
+
pointer,
|
|
16
|
+
region
|
|
17
|
+
});
|
|
18
|
+
}, [
|
|
19
|
+
container,
|
|
20
|
+
disabled,
|
|
21
|
+
pointer,
|
|
22
|
+
region,
|
|
23
|
+
onActivateRef
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useDoubleTapGesture };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=use-doubletap-gesture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-doubletap-gesture.js","names":[],"sources":["../../../../src/ui/gesture/use-doubletap-gesture.ts"],"sourcesContent":["'use client';\n\nimport { createDoubleTapGesture, type GesturePointerType, type GestureRegion } from '@videojs/core/dom';\nimport type { RefObject } from 'react';\nimport { useEffect } from 'react';\n\nimport { useContainer } from '../../player/context';\nimport { useLatestRef } from '../../utils/use-latest-ref';\n\nexport interface UseDoubleTapGestureOptions {\n pointer?: GesturePointerType;\n region?: GestureRegion;\n disabled?: boolean;\n target?: RefObject<HTMLElement | null>;\n}\n\nexport function useDoubleTapGesture(\n onActivate: (event: PointerEvent) => void,\n options?: UseDoubleTapGestureOptions\n): void {\n const { pointer, region, disabled = false, target } = options ?? {};\n const contextContainer = useContainer();\n const container = target?.current ?? contextContainer;\n const onActivateRef = useLatestRef(onActivate);\n\n useEffect(() => {\n if (!container || disabled) return;\n\n return createDoubleTapGesture(container, (event) => onActivateRef.current(event), { pointer, region });\n }, [container, disabled, pointer, region, onActivateRef]);\n}\n"],"mappings":";;;;;;AAgBA,SAAgB,oBACd,YACA,SACM;CACN,MAAM,EAAE,SAAS,QAAQ,WAAW,OAAO,WAAW,WAAW,EAAE;CACnE,MAAM,mBAAmB,cAAc;CACvC,MAAM,YAAY,QAAQ,WAAW;CACrC,MAAM,gBAAgB,aAAa,WAAW;AAE9C,iBAAgB;AACd,MAAI,CAAC,aAAa,SAAU;AAE5B,SAAO,uBAAuB,YAAY,UAAU,cAAc,QAAQ,MAAM,EAAE;GAAE;GAAS;GAAQ,CAAC;IACrG;EAAC;EAAW;EAAU;EAAS;EAAQ;EAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GesturePointerType, GestureRegion } from "@videojs/core/dom";
|
|
2
|
+
import { RefObject } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/ui/gesture/use-tap-gesture.d.ts
|
|
5
|
+
interface UseTapGestureOptions {
|
|
6
|
+
pointer?: GesturePointerType;
|
|
7
|
+
region?: GestureRegion;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
target?: RefObject<HTMLElement | null>;
|
|
10
|
+
}
|
|
11
|
+
declare function useTapGesture(onActivate: (event: PointerEvent) => void, options?: UseTapGestureOptions): void;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { UseTapGestureOptions, useTapGesture };
|
|
14
|
+
//# sourceMappingURL=use-tap-gesture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tap-gesture.d.ts","names":[],"sources":["../../../../src/ui/gesture/use-tap-gesture.ts"],"mappings":";;;;UASiB,oBAAA;EACf,OAAA,GAAU,kBAAA;EACV,MAAA,GAAS,aAAA;EACT,QAAA;EACA,MAAA,GAAS,SAAA,CAAU,WAAA;AAAA;AAAA,iBAGL,aAAA,CAAc,UAAA,GAAa,KAAA,EAAO,YAAA,WAAuB,OAAA,GAAU,oBAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContainer } from "../../player/context.js";
|
|
3
|
+
import { useLatestRef } from "../../utils/use-latest-ref.js";
|
|
4
|
+
import { createTapGesture } from "@videojs/core/dom";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
//#region src/ui/gesture/use-tap-gesture.ts
|
|
7
|
+
function useTapGesture(onActivate, options) {
|
|
8
|
+
const { pointer, region, disabled = false, target } = options ?? {};
|
|
9
|
+
const contextContainer = useContainer();
|
|
10
|
+
const container = target?.current ?? contextContainer;
|
|
11
|
+
const onActivateRef = useLatestRef(onActivate);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!container || disabled) return;
|
|
14
|
+
return createTapGesture(container, (event) => onActivateRef.current(event), {
|
|
15
|
+
pointer,
|
|
16
|
+
region
|
|
17
|
+
});
|
|
18
|
+
}, [
|
|
19
|
+
container,
|
|
20
|
+
disabled,
|
|
21
|
+
pointer,
|
|
22
|
+
region,
|
|
23
|
+
onActivateRef
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useTapGesture };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=use-tap-gesture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tap-gesture.js","names":[],"sources":["../../../../src/ui/gesture/use-tap-gesture.ts"],"sourcesContent":["'use client';\n\nimport { createTapGesture, type GesturePointerType, type GestureRegion } from '@videojs/core/dom';\nimport type { RefObject } from 'react';\nimport { useEffect } from 'react';\n\nimport { useContainer } from '../../player/context';\nimport { useLatestRef } from '../../utils/use-latest-ref';\n\nexport interface UseTapGestureOptions {\n pointer?: GesturePointerType;\n region?: GestureRegion;\n disabled?: boolean;\n target?: RefObject<HTMLElement | null>;\n}\n\nexport function useTapGesture(onActivate: (event: PointerEvent) => void, options?: UseTapGestureOptions): void {\n const { pointer, region, disabled = false, target } = options ?? {};\n const contextContainer = useContainer();\n const container = target?.current ?? contextContainer;\n const onActivateRef = useLatestRef(onActivate);\n\n useEffect(() => {\n if (!container || disabled) return;\n\n return createTapGesture(container, (event) => onActivateRef.current(event), { pointer, region });\n }, [container, disabled, pointer, region, onActivateRef]);\n}\n"],"mappings":";;;;;;AAgBA,SAAgB,cAAc,YAA2C,SAAsC;CAC7G,MAAM,EAAE,SAAS,QAAQ,WAAW,OAAO,WAAW,WAAW,EAAE;CACnE,MAAM,mBAAmB,cAAc;CACvC,MAAM,YAAY,QAAQ,WAAW;CACrC,MAAM,gBAAgB,aAAa,WAAW;AAE9C,iBAAgB;AACd,MAAI,CAAC,aAAa,SAAU;AAE5B,SAAO,iBAAiB,YAAY,UAAU,cAAc,QAAQ,MAAM,EAAE;GAAE;GAAS;GAAQ,CAAC;IAC/F;EAAC;EAAW;EAAU;EAAS;EAAQ;EAAc,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { SliderInput, SliderState } from "@videojs/core";
|
|
|
2
2
|
import { SliderOptions, SliderRootProps, SliderRootStyle, SliderThumbProps } from "@videojs/core/dom";
|
|
3
3
|
|
|
4
4
|
//#region src/ui/hooks/use-slider.d.ts
|
|
5
|
-
interface UseSliderOptions<State extends SliderState = SliderState> extends Pick<SliderOptions, 'getPercent' | 'getStepPercent' | 'getLargeStepPercent' | '
|
|
5
|
+
interface UseSliderOptions<State extends SliderState = SliderState> extends Pick<SliderOptions, 'getPercent' | 'getStepPercent' | 'getLargeStepPercent' | 'changeThrottle' | 'onValueChange' | 'onValueCommit' | 'onDragStart' | 'onDragEnd'> {
|
|
6
6
|
computeState: (input: SliderInput) => State;
|
|
7
7
|
orientation?: 'horizontal' | 'vertical' | undefined;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
@@ -29,7 +29,7 @@ function useSlider(options) {
|
|
|
29
29
|
getPercent: () => optionsRef.current.getPercent(),
|
|
30
30
|
getStepPercent: () => optionsRef.current.getStepPercent(),
|
|
31
31
|
getLargeStepPercent: () => optionsRef.current.getLargeStepPercent(),
|
|
32
|
-
|
|
32
|
+
changeThrottle: optionsRef.current.changeThrottle,
|
|
33
33
|
adjustPercent: optionsRef.current.adjustPercent,
|
|
34
34
|
onValueChange: (percent) => optionsRef.current.onValueChange?.(percent),
|
|
35
35
|
onValueCommit: (percent) => optionsRef.current.onValueCommit?.(percent),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-slider.js","names":[],"sources":["../../../../src/ui/hooks/use-slider.ts"],"sourcesContent":["'use client';\n\nimport type { SliderInput, SliderState } from '@videojs/core';\nimport {\n createSlider,\n type SliderApi,\n type SliderOptions,\n type SliderRootProps,\n type SliderRootStyle,\n type SliderThumbProps,\n} from '@videojs/core/dom';\nimport { useSnapshot } from '@videojs/store/react';\nimport { isRTL } from '@videojs/utils/dom';\nimport { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { useDestroy } from '../../utils/use-destroy';\nimport { useForceRender } from '../../utils/use-force-render';\nimport { useLatestRef } from '../../utils/use-latest-ref';\n\nexport interface UseSliderOptions<State extends SliderState = SliderState>\n extends Pick<\n SliderOptions,\n | 'getPercent'\n | 'getStepPercent'\n | 'getLargeStepPercent'\n | '
|
|
1
|
+
{"version":3,"file":"use-slider.js","names":[],"sources":["../../../../src/ui/hooks/use-slider.ts"],"sourcesContent":["'use client';\n\nimport type { SliderInput, SliderState } from '@videojs/core';\nimport {\n createSlider,\n type SliderApi,\n type SliderOptions,\n type SliderRootProps,\n type SliderRootStyle,\n type SliderThumbProps,\n} from '@videojs/core/dom';\nimport { useSnapshot } from '@videojs/store/react';\nimport { isRTL } from '@videojs/utils/dom';\nimport { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { useDestroy } from '../../utils/use-destroy';\nimport { useForceRender } from '../../utils/use-force-render';\nimport { useLatestRef } from '../../utils/use-latest-ref';\n\nexport interface UseSliderOptions<State extends SliderState = SliderState>\n extends Pick<\n SliderOptions,\n | 'getPercent'\n | 'getStepPercent'\n | 'getLargeStepPercent'\n | 'changeThrottle'\n | 'onValueChange'\n | 'onValueCommit'\n | 'onDragStart'\n | 'onDragEnd'\n > {\n computeState: (input: SliderInput) => State;\n orientation?: 'horizontal' | 'vertical' | undefined;\n disabled?: boolean | undefined;\n /** Adjust a raw 0–100 percent for thumb alignment. Called for fill and pointer percents. */\n adjustPercent?: ((rawPercent: number, thumbSize: number, trackSize: number) => number) | undefined;\n /** Compute CSS variable map from the (possibly alignment-adjusted) state. */\n getCSSVars: (state: State) => Record<string, string>;\n}\n\nexport interface UseSliderReturnValue<State extends SliderState = SliderState> {\n state: State;\n cssVars: Record<string, string>;\n rootRef: React.RefCallback<HTMLElement>;\n thumbRef: React.RefCallback<HTMLElement>;\n rootProps: SliderRootProps;\n rootStyle: SliderRootStyle;\n thumbProps: SliderThumbProps;\n}\n\n/**\n * Manages slider input lifecycle for React.\n *\n * Wraps `createSlider()` from `@videojs/core/dom` and subscribes to its\n * input state via `useSnapshot`. Returns split props for the root\n * (pointer events) and thumb (keyboard/focus) elements.\n */\nexport function useSlider<State extends SliderState = SliderState>(\n options: UseSliderOptions<State>\n): UseSliderReturnValue<State> {\n const optionsRef = useLatestRef(options);\n\n const rootElementRef = useRef<HTMLElement | null>(null);\n const thumbElementRef = useRef<HTMLElement | null>(null);\n const forceRender = useForceRender();\n\n // Lazy-init the slider handle. Stable across re-renders.\n const [slider] = useState<SliderApi>(() => {\n const stableOptions: SliderOptions = {\n getElement: () => rootElementRef.current!,\n getThumbElement: () => thumbElementRef.current,\n getOrientation: () => optionsRef.current.orientation ?? 'horizontal',\n isRTL: () => (rootElementRef.current ? isRTL(rootElementRef.current) : false),\n isDisabled: () => optionsRef.current.disabled ?? false,\n getPercent: () => optionsRef.current.getPercent(),\n getStepPercent: () => optionsRef.current.getStepPercent(),\n getLargeStepPercent: () => optionsRef.current.getLargeStepPercent(),\n changeThrottle: optionsRef.current.changeThrottle,\n adjustPercent: optionsRef.current.adjustPercent,\n onValueChange: (percent) => optionsRef.current.onValueChange?.(percent),\n onValueCommit: (percent) => optionsRef.current.onValueCommit?.(percent),\n onDragStart: () => optionsRef.current.onDragStart?.(),\n onDragEnd: () => optionsRef.current.onDragEnd?.(),\n };\n\n return createSlider(stableOptions);\n });\n\n useDestroy(slider);\n\n // Subscribe to slider input state.\n const input = useSnapshot(slider.input);\n\n // Compute derived state from input + caller-provided projection.\n const state = options.computeState(input);\n\n // Force a synchronous re-render after mount so edge thumb alignment\n // can read DOM measurements from the now-populated element refs.\n useLayoutEffect(() => {\n if (state.thumbAlignment === 'edge' && rootElementRef.current && thumbElementRef.current) {\n forceRender();\n }\n }, [state.thumbAlignment]);\n\n // Adjust CSS var percents for edge thumb alignment using live DOM measurements.\n const cssVars = options.getCSSVars(slider.adjustForAlignment(state));\n\n // Ref callbacks for root and thumb elements.\n const rootRef = useCallback((element: HTMLElement | null) => {\n rootElementRef.current = element;\n }, []);\n\n const thumbRef = useCallback((element: HTMLElement | null) => {\n thumbElementRef.current = element;\n }, []);\n\n return {\n state,\n cssVars,\n rootRef,\n thumbRef,\n rootProps: slider.rootProps,\n rootStyle: slider.rootStyle,\n thumbProps: slider.thumbProps,\n };\n}\n\nexport namespace useSlider {\n export type Options = UseSliderOptions;\n export type ReturnValue = UseSliderReturnValue;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwDA,SAAgB,UACd,SAC6B;CAC7B,MAAM,aAAa,aAAa,QAAQ;CAExC,MAAM,iBAAiB,OAA2B,KAAK;CACvD,MAAM,kBAAkB,OAA2B,KAAK;CACxD,MAAM,cAAc,gBAAgB;CAGpC,MAAM,CAAC,UAAU,eAA0B;AAkBzC,SAAO,aAjB8B;GACnC,kBAAkB,eAAe;GACjC,uBAAuB,gBAAgB;GACvC,sBAAsB,WAAW,QAAQ,eAAe;GACxD,aAAc,eAAe,UAAU,MAAM,eAAe,QAAQ,GAAG;GACvE,kBAAkB,WAAW,QAAQ,YAAY;GACjD,kBAAkB,WAAW,QAAQ,YAAY;GACjD,sBAAsB,WAAW,QAAQ,gBAAgB;GACzD,2BAA2B,WAAW,QAAQ,qBAAqB;GACnE,gBAAgB,WAAW,QAAQ;GACnC,eAAe,WAAW,QAAQ;GAClC,gBAAgB,YAAY,WAAW,QAAQ,gBAAgB,QAAQ;GACvE,gBAAgB,YAAY,WAAW,QAAQ,gBAAgB,QAAQ;GACvE,mBAAmB,WAAW,QAAQ,eAAe;GACrD,iBAAiB,WAAW,QAAQ,aAAa;GAClD,CAEiC;GAClC;AAEF,YAAW,OAAO;CAGlB,MAAM,QAAQ,YAAY,OAAO,MAAM;CAGvC,MAAM,QAAQ,QAAQ,aAAa,MAAM;AAIzC,uBAAsB;AACpB,MAAI,MAAM,mBAAmB,UAAU,eAAe,WAAW,gBAAgB,QAC/E,cAAa;IAEd,CAAC,MAAM,eAAe,CAAC;AAc1B,QAAO;EACL;EACA,SAbc,QAAQ,WAAW,OAAO,mBAAmB,MAAM,CAAC;EAclE,SAXc,aAAa,YAAgC;AAC3D,kBAAe,UAAU;KACxB,EAAE,CAAC;EAUJ,UARe,aAAa,YAAgC;AAC5D,mBAAgB,UAAU;KACzB,EAAE,CAAC;EAOJ,WAAW,OAAO;EAClB,WAAW,OAAO;EAClB,YAAY,OAAO;EACpB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HotkeyActionName } from "@videojs/core/dom";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/ui/hotkey/media-hotkey.d.ts
|
|
5
|
+
interface MediaHotkeyProps {
|
|
6
|
+
keys: string;
|
|
7
|
+
action: HotkeyActionName | (string & {});
|
|
8
|
+
value?: number;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
target?: 'player' | 'document';
|
|
11
|
+
}
|
|
12
|
+
declare function MediaHotkey({
|
|
13
|
+
keys,
|
|
14
|
+
action,
|
|
15
|
+
value,
|
|
16
|
+
disabled,
|
|
17
|
+
target
|
|
18
|
+
}: MediaHotkeyProps): ReactNode;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { MediaHotkey, MediaHotkeyProps };
|
|
21
|
+
//# sourceMappingURL=media-hotkey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-hotkey.d.ts","names":[],"sources":["../../../../src/ui/hotkey/media-hotkey.tsx"],"mappings":";;;;UAciB,gBAAA;EACf,IAAA;EACA,MAAA,EAAQ,gBAAA;EACR,KAAA;EACA,QAAA;EACA,MAAA;AAAA;AAAA,iBAGc,WAAA,CAAA;EAAc,IAAA;EAAM,MAAA;EAAQ,KAAA;EAAO,QAAA;EAAU;AAAA,GAAU,gBAAA,GAAmB,SAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContainer, usePlayer } from "../../player/context.js";
|
|
3
|
+
import { createHotkey, isHotkeyToggleAction, resolveHotkeyAction } from "@videojs/core/dom";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
//#region src/ui/hotkey/media-hotkey.tsx
|
|
6
|
+
function MediaHotkey({ keys, action, value, disabled, target }) {
|
|
7
|
+
const store = usePlayer();
|
|
8
|
+
const container = useContainer();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!container || !keys || !action || disabled) return;
|
|
11
|
+
const resolver = resolveHotkeyAction(action);
|
|
12
|
+
if (!resolver) return;
|
|
13
|
+
return createHotkey(container, {
|
|
14
|
+
keys,
|
|
15
|
+
action,
|
|
16
|
+
target,
|
|
17
|
+
disabled,
|
|
18
|
+
repeatable: !isHotkeyToggleAction(action),
|
|
19
|
+
onActivate: (_event, key) => {
|
|
20
|
+
resolver({
|
|
21
|
+
store,
|
|
22
|
+
key,
|
|
23
|
+
value
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}, [
|
|
28
|
+
container,
|
|
29
|
+
store,
|
|
30
|
+
keys,
|
|
31
|
+
action,
|
|
32
|
+
value,
|
|
33
|
+
disabled,
|
|
34
|
+
target
|
|
35
|
+
]);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { MediaHotkey };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=media-hotkey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-hotkey.js","names":[],"sources":["../../../../src/ui/hotkey/media-hotkey.tsx"],"sourcesContent":["'use client';\n\nimport {\n type AnyPlayerStore,\n createHotkey,\n type HotkeyActionName,\n isHotkeyToggleAction,\n resolveHotkeyAction,\n} from '@videojs/core/dom';\nimport type { ReactNode } from 'react';\nimport { useEffect } from 'react';\n\nimport { useContainer, usePlayer } from '../../player/context';\n\nexport interface MediaHotkeyProps {\n keys: string;\n action: HotkeyActionName | (string & {});\n value?: number;\n disabled?: boolean;\n target?: 'player' | 'document';\n}\n\nexport function MediaHotkey({ keys, action, value, disabled, target }: MediaHotkeyProps): ReactNode {\n const store = usePlayer() as AnyPlayerStore;\n const container = useContainer();\n\n useEffect(() => {\n if (!container || !keys || !action || disabled) return;\n\n const resolver = resolveHotkeyAction(action);\n if (!resolver) return;\n\n return createHotkey(container, {\n keys,\n action,\n target,\n disabled,\n repeatable: !isHotkeyToggleAction(action),\n onActivate: (_event, key) => {\n resolver({ store, key, value });\n },\n });\n }, [container, store, keys, action, value, disabled, target]);\n\n return null;\n}\n"],"mappings":";;;;;AAsBA,SAAgB,YAAY,EAAE,MAAM,QAAQ,OAAO,UAAU,UAAuC;CAClG,MAAM,QAAQ,WAAW;CACzB,MAAM,YAAY,cAAc;AAEhC,iBAAgB;AACd,MAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,SAAU;EAEhD,MAAM,WAAW,oBAAoB,OAAO;AAC5C,MAAI,CAAC,SAAU;AAEf,SAAO,aAAa,WAAW;GAC7B;GACA;GACA;GACA;GACA,YAAY,CAAC,qBAAqB,OAAO;GACzC,aAAa,QAAQ,QAAQ;AAC3B,aAAS;KAAE;KAAO;KAAK;KAAO,CAAC;;GAElC,CAAC;IACD;EAAC;EAAW;EAAO;EAAM;EAAQ;EAAO;EAAU;EAAO,CAAC;AAE7D,QAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-aria-key-shortcuts.d.ts","names":[],"sources":["../../../../src/ui/hotkey/use-aria-key-shortcuts.ts"],"mappings":";iBAOgB,mBAAA,CAAoB,MAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContainer } from "../../player/context.js";
|
|
3
|
+
import { findHotkeyCoordinator } from "@videojs/core/dom";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
//#region src/ui/hotkey/use-aria-key-shortcuts.ts
|
|
6
|
+
function useAriaKeyShortcuts(action) {
|
|
7
|
+
const container = useContainer();
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
if (!container || !action) return void 0;
|
|
10
|
+
return findHotkeyCoordinator(container)?.getAriaKeys(action);
|
|
11
|
+
}, [container, action]);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { useAriaKeyShortcuts };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=use-aria-key-shortcuts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-aria-key-shortcuts.js","names":[],"sources":["../../../../src/ui/hotkey/use-aria-key-shortcuts.ts"],"sourcesContent":["'use client';\n\nimport { findHotkeyCoordinator } from '@videojs/core/dom';\nimport { useMemo } from 'react';\n\nimport { useContainer } from '../../player/context';\n\nexport function useAriaKeyShortcuts(action: string | undefined): string | undefined {\n const container = useContainer();\n return useMemo(() => {\n if (!container || !action) return undefined;\n return findHotkeyCoordinator(container)?.getAriaKeys(action);\n }, [container, action]);\n}\n"],"mappings":";;;;;AAOA,SAAgB,oBAAoB,QAAgD;CAClF,MAAM,YAAY,cAAc;AAChC,QAAO,cAAc;AACnB,MAAI,CAAC,aAAa,CAAC,OAAQ,QAAO,KAAA;AAClC,SAAO,sBAAsB,UAAU,EAAE,YAAY,OAAO;IAC3D,CAAC,WAAW,OAAO,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/ui/hotkey/use-hotkey.d.ts
|
|
2
|
+
interface UseHotkeyOptions {
|
|
3
|
+
keys: string;
|
|
4
|
+
onActivate: (event: KeyboardEvent, key: string) => void;
|
|
5
|
+
target?: 'player' | 'document';
|
|
6
|
+
repeatable?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function useHotkey(options: UseHotkeyOptions): void;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { UseHotkeyOptions, useHotkey };
|
|
12
|
+
//# sourceMappingURL=use-hotkey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-hotkey.d.ts","names":[],"sources":["../../../../src/ui/hotkey/use-hotkey.ts"],"mappings":";UAQiB,gBAAA;EACf,IAAA;EACA,UAAA,GAAa,KAAA,EAAO,aAAA,EAAe,GAAA;EACnC,MAAA;EACA,UAAA;EACA,QAAA;AAAA;AAAA,iBAGc,SAAA,CAAU,OAAA,EAAS,gBAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContainer } from "../../player/context.js";
|
|
3
|
+
import { useLatestRef } from "../../utils/use-latest-ref.js";
|
|
4
|
+
import { createHotkey } from "@videojs/core/dom";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
//#region src/ui/hotkey/use-hotkey.ts
|
|
7
|
+
function useHotkey(options) {
|
|
8
|
+
const { keys, target = "player", repeatable = true, disabled = false } = options;
|
|
9
|
+
const container = useContainer();
|
|
10
|
+
const onActivateRef = useLatestRef(options.onActivate);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!container || !keys || disabled) return;
|
|
13
|
+
return createHotkey(container, {
|
|
14
|
+
keys,
|
|
15
|
+
target,
|
|
16
|
+
repeatable,
|
|
17
|
+
disabled,
|
|
18
|
+
onActivate: (event, key) => onActivateRef.current(event, key)
|
|
19
|
+
});
|
|
20
|
+
}, [
|
|
21
|
+
container,
|
|
22
|
+
keys,
|
|
23
|
+
target,
|
|
24
|
+
repeatable,
|
|
25
|
+
disabled,
|
|
26
|
+
onActivateRef
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { useHotkey };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=use-hotkey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-hotkey.js","names":[],"sources":["../../../../src/ui/hotkey/use-hotkey.ts"],"sourcesContent":["'use client';\n\nimport { createHotkey } from '@videojs/core/dom';\nimport { useEffect } from 'react';\n\nimport { useContainer } from '../../player/context';\nimport { useLatestRef } from '../../utils/use-latest-ref';\n\nexport interface UseHotkeyOptions {\n keys: string;\n onActivate: (event: KeyboardEvent, key: string) => void;\n target?: 'player' | 'document';\n repeatable?: boolean;\n disabled?: boolean;\n}\n\nexport function useHotkey(options: UseHotkeyOptions): void {\n const { keys, target = 'player', repeatable = true, disabled = false } = options;\n const container = useContainer();\n const onActivateRef = useLatestRef(options.onActivate);\n\n useEffect(() => {\n if (!container || !keys || disabled) return;\n\n return createHotkey(container, {\n keys,\n target,\n repeatable,\n disabled,\n onActivate: (event, key) => onActivateRef.current(event, key),\n });\n }, [container, keys, target, repeatable, disabled, onActivateRef]);\n}\n"],"mappings":";;;;;;AAgBA,SAAgB,UAAU,SAAiC;CACzD,MAAM,EAAE,MAAM,SAAS,UAAU,aAAa,MAAM,WAAW,UAAU;CACzE,MAAM,YAAY,cAAc;CAChC,MAAM,gBAAgB,aAAa,QAAQ,WAAW;AAEtD,iBAAgB;AACd,MAAI,CAAC,aAAa,CAAC,QAAQ,SAAU;AAErC,SAAO,aAAa,WAAW;GAC7B;GACA;GACA;GACA;GACA,aAAa,OAAO,QAAQ,cAAc,QAAQ,OAAO,IAAI;GAC9D,CAAC;IACD;EAAC;EAAW;EAAM;EAAQ;EAAY;EAAU;EAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mute-button.d.ts","names":[],"sources":["../../../../src/ui/mute-button/mute-button.tsx"],"mappings":";;;;;UAQiB,eAAA,SAAwB,gBAAA,WAA2B,cAAA,CAAe,KAAA,GAAQ,cAAA,CAAe,KAAA;;cAG7F,UAAA,EAAU,KAAA,CAAA,yBAAA,CAAA,eAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"mute-button.d.ts","names":[],"sources":["../../../../src/ui/mute-button/mute-button.tsx"],"mappings":";;;;;UAQiB,eAAA,SAAwB,gBAAA,WAA2B,cAAA,CAAe,KAAA,GAAQ,cAAA,CAAe,KAAA;;cAG7F,UAAA,EAAU,KAAA,CAAA,yBAAA,CAAA,eAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA;AAAA,kBASN,UAAA;EAAA,KACH,KAAA,GAAQ,eAAA;EAAA,KACR,KAAA,GAAQ,cAAA,CAAe,KAAA;AAAA"}
|
|
@@ -9,7 +9,8 @@ const MuteButton = createMediaButton({
|
|
|
9
9
|
core: MuteButtonCore,
|
|
10
10
|
stateAttrMap: MuteButtonDataAttrs,
|
|
11
11
|
selector: selectVolume,
|
|
12
|
-
action: (core, state) => core.toggle(state)
|
|
12
|
+
action: (core, state) => core.toggle(state),
|
|
13
|
+
hotkeyAction: "toggleMuted"
|
|
13
14
|
});
|
|
14
15
|
//#endregion
|
|
15
16
|
export { MuteButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mute-button.js","names":[],"sources":["../../../../src/ui/mute-button/mute-button.tsx"],"sourcesContent":["'use client';\n\nimport { MuteButtonCore, MuteButtonDataAttrs } from '@videojs/core';\nimport { selectVolume } from '@videojs/core/dom';\n\nimport type { UIComponentProps } from '../../utils/types';\nimport { createMediaButton } from '../create-media-button';\n\nexport interface MuteButtonProps extends UIComponentProps<'button', MuteButtonCore.State>, MuteButtonCore.Props {}\n\n/** A button that toggles mute state. */\nexport const MuteButton = createMediaButton<MuteButtonCore, MuteButtonProps>({\n displayName: 'MuteButton',\n core: MuteButtonCore,\n stateAttrMap: MuteButtonDataAttrs,\n selector: selectVolume,\n action: (core, state) => core.toggle(state),\n});\n\nexport namespace MuteButton {\n export type Props = MuteButtonProps;\n export type State = MuteButtonCore.State;\n}\n"],"mappings":";;;;;;AAWA,MAAa,aAAa,kBAAmD;CAC3E,aAAa;CACb,MAAM;CACN,cAAc;CACd,UAAU;CACV,SAAS,MAAM,UAAU,KAAK,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"mute-button.js","names":[],"sources":["../../../../src/ui/mute-button/mute-button.tsx"],"sourcesContent":["'use client';\n\nimport { MuteButtonCore, MuteButtonDataAttrs } from '@videojs/core';\nimport { selectVolume } from '@videojs/core/dom';\n\nimport type { UIComponentProps } from '../../utils/types';\nimport { createMediaButton } from '../create-media-button';\n\nexport interface MuteButtonProps extends UIComponentProps<'button', MuteButtonCore.State>, MuteButtonCore.Props {}\n\n/** A button that toggles mute state. */\nexport const MuteButton = createMediaButton<MuteButtonCore, MuteButtonProps>({\n displayName: 'MuteButton',\n core: MuteButtonCore,\n stateAttrMap: MuteButtonDataAttrs,\n selector: selectVolume,\n action: (core, state) => core.toggle(state),\n hotkeyAction: 'toggleMuted',\n});\n\nexport namespace MuteButton {\n export type Props = MuteButtonProps;\n export type State = MuteButtonCore.State;\n}\n"],"mappings":";;;;;;AAWA,MAAa,aAAa,kBAAmD;CAC3E,aAAa;CACb,MAAM;CACN,cAAc;CACd,UAAU;CACV,SAAS,MAAM,UAAU,KAAK,OAAO,MAAM;CAC3C,cAAc;CACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pip-button.d.ts","names":[],"sources":["../../../../src/ui/pip-button/pip-button.tsx"],"mappings":";;;;;UAQiB,cAAA,SAAuB,gBAAA,WAA2B,aAAA,CAAc,KAAA,GAAQ,aAAA,CAAc,KAAA;;cAG1F,SAAA,EAAS,KAAA,CAAA,yBAAA,CAAA,cAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"pip-button.d.ts","names":[],"sources":["../../../../src/ui/pip-button/pip-button.tsx"],"mappings":";;;;;UAQiB,cAAA,SAAuB,gBAAA,WAA2B,aAAA,CAAc,KAAA,GAAQ,aAAA,CAAc,KAAA;;cAG1F,SAAA,EAAS,KAAA,CAAA,yBAAA,CAAA,cAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA;AAAA,kBASL,SAAA;EAAA,KACH,KAAA,GAAQ,cAAA;EAAA,KACR,KAAA,GAAQ,aAAA,CAAc,KAAA;AAAA"}
|
|
@@ -9,7 +9,8 @@ const PiPButton = createMediaButton({
|
|
|
9
9
|
core: PiPButtonCore,
|
|
10
10
|
stateAttrMap: PiPButtonDataAttrs,
|
|
11
11
|
selector: selectPiP,
|
|
12
|
-
action: (core, state) => core.toggle(state)
|
|
12
|
+
action: (core, state) => core.toggle(state),
|
|
13
|
+
hotkeyAction: "togglePictureInPicture"
|
|
13
14
|
});
|
|
14
15
|
//#endregion
|
|
15
16
|
export { PiPButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pip-button.js","names":[],"sources":["../../../../src/ui/pip-button/pip-button.tsx"],"sourcesContent":["'use client';\n\nimport { PiPButtonCore, PiPButtonDataAttrs } from '@videojs/core';\nimport { selectPiP } from '@videojs/core/dom';\n\nimport type { UIComponentProps } from '../../utils/types';\nimport { createMediaButton } from '../create-media-button';\n\nexport interface PiPButtonProps extends UIComponentProps<'button', PiPButtonCore.State>, PiPButtonCore.Props {}\n\n/** A button that toggles picture-in-picture. */\nexport const PiPButton = createMediaButton<PiPButtonCore, PiPButtonProps>({\n displayName: 'PiPButton',\n core: PiPButtonCore,\n stateAttrMap: PiPButtonDataAttrs,\n selector: selectPiP,\n action: (core, state) => core.toggle(state),\n});\n\nexport namespace PiPButton {\n export type Props = PiPButtonProps;\n export type State = PiPButtonCore.State;\n}\n"],"mappings":";;;;;;AAWA,MAAa,YAAY,kBAAiD;CACxE,aAAa;CACb,MAAM;CACN,cAAc;CACd,UAAU;CACV,SAAS,MAAM,UAAU,KAAK,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"pip-button.js","names":[],"sources":["../../../../src/ui/pip-button/pip-button.tsx"],"sourcesContent":["'use client';\n\nimport { PiPButtonCore, PiPButtonDataAttrs } from '@videojs/core';\nimport { selectPiP } from '@videojs/core/dom';\n\nimport type { UIComponentProps } from '../../utils/types';\nimport { createMediaButton } from '../create-media-button';\n\nexport interface PiPButtonProps extends UIComponentProps<'button', PiPButtonCore.State>, PiPButtonCore.Props {}\n\n/** A button that toggles picture-in-picture. */\nexport const PiPButton = createMediaButton<PiPButtonCore, PiPButtonProps>({\n displayName: 'PiPButton',\n core: PiPButtonCore,\n stateAttrMap: PiPButtonDataAttrs,\n selector: selectPiP,\n action: (core, state) => core.toggle(state),\n hotkeyAction: 'togglePictureInPicture',\n});\n\nexport namespace PiPButton {\n export type Props = PiPButtonProps;\n export type State = PiPButtonCore.State;\n}\n"],"mappings":";;;;;;AAWA,MAAa,YAAY,kBAAiD;CACxE,aAAa;CACb,MAAM;CACN,cAAc;CACd,UAAU;CACV,SAAS,MAAM,UAAU,KAAK,OAAO,MAAM;CAC3C,cAAc;CACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play-button.d.ts","names":[],"sources":["../../../../src/ui/play-button/play-button.tsx"],"mappings":";;;;;UAQiB,eAAA,SAAwB,gBAAA,WAA2B,cAAA,CAAe,KAAA,GAAQ,cAAA,CAAe,KAAA;;AAA1G;;;;;;;;;;;;;;;cAkBa,UAAA,EAAU,KAAA,CAAA,yBAAA,CAAA,eAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"play-button.d.ts","names":[],"sources":["../../../../src/ui/play-button/play-button.tsx"],"mappings":";;;;;UAQiB,eAAA,SAAwB,gBAAA,WAA2B,cAAA,CAAe,KAAA,GAAQ,cAAA,CAAe,KAAA;;AAA1G;;;;;;;;;;;;;;;cAkBa,UAAA,EAAU,KAAA,CAAA,yBAAA,CAAA,eAAA,GAAA,KAAA,CAAA,aAAA,CAAA,iBAAA;AAAA,kBASN,UAAA;EAAA,KACH,KAAA,GAAQ,eAAA;EAAA,KACR,KAAA,GAAQ,cAAA,CAAe,KAAA;AAAA"}
|
|
@@ -24,7 +24,8 @@ const PlayButton = createMediaButton({
|
|
|
24
24
|
core: PlayButtonCore,
|
|
25
25
|
stateAttrMap: PlayButtonDataAttrs,
|
|
26
26
|
selector: selectPlayback,
|
|
27
|
-
action: (core, state) => core.toggle(state)
|
|
27
|
+
action: (core, state) => core.toggle(state),
|
|
28
|
+
hotkeyAction: "togglePaused"
|
|
28
29
|
});
|
|
29
30
|
//#endregion
|
|
30
31
|
export { PlayButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play-button.js","names":[],"sources":["../../../../src/ui/play-button/play-button.tsx"],"sourcesContent":["'use client';\n\nimport { PlayButtonCore, PlayButtonDataAttrs } from '@videojs/core';\nimport { selectPlayback } from '@videojs/core/dom';\n\nimport type { UIComponentProps } from '../../utils/types';\nimport { createMediaButton } from '../create-media-button';\n\nexport interface PlayButtonProps extends UIComponentProps<'button', PlayButtonCore.State>, PlayButtonCore.Props {}\n\n/**\n * A button that toggles playback.\n *\n * @example\n * ```tsx\n * <PlayButton />\n *\n * <PlayButton\n * render={(props, state) => (\n * <button {...props}>\n * {state.paused ? <PlayIcon /> : <PauseIcon />}\n * </button>\n * )}\n * />\n * ```\n */\nexport const PlayButton = createMediaButton<PlayButtonCore, PlayButtonProps>({\n displayName: 'PlayButton',\n core: PlayButtonCore,\n stateAttrMap: PlayButtonDataAttrs,\n selector: selectPlayback,\n action: (core, state) => core.toggle(state),\n});\n\nexport namespace PlayButton {\n export type Props = PlayButtonProps;\n export type State = PlayButtonCore.State;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,aAAa,kBAAmD;CAC3E,aAAa;CACb,MAAM;CACN,cAAc;CACd,UAAU;CACV,SAAS,MAAM,UAAU,KAAK,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"play-button.js","names":[],"sources":["../../../../src/ui/play-button/play-button.tsx"],"sourcesContent":["'use client';\n\nimport { PlayButtonCore, PlayButtonDataAttrs } from '@videojs/core';\nimport { selectPlayback } from '@videojs/core/dom';\n\nimport type { UIComponentProps } from '../../utils/types';\nimport { createMediaButton } from '../create-media-button';\n\nexport interface PlayButtonProps extends UIComponentProps<'button', PlayButtonCore.State>, PlayButtonCore.Props {}\n\n/**\n * A button that toggles playback.\n *\n * @example\n * ```tsx\n * <PlayButton />\n *\n * <PlayButton\n * render={(props, state) => (\n * <button {...props}>\n * {state.paused ? <PlayIcon /> : <PauseIcon />}\n * </button>\n * )}\n * />\n * ```\n */\nexport const PlayButton = createMediaButton<PlayButtonCore, PlayButtonProps>({\n displayName: 'PlayButton',\n core: PlayButtonCore,\n stateAttrMap: PlayButtonDataAttrs,\n selector: selectPlayback,\n action: (core, state) => core.toggle(state),\n hotkeyAction: 'togglePaused',\n});\n\nexport namespace PlayButton {\n export type Props = PlayButtonProps;\n export type State = PlayButtonCore.State;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,aAAa,kBAAmD;CAC3E,aAAa;CACb,MAAM;CACN,cAAc;CACd,UAAU;CACV,SAAS,MAAM,UAAU,KAAK,OAAO,MAAM;CAC3C,cAAc;CACf,CAAC"}
|
|
@@ -12,7 +12,7 @@ import { formatTime } from "@videojs/utils/time";
|
|
|
12
12
|
//#region src/ui/time-slider/time-slider-root.tsx
|
|
13
13
|
const noopSeek = () => Promise.resolve(0);
|
|
14
14
|
const TimeSliderRoot = forwardRef(function TimeSliderRoot(componentProps, forwardedRef) {
|
|
15
|
-
const { render, className, style, label,
|
|
15
|
+
const { render, className, style, label, changeThrottle = TimeSliderCore.defaultProps.changeThrottle, step = TimeSliderCore.defaultProps.step, largeStep = TimeSliderCore.defaultProps.largeStep, orientation, disabled, thumbAlignment, onDragStart, onDragEnd, ...elementProps } = componentProps;
|
|
16
16
|
const time = usePlayer(selectTime);
|
|
17
17
|
const buffer = usePlayer(selectBuffer);
|
|
18
18
|
const [core] = useState(() => new TimeSliderCore());
|
|
@@ -51,7 +51,7 @@ const TimeSliderRoot = forwardRef(function TimeSliderRoot(componentProps, forwar
|
|
|
51
51
|
getLargeStepPercent: () => core.getLargeStepPercent(),
|
|
52
52
|
orientation,
|
|
53
53
|
disabled,
|
|
54
|
-
|
|
54
|
+
changeThrottle,
|
|
55
55
|
adjustPercent: (rawPercent, thumbSize, trackSize) => core.adjustPercentForAlignment(rawPercent, thumbSize, trackSize),
|
|
56
56
|
getCSSVars: getTimeSliderCSSVars,
|
|
57
57
|
onValueCommit: (percent) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-slider-root.js","names":[],"sources":["../../../../src/ui/time-slider/time-slider-root.tsx"],"sourcesContent":["'use client';\n\nimport { TimeSliderCore, TimeSliderDataAttrs } from '@videojs/core';\nimport { getTimeSliderCSSVars, logMissingFeature, selectBuffer, selectTime } from '@videojs/core/dom';\nimport { formatTime } from '@videojs/utils/time';\nimport { forwardRef, useState } from 'react';\n\nimport { usePlayer } from '../../player/context';\nimport type { UIComponentProps } from '../../utils/types';\nimport { useLatestRef } from '../../utils/use-latest-ref';\nimport { renderElement } from '../../utils/use-render';\nimport { useSlider } from '../hooks/use-slider';\nimport { SliderProvider } from '../slider/context';\n\nconst noopSeek = (): Promise<number> => Promise.resolve(0);\n\nexport interface TimeSliderRootProps extends UIComponentProps<'div', TimeSliderCore.State>, TimeSliderCore.Props {\n onDragStart?: (() => void) | undefined;\n onDragEnd?: (() => void) | undefined;\n}\n\nexport const TimeSliderRoot = forwardRef<HTMLDivElement, TimeSliderRootProps>(\n function TimeSliderRoot(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n label,\n
|
|
1
|
+
{"version":3,"file":"time-slider-root.js","names":[],"sources":["../../../../src/ui/time-slider/time-slider-root.tsx"],"sourcesContent":["'use client';\n\nimport { TimeSliderCore, TimeSliderDataAttrs } from '@videojs/core';\nimport { getTimeSliderCSSVars, logMissingFeature, selectBuffer, selectTime } from '@videojs/core/dom';\nimport { formatTime } from '@videojs/utils/time';\nimport { forwardRef, useState } from 'react';\n\nimport { usePlayer } from '../../player/context';\nimport type { UIComponentProps } from '../../utils/types';\nimport { useLatestRef } from '../../utils/use-latest-ref';\nimport { renderElement } from '../../utils/use-render';\nimport { useSlider } from '../hooks/use-slider';\nimport { SliderProvider } from '../slider/context';\n\nconst noopSeek = (): Promise<number> => Promise.resolve(0);\n\nexport interface TimeSliderRootProps extends UIComponentProps<'div', TimeSliderCore.State>, TimeSliderCore.Props {\n onDragStart?: (() => void) | undefined;\n onDragEnd?: (() => void) | undefined;\n}\n\nexport const TimeSliderRoot = forwardRef<HTMLDivElement, TimeSliderRootProps>(\n function TimeSliderRoot(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n label,\n changeThrottle = TimeSliderCore.defaultProps.changeThrottle,\n step = TimeSliderCore.defaultProps.step,\n largeStep = TimeSliderCore.defaultProps.largeStep,\n orientation,\n disabled,\n thumbAlignment,\n onDragStart,\n onDragEnd,\n ...elementProps\n } = componentProps;\n\n const time = usePlayer(selectTime);\n const buffer = usePlayer(selectBuffer);\n\n const [core] = useState(() => new TimeSliderCore());\n core.setProps({ label, step, largeStep, orientation, disabled, thumbAlignment });\n\n // Keep a ref to the latest media state for callbacks that fire outside the render cycle.\n const mediaRef = useLatestRef(time && buffer ? { ...time, ...buffer } : null);\n\n const duration = time?.duration ?? 0;\n\n const { state, cssVars, rootRef, thumbRef, rootProps, rootStyle, thumbProps } = useSlider<TimeSliderCore.State>({\n computeState: (input) => {\n core.setInput(input);\n if (!time || !buffer) {\n core.setMedia({\n currentTime: 0,\n duration: 0,\n seeking: false,\n seek: noopSeek,\n buffered: [],\n seekable: [],\n });\n } else {\n core.setMedia({ ...time, ...buffer });\n }\n\n return core.getState();\n },\n getPercent: () => (duration > 0 ? ((time?.currentTime ?? 0) / duration) * 100 : 0),\n getStepPercent: () => core.getStepPercent(),\n getLargeStepPercent: () => core.getLargeStepPercent(),\n orientation,\n disabled,\n changeThrottle,\n adjustPercent: (rawPercent, thumbSize, trackSize) =>\n core.adjustPercentForAlignment(rawPercent, thumbSize, trackSize),\n getCSSVars: getTimeSliderCSSVars,\n onValueCommit: (percent) => {\n const media = mediaRef.current;\n if (media) media.seek(core.rawValueFromPercent(percent));\n },\n onDragStart,\n onDragEnd,\n });\n\n if (!time) {\n if (__DEV__) logMissingFeature('TimeSlider', 'time');\n return null;\n }\n\n return (\n <SliderProvider\n value={{\n state,\n pointerValue: core.valueFromPercent(state.pointerPercent),\n thumbRef,\n thumbProps,\n stateAttrMap: TimeSliderDataAttrs,\n getAttrs: (sliderState) => core.getAttrs(sliderState as TimeSliderCore.State),\n formatValue: (value) => formatTime(value, duration),\n }}\n >\n {renderElement(\n 'div',\n { render, className, style },\n {\n state,\n stateAttrMap: TimeSliderDataAttrs,\n ref: [forwardedRef, rootRef],\n props: [{ style: { ...cssVars, ...rootStyle } }, rootProps, elementProps],\n }\n )}\n </SliderProvider>\n );\n }\n);\n\nexport namespace TimeSliderRoot {\n export type Props = TimeSliderRootProps;\n export type State = TimeSliderCore.State;\n}\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,iBAAkC,QAAQ,QAAQ,EAAE;AAO1D,MAAa,iBAAiB,WAC5B,SAAS,eAAe,gBAAgB,cAAc;CACpD,MAAM,EACJ,QACA,WACA,OACA,OACA,iBAAiB,eAAe,aAAa,gBAC7C,OAAO,eAAe,aAAa,MACnC,YAAY,eAAe,aAAa,WACxC,aACA,UACA,gBACA,aACA,WACA,GAAG,iBACD;CAEJ,MAAM,OAAO,UAAU,WAAW;CAClC,MAAM,SAAS,UAAU,aAAa;CAEtC,MAAM,CAAC,QAAQ,eAAe,IAAI,gBAAgB,CAAC;AACnD,MAAK,SAAS;EAAE;EAAO;EAAM;EAAW;EAAa;EAAU;EAAgB,CAAC;CAGhF,MAAM,WAAW,aAAa,QAAQ,SAAS;EAAE,GAAG;EAAM,GAAG;EAAQ,GAAG,KAAK;CAE7E,MAAM,WAAW,MAAM,YAAY;CAEnC,MAAM,EAAE,OAAO,SAAS,SAAS,UAAU,WAAW,WAAW,eAAe,UAAgC;EAC9G,eAAe,UAAU;AACvB,QAAK,SAAS,MAAM;AACpB,OAAI,CAAC,QAAQ,CAAC,OACZ,MAAK,SAAS;IACZ,aAAa;IACb,UAAU;IACV,SAAS;IACT,MAAM;IACN,UAAU,EAAE;IACZ,UAAU,EAAE;IACb,CAAC;OAEF,MAAK,SAAS;IAAE,GAAG;IAAM,GAAG;IAAQ,CAAC;AAGvC,UAAO,KAAK,UAAU;;EAExB,kBAAmB,WAAW,KAAM,MAAM,eAAe,KAAK,WAAY,MAAM;EAChF,sBAAsB,KAAK,gBAAgB;EAC3C,2BAA2B,KAAK,qBAAqB;EACrD;EACA;EACA;EACA,gBAAgB,YAAY,WAAW,cACrC,KAAK,0BAA0B,YAAY,WAAW,UAAU;EAClE,YAAY;EACZ,gBAAgB,YAAY;GAC1B,MAAM,QAAQ,SAAS;AACvB,OAAI,MAAO,OAAM,KAAK,KAAK,oBAAoB,QAAQ,CAAC;;EAE1D;EACA;EACD,CAAC;AAEF,KAAI,CAAC,MAAM;AACI,oBAAkB,cAAc,OAAO;AACpD,SAAO;;AAGT,QACE,oBAAC,gBAAD;EACE,OAAO;GACL;GACA,cAAc,KAAK,iBAAiB,MAAM,eAAe;GACzD;GACA;GACA,cAAc;GACd,WAAW,gBAAgB,KAAK,SAAS,YAAoC;GAC7E,cAAc,UAAU,WAAW,OAAO,SAAS;GACpD;YAEA,cACC,OACA;GAAE;GAAQ;GAAW;GAAO,EAC5B;GACE;GACA,cAAc;GACd,KAAK,CAAC,cAAc,QAAQ;GAC5B,OAAO;IAAC,EAAE,OAAO;KAAE,GAAG;KAAS,GAAG;KAAW,EAAE;IAAE;IAAW;IAAa;GAC1E,CACF;EACc,CAAA;EAGtB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@videojs/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "10.0.0-beta.
|
|
4
|
+
"version": "10.0.0-beta.17",
|
|
5
5
|
"description": "React library for building media players",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -62,25 +62,25 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"react": "
|
|
65
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@videojs/
|
|
69
|
-
"@videojs/store": "10.0.0-beta.
|
|
70
|
-
"@videojs/
|
|
71
|
-
"@videojs/
|
|
68
|
+
"@videojs/spf": "10.0.0-beta.17",
|
|
69
|
+
"@videojs/store": "10.0.0-beta.17",
|
|
70
|
+
"@videojs/utils": "10.0.0-beta.17",
|
|
71
|
+
"@videojs/core": "10.0.0-beta.17"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@testing-library/react": "^16.3.0",
|
|
75
|
-
"@types/react": "^19.2.
|
|
75
|
+
"@types/react": "^19.2.14",
|
|
76
76
|
"jsdom": "^26.1.0",
|
|
77
|
-
"react": "^19.2.
|
|
78
|
-
"react-dom": "^19.2.
|
|
77
|
+
"react": "^19.2.4",
|
|
78
|
+
"react-dom": "^19.2.4",
|
|
79
79
|
"tsdown": "^0.21.4",
|
|
80
80
|
"typescript": "^6.0.2",
|
|
81
81
|
"vitest": "^4.1.0",
|
|
82
|
-
"@videojs/
|
|
83
|
-
"@videojs/
|
|
82
|
+
"@videojs/skins": "10.0.0-beta.17",
|
|
83
|
+
"@videojs/icons": "10.0.0-beta.17"
|
|
84
84
|
},
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|