remotion 4.0.535 → 4.0.537
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/AbsoluteFill.d.ts +1 -1
- package/dist/cjs/CompositionManagerContext.d.ts +3 -0
- package/dist/cjs/CompositionManagerContext.js +5 -3
- package/dist/cjs/CompositionManagerProvider.js +3 -1
- package/dist/cjs/HtmlInCanvas.d.ts +4 -2
- package/dist/cjs/HtmlInCanvas.js +70 -19
- package/dist/cjs/Img.d.ts +4 -2
- package/dist/cjs/Img.js +2 -2
- package/dist/cjs/Interactive.d.ts +21 -7
- package/dist/cjs/Interactive.js +22 -1
- package/dist/cjs/Sequence.js +47 -3
- package/dist/cjs/SequenceActivityBoundary.js +14 -1
- package/dist/cjs/SequenceActivityBudget.js +26 -11
- package/dist/cjs/SequenceActivitySuspensionProvider.d.ts +4 -0
- package/dist/cjs/SequenceActivitySuspensionProvider.js +45 -0
- package/dist/cjs/SequenceManager.d.ts +5 -0
- package/dist/cjs/SequenceManager.js +22 -4
- package/dist/cjs/Track.js +1 -2
- package/dist/cjs/animated-image/AnimatedImage.d.ts +3 -2
- package/dist/cjs/animated-image/AnimatedImage.js +17 -10
- package/dist/cjs/animated-image/canvas.d.ts +2 -1
- package/dist/cjs/animated-image/canvas.js +2 -2
- package/dist/cjs/animated-image/props.d.ts +2 -1
- package/dist/cjs/asset-types.d.ts +4 -0
- package/dist/cjs/audio/shared-audio-tags.d.ts +1 -1
- package/dist/cjs/audio/shared-audio-tags.js +1 -1
- package/dist/cjs/canvas-image/CanvasImage.d.ts +3 -2
- package/dist/cjs/canvas-image/CanvasImage.js +4 -4
- package/dist/cjs/canvas-image/props.d.ts +2 -1
- package/dist/cjs/effects/Solid.d.ts +3 -2
- package/dist/cjs/effects/Solid.js +4 -4
- package/dist/cjs/effects/effect-types.d.ts +4 -0
- package/dist/cjs/effects/index.d.ts +1 -1
- package/dist/cjs/effects/run-effect-chain.d.ts +3 -1
- package/dist/cjs/effects/run-effect-chain.js +94 -56
- package/dist/cjs/effects/use-effect-chain-state.d.ts +2 -1
- package/dist/cjs/effects/use-effect-chain-state.js +11 -2
- package/dist/cjs/effects/use-memoized-effects.js +86 -44
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/interactivity-schema.d.ts +5 -5
- package/dist/cjs/interactivity-schema.js +2 -1
- package/dist/cjs/internals.d.ts +11 -10
- package/dist/cjs/internals.js +1 -1
- package/dist/cjs/interpolate.js +8 -1
- package/dist/cjs/no-react.d.ts +1 -1
- package/dist/cjs/sequence-activity-context.d.ts +1 -1
- package/dist/cjs/sequence-activity-context.js +4 -3
- package/dist/cjs/sequence-activity-defaults.d.ts +1 -1
- package/dist/cjs/sequence-activity-defaults.js +1 -1
- package/dist/cjs/timeline-position-state.d.ts +1 -0
- package/dist/cjs/timeline-position-state.js +21 -1
- package/dist/cjs/timeline-track-context.d.ts +0 -1
- package/dist/cjs/timeline-track-context.js +1 -2
- package/dist/cjs/use-current-frame.d.ts +1 -0
- package/dist/cjs/use-current-frame.js +14 -7
- package/dist/cjs/use-schema.js +3 -1
- package/dist/cjs/use-timeline-seek.d.ts +1 -0
- package/dist/cjs/use-timeline-seek.js +10 -0
- package/dist/cjs/validation/validate-duration-in-frames.js +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/seek-until-right.js +11 -7
- package/dist/cjs/with-interactivity-schema.js +18 -16
- package/dist/cjs/wrap-remotion-context.d.ts +0 -1
- package/dist/cjs/wrap-remotion-context.js +1 -4
- package/dist/esm/index.mjs +951 -720
- package/dist/esm/no-react.mjs +7 -6
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/dist/cjs/nonce.d.ts +0 -11
- package/dist/cjs/nonce.js +0 -42
- package/dist/cjs/sequence-order-marker.d.ts +0 -58
- package/dist/cjs/sequence-order-marker.js +0 -44
|
@@ -50,8 +50,9 @@ const createActivityBudget = () => {
|
|
|
50
50
|
let frame = {};
|
|
51
51
|
let limit = sequence_activity_context_js_1.DEFAULT_SEQUENCE_ACTIVITY_LIMIT;
|
|
52
52
|
let scheduled = false;
|
|
53
|
+
let suspended = false;
|
|
53
54
|
const schedule = () => {
|
|
54
|
-
if (scheduled) {
|
|
55
|
+
if (scheduled || suspended) {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
scheduled = true;
|
|
@@ -59,6 +60,9 @@ const createActivityBudget = () => {
|
|
|
59
60
|
// whole commit, once all candidates and the root playhead are current.
|
|
60
61
|
queueMicrotask(() => {
|
|
61
62
|
scheduled = false;
|
|
63
|
+
if (suspended) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
62
66
|
const ranked = [...candidates.values()]
|
|
63
67
|
.filter((candidate) => candidate.end > candidate.from)
|
|
64
68
|
.map((candidate) => {
|
|
@@ -105,6 +109,12 @@ const createActivityBudget = () => {
|
|
|
105
109
|
};
|
|
106
110
|
return {
|
|
107
111
|
...registry,
|
|
112
|
+
setSuspended: (next) => {
|
|
113
|
+
if (suspended !== next) {
|
|
114
|
+
suspended = next;
|
|
115
|
+
schedule();
|
|
116
|
+
}
|
|
117
|
+
},
|
|
108
118
|
setLimit: (next) => {
|
|
109
119
|
if (limit !== next) {
|
|
110
120
|
limit = next;
|
|
@@ -133,10 +143,11 @@ const SequenceActivityBudgetProvider = ({ children }) => {
|
|
|
133
143
|
var _a;
|
|
134
144
|
const enabled = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityContext);
|
|
135
145
|
const settings = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivitySettingsContext);
|
|
146
|
+
const suspended = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivitySuspensionContext);
|
|
136
147
|
const limit = (_a = settings === null || settings === void 0 ? void 0 : settings.limit) !== null && _a !== void 0 ? _a : sequence_activity_context_js_1.DEFAULT_SEQUENCE_ACTIVITY_LIMIT;
|
|
137
|
-
const admitting = enabled && limit > 0;
|
|
148
|
+
const admitting = enabled && limit > 0 && limit !== Infinity;
|
|
138
149
|
const [budget] = (0, react_1.useState)(createActivityBudget);
|
|
139
|
-
const timeline = (0, react_1.useContext)(admitting ? TimelineContext_js_1.TimelineContext : InactiveTimelineContext);
|
|
150
|
+
const timeline = (0, react_1.useContext)(admitting && !suspended ? TimelineContext_js_1.TimelineContext : InactiveTimelineContext);
|
|
140
151
|
const selected = (0, use_sync_external_store_js_1.useSyncExternalStore)(budget.subscribe, budget.getSnapshot, budget.getSnapshot);
|
|
141
152
|
// Shrinking the setting must not keep the old, larger selection for a commit
|
|
142
153
|
// while the budget schedules its new snapshot.
|
|
@@ -146,26 +157,30 @@ const SequenceActivityBudgetProvider = ({ children }) => {
|
|
|
146
157
|
? new Set([...selected].slice(0, limit))
|
|
147
158
|
: selected, [admitting, limit, selected]);
|
|
148
159
|
useCommitEffect(() => {
|
|
160
|
+
// Retain the admitted trees while moving the playhead. Re-ranking would
|
|
161
|
+
// unmount their suspended content and remove its timeline registrations.
|
|
162
|
+
budget.setSuspended(suspended);
|
|
149
163
|
budget.setLimit(admitting ? limit : 0);
|
|
150
164
|
if (admitting && timeline !== null) {
|
|
151
165
|
budget.setFrame(timeline.frame);
|
|
152
166
|
}
|
|
153
|
-
}, [admitting, budget, limit, timeline]);
|
|
167
|
+
}, [admitting, budget, limit, suspended, timeline]);
|
|
154
168
|
return (jsx_runtime_1.jsx(ActivityBudgetContext.Provider, { value: admitting ? budget : null, children: jsx_runtime_1.jsx(ActivitySelectionContext.Provider, { value: admitted, children: children }) }));
|
|
155
169
|
};
|
|
156
170
|
exports.SequenceActivityBudgetProvider = SequenceActivityBudgetProvider;
|
|
157
171
|
const useSequenceActivityAdmission = (candidate) => {
|
|
158
|
-
var _a, _b, _c, _d, _e;
|
|
172
|
+
var _a, _b, _c, _d, _e, _f;
|
|
159
173
|
const budget = (0, react_1.useContext)(ActivityBudgetContext);
|
|
160
174
|
const enabled = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityContext);
|
|
161
175
|
const settings = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivitySettingsContext);
|
|
162
|
-
const unlimited = enabled &&
|
|
176
|
+
const unlimited = enabled &&
|
|
177
|
+
((_a = settings === null || settings === void 0 ? void 0 : settings.limit) !== null && _a !== void 0 ? _a : sequence_activity_context_js_1.DEFAULT_SEQUENCE_ACTIVITY_LIMIT) === Infinity;
|
|
163
178
|
const selected = (0, react_1.useContext)(ActivitySelectionContext);
|
|
164
|
-
const id = (
|
|
165
|
-
const parent = (
|
|
166
|
-
const compositionId = (
|
|
167
|
-
const from = (
|
|
168
|
-
const end = (
|
|
179
|
+
const id = (_b = candidate === null || candidate === void 0 ? void 0 : candidate.id) !== null && _b !== void 0 ? _b : null;
|
|
180
|
+
const parent = (_c = candidate === null || candidate === void 0 ? void 0 : candidate.parent) !== null && _c !== void 0 ? _c : null;
|
|
181
|
+
const compositionId = (_d = candidate === null || candidate === void 0 ? void 0 : candidate.compositionId) !== null && _d !== void 0 ? _d : null;
|
|
182
|
+
const from = (_e = candidate === null || candidate === void 0 ? void 0 : candidate.from) !== null && _e !== void 0 ? _e : null;
|
|
183
|
+
const end = (_f = candidate === null || candidate === void 0 ? void 0 : candidate.end) !== null && _f !== void 0 ? _f : null;
|
|
169
184
|
const committedCandidate = (0, react_1.useMemo)(() => id !== null && compositionId !== null && from !== null && end !== null
|
|
170
185
|
? { id, parent, compositionId, from, end }
|
|
171
186
|
: null, [id, parent, compositionId, from, end]);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SequenceActivitySuspensionProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const sequence_activity_context_js_1 = require("./sequence-activity-context.js");
|
|
7
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
8
|
+
const SequenceActivitySuspensionProvider = ({ children }) => {
|
|
9
|
+
const enabled = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityContext);
|
|
10
|
+
const { isPlaying, subscribePlaying, seek } = (0, react_1.useContext)(TimelineContext_js_1.SetTimelineContext);
|
|
11
|
+
const [suspended, setSuspended] = (0, react_1.useState)(false);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
if (!enabled) {
|
|
14
|
+
setSuspended(false);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let timeout = null;
|
|
18
|
+
const update = () => {
|
|
19
|
+
setSuspended(isPlaying() || timeout !== null);
|
|
20
|
+
};
|
|
21
|
+
const unsubscribePlaying = subscribePlaying(update);
|
|
22
|
+
const unsubscribeSeek = seek === null || seek === void 0 ? void 0 : seek.subscribe(() => {
|
|
23
|
+
setSuspended(true);
|
|
24
|
+
if (timeout !== null) {
|
|
25
|
+
clearTimeout(timeout);
|
|
26
|
+
}
|
|
27
|
+
// Repeated pointer, keyboard, and API seeks keep discovery suspended.
|
|
28
|
+
// Resume only once navigation settles, using the latest scene props.
|
|
29
|
+
timeout = setTimeout(() => {
|
|
30
|
+
timeout = null;
|
|
31
|
+
update();
|
|
32
|
+
}, 150);
|
|
33
|
+
});
|
|
34
|
+
update();
|
|
35
|
+
return () => {
|
|
36
|
+
unsubscribePlaying();
|
|
37
|
+
unsubscribeSeek === null || unsubscribeSeek === void 0 ? void 0 : unsubscribeSeek();
|
|
38
|
+
if (timeout !== null) {
|
|
39
|
+
clearTimeout(timeout);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, [enabled, isPlaying, seek, subscribePlaying]);
|
|
43
|
+
return (jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivitySuspensionContext.Provider, { value: suspended, children: children }));
|
|
44
|
+
};
|
|
45
|
+
exports.SequenceActivitySuspensionProvider = SequenceActivitySuspensionProvider;
|
|
@@ -67,6 +67,11 @@ export type CanUpdateSequencePropsResponseTrue<Numeric = SourceNumericValue> = {
|
|
|
67
67
|
canUpdate: true;
|
|
68
68
|
props: Record<string, CanUpdateSequencePropStatus<Numeric>>;
|
|
69
69
|
effects: CanUpdateEffectPropsResponse<Numeric>[];
|
|
70
|
+
/** Source ranges also include interpolations outside the editable schema. */
|
|
71
|
+
durationDependentKeyframes: {
|
|
72
|
+
readonly scope: SequenceNodePath;
|
|
73
|
+
readonly inputRanges: readonly (readonly SourceNumericValue[] | null)[];
|
|
74
|
+
} | null;
|
|
70
75
|
};
|
|
71
76
|
export type CanUpdateSequencePropsResponseFalse = {
|
|
72
77
|
canUpdate: false;
|
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
|
+
var _a;
|
|
38
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
40
|
exports.SequenceManagerProvider = exports.VisualModeBatchSettersContext = exports.VisualModeSettersContext = exports.useEffectDragOverridesForNodePath = exports.useActiveFromDragOverrideKeys = exports.useDragOverridesForNodePath = exports.VisualModeDragOverridesRefContext = exports.VisualModeDragOverridesContext = exports.VisualModePropStatusesRefContext = exports.VisualModePropStatusesContext = exports.makeSequencePropsSubscriptionKey = exports.VisualModeDragOverridesSubscriptionContext = void 0;
|
|
40
41
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -43,23 +44,26 @@ __exportStar(require("./sequence-registry-context.js"), exports);
|
|
|
43
44
|
const sequence_activity_context_js_1 = require("./sequence-activity-context.js");
|
|
44
45
|
const sequence_registry_context_js_1 = require("./sequence-registry-context.js");
|
|
45
46
|
const SequenceActivityBudget_js_1 = require("./SequenceActivityBudget.js");
|
|
47
|
+
const SequenceActivitySuspensionProvider_js_1 = require("./SequenceActivitySuspensionProvider.js");
|
|
46
48
|
const SequenceRegistryProvider_js_1 = require("./SequenceRegistryProvider.js");
|
|
47
49
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
48
50
|
const use_sync_external_store_js_1 = require("./use-sync-external-store.js");
|
|
49
51
|
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? react_1.default.useEffect : react_1.default.useLayoutEffect;
|
|
52
|
+
const useCommitEffect = (_a = react_1.default.useInsertionEffect) !== null && _a !== void 0 ? _a : useIsomorphicLayoutEffect;
|
|
50
53
|
exports.VisualModeDragOverridesSubscriptionContext = react_1.default.createContext(null);
|
|
51
54
|
const ActiveFromDragOverrideKeysContext = react_1.default.createContext(null);
|
|
52
55
|
const SequenceManagerScopeProviders = ({ children, dragOverridesSubscription, fromKeys }) => {
|
|
56
|
+
var _a;
|
|
53
57
|
const { isStudio } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
54
58
|
const activitySettings = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivitySettingsContext);
|
|
55
59
|
const commitRegistrationEnabled = (0, react_1.useContext)(sequence_registry_context_js_1.SequenceCommitRegistrationContext);
|
|
56
60
|
const manager = (0, react_1.useContext)(sequence_registry_context_js_1.SequenceManagerActionsContext);
|
|
57
61
|
const scopedDragOverridesSubscription = (0, react_1.useMemo)(() => ({ ...dragOverridesSubscription, manager }), [dragOverridesSubscription, manager]);
|
|
58
62
|
const activeFromDragOverrideKeys = (0, react_1.useMemo)(() => ({ manager, keys: fromKeys }), [fromKeys, manager]);
|
|
59
|
-
return (jsx_runtime_1.jsx(ActiveFromDragOverrideKeysContext.Provider, { value: activeFromDragOverrideKeys, children: jsx_runtime_1.jsx(exports.VisualModeDragOverridesSubscriptionContext.Provider, { value: scopedDragOverridesSubscription, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityContext.Provider, { value: (activitySettings === null || activitySettings === void 0 ? void 0 : activitySettings.
|
|
63
|
+
return (jsx_runtime_1.jsx(ActiveFromDragOverrideKeysContext.Provider, { value: activeFromDragOverrideKeys, children: jsx_runtime_1.jsx(exports.VisualModeDragOverridesSubscriptionContext.Provider, { value: scopedDragOverridesSubscription, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityContext.Provider, { value: ((_a = activitySettings === null || activitySettings === void 0 ? void 0 : activitySettings.limit) !== null && _a !== void 0 ? _a : sequence_activity_context_js_1.DEFAULT_SEQUENCE_ACTIVITY_LIMIT) > 0 &&
|
|
60
64
|
isStudio &&
|
|
61
65
|
commitRegistrationEnabled &&
|
|
62
|
-
typeof react_1.default.Activity !== 'undefined', children: jsx_runtime_1.jsx(SequenceActivityBudget_js_1.SequenceActivityBudgetProvider, { children: children }) }) }) }));
|
|
66
|
+
typeof react_1.default.Activity !== 'undefined', children: jsx_runtime_1.jsx(SequenceActivitySuspensionProvider_js_1.SequenceActivitySuspensionProvider, { children: jsx_runtime_1.jsx(SequenceActivityBudget_js_1.SequenceActivityBudgetProvider, { children: children }) }) }) }) }));
|
|
63
67
|
};
|
|
64
68
|
const emptyDragOverrides = {};
|
|
65
69
|
const emptyFromOverrideKeys = new Set();
|
|
@@ -84,6 +88,20 @@ const defaultVisualModeDragOverrides = {
|
|
|
84
88
|
};
|
|
85
89
|
exports.VisualModeDragOverridesContext = react_1.default.createContext(defaultVisualModeDragOverrides);
|
|
86
90
|
exports.VisualModeDragOverridesRefContext = react_1.default.createContext({ current: defaultVisualModeDragOverrides });
|
|
91
|
+
const useDragOverrideSnapshot = (subscribe, getSnapshot) => {
|
|
92
|
+
const dormant = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityDormantContext);
|
|
93
|
+
const [, forceUpdate] = (0, react_1.useState)(0);
|
|
94
|
+
const snapshot = (0, use_sync_external_store_js_1.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
95
|
+
useCommitEffect(() => {
|
|
96
|
+
if (!dormant) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// Activity disconnects passive subscriptions, including useSyncExternalStore.
|
|
100
|
+
// Insertion effects stay connected through nested hidden Activities.
|
|
101
|
+
return subscribe(() => forceUpdate((current) => current + 1));
|
|
102
|
+
}, [dormant, subscribe]);
|
|
103
|
+
return snapshot;
|
|
104
|
+
};
|
|
87
105
|
const useDragOverridesForNodePath = (nodePath) => {
|
|
88
106
|
const subscription = (0, react_1.useContext)(exports.VisualModeDragOverridesSubscriptionContext);
|
|
89
107
|
const manager = (0, react_1.useContext)(sequence_registry_context_js_1.SequenceManagerActionsContext);
|
|
@@ -97,7 +115,7 @@ const useDragOverridesForNodePath = (nodePath) => {
|
|
|
97
115
|
var _a;
|
|
98
116
|
return (_a = scopedSubscription === null || scopedSubscription === void 0 ? void 0 : scopedSubscription.getSnapshot(key)) !== null && _a !== void 0 ? _a : emptyDragOverrides;
|
|
99
117
|
}, [key, scopedSubscription]);
|
|
100
|
-
return (
|
|
118
|
+
return useDragOverrideSnapshot(subscribe, getSnapshot);
|
|
101
119
|
};
|
|
102
120
|
exports.useDragOverridesForNodePath = useDragOverridesForNodePath;
|
|
103
121
|
const useActiveFromDragOverrideKeys = () => {
|
|
@@ -119,7 +137,7 @@ const useEffectDragOverridesForNodePath = (nodePath) => {
|
|
|
119
137
|
var _a;
|
|
120
138
|
return (_a = scopedSubscription === null || scopedSubscription === void 0 ? void 0 : scopedSubscription.getEffectSnapshot(key)) !== null && _a !== void 0 ? _a : emptyEffectDragOverrides;
|
|
121
139
|
}, [key, scopedSubscription]);
|
|
122
|
-
return (
|
|
140
|
+
return useDragOverrideSnapshot(subscribe, getSnapshot);
|
|
123
141
|
};
|
|
124
142
|
exports.useEffectDragOverridesForNodePath = useEffectDragOverridesForNodePath;
|
|
125
143
|
exports.VisualModeSettersContext = react_1.default.createContext({
|
package/dist/cjs/Track.js
CHANGED
|
@@ -17,8 +17,7 @@ const trackSchema = {
|
|
|
17
17
|
};
|
|
18
18
|
const TrackWithoutSchema = ({ name = 'Track', children, layout = 'none', ...props }) => {
|
|
19
19
|
const [id] = (0, react_1.useState)(() => String(Math.random()));
|
|
20
|
-
const
|
|
21
|
-
const value = (0, react_1.useMemo)(() => (tracksEnabled ? { id, name } : null), [id, name, tracksEnabled]);
|
|
20
|
+
const value = (0, react_1.useMemo)(() => ({ id, name }), [id, name]);
|
|
22
21
|
return (jsx_runtime_1.jsx(timeline_track_context_js_1.TimelineTrackContext.Provider, { value: value, children: jsx_runtime_1.jsx(Sequence_js_1.SequenceWithoutSchema, { _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/track", ...props, name: name, layout: layout, _remotionInternalTimelineTrack: { role: 'track', seriesOffset: null }, children: children }) }));
|
|
23
22
|
};
|
|
24
23
|
exports.TrackWithoutSchema = TrackWithoutSchema;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { SequenceControls } from '../CompositionManager.js';
|
|
3
|
-
import type { EffectsProp } from '../effects/effect-types.js';
|
|
3
|
+
import type { EffectsProp, EffectsOutputSize } from '../effects/effect-types.js';
|
|
4
4
|
export declare const animatedImageSchema: {
|
|
5
5
|
readonly 'style.transformOrigin': {
|
|
6
6
|
readonly type: "transform-origin";
|
|
@@ -115,7 +115,7 @@ export declare const animatedImageSchema: {
|
|
|
115
115
|
};
|
|
116
116
|
readonly premountFor: {
|
|
117
117
|
readonly type: "number";
|
|
118
|
-
readonly default:
|
|
118
|
+
readonly default: undefined;
|
|
119
119
|
readonly description: "Premount For";
|
|
120
120
|
readonly min: 0;
|
|
121
121
|
readonly step: 1;
|
|
@@ -236,6 +236,7 @@ export declare const AnimatedImage: React.ComponentType<import("../Interactive.j
|
|
|
236
236
|
requestInit?: RequestInit | undefined;
|
|
237
237
|
} & React.AriaAttributes & Record<`data-${string}`, string | undefined> & {
|
|
238
238
|
readonly effects?: EffectsProp | undefined;
|
|
239
|
+
readonly effectsOutputSize?: EffectsOutputSize | undefined;
|
|
239
240
|
} & {
|
|
240
241
|
readonly controls?: SequenceControls | undefined;
|
|
241
242
|
readonly ref?: React.Ref<HTMLCanvasElement> | undefined;
|
|
@@ -51,11 +51,12 @@ const getCanvasPropsFromSequenceProps = (props) => {
|
|
|
51
51
|
}
|
|
52
52
|
return canvasProps;
|
|
53
53
|
};
|
|
54
|
-
const AnimatedImageContent = (0, react_2.forwardRef)(({ src, width, height, onError, loopBehavior = 'loop', playbackRate = 1, fit = 'fill', requestInit, effects, controls, ...props }, canvasRef) => {
|
|
54
|
+
const AnimatedImageContent = (0, react_2.forwardRef)(({ src, width, height, onError, loopBehavior = 'loop', playbackRate = 1, fit = 'fill', requestInit, effects, effectsOutputSize, controls, ...props }, canvasRef) => {
|
|
55
55
|
var _a, _b, _c;
|
|
56
56
|
const resolvedSrc = (0, resolve_image_source_1.resolveAnimatedImageSource)(src);
|
|
57
57
|
const [decodedImage, setDecodedImage] = (0, react_2.useState)(null);
|
|
58
58
|
const imageDecoder = (_a = decodedImage === null || decodedImage === void 0 ? void 0 : decodedImage.decoder) !== null && _a !== void 0 ? _a : null;
|
|
59
|
+
const activeDecoderRef = (0, react_2.useRef)(null);
|
|
59
60
|
const { delayRender, continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
|
|
60
61
|
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
61
62
|
const { fps } = (0, use_video_config_js_1.useVideoConfig)();
|
|
@@ -85,6 +86,7 @@ const AnimatedImageContent = (0, react_2.forwardRef)(({ src, width, height, onEr
|
|
|
85
86
|
const controller = new AbortController();
|
|
86
87
|
let cancelled = false;
|
|
87
88
|
let continued = false;
|
|
89
|
+
let decoder = null;
|
|
88
90
|
const continueRenderOnce = () => {
|
|
89
91
|
if (continued) {
|
|
90
92
|
return;
|
|
@@ -104,6 +106,8 @@ const AnimatedImageContent = (0, react_2.forwardRef)(({ src, width, height, onEr
|
|
|
104
106
|
d.close();
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
109
|
+
decoder = d;
|
|
110
|
+
activeDecoderRef.current = d;
|
|
107
111
|
setDecodedImage({ decoder: d, handle: decodeHandle });
|
|
108
112
|
})
|
|
109
113
|
.catch((err) => {
|
|
@@ -124,6 +128,8 @@ const AnimatedImageContent = (0, react_2.forwardRef)(({ src, width, height, onEr
|
|
|
124
128
|
});
|
|
125
129
|
return () => {
|
|
126
130
|
cancelled = true;
|
|
131
|
+
activeDecoderRef.current = null;
|
|
132
|
+
decoder === null || decoder === void 0 ? void 0 : decoder.close();
|
|
127
133
|
controller.abort();
|
|
128
134
|
continueRenderOnce();
|
|
129
135
|
};
|
|
@@ -136,13 +142,12 @@ const AnimatedImageContent = (0, react_2.forwardRef)(({ src, width, height, onEr
|
|
|
136
142
|
delayRender,
|
|
137
143
|
cancelRender,
|
|
138
144
|
]);
|
|
139
|
-
(0, react_2.useEffect)(() => {
|
|
140
|
-
return () => {
|
|
141
|
-
imageDecoder === null || imageDecoder === void 0 ? void 0 : imageDecoder.close();
|
|
142
|
-
};
|
|
143
|
-
}, [imageDecoder]);
|
|
144
145
|
(0, react_2.useLayoutEffect)(() => {
|
|
145
|
-
|
|
146
|
+
// Activity and Suspense can retain state after cleaning up effects.
|
|
147
|
+
// Wait for the current loading effect to publish a live decoder.
|
|
148
|
+
if (!imageDecoder ||
|
|
149
|
+
!decodedImage ||
|
|
150
|
+
activeDecoderRef.current !== imageDecoder) {
|
|
146
151
|
return;
|
|
147
152
|
}
|
|
148
153
|
const delay = delayRender(`Rendering frame at ${currentTime} of <AnimatedImage src="${src}"/>`);
|
|
@@ -196,11 +201,13 @@ const AnimatedImageContent = (0, react_2.forwardRef)(({ src, width, height, onEr
|
|
|
196
201
|
width,
|
|
197
202
|
height,
|
|
198
203
|
cancelRender,
|
|
204
|
+
effectsOutputSize === null || effectsOutputSize === void 0 ? void 0 : effectsOutputSize.width,
|
|
205
|
+
effectsOutputSize === null || effectsOutputSize === void 0 ? void 0 : effectsOutputSize.height,
|
|
199
206
|
]);
|
|
200
|
-
return (jsx_runtime_1.jsx(canvas_1.Canvas, { ref: ref, width: width, height: height, fit: fit, effects: memoizedEffects, ...props }));
|
|
207
|
+
return (jsx_runtime_1.jsx(canvas_1.Canvas, { ref: ref, width: width, height: height, fit: fit, effects: memoizedEffects, effectsOutputSize: effectsOutputSize !== null && effectsOutputSize !== void 0 ? effectsOutputSize : null, ...props }));
|
|
201
208
|
});
|
|
202
209
|
AnimatedImageContent.displayName = 'AnimatedImageContent';
|
|
203
|
-
const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, loopBehavior, id, className, style, durationInFrames, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, cropLeft, cropRight, cropTop, cropBottom, requestInit, effects = [], controls, ref, ...sequenceProps }) => {
|
|
210
|
+
const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, loopBehavior, id, className, style, durationInFrames, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, cropLeft, cropRight, cropTop, cropBottom, requestInit, effects = [], effectsOutputSize, controls, ref, ...sequenceProps }) => {
|
|
204
211
|
const actualRef = (0, react_2.useRef)(null);
|
|
205
212
|
const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
|
|
206
213
|
(0, react_2.useImperativeHandle)(ref, () => {
|
|
@@ -242,7 +249,7 @@ const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, lo
|
|
|
242
249
|
requestInit,
|
|
243
250
|
...canvasProps,
|
|
244
251
|
};
|
|
245
|
-
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, playbackRate: playbackRate, durationInFrames: durationInFrames, name: "<AnimatedImage>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, ...sequenceProps, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceContent, { children: jsx_runtime_1.jsx(AnimatedImageContent, { ...animatedImageProps, ref: actualRef, effects: effects, controls: controls }) }) }) }));
|
|
252
|
+
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, playbackRate: playbackRate, durationInFrames: durationInFrames, name: "<AnimatedImage>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, ...sequenceProps, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceContent, { children: jsx_runtime_1.jsx(AnimatedImageContent, { ...animatedImageProps, ref: actualRef, effects: effects, effectsOutputSize: effectsOutputSize !== null && effectsOutputSize !== void 0 ? effectsOutputSize : null, controls: controls }) }) }) }));
|
|
246
253
|
};
|
|
247
254
|
const AnimatedImageWithIntrinsicDuration = (props) => {
|
|
248
255
|
const { fps } = (0, use_video_config_js_1.useVideoConfig)();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { EffectDefinitionAndStack } from '../effects/effect-types.js';
|
|
2
|
+
import type { EffectDefinitionAndStack, EffectsOutputSize } from '../effects/effect-types.js';
|
|
3
3
|
export type AnimatedImageCanvasRef = {
|
|
4
4
|
readonly draw: (imageData: VideoFrame) => Promise<boolean>;
|
|
5
5
|
readonly getCanvas: () => HTMLCanvasElement | null;
|
|
@@ -12,4 +12,5 @@ export declare const Canvas: React.ForwardRefExoticComponent<{
|
|
|
12
12
|
readonly className?: string | undefined;
|
|
13
13
|
readonly style?: React.CSSProperties | undefined;
|
|
14
14
|
readonly effects: EffectDefinitionAndStack<unknown>[];
|
|
15
|
+
readonly effectsOutputSize: EffectsOutputSize | null;
|
|
15
16
|
} & React.AriaAttributes & Record<`data-${string}`, string | undefined> & React.RefAttributes<AnimatedImageCanvasRef>>;
|
|
@@ -39,9 +39,9 @@ const react_1 = __importStar(require("react"));
|
|
|
39
39
|
const calculate_image_fit_js_1 = require("../calculate-image-fit.js");
|
|
40
40
|
const run_effect_chain_js_1 = require("../effects/run-effect-chain.js");
|
|
41
41
|
const use_effect_chain_state_js_1 = require("../effects/use-effect-chain-state.js");
|
|
42
|
-
const CanvasRefForwardingFunction = ({ width, height, fit, className, style, effects, ...props }, ref) => {
|
|
42
|
+
const CanvasRefForwardingFunction = ({ width, height, fit, className, style, effects, effectsOutputSize, ...props }, ref) => {
|
|
43
43
|
const canvasRef = (0, react_1.useRef)(null);
|
|
44
|
-
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)();
|
|
44
|
+
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)(effectsOutputSize);
|
|
45
45
|
const sourceCanvas = (0, react_1.useMemo)(() => {
|
|
46
46
|
if (typeof document === 'undefined') {
|
|
47
47
|
return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImageFit } from '../calculate-image-fit.js';
|
|
2
|
-
import type { EffectsProp } from '../effects/effect-types.js';
|
|
2
|
+
import type { EffectsProp, EffectsOutputSize } from '../effects/effect-types.js';
|
|
3
3
|
import type { InteractiveBaseProps, InteractiveCropProps, InteractivePremountProps } from '../Interactive.js';
|
|
4
4
|
export type RemotionAnimatedImageLoopBehavior = 'loop' | 'pause-after-finish' | 'clear-after-finish';
|
|
5
5
|
export type AnimatedImageCanvasProps = React.AriaAttributes & Record<`data-${string}`, string | undefined>;
|
|
@@ -18,5 +18,6 @@ export type RemotionAnimatedImageProps = {
|
|
|
18
18
|
} & AnimatedImageCanvasProps;
|
|
19
19
|
export type AnimatedImageProps = InteractiveBaseProps & InteractiveCropProps & InteractivePremountProps & RemotionAnimatedImageProps & {
|
|
20
20
|
readonly effects?: EffectsProp;
|
|
21
|
+
readonly effectsOutputSize?: EffectsOutputSize;
|
|
21
22
|
};
|
|
22
23
|
export type AnimatedImageFillMode = ImageFit;
|
|
@@ -62,7 +62,7 @@ type SharedAudioContextValue = {
|
|
|
62
62
|
resumeAsAutoPlay: () => Promise<void>;
|
|
63
63
|
suspend: () => Promise<void>;
|
|
64
64
|
getIsResumingAudioContext: () => Promise<AudioContextResumeResult> | null;
|
|
65
|
-
unscheduleAudioNode: (node: AudioBufferSourceNode) =>
|
|
65
|
+
unscheduleAudioNode: (node: AudioBufferSourceNode) => boolean;
|
|
66
66
|
_experimentalKeepAudioContextAlive: boolean;
|
|
67
67
|
};
|
|
68
68
|
type SharedAudioTagsContextValue = {
|
|
@@ -127,7 +127,7 @@ const SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled,
|
|
|
127
127
|
const prevEndTimes = (0, react_1.useRef)({ scheduledEndTime: null, mediaEndTime: null });
|
|
128
128
|
const nodesToResume = (0, react_1.useRef)(new Map());
|
|
129
129
|
const unscheduleAudioNode = (0, react_1.useCallback)((node) => {
|
|
130
|
-
nodesToResume.current.delete(node);
|
|
130
|
+
return nodesToResume.current.delete(node);
|
|
131
131
|
}, []);
|
|
132
132
|
const scheduleAudioNode = (0, react_1.useMemo)(() => {
|
|
133
133
|
return ({ node, mediaTimestamp, sourceOffset, scheduledTime, duration, offset, originalUnloopedMediaTimestamp, }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EffectsProp } from '../effects/effect-types.js';
|
|
1
|
+
import type { EffectsProp, EffectsOutputSize } from '../effects/effect-types.js';
|
|
2
2
|
import type { CanvasImageCanvasProps } from './props.js';
|
|
3
3
|
export declare const canvasImageSchema: {
|
|
4
4
|
readonly 'style.transformOrigin': {
|
|
@@ -114,7 +114,7 @@ export declare const canvasImageSchema: {
|
|
|
114
114
|
};
|
|
115
115
|
readonly premountFor: {
|
|
116
116
|
readonly type: "number";
|
|
117
|
-
readonly default:
|
|
117
|
+
readonly default: undefined;
|
|
118
118
|
readonly description: "Premount For";
|
|
119
119
|
readonly min: 0;
|
|
120
120
|
readonly step: 1;
|
|
@@ -223,6 +223,7 @@ export declare const CanvasImage: import("react").ComponentType<Omit<import("../
|
|
|
223
223
|
readonly height?: number | undefined;
|
|
224
224
|
readonly fit?: import("../calculate-image-fit.js").ImageFit | undefined;
|
|
225
225
|
readonly effects?: EffectsProp | undefined;
|
|
226
|
+
readonly effectsOutputSize?: EffectsOutputSize | undefined;
|
|
226
227
|
readonly className?: string | undefined;
|
|
227
228
|
readonly style?: import("react").CSSProperties | undefined;
|
|
228
229
|
readonly id?: string | undefined;
|
|
@@ -111,14 +111,14 @@ const waitForNextFrame = ({ onFrame, }) => {
|
|
|
111
111
|
const frame = requestAnimationFrame(onFrame);
|
|
112
112
|
return () => cancelAnimationFrame(frame);
|
|
113
113
|
};
|
|
114
|
-
const CanvasImageContent = (0, react_1.forwardRef)(({ src, crossOrigin, width, height, fit = 'fill', effects, controls, onError, className, style, id, pauseWhenLoading, maxRetries = 2, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...canvasProps }, ref) => {
|
|
114
|
+
const CanvasImageContent = (0, react_1.forwardRef)(({ src, crossOrigin, width, height, fit = 'fill', effects, effectsOutputSize, controls, onError, className, style, id, pauseWhenLoading, maxRetries = 2, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...canvasProps }, ref) => {
|
|
115
115
|
var _a, _b;
|
|
116
116
|
const { delayRender, continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
|
|
117
117
|
const { delayPlayback } = (0, use_buffer_state_js_1.useBufferState)();
|
|
118
118
|
const [outputCanvas, setOutputCanvas] = (0, react_1.useState)(null);
|
|
119
119
|
const [loadedImage, setLoadedImage] = (0, react_1.useState)(null);
|
|
120
120
|
const actualSrc = (0, prefetch_js_1.usePreload)(src);
|
|
121
|
-
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)();
|
|
121
|
+
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)(effectsOutputSize);
|
|
122
122
|
const memoizedEffects = (0, use_memoized_effects_js_1.useMemoizedEffects)({
|
|
123
123
|
effects,
|
|
124
124
|
overrideId: (_a = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _a !== void 0 ? _a : null,
|
|
@@ -330,7 +330,7 @@ const CanvasImageContent = (0, react_1.forwardRef)(({ src, crossOrigin, width, h
|
|
|
330
330
|
return (jsx_runtime_1.jsx("canvas", { ...canvasProps, ref: canvasRef, width: width, height: height, className: className, style: style, id: id }));
|
|
331
331
|
});
|
|
332
332
|
CanvasImageContent.displayName = 'CanvasImageContent';
|
|
333
|
-
const CanvasImageInner = (0, react_1.forwardRef)(({ src, crossOrigin, width, height, fit, effects = [], className, style, id, onError, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, durationInFrames, from, trimBefore, loop, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, hidden, name, showInTimeline, cropLeft, cropRight, cropTop, cropBottom, controls, _remotionInternalDocumentationLink, _remotionInternalCropComponentName, ...canvasProps }, ref) => {
|
|
333
|
+
const CanvasImageInner = (0, react_1.forwardRef)(({ src, crossOrigin, width, height, fit, effects = [], effectsOutputSize, className, style, id, onError, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, durationInFrames, from, trimBefore, loop, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, hidden, name, showInTimeline, cropLeft, cropRight, cropTop, cropBottom, controls, _remotionInternalDocumentationLink, _remotionInternalCropComponentName, ...canvasProps }, ref) => {
|
|
334
334
|
if (!src) {
|
|
335
335
|
throw new Error('No "src" prop was passed to <CanvasImage>.');
|
|
336
336
|
}
|
|
@@ -365,7 +365,7 @@ const CanvasImageInner = (0, react_1.forwardRef)(({ src, crossOrigin, width, hei
|
|
|
365
365
|
style: premountingStyle,
|
|
366
366
|
componentName: _remotionInternalCropComponentName !== null && _remotionInternalCropComponentName !== void 0 ? _remotionInternalCropComponentName : '<CanvasImage />',
|
|
367
367
|
});
|
|
368
|
-
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, loop: loop, durationInFrames: durationInFrames, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, name: name !== null && name !== void 0 ? name : '<CanvasImage>', _remotionInternalDocumentationLink: _remotionInternalDocumentationLink !== null && _remotionInternalDocumentationLink !== void 0 ? _remotionInternalDocumentationLink : 'https://www.remotion.dev/docs/canvasimage', controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalIsMedia: isMedia, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceContent, { children: jsx_runtime_1.jsx(CanvasImageContent, { ref: actualRef, src: src, crossOrigin: crossOrigin, width: width, height: height, fit: fit, effects: effects, controls: controls, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, id: id, onError: onError, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, ...canvasProps }) }) }) }));
|
|
368
|
+
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, loop: loop, durationInFrames: durationInFrames, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, name: name !== null && name !== void 0 ? name : '<CanvasImage>', _remotionInternalDocumentationLink: _remotionInternalDocumentationLink !== null && _remotionInternalDocumentationLink !== void 0 ? _remotionInternalDocumentationLink : 'https://www.remotion.dev/docs/canvasimage', controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalIsMedia: isMedia, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceContent, { children: jsx_runtime_1.jsx(CanvasImageContent, { ref: actualRef, src: src, crossOrigin: crossOrigin, width: width, height: height, fit: fit, effects: effects, effectsOutputSize: effectsOutputSize !== null && effectsOutputSize !== void 0 ? effectsOutputSize : null, controls: controls, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, id: id, onError: onError, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, ...canvasProps }) }) }) }));
|
|
369
369
|
});
|
|
370
370
|
/*
|
|
371
371
|
* @description Renders a static image to a `<canvas>` and applies Remotion effects.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ImageFit } from '../calculate-image-fit.js';
|
|
3
|
-
import type { EffectsProp } from '../effects/effect-types.js';
|
|
3
|
+
import type { EffectsProp, EffectsOutputSize } from '../effects/effect-types.js';
|
|
4
4
|
import type { InteractiveBaseProps, InteractiveCropProps, InteractivePremountProps } from '../Interactive.js';
|
|
5
5
|
type CanvasImageSequenceProps = Omit<InteractiveBaseProps, 'playbackRate'> & InteractiveCropProps & InteractivePremountProps;
|
|
6
6
|
export type CanvasImageCanvasProps = Omit<React.CanvasHTMLAttributes<HTMLCanvasElement>, 'children' | 'height' | 'onError' | 'width'>;
|
|
@@ -11,6 +11,7 @@ export type CanvasImageProps = CanvasImageSequenceProps & CanvasImageCanvasProps
|
|
|
11
11
|
readonly height?: number;
|
|
12
12
|
readonly fit?: ImageFit;
|
|
13
13
|
readonly effects?: EffectsProp;
|
|
14
|
+
readonly effectsOutputSize?: EffectsOutputSize;
|
|
14
15
|
readonly className?: string;
|
|
15
16
|
readonly style?: React.CSSProperties;
|
|
16
17
|
readonly id?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { InteractiveBaseProps, InteractivePremountProps, InteractiveCropProps } from '../Interactive.js';
|
|
3
|
-
import type { EffectsProp } from './effect-types.js';
|
|
3
|
+
import type { EffectsProp, EffectsOutputSize } from './effect-types.js';
|
|
4
4
|
type MandatoryProps = {
|
|
5
5
|
readonly width: number;
|
|
6
6
|
readonly height: number;
|
|
@@ -8,6 +8,7 @@ type MandatoryProps = {
|
|
|
8
8
|
type OptionalProps = {
|
|
9
9
|
readonly color: string | undefined;
|
|
10
10
|
readonly effects: EffectsProp;
|
|
11
|
+
readonly effectsOutputSize: EffectsOutputSize | null;
|
|
11
12
|
readonly className: string | undefined;
|
|
12
13
|
readonly style: React.CSSProperties | undefined;
|
|
13
14
|
readonly pixelDensity: number | undefined;
|
|
@@ -127,7 +128,7 @@ export declare const solidSchema: {
|
|
|
127
128
|
};
|
|
128
129
|
readonly premountFor: {
|
|
129
130
|
readonly type: "number";
|
|
130
|
-
readonly default:
|
|
131
|
+
readonly default: undefined;
|
|
131
132
|
readonly description: "Premount For";
|
|
132
133
|
readonly min: 0;
|
|
133
134
|
readonly step: 1;
|
|
@@ -66,7 +66,7 @@ exports.solidSchema = {
|
|
|
66
66
|
...interactivity_schema_js_1.borderRadiusSchema,
|
|
67
67
|
...interactivity_schema_js_1.cropSchema,
|
|
68
68
|
};
|
|
69
|
-
const SolidInner = ({ color, width, height, effects = [], className, style, pixelDensity, overrideId, videoConfigValues, reference, }) => {
|
|
69
|
+
const SolidInner = ({ color, width, height, effects = [], effectsOutputSize = null, className, style, pixelDensity, overrideId, videoConfigValues, reference, }) => {
|
|
70
70
|
const { delayRender, continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
|
|
71
71
|
const resolvedPixelDensity = resolveSolidPixelDensity(pixelDensity);
|
|
72
72
|
const canvasWidth = Math.ceil(width * resolvedPixelDensity);
|
|
@@ -86,7 +86,7 @@ const SolidInner = ({ color, width, height, effects = [], className, style, pixe
|
|
|
86
86
|
canvas.height = 1;
|
|
87
87
|
return canvas;
|
|
88
88
|
}, []);
|
|
89
|
-
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)();
|
|
89
|
+
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)(effectsOutputSize);
|
|
90
90
|
const canvasRef = (0, react_1.useCallback)((canvas) => {
|
|
91
91
|
setOutputCanvas(canvas);
|
|
92
92
|
if (typeof reference === 'function') {
|
|
@@ -158,7 +158,7 @@ const SolidInner = ({ color, width, height, effects = [], className, style, pixe
|
|
|
158
158
|
}, [height, style, width]);
|
|
159
159
|
return (jsx_runtime_1.jsx("canvas", { ref: canvasRef, width: canvasWidth, height: canvasHeight, className: className, style: canvasStyle }));
|
|
160
160
|
};
|
|
161
|
-
const SolidOuter = (0, react_1.forwardRef)(({ effects = [], controls, color, height, width, className, durationInFrames, style, name, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, trimBefore, playbackRate, loop, freeze, hidden, showInTimeline, pixelDensity, cropLeft, cropRight, cropTop, cropBottom, ...props }, ref) => {
|
|
161
|
+
const SolidOuter = (0, react_1.forwardRef)(({ effects = [], effectsOutputSize = null, controls, color, height, width, className, durationInFrames, style, name, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, trimBefore, playbackRate, loop, freeze, hidden, showInTimeline, pixelDensity, cropLeft, cropRight, cropTop, cropBottom, ...props }, ref) => {
|
|
162
162
|
var _a, _b;
|
|
163
163
|
props;
|
|
164
164
|
const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
|
|
@@ -188,7 +188,7 @@ const SolidOuter = (0, react_1.forwardRef)(({ effects = [], controls, color, hei
|
|
|
188
188
|
style: premountingStyle,
|
|
189
189
|
componentName: '<Solid />',
|
|
190
190
|
});
|
|
191
|
-
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<Solid>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/solid", ...props, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceContent, { children: jsx_runtime_1.jsx(SolidInner, { reference: actualRef, videoConfigValues: (_a = controls === null || controls === void 0 ? void 0 : controls.videoConfigValues) !== null && _a !== void 0 ? _a : null, overrideId: (_b = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _b !== void 0 ? _b : null, color: color, height: height, width: width, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, effects: effects, pixelDensity: pixelDensity }) }) }) }));
|
|
191
|
+
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<Solid>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/solid", ...props, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceContent, { children: jsx_runtime_1.jsx(SolidInner, { reference: actualRef, videoConfigValues: (_a = controls === null || controls === void 0 ? void 0 : controls.videoConfigValues) !== null && _a !== void 0 ? _a : null, overrideId: (_b = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _b !== void 0 ? _b : null, color: color, height: height, width: width, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, effects: effects, effectsOutputSize: effectsOutputSize, pixelDensity: pixelDensity }) }) }) }));
|
|
192
192
|
});
|
|
193
193
|
exports.Solid = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
|
|
194
194
|
Component: SolidOuter,
|
|
@@ -52,4 +52,8 @@ export type EffectFactory<P> = {} extends P ? (params?: P & {
|
|
|
52
52
|
}) => EffectDescriptor<unknown> : (params: P & {
|
|
53
53
|
readonly disabled?: boolean;
|
|
54
54
|
}) => EffectDescriptor<unknown>;
|
|
55
|
+
export type EffectsOutputSize = {
|
|
56
|
+
readonly width: number;
|
|
57
|
+
readonly height: number;
|
|
58
|
+
};
|
|
55
59
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { createEffect } from './create-effect.js';
|
|
2
|
-
export type { Backend, EffectApplyParams, EffectDefinitionAndStack, EffectDescriptor, EffectsProp, EffectDefinition, EffectFactory, } from './effect-types.js';
|
|
2
|
+
export type { Backend, EffectApplyParams, EffectDefinitionAndStack, EffectDescriptor, EffectsProp, EffectsOutputSize, EffectDefinition, EffectFactory, } from './effect-types.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CanvasPool } from './canvas-pool.js';
|
|
2
2
|
import type { EffectDefinition, EffectDefinitionAndStack } from './effect-types.js';
|
|
3
3
|
export type EffectChainState = {
|
|
4
|
+
readonly width: number;
|
|
5
|
+
readonly height: number;
|
|
4
6
|
pool: CanvasPool;
|
|
5
7
|
setupCache: WeakMap<EffectDefinition<unknown, unknown>, WeakMap<HTMLCanvasElement, unknown>>;
|
|
6
8
|
cleanupRegistry: Array<{
|
|
@@ -22,4 +24,4 @@ export type RunEffectChainOptions = {
|
|
|
22
24
|
readonly width: number;
|
|
23
25
|
readonly height: number;
|
|
24
26
|
};
|
|
25
|
-
export declare const runEffectChain: (
|
|
27
|
+
export declare const runEffectChain: (options: RunEffectChainOptions) => Promise<boolean>;
|