1 | "use strict";
|
2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3 | if (k2 === undefined) k2 = k;
|
4 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5 | }) : (function(o, m, k, k2) {
|
6 | if (k2 === undefined) k2 = k;
|
7 | o[k2] = m[k];
|
8 | }));
|
9 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11 | }) : function(o, v) {
|
12 | o["default"] = v;
|
13 | });
|
14 | var __importStar = (this && this.__importStar) || function (mod) {
|
15 | if (mod && mod.__esModule) return mod;
|
16 | var result = {};
|
17 | if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18 | __setModuleDefault(result, mod);
|
19 | return result;
|
20 | };
|
21 | Object.defineProperty(exports, "__esModule", { value: true });
|
22 | exports.RemotionContextProvider = exports.useRemotionContexts = void 0;
|
23 | const jsx_runtime_1 = require("react/jsx-runtime");
|
24 |
|
25 |
|
26 |
|
27 | const react_1 = __importStar(require("react"));
|
28 | const CompositionManager_1 = require("./CompositionManager");
|
29 | const nonce_1 = require("./nonce");
|
30 | const sequencing_1 = require("./sequencing");
|
31 | const timeline_position_state_1 = require("./timeline-position-state");
|
32 | function useRemotionContexts() {
|
33 | const compositionManagerCtx = react_1.default.useContext(CompositionManager_1.CompositionManager);
|
34 | const timelineContext = react_1.default.useContext(timeline_position_state_1.TimelineContext);
|
35 | const setTimelineContext = react_1.default.useContext(timeline_position_state_1.SetTimelineContext);
|
36 | const sequenceContext = react_1.default.useContext(sequencing_1.SequenceContext);
|
37 | const nonceContext = react_1.default.useContext(nonce_1.NonceContext);
|
38 | return (0, react_1.useMemo)(() => ({
|
39 | compositionManagerCtx,
|
40 | timelineContext,
|
41 | setTimelineContext,
|
42 | sequenceContext,
|
43 | nonceContext,
|
44 | }), [
|
45 | compositionManagerCtx,
|
46 | nonceContext,
|
47 | sequenceContext,
|
48 | setTimelineContext,
|
49 | timelineContext,
|
50 | ]);
|
51 | }
|
52 | exports.useRemotionContexts = useRemotionContexts;
|
53 | const RemotionContextProvider = (props) => {
|
54 | const { children, contexts } = props;
|
55 | return ((0, jsx_runtime_1.jsx)(nonce_1.NonceContext.Provider, Object.assign({ value: contexts.nonceContext }, { children: (0, jsx_runtime_1.jsx)(CompositionManager_1.CompositionManager.Provider, Object.assign({ value: contexts.compositionManagerCtx }, { children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.TimelineContext.Provider, Object.assign({ value: contexts.timelineContext }, { children: (0, jsx_runtime_1.jsx)(timeline_position_state_1.SetTimelineContext.Provider, Object.assign({ value: contexts.setTimelineContext }, { children: (0, jsx_runtime_1.jsx)(sequencing_1.SequenceContext.Provider, Object.assign({ value: contexts.sequenceContext }, { children: children }), void 0) }), void 0) }), void 0) }), void 0) }), void 0));
|
56 | };
|
57 | exports.RemotionContextProvider = RemotionContextProvider;
|
58 |
|
\ | No newline at end of file |