41 lines
1.8 KiB
JavaScript
41 lines
1.8 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
const client_1 = __importDefault(require("react-dom/client"));
|
|
const remotion_1 = require("remotion");
|
|
const no_react_1 = require("remotion/no-react");
|
|
const Studio_1 = require("./Studio");
|
|
const NoRegisterRoot_1 = require("./components/NoRegisterRoot");
|
|
const entry_basic_1 = require("./error-overlay/entry-basic");
|
|
const client_2 = require("./hot-middleware-client/client");
|
|
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultPreviewCSS(null, '#1f2428'));
|
|
let root = null;
|
|
const getRootForElement = () => {
|
|
if (root) {
|
|
return root;
|
|
}
|
|
root = client_1.default.createRoot(remotion_1.Internals.getPreviewDomElement());
|
|
return root;
|
|
};
|
|
const renderToDOM = (content) => {
|
|
if (!client_1.default.createRoot) {
|
|
if (no_react_1.NoReactInternals.ENABLE_V5_BREAKING_CHANGES) {
|
|
throw new Error('Remotion 5.0 does only support React 18+. However, ReactDOM.createRoot() is undefined.');
|
|
}
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
client_1.default.render(content, remotion_1.Internals.getPreviewDomElement());
|
|
return;
|
|
}
|
|
getRootForElement().render(content);
|
|
};
|
|
renderToDOM((0, jsx_runtime_1.jsx)(NoRegisterRoot_1.NoRegisterRoot, {}));
|
|
remotion_1.Internals.waitForRoot((NewRoot) => {
|
|
remotion_1.Internals.enableSequenceStackTraces();
|
|
renderToDOM((0, jsx_runtime_1.jsx)(Studio_1.Studio, { readOnly: false, rootComponent: NewRoot }));
|
|
});
|
|
(0, entry_basic_1.startErrorOverlay)();
|
|
(0, client_2.enableHotMiddleware)();
|