@remotion/studio
Version:
APIs for interacting with the Remotion Studio
21 lines (20 loc) • 999 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SetTimelineInOutProvider = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const in_out_1 = require("../state/in-out");
const marks_1 = require("../state/marks");
const SetTimelineInOutProvider = ({ children }) => {
const [inAndOutFrames, setInAndOutFrames] = (0, react_1.useState)(() => (0, marks_1.loadMarks)());
const setTimelineInOutContextValue = (0, react_1.useMemo)(() => {
return {
setInAndOutFrames,
};
}, []);
(0, react_1.useEffect)(() => {
(0, marks_1.persistMarks)(inAndOutFrames);
}, [inAndOutFrames]);
return (jsx_runtime_1.jsx(in_out_1.TimelineInOutContext.Provider, { value: inAndOutFrames, children: jsx_runtime_1.jsx(in_out_1.SetTimelineInOutContext.Provider, { value: setTimelineInOutContextValue, children: children }) }));
};
exports.SetTimelineInOutProvider = SetTimelineInOutProvider;