mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
build(react): build26 from 45504a2b
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { UIComponentProps } from "../../utils/types.js";
|
||||
import { BufferingIndicatorCore } from "@videojs/core";
|
||||
//#region src/ui/buffering-indicator/buffering-indicator.d.ts
|
||||
interface BufferingIndicatorProps extends UIComponentProps<'div', BufferingIndicatorCore.State>, BufferingIndicatorCore.Props {}
|
||||
/**
|
||||
* Displays a buffering indicator when media is waiting for data.
|
||||
*
|
||||
* Visibility is delayed (default 500ms) to avoid flashing on quick buffers.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* <BufferingIndicator />
|
||||
*
|
||||
* <BufferingIndicator delay={1000} />
|
||||
*
|
||||
* <BufferingIndicator
|
||||
* render={(props, state) => (
|
||||
* <div {...props}>{state.visible && <Spinner />}</div>
|
||||
* )}
|
||||
* />
|
||||
* ```
|
||||
*/
|
||||
declare const BufferingIndicator: import("react").ForwardRefExoticComponent<Omit<BufferingIndicatorProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
||||
declare namespace BufferingIndicator {
|
||||
type Props = BufferingIndicatorProps;
|
||||
type State = BufferingIndicatorCore.State;
|
||||
}
|
||||
//#endregion
|
||||
export { BufferingIndicator, BufferingIndicatorProps };
|
||||
//# sourceMappingURL=buffering-indicator.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buffering-indicator.d.ts","names":[],"sources":["../../../../src/ui/buffering-indicator/buffering-indicator.tsx"],"mappings":";;;UAYiB,gCACP,wBAAwB,uBAAuB,QACrD,uBAAuB;;;;;;;;;;;;;;;;;;;cAoBd,oCAAkB,0BAAA,KAAA,kDAAA,cAAA;kBAqCd;OACH,QAAQ;OACR,QAAQ,uBAAuB"}
|
||||
@@ -0,0 +1,53 @@
|
||||
"use client";
|
||||
import { usePlayer } from "../../player/context.js";
|
||||
import { useDestroy } from "../../utils/use-destroy.js";
|
||||
import { renderElement } from "../../utils/use-render.js";
|
||||
import { logMissingFeature, selectPlayback } from "@videojs/core/dom";
|
||||
import { forwardRef, useState, useSyncExternalStore } from "react";
|
||||
import { BufferingIndicatorCore, BufferingIndicatorDataAttrs } from "@videojs/core";
|
||||
//#region src/ui/buffering-indicator/buffering-indicator.tsx
|
||||
/**
|
||||
* Displays a buffering indicator when media is waiting for data.
|
||||
*
|
||||
* Visibility is delayed (default 500ms) to avoid flashing on quick buffers.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* <BufferingIndicator />
|
||||
*
|
||||
* <BufferingIndicator delay={1000} />
|
||||
*
|
||||
* <BufferingIndicator
|
||||
* render={(props, state) => (
|
||||
* <div {...props}>{state.visible && <Spinner />}</div>
|
||||
* )}
|
||||
* />
|
||||
* ```
|
||||
*/
|
||||
const BufferingIndicator = forwardRef(function BufferingIndicator(componentProps, forwardedRef) {
|
||||
const { render, className, style, delay, ...elementProps } = componentProps;
|
||||
const playback = usePlayer(selectPlayback);
|
||||
const [core] = useState(() => new BufferingIndicatorCore());
|
||||
useDestroy(core);
|
||||
core.setProps({ delay });
|
||||
if (playback) core.update(playback);
|
||||
const state = useSyncExternalStore((cb) => core.state.subscribe(cb), () => core.state.current, () => core.state.current);
|
||||
if (!playback) {
|
||||
logMissingFeature("BufferingIndicator", "playback");
|
||||
return null;
|
||||
}
|
||||
return renderElement("div", {
|
||||
render,
|
||||
className,
|
||||
style
|
||||
}, {
|
||||
state,
|
||||
stateAttrMap: BufferingIndicatorDataAttrs,
|
||||
ref: [forwardedRef],
|
||||
props: [elementProps]
|
||||
});
|
||||
});
|
||||
//#endregion
|
||||
export { BufferingIndicator };
|
||||
|
||||
//# sourceMappingURL=buffering-indicator.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buffering-indicator.js","names":[],"sources":["../../../../src/ui/buffering-indicator/buffering-indicator.tsx"],"sourcesContent":["'use client';\n\nimport { BufferingIndicatorCore, BufferingIndicatorDataAttrs } from '@videojs/core';\nimport { logMissingFeature, selectPlayback } from '@videojs/core/dom';\nimport type { ForwardedRef } from 'react';\nimport { forwardRef, useState, useSyncExternalStore } from 'react';\n\nimport { usePlayer } from '../../player/context';\nimport type { UIComponentProps } from '../../utils/types';\nimport { useDestroy } from '../../utils/use-destroy';\nimport { renderElement } from '../../utils/use-render';\n\nexport interface BufferingIndicatorProps\n extends UIComponentProps<'div', BufferingIndicatorCore.State>,\n BufferingIndicatorCore.Props {}\n\n/**\n * Displays a buffering indicator when media is waiting for data.\n *\n * Visibility is delayed (default 500ms) to avoid flashing on quick buffers.\n *\n * @example\n * ```tsx\n * <BufferingIndicator />\n *\n * <BufferingIndicator delay={1000} />\n *\n * <BufferingIndicator\n * render={(props, state) => (\n * <div {...props}>{state.visible && <Spinner />}</div>\n * )}\n * />\n * ```\n */\nexport const BufferingIndicator = forwardRef(function BufferingIndicator(\n componentProps: BufferingIndicatorProps,\n forwardedRef: ForwardedRef<HTMLDivElement>\n) {\n const { render, className, style, delay, ...elementProps } = componentProps;\n\n const playback = usePlayer(selectPlayback);\n\n const [core] = useState(() => new BufferingIndicatorCore());\n useDestroy(core);\n core.setProps({ delay });\n\n if (playback) core.update(playback);\n\n const state = useSyncExternalStore(\n (cb) => core.state.subscribe(cb),\n () => core.state.current,\n () => core.state.current\n );\n\n if (!playback) {\n if (__DEV__) logMissingFeature('BufferingIndicator', 'playback');\n return null;\n }\n\n return renderElement(\n 'div',\n { render, className, style },\n {\n state,\n stateAttrMap: BufferingIndicatorDataAttrs,\n ref: [forwardedRef],\n props: [elementProps],\n }\n );\n});\n\nexport namespace BufferingIndicator {\n export type Props = BufferingIndicatorProps;\n export type State = BufferingIndicatorCore.State;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,qBAAqB,WAAW,SAAS,mBACpD,gBACA,cACA;CACA,MAAM,EAAE,QAAQ,WAAW,OAAO,OAAO,GAAG,iBAAiB;CAE7D,MAAM,WAAW,UAAU,cAAc;CAEzC,MAAM,CAAC,QAAQ,eAAe,IAAI,uBAAuB,CAAC;CAC1D,WAAW,IAAI;CACf,KAAK,SAAS,EAAE,MAAM,CAAC;CAEvB,IAAI,UAAU,KAAK,OAAO,QAAQ;CAElC,MAAM,QAAQ,sBACX,OAAO,KAAK,MAAM,UAAU,EAAE,SACzB,KAAK,MAAM,eACX,KAAK,MAAM,OACnB;CAEA,IAAI,CAAC,UAAU;EACA,kBAAkB,sBAAsB,UAAU;EAC/D,OAAO;CACT;CAEA,OAAO,cACL,OACA;EAAE;EAAQ;EAAW;CAAM,GAC3B;EACE;EACA,cAAc;EACd,KAAK,CAAC,YAAY;EAClB,OAAO,CAAC,YAAY;CACtB,CACF;AACF,CAAC"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { BufferingIndicator, BufferingIndicatorProps } from "./buffering-indicator.js";
|
||||
export { BufferingIndicator, BufferingIndicatorProps };
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { BufferingIndicator } from "./buffering-indicator.js";
|
||||
export { BufferingIndicator };
|
||||
Reference in New Issue
Block a user