remotion 4.0.534 → 4.0.535
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/README.md +1 -1
- package/dist/cjs/AbsoluteFill.d.ts +1 -6
- package/dist/cjs/AbsoluteFill.js +1 -1
- package/dist/cjs/Composition.js +15 -20
- package/dist/cjs/CompositionManager.d.ts +0 -4
- package/dist/cjs/CompositionManagerContext.d.ts +1 -6
- package/dist/cjs/CompositionManagerContext.js +0 -4
- package/dist/cjs/CompositionManagerProvider.js +77 -169
- package/dist/cjs/CompositionRegistryProvider.d.ts +5 -0
- package/dist/cjs/CompositionRegistryProvider.js +142 -0
- package/dist/cjs/DefaultPremountContext.d.ts +1 -0
- package/dist/cjs/DefaultPremountContext.js +6 -0
- package/dist/cjs/Folder.js +11 -20
- package/dist/cjs/HtmlInCanvas.d.ts +2 -2
- package/dist/cjs/HtmlInCanvas.js +177 -30
- package/dist/cjs/IFrame.js +40 -8
- package/dist/cjs/Img.js +2 -1
- package/dist/cjs/Interactive.d.ts +12 -0
- package/dist/cjs/Interactive.js +19 -8
- package/dist/cjs/RemotionRoot.js +2 -1
- package/dist/cjs/Sequence.d.ts +2 -3
- package/dist/cjs/Sequence.js +72 -38
- package/dist/cjs/SequenceActivityBoundary.d.ts +10 -0
- package/dist/cjs/SequenceActivityBoundary.js +88 -0
- package/dist/cjs/SequenceActivityBudget.d.ts +13 -0
- package/dist/cjs/SequenceActivityBudget.js +181 -0
- package/dist/cjs/SequenceManager.d.ts +4 -22
- package/dist/cjs/SequenceManager.js +36 -196
- package/dist/cjs/SequenceRegistryProvider.d.ts +4 -0
- package/dist/cjs/SequenceRegistryProvider.js +292 -0
- package/dist/cjs/Track.d.ts +10 -3
- package/dist/cjs/Track.js +7 -6
- package/dist/cjs/animated-image/AnimatedImage.js +42 -31
- package/dist/cjs/audio/AudioForPreview.js +54 -41
- package/dist/cjs/audio/get-audio-sync-anchor-tolerance.d.ts +1 -0
- package/dist/cjs/audio/get-audio-sync-anchor-tolerance.js +11 -0
- package/dist/cjs/audio/use-audio-context.js +26 -7
- package/dist/cjs/canvas-image/CanvasImage.js +2 -1
- package/dist/cjs/committed-metadata.d.ts +68 -0
- package/dist/cjs/committed-metadata.js +39 -0
- package/dist/cjs/component-identity.d.ts +6 -0
- package/dist/cjs/component-identity.js +39 -0
- package/dist/cjs/composition-registry-fallback.d.ts +14 -0
- package/dist/cjs/composition-registry-fallback.js +35 -0
- package/dist/cjs/create-element-source-proxy.d.ts +4 -0
- package/dist/cjs/create-element-source-proxy.js +46 -0
- package/dist/cjs/default-premount-in-seconds.d.ts +3 -0
- package/dist/cjs/default-premount-in-seconds.js +12 -0
- package/dist/cjs/effects/Solid.js +2 -1
- package/dist/cjs/effects/canvas-pool.d.ts +1 -0
- package/dist/cjs/effects/canvas-pool.js +15 -10
- package/dist/cjs/effects/run-effect-chain.js +3 -3
- package/dist/cjs/effects/use-memoized-effects.js +96 -17
- package/dist/cjs/enable-sequence-stack-traces.d.ts +2 -8
- package/dist/cjs/enable-sequence-stack-traces.js +7 -38
- package/dist/cjs/freeze.js +4 -1
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/interactivity-schema.d.ts +45 -9
- package/dist/cjs/interactivity-schema.js +30 -3
- package/dist/cjs/internals.d.ts +104 -25
- package/dist/cjs/internals.js +29 -7
- package/dist/cjs/interpolate-keyframed-status.d.ts +4 -0
- package/dist/cjs/interpolate-keyframed-status.js +38 -1
- package/dist/cjs/interpolate.d.ts +12 -0
- package/dist/cjs/interpolate.js +7 -0
- package/dist/cjs/no-react.d.ts +4 -0
- package/dist/cjs/no-react.js +6 -0
- package/dist/cjs/optimistic-sequence-deletion.d.ts +17 -0
- package/dist/cjs/optimistic-sequence-deletion.js +114 -0
- package/dist/cjs/registry-store.d.ts +17 -0
- package/dist/cjs/registry-store.js +68 -0
- package/dist/cjs/sequence-activity-context.d.ts +13 -0
- package/dist/cjs/sequence-activity-context.js +20 -0
- package/dist/cjs/sequence-activity-defaults.d.ts +1 -0
- package/dist/cjs/sequence-activity-defaults.js +4 -0
- package/dist/cjs/sequence-outline.js +1 -2
- package/dist/cjs/sequence-registry-context.d.ts +26 -0
- package/dist/cjs/sequence-registry-context.js +71 -0
- package/dist/cjs/series/index.d.ts +2 -1
- package/dist/cjs/series/index.js +12 -4
- package/dist/cjs/timeline-position-state.js +11 -3
- package/dist/cjs/timeline-track-context.d.ts +1 -0
- package/dist/cjs/use-lazy-component.js +29 -15
- package/dist/cjs/use-media-in-timeline.d.ts +7 -14
- package/dist/cjs/use-media-in-timeline.js +15 -117
- package/dist/cjs/use-premounting.js +3 -4
- package/dist/cjs/use-sequence-registration.d.ts +1 -1
- package/dist/cjs/use-sequence-registration.js +22 -6
- package/dist/cjs/use-video.d.ts +7 -2
- package/dist/cjs/use-video.js +11 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/VideoForPreview.js +55 -42
- package/dist/cjs/with-interactivity-schema.js +40 -14
- package/dist/cjs/wrap-remotion-context.d.ts +15 -2
- package/dist/cjs/wrap-remotion-context.js +101 -4
- package/dist/esm/index.mjs +3352 -2284
- package/dist/esm/no-react.mjs +71 -35
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/Sequence.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type SequencePropsWithoutDuration = {
|
|
|
36
36
|
/**
|
|
37
37
|
* @deprecated For internal use only.
|
|
38
38
|
*/
|
|
39
|
-
readonly _remotionInternalTimelineTrack?: Pick<TimelineTrackItem, 'role'>;
|
|
39
|
+
readonly _remotionInternalTimelineTrack?: Pick<TimelineTrackItem, 'role' | 'seriesOffset'>;
|
|
40
40
|
/**
|
|
41
41
|
* @deprecated For internal use only.
|
|
42
42
|
*/
|
|
@@ -80,8 +80,7 @@ export type SequencePropsWithoutDuration = {
|
|
|
80
80
|
src: string;
|
|
81
81
|
};
|
|
82
82
|
/**
|
|
83
|
-
* @deprecated Remotion Studio discovers
|
|
84
|
-
* Remove this prop.
|
|
83
|
+
* @deprecated This prop has no effect. Remotion Studio discovers selection outlines automatically.
|
|
85
84
|
*/
|
|
86
85
|
readonly outlineRef?: React.RefObject<Element | null> | null;
|
|
87
86
|
} & LayoutAndStyle;
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SequenceWithoutFrom = exports.Sequence = exports.SequenceWithoutSchema = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
6
5
|
const react_1 = require("react");
|
|
7
6
|
const AbsoluteFillElement_js_1 = require("./AbsoluteFillElement.js");
|
|
7
|
+
const committed_metadata_js_1 = require("./committed-metadata.js");
|
|
8
|
+
const component_identity_js_1 = require("./component-identity.js");
|
|
9
|
+
const DefaultPremountContext_js_1 = require("./DefaultPremountContext.js");
|
|
8
10
|
const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
|
|
9
11
|
const freeze_js_1 = require("./freeze.js");
|
|
10
12
|
const get_sequence_boundary_tolerance_js_1 = require("./get-sequence-boundary-tolerance.js");
|
|
11
13
|
const interactivity_schema_js_1 = require("./interactivity-schema.js");
|
|
12
14
|
const loop_context_js_1 = require("./loop/loop-context.js");
|
|
13
15
|
const resolve_sequence_duration_js_1 = require("./resolve-sequence-duration.js");
|
|
16
|
+
const sequence_activity_context_js_1 = require("./sequence-activity-context.js");
|
|
14
17
|
const sequence_crop_js_1 = require("./sequence-crop.js");
|
|
15
|
-
const sequence_order_marker_js_1 = require("./sequence-order-marker.js");
|
|
16
18
|
const sequence_outline_js_1 = require("./sequence-outline.js");
|
|
19
|
+
const SequenceActivityBoundary_js_1 = require("./SequenceActivityBoundary.js");
|
|
20
|
+
const SequenceActivityBudget_js_1 = require("./SequenceActivityBudget.js");
|
|
17
21
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
18
22
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
19
23
|
const is_inside_series_js_1 = require("./series/is-inside-series.js");
|
|
@@ -23,18 +27,23 @@ const use_premounting_js_1 = require("./use-premounting.js");
|
|
|
23
27
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
24
28
|
const use_sequence_registration_js_1 = require("./use-sequence-registration.js");
|
|
25
29
|
const use_video_config_js_1 = require("./use-video-config.js");
|
|
26
|
-
const v5_flag_js_1 = require("./v5-flag.js");
|
|
27
30
|
const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
|
|
28
31
|
const SeriesContentVisibilityContext = (0, react_1.createContext)(true);
|
|
32
|
+
const SequenceContextProvider = (0, committed_metadata_js_1.withCommittedMetadata)(SequenceContext_js_1.SequenceContext.Provider);
|
|
29
33
|
const EMPTY_EFFECTS = [];
|
|
30
|
-
const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playbackRate = 1, loop = false, freeze, durationInFrames, children, name, height, width, showInTimeline = true, hidden = false, controls, _remotionInternalEffects, _remotionInternalTimelineTrack: timelineTrackItem, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack,
|
|
31
|
-
var _a, _b, _c, _d, _e, _f;
|
|
34
|
+
const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playbackRate = 1, loop = false, freeze, durationInFrames, children, name, height, width, showInTimeline = true, hidden = false, controls, _remotionInternalEffects, _remotionInternalTimelineTrack: timelineTrackItem, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalSingleChildComponent: childComponentOverride, _remotionInternalDocumentationLink: documentationLink, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, cropLeft, cropRight, cropTop, cropBottom, ...other }, ref) => {
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32
36
|
const { layout = 'absolute-fill' } = other;
|
|
33
37
|
const [id] = (0, react_1.useState)(() => String(Math.random()));
|
|
34
38
|
const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
39
|
+
const activityRequested = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityContext);
|
|
40
|
+
const parentDormant = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityDormantContext);
|
|
41
|
+
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
42
|
+
const activityEnabled = activityRequested && env.isStudio && !env.isRendering;
|
|
35
43
|
const timelineTrack = (0, react_1.useContext)(timeline_track_context_js_1.TimelineTrackContext);
|
|
36
44
|
const timelineTrackRole = (_a = timelineTrackItem === null || timelineTrackItem === void 0 ? void 0 : timelineTrackItem.role) !== null && _a !== void 0 ? _a : 'clip';
|
|
37
|
-
const
|
|
45
|
+
const seriesOffset = (_b = timelineTrackItem === null || timelineTrackItem === void 0 ? void 0 : timelineTrackItem.seriesOffset) !== null && _b !== void 0 ? _b : null;
|
|
46
|
+
const parentPlaybackRate = (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.playbackRate) !== null && _c !== void 0 ? _c : 1;
|
|
38
47
|
const cumulativePlaybackRate = parentPlaybackRate * playbackRate;
|
|
39
48
|
const cumulatedFrom = parentSequence
|
|
40
49
|
? parentSequence.cumulatedFrom + parentSequence.relativeFrom
|
|
@@ -110,7 +119,9 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
110
119
|
lastPlaybackRate.current.playbackRate !== playbackRate) {
|
|
111
120
|
throw new Error('The "playbackRate" prop of <Sequence /> must be constant. Animating playbackRate is not supported.');
|
|
112
121
|
}
|
|
113
|
-
|
|
122
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
123
|
+
lastPlaybackRate.current = { playbackRate, frame: absoluteFrame };
|
|
124
|
+
}, [absoluteFrame, playbackRate]);
|
|
114
125
|
const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
|
|
115
126
|
const effectiveDurationInFrames = (0, resolve_sequence_duration_js_1.resolveSequenceDuration)({
|
|
116
127
|
durationInFrames,
|
|
@@ -130,7 +141,11 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
130
141
|
? contentDurationInFrames / playbackRate
|
|
131
142
|
: null;
|
|
132
143
|
let loopIteration = 0;
|
|
133
|
-
if (loopPeriod !== null
|
|
144
|
+
if (loopPeriod !== null &&
|
|
145
|
+
(!activityEnabled ||
|
|
146
|
+
(!parentDormant &&
|
|
147
|
+
frameInParent >= from &&
|
|
148
|
+
frameInParent < from + actualDurationInFrames))) {
|
|
134
149
|
const loopsElapsed = (frameInParent - from) / loopPeriod;
|
|
135
150
|
const nearestIteration = Math.round(loopsElapsed);
|
|
136
151
|
// Fractional periods and nested playback rates can put an exact loop
|
|
@@ -144,7 +159,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
144
159
|
const clockFrom = from + loopOffset;
|
|
145
160
|
const effectiveRelativeFrom = clockFrom - trimBefore / playbackRate;
|
|
146
161
|
const relativeFrom = effectiveRelativeFrom / parentPlaybackRate;
|
|
147
|
-
const absoluteFrom = ((
|
|
162
|
+
const absoluteFrom = ((_d = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.absoluteFrom) !== null && _d !== void 0 ? _d : 0) + relativeFrom;
|
|
148
163
|
// Inside a loop, the local clock ends after `durationInFrames`, except in a final
|
|
149
164
|
// iteration that the parent cuts short.
|
|
150
165
|
const localClockEnd = loopPeriod === null
|
|
@@ -154,15 +169,12 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
154
169
|
trimBefore;
|
|
155
170
|
const sequenceRegistrationEnabled = (0, react_1.useContext)(SequenceManager_js_1.SequenceRegistrationContext);
|
|
156
171
|
const canvasOutlinesEnabled = (0, react_1.useContext)(sequence_outline_js_1.SequenceOutlineContext);
|
|
157
|
-
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
158
172
|
const shouldDiscoverOutline = env.isStudio || canvasOutlinesEnabled;
|
|
159
|
-
const automaticOutlineRef = (0, react_1.useMemo)(() => shouldDiscoverOutline && layout === 'none'
|
|
173
|
+
const automaticOutlineRef = (0, react_1.useMemo)(() => shouldDiscoverOutline && layout === 'none'
|
|
160
174
|
? sequence_outline_js_1.SequenceOutlineInternals.createRef()
|
|
161
|
-
: null, [shouldDiscoverOutline, layout
|
|
175
|
+
: null, [shouldDiscoverOutline, layout]);
|
|
162
176
|
const wrapperRefForOutline = (0, react_1.useRef)(null);
|
|
163
|
-
const refForOutline =
|
|
164
|
-
? (passedRefForOutline !== null && passedRefForOutline !== void 0 ? passedRefForOutline : automaticOutlineRef)
|
|
165
|
-
: (passedRefForOutline !== null && passedRefForOutline !== void 0 ? passedRefForOutline : wrapperRefForOutline);
|
|
177
|
+
const refForOutline = layout === 'none' ? automaticOutlineRef : wrapperRefForOutline;
|
|
166
178
|
const premounting = (0, react_1.useMemo)(() => {
|
|
167
179
|
// || is intentional, ?? would not trigger on `false`
|
|
168
180
|
return ((parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.premounting) ||
|
|
@@ -254,13 +266,13 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
254
266
|
}, [name]);
|
|
255
267
|
const resolvedDocumentationLink = documentationLink !== null && documentationLink !== void 0 ? documentationLink : 'https://www.remotion.dev/docs/sequence';
|
|
256
268
|
const isInsideSeries = (0, react_1.useContext)(is_inside_series_js_1.IsInsideSeriesContext);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
? ((
|
|
269
|
+
const singleChildComponent = (0, react_1.useMemo)(() => childComponentOverride === undefined
|
|
270
|
+
? (0, component_identity_js_1.getSingleChildComponent)(children)
|
|
271
|
+
: childComponentOverride, [children, childComponentOverride]);
|
|
272
|
+
const registrationStack = controls
|
|
273
|
+
? ((_f = (_e = (0, enable_sequence_stack_traces_js_1.getStackForControls)(controls)) !== null && _e !== void 0 ? _e : stack) !== null && _f !== void 0 ? _f : null)
|
|
262
274
|
: (stack !== null && stack !== void 0 ? stack : null);
|
|
263
|
-
const getStack = (0, react_1.useCallback)(() =>
|
|
275
|
+
const getStack = (0, react_1.useCallback)(() => registrationStack, [registrationStack]);
|
|
264
276
|
const registeredFrozenFrame = typeof freeze === 'number' ? freeze : null;
|
|
265
277
|
const currentFrame = registeredFrozenFrame !== null && registeredFrozenFrame !== void 0 ? registeredFrozenFrame : (absoluteFrame - currentSequenceStart) * cumulativePlaybackRate;
|
|
266
278
|
const currentFrameRef = (0, react_1.useRef)(currentFrame);
|
|
@@ -269,7 +281,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
269
281
|
}, [currentFrame]);
|
|
270
282
|
const getCurrentFrame = (0, react_1.useCallback)(() => currentFrameRef.current, []);
|
|
271
283
|
const registeredTrimBefore = trimBefore === 0 ? null : trimBefore;
|
|
272
|
-
const parentCumulatedNegativeFrom = (
|
|
284
|
+
const parentCumulatedNegativeFrom = (_g = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.cumulatedNegativeFrom) !== null && _g !== void 0 ? _g : 0;
|
|
273
285
|
const startMediaFrom = isMedia && isMedia.type !== 'image'
|
|
274
286
|
? isMedia.data.startMediaFrom +
|
|
275
287
|
parentCumulatedNegativeFrom -
|
|
@@ -350,6 +362,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
350
362
|
timelineTrack: {
|
|
351
363
|
...timelineTrack,
|
|
352
364
|
role: timelineTrackRole,
|
|
365
|
+
seriesOffset,
|
|
353
366
|
},
|
|
354
367
|
}
|
|
355
368
|
: {};
|
|
@@ -392,7 +405,6 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
392
405
|
effectRuntimeValues,
|
|
393
406
|
displayName: timelineClipName,
|
|
394
407
|
documentationLink: resolvedDocumentationLink,
|
|
395
|
-
doesVolumeChange: isMedia.data.doesVolumeChange,
|
|
396
408
|
duration: actualDurationInFrames,
|
|
397
409
|
from,
|
|
398
410
|
trimBefore: registeredTrimBefore,
|
|
@@ -409,7 +421,6 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
409
421
|
getCurrentFrame,
|
|
410
422
|
startMediaFrom: startMediaFrom !== null && startMediaFrom !== void 0 ? startMediaFrom : isMedia.data.startMediaFrom,
|
|
411
423
|
mediaFrameAtSequenceZero,
|
|
412
|
-
volume: isMedia.data.volumes,
|
|
413
424
|
muted: isMedia.data.muted,
|
|
414
425
|
refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
|
|
415
426
|
isInsideSeries,
|
|
@@ -451,6 +462,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
451
462
|
id,
|
|
452
463
|
timelineTrack,
|
|
453
464
|
timelineTrackRole,
|
|
465
|
+
seriesOffset,
|
|
454
466
|
getCurrentFrame,
|
|
455
467
|
getStack,
|
|
456
468
|
timelineClipName,
|
|
@@ -480,7 +492,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
480
492
|
frozenMediaFrame,
|
|
481
493
|
singleChildComponent,
|
|
482
494
|
]);
|
|
483
|
-
(0, use_sequence_registration_js_1.useSequenceRegistration)({
|
|
495
|
+
const registration = (0, use_sequence_registration_js_1.useSequenceRegistration)({
|
|
484
496
|
getSequence: env.isStudio || sequenceRegistrationEnabled
|
|
485
497
|
? getSequenceForRegistration
|
|
486
498
|
: null,
|
|
@@ -495,11 +507,24 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
495
507
|
parentPlaybackRate,
|
|
496
508
|
durationInFrames: effectiveDurationInFrames,
|
|
497
509
|
});
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
510
|
+
const contentVisible = seriesContentVisible &&
|
|
511
|
+
frameInParent - from >= -boundaryTolerance &&
|
|
512
|
+
frameInParent - endThreshold < -boundaryTolerance;
|
|
513
|
+
const activityDormant = parentDormant || !contentVisible;
|
|
514
|
+
const admitted = (0, SequenceActivityBudget_js_1.useSequenceActivityAdmission)(activityEnabled && !hidden
|
|
515
|
+
? {
|
|
516
|
+
id,
|
|
517
|
+
parent: (_h = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _h !== void 0 ? _h : null,
|
|
518
|
+
compositionId: videoConfig.id,
|
|
519
|
+
from: firstFrame,
|
|
520
|
+
end: cumulatedFrom +
|
|
521
|
+
(from + actualDurationInFrames) / parentPlaybackRate,
|
|
522
|
+
}
|
|
523
|
+
: null);
|
|
524
|
+
const renderActivity = activityEnabled && (!activityDormant || admitted);
|
|
525
|
+
const content = (activityEnabled ? renderActivity : contentVisible)
|
|
526
|
+
? children
|
|
527
|
+
: null;
|
|
503
528
|
const frozenContent = content === null || typeof freeze === 'undefined' || freeze === null ? (content) : (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freeze, children: content }));
|
|
504
529
|
const loopedContent = frozenContent === null || loopContextValue === null ? (frozenContent) : (jsx_runtime_1.jsx(loop_context_js_1.LoopContext.Provider, { value: loopContextValue, children: frozenContent }));
|
|
505
530
|
const styleIfThere = other.layout === 'none' ? undefined : other.style;
|
|
@@ -535,20 +560,30 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
535
560
|
if (ref !== null && layout === 'none') {
|
|
536
561
|
throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
|
|
537
562
|
}
|
|
563
|
+
const metadata = (0, react_1.useMemo)(() => shouldDiscoverOutline || registration !== null
|
|
564
|
+
? {
|
|
565
|
+
type: 'sequence',
|
|
566
|
+
id,
|
|
567
|
+
value: registration,
|
|
568
|
+
outlineChildrenRef: automaticOutlineRef,
|
|
569
|
+
}
|
|
570
|
+
: null, [automaticOutlineRef, id, registration, shouldDiscoverOutline]);
|
|
538
571
|
if (hidden) {
|
|
539
|
-
return shouldDiscoverOutline ? (jsx_runtime_1.jsx(
|
|
572
|
+
return shouldDiscoverOutline || registration !== null ? (jsx_runtime_1.jsx(SequenceContextProvider, { value: contextValue, _remotionCommitMetadata: metadata, children: null })) : null;
|
|
540
573
|
}
|
|
541
574
|
// Retain resolved scene registrations so Studio can recover the natural end
|
|
542
575
|
// even when seeking past an explicit wrapper trim. Scene contents stay hidden.
|
|
543
576
|
const retainSeriesRegistration = env.isStudio && canInferDuration;
|
|
544
|
-
const
|
|
545
|
-
const
|
|
577
|
+
const contentForLayout = renderActivity ? (jsx_runtime_1.jsx(SequenceActivityBoundary_js_1.SequenceActivityContent, { dormant: activityDormant, children: loopedContent })) : (loopedContent);
|
|
578
|
+
const renderedContent = loopedContent === null ? (retainSeriesRegistration ? (children) : null) : other.layout === 'none' ? (contentForLayout) : (jsx_runtime_1.jsx(AbsoluteFillElement_js_1.AbsoluteFillElement, { ref: sequenceRef, style: defaultStyle, className: other.className, children: contentForLayout }));
|
|
579
|
+
const activityContent = renderActivity ? (jsx_runtime_1.jsx(SequenceActivityBoundary_js_1.SequenceActivityBoundary, { dormant: activityDormant, frame: firstFrame, children: renderedContent })) : (renderedContent);
|
|
580
|
+
const sequenceContent = (jsx_runtime_1.jsx(SequenceContextProvider, { value: contextValue, _remotionCommitMetadata: metadata, children: retainSeriesRegistration ? (jsx_runtime_1.jsx(SeriesContentVisibilityContext.Provider, { value: renderActivity || contentVisible, children: activityContent })) : (activityContent) }));
|
|
546
581
|
// Keep the provider mounted when track grouping changes so clip state survives.
|
|
547
582
|
const sequence = (jsx_runtime_1.jsx(timeline_track_context_js_1.TimelineTrackContext.Provider, { value: timelineTrackRole === 'track' ||
|
|
548
583
|
(timelineTrackRole === 'clip' && !showInTimeline)
|
|
549
584
|
? timelineTrack
|
|
550
585
|
: null, children: sequenceContent }));
|
|
551
|
-
return
|
|
586
|
+
return sequence;
|
|
552
587
|
};
|
|
553
588
|
const RegularSequence = (0, react_1.forwardRef)(RegularSequenceRefForwardingFunction);
|
|
554
589
|
const PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
@@ -570,17 +605,16 @@ const PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
|
570
605
|
styleWhilePostmounted: styleWhilePostmounted !== null && styleWhilePostmounted !== void 0 ? styleWhilePostmounted : null,
|
|
571
606
|
hideWhilePremounted: 'opacity',
|
|
572
607
|
});
|
|
573
|
-
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(
|
|
608
|
+
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(RegularSequence, { ref: ref, from: from, durationInFrames: durationInFrames, style: premountingStyle !== null && premountingStyle !== void 0 ? premountingStyle : undefined, _remotionInternalPremountDisplay: premountFor, _remotionInternalPostmountDisplay: postmountFor, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, ...otherProps }) }));
|
|
574
609
|
};
|
|
575
610
|
const PremountedPostmountedSequence = (0, react_1.forwardRef)(PremountedPostmountedSequenceRefForwardingFunction);
|
|
576
611
|
const SequenceRefForwardingFunction = (props, ref) => {
|
|
577
612
|
var _a;
|
|
578
613
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
579
614
|
const { fps } = (0, use_video_config_js_1.useVideoConfig)();
|
|
615
|
+
const defaultPremountInSeconds = (0, react_1.useContext)(DefaultPremountContext_js_1.DefaultPremountContext);
|
|
580
616
|
if (props.layout !== 'none' && !env.isRendering) {
|
|
581
|
-
const effectivePremountFor =
|
|
582
|
-
? ((_a = props.premountFor) !== null && _a !== void 0 ? _a : fps)
|
|
583
|
-
: props.premountFor;
|
|
617
|
+
const effectivePremountFor = (_a = props.premountFor) !== null && _a !== void 0 ? _a : Math.round(defaultPremountInSeconds * fps);
|
|
584
618
|
if (effectivePremountFor || props.postmountFor) {
|
|
585
619
|
return (jsx_runtime_1.jsx(PremountedPostmountedSequence, { ref: ref, ...props, premountFor: effectivePremountFor }));
|
|
586
620
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const SequenceActivityContent: React.NamedExoticComponent<{
|
|
3
|
+
readonly children: React.ReactNode;
|
|
4
|
+
readonly dormant: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const SequenceActivityBoundary: React.FC<{
|
|
7
|
+
readonly children: React.ReactNode;
|
|
8
|
+
readonly dormant: boolean;
|
|
9
|
+
readonly frame: number;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SequenceActivityBoundary = exports.SequenceActivityContent = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const sequence_activity_context_js_1 = require("./sequence-activity-context.js");
|
|
40
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
41
|
+
const use_video_config_js_1 = require("./use-video-config.js");
|
|
42
|
+
const areActivityChildrenEqual = (previous, next) => {
|
|
43
|
+
if (Object.is(previous, next)) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(previous) && Array.isArray(next)) {
|
|
47
|
+
return (previous.length === next.length &&
|
|
48
|
+
previous.every((child, index) => areActivityChildrenEqual(child, next[index])));
|
|
49
|
+
}
|
|
50
|
+
if (!react_1.default.isValidElement(previous) ||
|
|
51
|
+
!react_1.default.isValidElement(next) ||
|
|
52
|
+
previous.type !== next.type ||
|
|
53
|
+
previous.key !== next.key) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const keys = Object.keys(previous.props);
|
|
57
|
+
return (keys.length === Object.keys(next.props).length &&
|
|
58
|
+
keys.every((key) => Object.prototype.hasOwnProperty.call(next.props, key) &&
|
|
59
|
+
(key === 'children'
|
|
60
|
+
? areActivityChildrenEqual(previous.props.children, next.props.children)
|
|
61
|
+
: Object.is(previous.props[key], next.props[key]))));
|
|
62
|
+
};
|
|
63
|
+
// Parent frame subscriptions often recreate unchanged JSX. Compare element
|
|
64
|
+
// structure and all props instead of ignoring changes to dormant scene props.
|
|
65
|
+
exports.SequenceActivityContent = react_1.default.memo(({ children }) => children, (previous, next) => previous.dormant &&
|
|
66
|
+
next.dormant &&
|
|
67
|
+
areActivityChildrenEqual(previous.children, next.children));
|
|
68
|
+
const SequenceActivityBoundary = ({ children, dormant, frame }) => {
|
|
69
|
+
const parentDormant = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityDormantContext);
|
|
70
|
+
const timeline = (0, react_1.useContext)(parentDormant ? sequence_activity_context_js_1.SequenceActivityTimelineContext : TimelineContext_js_1.TimelineContext);
|
|
71
|
+
const absoluteTime = (0, react_1.useContext)(parentDormant ? sequence_activity_context_js_1.SequenceActivityAbsoluteTimeContext : TimelineContext_js_1.AbsoluteTimeContext);
|
|
72
|
+
const { id } = (0, use_video_config_js_1.useVideoConfig)();
|
|
73
|
+
if (timeline === null) {
|
|
74
|
+
throw new Error('TimelineContext is missing');
|
|
75
|
+
}
|
|
76
|
+
const { audioAndVideoTags } = timeline;
|
|
77
|
+
const dormantTimeline = (0, react_1.useMemo)(() => ({
|
|
78
|
+
frame: { [id]: frame },
|
|
79
|
+
isPlaying: () => false,
|
|
80
|
+
isInsideFreeze: true,
|
|
81
|
+
audioAndVideoTags,
|
|
82
|
+
}), [audioAndVideoTags, frame, id]);
|
|
83
|
+
// Keep the providers and Activity at the same position when activating a
|
|
84
|
+
// scene. Unlike Freeze, discovery does not reset SequenceContext origins or
|
|
85
|
+
// disable Series duration inference.
|
|
86
|
+
return (jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityDormantContext.Provider, { value: dormant, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityTimelineContext.Provider, { value: dormant ? dormantTimeline : null, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityAbsoluteTimeContext.Provider, { value: dormant ? dormantTimeline : null, children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineContext.Provider, { value: dormant ? dormantTimeline : timeline, children: jsx_runtime_1.jsx(TimelineContext_js_1.AbsoluteTimeContext.Provider, { value: dormant ? dormantTimeline : absoluteTime, children: jsx_runtime_1.jsx(react_1.default.Activity, { mode: dormant && !parentDormant ? 'hidden' : 'visible', children: children }) }) }) }) }) }));
|
|
87
|
+
};
|
|
88
|
+
exports.SequenceActivityBoundary = SequenceActivityBoundary;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ActivityCandidate = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly parent: string | null;
|
|
5
|
+
readonly compositionId: string;
|
|
6
|
+
readonly from: number;
|
|
7
|
+
readonly end: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const SequenceActivityBudgetProvider: React.FC<{
|
|
10
|
+
readonly children: React.ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const useSequenceActivityAdmission: (candidate: ActivityCandidate | null) => boolean;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var _a;
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.useSequenceActivityAdmission = exports.SequenceActivityBudgetProvider = void 0;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const registry_store_js_1 = require("./registry-store.js");
|
|
41
|
+
const sequence_activity_context_js_1 = require("./sequence-activity-context.js");
|
|
42
|
+
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
43
|
+
const use_sync_external_store_js_1 = require("./use-sync-external-store.js");
|
|
44
|
+
// Count nested dormant content too: one admitted scene must not be able to
|
|
45
|
+
// recursively mount another thousand expensive scenes behind its Activity.
|
|
46
|
+
const useCommitEffect = (_a = react_1.default.useInsertionEffect) !== null && _a !== void 0 ? _a : react_1.default.useLayoutEffect;
|
|
47
|
+
const createActivityBudget = () => {
|
|
48
|
+
const registry = (0, registry_store_js_1.createRegistryStore)(new Set());
|
|
49
|
+
const candidates = new Map();
|
|
50
|
+
let frame = {};
|
|
51
|
+
let limit = sequence_activity_context_js_1.DEFAULT_SEQUENCE_ACTIVITY_LIMIT;
|
|
52
|
+
let scheduled = false;
|
|
53
|
+
const schedule = () => {
|
|
54
|
+
if (scheduled) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
scheduled = true;
|
|
58
|
+
// Insertion effects run in hidden Activities too. Publish only after the
|
|
59
|
+
// whole commit, once all candidates and the root playhead are current.
|
|
60
|
+
queueMicrotask(() => {
|
|
61
|
+
scheduled = false;
|
|
62
|
+
const ranked = [...candidates.values()]
|
|
63
|
+
.filter((candidate) => candidate.end > candidate.from)
|
|
64
|
+
.map((candidate) => {
|
|
65
|
+
var _a;
|
|
66
|
+
const currentFrame = (_a = frame[candidate.compositionId]) !== null && _a !== void 0 ? _a : 0;
|
|
67
|
+
return {
|
|
68
|
+
candidate,
|
|
69
|
+
distance: Math.max(0, candidate.from - currentFrame, currentFrame - candidate.end),
|
|
70
|
+
};
|
|
71
|
+
})
|
|
72
|
+
.sort((a, b) => a.distance - b.distance);
|
|
73
|
+
const selected = new Set();
|
|
74
|
+
for (const { candidate } of ranked) {
|
|
75
|
+
const ancestors = [];
|
|
76
|
+
let ancestor = candidate;
|
|
77
|
+
while (ancestor && !selected.has(ancestor.id)) {
|
|
78
|
+
ancestors.push(ancestor.id);
|
|
79
|
+
if (selected.size + ancestors.length > limit) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
ancestor =
|
|
83
|
+
ancestor.parent === null
|
|
84
|
+
? undefined
|
|
85
|
+
: candidates.get(ancestor.parent);
|
|
86
|
+
}
|
|
87
|
+
if (selected.size + ancestors.length > limit) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
for (const id of ancestors) {
|
|
91
|
+
selected.add(id);
|
|
92
|
+
}
|
|
93
|
+
if (selected.size === limit) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Reserve nearby visible trees too, so becoming dormant retains their
|
|
98
|
+
// state immediately. All other visible trees bypass admission. Reserved
|
|
99
|
+
// IDs bound dormant content, including during a large seek.
|
|
100
|
+
registry.setSnapshot((previous) => previous.size === selected.size &&
|
|
101
|
+
[...previous].every((id) => selected.has(id))
|
|
102
|
+
? previous
|
|
103
|
+
: selected);
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
...registry,
|
|
108
|
+
setLimit: (next) => {
|
|
109
|
+
if (limit !== next) {
|
|
110
|
+
limit = next;
|
|
111
|
+
schedule();
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
setFrame: (next) => {
|
|
115
|
+
frame = next;
|
|
116
|
+
schedule();
|
|
117
|
+
},
|
|
118
|
+
register: (candidate) => {
|
|
119
|
+
candidates.set(candidate.id, candidate);
|
|
120
|
+
schedule();
|
|
121
|
+
return () => {
|
|
122
|
+
candidates.delete(candidate.id);
|
|
123
|
+
schedule();
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const ActivityBudgetContext = (0, react_1.createContext)(null);
|
|
129
|
+
const InactiveTimelineContext = (0, react_1.createContext)(null);
|
|
130
|
+
const emptySelection = new Set();
|
|
131
|
+
const ActivitySelectionContext = (0, react_1.createContext)(emptySelection);
|
|
132
|
+
const SequenceActivityBudgetProvider = ({ children }) => {
|
|
133
|
+
var _a;
|
|
134
|
+
const enabled = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityContext);
|
|
135
|
+
const settings = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivitySettingsContext);
|
|
136
|
+
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;
|
|
138
|
+
const [budget] = (0, react_1.useState)(createActivityBudget);
|
|
139
|
+
const timeline = (0, react_1.useContext)(admitting ? TimelineContext_js_1.TimelineContext : InactiveTimelineContext);
|
|
140
|
+
const selected = (0, use_sync_external_store_js_1.useSyncExternalStore)(budget.subscribe, budget.getSnapshot, budget.getSnapshot);
|
|
141
|
+
// Shrinking the setting must not keep the old, larger selection for a commit
|
|
142
|
+
// while the budget schedules its new snapshot.
|
|
143
|
+
const admitted = (0, react_1.useMemo)(() => !admitting
|
|
144
|
+
? emptySelection
|
|
145
|
+
: selected.size > limit
|
|
146
|
+
? new Set([...selected].slice(0, limit))
|
|
147
|
+
: selected, [admitting, limit, selected]);
|
|
148
|
+
useCommitEffect(() => {
|
|
149
|
+
budget.setLimit(admitting ? limit : 0);
|
|
150
|
+
if (admitting && timeline !== null) {
|
|
151
|
+
budget.setFrame(timeline.frame);
|
|
152
|
+
}
|
|
153
|
+
}, [admitting, budget, limit, timeline]);
|
|
154
|
+
return (jsx_runtime_1.jsx(ActivityBudgetContext.Provider, { value: admitting ? budget : null, children: jsx_runtime_1.jsx(ActivitySelectionContext.Provider, { value: admitted, children: children }) }));
|
|
155
|
+
};
|
|
156
|
+
exports.SequenceActivityBudgetProvider = SequenceActivityBudgetProvider;
|
|
157
|
+
const useSequenceActivityAdmission = (candidate) => {
|
|
158
|
+
var _a, _b, _c, _d, _e;
|
|
159
|
+
const budget = (0, react_1.useContext)(ActivityBudgetContext);
|
|
160
|
+
const enabled = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityContext);
|
|
161
|
+
const settings = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivitySettingsContext);
|
|
162
|
+
const unlimited = enabled && (settings === null || settings === void 0 ? void 0 : settings.limit) === -1;
|
|
163
|
+
const selected = (0, react_1.useContext)(ActivitySelectionContext);
|
|
164
|
+
const id = (_a = candidate === null || candidate === void 0 ? void 0 : candidate.id) !== null && _a !== void 0 ? _a : null;
|
|
165
|
+
const parent = (_b = candidate === null || candidate === void 0 ? void 0 : candidate.parent) !== null && _b !== void 0 ? _b : null;
|
|
166
|
+
const compositionId = (_c = candidate === null || candidate === void 0 ? void 0 : candidate.compositionId) !== null && _c !== void 0 ? _c : null;
|
|
167
|
+
const from = (_d = candidate === null || candidate === void 0 ? void 0 : candidate.from) !== null && _d !== void 0 ? _d : null;
|
|
168
|
+
const end = (_e = candidate === null || candidate === void 0 ? void 0 : candidate.end) !== null && _e !== void 0 ? _e : null;
|
|
169
|
+
const committedCandidate = (0, react_1.useMemo)(() => id !== null && compositionId !== null && from !== null && end !== null
|
|
170
|
+
? { id, parent, compositionId, from, end }
|
|
171
|
+
: null, [id, parent, compositionId, from, end]);
|
|
172
|
+
useCommitEffect(() => {
|
|
173
|
+
if (budget !== null && committedCandidate !== null) {
|
|
174
|
+
return budget.register(committedCandidate);
|
|
175
|
+
}
|
|
176
|
+
}, [budget, committedCandidate]);
|
|
177
|
+
// Unlimited discovery admits children on their first render, without waiting
|
|
178
|
+
// for their registration and a subsequent budget publication.
|
|
179
|
+
return id !== null && (unlimited || selected.has(id));
|
|
180
|
+
};
|
|
181
|
+
exports.useSequenceActivityAdmission = useSequenceActivityAdmission;
|
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
export * from './sequence-registry-context.js';
|
|
3
|
+
import { type SequenceManagerActions, type SequenceNodePath } from './sequence-registry-context.js';
|
|
3
4
|
import type { CanUpdateSequencePropStatus, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, PropStatuses } from './use-schema.js';
|
|
4
5
|
import type { SourceNumericValue } from './use-schema.js';
|
|
5
6
|
import type { VideoConfigValues } from './video-config.js';
|
|
6
|
-
export type SequenceManagerContext = {
|
|
7
|
-
registerSequence: (seq: TSequence) => void;
|
|
8
|
-
updateSequence: ((seq: TSequence) => void) | null;
|
|
9
|
-
unregisterSequence: (id: string) => void;
|
|
10
|
-
sequences: TSequence[];
|
|
11
|
-
};
|
|
12
|
-
export type SequenceManagerRef = {
|
|
13
|
-
current: TSequence[];
|
|
14
|
-
};
|
|
15
|
-
export type SequenceNodePath = Array<string | number>;
|
|
16
|
-
type SequenceManagerActions = Pick<SequenceManagerContext, 'registerSequence' | 'updateSequence' | 'unregisterSequence'>;
|
|
17
|
-
export declare const SequenceManagerActionsContext: React.Context<SequenceManagerActions>;
|
|
18
|
-
export declare const SequenceManager: React.Context<SequenceManagerContext>;
|
|
19
|
-
export declare const useSequenceManagerSequences: () => TSequence[];
|
|
20
|
-
export declare const SequenceManagerRefContext: React.Context<SequenceManagerRef>;
|
|
21
|
-
export declare const SequenceRegistrationContext: React.Context<boolean>;
|
|
22
|
-
export declare const DisableSequenceRegistrationContext: React.Context<boolean>;
|
|
23
|
-
export declare const DisableSequenceRegistrationProvider: React.FC<{
|
|
24
|
-
readonly children: React.ReactNode;
|
|
25
|
-
}>;
|
|
26
7
|
export type VisualModePropStatuses = {
|
|
27
8
|
propStatuses: PropStatuses;
|
|
28
9
|
};
|
|
@@ -96,9 +77,10 @@ export declare const makeSequencePropsSubscriptionKey: (key: SequencePropsSubscr
|
|
|
96
77
|
export declare const VisualModePropStatusesContext: React.Context<VisualModePropStatuses>;
|
|
97
78
|
export declare const VisualModePropStatusesRefContext: React.Context<VisualModePropStatusesRef>;
|
|
98
79
|
export declare const VisualModeDragOverridesContext: React.Context<VisualModeDragOverrides>;
|
|
80
|
+
export declare const VisualModeDragOverridesRefContext: React.Context<React.RefObject<VisualModeDragOverrides>>;
|
|
99
81
|
export declare const useDragOverridesForNodePath: (nodePath: SequencePropsSubscriptionKey | null) => Record<string, DragOverrideValue>;
|
|
100
82
|
export declare const useActiveFromDragOverrideKeys: () => ReadonlySet<string>;
|
|
101
|
-
export declare const useEffectDragOverridesForNodePath: (nodePath: SequencePropsSubscriptionKey | null
|
|
83
|
+
export declare const useEffectDragOverridesForNodePath: (nodePath: SequencePropsSubscriptionKey | null) => Record<string, Record<string, DragOverrideValue>>;
|
|
102
84
|
export declare const VisualModeSettersContext: React.Context<VisualModeSetters>;
|
|
103
85
|
export declare const VisualModeBatchSettersContext: React.Context<VisualModeBatchSetters | null>;
|
|
104
86
|
export type SequencePropsSubscriptionKey = {
|