UNPKG

1.43 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.Freeze = void 0;
4const jsx_runtime_1 = require("react/jsx-runtime");
5const react_1 = require("react");
6const timeline_position_state_1 = require("./timeline-position-state");
7const Freeze = ({ frame, children }) => {
8 if (typeof frame === 'undefined') {
9 throw new Error(`The <Freeze /> component requires a 'frame' prop, but none was passed.`);
10 }
11 if (typeof frame !== 'number') {
12 throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof frame}`);
13 }
14 if (Number.isNaN(frame)) {
15 throw new Error(`The 'frame' prop of <Freeze /> must be a real number, but it is NaN.`);
16 }
17 if (!Number.isFinite(frame)) {
18 throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${frame}.`);
19 }
20 const context = (0, react_1.useContext)(timeline_position_state_1.TimelineContext);
21 const value = (0, react_1.useMemo)(() => {
22 return {
23 ...context,
24 playing: false,
25 imperativePlaying: {
26 current: false,
27 },
28 frame,
29 };
30 }, [context, frame]);
31 return ((0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, Object.assign({ value: value }, { children: children }), void 0));
32};
33exports.Freeze = Freeze;
34//# sourceMappingURL=freeze.js.map
\No newline at end of file