remotion 4.0.519 → 4.0.520
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/THIRD_PARTY_LICENSES.md +28 -0
- package/dist/cjs/Composition.js +5 -5
- package/dist/cjs/CompositionManager.d.ts +2 -3
- package/dist/cjs/CompositionManagerContext.d.ts +1 -2
- package/dist/cjs/CompositionManagerProvider.js +119 -5
- package/dist/cjs/Folder.d.ts +1 -2
- package/dist/cjs/Folder.js +6 -5
- package/dist/cjs/RemotionRoot.js +1 -8
- package/dist/cjs/Sequence.js +47 -60
- package/dist/cjs/SequenceManager.d.ts +1 -0
- package/dist/cjs/SequenceManager.js +85 -3
- package/dist/cjs/TimelineContext.d.ts +14 -8
- package/dist/cjs/TimelineContext.js +40 -23
- package/dist/cjs/audio/AudioForPreview.js +6 -2
- package/dist/cjs/buffering.d.ts +3 -19
- package/dist/cjs/buffering.js +16 -77
- package/dist/cjs/freeze.js +1 -4
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/internals.d.ts +14 -30
- package/dist/cjs/internals.js +12 -4
- package/dist/cjs/runtime-value-store.d.ts +7 -7
- package/dist/cjs/runtime-value-store.js +1 -1
- package/dist/cjs/sequence-order-marker.d.ts +57 -0
- package/dist/cjs/sequence-order-marker.js +44 -0
- package/dist/cjs/timeline-position-state.d.ts +2 -8
- package/dist/cjs/timeline-position-state.js +5 -7
- package/dist/cjs/use-buffer-state.js +1 -3
- package/dist/cjs/use-buffering.d.ts +1 -0
- package/dist/cjs/use-buffering.js +11 -0
- package/dist/cjs/use-media-in-timeline.d.ts +0 -1
- package/dist/cjs/use-media-in-timeline.js +15 -29
- package/dist/cjs/use-media-playback.js +43 -56
- package/dist/cjs/use-media-tag.js +25 -3
- package/dist/cjs/use-playing.d.ts +1 -0
- package/dist/cjs/use-playing.js +14 -0
- package/dist/cjs/use-sequence-registration.d.ts +5 -0
- package/dist/cjs/use-sequence-registration.js +37 -0
- package/dist/cjs/use-sync-external-store.d.ts +28 -0
- package/dist/cjs/use-sync-external-store.js +116 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/VideoForPreview.js +5 -1
- package/dist/cjs/wrap-remotion-context.d.ts +1 -12
- package/dist/cjs/wrap-remotion-context.js +1 -8
- package/dist/esm/index.mjs +1115 -894
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Third-party licenses
|
|
2
|
+
|
|
3
|
+
## use-sync-external-store
|
|
4
|
+
|
|
5
|
+
The vendored `useSyncExternalStore` compatibility implementation is adapted
|
|
6
|
+
from `use-sync-external-store` 1.5.0.
|
|
7
|
+
|
|
8
|
+
MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
package/dist/cjs/Composition.js
CHANGED
|
@@ -13,9 +13,9 @@ const Folder_js_1 = require("./Folder.js");
|
|
|
13
13
|
const input_props_serialization_js_1 = require("./input-props-serialization.js");
|
|
14
14
|
const is_player_js_1 = require("./is-player.js");
|
|
15
15
|
const loading_indicator_js_1 = require("./loading-indicator.js");
|
|
16
|
-
const nonce_js_1 = require("./nonce.js");
|
|
17
16
|
const portal_node_js_1 = require("./portal-node.js");
|
|
18
17
|
const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
|
|
18
|
+
const sequence_order_marker_js_1 = require("./sequence-order-marker.js");
|
|
19
19
|
const use_delay_render_js_1 = require("./use-delay-render.js");
|
|
20
20
|
const use_lazy_component_js_1 = require("./use-lazy-component.js");
|
|
21
21
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
@@ -40,7 +40,6 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
40
40
|
componentName: 'Composition',
|
|
41
41
|
noSuspense: false,
|
|
42
42
|
});
|
|
43
|
-
const nonce = (0, nonce_js_1.useNonce)();
|
|
44
43
|
const isPlayer = (0, is_player_js_1.useIsPlayer)();
|
|
45
44
|
const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
46
45
|
const canUseComposition = (0, react_1.useContext)(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
|
|
@@ -77,7 +76,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
77
76
|
folderName,
|
|
78
77
|
component: lazy,
|
|
79
78
|
defaultProps: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)((defaultProps !== null && defaultProps !== void 0 ? defaultProps : {})),
|
|
80
|
-
|
|
79
|
+
order: null,
|
|
81
80
|
parentFolderName: parentName,
|
|
82
81
|
componentFromProps,
|
|
83
82
|
schema: schema !== null && schema !== void 0 ? schema : null,
|
|
@@ -96,7 +95,6 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
96
95
|
folderName,
|
|
97
96
|
defaultProps,
|
|
98
97
|
width,
|
|
99
|
-
nonce,
|
|
100
98
|
parentName,
|
|
101
99
|
componentFromProps,
|
|
102
100
|
schema,
|
|
@@ -145,10 +143,12 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
145
143
|
*/
|
|
146
144
|
const Composition = (props) => {
|
|
147
145
|
const { onlyRenderComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionSetters);
|
|
146
|
+
const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
148
147
|
if (onlyRenderComposition && onlyRenderComposition !== props.id) {
|
|
149
148
|
return null;
|
|
150
149
|
}
|
|
151
150
|
// @ts-expect-error
|
|
152
|
-
|
|
151
|
+
const composition = jsx_runtime_1.jsx(InnerComposition, { ...props });
|
|
152
|
+
return environment.isStudio ? (jsx_runtime_1.jsx(sequence_order_marker_js_1.CompositionOrderMarker, { compositionId: props.id, children: composition })) : (composition);
|
|
153
153
|
};
|
|
154
154
|
exports.Composition = Composition;
|
|
@@ -5,7 +5,6 @@ import type { CalculateMetadataFunction } from './Composition.js';
|
|
|
5
5
|
import type { DownloadBehavior } from './download-behavior.js';
|
|
6
6
|
import type { EffectDefinition } from './effects/effect-types.js';
|
|
7
7
|
import type { InteractivitySchema } from './interactivity-schema.js';
|
|
8
|
-
import type { NonceHistory } from './nonce.js';
|
|
9
8
|
import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
|
|
10
9
|
import type { RuntimeValueSnapshot, RuntimeValueStore } from './runtime-value-store.js';
|
|
11
10
|
export type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
|
|
@@ -18,7 +17,7 @@ export type TComposition<Schema extends AnyZodObject, Props extends Record<strin
|
|
|
18
17
|
parentFolderName: string | null;
|
|
19
18
|
component: LazyExoticComponent<ComponentType<Props>> | ComponentType<Props>;
|
|
20
19
|
componentFromProps?: unknown;
|
|
21
|
-
|
|
20
|
+
order: number | null;
|
|
22
21
|
schema: Schema | null;
|
|
23
22
|
calculateMetadata: CalculateMetadataFunction<InferProps<Schema, Props>> | null;
|
|
24
23
|
stack: string | null;
|
|
@@ -79,7 +78,7 @@ export type TSequence = {
|
|
|
79
78
|
documentationLink: string | null;
|
|
80
79
|
parent: string | null;
|
|
81
80
|
showInTimeline: boolean;
|
|
82
|
-
|
|
81
|
+
timelineOrder: number | null;
|
|
83
82
|
loopDisplay: LoopDisplay | undefined;
|
|
84
83
|
getStack: () => string | null;
|
|
85
84
|
premountDisplay: number | null;
|
|
@@ -2,7 +2,6 @@ import type React from 'react';
|
|
|
2
2
|
import type { AnyZodObject } from './any-zod-type.js';
|
|
3
3
|
import type { AnyComposition, TComposition } from './CompositionManager.js';
|
|
4
4
|
import type { TFolder } from './Folder.js';
|
|
5
|
-
import type { NonceHistory } from './nonce.js';
|
|
6
5
|
import type { VideoConfig } from './video-config.js';
|
|
7
6
|
export type BaseMetadata = Pick<VideoConfig, 'durationInFrames' | 'fps' | 'props' | 'height' | 'width' | 'defaultCodec' | 'defaultOutName' | 'defaultVideoImageFormat' | 'defaultPixelFormat' | 'defaultProResProfile' | 'defaultSampleRate'>;
|
|
8
7
|
export type AssetPreviewMetadata = BaseMetadata & {
|
|
@@ -29,7 +28,7 @@ export type CanvasContent = {
|
|
|
29
28
|
export type CompositionManagerSetters = {
|
|
30
29
|
registerComposition: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(comp: TComposition<Schema, Props>) => void;
|
|
31
30
|
unregisterComposition: (name: string) => void;
|
|
32
|
-
registerFolder: (name: string, parent: string | null,
|
|
31
|
+
registerFolder: (name: string, parent: string | null, stack: string | null) => void;
|
|
33
32
|
unregisterFolder: (name: string, parent: string | null) => void;
|
|
34
33
|
setCanvasContent: React.Dispatch<React.SetStateAction<CanvasContent | null>>;
|
|
35
34
|
setCurrentAssetMetadata: React.Dispatch<React.SetStateAction<AssetPreviewMetadata | null>>;
|
|
@@ -5,11 +5,26 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const CompositionManager_1 = require("./CompositionManager");
|
|
7
7
|
const CompositionManagerContext_1 = require("./CompositionManagerContext");
|
|
8
|
+
const sequence_order_marker_js_1 = require("./sequence-order-marker.js");
|
|
9
|
+
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
10
|
+
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? react_1.useEffect : react_1.useLayoutEffect;
|
|
8
11
|
const CompositionManagerProvider = ({ children, onlyRenderComposition, currentCompositionMetadata, initialCompositions, initialCanvasContent, }) => {
|
|
12
|
+
const { isStudio } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
13
|
+
const [compositionManagerId] = (0, react_1.useState)(() => String(Math.random()));
|
|
14
|
+
const committedOrderRef = (0, react_1.useRef)(null);
|
|
15
|
+
const committedOrderIdsRef = (0, react_1.useRef)(null);
|
|
16
|
+
const internalOrderRef = (0, react_1.useRef)(new Map(initialCompositions.map((composition, index) => [
|
|
17
|
+
(0, sequence_order_marker_js_1.getCompositionAndFolderOrderKey)({
|
|
18
|
+
type: 'composition',
|
|
19
|
+
id: composition.id,
|
|
20
|
+
}),
|
|
21
|
+
index,
|
|
22
|
+
])));
|
|
23
|
+
const nextInternalOrderRef = (0, react_1.useRef)(initialCompositions.length);
|
|
9
24
|
const [folders, setFolders] = (0, react_1.useState)([]);
|
|
10
25
|
const [canvasContent, setCanvasContent] = (0, react_1.useState)(initialCanvasContent);
|
|
11
26
|
const [currentAssetMetadata, setCurrentAssetMetadata] = (0, react_1.useState)(null);
|
|
12
|
-
const [compositions, setCompositions] = (0, react_1.useState)(initialCompositions);
|
|
27
|
+
const [compositions, setCompositions] = (0, react_1.useState)(() => initialCompositions.map((composition, order) => ({ ...composition, order })));
|
|
13
28
|
// CompositionManagerProvider state
|
|
14
29
|
const currentcompositionsRef = (0, react_1.useRef)(compositions);
|
|
15
30
|
const updateCompositions = (0, react_1.useCallback)((updateComps) => {
|
|
@@ -20,36 +35,134 @@ const CompositionManagerProvider = ({ children, onlyRenderComposition, currentCo
|
|
|
20
35
|
});
|
|
21
36
|
}, []);
|
|
22
37
|
const registerComposition = (0, react_1.useCallback)((comp) => {
|
|
38
|
+
const orderKey = (0, sequence_order_marker_js_1.getCompositionAndFolderOrderKey)({
|
|
39
|
+
type: 'composition',
|
|
40
|
+
id: comp.id,
|
|
41
|
+
});
|
|
42
|
+
const internalOrder = nextInternalOrderRef.current++;
|
|
43
|
+
internalOrderRef.current.set(orderKey, internalOrder);
|
|
23
44
|
updateCompositions((comps) => {
|
|
45
|
+
var _a;
|
|
46
|
+
var _b;
|
|
24
47
|
if (comps.find((c) => c.id === comp.id)) {
|
|
25
48
|
throw new Error(`Multiple composition with id ${comp.id} are registered.`);
|
|
26
49
|
}
|
|
27
|
-
return [
|
|
50
|
+
return [
|
|
51
|
+
...comps,
|
|
52
|
+
{
|
|
53
|
+
...comp,
|
|
54
|
+
order: (_b = (_a = committedOrderRef.current) === null || _a === void 0 ? void 0 : _a.get(orderKey)) !== null && _b !== void 0 ? _b : internalOrder,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
28
57
|
});
|
|
29
58
|
}, [updateCompositions]);
|
|
30
59
|
const unregisterComposition = (0, react_1.useCallback)((id) => {
|
|
60
|
+
internalOrderRef.current.delete((0, sequence_order_marker_js_1.getCompositionAndFolderOrderKey)({ type: 'composition', id }));
|
|
31
61
|
setCompositions((comps) => {
|
|
32
62
|
return comps.filter((c) => c.id !== id);
|
|
33
63
|
});
|
|
34
64
|
}, []);
|
|
35
|
-
const registerFolder = (0, react_1.useCallback)((name, parent,
|
|
65
|
+
const registerFolder = (0, react_1.useCallback)((name, parent, stack) => {
|
|
66
|
+
const orderKey = (0, sequence_order_marker_js_1.getCompositionAndFolderOrderKey)({
|
|
67
|
+
type: 'folder',
|
|
68
|
+
id: (0, sequence_order_marker_js_1.getFolderOrderId)({ name, parent }),
|
|
69
|
+
});
|
|
70
|
+
const internalOrder = nextInternalOrderRef.current++;
|
|
71
|
+
internalOrderRef.current.set(orderKey, internalOrder);
|
|
36
72
|
setFolders((prevFolders) => {
|
|
73
|
+
var _a;
|
|
74
|
+
var _b;
|
|
37
75
|
return [
|
|
38
76
|
...prevFolders,
|
|
39
77
|
{
|
|
40
78
|
name,
|
|
41
79
|
parent,
|
|
42
|
-
|
|
80
|
+
order: (_b = (_a = committedOrderRef.current) === null || _a === void 0 ? void 0 : _a.get(orderKey)) !== null && _b !== void 0 ? _b : internalOrder,
|
|
43
81
|
stack,
|
|
44
82
|
},
|
|
45
83
|
];
|
|
46
84
|
});
|
|
47
85
|
}, []);
|
|
48
86
|
const unregisterFolder = (0, react_1.useCallback)((name, parent) => {
|
|
87
|
+
internalOrderRef.current.delete((0, sequence_order_marker_js_1.getCompositionAndFolderOrderKey)({
|
|
88
|
+
type: 'folder',
|
|
89
|
+
id: (0, sequence_order_marker_js_1.getFolderOrderId)({ name, parent }),
|
|
90
|
+
}));
|
|
49
91
|
setFolders((prevFolders) => {
|
|
50
92
|
return prevFolders.filter((p) => !(p.name === name && p.parent === parent));
|
|
51
93
|
});
|
|
52
94
|
}, []);
|
|
95
|
+
useIsomorphicLayoutEffect(() => {
|
|
96
|
+
if (!isStudio) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
let unmounted = false;
|
|
100
|
+
const onCommitOrder = (event) => {
|
|
101
|
+
const { detail } = event;
|
|
102
|
+
const managerOrder = detail.compositionManagers.find((item) => item.managerId === compositionManagerId);
|
|
103
|
+
if (!managerOrder) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const orderIds = managerOrder.compositionAndFolderOrder.map(sequence_order_marker_js_1.getCompositionAndFolderOrderKey);
|
|
107
|
+
const previousOrder = committedOrderIdsRef.current;
|
|
108
|
+
if (previousOrder !== null &&
|
|
109
|
+
previousOrder.length === orderIds.length &&
|
|
110
|
+
previousOrder.every((id, index) => id === orderIds[index])) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const order = new Map(orderIds.map((id, index) => [id, index]));
|
|
114
|
+
committedOrderIdsRef.current = orderIds;
|
|
115
|
+
committedOrderRef.current = order;
|
|
116
|
+
queueMicrotask(() => {
|
|
117
|
+
if (unmounted) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
updateCompositions((currentCompositions) => {
|
|
121
|
+
let changed = false;
|
|
122
|
+
const nextCompositions = currentCompositions.map((composition) => {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
const nextOrder = (_b = (_a = order.get((0, sequence_order_marker_js_1.getCompositionAndFolderOrderKey)({
|
|
125
|
+
type: 'composition',
|
|
126
|
+
id: composition.id,
|
|
127
|
+
}))) !== null && _a !== void 0 ? _a : internalOrderRef.current.get((0, sequence_order_marker_js_1.getCompositionAndFolderOrderKey)({
|
|
128
|
+
type: 'composition',
|
|
129
|
+
id: composition.id,
|
|
130
|
+
}))) !== null && _b !== void 0 ? _b : composition.order;
|
|
131
|
+
if (nextOrder === composition.order) {
|
|
132
|
+
return composition;
|
|
133
|
+
}
|
|
134
|
+
changed = true;
|
|
135
|
+
return { ...composition, order: nextOrder };
|
|
136
|
+
});
|
|
137
|
+
return changed ? nextCompositions : currentCompositions;
|
|
138
|
+
});
|
|
139
|
+
setFolders((currentFolders) => {
|
|
140
|
+
let changed = false;
|
|
141
|
+
const nextFolders = currentFolders.map((folder) => {
|
|
142
|
+
var _a, _b;
|
|
143
|
+
const nextOrder = (_b = (_a = order.get((0, sequence_order_marker_js_1.getCompositionAndFolderOrderKey)({
|
|
144
|
+
type: 'folder',
|
|
145
|
+
id: (0, sequence_order_marker_js_1.getFolderOrderId)(folder),
|
|
146
|
+
}))) !== null && _a !== void 0 ? _a : internalOrderRef.current.get((0, sequence_order_marker_js_1.getCompositionAndFolderOrderKey)({
|
|
147
|
+
type: 'folder',
|
|
148
|
+
id: (0, sequence_order_marker_js_1.getFolderOrderId)(folder),
|
|
149
|
+
}))) !== null && _b !== void 0 ? _b : folder.order;
|
|
150
|
+
if (nextOrder === folder.order) {
|
|
151
|
+
return folder;
|
|
152
|
+
}
|
|
153
|
+
changed = true;
|
|
154
|
+
return { ...folder, order: nextOrder };
|
|
155
|
+
});
|
|
156
|
+
return changed ? nextFolders : currentFolders;
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
window.addEventListener(sequence_order_marker_js_1.COMMIT_ORDER_EVENT, onCommitOrder);
|
|
161
|
+
return () => {
|
|
162
|
+
unmounted = true;
|
|
163
|
+
window.removeEventListener(sequence_order_marker_js_1.COMMIT_ORDER_EVENT, onCommitOrder);
|
|
164
|
+
};
|
|
165
|
+
}, [compositionManagerId, isStudio, updateCompositions]);
|
|
53
166
|
(0, react_1.useImperativeHandle)(CompositionManager_1.compositionsRef, () => {
|
|
54
167
|
return {
|
|
55
168
|
getCompositions: () => currentcompositionsRef.current,
|
|
@@ -87,6 +200,7 @@ const CompositionManagerProvider = ({ children, onlyRenderComposition, currentCo
|
|
|
87
200
|
currentAssetMetadata,
|
|
88
201
|
canvasContent,
|
|
89
202
|
]);
|
|
90
|
-
|
|
203
|
+
const providers = (jsx_runtime_1.jsx(CompositionManagerContext_1.CompositionManager.Provider, { value: compositionManagerContextValue, children: jsx_runtime_1.jsx(CompositionManagerContext_1.CompositionSetters.Provider, { value: compositionManagerSetters, children: children }) }));
|
|
204
|
+
return isStudio ? (jsx_runtime_1.jsx(sequence_order_marker_js_1.CompositionManagerOrderMarker, { managerId: compositionManagerId, children: providers })) : (providers);
|
|
91
205
|
};
|
|
92
206
|
exports.CompositionManagerProvider = CompositionManagerProvider;
|
package/dist/cjs/Folder.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
|
-
import type { NonceHistory } from './nonce.js';
|
|
3
2
|
export type TFolder = {
|
|
4
3
|
name: string;
|
|
5
4
|
parent: string | null;
|
|
6
|
-
|
|
5
|
+
order: number | null;
|
|
7
6
|
stack: string | null;
|
|
8
7
|
};
|
|
9
8
|
type FolderContextType = {
|
package/dist/cjs/Folder.js
CHANGED
|
@@ -4,8 +4,9 @@ exports.Folder = exports.FolderContext = void 0;
|
|
|
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
|
|
7
|
+
const sequence_order_marker_js_1 = require("./sequence-order-marker.js");
|
|
8
8
|
const truthy_js_1 = require("./truthy.js");
|
|
9
|
+
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
9
10
|
const validate_folder_name_js_1 = require("./validation/validate-folder-name.js");
|
|
10
11
|
exports.FolderContext = (0, react_1.createContext)({
|
|
11
12
|
folderName: null,
|
|
@@ -20,7 +21,7 @@ const Folder = (props) => {
|
|
|
20
21
|
const { name, children } = props;
|
|
21
22
|
const parent = (0, react_1.useContext)(exports.FolderContext);
|
|
22
23
|
const { registerFolder, unregisterFolder } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionSetters);
|
|
23
|
-
const
|
|
24
|
+
const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
24
25
|
const stack = (_a = props
|
|
25
26
|
._remotionInternalStack) !== null && _a !== void 0 ? _a : null;
|
|
26
27
|
(0, validate_folder_name_js_1.validateFolderName)(name);
|
|
@@ -33,7 +34,7 @@ const Folder = (props) => {
|
|
|
33
34
|
};
|
|
34
35
|
}, [name, parentName]);
|
|
35
36
|
(0, react_1.useEffect)(() => {
|
|
36
|
-
registerFolder(name, parentName,
|
|
37
|
+
registerFolder(name, parentName, stack);
|
|
37
38
|
return () => {
|
|
38
39
|
unregisterFolder(name, parentName);
|
|
39
40
|
};
|
|
@@ -43,9 +44,9 @@ const Folder = (props) => {
|
|
|
43
44
|
parentName,
|
|
44
45
|
registerFolder,
|
|
45
46
|
unregisterFolder,
|
|
46
|
-
nonce,
|
|
47
47
|
stack,
|
|
48
48
|
]);
|
|
49
|
-
|
|
49
|
+
const folder = (jsx_runtime_1.jsx(exports.FolderContext.Provider, { value: value, children: children }));
|
|
50
|
+
return environment.isStudio ? (jsx_runtime_1.jsx(sequence_order_marker_js_1.FolderOrderMarker, { folderId: (0, sequence_order_marker_js_1.getFolderOrderId)({ name, parent: parentName }), children: folder })) : (folder);
|
|
50
51
|
};
|
|
51
52
|
exports.Folder = Folder;
|
package/dist/cjs/RemotionRoot.js
CHANGED
|
@@ -7,22 +7,15 @@ const shared_audio_tags_js_1 = require("./audio/shared-audio-tags.js");
|
|
|
7
7
|
const buffering_js_1 = require("./buffering.js");
|
|
8
8
|
const EditorProps_js_1 = require("./EditorProps.js");
|
|
9
9
|
const log_level_context_js_1 = require("./log-level-context.js");
|
|
10
|
-
const nonce_js_1 = require("./nonce.js");
|
|
11
10
|
const prefetch_state_js_1 = require("./prefetch-state.js");
|
|
12
11
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
13
12
|
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
14
13
|
const use_media_enabled_js_1 = require("./use-media-enabled.js");
|
|
15
14
|
const duration_state_js_1 = require("./video/duration-state.js");
|
|
16
15
|
const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLatencyHint, previewSampleRate, videoEnabled, audioEnabled, frameState, _experimentalKeepAudioContextAlive, }) => {
|
|
17
|
-
const nonceContext = (0, react_1.useMemo)(() => {
|
|
18
|
-
let counter = 0;
|
|
19
|
-
return {
|
|
20
|
-
getNonce: () => counter++,
|
|
21
|
-
};
|
|
22
|
-
}, []);
|
|
23
16
|
const logging = (0, react_1.useMemo)(() => {
|
|
24
17
|
return { logLevel, mountTime: Date.now() };
|
|
25
18
|
}, [logLevel]);
|
|
26
|
-
return (jsx_runtime_1.jsx(log_level_context_js_1.LogLevelContext.Provider, { value: logging, children: jsx_runtime_1.jsx(
|
|
19
|
+
return (jsx_runtime_1.jsx(log_level_context_js_1.LogLevelContext.Provider, { value: logging, children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineContextProvider, { frameState: frameState, children: jsx_runtime_1.jsx(use_media_enabled_js_1.MediaEnabledProvider, { videoEnabled: videoEnabled, audioEnabled: audioEnabled, children: jsx_runtime_1.jsx(EditorProps_js_1.EditorPropsProvider, { children: jsx_runtime_1.jsx(prefetch_state_js_1.PrefetchProvider, { children: jsx_runtime_1.jsx(SequenceManager_js_1.SequenceManagerProvider, { children: jsx_runtime_1.jsx(duration_state_js_1.DurationsContextProvider, { children: jsx_runtime_1.jsx(buffering_js_1.BufferingProvider, { children: jsx_runtime_1.jsx(shared_audio_tags_js_1.SharedAudioContextProvider, { audioLatencyHint: audioLatencyHint, audioEnabled: audioEnabled, previewSampleRate: previewSampleRate, _experimentalKeepAudioContextAlive: _experimentalKeepAudioContextAlive, children: jsx_runtime_1.jsx(shared_audio_tags_js_1.SharedAudioTagsContextProvider, { numberOfAudioTags: numberOfAudioTags, children: children }) }) }) }) }) }) }) }) }) }));
|
|
27
20
|
};
|
|
28
21
|
exports.RemotionRootContexts = RemotionRootContexts;
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -8,14 +8,15 @@ const AbsoluteFillElement_js_1 = require("./AbsoluteFillElement.js");
|
|
|
8
8
|
const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
|
|
9
9
|
const freeze_js_1 = require("./freeze.js");
|
|
10
10
|
const interactivity_schema_js_1 = require("./interactivity-schema.js");
|
|
11
|
-
const nonce_js_1 = require("./nonce.js");
|
|
12
11
|
const sequence_crop_js_1 = require("./sequence-crop.js");
|
|
12
|
+
const sequence_order_marker_js_1 = require("./sequence-order-marker.js");
|
|
13
13
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
14
14
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
15
15
|
const is_inside_series_js_1 = require("./series/is-inside-series.js");
|
|
16
16
|
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
17
17
|
const use_premounting_js_1 = require("./use-premounting.js");
|
|
18
18
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
19
|
+
const use_sequence_registration_js_1 = require("./use-sequence-registration.js");
|
|
19
20
|
const use_video_config_js_1 = require("./use-video-config.js");
|
|
20
21
|
const v5_flag_js_1 = require("./v5-flag.js");
|
|
21
22
|
const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
|
|
@@ -28,7 +29,6 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
28
29
|
const cumulatedFrom = parentSequence
|
|
29
30
|
? parentSequence.cumulatedFrom + parentSequence.relativeFrom
|
|
30
31
|
: 0;
|
|
31
|
-
const nonce = (0, nonce_js_1.useNonce)();
|
|
32
32
|
if (layout !== 'absolute-fill' && layout !== 'none') {
|
|
33
33
|
throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
|
|
34
34
|
}
|
|
@@ -88,7 +88,6 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
88
88
|
? Math.min(parentSequence.durationInFrames - effectiveRelativeFrom, durationInFrames)
|
|
89
89
|
: durationInFrames;
|
|
90
90
|
const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
|
|
91
|
-
const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
|
|
92
91
|
const sequenceRegistrationEnabled = (0, react_1.useContext)(SequenceManager_js_1.SequenceRegistrationContext);
|
|
93
92
|
const wrapperRefForOutline = (0, react_1.useRef)(null);
|
|
94
93
|
const refForOutline = other.layout === 'none'
|
|
@@ -225,14 +224,11 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
225
224
|
controlsSchema,
|
|
226
225
|
controlsSupportsEffects,
|
|
227
226
|
]);
|
|
228
|
-
(0, react_1.
|
|
227
|
+
const getSequenceForRegistration = (0, react_1.useCallback)(() => {
|
|
229
228
|
var _a, _b, _c;
|
|
230
|
-
if (!env.isStudio && !sequenceRegistrationEnabled) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
229
|
if (isMedia) {
|
|
234
230
|
if (isMedia.type === 'image') {
|
|
235
|
-
|
|
231
|
+
return {
|
|
236
232
|
type: 'image',
|
|
237
233
|
controls: registrationControls,
|
|
238
234
|
effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
|
|
@@ -244,57 +240,52 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
244
240
|
trimBefore: registeredTrimBefore,
|
|
245
241
|
id,
|
|
246
242
|
loopDisplay,
|
|
247
|
-
nonce: nonce.get(),
|
|
248
243
|
parent: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _a !== void 0 ? _a : null,
|
|
249
244
|
postmountDisplay: postmountDisplay !== null && postmountDisplay !== void 0 ? postmountDisplay : null,
|
|
250
245
|
premountDisplay: premountDisplay !== null && premountDisplay !== void 0 ? premountDisplay : null,
|
|
251
246
|
showInTimeline,
|
|
247
|
+
timelineOrder: null,
|
|
252
248
|
src: isMedia.src,
|
|
253
249
|
getStack: () => stackRef.current,
|
|
254
250
|
refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
|
|
255
251
|
isInsideSeries,
|
|
256
252
|
frozenFrame: registeredFrozenFrame,
|
|
257
253
|
singleChildComponent: singleChildComponent !== null && singleChildComponent !== void 0 ? singleChildComponent : null,
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
registerSequence({
|
|
262
|
-
type: isMedia.type,
|
|
263
|
-
controls: registrationControls,
|
|
264
|
-
effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
|
|
265
|
-
effectRuntimeValues,
|
|
266
|
-
displayName: timelineClipName,
|
|
267
|
-
documentationLink: resolvedDocumentationLink,
|
|
268
|
-
doesVolumeChange: isMedia.data.doesVolumeChange,
|
|
269
|
-
duration: actualDurationInFrames,
|
|
270
|
-
from,
|
|
271
|
-
trimBefore: registeredTrimBefore,
|
|
272
|
-
id,
|
|
273
|
-
loopDisplay,
|
|
274
|
-
nonce: nonce.get(),
|
|
275
|
-
parent: (_b = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _b !== void 0 ? _b : null,
|
|
276
|
-
playbackRate: isMedia.data.playbackRate,
|
|
277
|
-
postmountDisplay: postmountDisplay !== null && postmountDisplay !== void 0 ? postmountDisplay : null,
|
|
278
|
-
premountDisplay: premountDisplay !== null && premountDisplay !== void 0 ? premountDisplay : null,
|
|
279
|
-
showInTimeline,
|
|
280
|
-
src: isMedia.data.src,
|
|
281
|
-
getStack: () => stackRef.current,
|
|
282
|
-
startMediaFrom: startMediaFrom !== null && startMediaFrom !== void 0 ? startMediaFrom : isMedia.data.startMediaFrom,
|
|
283
|
-
mediaFrameAtSequenceZero,
|
|
284
|
-
volume: isMedia.data.volumes,
|
|
285
|
-
muted: isMedia.data.muted,
|
|
286
|
-
refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
|
|
287
|
-
isInsideSeries,
|
|
288
|
-
frozenFrame: registeredFrozenFrame,
|
|
289
|
-
frozenMediaFrame,
|
|
290
|
-
singleChildComponent: singleChildComponent !== null && singleChildComponent !== void 0 ? singleChildComponent : null,
|
|
291
|
-
});
|
|
254
|
+
};
|
|
292
255
|
}
|
|
293
|
-
return
|
|
294
|
-
|
|
256
|
+
return {
|
|
257
|
+
type: isMedia.type,
|
|
258
|
+
controls: registrationControls,
|
|
259
|
+
effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
|
|
260
|
+
effectRuntimeValues,
|
|
261
|
+
displayName: timelineClipName,
|
|
262
|
+
documentationLink: resolvedDocumentationLink,
|
|
263
|
+
doesVolumeChange: isMedia.data.doesVolumeChange,
|
|
264
|
+
duration: actualDurationInFrames,
|
|
265
|
+
from,
|
|
266
|
+
trimBefore: registeredTrimBefore,
|
|
267
|
+
id,
|
|
268
|
+
loopDisplay,
|
|
269
|
+
parent: (_b = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _b !== void 0 ? _b : null,
|
|
270
|
+
playbackRate: isMedia.data.playbackRate,
|
|
271
|
+
postmountDisplay: postmountDisplay !== null && postmountDisplay !== void 0 ? postmountDisplay : null,
|
|
272
|
+
premountDisplay: premountDisplay !== null && premountDisplay !== void 0 ? premountDisplay : null,
|
|
273
|
+
showInTimeline,
|
|
274
|
+
timelineOrder: null,
|
|
275
|
+
src: isMedia.data.src,
|
|
276
|
+
getStack: () => stackRef.current,
|
|
277
|
+
startMediaFrom: startMediaFrom !== null && startMediaFrom !== void 0 ? startMediaFrom : isMedia.data.startMediaFrom,
|
|
278
|
+
mediaFrameAtSequenceZero,
|
|
279
|
+
volume: isMedia.data.volumes,
|
|
280
|
+
muted: isMedia.data.muted,
|
|
281
|
+
refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
|
|
282
|
+
isInsideSeries,
|
|
283
|
+
frozenFrame: registeredFrozenFrame,
|
|
284
|
+
frozenMediaFrame,
|
|
285
|
+
singleChildComponent: singleChildComponent !== null && singleChildComponent !== void 0 ? singleChildComponent : null,
|
|
295
286
|
};
|
|
296
287
|
}
|
|
297
|
-
|
|
288
|
+
return {
|
|
298
289
|
from,
|
|
299
290
|
trimBefore: registeredTrimBefore,
|
|
300
291
|
duration: actualDurationInFrames,
|
|
@@ -304,7 +295,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
304
295
|
parent: (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _c !== void 0 ? _c : null,
|
|
305
296
|
type: 'sequence',
|
|
306
297
|
showInTimeline,
|
|
307
|
-
|
|
298
|
+
timelineOrder: null,
|
|
308
299
|
loopDisplay,
|
|
309
300
|
getStack: () => stackRef.current,
|
|
310
301
|
premountDisplay: premountDisplay !== null && premountDisplay !== void 0 ? premountDisplay : null,
|
|
@@ -316,29 +307,18 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
316
307
|
isInsideSeries,
|
|
317
308
|
frozenFrame: registeredFrozenFrame,
|
|
318
309
|
singleChildComponent: singleChildComponent !== null && singleChildComponent !== void 0 ? singleChildComponent : null,
|
|
319
|
-
});
|
|
320
|
-
return () => {
|
|
321
|
-
unregisterSequence(id);
|
|
322
310
|
};
|
|
323
311
|
}, [
|
|
324
|
-
durationInFrames,
|
|
325
312
|
id,
|
|
326
|
-
name,
|
|
327
|
-
registerSequence,
|
|
328
313
|
timelineClipName,
|
|
329
|
-
unregisterSequence,
|
|
330
314
|
parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id,
|
|
331
315
|
actualDurationInFrames,
|
|
332
316
|
from,
|
|
333
|
-
trimBefore,
|
|
334
317
|
registeredTrimBefore,
|
|
335
318
|
showInTimeline,
|
|
336
|
-
nonce,
|
|
337
319
|
loopDisplay,
|
|
338
320
|
premountDisplay,
|
|
339
321
|
postmountDisplay,
|
|
340
|
-
env.isStudio,
|
|
341
|
-
sequenceRegistrationEnabled,
|
|
342
322
|
registrationControls,
|
|
343
323
|
_remotionInternalEffects,
|
|
344
324
|
effectRuntimeValues,
|
|
@@ -352,6 +332,12 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
352
332
|
frozenMediaFrame,
|
|
353
333
|
singleChildComponent,
|
|
354
334
|
]);
|
|
335
|
+
(0, use_sequence_registration_js_1.useSequenceRegistration)({
|
|
336
|
+
getSequence: env.isStudio || sequenceRegistrationEnabled
|
|
337
|
+
? getSequenceForRegistration
|
|
338
|
+
: null,
|
|
339
|
+
id,
|
|
340
|
+
});
|
|
355
341
|
// Ceil to support floats
|
|
356
342
|
// https://github.com/remotion-dev/remotion/issues/2958
|
|
357
343
|
const endThreshold = Math.ceil(cumulatedFrom + from + durationInFrames - 1);
|
|
@@ -395,9 +381,10 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
395
381
|
throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
|
|
396
382
|
}
|
|
397
383
|
if (hidden) {
|
|
398
|
-
return null;
|
|
384
|
+
return env.isStudio ? (jsx_runtime_1.jsx(sequence_order_marker_js_1.SequenceOrderMarker, { sequenceId: id, children: null })) : null;
|
|
399
385
|
}
|
|
400
|
-
|
|
386
|
+
const sequence = (jsx_runtime_1.jsx(SequenceContext_js_1.SequenceContext.Provider, { value: contextValue, children: frozenContent === null ? null : other.layout === 'none' ? (frozenContent) : (jsx_runtime_1.jsx(AbsoluteFillElement_js_1.AbsoluteFillElement, { ref: sequenceRef, style: defaultStyle, className: other.className, children: frozenContent })) }));
|
|
387
|
+
return env.isStudio ? (jsx_runtime_1.jsx(sequence_order_marker_js_1.SequenceOrderMarker, { sequenceId: id, children: sequence })) : (sequence);
|
|
401
388
|
};
|
|
402
389
|
const RegularSequence = (0, react_1.forwardRef)(RegularSequenceRefForwardingFunction);
|
|
403
390
|
const PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
@@ -3,6 +3,7 @@ import type { TSequence } from './CompositionManager.js';
|
|
|
3
3
|
import type { CanUpdateSequencePropStatus, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, PropStatuses } from './use-schema.js';
|
|
4
4
|
export type SequenceManagerContext = {
|
|
5
5
|
registerSequence: (seq: TSequence) => void;
|
|
6
|
+
updateSequence: ((seq: TSequence) => void) | null;
|
|
6
7
|
unregisterSequence: (id: string) => void;
|
|
7
8
|
sequences: TSequence[];
|
|
8
9
|
};
|