build(react): build26 from 45504a2b

This commit is contained in:
publish
2026-08-05 18:57:47 +02:00
commit 784a38389b
1955 changed files with 60543 additions and 0 deletions
@@ -0,0 +1,25 @@
"use client";
import { useContainer } from "../../player/context.js";
import { useLatestRef } from "../../utils/use-latest-ref.js";
import { getIndicatorVisibilityCoordinator } from "@videojs/core/dom";
import { useCallback, useEffect, useRef, useState } from "react";
//#region src/ui/input-indicators/use-indicator-visibility.ts
function useIndicatorVisibility(close) {
const container = useContainer();
const closeRef = useLatestRef(close);
const coordinatorRef = useRef(null);
const [handle] = useState(() => ({ close: () => closeRef.current() }));
useEffect(() => {
if (!container) return;
const coordinator = getIndicatorVisibilityCoordinator(container);
coordinatorRef.current = coordinator;
return coordinator.register(handle);
}, [container, handle]);
return useCallback(() => {
coordinatorRef.current?.show(handle);
}, [handle]);
}
//#endregion
export { useIndicatorVisibility };
//# sourceMappingURL=use-indicator-visibility.js.map
@@ -0,0 +1 @@
{"version":3,"file":"use-indicator-visibility.js","names":[],"sources":["../../../../src/ui/input-indicators/use-indicator-visibility.ts"],"sourcesContent":["'use client';\n\nimport type { IndicatorVisibilityHandle } from '@videojs/core';\nimport { getIndicatorVisibilityCoordinator } from '@videojs/core/dom';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useContainer } from '../../player/context';\nimport { useLatestRef } from '../../utils/use-latest-ref';\n\nexport function useIndicatorVisibility(close: () => void): () => void {\n const container = useContainer();\n const closeRef = useLatestRef(close);\n const coordinatorRef = useRef<ReturnType<typeof getIndicatorVisibilityCoordinator> | null>(null);\n const [handle] = useState<IndicatorVisibilityHandle>(() => ({\n close: () => closeRef.current(),\n }));\n\n useEffect(() => {\n if (!container) return;\n\n const coordinator = getIndicatorVisibilityCoordinator(container);\n coordinatorRef.current = coordinator;\n\n return coordinator.register(handle);\n }, [container, handle]);\n\n return useCallback(() => {\n coordinatorRef.current?.show(handle);\n }, [handle]);\n}\n"],"mappings":";;;;;;AASA,SAAgB,uBAAuB,OAA+B;CACpE,MAAM,YAAY,aAAa;CAC/B,MAAM,WAAW,aAAa,KAAK;CACnC,MAAM,iBAAiB,OAAoE,IAAI;CAC/F,MAAM,CAAC,UAAU,gBAA2C,EAC1D,aAAa,SAAS,QAAQ,EAChC,EAAE;CAEF,gBAAgB;EACd,IAAI,CAAC,WAAW;EAEhB,MAAM,cAAc,kCAAkC,SAAS;EAC/D,eAAe,UAAU;EAEzB,OAAO,YAAY,SAAS,MAAM;CACpC,GAAG,CAAC,WAAW,MAAM,CAAC;CAEtB,OAAO,kBAAkB;EACvB,eAAe,SAAS,KAAK,MAAM;CACrC,GAAG,CAAC,MAAM,CAAC;AACb"}
@@ -0,0 +1,22 @@
"use client";
import { useContainer, usePlayer } from "../../player/context.js";
import { useLatestRef } from "../../utils/use-latest-ref.js";
import { getMediaSnapshot, subscribeToInputActions } from "@videojs/core/dom";
import { useEffect } from "react";
//#region src/ui/input-indicators/use-input-action-subscription.ts
function useInputActionSubscription(callback) {
const container = useContainer();
const store = usePlayer();
const callbackRef = useLatestRef(callback);
const storeRef = useLatestRef(store);
useEffect(() => {
if (!container) return;
return subscribeToInputActions(container, (event) => {
callbackRef.current(event, getMediaSnapshot(storeRef.current));
});
}, [container]);
}
//#endregion
export { useInputActionSubscription };
//# sourceMappingURL=use-input-action-subscription.js.map
@@ -0,0 +1 @@
{"version":3,"file":"use-input-action-subscription.js","names":[],"sources":["../../../../src/ui/input-indicators/use-input-action-subscription.ts"],"sourcesContent":["'use client';\n\nimport type { InputActionEvent, MediaSnapshot } from '@videojs/core';\nimport { getMediaSnapshot, subscribeToInputActions } from '@videojs/core/dom';\nimport { useEffect } from 'react';\n\nimport { useContainer, usePlayer } from '../../player/context';\nimport { useLatestRef } from '../../utils/use-latest-ref';\n\nexport function useInputActionSubscription(callback: (event: InputActionEvent, snapshot: MediaSnapshot) => void): void {\n const container = useContainer();\n const store = usePlayer();\n const callbackRef = useLatestRef(callback);\n const storeRef = useLatestRef(store);\n\n useEffect(() => {\n if (!container) return;\n\n return subscribeToInputActions(container, (event) => {\n callbackRef.current(event, getMediaSnapshot(storeRef.current));\n });\n }, [container]);\n}\n"],"mappings":";;;;;;AASA,SAAgB,2BAA2B,UAA4E;CACrH,MAAM,YAAY,aAAa;CAC/B,MAAM,QAAQ,UAAU;CACxB,MAAM,cAAc,aAAa,QAAQ;CACzC,MAAM,WAAW,aAAa,KAAK;CAEnC,gBAAgB;EACd,IAAI,CAAC,WAAW;EAEhB,OAAO,wBAAwB,YAAY,UAAU;GACnD,YAAY,QAAQ,OAAO,iBAAiB,SAAS,OAAO,CAAC;EAC/D,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;AAChB"}
@@ -0,0 +1,21 @@
"use client";
import { useDestroy } from "../../utils/use-destroy.js";
import { useIndicatorVisibility } from "./use-indicator-visibility.js";
import { useInputActionSubscription } from "./use-input-action-subscription.js";
import { useRenderedIndicatorState } from "./use-rendered-indicator-state.js";
import { useState, useSyncExternalStore } from "react";
//#region src/ui/input-indicators/use-input-indicator-root.ts
function useInputIndicatorRoot(createCore, props, options) {
const [core] = useState(createCore);
useDestroy(core);
core.setProps(props);
const showIndicator = useIndicatorVisibility(() => core.close());
useInputActionSubscription((event, snapshot) => {
if (core.processEvent(event, snapshot)) showIndicator();
});
return useRenderedIndicatorState(useSyncExternalStore((callback) => core.state.subscribe(callback), () => core.state.current, () => core.state.current), options);
}
//#endregion
export { useInputIndicatorRoot };
//# sourceMappingURL=use-input-indicator-root.js.map
@@ -0,0 +1 @@
{"version":3,"file":"use-input-indicator-root.js","names":[],"sources":["../../../../src/ui/input-indicators/use-input-indicator-root.ts"],"sourcesContent":["'use client';\n\nimport type { IndicatorLifecycleState, InputActionEvent, MediaSnapshot } from '@videojs/core';\nimport type { State as StoreState } from '@videojs/store';\nimport { useState, useSyncExternalStore } from 'react';\n\nimport { useDestroy } from '../../utils/use-destroy';\nimport { useIndicatorVisibility } from './use-indicator-visibility';\nimport { useInputActionSubscription } from './use-input-action-subscription';\nimport { type RenderedIndicatorOptions, useRenderedIndicatorState } from './use-rendered-indicator-state';\n\ninterface InputIndicatorRootCore<IndicatorState extends IndicatorLifecycleState, Props> {\n readonly state: StoreState<IndicatorState>;\n setProps(props: Props): void;\n destroy(): void;\n close(): void;\n processEvent(event: InputActionEvent, snapshot: MediaSnapshot): boolean;\n}\n\nexport function useInputIndicatorRoot<IndicatorState extends IndicatorLifecycleState, Props>(\n createCore: () => InputIndicatorRootCore<IndicatorState, Props>,\n props: Props,\n options?: RenderedIndicatorOptions\n) {\n const [core] = useState(createCore);\n useDestroy(core);\n core.setProps(props);\n const showIndicator = useIndicatorVisibility(() => core.close());\n\n useInputActionSubscription((event, snapshot) => {\n if (core.processEvent(event, snapshot)) showIndicator();\n });\n\n const currentState = useSyncExternalStore(\n (callback) => core.state.subscribe(callback),\n () => core.state.current,\n () => core.state.current\n );\n\n return useRenderedIndicatorState(currentState, options);\n}\n"],"mappings":";;;;;;;AAmBA,SAAgB,sBACd,YACA,OACA,SACA;CACA,MAAM,CAAC,QAAQ,SAAS,UAAU;CAClC,WAAW,IAAI;CACf,KAAK,SAAS,KAAK;CACnB,MAAM,gBAAgB,6BAA6B,KAAK,MAAM,CAAC;CAE/D,4BAA4B,OAAO,aAAa;EAC9C,IAAI,KAAK,aAAa,OAAO,QAAQ,GAAG,cAAc;CACxD,CAAC;CAQD,OAAO,0BANc,sBAClB,aAAa,KAAK,MAAM,UAAU,QAAQ,SACrC,KAAK,MAAM,eACX,KAAK,MAAM,OAGyB,GAAG,OAAO;AACxD"}
@@ -0,0 +1,43 @@
"use client";
import { useDestroy } from "../../utils/use-destroy.js";
import { createTransition } from "@videojs/core/dom";
import { useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
import { getRenderedIndicatorState, isIndicatorPresent } from "@videojs/core";
//#region src/ui/input-indicators/use-rendered-indicator-state.ts
function useRenderedIndicatorState(currentState, options = {}) {
const elementRef = useRef(null);
const currentStateRef = useRef(currentState);
const snapshotRef = useRef(currentState);
const [transition] = useState(() => createTransition());
useDestroy(transition);
currentStateRef.current = currentState;
const transitionState = useSyncExternalStore((callback) => transition.state.subscribe(callback), () => transition.state.current, () => transition.state.current);
const { generation, open } = currentState;
useLayoutEffect(() => {
if (open) {
const nextState = currentStateRef.current;
if (nextState.generation !== generation) return;
snapshotRef.current = nextState;
const transitionState = transition.state.current;
if (!transitionState.active || options.replayOnUpdate !== false) transition.open(elementRef.current);
else if (transitionState.status === "ending") transition.cancel();
return;
}
const { active, status } = transition.state.current;
if (active && status !== "ending") transition.close(elementRef.current);
}, [
generation,
open,
options.replayOnUpdate,
transition
]);
return {
elementRef,
present: isIndicatorPresent(currentState, transitionState),
state: getRenderedIndicatorState(currentState, snapshotRef.current, transitionState)
};
}
//#endregion
export { useRenderedIndicatorState };
//# sourceMappingURL=use-rendered-indicator-state.js.map
@@ -0,0 +1 @@
{"version":3,"file":"use-rendered-indicator-state.js","names":[],"sources":["../../../../src/ui/input-indicators/use-rendered-indicator-state.ts"],"sourcesContent":["'use client';\n\nimport { getRenderedIndicatorState, type IndicatorLifecycleState, isIndicatorPresent } from '@videojs/core';\nimport { createTransition } from '@videojs/core/dom';\nimport { useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';\n\nimport { useDestroy } from '../../utils/use-destroy';\n\nexport interface RenderedIndicatorOptions {\n replayOnUpdate?: boolean | undefined;\n}\n\nexport function useRenderedIndicatorState<State extends IndicatorLifecycleState>(\n currentState: State,\n options: RenderedIndicatorOptions = {}\n) {\n const elementRef = useRef<HTMLElement>(null);\n const currentStateRef = useRef(currentState);\n const snapshotRef = useRef(currentState);\n const [transition] = useState(() => createTransition());\n useDestroy(transition);\n currentStateRef.current = currentState;\n\n const transitionState = useSyncExternalStore(\n (callback) => transition.state.subscribe(callback),\n () => transition.state.current,\n () => transition.state.current\n );\n\n const { generation, open } = currentState;\n\n useLayoutEffect(() => {\n if (open) {\n const nextState = currentStateRef.current;\n if (nextState.generation !== generation) return;\n\n snapshotRef.current = nextState;\n const transitionState = transition.state.current;\n if (!transitionState.active || options.replayOnUpdate !== false) {\n void transition.open(elementRef.current);\n } else if (transitionState.status === 'ending') {\n transition.cancel();\n }\n return;\n }\n\n const { active, status } = transition.state.current;\n if (active && status !== 'ending') {\n void transition.close(elementRef.current);\n }\n }, [generation, open, options.replayOnUpdate, transition]);\n\n return {\n elementRef,\n present: isIndicatorPresent(currentState, transitionState),\n state: getRenderedIndicatorState(currentState, snapshotRef.current, transitionState),\n };\n}\n"],"mappings":";;;;;;AAYA,SAAgB,0BACd,cACA,UAAoC,CAAC,GACrC;CACA,MAAM,aAAa,OAAoB,IAAI;CAC3C,MAAM,kBAAkB,OAAO,YAAY;CAC3C,MAAM,cAAc,OAAO,YAAY;CACvC,MAAM,CAAC,cAAc,eAAe,iBAAiB,CAAC;CACtD,WAAW,UAAU;CACrB,gBAAgB,UAAU;CAE1B,MAAM,kBAAkB,sBACrB,aAAa,WAAW,MAAM,UAAU,QAAQ,SAC3C,WAAW,MAAM,eACjB,WAAW,MAAM,OACzB;CAEA,MAAM,EAAE,YAAY,SAAS;CAE7B,sBAAsB;EACpB,IAAI,MAAM;GACR,MAAM,YAAY,gBAAgB;GAClC,IAAI,UAAU,eAAe,YAAY;GAEzC,YAAY,UAAU;GACtB,MAAM,kBAAkB,WAAW,MAAM;GACzC,IAAI,CAAC,gBAAgB,UAAU,QAAQ,mBAAmB,OACxD,WAAgB,KAAK,WAAW,OAAO;QAClC,IAAI,gBAAgB,WAAW,UACpC,WAAW,OAAO;GAEpB;EACF;EAEA,MAAM,EAAE,QAAQ,WAAW,WAAW,MAAM;EAC5C,IAAI,UAAU,WAAW,UACvB,WAAgB,MAAM,WAAW,OAAO;CAE5C,GAAG;EAAC;EAAY;EAAM,QAAQ;EAAgB;CAAU,CAAC;CAEzD,OAAO;EACL;EACA,SAAS,mBAAmB,cAAc,eAAe;EACzD,OAAO,0BAA0B,cAAc,YAAY,SAAS,eAAe;CACrF;AACF"}