remotion 4.0.459 → 4.0.460
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/Sequence.d.ts +1 -1
- package/dist/cjs/SequenceManager.d.ts +26 -8
- package/dist/cjs/SequenceManager.js +61 -37
- package/dist/cjs/audio/shared-audio-tags.js +12 -9
- package/dist/cjs/buffering.js +5 -0
- package/dist/cjs/internals.d.ts +10 -3
- package/dist/cjs/internals.js +6 -3
- package/dist/cjs/sequence-node-path.d.ts +10 -0
- package/dist/cjs/sequence-node-path.js +12 -0
- package/dist/cjs/series/index.js +0 -3
- package/dist/cjs/use-buffer-state.js +16 -2
- package/dist/cjs/use-schema.d.ts +5 -1
- package/dist/cjs/use-sequence-control-override.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrap-in-schema.js +27 -6
- package/dist/esm/index.mjs +171 -105
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/dist/cjs/audio/Audio.d.ts +0 -56
- package/dist/cjs/audio/Audio.js +0 -101
- package/dist/cjs/video/Video.d.ts +0 -53
- package/dist/cjs/video/Video.js +0 -85
package/dist/cjs/Sequence.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type LayoutAndStyle = AbsoluteFillLayout | {
|
|
|
15
15
|
layout: 'none';
|
|
16
16
|
};
|
|
17
17
|
export type SequencePropsWithoutDuration = {
|
|
18
|
-
readonly children
|
|
18
|
+
readonly children?: React.ReactNode;
|
|
19
19
|
readonly width?: number;
|
|
20
20
|
readonly height?: number;
|
|
21
21
|
readonly from?: number;
|
|
@@ -1,27 +1,45 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TSequence } from './CompositionManager.js';
|
|
3
|
-
import type { CanUpdateSequencePropStatus, CodeValues,
|
|
3
|
+
import type { CanUpdateSequencePropStatus, CodeValues, GetCodeValues, GetDragOverrides } from './use-schema.js';
|
|
4
4
|
export type SequenceManagerContext = {
|
|
5
5
|
registerSequence: (seq: TSequence) => void;
|
|
6
6
|
unregisterSequence: (id: string) => void;
|
|
7
7
|
sequences: TSequence[];
|
|
8
8
|
};
|
|
9
|
+
export type SequenceNodePath = Array<string | number>;
|
|
9
10
|
export declare const SequenceManager: React.Context<SequenceManagerContext>;
|
|
10
11
|
export type SequenceVisibilityToggleState = {
|
|
11
12
|
hidden: Record<string, boolean>;
|
|
12
13
|
setHidden: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
|
|
13
14
|
};
|
|
14
15
|
export declare const SequenceVisibilityToggleContext: React.Context<SequenceVisibilityToggleState>;
|
|
15
|
-
export type
|
|
16
|
+
export type VisualModeGetters = {
|
|
16
17
|
visualModeEnabled: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
codeValues: CodeValues;
|
|
21
|
-
setCodeValues: (sequenceId: string, values: Record<string, CanUpdateSequencePropStatus> | null) => void;
|
|
18
|
+
getDragOverrides: GetDragOverrides;
|
|
19
|
+
getCodeValues: GetCodeValues;
|
|
20
|
+
getIsJsxInMapCallback: (nodePath: SequenceNodePath) => boolean;
|
|
22
21
|
};
|
|
23
|
-
export
|
|
22
|
+
export type VisualModeSetters = {
|
|
23
|
+
setDragOverrides: (nodePath: SequenceNodePath, key: string, value: unknown) => void;
|
|
24
|
+
clearDragOverrides: (nodePath: SequenceNodePath) => void;
|
|
25
|
+
setCodeValues: (nodePath: SequenceNodePath, values: CanUpdateSequencePropsResponse) => void;
|
|
26
|
+
};
|
|
27
|
+
export type CanUpdateSequencePropsResponse = {
|
|
28
|
+
canUpdate: true;
|
|
29
|
+
props: Record<string, CanUpdateSequencePropStatus>;
|
|
30
|
+
nodePath: SequenceNodePath;
|
|
31
|
+
/** True when the JSX is inside a `.map()` callback (list iteration). */
|
|
32
|
+
jsxInMapCallback: boolean;
|
|
33
|
+
} | {
|
|
34
|
+
canUpdate: false;
|
|
35
|
+
reason: string;
|
|
36
|
+
};
|
|
37
|
+
declare const getCodeValues: (codeValues: CodeValues, nodePath: SequenceNodePath) => Record<string, CanUpdateSequencePropStatus> | undefined;
|
|
38
|
+
export type GetCodeValuesType = typeof getCodeValues;
|
|
39
|
+
export declare const VisualModeGettersContext: React.Context<VisualModeGetters>;
|
|
40
|
+
export declare const VisualModeSettersContext: React.Context<VisualModeSetters>;
|
|
24
41
|
export declare const SequenceManagerProvider: React.FC<{
|
|
25
42
|
readonly children: React.ReactNode;
|
|
26
43
|
readonly visualModeEnabled: boolean;
|
|
27
44
|
}>;
|
|
45
|
+
export {};
|
|
@@ -33,9 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SequenceManagerProvider = exports.
|
|
36
|
+
exports.SequenceManagerProvider = exports.VisualModeSettersContext = exports.VisualModeGettersContext = exports.SequenceVisibilityToggleContext = exports.SequenceManager = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
|
+
const nodePathToString = (nodePath) => {
|
|
40
|
+
return nodePath.join('.');
|
|
41
|
+
};
|
|
39
42
|
exports.SequenceManager = react_1.default.createContext({
|
|
40
43
|
registerSequence: () => {
|
|
41
44
|
throw new Error('SequenceManagerContext not initialized');
|
|
@@ -51,19 +54,48 @@ exports.SequenceVisibilityToggleContext = react_1.default.createContext({
|
|
|
51
54
|
throw new Error('SequenceVisibilityToggle not initialized');
|
|
52
55
|
},
|
|
53
56
|
});
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
const getCodeValues = (codeValues, nodePath) => {
|
|
58
|
+
const status = codeValues[nodePathToString(nodePath)];
|
|
59
|
+
if (!status) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
if (!status.canUpdate) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
return status.props;
|
|
66
|
+
};
|
|
67
|
+
const getIsJsxInMapCallback = (codeValues, nodePath) => {
|
|
68
|
+
const status = codeValues[nodePathToString(nodePath)];
|
|
69
|
+
if (!status) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (!status.canUpdate) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return status.jsxInMapCallback;
|
|
76
|
+
};
|
|
77
|
+
exports.VisualModeGettersContext = react_1.default.createContext({
|
|
78
|
+
getDragOverrides: () => {
|
|
79
|
+
throw new Error('VisualModeGettersContext not initialized');
|
|
80
|
+
},
|
|
81
|
+
getCodeValues: () => {
|
|
82
|
+
throw new Error('VisualModeGettersContext not initialized');
|
|
83
|
+
},
|
|
84
|
+
getIsJsxInMapCallback: () => {
|
|
85
|
+
throw new Error('VisualModeGettersContext not initialized');
|
|
86
|
+
},
|
|
87
|
+
visualModeEnabled: false,
|
|
88
|
+
});
|
|
89
|
+
exports.VisualModeSettersContext = react_1.default.createContext({
|
|
56
90
|
setDragOverrides: () => {
|
|
57
|
-
throw new Error('
|
|
91
|
+
throw new Error('VisualModeSettersContext not initialized');
|
|
58
92
|
},
|
|
59
93
|
clearDragOverrides: () => {
|
|
60
|
-
throw new Error('
|
|
94
|
+
throw new Error('VisualModeSettersContext not initialized');
|
|
61
95
|
},
|
|
62
|
-
codeValues: {},
|
|
63
96
|
setCodeValues: () => {
|
|
64
|
-
throw new Error('
|
|
97
|
+
throw new Error('VisualModeSettersContext not initialized');
|
|
65
98
|
},
|
|
66
|
-
visualModeEnabled: false,
|
|
67
99
|
});
|
|
68
100
|
const SequenceManagerProvider = ({ children, visualModeEnabled }) => {
|
|
69
101
|
const [sequences, setSequences] = (0, react_1.useState)([]);
|
|
@@ -72,39 +104,33 @@ const SequenceManagerProvider = ({ children, visualModeEnabled }) => {
|
|
|
72
104
|
const controlOverridesRef = (0, react_1.useRef)(dragOverrides);
|
|
73
105
|
controlOverridesRef.current = dragOverrides;
|
|
74
106
|
const [codeValues, setCodeValuesMapState] = (0, react_1.useState)({});
|
|
75
|
-
const setDragOverrides = (0, react_1.useCallback)((
|
|
107
|
+
const setDragOverrides = (0, react_1.useCallback)((nodePath, key, value) => {
|
|
76
108
|
setControlOverrides((prev) => ({
|
|
77
109
|
...prev,
|
|
78
|
-
[
|
|
79
|
-
...prev[
|
|
110
|
+
[nodePathToString(nodePath)]: {
|
|
111
|
+
...prev[nodePathToString(nodePath)],
|
|
80
112
|
[key]: value,
|
|
81
113
|
},
|
|
82
114
|
}));
|
|
83
115
|
}, []);
|
|
84
|
-
const clearDragOverrides = (0, react_1.useCallback)((
|
|
116
|
+
const clearDragOverrides = (0, react_1.useCallback)((nodePath) => {
|
|
85
117
|
setControlOverrides((prev) => {
|
|
86
|
-
|
|
118
|
+
const key = nodePathToString(nodePath);
|
|
119
|
+
if (!prev[key]) {
|
|
87
120
|
return prev;
|
|
88
121
|
}
|
|
89
122
|
const next = { ...prev };
|
|
90
|
-
delete next[
|
|
123
|
+
delete next[key];
|
|
91
124
|
return next;
|
|
92
125
|
});
|
|
93
126
|
}, []);
|
|
94
|
-
const setCodeValues = (0, react_1.useCallback)((
|
|
127
|
+
const setCodeValues = (0, react_1.useCallback)((nodePath, values) => {
|
|
95
128
|
setCodeValuesMapState((prev) => {
|
|
96
|
-
|
|
129
|
+
const key = nodePathToString(nodePath);
|
|
130
|
+
if (prev[key] === values) {
|
|
97
131
|
return prev;
|
|
98
132
|
}
|
|
99
|
-
|
|
100
|
-
if (!(sequenceId in prev)) {
|
|
101
|
-
return prev;
|
|
102
|
-
}
|
|
103
|
-
const next = { ...prev };
|
|
104
|
-
delete next[sequenceId];
|
|
105
|
-
return next;
|
|
106
|
-
}
|
|
107
|
-
return { ...prev, [sequenceId]: values };
|
|
133
|
+
return { ...prev, [key]: values };
|
|
108
134
|
});
|
|
109
135
|
}, []);
|
|
110
136
|
const registerSequence = (0, react_1.useCallback)((seq) => {
|
|
@@ -128,23 +154,21 @@ const SequenceManagerProvider = ({ children, visualModeEnabled }) => {
|
|
|
128
154
|
setHidden,
|
|
129
155
|
};
|
|
130
156
|
}, [hidden]);
|
|
131
|
-
const
|
|
157
|
+
const gettersContext = (0, react_1.useMemo)(() => {
|
|
132
158
|
return {
|
|
133
159
|
visualModeEnabled,
|
|
134
|
-
dragOverrides,
|
|
160
|
+
getDragOverrides: (nodePath) => { var _a; return (_a = dragOverrides[nodePathToString(nodePath)]) !== null && _a !== void 0 ? _a : {}; },
|
|
161
|
+
getCodeValues: (nodePath) => getCodeValues(codeValues, nodePath),
|
|
162
|
+
getIsJsxInMapCallback: (nodePath) => getIsJsxInMapCallback(codeValues, nodePath),
|
|
163
|
+
};
|
|
164
|
+
}, [visualModeEnabled, dragOverrides, codeValues]);
|
|
165
|
+
const settersContext = (0, react_1.useMemo)(() => {
|
|
166
|
+
return {
|
|
135
167
|
setDragOverrides,
|
|
136
168
|
clearDragOverrides,
|
|
137
|
-
codeValues,
|
|
138
169
|
setCodeValues,
|
|
139
170
|
};
|
|
140
|
-
}, [
|
|
141
|
-
|
|
142
|
-
dragOverrides,
|
|
143
|
-
setDragOverrides,
|
|
144
|
-
clearDragOverrides,
|
|
145
|
-
codeValues,
|
|
146
|
-
setCodeValues,
|
|
147
|
-
]);
|
|
148
|
-
return ((0, jsx_runtime_1.jsx)(exports.SequenceManager.Provider, { value: sequenceContext, children: (0, jsx_runtime_1.jsx)(exports.SequenceVisibilityToggleContext.Provider, { value: hiddenContext, children: (0, jsx_runtime_1.jsx)(exports.VisualModeOverridesContext.Provider, { value: overrideContext, children: children }) }) }));
|
|
171
|
+
}, [setDragOverrides, clearDragOverrides, setCodeValues]);
|
|
172
|
+
return ((0, jsx_runtime_1.jsx)(exports.SequenceManager.Provider, { value: sequenceContext, children: (0, jsx_runtime_1.jsx)(exports.SequenceVisibilityToggleContext.Provider, { value: hiddenContext, children: (0, jsx_runtime_1.jsx)(exports.VisualModeGettersContext.Provider, { value: gettersContext, children: (0, jsx_runtime_1.jsx)(exports.VisualModeSettersContext.Provider, { value: settersContext, children: children }) }) }) }));
|
|
149
173
|
};
|
|
150
174
|
exports.SequenceManagerProvider = SequenceManagerProvider;
|
|
@@ -114,8 +114,9 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled }
|
|
|
114
114
|
if (!ctxAndGain) {
|
|
115
115
|
throw new Error('Audio context not found');
|
|
116
116
|
}
|
|
117
|
+
const saveForLater = ctxAndGain.audioContext.state === 'suspended' && !isResuming.current;
|
|
117
118
|
if (duration > 0) {
|
|
118
|
-
if (
|
|
119
|
+
if (saveForLater) {
|
|
119
120
|
nodesToResume.current.set(node, {
|
|
120
121
|
scheduledTime,
|
|
121
122
|
offset,
|
|
@@ -137,16 +138,16 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled }
|
|
|
137
138
|
Math.abs(scheduledTime - prev.scheduledEndTime) > 0.001;
|
|
138
139
|
const mediaMismatch = prev.mediaEndTime !== null &&
|
|
139
140
|
Math.abs(mediaTime - prev.mediaEndTime) > 0.001;
|
|
140
|
-
log_js_1.Log.verbose({ logLevel, tag: 'audio-scheduling' }, 'scheduled %c%s%c %s %c%s%c %s %c%s%c %s %s %s', scheduledMismatch ? 'color: red; font-weight: bold' : '', scheduledTime.toFixed(4), '', scheduledEndTime.toFixed(4), mediaMismatch ? 'color: red; font-weight: bold' : '', mediaTime.toFixed(4), '', mediaEndTime.toFixed(4), duration < 0
|
|
141
|
+
log_js_1.Log.verbose({ logLevel, tag: 'audio-scheduling' }, 'scheduled %c%s%c %s %c%s%c %s %c%s%c %s %s %s %s %s', scheduledMismatch ? 'color: red; font-weight: bold' : '', scheduledTime.toFixed(4), '', scheduledEndTime.toFixed(4), mediaMismatch ? 'color: red; font-weight: bold' : '', mediaTime.toFixed(4), '', mediaEndTime.toFixed(4), duration < 0
|
|
141
142
|
? 'color: red; font-weight: bold'
|
|
142
143
|
: timeDiff < 0
|
|
143
144
|
? 'color: red; font-weight: bold'
|
|
144
145
|
: 'color: blue; font-weight: bold', duration < 0
|
|
145
146
|
? 'missed ' + Math.abs(offset).toFixed(2) + 's'
|
|
146
147
|
: Math.abs(timeDiff).toFixed(2) +
|
|
147
|
-
(timeDiff < 0 ? ' delay' : ' ahead'), '', 'current=' + currentTime.toFixed(4), 'offset=' + offset.toFixed(4), 'latency=' + latency.toFixed(4), 'state=' + ctxAndGain.audioContext.state, originalUnloopedMediaTimestamp !== mediaTime
|
|
148
|
+
(timeDiff < 0 ? ' delay' : ' ahead'), '', 'current=' + currentTime.toFixed(4), 'actualcurrent=' + ctxAndGain.audioContext.currentTime.toFixed(4), 'offset=' + offset.toFixed(4), 'latency=' + latency.toFixed(4), 'state=' + ctxAndGain.audioContext.state, originalUnloopedMediaTimestamp !== mediaTime
|
|
148
149
|
? 'original_ts=' + originalUnloopedMediaTimestamp.toFixed(4)
|
|
149
|
-
: '');
|
|
150
|
+
: '', 'action=' + (saveForLater ? 'schedule' : 'start'), '');
|
|
150
151
|
prev.scheduledEndTime = scheduledEndTime;
|
|
151
152
|
prev.mediaEndTime = mediaEndTime;
|
|
152
153
|
return duration > 0
|
|
@@ -168,6 +169,13 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled }
|
|
|
168
169
|
return Promise.resolve();
|
|
169
170
|
}
|
|
170
171
|
audioContextIsPlayingEventually.current = true;
|
|
172
|
+
ctxAndGain.gainNode.gain.cancelScheduledValues(ctxAndGain.audioContext.currentTime);
|
|
173
|
+
ctxAndGain.gainNode.gain.setValueAtTime(0, ctxAndGain.audioContext.currentTime);
|
|
174
|
+
ctxAndGain.gainNode.gain.linearRampToValueAtTime(1, ctxAndGain.audioContext.currentTime + 0.03);
|
|
175
|
+
nodesToResume.current.forEach((r, node) => {
|
|
176
|
+
node.start(r.scheduledTime, r.offset, r.duration);
|
|
177
|
+
});
|
|
178
|
+
nodesToResume.current.clear();
|
|
171
179
|
const resumePromise = ctxAndGain.audioContext.resume();
|
|
172
180
|
isResuming.current = new Promise((resolve) => {
|
|
173
181
|
(0, wait_until_actually_resumed_js_1.waitUntilActuallyResumed)(ctxAndGain.audioContext, logLevel).then(resolve);
|
|
@@ -178,11 +186,6 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled }
|
|
|
178
186
|
}).finally(() => {
|
|
179
187
|
isResuming.current = null;
|
|
180
188
|
});
|
|
181
|
-
ctxAndGain.gainNode.gain.cancelScheduledValues(ctxAndGain.audioContext.currentTime);
|
|
182
|
-
ctxAndGain.gainNode.gain.setValueAtTime(0, ctxAndGain.audioContext.currentTime);
|
|
183
|
-
ctxAndGain.gainNode.gain.linearRampToValueAtTime(1, ctxAndGain.audioContext.currentTime + 0.03);
|
|
184
|
-
nodesToResume.current.forEach((r, node) => node.start(r.scheduledTime, r.offset, r.duration));
|
|
185
|
-
nodesToResume.current.clear();
|
|
186
189
|
return resumePromise.catch(() => {
|
|
187
190
|
// Already logged above; swallow to avoid unhandled rejection
|
|
188
191
|
// since callers (e.g. use-playback.ts) do not await this.
|
package/dist/cjs/buffering.js
CHANGED
|
@@ -52,9 +52,14 @@ const useBufferManager = (logLevel, mountTime) => {
|
|
|
52
52
|
unblock: () => undefined,
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
+
let unblocked = false;
|
|
55
56
|
setBlocks((b) => [...b, block]);
|
|
56
57
|
return {
|
|
57
58
|
unblock: () => {
|
|
59
|
+
if (unblocked) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
unblocked = true;
|
|
58
63
|
setBlocks((b) => {
|
|
59
64
|
const newArr = b.filter((bx) => bx !== block);
|
|
60
65
|
if (newArr.length === b.length) {
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -9,10 +9,15 @@ import type { LoggingContextValue } from './log-level-context.js';
|
|
|
9
9
|
import type { NonceHistory } from './nonce.js';
|
|
10
10
|
import type { RemotionEnvironment } from './remotion-environment-context.js';
|
|
11
11
|
import type { SequenceFieldSchema, SequenceSchema } from './sequence-field-schema.js';
|
|
12
|
+
import type { OverrideIdToNodePaths, OverrideToNodePathGetters, OverrideToNodeSetters } from './sequence-node-path.js';
|
|
13
|
+
import { OverrideIdsToNodePathsSettersContext } from './sequence-node-path.js';
|
|
14
|
+
import { OverrideIdsToNodePathsGettersContext } from './sequence-node-path.js';
|
|
12
15
|
import type { ResolvedStackLocation } from './sequence-stack-traces.js';
|
|
16
|
+
import type { CanUpdateSequencePropsResponse, SequenceNodePath } from './SequenceManager.js';
|
|
13
17
|
import * as TimelinePosition from './timeline-position-state.js';
|
|
14
18
|
import { type PlaybackRateContextValue, type SetTimelineContextValue, type TimelineContextValue } from './TimelineContext.js';
|
|
15
19
|
import { truthy } from './truthy.js';
|
|
20
|
+
import type { GetCodeValues, GetDragOverrides } from './use-schema.js';
|
|
16
21
|
import { type CanUpdateSequencePropStatus, type CodeValues, type DragOverrides } from './use-schema.js';
|
|
17
22
|
import type { MediaVolumeContextValue, SetMediaVolumeContextValue } from './volume-position-state.js';
|
|
18
23
|
import type { WatchRemotionStaticFilesPayload } from './watch-static-file.js';
|
|
@@ -78,7 +83,8 @@ export declare const Internals: {
|
|
|
78
83
|
}, "ref"> & import("react").RefAttributes<HTMLVideoElement>>;
|
|
79
84
|
readonly CompositionManager: import("react").Context<CompositionManagerContext>;
|
|
80
85
|
readonly CompositionSetters: import("react").Context<import("./CompositionManagerContext.js").CompositionManagerSetters>;
|
|
81
|
-
readonly
|
|
86
|
+
readonly VisualModeGettersContext: import("react").Context<import("./SequenceManager.js").VisualModeGetters>;
|
|
87
|
+
readonly VisualModeSettersContext: import("react").Context<import("./SequenceManager.js").VisualModeSetters>;
|
|
82
88
|
readonly SequenceManager: import("react").Context<import("./SequenceManager.js").SequenceManagerContext>;
|
|
83
89
|
readonly SequenceStackTracesUpdateContext: import("react").Context<import("./sequence-stack-traces.js").UpdateResolvedStackTraceFn>;
|
|
84
90
|
readonly SequenceVisibilityToggleContext: import("react").Context<import("./SequenceManager.js").SequenceVisibilityToggleState>;
|
|
@@ -157,7 +163,6 @@ export declare const Internals: {
|
|
|
157
163
|
};
|
|
158
164
|
readonly flattenActiveSchema: (schema: SequenceSchema, resolve: import("./flatten-schema.js").ResolveValue) => SequenceSchema;
|
|
159
165
|
readonly getFlatSchemaWithAllKeys: (schema: SequenceSchema) => SequenceSchema;
|
|
160
|
-
readonly useSequenceControlOverride: (key: string) => unknown | undefined;
|
|
161
166
|
readonly RemotionRootContexts: import("react").FC<{
|
|
162
167
|
readonly children: React.ReactNode;
|
|
163
168
|
readonly numberOfAudioTags: number;
|
|
@@ -541,5 +546,7 @@ export declare const Internals: {
|
|
|
541
546
|
overrideValues: Record<string, unknown>;
|
|
542
547
|
propStatus: Record<string, CanUpdateSequencePropStatus> | undefined;
|
|
543
548
|
}) => Record<string, unknown>;
|
|
549
|
+
readonly OverrideIdsToNodePathsGettersContext: import("react").Context<OverrideToNodePathGetters>;
|
|
550
|
+
readonly OverrideIdsToNodePathsSettersContext: import("react").Context<OverrideToNodeSetters>;
|
|
544
551
|
};
|
|
545
|
-
export type { CompositionManagerContext, ResolvedStackLocation, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SequenceFieldSchema, SequenceSchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, PlaybackRateContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, ScheduleAudioNodeOptions, CanUpdateSequencePropStatus, CodeValues, DragOverrides, ScheduleAudioNodeResult, NonceHistory, };
|
|
552
|
+
export type { CompositionManagerContext, ResolvedStackLocation, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SequenceFieldSchema, SequenceSchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, PlaybackRateContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, ScheduleAudioNodeOptions, CanUpdateSequencePropStatus, CodeValues, GetCodeValues, DragOverrides, ScheduleAudioNodeResult, GetDragOverrides, NonceHistory, OverrideIdsToNodePathsGettersContext, OverrideIdsToNodePathsSettersContext, SequenceNodePath, OverrideIdToNodePaths, OverrideToNodeSetters, OverrideToNodePathGetters, CanUpdateSequencePropsResponse, };
|
package/dist/cjs/internals.js
CHANGED
|
@@ -76,6 +76,8 @@ const RenderAssetManager_js_1 = require("./RenderAssetManager.js");
|
|
|
76
76
|
const resolve_video_config_js_1 = require("./resolve-video-config.js");
|
|
77
77
|
const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
|
|
78
78
|
const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
|
|
79
|
+
const sequence_node_path_js_1 = require("./sequence-node-path.js");
|
|
80
|
+
const sequence_node_path_js_2 = require("./sequence-node-path.js");
|
|
79
81
|
const sequence_stack_traces_js_1 = require("./sequence-stack-traces.js");
|
|
80
82
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
81
83
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
@@ -90,7 +92,6 @@ const use_lazy_component_js_1 = require("./use-lazy-component.js");
|
|
|
90
92
|
const use_media_enabled_js_1 = require("./use-media-enabled.js");
|
|
91
93
|
const use_media_in_timeline_js_1 = require("./use-media-in-timeline.js");
|
|
92
94
|
const use_schema_js_1 = require("./use-schema.js");
|
|
93
|
-
const use_sequence_control_override_js_1 = require("./use-sequence-control-override.js");
|
|
94
95
|
const use_unsafe_video_config_js_1 = require("./use-unsafe-video-config.js");
|
|
95
96
|
const use_video_js_1 = require("./use-video.js");
|
|
96
97
|
const validate_media_props_js_1 = require("./validate-media-props.js");
|
|
@@ -126,7 +127,8 @@ exports.Internals = {
|
|
|
126
127
|
VideoForPreview: VideoForPreview_js_1.VideoForPreview,
|
|
127
128
|
CompositionManager: CompositionManagerContext_js_1.CompositionManager,
|
|
128
129
|
CompositionSetters: CompositionManagerContext_js_1.CompositionSetters,
|
|
129
|
-
|
|
130
|
+
VisualModeGettersContext: SequenceManager_js_1.VisualModeGettersContext,
|
|
131
|
+
VisualModeSettersContext: SequenceManager_js_1.VisualModeSettersContext,
|
|
130
132
|
SequenceManager: SequenceManager_js_1.SequenceManager,
|
|
131
133
|
SequenceStackTracesUpdateContext: sequence_stack_traces_js_1.SequenceStackTracesUpdateContext,
|
|
132
134
|
SequenceVisibilityToggleContext: SequenceManager_js_1.SequenceVisibilityToggleContext,
|
|
@@ -135,7 +137,6 @@ exports.Internals = {
|
|
|
135
137
|
sequenceStyleSchema: sequence_field_schema_js_1.sequenceStyleSchema,
|
|
136
138
|
flattenActiveSchema: flatten_schema_js_1.flattenActiveSchema,
|
|
137
139
|
getFlatSchemaWithAllKeys: flatten_schema_js_1.getFlatSchemaWithAllKeys,
|
|
138
|
-
useSequenceControlOverride: use_sequence_control_override_js_1.useSequenceControlOverride,
|
|
139
140
|
RemotionRootContexts: RemotionRoot_js_1.RemotionRootContexts,
|
|
140
141
|
CompositionManagerProvider: CompositionManagerProvider_js_1.CompositionManagerProvider,
|
|
141
142
|
useVideo: use_video_js_1.useVideo,
|
|
@@ -229,4 +230,6 @@ exports.Internals = {
|
|
|
229
230
|
defineEffect: define_effect_js_1.defineEffect,
|
|
230
231
|
createDescriptor: define_effect_js_1.createDescriptor,
|
|
231
232
|
computeEffectiveSchemaValuesDotNotation: use_schema_js_1.computeEffectiveSchemaValuesDotNotation,
|
|
233
|
+
OverrideIdsToNodePathsGettersContext: sequence_node_path_js_2.OverrideIdsToNodePathsGettersContext,
|
|
234
|
+
OverrideIdsToNodePathsSettersContext: sequence_node_path_js_1.OverrideIdsToNodePathsSettersContext,
|
|
232
235
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SequenceNodePath } from './SequenceManager';
|
|
2
|
+
export type OverrideIdToNodePaths = Record<string, SequenceNodePath>;
|
|
3
|
+
export type OverrideToNodePathGetters = {
|
|
4
|
+
overrideIdToNodePathMappings: OverrideIdToNodePaths;
|
|
5
|
+
};
|
|
6
|
+
export type OverrideToNodeSetters = {
|
|
7
|
+
setOverrideIdToNodePath: (overrideId: string, nodePath: SequenceNodePath) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const OverrideIdsToNodePathsGettersContext: import("react").Context<OverrideToNodePathGetters>;
|
|
10
|
+
export declare const OverrideIdsToNodePathsSettersContext: import("react").Context<OverrideToNodeSetters>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OverrideIdsToNodePathsSettersContext = exports.OverrideIdsToNodePathsGettersContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.OverrideIdsToNodePathsGettersContext = (0, react_1.createContext)({
|
|
6
|
+
overrideIdToNodePathMappings: {},
|
|
7
|
+
});
|
|
8
|
+
exports.OverrideIdsToNodePathsSettersContext = (0, react_1.createContext)({
|
|
9
|
+
setOverrideIdToNodePath: () => {
|
|
10
|
+
throw new Error('OverrideIdsToNodePathsSettersContext not initialized');
|
|
11
|
+
},
|
|
12
|
+
});
|
package/dist/cjs/series/index.js
CHANGED
|
@@ -34,9 +34,6 @@ const SeriesInner = (props) => {
|
|
|
34
34
|
throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but got ${castedChild} instead`);
|
|
35
35
|
}
|
|
36
36
|
const debugInfo = `index = ${i}, duration = ${castedChild.props.durationInFrames}`;
|
|
37
|
-
if (!(castedChild === null || castedChild === void 0 ? void 0 : castedChild.props.children)) {
|
|
38
|
-
throw new TypeError(`A <Series.Sequence /> component (${debugInfo}) was detected to not have any children. Delete it to fix this error.`);
|
|
39
|
-
}
|
|
40
37
|
const durationInFramesProp = castedChild.props.durationInFrames;
|
|
41
38
|
const { durationInFrames, children: _children, from, name, ...passedProps } = castedChild.props; // `from` is not accepted and must be filtered out if used in JS
|
|
42
39
|
if (i !== flattenedChildren.length - 1 ||
|
|
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useBufferState = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const buffering_1 = require("./buffering");
|
|
6
|
+
const log_1 = require("./log");
|
|
7
|
+
const log_level_context_1 = require("./log-level-context");
|
|
6
8
|
const useBufferState = () => {
|
|
7
9
|
const buffer = (0, react_1.useContext)(buffering_1.BufferingContextReact);
|
|
10
|
+
const logLevel = (0, log_level_context_1.useLogLevel)();
|
|
8
11
|
// Allows <Img> tag to be rendered without a context
|
|
9
12
|
// https://github.com/remotion-dev/remotion/issues/4007
|
|
10
13
|
const addBlock = buffer ? buffer.addBlock : null;
|
|
@@ -13,11 +16,22 @@ const useBufferState = () => {
|
|
|
13
16
|
if (!addBlock) {
|
|
14
17
|
throw new Error('Tried to enable the buffering state, but a Remotion context was not found. This API can only be called in a component that was passed to the Remotion Player or a <Composition>. Or you might have experienced a version mismatch - run `npx remotion versions` and ensure all packages have the same version. This error is thrown by the buffer state https://remotion.dev/docs/player/buffer-state');
|
|
15
18
|
}
|
|
19
|
+
log_1.Log.trace({ logLevel, tag: '[buffer-state]' }, 'Adding buffer handle', new Error().stack);
|
|
16
20
|
const { unblock } = addBlock({
|
|
17
21
|
id: String(Math.random()),
|
|
18
22
|
});
|
|
19
|
-
|
|
23
|
+
let unblocked = false;
|
|
24
|
+
return {
|
|
25
|
+
unblock: () => {
|
|
26
|
+
if (unblocked) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
unblocked = true;
|
|
30
|
+
log_1.Log.trace({ logLevel, tag: '[buffer-state]' }, 'Removing buffer handle');
|
|
31
|
+
unblock();
|
|
32
|
+
},
|
|
33
|
+
};
|
|
20
34
|
},
|
|
21
|
-
}), [addBlock]);
|
|
35
|
+
}), [addBlock, logLevel]);
|
|
22
36
|
};
|
|
23
37
|
exports.useBufferState = useBufferState;
|
package/dist/cjs/use-schema.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SequenceSchema } from './sequence-field-schema.js';
|
|
2
|
+
import type { CanUpdateSequencePropsResponse, SequenceNodePath } from './SequenceManager.js';
|
|
2
3
|
export type CanUpdateSequencePropStatus = {
|
|
3
4
|
canUpdate: true;
|
|
4
5
|
codeValue: unknown;
|
|
@@ -7,7 +8,10 @@ export type CanUpdateSequencePropStatus = {
|
|
|
7
8
|
reason: 'computed';
|
|
8
9
|
};
|
|
9
10
|
export type DragOverrides = Record<string, Record<string, unknown>>;
|
|
10
|
-
export type CodeValues = Record<string,
|
|
11
|
+
export type CodeValues = Record<string, CanUpdateSequencePropsResponse>;
|
|
12
|
+
export type GetCodeValues = (nodePath: SequenceNodePath) => Record<string, CanUpdateSequencePropStatus> | undefined;
|
|
13
|
+
export type GetIsJsxInMapCallback = (nodePath: SequenceNodePath) => boolean;
|
|
14
|
+
export type GetDragOverrides = (nodePath: SequenceNodePath) => DragOverrides[string];
|
|
11
15
|
export declare const computeEffectiveSchemaValuesDotNotation: ({ schema, currentValue, overrideValues, propStatus, }: {
|
|
12
16
|
schema: SequenceSchema;
|
|
13
17
|
currentValue: Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useSequenceControlOverride: (key: string) => unknown
|
|
1
|
+
export declare const useSequenceControlOverride: (key: string) => unknown;
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.wrapInSchema = exports.mergeValues = exports.selectActiveKeys = exports.readValuesFromProps = exports.getNestedValue = void 0;
|
|
37
37
|
const react_1 = __importStar(require("react"));
|
|
38
38
|
const flatten_schema_js_1 = require("./flatten-schema.js");
|
|
39
|
+
const sequence_node_path_js_1 = require("./sequence-node-path.js");
|
|
39
40
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
40
41
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
41
42
|
const use_schema_js_1 = require("./use-schema.js");
|
|
@@ -91,6 +92,7 @@ const mergeValues = ({ props, valuesDotNotation, schemaKeys, }) => {
|
|
|
91
92
|
return merged;
|
|
92
93
|
};
|
|
93
94
|
exports.mergeValues = mergeValues;
|
|
95
|
+
const stackToOverrideMap = {};
|
|
94
96
|
const wrapInSchema = (Component, schema) => {
|
|
95
97
|
var _a;
|
|
96
98
|
if (typeof process === 'undefined' ||
|
|
@@ -101,8 +103,10 @@ const wrapInSchema = (Component, schema) => {
|
|
|
101
103
|
const flatSchema = (0, flatten_schema_js_1.getFlatSchemaWithAllKeys)(schema);
|
|
102
104
|
const flatKeys = Object.keys(flatSchema);
|
|
103
105
|
const Wrapped = (0, react_1.forwardRef)((props, ref) => {
|
|
106
|
+
var _a;
|
|
104
107
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
105
|
-
const { visualModeEnabled,
|
|
108
|
+
const { visualModeEnabled, getDragOverrides, getCodeValues } = (0, react_1.useContext)(SequenceManager_js_1.VisualModeGettersContext);
|
|
109
|
+
const nodePathMapping = (0, react_1.useContext)(sequence_node_path_js_1.OverrideIdsToNodePathsGettersContext);
|
|
106
110
|
if (!env.isStudio ||
|
|
107
111
|
env.isReadOnlyStudio ||
|
|
108
112
|
env.isRendering ||
|
|
@@ -122,7 +126,20 @@ const wrapInSchema = (Component, schema) => {
|
|
|
122
126
|
});
|
|
123
127
|
}
|
|
124
128
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
125
|
-
const [overrideId] = (0, react_1.useState)(() =>
|
|
129
|
+
const [overrideId] = (0, react_1.useState)(() => {
|
|
130
|
+
const { stack } = props;
|
|
131
|
+
if (!stack) {
|
|
132
|
+
return String(Math.random());
|
|
133
|
+
}
|
|
134
|
+
const existingOverrideId = stackToOverrideMap[stack];
|
|
135
|
+
if (existingOverrideId) {
|
|
136
|
+
return existingOverrideId;
|
|
137
|
+
}
|
|
138
|
+
const newOverrideId = String(Math.random());
|
|
139
|
+
stackToOverrideMap[stack] = newOverrideId;
|
|
140
|
+
return newOverrideId;
|
|
141
|
+
});
|
|
142
|
+
const nodePath = (_a = nodePathMapping.overrideIdToNodePathMappings[overrideId]) !== null && _a !== void 0 ? _a : null;
|
|
126
143
|
// Read the runtime values for every flat key from the JSX props,
|
|
127
144
|
// memoized on the leaf values so the object reference is stable
|
|
128
145
|
// when nothing changed — otherwise downstream `useMemo`s churn and
|
|
@@ -143,14 +160,18 @@ const wrapInSchema = (Component, schema) => {
|
|
|
143
160
|
// 3. Apply drag/code overrides on top of the runtime values.
|
|
144
161
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
145
162
|
const valuesDotNotation = (0, react_1.useMemo)(() => {
|
|
146
|
-
var _a;
|
|
147
163
|
return (0, use_schema_js_1.computeEffectiveSchemaValuesDotNotation)({
|
|
148
164
|
schema,
|
|
149
165
|
currentValue: currentRuntimeValueDotNotation,
|
|
150
|
-
overrideValues:
|
|
151
|
-
propStatus:
|
|
166
|
+
overrideValues: nodePath === null ? {} : getDragOverrides(nodePath),
|
|
167
|
+
propStatus: nodePath === null ? undefined : getCodeValues(nodePath),
|
|
152
168
|
});
|
|
153
|
-
}, [
|
|
169
|
+
}, [
|
|
170
|
+
currentRuntimeValueDotNotation,
|
|
171
|
+
getDragOverrides,
|
|
172
|
+
nodePath,
|
|
173
|
+
getCodeValues,
|
|
174
|
+
]);
|
|
154
175
|
// 4. Eliminate values forbidden by the resolved discriminated union.
|
|
155
176
|
const activeKeys = (0, exports.selectActiveKeys)(schema, valuesDotNotation);
|
|
156
177
|
// 5. Apply the active values back onto the props.
|