remotion 4.0.0-alpha10 → 4.0.0-alpha11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Img.js +31 -28
- package/dist/cjs/ResolveCompositionConfig.js +16 -3
- package/dist/cjs/delay-render.js +3 -3
- package/dist/cjs/get-preview-dom-element.d.ts +1 -0
- package/dist/cjs/get-preview-dom-element.js +3 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/internals.d.ts +1 -0
- package/dist/cjs/internals.js +1 -0
- package/dist/cjs/resolve-video-config.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/warn-about-non-seekable-media.js +1 -1
- package/dist/esm/index.mjs +80 -63
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/Img.js
CHANGED
|
@@ -59,35 +59,38 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
|
|
|
59
59
|
}
|
|
60
60
|
(0, cancel_render_js_1.cancelRender)('Error loading image with src: ' + ((_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src));
|
|
61
61
|
}, [maxRetries, onError, retryIn]);
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const { current } = imageRef;
|
|
68
|
-
const onComplete = () => {
|
|
69
|
-
var _a, _b, _c, _d;
|
|
70
|
-
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
71
|
-
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
72
|
-
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
62
|
+
if (typeof window !== 'undefined') {
|
|
63
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
64
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
65
|
+
if (process.env.NODE_ENV === 'test') {
|
|
66
|
+
return;
|
|
73
67
|
}
|
|
74
|
-
(0, delay_render_js_1.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
current === null || current === void 0 ? void 0 : current.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
68
|
+
const newHandle = (0, delay_render_js_1.delayRender)('Loading <Img> with src=' + src);
|
|
69
|
+
const { current } = imageRef;
|
|
70
|
+
const onComplete = () => {
|
|
71
|
+
var _a, _b, _c, _d;
|
|
72
|
+
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
73
|
+
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
74
|
+
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
75
|
+
}
|
|
76
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
77
|
+
};
|
|
78
|
+
const didLoad = () => {
|
|
79
|
+
onComplete();
|
|
80
|
+
};
|
|
81
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
82
|
+
onComplete();
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
86
|
+
}
|
|
87
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
88
|
+
return () => {
|
|
89
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
90
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
91
|
+
};
|
|
92
|
+
}, [src]);
|
|
93
|
+
}
|
|
91
94
|
return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
92
95
|
};
|
|
93
96
|
/**
|
|
@@ -4,6 +4,7 @@ exports.useResolvedVideoConfig = exports.ResolveCompositionConfig = exports.reso
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
7
|
+
const input_props_js_1 = require("./config/input-props.js");
|
|
7
8
|
const EditorProps_js_1 = require("./EditorProps.js");
|
|
8
9
|
const resolve_video_config_js_1 = require("./resolve-video-config.js");
|
|
9
10
|
exports.ResolveCompositionContext = (0, react_1.createContext)(null);
|
|
@@ -134,11 +135,16 @@ const ResolveCompositionConfig = ({ children }) => {
|
|
|
134
135
|
exports.ResolveCompositionConfig = ResolveCompositionConfig;
|
|
135
136
|
const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
136
137
|
const context = (0, react_1.useContext)(exports.ResolveCompositionContext);
|
|
138
|
+
const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
|
|
137
139
|
const { compositions, currentComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
138
140
|
const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
|
|
139
141
|
const composition = compositions.find((c) => c.id === compositionId);
|
|
140
|
-
|
|
142
|
+
const selectedEditorProps = (0, react_1.useMemo)(() => {
|
|
141
143
|
var _a;
|
|
144
|
+
return composition ? (_a = allEditorProps[composition.id]) !== null && _a !== void 0 ? _a : {} : {};
|
|
145
|
+
}, [allEditorProps, composition]);
|
|
146
|
+
return (0, react_1.useMemo)(() => {
|
|
147
|
+
var _a, _b;
|
|
142
148
|
if (!composition) {
|
|
143
149
|
return null;
|
|
144
150
|
}
|
|
@@ -146,13 +152,20 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
|
146
152
|
if (needsResolution === null) {
|
|
147
153
|
return {
|
|
148
154
|
type: 'success',
|
|
149
|
-
result: {
|
|
155
|
+
result: {
|
|
156
|
+
...composition,
|
|
157
|
+
defaultProps: {
|
|
158
|
+
...((_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {}),
|
|
159
|
+
...(selectedEditorProps !== null && selectedEditorProps !== void 0 ? selectedEditorProps : {}),
|
|
160
|
+
...(typeof window === 'undefined' ? {} : (_b = (0, input_props_js_1.getInputProps)()) !== null && _b !== void 0 ? _b : {}),
|
|
161
|
+
},
|
|
162
|
+
},
|
|
150
163
|
};
|
|
151
164
|
}
|
|
152
165
|
if (!context[composition.id]) {
|
|
153
166
|
return null;
|
|
154
167
|
}
|
|
155
168
|
return context[composition.id];
|
|
156
|
-
}, [composition, context]);
|
|
169
|
+
}, [composition, context, selectedEditorProps]);
|
|
157
170
|
};
|
|
158
171
|
exports.useResolvedVideoConfig = useResolvedVideoConfig;
|
package/dist/cjs/delay-render.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.continueRender = exports.delayRender = exports.DELAY_RENDER_CALLSTACK_TO
|
|
|
4
4
|
const get_environment_js_1 = require("./get-environment.js");
|
|
5
5
|
const truthy_js_1 = require("./truthy.js");
|
|
6
6
|
if (typeof window !== 'undefined') {
|
|
7
|
-
window.
|
|
7
|
+
window.remotion_renderReady = false;
|
|
8
8
|
}
|
|
9
9
|
let handles = [];
|
|
10
10
|
const timeouts = {};
|
|
@@ -43,7 +43,7 @@ const delayRender = (label) => {
|
|
|
43
43
|
}, timeoutToUse);
|
|
44
44
|
}
|
|
45
45
|
if (typeof window !== 'undefined') {
|
|
46
|
-
window.
|
|
46
|
+
window.remotion_renderReady = false;
|
|
47
47
|
}
|
|
48
48
|
return handle;
|
|
49
49
|
};
|
|
@@ -71,7 +71,7 @@ const continueRender = (handle) => {
|
|
|
71
71
|
return true;
|
|
72
72
|
});
|
|
73
73
|
if (handles.length === 0 && typeof window !== 'undefined') {
|
|
74
|
-
window.
|
|
74
|
+
window.remotion_renderReady = true;
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
exports.continueRender = continueRender;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPreviewDomElement = void 0;
|
|
3
|
+
exports.getPreviewDomElement = exports.REMOTION_STUDIO_CONTAINER_ELEMENT = void 0;
|
|
4
|
+
exports.REMOTION_STUDIO_CONTAINER_ELEMENT = '__remotion-studio-container';
|
|
4
5
|
const getPreviewDomElement = () => {
|
|
5
|
-
return document.getElementById(
|
|
6
|
+
return document.getElementById(exports.REMOTION_STUDIO_CONTAINER_ELEMENT);
|
|
6
7
|
};
|
|
7
8
|
exports.getPreviewDomElement = getPreviewDomElement;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ClipRegion } from './NativeLayers.js';
|
|
|
5
5
|
import type { VideoConfig } from './video-config.js';
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
8
|
-
|
|
8
|
+
remotion_renderReady: boolean;
|
|
9
9
|
remotion_cancelledError: string | undefined;
|
|
10
10
|
getStaticCompositions: () => Promise<AnyCompMetadata[]>;
|
|
11
11
|
calculateComposition: (compId: string) => Promise<VideoConfig>;
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -124,5 +124,6 @@ export declare const Internals: {
|
|
|
124
124
|
ResolveCompositionConfig: import("react").FC<import("react").PropsWithChildren<{
|
|
125
125
|
children: import("react").ReactNode;
|
|
126
126
|
}>>;
|
|
127
|
+
REMOTION_STUDIO_CONTAINER_ELEMENT: string;
|
|
127
128
|
};
|
|
128
129
|
export type { TComposition, Timeline, TCompMetadata, TSequence, TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, };
|
package/dist/cjs/internals.js
CHANGED
|
@@ -112,4 +112,5 @@ exports.Internals = {
|
|
|
112
112
|
useResolvedVideoConfig: ResolveCompositionConfig_js_1.useResolvedVideoConfig,
|
|
113
113
|
resolveCompositionsRef: ResolveCompositionConfig_js_1.resolveCompositionsRef,
|
|
114
114
|
ResolveCompositionConfig: ResolveCompositionConfig_js_1.ResolveCompositionConfig,
|
|
115
|
+
REMOTION_STUDIO_CONTAINER_ELEMENT: get_preview_dom_element_js_1.REMOTION_STUDIO_CONTAINER_ELEMENT,
|
|
115
116
|
};
|
|
@@ -12,7 +12,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
|
|
|
12
12
|
props: {
|
|
13
13
|
...((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
|
|
14
14
|
...(editorPropsOrUndefined !== null && editorPropsOrUndefined !== void 0 ? editorPropsOrUndefined : {}),
|
|
15
|
-
...((_c = (0, input_props_js_1.getInputProps)()) !== null && _c !== void 0 ? _c : {}),
|
|
15
|
+
...(typeof window === 'undefined' ? {} : (_c = (0, input_props_js_1.getInputProps)()) !== null && _c !== void 0 ? _c : {}),
|
|
16
16
|
},
|
|
17
17
|
abortSignal: signal,
|
|
18
18
|
})
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.0-
|
|
1
|
+
export declare const VERSION = "4.0.0-alpha11";
|
package/dist/cjs/version.js
CHANGED
|
@@ -23,7 +23,7 @@ const warnAboutNonSeekableMedia = (ref, type) => {
|
|
|
23
23
|
console.error(msg);
|
|
24
24
|
}
|
|
25
25
|
else if (type === 'console-warning') {
|
|
26
|
-
console.warn(`The media ${ref.src} does not support seeking. The video will render fine, but may not play correctly in
|
|
26
|
+
console.warn(`The media ${ref.src} does not support seeking. The video will render fine, but may not play correctly in the Remotion Studio and in the <Player>. See https://remotion.dev/docs/non-seekable-media for an explanation.`);
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
throw new Error(msg);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -58,7 +58,7 @@ function truthy(value) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// Automatically generated on publish
|
|
61
|
-
const VERSION = '4.0.0-
|
|
61
|
+
const VERSION = '4.0.0-alpha11';
|
|
62
62
|
|
|
63
63
|
const checkMultipleRemotionVersions = () => {
|
|
64
64
|
if (typeof globalThis === 'undefined') {
|
|
@@ -263,31 +263,6 @@ const useNonce = () => {
|
|
|
263
263
|
|
|
264
264
|
const SequenceContext = createContext(null);
|
|
265
265
|
|
|
266
|
-
const EditorPropsContext = createContext({
|
|
267
|
-
props: {},
|
|
268
|
-
updateProps: () => {
|
|
269
|
-
throw new Error('Not implemented');
|
|
270
|
-
},
|
|
271
|
-
});
|
|
272
|
-
const EditorPropsProvider = ({ children }) => {
|
|
273
|
-
const [props, setProps] = React.useState({});
|
|
274
|
-
const updateProps = useCallback(({ defaultProps, id, newProps, }) => {
|
|
275
|
-
setProps((prev) => {
|
|
276
|
-
var _a;
|
|
277
|
-
return {
|
|
278
|
-
...prev,
|
|
279
|
-
[id]: typeof newProps === 'function'
|
|
280
|
-
? newProps((_a = prev[id]) !== null && _a !== void 0 ? _a : defaultProps)
|
|
281
|
-
: newProps,
|
|
282
|
-
};
|
|
283
|
-
});
|
|
284
|
-
}, []);
|
|
285
|
-
const ctx = useMemo(() => {
|
|
286
|
-
return { props, updateProps };
|
|
287
|
-
}, [props, updateProps]);
|
|
288
|
-
return (jsx(EditorPropsContext.Provider, { value: ctx, children: children }));
|
|
289
|
-
};
|
|
290
|
-
|
|
291
266
|
let didWarnSSRImport = false;
|
|
292
267
|
const warnOnceSSRImport = () => {
|
|
293
268
|
if (didWarnSSRImport) {
|
|
@@ -315,6 +290,31 @@ const getInputProps = () => {
|
|
|
315
290
|
return parsed;
|
|
316
291
|
};
|
|
317
292
|
|
|
293
|
+
const EditorPropsContext = createContext({
|
|
294
|
+
props: {},
|
|
295
|
+
updateProps: () => {
|
|
296
|
+
throw new Error('Not implemented');
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
const EditorPropsProvider = ({ children }) => {
|
|
300
|
+
const [props, setProps] = React.useState({});
|
|
301
|
+
const updateProps = useCallback(({ defaultProps, id, newProps, }) => {
|
|
302
|
+
setProps((prev) => {
|
|
303
|
+
var _a;
|
|
304
|
+
return {
|
|
305
|
+
...prev,
|
|
306
|
+
[id]: typeof newProps === 'function'
|
|
307
|
+
? newProps((_a = prev[id]) !== null && _a !== void 0 ? _a : defaultProps)
|
|
308
|
+
: newProps,
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
}, []);
|
|
312
|
+
const ctx = useMemo(() => {
|
|
313
|
+
return { props, updateProps };
|
|
314
|
+
}, [props, updateProps]);
|
|
315
|
+
return (jsx(EditorPropsContext.Provider, { value: ctx, children: children }));
|
|
316
|
+
};
|
|
317
|
+
|
|
318
318
|
const validateDimension = (amount, nameOfProp, location) => {
|
|
319
319
|
if (typeof amount !== 'number') {
|
|
320
320
|
throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
|
|
@@ -356,7 +356,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
|
|
|
356
356
|
props: {
|
|
357
357
|
...((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
|
|
358
358
|
...(editorPropsOrUndefined !== null && editorPropsOrUndefined !== void 0 ? editorPropsOrUndefined : {}),
|
|
359
|
-
...((_c = getInputProps()) !== null && _c !== void 0 ? _c : {}),
|
|
359
|
+
...(typeof window === 'undefined' ? {} : (_c = getInputProps()) !== null && _c !== void 0 ? _c : {}),
|
|
360
360
|
},
|
|
361
361
|
abortSignal: signal,
|
|
362
362
|
})
|
|
@@ -545,11 +545,16 @@ const ResolveCompositionConfig = ({ children }) => {
|
|
|
545
545
|
};
|
|
546
546
|
const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
547
547
|
const context = useContext(ResolveCompositionContext);
|
|
548
|
+
const { props: allEditorProps } = useContext(EditorPropsContext);
|
|
548
549
|
const { compositions, currentComposition } = useContext(CompositionManager);
|
|
549
550
|
const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
|
|
550
551
|
const composition = compositions.find((c) => c.id === compositionId);
|
|
551
|
-
|
|
552
|
+
const selectedEditorProps = useMemo(() => {
|
|
552
553
|
var _a;
|
|
554
|
+
return composition ? (_a = allEditorProps[composition.id]) !== null && _a !== void 0 ? _a : {} : {};
|
|
555
|
+
}, [allEditorProps, composition]);
|
|
556
|
+
return useMemo(() => {
|
|
557
|
+
var _a, _b;
|
|
553
558
|
if (!composition) {
|
|
554
559
|
return null;
|
|
555
560
|
}
|
|
@@ -557,14 +562,21 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
|
557
562
|
if (needsResolution === null) {
|
|
558
563
|
return {
|
|
559
564
|
type: 'success',
|
|
560
|
-
result: {
|
|
565
|
+
result: {
|
|
566
|
+
...composition,
|
|
567
|
+
defaultProps: {
|
|
568
|
+
...((_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {}),
|
|
569
|
+
...(selectedEditorProps !== null && selectedEditorProps !== void 0 ? selectedEditorProps : {}),
|
|
570
|
+
...(typeof window === 'undefined' ? {} : (_b = getInputProps()) !== null && _b !== void 0 ? _b : {}),
|
|
571
|
+
},
|
|
572
|
+
},
|
|
561
573
|
};
|
|
562
574
|
}
|
|
563
575
|
if (!context[composition.id]) {
|
|
564
576
|
return null;
|
|
565
577
|
}
|
|
566
578
|
return context[composition.id];
|
|
567
|
-
}, [composition, context]);
|
|
579
|
+
}, [composition, context, selectedEditorProps]);
|
|
568
580
|
};
|
|
569
581
|
|
|
570
582
|
const useVideo = () => {
|
|
@@ -1483,7 +1495,7 @@ const warnAboutNonSeekableMedia = (ref, type) => {
|
|
|
1483
1495
|
console.error(msg);
|
|
1484
1496
|
}
|
|
1485
1497
|
else if (type === 'console-warning') {
|
|
1486
|
-
console.warn(`The media ${ref.src} does not support seeking. The video will render fine, but may not play correctly in
|
|
1498
|
+
console.warn(`The media ${ref.src} does not support seeking. The video will render fine, but may not play correctly in the Remotion Studio and in the <Player>. See https://remotion.dev/docs/non-seekable-media for an explanation.`);
|
|
1487
1499
|
}
|
|
1488
1500
|
else {
|
|
1489
1501
|
throw new Error(msg);
|
|
@@ -1941,7 +1953,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
1941
1953
|
const AudioForDevelopment = forwardRef(AudioForDevelopmentForwardRefFunction);
|
|
1942
1954
|
|
|
1943
1955
|
if (typeof window !== 'undefined') {
|
|
1944
|
-
window.
|
|
1956
|
+
window.remotion_renderReady = false;
|
|
1945
1957
|
}
|
|
1946
1958
|
let handles = [];
|
|
1947
1959
|
const timeouts = {};
|
|
@@ -1980,7 +1992,7 @@ const delayRender = (label) => {
|
|
|
1980
1992
|
}, timeoutToUse);
|
|
1981
1993
|
}
|
|
1982
1994
|
if (typeof window !== 'undefined') {
|
|
1983
|
-
window.
|
|
1995
|
+
window.remotion_renderReady = false;
|
|
1984
1996
|
}
|
|
1985
1997
|
return handle;
|
|
1986
1998
|
};
|
|
@@ -2007,7 +2019,7 @@ const continueRender = (handle) => {
|
|
|
2007
2019
|
return true;
|
|
2008
2020
|
});
|
|
2009
2021
|
if (handles.length === 0 && typeof window !== 'undefined') {
|
|
2010
|
-
window.
|
|
2022
|
+
window.remotion_renderReady = true;
|
|
2011
2023
|
}
|
|
2012
2024
|
};
|
|
2013
2025
|
|
|
@@ -2739,35 +2751,38 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
|
|
|
2739
2751
|
}
|
|
2740
2752
|
cancelRender('Error loading image with src: ' + ((_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src));
|
|
2741
2753
|
}, [maxRetries, onError, retryIn]);
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
const { current } = imageRef;
|
|
2748
|
-
const onComplete = () => {
|
|
2749
|
-
var _a, _b, _c, _d;
|
|
2750
|
-
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
2751
|
-
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
2752
|
-
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
2754
|
+
if (typeof window !== 'undefined') {
|
|
2755
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
2756
|
+
useLayoutEffect(() => {
|
|
2757
|
+
if (process.env.NODE_ENV === 'test') {
|
|
2758
|
+
return;
|
|
2753
2759
|
}
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
current === null || current === void 0 ? void 0 : current.
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2760
|
+
const newHandle = delayRender('Loading <Img> with src=' + src);
|
|
2761
|
+
const { current } = imageRef;
|
|
2762
|
+
const onComplete = () => {
|
|
2763
|
+
var _a, _b, _c, _d;
|
|
2764
|
+
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
2765
|
+
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
2766
|
+
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
2767
|
+
}
|
|
2768
|
+
continueRender(newHandle);
|
|
2769
|
+
};
|
|
2770
|
+
const didLoad = () => {
|
|
2771
|
+
onComplete();
|
|
2772
|
+
};
|
|
2773
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
2774
|
+
onComplete();
|
|
2775
|
+
}
|
|
2776
|
+
else {
|
|
2777
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
2778
|
+
}
|
|
2779
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
2780
|
+
return () => {
|
|
2781
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
2782
|
+
continueRender(newHandle);
|
|
2783
|
+
};
|
|
2784
|
+
}, [src]);
|
|
2785
|
+
}
|
|
2771
2786
|
return (jsx("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
2772
2787
|
};
|
|
2773
2788
|
/**
|
|
@@ -2952,8 +2967,9 @@ var CSSUtils = /*#__PURE__*/Object.freeze({
|
|
|
2952
2967
|
makeDefaultCSS: makeDefaultCSS
|
|
2953
2968
|
});
|
|
2954
2969
|
|
|
2970
|
+
const REMOTION_STUDIO_CONTAINER_ELEMENT = '__remotion-studio-container';
|
|
2955
2971
|
const getPreviewDomElement = () => {
|
|
2956
|
-
return document.getElementById(
|
|
2972
|
+
return document.getElementById(REMOTION_STUDIO_CONTAINER_ELEMENT);
|
|
2957
2973
|
};
|
|
2958
2974
|
|
|
2959
2975
|
/**
|
|
@@ -3584,6 +3600,7 @@ const Internals = {
|
|
|
3584
3600
|
useResolvedVideoConfig,
|
|
3585
3601
|
resolveCompositionsRef,
|
|
3586
3602
|
ResolveCompositionConfig,
|
|
3603
|
+
REMOTION_STUDIO_CONTAINER_ELEMENT,
|
|
3587
3604
|
};
|
|
3588
3605
|
|
|
3589
3606
|
const flattenChildren = (children) => {
|
package/dist/esm/version.mjs
CHANGED