remotion 4.0.472 → 4.0.474
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/CompositionManager.d.ts +1 -1
- package/dist/cjs/Img.d.ts +0 -1
- package/dist/cjs/Sequence.d.ts +3 -1
- package/dist/cjs/Sequence.js +7 -1
- package/dist/cjs/SequenceManager.d.ts +13 -5
- package/dist/cjs/SequenceManager.js +23 -13
- package/dist/cjs/calculate-media-duration.js +1 -1
- package/dist/cjs/canvas-image/CanvasImage.d.ts +0 -1
- package/dist/cjs/effects/use-memoized-effects.d.ts +5 -5
- package/dist/cjs/effects/use-memoized-effects.js +32 -21
- package/dist/cjs/get-effective-visual-mode-value.d.ts +2 -2
- package/dist/cjs/get-effective-visual-mode-value.js +11 -8
- package/dist/cjs/internals.d.ts +14 -14
- package/dist/cjs/internals.js +7 -3
- package/dist/cjs/interpolate-keyframed-status.d.ts +3 -1
- package/dist/cjs/interpolate-keyframed-status.js +3 -2
- package/dist/cjs/interpolate.d.ts +8 -1
- package/dist/cjs/interpolate.js +34 -1
- package/dist/cjs/no-react.d.ts +0 -1
- package/dist/cjs/sequence-field-schema.d.ts +70 -3
- package/dist/cjs/sequence-field-schema.js +6 -2
- package/dist/cjs/series/index.js +2 -2
- package/dist/cjs/timeline-position-state.d.ts +1 -0
- package/dist/cjs/timeline-position-state.js +6 -2
- package/dist/cjs/use-media-in-timeline.d.ts +1 -1
- package/dist/cjs/use-schema.d.ts +3 -4
- package/dist/cjs/use-schema.js +6 -6
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrap-in-schema.js +3 -3
- package/dist/cjs/wrap-remotion-context.d.ts +2 -0
- package/dist/cjs/wrap-remotion-context.js +7 -1
- package/dist/esm/index.mjs +179 -82
- package/dist/esm/no-react.mjs +43 -2
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -71,7 +71,7 @@ export type TSequence = {
|
|
|
71
71
|
premountDisplay: number | null;
|
|
72
72
|
postmountDisplay: number | null;
|
|
73
73
|
controls: SequenceControls | null;
|
|
74
|
-
refForOutline: React.RefObject<
|
|
74
|
+
refForOutline: React.RefObject<Element | null> | null;
|
|
75
75
|
effects: readonly EffectDefinition<unknown>[];
|
|
76
76
|
isInsideSeries: boolean;
|
|
77
77
|
} & EnhancedTSequenceData;
|
package/dist/cjs/Img.d.ts
CHANGED
package/dist/cjs/Sequence.d.ts
CHANGED
|
@@ -65,9 +65,11 @@ export type SequencePropsWithoutDuration = {
|
|
|
65
65
|
/**
|
|
66
66
|
* @deprecated For internal use only.
|
|
67
67
|
*/
|
|
68
|
-
readonly _remotionInternalRefForOutline?: React.RefObject<
|
|
68
|
+
readonly _remotionInternalRefForOutline?: React.RefObject<Element | null> | null;
|
|
69
69
|
} & LayoutAndStyle;
|
|
70
70
|
export type SequenceProps = {
|
|
71
71
|
readonly durationInFrames?: number;
|
|
72
72
|
} & SequencePropsWithoutDuration;
|
|
73
|
+
export declare const SequenceWithoutSchema: React.ForwardRefExoticComponent<SequenceProps & React.RefAttributes<HTMLDivElement>>;
|
|
73
74
|
export declare const Sequence: React.ComponentType<SequenceProps & React.RefAttributes<HTMLDivElement>>;
|
|
75
|
+
export declare const SequenceWithoutFrom: React.ComponentType<SequenceProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Sequence = void 0;
|
|
3
|
+
exports.SequenceWithoutFrom = exports.Sequence = exports.SequenceWithoutSchema = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
6
6
|
const react_1 = require("react");
|
|
@@ -316,6 +316,7 @@ const SequenceRefForwardingFunction = (props, ref) => {
|
|
|
316
316
|
return jsx_runtime_1.jsx(RegularSequence, { ...props, ref: ref });
|
|
317
317
|
};
|
|
318
318
|
const SequenceInner = (0, react_1.forwardRef)(SequenceRefForwardingFunction);
|
|
319
|
+
exports.SequenceWithoutSchema = SequenceInner;
|
|
319
320
|
/*
|
|
320
321
|
* @description A component that time-shifts its children and wraps them in an absolutely positioned <div>.
|
|
321
322
|
* @see [Documentation](https://www.remotion.dev/docs/sequence)
|
|
@@ -325,3 +326,8 @@ exports.Sequence = (0, wrap_in_schema_js_1.wrapInSchema)({
|
|
|
325
326
|
schema: sequence_field_schema_js_1.sequenceSchema,
|
|
326
327
|
supportsEffects: false,
|
|
327
328
|
});
|
|
329
|
+
exports.SequenceWithoutFrom = (0, wrap_in_schema_js_1.wrapInSchema)({
|
|
330
|
+
Component: SequenceInner,
|
|
331
|
+
schema: sequence_field_schema_js_1.sequenceSchemaWithoutFrom,
|
|
332
|
+
supportsEffects: false,
|
|
333
|
+
});
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TSequence } from './CompositionManager.js';
|
|
3
|
-
import type { CanUpdateSequencePropStatus,
|
|
3
|
+
import type { CanUpdateSequencePropStatus, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, PropStatuses } from './use-schema.js';
|
|
4
4
|
export type SequenceManagerContext = {
|
|
5
5
|
registerSequence: (seq: TSequence) => void;
|
|
6
6
|
unregisterSequence: (id: string) => void;
|
|
7
7
|
sequences: TSequence[];
|
|
8
8
|
};
|
|
9
|
+
export type SequenceManagerRef = {
|
|
10
|
+
current: TSequence[];
|
|
11
|
+
};
|
|
9
12
|
export type SequenceNodePath = Array<string | number>;
|
|
10
13
|
export declare const SequenceManager: React.Context<SequenceManagerContext>;
|
|
11
|
-
export
|
|
12
|
-
|
|
14
|
+
export declare const SequenceManagerRefContext: React.Context<SequenceManagerRef>;
|
|
15
|
+
export type VisualModePropStatuses = {
|
|
16
|
+
propStatuses: PropStatuses;
|
|
17
|
+
};
|
|
18
|
+
export type VisualModePropStatusesRef = {
|
|
19
|
+
current: PropStatuses;
|
|
13
20
|
};
|
|
14
21
|
export type VisualModeDragOverrides = {
|
|
15
22
|
getDragOverrides: GetDragOverrides;
|
|
@@ -20,7 +27,7 @@ export type VisualModeSetters = {
|
|
|
20
27
|
clearDragOverrides: (nodePath: SequencePropsSubscriptionKey) => void;
|
|
21
28
|
setEffectDragOverrides: (nodePath: SequencePropsSubscriptionKey, effectIndex: number, key: string, value: DragOverrideValue) => void;
|
|
22
29
|
clearEffectDragOverrides: (nodePath: SequencePropsSubscriptionKey, effectIndex: number) => void;
|
|
23
|
-
|
|
30
|
+
setPropStatuses: (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
|
|
24
31
|
};
|
|
25
32
|
export type CanUpdateEffectPropsResponseTrue = {
|
|
26
33
|
canUpdate: true;
|
|
@@ -48,7 +55,8 @@ export type CanUpdateSequencePropsResponseFalse = {
|
|
|
48
55
|
};
|
|
49
56
|
export type CanUpdateSequencePropsResponse = CanUpdateSequencePropsResponseTrue | CanUpdateSequencePropsResponseFalse;
|
|
50
57
|
export declare const makeSequencePropsSubscriptionKey: (key: SequencePropsSubscriptionKey) => string;
|
|
51
|
-
export declare const
|
|
58
|
+
export declare const VisualModePropStatusesContext: React.Context<VisualModePropStatuses>;
|
|
59
|
+
export declare const VisualModePropStatusesRefContext: React.Context<VisualModePropStatusesRef>;
|
|
52
60
|
export declare const VisualModeDragOverridesContext: React.Context<VisualModeDragOverrides>;
|
|
53
61
|
export declare const VisualModeSettersContext: React.Context<VisualModeSetters>;
|
|
54
62
|
export type SequencePropsSubscriptionKey = {
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SequenceManagerProvider = exports.VisualModeSettersContext = exports.VisualModeDragOverridesContext = exports.
|
|
36
|
+
exports.SequenceManagerProvider = exports.VisualModeSettersContext = exports.VisualModeDragOverridesContext = exports.VisualModePropStatusesRefContext = exports.VisualModePropStatusesContext = exports.makeSequencePropsSubscriptionKey = exports.SequenceManagerRefContext = exports.SequenceManager = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
exports.SequenceManager = react_1.default.createContext({
|
|
@@ -45,12 +45,18 @@ exports.SequenceManager = react_1.default.createContext({
|
|
|
45
45
|
},
|
|
46
46
|
sequences: [],
|
|
47
47
|
});
|
|
48
|
+
exports.SequenceManagerRefContext = react_1.default.createContext({
|
|
49
|
+
current: [],
|
|
50
|
+
});
|
|
48
51
|
const makeSequencePropsSubscriptionKey = (key) => {
|
|
49
52
|
return `${key.nodePath.join('.')}.${key.sequenceKeys.join('.')}.${key.effectKeys.map((keys) => keys.join('.')).join('.')}`;
|
|
50
53
|
};
|
|
51
54
|
exports.makeSequencePropsSubscriptionKey = makeSequencePropsSubscriptionKey;
|
|
52
|
-
exports.
|
|
53
|
-
|
|
55
|
+
exports.VisualModePropStatusesContext = react_1.default.createContext({
|
|
56
|
+
propStatuses: {},
|
|
57
|
+
});
|
|
58
|
+
exports.VisualModePropStatusesRefContext = react_1.default.createContext({
|
|
59
|
+
current: {},
|
|
54
60
|
});
|
|
55
61
|
exports.VisualModeDragOverridesContext = react_1.default.createContext({
|
|
56
62
|
getDragOverrides: () => {
|
|
@@ -73,18 +79,22 @@ exports.VisualModeSettersContext = react_1.default.createContext({
|
|
|
73
79
|
clearEffectDragOverrides: () => {
|
|
74
80
|
throw new Error('VisualModeSettersContext not initialized');
|
|
75
81
|
},
|
|
76
|
-
|
|
82
|
+
setPropStatuses: () => {
|
|
77
83
|
throw new Error('VisualModeSettersContext not initialized');
|
|
78
84
|
},
|
|
79
85
|
});
|
|
80
86
|
const effectDragOverridesKey = (nodePath, effectIndex) => `${(0, exports.makeSequencePropsSubscriptionKey)(nodePath)}.effects.${effectIndex}`;
|
|
81
87
|
const SequenceManagerProvider = ({ children }) => {
|
|
82
88
|
const [sequences, setSequences] = (0, react_1.useState)([]);
|
|
89
|
+
const sequencesRef = (0, react_1.useRef)(sequences);
|
|
90
|
+
sequencesRef.current = sequences;
|
|
83
91
|
const [dragOverrides, setControlOverrides] = (0, react_1.useState)({});
|
|
84
92
|
const controlOverridesRef = (0, react_1.useRef)(dragOverrides);
|
|
85
93
|
controlOverridesRef.current = dragOverrides;
|
|
86
94
|
const [effectDragOverridesState, setEffectDragOverridesState] = (0, react_1.useState)({});
|
|
87
|
-
const [
|
|
95
|
+
const [propStatuses, setPropStatusesMapState] = (0, react_1.useState)({});
|
|
96
|
+
const propStatusesRef = (0, react_1.useRef)(propStatuses);
|
|
97
|
+
propStatusesRef.current = propStatuses;
|
|
88
98
|
const setDragOverrides = (0, react_1.useCallback)((nodePath, key, value) => {
|
|
89
99
|
setControlOverrides((prev) => ({
|
|
90
100
|
...prev,
|
|
@@ -128,8 +138,8 @@ const SequenceManagerProvider = ({ children }) => {
|
|
|
128
138
|
return next;
|
|
129
139
|
});
|
|
130
140
|
}, []);
|
|
131
|
-
const
|
|
132
|
-
|
|
141
|
+
const setPropStatuses = (0, react_1.useCallback)((nodePath, values) => {
|
|
142
|
+
setPropStatusesMapState((prev) => {
|
|
133
143
|
const key = (0, exports.makeSequencePropsSubscriptionKey)(nodePath);
|
|
134
144
|
const prevKey = prev[key];
|
|
135
145
|
const newKey = values(prevKey);
|
|
@@ -162,11 +172,11 @@ const SequenceManagerProvider = ({ children }) => {
|
|
|
162
172
|
var _a;
|
|
163
173
|
return ((_a = effectDragOverridesState[effectDragOverridesKey(nodePath, effectIndex)]) !== null && _a !== void 0 ? _a : {});
|
|
164
174
|
}, [effectDragOverridesState]);
|
|
165
|
-
const
|
|
175
|
+
const propStatusesContext = (0, react_1.useMemo)(() => {
|
|
166
176
|
return {
|
|
167
|
-
|
|
177
|
+
propStatuses,
|
|
168
178
|
};
|
|
169
|
-
}, [
|
|
179
|
+
}, [propStatuses]);
|
|
170
180
|
const dragOverridesContext = (0, react_1.useMemo)(() => {
|
|
171
181
|
return {
|
|
172
182
|
getDragOverrides,
|
|
@@ -179,15 +189,15 @@ const SequenceManagerProvider = ({ children }) => {
|
|
|
179
189
|
clearDragOverrides,
|
|
180
190
|
setEffectDragOverrides,
|
|
181
191
|
clearEffectDragOverrides,
|
|
182
|
-
|
|
192
|
+
setPropStatuses,
|
|
183
193
|
};
|
|
184
194
|
}, [
|
|
185
195
|
setDragOverrides,
|
|
186
196
|
clearDragOverrides,
|
|
187
197
|
setEffectDragOverrides,
|
|
188
198
|
clearEffectDragOverrides,
|
|
189
|
-
|
|
199
|
+
setPropStatuses,
|
|
190
200
|
]);
|
|
191
|
-
return (jsx_runtime_1.jsx(exports.SequenceManager.Provider, { value: sequenceContext, children: jsx_runtime_1.jsx(exports.
|
|
201
|
+
return (jsx_runtime_1.jsx(exports.SequenceManagerRefContext.Provider, { value: sequencesRef, children: jsx_runtime_1.jsx(exports.SequenceManager.Provider, { value: sequenceContext, children: jsx_runtime_1.jsx(exports.VisualModePropStatusesRefContext.Provider, { value: propStatusesRef, children: jsx_runtime_1.jsx(exports.VisualModePropStatusesContext.Provider, { value: propStatusesContext, children: jsx_runtime_1.jsx(exports.VisualModeDragOverridesContext.Provider, { value: dragOverridesContext, children: jsx_runtime_1.jsx(exports.VisualModeSettersContext.Provider, { value: settersContext, children: children }) }) }) }) }) }));
|
|
192
202
|
};
|
|
193
203
|
exports.SequenceManagerProvider = SequenceManagerProvider;
|
|
@@ -12,6 +12,6 @@ const calculateMediaDuration = ({ trimAfter, mediaDurationInFrames, playbackRate
|
|
|
12
12
|
duration -= trimBefore;
|
|
13
13
|
}
|
|
14
14
|
const actualDuration = duration / playbackRate;
|
|
15
|
-
return
|
|
15
|
+
return Number(actualDuration.toFixed(10));
|
|
16
16
|
};
|
|
17
17
|
exports.calculateMediaDuration = calculateMediaDuration;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CannotUpdateEffectReason, CannotUpdateSequenceReason } from '../SequenceManager.js';
|
|
2
2
|
import { type SequencePropsSubscriptionKey } from '../SequenceManager.js';
|
|
3
|
-
import { type CanUpdateSequencePropStatus, type
|
|
3
|
+
import { type CanUpdateSequencePropStatus, type PropStatuses } from '../use-schema.js';
|
|
4
4
|
import type { EffectDefinition, EffectDefinitionAndStack, EffectDescriptor } from './effect-types.js';
|
|
5
5
|
export declare const useMemoizedEffectDefinitions: (effects: readonly EffectDescriptor<unknown>[]) => readonly EffectDefinition<unknown>[];
|
|
6
6
|
type EffectStatus = {
|
|
@@ -13,13 +13,13 @@ type EffectStatus = {
|
|
|
13
13
|
type: 'can-update-effect';
|
|
14
14
|
props: Record<string, CanUpdateSequencePropStatus>;
|
|
15
15
|
};
|
|
16
|
-
export declare const
|
|
17
|
-
|
|
16
|
+
export declare const getEffectPropStatusesCtx: ({ propStatuses, nodePath, effectIndex, }: {
|
|
17
|
+
propStatuses: PropStatuses;
|
|
18
18
|
nodePath: SequencePropsSubscriptionKey;
|
|
19
19
|
effectIndex: number;
|
|
20
20
|
}) => EffectStatus;
|
|
21
|
-
export declare const
|
|
22
|
-
export type
|
|
21
|
+
export declare const getPropStatusesCtx: (propStatuses: PropStatuses, nodePath: SequencePropsSubscriptionKey) => Record<string, CanUpdateSequencePropStatus> | undefined;
|
|
22
|
+
export type GetPropStatusesType = typeof getPropStatusesCtx;
|
|
23
23
|
export declare const useMemoizedEffects: ({ effects, overrideId, }: {
|
|
24
24
|
effects: readonly EffectDescriptor<unknown>[];
|
|
25
25
|
readonly overrideId: string | null;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMemoizedEffects = exports.
|
|
3
|
+
exports.useMemoizedEffects = exports.getPropStatusesCtx = exports.getEffectPropStatusesCtx = exports.useMemoizedEffectDefinitions = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const get_effective_visual_mode_value_js_1 = require("../get-effective-visual-mode-value.js");
|
|
6
|
+
const interpolate_keyframed_status_js_1 = require("../interpolate-keyframed-status.js");
|
|
6
7
|
const sequence_node_path_js_1 = require("../sequence-node-path.js");
|
|
7
8
|
const SequenceManager_js_1 = require("../SequenceManager.js");
|
|
8
|
-
const SequenceManager_js_2 = require("../SequenceManager.js");
|
|
9
9
|
const use_current_frame_js_1 = require("../use-current-frame.js");
|
|
10
|
-
const mergeOverrides = ({ descriptor,
|
|
11
|
-
if (!
|
|
10
|
+
const mergeOverrides = ({ descriptor, propStatusOverrides, dragOverrides, frame, }) => {
|
|
11
|
+
if (!propStatusOverrides && !dragOverrides) {
|
|
12
12
|
return { params: descriptor.params, effectKey: descriptor.effectKey };
|
|
13
13
|
}
|
|
14
14
|
const merged = {
|
|
15
15
|
...descriptor.params,
|
|
16
16
|
};
|
|
17
|
-
if (
|
|
18
|
-
for (const [key, value] of Object.entries(
|
|
17
|
+
if (propStatusOverrides) {
|
|
18
|
+
for (const [key, value] of Object.entries(propStatusOverrides)) {
|
|
19
19
|
if (value !== undefined) {
|
|
20
20
|
merged[key] = value;
|
|
21
21
|
}
|
|
@@ -37,16 +37,27 @@ const mergeOverrides = ({ descriptor, codeOverrides, dragOverrides, frame, }) =>
|
|
|
37
37
|
effectKey: descriptor.definition.calculateKey(merged),
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
const
|
|
40
|
+
const resolvePropStatusOverrides = (propStatus, frame) => {
|
|
41
41
|
if (!propStatus) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
const out = {};
|
|
45
45
|
let hasAny = false;
|
|
46
46
|
for (const [key, status] of Object.entries(propStatus)) {
|
|
47
|
-
if (status.status
|
|
47
|
+
if (status.status === 'static') {
|
|
48
48
|
out[key] = status.codeValue;
|
|
49
49
|
hasAny = true;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (status.status === 'keyframed') {
|
|
53
|
+
const value = (0, interpolate_keyframed_status_js_1.interpolateKeyframedStatus)({
|
|
54
|
+
frame,
|
|
55
|
+
status,
|
|
56
|
+
});
|
|
57
|
+
if (value !== null) {
|
|
58
|
+
out[key] = value;
|
|
59
|
+
hasAny = true;
|
|
60
|
+
}
|
|
50
61
|
}
|
|
51
62
|
}
|
|
52
63
|
return hasAny ? out : null;
|
|
@@ -65,8 +76,8 @@ const useMemoizedEffectDefinitions = (effects) => {
|
|
|
65
76
|
return definitions;
|
|
66
77
|
};
|
|
67
78
|
exports.useMemoizedEffectDefinitions = useMemoizedEffectDefinitions;
|
|
68
|
-
const
|
|
69
|
-
const status =
|
|
79
|
+
const getEffectPropStatusesCtx = ({ propStatuses, nodePath, effectIndex, }) => {
|
|
80
|
+
const status = propStatuses[(0, SequenceManager_js_1.makeSequencePropsSubscriptionKey)(nodePath)];
|
|
70
81
|
if (!status) {
|
|
71
82
|
return { type: 'cannot-update-sequence', reason: 'not-found' };
|
|
72
83
|
}
|
|
@@ -82,9 +93,9 @@ const getEffectCodeValuesCtx = ({ codeValues, nodePath, effectIndex, }) => {
|
|
|
82
93
|
}
|
|
83
94
|
return { type: 'can-update-effect', props: effect.props };
|
|
84
95
|
};
|
|
85
|
-
exports.
|
|
86
|
-
const
|
|
87
|
-
const status =
|
|
96
|
+
exports.getEffectPropStatusesCtx = getEffectPropStatusesCtx;
|
|
97
|
+
const getPropStatusesCtx = (propStatuses, nodePath) => {
|
|
98
|
+
const status = propStatuses[(0, SequenceManager_js_1.makeSequencePropsSubscriptionKey)(nodePath)];
|
|
88
99
|
if (!status) {
|
|
89
100
|
return undefined;
|
|
90
101
|
}
|
|
@@ -93,12 +104,12 @@ const getCodeValuesCtx = (codeValues, nodePath) => {
|
|
|
93
104
|
}
|
|
94
105
|
return status.props;
|
|
95
106
|
};
|
|
96
|
-
exports.
|
|
107
|
+
exports.getPropStatusesCtx = getPropStatusesCtx;
|
|
97
108
|
const useMemoizedEffects = ({ effects, overrideId, }) => {
|
|
98
109
|
var _a;
|
|
99
110
|
const previousRef = (0, react_1.useRef)(null);
|
|
100
|
-
const {
|
|
101
|
-
const { getEffectDragOverrides } = (0, react_1.useContext)(
|
|
111
|
+
const { propStatuses } = (0, react_1.useContext)(SequenceManager_js_1.VisualModePropStatusesContext);
|
|
112
|
+
const { getEffectDragOverrides } = (0, react_1.useContext)(SequenceManager_js_1.VisualModeDragOverridesContext);
|
|
102
113
|
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
103
114
|
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(sequence_node_path_js_1.OverrideIdsToNodePathsGettersContext);
|
|
104
115
|
const previous = previousRef.current;
|
|
@@ -113,19 +124,19 @@ const useMemoizedEffects = ({ effects, overrideId, }) => {
|
|
|
113
124
|
effectKey: descriptor.effectKey,
|
|
114
125
|
};
|
|
115
126
|
}
|
|
116
|
-
const effectStatus = (0, exports.
|
|
117
|
-
|
|
127
|
+
const effectStatus = (0, exports.getEffectPropStatusesCtx)({
|
|
128
|
+
propStatuses,
|
|
118
129
|
nodePath,
|
|
119
130
|
effectIndex: index,
|
|
120
131
|
});
|
|
121
|
-
const
|
|
122
|
-
?
|
|
132
|
+
const propStatusOverrides = effectStatus.type === 'can-update-effect'
|
|
133
|
+
? resolvePropStatusOverrides(effectStatus.props, frame)
|
|
123
134
|
: null;
|
|
124
135
|
const dragOverridesMap = getEffectDragOverrides(nodePath, index);
|
|
125
136
|
const dragOverrides = Object.keys(dragOverridesMap).length === 0 ? null : dragOverridesMap;
|
|
126
137
|
const { params, effectKey } = mergeOverrides({
|
|
127
138
|
descriptor,
|
|
128
|
-
|
|
139
|
+
propStatusOverrides,
|
|
129
140
|
dragOverrides,
|
|
130
141
|
frame,
|
|
131
142
|
});
|
|
@@ -9,8 +9,8 @@ export declare const resolveDragOverrideValue: ({ dragOverrideValue, frame, }: {
|
|
|
9
9
|
dragOverrideValue: DragOverrideValue | undefined;
|
|
10
10
|
frame: number | null;
|
|
11
11
|
}) => ResolvedDragOverrideValue;
|
|
12
|
-
export declare const getEffectiveVisualModeValue: ({
|
|
13
|
-
|
|
12
|
+
export declare const getEffectiveVisualModeValue: ({ propStatus, dragOverrideValue, defaultValue, frame, shouldResortToDefaultValueIfUndefined, }: {
|
|
13
|
+
propStatus: CanUpdateSequencePropStatusKeyframed | CanUpdateSequencePropStatusStatic;
|
|
14
14
|
dragOverrideValue: DragOverrideValue | undefined;
|
|
15
15
|
defaultValue: unknown;
|
|
16
16
|
frame?: number | null | undefined;
|
|
@@ -22,7 +22,7 @@ const resolveDragOverrideValue = ({ dragOverrideValue, frame, }) => {
|
|
|
22
22
|
return { type: 'resolved', value: interpolated };
|
|
23
23
|
};
|
|
24
24
|
exports.resolveDragOverrideValue = resolveDragOverrideValue;
|
|
25
|
-
const getEffectiveVisualModeValue = ({
|
|
25
|
+
const getEffectiveVisualModeValue = ({ propStatus, dragOverrideValue, defaultValue, frame = null, shouldResortToDefaultValueIfUndefined = false, }) => {
|
|
26
26
|
const dragOverride = (0, exports.resolveDragOverrideValue)({
|
|
27
27
|
dragOverrideValue,
|
|
28
28
|
frame,
|
|
@@ -30,16 +30,19 @@ const getEffectiveVisualModeValue = ({ codeValue, dragOverrideValue, defaultValu
|
|
|
30
30
|
if (dragOverride.type === 'resolved' && dragOverride.value !== undefined) {
|
|
31
31
|
return dragOverride.value;
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (propStatus.status === 'keyframed') {
|
|
34
|
+
if (frame !== null) {
|
|
35
|
+
return (0, interpolate_keyframed_status_1.interpolateKeyframedStatus)({
|
|
36
|
+
frame,
|
|
37
|
+
status: propStatus,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return shouldResortToDefaultValueIfUndefined ? defaultValue : undefined;
|
|
38
41
|
}
|
|
39
|
-
if (
|
|
42
|
+
if (propStatus.codeValue === undefined &&
|
|
40
43
|
shouldResortToDefaultValueIfUndefined) {
|
|
41
44
|
return defaultValue;
|
|
42
45
|
}
|
|
43
|
-
return
|
|
46
|
+
return propStatus.codeValue;
|
|
44
47
|
};
|
|
45
48
|
exports.getEffectiveVisualModeValue = getEffectiveVisualModeValue;
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ import { type CanUpdateEffectPropsResponse, type CanUpdateEffectPropsResponseFal
|
|
|
18
18
|
import * as TimelinePosition from './timeline-position-state.js';
|
|
19
19
|
import { type PlaybackRateContextValue, type SetTimelineContextValue, type TimelineContextValue } from './TimelineContext.js';
|
|
20
20
|
import { truthy } from './truthy.js';
|
|
21
|
-
import type { CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, DragOverrideValue,
|
|
22
|
-
import { type CanUpdateSequencePropStatus, type
|
|
21
|
+
import type { CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, GetEffectPropStatuses, GetPropStatuses } from './use-schema.js';
|
|
22
|
+
import { type CanUpdateSequencePropStatus, type DragOverrides, type EffectDragOverrides, type PropStatuses } from './use-schema.js';
|
|
23
23
|
import type { MediaVolumeContextValue, SetMediaVolumeContextValue } from './volume-position-state.js';
|
|
24
24
|
import type { WatchRemotionStaticFilesPayload } from './watch-static-file.js';
|
|
25
25
|
import { useRemotionContexts } from './wrap-remotion-context.js';
|
|
@@ -70,10 +70,12 @@ export declare const Internals: {
|
|
|
70
70
|
}, "ref"> & import("react").RefAttributes<HTMLVideoElement>>;
|
|
71
71
|
readonly CompositionManager: import("react").Context<CompositionManagerContext>;
|
|
72
72
|
readonly CompositionSetters: import("react").Context<import("./CompositionManagerContext.js").CompositionManagerSetters>;
|
|
73
|
-
readonly
|
|
73
|
+
readonly VisualModePropStatusesContext: import("react").Context<import("./SequenceManager.js").VisualModePropStatuses>;
|
|
74
|
+
readonly VisualModePropStatusesRefContext: import("react").Context<import("./SequenceManager.js").VisualModePropStatusesRef>;
|
|
74
75
|
readonly VisualModeDragOverridesContext: import("react").Context<import("./SequenceManager.js").VisualModeDragOverrides>;
|
|
75
76
|
readonly VisualModeSettersContext: import("react").Context<import("./SequenceManager.js").VisualModeSetters>;
|
|
76
77
|
readonly SequenceManager: import("react").Context<import("./SequenceManager.js").SequenceManagerContext>;
|
|
78
|
+
readonly SequenceManagerRefContext: import("react").Context<import("./SequenceManager.js").SequenceManagerRef>;
|
|
77
79
|
readonly SequenceStackTracesUpdateContext: import("react").Context<import("./sequence-stack-traces.js").UpdateResolvedStackTraceFn>;
|
|
78
80
|
readonly wrapInSchema: <S extends SequenceSchema, Props extends object>({ Component, schema, supportsEffects, }: {
|
|
79
81
|
Component: import("react").ComponentType<Props & {
|
|
@@ -111,7 +113,6 @@ export declare const Internals: {
|
|
|
111
113
|
};
|
|
112
114
|
readonly 'style.scale': {
|
|
113
115
|
readonly type: "scale";
|
|
114
|
-
readonly min: 0.05;
|
|
115
116
|
readonly max: 100;
|
|
116
117
|
readonly step: 0.01;
|
|
117
118
|
readonly default: 1;
|
|
@@ -158,6 +159,7 @@ export declare const Internals: {
|
|
|
158
159
|
};
|
|
159
160
|
};
|
|
160
161
|
};
|
|
162
|
+
readonly SequenceWithoutSchema: import("react").ForwardRefExoticComponent<import("./Sequence.js").SequenceProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
161
163
|
readonly sequenceStyleSchema: {
|
|
162
164
|
readonly 'style.translate': {
|
|
163
165
|
readonly type: "translate";
|
|
@@ -167,7 +169,6 @@ export declare const Internals: {
|
|
|
167
169
|
};
|
|
168
170
|
readonly 'style.scale': {
|
|
169
171
|
readonly type: "scale";
|
|
170
|
-
readonly min: 0.05;
|
|
171
172
|
readonly max: 100;
|
|
172
173
|
readonly step: 0.01;
|
|
173
174
|
readonly default: 1;
|
|
@@ -219,7 +220,6 @@ export declare const Internals: {
|
|
|
219
220
|
};
|
|
220
221
|
readonly 'style.scale': {
|
|
221
222
|
readonly type: "scale";
|
|
222
|
-
readonly min: 0.05;
|
|
223
223
|
readonly max: 100;
|
|
224
224
|
readonly step: 0.01;
|
|
225
225
|
readonly default: 1;
|
|
@@ -303,7 +303,7 @@ export declare const Internals: {
|
|
|
303
303
|
postmountDisplay: number | null;
|
|
304
304
|
loopDisplay: import("./CompositionManager.js").LoopDisplay | undefined;
|
|
305
305
|
documentationLink: string | null;
|
|
306
|
-
refForOutline: import("react").RefObject<
|
|
306
|
+
refForOutline: import("react").RefObject<Element | null> | null;
|
|
307
307
|
}) => void;
|
|
308
308
|
readonly useLazyComponent: <Props>({ compProps, componentName, noSuspense, }: {
|
|
309
309
|
compProps: CompProps<Props>;
|
|
@@ -640,8 +640,8 @@ export declare const Internals: {
|
|
|
640
640
|
children: import("react").ReactNode;
|
|
641
641
|
collectAssets: import("react").RefObject<import("./RenderAssetManager.js").CollectAssetsRef | null> | null;
|
|
642
642
|
}>;
|
|
643
|
-
readonly getEffectiveVisualModeValue: ({
|
|
644
|
-
|
|
643
|
+
readonly getEffectiveVisualModeValue: ({ propStatus, dragOverrideValue, defaultValue, frame, shouldResortToDefaultValueIfUndefined, }: {
|
|
644
|
+
propStatus: CanUpdateSequencePropStatusKeyframed | CanUpdateSequencePropStatusStatic;
|
|
645
645
|
dragOverrideValue: DragOverrideValue | undefined;
|
|
646
646
|
defaultValue: unknown;
|
|
647
647
|
frame?: number | null | undefined;
|
|
@@ -675,7 +675,7 @@ export declare const Internals: {
|
|
|
675
675
|
readonly interpolateKeyframedStatus: ({ frame, status, }: {
|
|
676
676
|
frame: number;
|
|
677
677
|
status: CanUpdateSequencePropStatusKeyframed;
|
|
678
|
-
}) => string | number | null;
|
|
678
|
+
}) => string | number | readonly number[] | null;
|
|
679
679
|
readonly makeStaticDragOverride: (value: unknown) => DragOverrideValue;
|
|
680
680
|
readonly makeKeyframedDragOverride: ({ status, frame, value, }: {
|
|
681
681
|
status: CanUpdateSequencePropStatusKeyframed;
|
|
@@ -695,9 +695,9 @@ export declare const Internals: {
|
|
|
695
695
|
value: unknown;
|
|
696
696
|
}) => string[];
|
|
697
697
|
readonly makeSequencePropsSubscriptionKey: (key: SequencePropsSubscriptionKey) => string;
|
|
698
|
-
readonly
|
|
699
|
-
readonly
|
|
700
|
-
|
|
698
|
+
readonly getPropStatusesCtx: (propStatuses: PropStatuses, nodePath: SequencePropsSubscriptionKey) => Record<string, CanUpdateSequencePropStatus> | undefined;
|
|
699
|
+
readonly getEffectPropStatusesCtx: ({ propStatuses, nodePath, effectIndex, }: {
|
|
700
|
+
propStatuses: PropStatuses;
|
|
701
701
|
nodePath: SequencePropsSubscriptionKey;
|
|
702
702
|
effectIndex: number;
|
|
703
703
|
}) => {
|
|
@@ -725,4 +725,4 @@ export declare const Internals: {
|
|
|
725
725
|
readonly hiddenFromList: true;
|
|
726
726
|
};
|
|
727
727
|
};
|
|
728
|
-
export type { ArrayFieldSchema, ArrayItemFieldSchema, CannotUpdateSequenceReason, CanUpdateEffectPropsResponse, CanUpdateEffectPropsResponseFalse, CanUpdateEffectPropsResponseTrue, CanUpdateSequencePropsResponse, CanUpdateSequencePropsResponseFalse, CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic,
|
|
728
|
+
export type { ArrayFieldSchema, ArrayItemFieldSchema, CannotUpdateSequenceReason, CanUpdateEffectPropsResponse, CanUpdateEffectPropsResponseFalse, CanUpdateEffectPropsResponseTrue, CanUpdateSequencePropsResponse, CanUpdateSequencePropsResponseFalse, CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, CompositionManagerContext, CompProps, DragOverrides, DragOverrideValue, EffectDragOverrides, GetDragOverrides, GetEffectDragOverrides, GetEffectPropStatuses, GetPropStatuses, LoggingContextValue, MediaVolumeContextValue, NonceHistory, OverrideIdsToNodePathsGettersContext, OverrideIdsToNodePathsSettersContext, OverrideIdToNodePaths, OverrideToNodePathGetters, OverrideToNodeSetters, PlaybackRateContextValue, PropStatuses, RemotionAudioContextState, RemotionEnvironment, ResolvedStackLocation, ScheduleAudioNodeOptions, ScheduleAudioNodeResult, SequenceFieldSchema, SequenceNodePath, SequencePropsSubscriptionKey, SequenceSchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, VisibleFieldSchema, WatchRemotionStaticFilesPayload, };
|
package/dist/cjs/internals.js
CHANGED
|
@@ -82,6 +82,7 @@ const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
|
|
|
82
82
|
const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
|
|
83
83
|
const sequence_node_path_js_1 = require("./sequence-node-path.js");
|
|
84
84
|
const sequence_stack_traces_js_1 = require("./sequence-stack-traces.js");
|
|
85
|
+
const Sequence_js_1 = require("./Sequence.js");
|
|
85
86
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
86
87
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
87
88
|
const setup_env_variables_js_1 = require("./setup-env-variables.js");
|
|
@@ -133,13 +134,16 @@ exports.Internals = {
|
|
|
133
134
|
VideoForPreview: VideoForPreview_js_1.VideoForPreview,
|
|
134
135
|
CompositionManager: CompositionManagerContext_js_1.CompositionManager,
|
|
135
136
|
CompositionSetters: CompositionManagerContext_js_1.CompositionSetters,
|
|
136
|
-
|
|
137
|
+
VisualModePropStatusesContext: SequenceManager_js_1.VisualModePropStatusesContext,
|
|
138
|
+
VisualModePropStatusesRefContext: SequenceManager_js_1.VisualModePropStatusesRefContext,
|
|
137
139
|
VisualModeDragOverridesContext: SequenceManager_js_1.VisualModeDragOverridesContext,
|
|
138
140
|
VisualModeSettersContext: SequenceManager_js_1.VisualModeSettersContext,
|
|
139
141
|
SequenceManager: SequenceManager_js_1.SequenceManager,
|
|
142
|
+
SequenceManagerRefContext: SequenceManager_js_1.SequenceManagerRefContext,
|
|
140
143
|
SequenceStackTracesUpdateContext: sequence_stack_traces_js_1.SequenceStackTracesUpdateContext,
|
|
141
144
|
wrapInSchema: wrap_in_schema_js_1.wrapInSchema,
|
|
142
145
|
sequenceSchema: sequence_field_schema_js_1.sequenceSchema,
|
|
146
|
+
SequenceWithoutSchema: Sequence_js_1.SequenceWithoutSchema,
|
|
143
147
|
sequenceStyleSchema: sequence_field_schema_js_1.sequenceStyleSchema,
|
|
144
148
|
sequenceVisualStyleSchema: sequence_field_schema_js_1.sequenceVisualStyleSchema,
|
|
145
149
|
sequencePremountSchema: sequence_field_schema_js_1.sequencePremountSchema,
|
|
@@ -254,8 +258,8 @@ exports.Internals = {
|
|
|
254
258
|
OverrideIdsToNodePathsSettersContext: sequence_node_path_js_1.OverrideIdsToNodePathsSettersContext,
|
|
255
259
|
findPropsToDelete: find_props_to_delete_js_1.findPropsToDelete,
|
|
256
260
|
makeSequencePropsSubscriptionKey: SequenceManager_js_1.makeSequencePropsSubscriptionKey,
|
|
257
|
-
|
|
258
|
-
|
|
261
|
+
getPropStatusesCtx: use_memoized_effects_js_1.getPropStatusesCtx,
|
|
262
|
+
getEffectPropStatusesCtx: use_memoized_effects_js_1.getEffectPropStatusesCtx,
|
|
259
263
|
hiddenField: sequence_field_schema_js_1.hiddenField,
|
|
260
264
|
durationInFramesField: sequence_field_schema_js_1.durationInFramesField,
|
|
261
265
|
fromField: sequence_field_schema_js_1.fromField,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CanUpdateSequencePropStatusKeyframed } from './use-schema.js';
|
|
2
|
+
type InterpolateKeyframedStatusResult = number | string | readonly number[] | null;
|
|
2
3
|
export declare const interpolateKeyframedStatus: ({ frame, status, }: {
|
|
3
4
|
frame: number;
|
|
4
5
|
status: CanUpdateSequencePropStatusKeyframed;
|
|
5
|
-
}) =>
|
|
6
|
+
}) => InterpolateKeyframedStatusResult;
|
|
7
|
+
export {};
|
|
@@ -16,8 +16,9 @@ const interpolateKeyframedStatus = ({ frame, status, }) => {
|
|
|
16
16
|
if (keyframes.length === 0) {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
const
|
|
19
|
+
const sortedKeyframes = [...keyframes].sort((a, b) => a.frame - b.frame);
|
|
20
|
+
const inputRange = sortedKeyframes.map((k) => k.frame);
|
|
21
|
+
const outputs = sortedKeyframes.map((k) => k.value);
|
|
21
22
|
if (interpolationFunction === 'interpolateColors') {
|
|
22
23
|
if (!outputs.every((v) => typeof v === 'string')) {
|
|
23
24
|
return null;
|
|
@@ -10,8 +10,15 @@ export type InterpolateOptions = Partial<{
|
|
|
10
10
|
extrapolateRight: ExtrapolateType;
|
|
11
11
|
posterize: number;
|
|
12
12
|
}>;
|
|
13
|
+
type NumericTuple = readonly [number, ...number[]];
|
|
14
|
+
type WidenNumericTuple<T extends readonly number[]> = {
|
|
15
|
+
readonly [Key in keyof T]: number;
|
|
16
|
+
};
|
|
13
17
|
export declare function assertValidInterpolateEasingOption(easing: EasingFunction | readonly EasingFunction[] | undefined, inputRangeLength: number): void;
|
|
14
18
|
export declare function assertValidInterpolatePosterizeOption(posterize: number | undefined): void;
|
|
15
19
|
export declare function interpolate(input: number, inputRange: readonly number[], outputRange: readonly number[], options?: InterpolateOptions): number;
|
|
16
20
|
export declare function interpolate(input: number, inputRange: readonly number[], outputRange: readonly string[], options?: InterpolateOptions): string;
|
|
17
|
-
export declare function interpolate(input: number, inputRange: readonly number[], outputRange: readonly
|
|
21
|
+
export declare function interpolate<const Tuple extends NumericTuple>(input: number, inputRange: readonly number[], outputRange: readonly Tuple[], options?: InterpolateOptions): WidenNumericTuple<Tuple>;
|
|
22
|
+
export declare function interpolate(input: number, inputRange: readonly number[], outputRange: readonly (readonly number[])[], options?: InterpolateOptions): number[];
|
|
23
|
+
export declare function interpolate(input: number, inputRange: readonly number[], outputRange: readonly (number | string | readonly number[])[], options?: InterpolateOptions): number | string | readonly number[];
|
|
24
|
+
export {};
|