remotion 4.0.521 → 4.0.522
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 +2 -0
- package/dist/cjs/Sequence.js +5 -1
- package/dist/cjs/SequenceManager.d.ts +2 -6
- package/dist/cjs/interpolate-translate.d.ts +8 -0
- package/dist/cjs/interpolate-translate.js +70 -0
- package/dist/cjs/sequence-field-schema.d.ts +425 -0
- package/dist/cjs/sequence-field-schema.js +133 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video-config.d.ts +1 -0
- package/dist/cjs/with-interactivity-schema.js +26 -1
- package/dist/cjs/wrap-in-schema.d.ts +20 -0
- package/dist/cjs/wrap-in-schema.js +203 -0
- package/dist/esm/index.mjs +24 -4
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -7,6 +7,7 @@ import type { EffectDefinition } from './effects/effect-types.js';
|
|
|
7
7
|
import type { InteractivitySchema } from './interactivity-schema.js';
|
|
8
8
|
import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
|
|
9
9
|
import type { RuntimeValueSnapshot, RuntimeValueStore } from './runtime-value-store.js';
|
|
10
|
+
import type { VideoConfigValues } from './video-config.js';
|
|
10
11
|
export type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
|
|
11
12
|
width: number | undefined;
|
|
12
13
|
height: number | undefined;
|
|
@@ -61,6 +62,7 @@ export type JsxComponentIdentity = string;
|
|
|
61
62
|
export type SequenceRegistrationControls = {
|
|
62
63
|
schema: InteractivitySchema;
|
|
63
64
|
runtimeValues: RuntimeValueStore;
|
|
65
|
+
videoConfigValues: VideoConfigValues | null;
|
|
64
66
|
overrideId: string;
|
|
65
67
|
supportsEffects: boolean;
|
|
66
68
|
componentIdentity: JsxComponentIdentity | null;
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -195,6 +195,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
195
195
|
const controlsSupportsEffects = controls === null || controls === void 0 ? void 0 : controls.supportsEffects;
|
|
196
196
|
const controlsComponentIdentity = controls === null || controls === void 0 ? void 0 : controls.componentIdentity;
|
|
197
197
|
const controlsComponentName = controls === null || controls === void 0 ? void 0 : controls.componentName;
|
|
198
|
+
const controlsVideoConfigValues = controls === null || controls === void 0 ? void 0 : controls.videoConfigValues;
|
|
198
199
|
const effectRuntimeValues = (0, react_1.useMemo)(() => {
|
|
199
200
|
var _a;
|
|
200
201
|
return (_a = _remotionInternalEffects === null || _remotionInternalEffects === void 0 ? void 0 : _remotionInternalEffects.runtimeValues) !== null && _a !== void 0 ? _a : null;
|
|
@@ -205,7 +206,8 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
205
206
|
controlsOverrideId === undefined ||
|
|
206
207
|
controlsSupportsEffects === undefined ||
|
|
207
208
|
controlsComponentIdentity === undefined ||
|
|
208
|
-
controlsComponentName === undefined
|
|
209
|
+
controlsComponentName === undefined ||
|
|
210
|
+
controlsVideoConfigValues === undefined) {
|
|
209
211
|
return null;
|
|
210
212
|
}
|
|
211
213
|
return {
|
|
@@ -215,10 +217,12 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
215
217
|
supportsEffects: controlsSupportsEffects,
|
|
216
218
|
componentIdentity: controlsComponentIdentity,
|
|
217
219
|
componentName: controlsComponentName,
|
|
220
|
+
videoConfigValues: controlsVideoConfigValues,
|
|
218
221
|
};
|
|
219
222
|
}, [
|
|
220
223
|
controlsComponentIdentity,
|
|
221
224
|
controlsComponentName,
|
|
225
|
+
controlsVideoConfigValues,
|
|
222
226
|
controlsOverrideId,
|
|
223
227
|
controlsRuntimeValues,
|
|
224
228
|
controlsSchema,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TSequence } from './CompositionManager.js';
|
|
3
3
|
import type { CanUpdateSequencePropStatus, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, PropStatuses } from './use-schema.js';
|
|
4
|
+
import type { VideoConfigValues } from './video-config.js';
|
|
4
5
|
export type SequenceManagerContext = {
|
|
5
6
|
registerSequence: (seq: TSequence) => void;
|
|
6
7
|
updateSequence: ((seq: TSequence) => void) | null;
|
|
@@ -74,12 +75,7 @@ export type SequencePropsSubscriptionKey = {
|
|
|
74
75
|
effectKeys: string[][];
|
|
75
76
|
videoConfigValues: VideoConfigValues | null;
|
|
76
77
|
};
|
|
77
|
-
export type VideoConfigValues
|
|
78
|
-
durationInFrames: number;
|
|
79
|
-
fps: number;
|
|
80
|
-
height: number;
|
|
81
|
-
width: number;
|
|
82
|
-
};
|
|
78
|
+
export type { VideoConfigValues } from './video-config.js';
|
|
83
79
|
export declare const SequenceManagerProvider: React.FC<{
|
|
84
80
|
readonly children: React.ReactNode;
|
|
85
81
|
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type InterpolateOptions } from './interpolate.js';
|
|
2
|
+
export type InterpolateTranslateOptions = InterpolateOptions;
|
|
3
|
+
export declare const interpolateTranslate: (input: number, inputRange: readonly number[], outputRange: readonly string[], options?: Partial<{
|
|
4
|
+
easing: import("./interpolate.js").EasingFunction | readonly import("./interpolate.js").EasingFunction[];
|
|
5
|
+
extrapolateLeft: import("./interpolate.js").ExtrapolateType;
|
|
6
|
+
extrapolateRight: import("./interpolate.js").ExtrapolateType;
|
|
7
|
+
posterize: number;
|
|
8
|
+
}> | undefined) => string;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.interpolateTranslate = void 0;
|
|
4
|
+
const interpolate_js_1 = require("./interpolate.js");
|
|
5
|
+
const pixelValueRegex = /^([+-]?(?:\d+\.?\d*|\.\d+))px$/;
|
|
6
|
+
const parseTranslate = (value) => {
|
|
7
|
+
if (typeof value !== 'string') {
|
|
8
|
+
throw new TypeError(`outputRange must contain only strings, but got ${typeof value}`);
|
|
9
|
+
}
|
|
10
|
+
const parts = value.trim().split(/\s+/);
|
|
11
|
+
if (parts.length < 1 || parts.length > 3 || parts[0] === '') {
|
|
12
|
+
throw new TypeError(`translate values must contain 1 to 3 pixel values, but got "${value}"`);
|
|
13
|
+
}
|
|
14
|
+
return parts.map((part) => {
|
|
15
|
+
const match = pixelValueRegex.exec(part);
|
|
16
|
+
if (match === null) {
|
|
17
|
+
throw new TypeError(`interpolateTranslate() only supports px values, but got "${part}" in "${value}"`);
|
|
18
|
+
}
|
|
19
|
+
return Number(match[1]);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/*
|
|
23
|
+
* @description Allows you to map a range of values to CSS translate values using pixel units.
|
|
24
|
+
* @see [Documentation](https://remotion.dev/docs/interpolate-translate)
|
|
25
|
+
*/
|
|
26
|
+
const interpolateTranslate = (input, inputRange, outputRange, options) => {
|
|
27
|
+
var _a;
|
|
28
|
+
if (typeof input === 'undefined') {
|
|
29
|
+
throw new TypeError('input can not be undefined');
|
|
30
|
+
}
|
|
31
|
+
if (typeof inputRange === 'undefined') {
|
|
32
|
+
throw new TypeError('inputRange can not be undefined');
|
|
33
|
+
}
|
|
34
|
+
if (typeof outputRange === 'undefined') {
|
|
35
|
+
throw new TypeError('outputRange can not be undefined');
|
|
36
|
+
}
|
|
37
|
+
if (inputRange.length !== outputRange.length) {
|
|
38
|
+
throw new TypeError('inputRange (' +
|
|
39
|
+
inputRange.length +
|
|
40
|
+
' values provided) and outputRange (' +
|
|
41
|
+
outputRange.length +
|
|
42
|
+
' values provided) must have the same length');
|
|
43
|
+
}
|
|
44
|
+
const parsedOutputRange = outputRange.map((translateValue) => parseTranslate(translateValue));
|
|
45
|
+
const firstValueLength = (_a = parsedOutputRange[0]) === null || _a === void 0 ? void 0 : _a.length;
|
|
46
|
+
if (firstValueLength === undefined) {
|
|
47
|
+
throw new TypeError('outputRange must have at least 1 element');
|
|
48
|
+
}
|
|
49
|
+
for (const parsedTranslate of parsedOutputRange) {
|
|
50
|
+
if (parsedTranslate.length !== firstValueLength) {
|
|
51
|
+
throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${parsedTranslate.length}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return new Array(firstValueLength)
|
|
55
|
+
.fill(true)
|
|
56
|
+
.map((_, index) => {
|
|
57
|
+
const outputValues = [];
|
|
58
|
+
for (const translateValue of parsedOutputRange) {
|
|
59
|
+
const value = translateValue[index];
|
|
60
|
+
if (value === undefined) {
|
|
61
|
+
throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${translateValue.length}`);
|
|
62
|
+
}
|
|
63
|
+
outputValues.push(value);
|
|
64
|
+
}
|
|
65
|
+
const interpolatedValue = (0, interpolate_js_1.interpolate)(input, inputRange, outputValues, options);
|
|
66
|
+
return `${interpolatedValue}px`;
|
|
67
|
+
})
|
|
68
|
+
.join(' ');
|
|
69
|
+
};
|
|
70
|
+
exports.interpolateTranslate = interpolateTranslate;
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
export type HiddenFieldSchema = {
|
|
2
|
+
type: 'hidden';
|
|
3
|
+
keyframable?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type NumberFieldSchema = {
|
|
6
|
+
type: 'number';
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
default: number | null | undefined;
|
|
11
|
+
description?: string;
|
|
12
|
+
hiddenFromList: boolean;
|
|
13
|
+
keyframable?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type BooleanFieldSchema = {
|
|
16
|
+
type: 'boolean';
|
|
17
|
+
default: boolean;
|
|
18
|
+
description?: string;
|
|
19
|
+
keyframable?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type RotationCssFieldSchema = {
|
|
22
|
+
type: 'rotation-css';
|
|
23
|
+
step?: number;
|
|
24
|
+
default: string | undefined;
|
|
25
|
+
description?: string;
|
|
26
|
+
keyframable?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type RotationDegreesFieldSchema = {
|
|
29
|
+
type: 'rotation-degrees';
|
|
30
|
+
min?: number;
|
|
31
|
+
max?: number;
|
|
32
|
+
step?: number;
|
|
33
|
+
default: number | undefined;
|
|
34
|
+
description?: string;
|
|
35
|
+
keyframable?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type TranslateFieldSchema = {
|
|
38
|
+
type: 'translate';
|
|
39
|
+
step?: number;
|
|
40
|
+
default: string | undefined;
|
|
41
|
+
description?: string;
|
|
42
|
+
keyframable?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export type TransformOriginFieldSchema = {
|
|
45
|
+
type: 'transform-origin';
|
|
46
|
+
step?: number;
|
|
47
|
+
default: string | undefined;
|
|
48
|
+
description?: string;
|
|
49
|
+
keyframable?: boolean;
|
|
50
|
+
};
|
|
51
|
+
export type ScaleFieldSchema = {
|
|
52
|
+
type: 'scale';
|
|
53
|
+
min?: number;
|
|
54
|
+
max?: number;
|
|
55
|
+
step?: number;
|
|
56
|
+
default: number | string | undefined;
|
|
57
|
+
description?: string;
|
|
58
|
+
keyframable?: boolean;
|
|
59
|
+
};
|
|
60
|
+
export type UvCoordinateFieldSchema = {
|
|
61
|
+
type: 'uv-coordinate';
|
|
62
|
+
min?: number;
|
|
63
|
+
max?: number;
|
|
64
|
+
step?: number;
|
|
65
|
+
lineTo?: string;
|
|
66
|
+
default: readonly [number, number] | undefined;
|
|
67
|
+
description?: string;
|
|
68
|
+
keyframable?: boolean;
|
|
69
|
+
};
|
|
70
|
+
export type ColorFieldSchema = {
|
|
71
|
+
type: 'color';
|
|
72
|
+
default: string | undefined;
|
|
73
|
+
description?: string;
|
|
74
|
+
keyframable?: boolean;
|
|
75
|
+
};
|
|
76
|
+
export type EnumFieldSchema = {
|
|
77
|
+
type: 'enum';
|
|
78
|
+
default: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
variants: Record<string, SequenceSchema>;
|
|
81
|
+
keyframable?: boolean;
|
|
82
|
+
};
|
|
83
|
+
export type NumberArrayItemSchema = Omit<NumberFieldSchema, 'default' | 'description' | 'hiddenFromList' | 'keyframable'>;
|
|
84
|
+
export type BooleanArrayItemSchema = Omit<BooleanFieldSchema, 'default' | 'description' | 'keyframable'>;
|
|
85
|
+
export type RotationCssArrayItemSchema = Omit<RotationCssFieldSchema, 'default' | 'description' | 'keyframable'>;
|
|
86
|
+
export type RotationDegreesArrayItemSchema = Omit<RotationDegreesFieldSchema, 'default' | 'description' | 'keyframable'>;
|
|
87
|
+
export type TranslateArrayItemSchema = Omit<TranslateFieldSchema, 'default' | 'description' | 'keyframable'>;
|
|
88
|
+
export type UvCoordinateArrayItemSchema = Omit<UvCoordinateFieldSchema, 'default' | 'description' | 'keyframable'>;
|
|
89
|
+
export type ColorArrayItemSchema = Omit<ColorFieldSchema, 'default' | 'description' | 'keyframable'>;
|
|
90
|
+
export type EnumArrayItemSchema = {
|
|
91
|
+
type: 'enum';
|
|
92
|
+
variants: readonly string[];
|
|
93
|
+
};
|
|
94
|
+
export type ArrayItemFieldSchema = NumberArrayItemSchema | BooleanArrayItemSchema | RotationCssArrayItemSchema | RotationDegreesArrayItemSchema | TranslateArrayItemSchema | UvCoordinateArrayItemSchema | ColorArrayItemSchema | EnumArrayItemSchema;
|
|
95
|
+
export type ArrayFieldSchema = {
|
|
96
|
+
type: 'array';
|
|
97
|
+
item: ArrayItemFieldSchema;
|
|
98
|
+
default: readonly unknown[] | undefined;
|
|
99
|
+
minLength?: number;
|
|
100
|
+
maxLength?: number;
|
|
101
|
+
newItemDefault: unknown;
|
|
102
|
+
description?: string;
|
|
103
|
+
keyframable?: false;
|
|
104
|
+
};
|
|
105
|
+
export type VisibleFieldSchema = NumberFieldSchema | BooleanFieldSchema | RotationCssFieldSchema | RotationDegreesFieldSchema | TranslateFieldSchema | TransformOriginFieldSchema | ScaleFieldSchema | UvCoordinateFieldSchema | ColorFieldSchema | ArrayFieldSchema | EnumFieldSchema;
|
|
106
|
+
export type SequenceFieldSchema = VisibleFieldSchema | HiddenFieldSchema;
|
|
107
|
+
export type SequenceSchema = {
|
|
108
|
+
[key: string]: SequenceFieldSchema;
|
|
109
|
+
};
|
|
110
|
+
export type SchemaKeysRecord<S extends SequenceSchema> = Record<keyof S, unknown>;
|
|
111
|
+
export declare const sequenceVisualStyleSchema: {
|
|
112
|
+
readonly 'style.transformOrigin': {
|
|
113
|
+
readonly type: "transform-origin";
|
|
114
|
+
readonly step: 1;
|
|
115
|
+
readonly default: "50% 50%";
|
|
116
|
+
readonly description: "Transform origin";
|
|
117
|
+
};
|
|
118
|
+
readonly 'style.translate': {
|
|
119
|
+
readonly type: "translate";
|
|
120
|
+
readonly step: 1;
|
|
121
|
+
readonly default: "0px 0px";
|
|
122
|
+
readonly description: "Offset";
|
|
123
|
+
};
|
|
124
|
+
readonly 'style.scale': {
|
|
125
|
+
readonly type: "scale";
|
|
126
|
+
readonly max: 100;
|
|
127
|
+
readonly step: 0.01;
|
|
128
|
+
readonly default: 1;
|
|
129
|
+
readonly description: "Scale";
|
|
130
|
+
};
|
|
131
|
+
readonly 'style.rotate': {
|
|
132
|
+
readonly type: "rotation-css";
|
|
133
|
+
readonly step: 1;
|
|
134
|
+
readonly default: "0deg";
|
|
135
|
+
readonly description: "Rotation";
|
|
136
|
+
};
|
|
137
|
+
readonly 'style.opacity': {
|
|
138
|
+
readonly type: "number";
|
|
139
|
+
readonly min: 0;
|
|
140
|
+
readonly max: 1;
|
|
141
|
+
readonly step: 0.01;
|
|
142
|
+
readonly default: 1;
|
|
143
|
+
readonly description: "Opacity";
|
|
144
|
+
readonly hiddenFromList: false;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export declare const sequencePremountSchema: {
|
|
148
|
+
readonly premountFor: {
|
|
149
|
+
readonly type: "number";
|
|
150
|
+
readonly default: 0;
|
|
151
|
+
readonly description: "Premount For";
|
|
152
|
+
readonly min: 0;
|
|
153
|
+
readonly step: 1;
|
|
154
|
+
readonly hiddenFromList: false;
|
|
155
|
+
};
|
|
156
|
+
readonly postmountFor: {
|
|
157
|
+
readonly type: "number";
|
|
158
|
+
readonly default: 0;
|
|
159
|
+
readonly min: 0;
|
|
160
|
+
readonly step: 1;
|
|
161
|
+
readonly hiddenFromList: true;
|
|
162
|
+
};
|
|
163
|
+
readonly styleWhilePremounted: {
|
|
164
|
+
readonly type: "hidden";
|
|
165
|
+
};
|
|
166
|
+
readonly styleWhilePostmounted: {
|
|
167
|
+
readonly type: "hidden";
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
export declare const sequenceStyleSchema: {
|
|
171
|
+
readonly 'style.transformOrigin': {
|
|
172
|
+
readonly type: "transform-origin";
|
|
173
|
+
readonly step: 1;
|
|
174
|
+
readonly default: "50% 50%";
|
|
175
|
+
readonly description: "Transform origin";
|
|
176
|
+
};
|
|
177
|
+
readonly 'style.translate': {
|
|
178
|
+
readonly type: "translate";
|
|
179
|
+
readonly step: 1;
|
|
180
|
+
readonly default: "0px 0px";
|
|
181
|
+
readonly description: "Offset";
|
|
182
|
+
};
|
|
183
|
+
readonly 'style.scale': {
|
|
184
|
+
readonly type: "scale";
|
|
185
|
+
readonly max: 100;
|
|
186
|
+
readonly step: 0.01;
|
|
187
|
+
readonly default: 1;
|
|
188
|
+
readonly description: "Scale";
|
|
189
|
+
};
|
|
190
|
+
readonly 'style.rotate': {
|
|
191
|
+
readonly type: "rotation-css";
|
|
192
|
+
readonly step: 1;
|
|
193
|
+
readonly default: "0deg";
|
|
194
|
+
readonly description: "Rotation";
|
|
195
|
+
};
|
|
196
|
+
readonly 'style.opacity': {
|
|
197
|
+
readonly type: "number";
|
|
198
|
+
readonly min: 0;
|
|
199
|
+
readonly max: 1;
|
|
200
|
+
readonly step: 0.01;
|
|
201
|
+
readonly default: 1;
|
|
202
|
+
readonly description: "Opacity";
|
|
203
|
+
readonly hiddenFromList: false;
|
|
204
|
+
};
|
|
205
|
+
readonly premountFor: {
|
|
206
|
+
readonly type: "number";
|
|
207
|
+
readonly default: 0;
|
|
208
|
+
readonly description: "Premount For";
|
|
209
|
+
readonly min: 0;
|
|
210
|
+
readonly step: 1;
|
|
211
|
+
readonly hiddenFromList: false;
|
|
212
|
+
};
|
|
213
|
+
readonly postmountFor: {
|
|
214
|
+
readonly type: "number";
|
|
215
|
+
readonly default: 0;
|
|
216
|
+
readonly min: 0;
|
|
217
|
+
readonly step: 1;
|
|
218
|
+
readonly hiddenFromList: true;
|
|
219
|
+
};
|
|
220
|
+
readonly styleWhilePremounted: {
|
|
221
|
+
readonly type: "hidden";
|
|
222
|
+
};
|
|
223
|
+
readonly styleWhilePostmounted: {
|
|
224
|
+
readonly type: "hidden";
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
export declare const hiddenField: SequenceFieldSchema;
|
|
228
|
+
export declare const sequenceNameField: SequenceFieldSchema;
|
|
229
|
+
export declare const extendSchemaWithSequenceName: <S extends SequenceSchema>(schema: S) => S & {
|
|
230
|
+
name: SequenceFieldSchema;
|
|
231
|
+
};
|
|
232
|
+
export declare const durationInFramesField: {
|
|
233
|
+
readonly type: "number";
|
|
234
|
+
readonly default: undefined;
|
|
235
|
+
readonly min: 1;
|
|
236
|
+
readonly step: 1;
|
|
237
|
+
readonly hiddenFromList: true;
|
|
238
|
+
};
|
|
239
|
+
export declare const fromField: {
|
|
240
|
+
readonly type: "number";
|
|
241
|
+
readonly default: 0;
|
|
242
|
+
readonly step: 1;
|
|
243
|
+
readonly hiddenFromList: true;
|
|
244
|
+
};
|
|
245
|
+
export declare const freezeField: {
|
|
246
|
+
readonly type: "number";
|
|
247
|
+
readonly default: null;
|
|
248
|
+
readonly step: 1;
|
|
249
|
+
readonly hiddenFromList: true;
|
|
250
|
+
};
|
|
251
|
+
export declare const sequenceSchema: {
|
|
252
|
+
readonly hidden: BooleanFieldSchema;
|
|
253
|
+
readonly showInTimeline: HiddenFieldSchema;
|
|
254
|
+
readonly from: {
|
|
255
|
+
readonly type: "number";
|
|
256
|
+
readonly default: 0;
|
|
257
|
+
readonly step: 1;
|
|
258
|
+
readonly hiddenFromList: true;
|
|
259
|
+
};
|
|
260
|
+
readonly freeze: {
|
|
261
|
+
readonly type: "number";
|
|
262
|
+
readonly default: null;
|
|
263
|
+
readonly step: 1;
|
|
264
|
+
readonly hiddenFromList: true;
|
|
265
|
+
};
|
|
266
|
+
readonly durationInFrames: {
|
|
267
|
+
readonly type: "number";
|
|
268
|
+
readonly default: undefined;
|
|
269
|
+
readonly min: 1;
|
|
270
|
+
readonly step: 1;
|
|
271
|
+
readonly hiddenFromList: true;
|
|
272
|
+
};
|
|
273
|
+
readonly layout: {
|
|
274
|
+
readonly type: "enum";
|
|
275
|
+
readonly default: "absolute-fill";
|
|
276
|
+
readonly description: "Layout";
|
|
277
|
+
readonly variants: {
|
|
278
|
+
readonly 'absolute-fill': {
|
|
279
|
+
readonly 'style.transformOrigin': {
|
|
280
|
+
readonly type: "transform-origin";
|
|
281
|
+
readonly step: 1;
|
|
282
|
+
readonly default: "50% 50%";
|
|
283
|
+
readonly description: "Transform origin";
|
|
284
|
+
};
|
|
285
|
+
readonly 'style.translate': {
|
|
286
|
+
readonly type: "translate";
|
|
287
|
+
readonly step: 1;
|
|
288
|
+
readonly default: "0px 0px";
|
|
289
|
+
readonly description: "Offset";
|
|
290
|
+
};
|
|
291
|
+
readonly 'style.scale': {
|
|
292
|
+
readonly type: "scale";
|
|
293
|
+
readonly max: 100;
|
|
294
|
+
readonly step: 0.01;
|
|
295
|
+
readonly default: 1;
|
|
296
|
+
readonly description: "Scale";
|
|
297
|
+
};
|
|
298
|
+
readonly 'style.rotate': {
|
|
299
|
+
readonly type: "rotation-css";
|
|
300
|
+
readonly step: 1;
|
|
301
|
+
readonly default: "0deg";
|
|
302
|
+
readonly description: "Rotation";
|
|
303
|
+
};
|
|
304
|
+
readonly 'style.opacity': {
|
|
305
|
+
readonly type: "number";
|
|
306
|
+
readonly min: 0;
|
|
307
|
+
readonly max: 1;
|
|
308
|
+
readonly step: 0.01;
|
|
309
|
+
readonly default: 1;
|
|
310
|
+
readonly description: "Opacity";
|
|
311
|
+
readonly hiddenFromList: false;
|
|
312
|
+
};
|
|
313
|
+
readonly premountFor: {
|
|
314
|
+
readonly type: "number";
|
|
315
|
+
readonly default: 0;
|
|
316
|
+
readonly description: "Premount For";
|
|
317
|
+
readonly min: 0;
|
|
318
|
+
readonly step: 1;
|
|
319
|
+
readonly hiddenFromList: false;
|
|
320
|
+
};
|
|
321
|
+
readonly postmountFor: {
|
|
322
|
+
readonly type: "number";
|
|
323
|
+
readonly default: 0;
|
|
324
|
+
readonly min: 0;
|
|
325
|
+
readonly step: 1;
|
|
326
|
+
readonly hiddenFromList: true;
|
|
327
|
+
};
|
|
328
|
+
readonly styleWhilePremounted: {
|
|
329
|
+
readonly type: "hidden";
|
|
330
|
+
};
|
|
331
|
+
readonly styleWhilePostmounted: {
|
|
332
|
+
readonly type: "hidden";
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
readonly none: {};
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
} & {
|
|
339
|
+
name: SequenceFieldSchema;
|
|
340
|
+
};
|
|
341
|
+
export declare const sequenceSchemaWithoutFrom: {
|
|
342
|
+
readonly hidden: BooleanFieldSchema;
|
|
343
|
+
readonly showInTimeline: HiddenFieldSchema;
|
|
344
|
+
readonly freeze: {
|
|
345
|
+
readonly type: "number";
|
|
346
|
+
readonly default: null;
|
|
347
|
+
readonly step: 1;
|
|
348
|
+
readonly hiddenFromList: true;
|
|
349
|
+
};
|
|
350
|
+
readonly durationInFrames: {
|
|
351
|
+
readonly type: "number";
|
|
352
|
+
readonly default: undefined;
|
|
353
|
+
readonly min: 1;
|
|
354
|
+
readonly step: 1;
|
|
355
|
+
readonly hiddenFromList: true;
|
|
356
|
+
};
|
|
357
|
+
readonly layout: {
|
|
358
|
+
readonly type: "enum";
|
|
359
|
+
readonly default: "absolute-fill";
|
|
360
|
+
readonly description: "Layout";
|
|
361
|
+
readonly variants: {
|
|
362
|
+
readonly 'absolute-fill': {
|
|
363
|
+
readonly 'style.transformOrigin': {
|
|
364
|
+
readonly type: "transform-origin";
|
|
365
|
+
readonly step: 1;
|
|
366
|
+
readonly default: "50% 50%";
|
|
367
|
+
readonly description: "Transform origin";
|
|
368
|
+
};
|
|
369
|
+
readonly 'style.translate': {
|
|
370
|
+
readonly type: "translate";
|
|
371
|
+
readonly step: 1;
|
|
372
|
+
readonly default: "0px 0px";
|
|
373
|
+
readonly description: "Offset";
|
|
374
|
+
};
|
|
375
|
+
readonly 'style.scale': {
|
|
376
|
+
readonly type: "scale";
|
|
377
|
+
readonly max: 100;
|
|
378
|
+
readonly step: 0.01;
|
|
379
|
+
readonly default: 1;
|
|
380
|
+
readonly description: "Scale";
|
|
381
|
+
};
|
|
382
|
+
readonly 'style.rotate': {
|
|
383
|
+
readonly type: "rotation-css";
|
|
384
|
+
readonly step: 1;
|
|
385
|
+
readonly default: "0deg";
|
|
386
|
+
readonly description: "Rotation";
|
|
387
|
+
};
|
|
388
|
+
readonly 'style.opacity': {
|
|
389
|
+
readonly type: "number";
|
|
390
|
+
readonly min: 0;
|
|
391
|
+
readonly max: 1;
|
|
392
|
+
readonly step: 0.01;
|
|
393
|
+
readonly default: 1;
|
|
394
|
+
readonly description: "Opacity";
|
|
395
|
+
readonly hiddenFromList: false;
|
|
396
|
+
};
|
|
397
|
+
readonly premountFor: {
|
|
398
|
+
readonly type: "number";
|
|
399
|
+
readonly default: 0;
|
|
400
|
+
readonly description: "Premount For";
|
|
401
|
+
readonly min: 0;
|
|
402
|
+
readonly step: 1;
|
|
403
|
+
readonly hiddenFromList: false;
|
|
404
|
+
};
|
|
405
|
+
readonly postmountFor: {
|
|
406
|
+
readonly type: "number";
|
|
407
|
+
readonly default: 0;
|
|
408
|
+
readonly min: 0;
|
|
409
|
+
readonly step: 1;
|
|
410
|
+
readonly hiddenFromList: true;
|
|
411
|
+
};
|
|
412
|
+
readonly styleWhilePremounted: {
|
|
413
|
+
readonly type: "hidden";
|
|
414
|
+
};
|
|
415
|
+
readonly styleWhilePostmounted: {
|
|
416
|
+
readonly type: "hidden";
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
readonly none: {};
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
} & {
|
|
423
|
+
name: SequenceFieldSchema;
|
|
424
|
+
};
|
|
425
|
+
export declare const sequenceSchemaDefaultLayoutNone: SequenceSchema;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sequenceSchemaDefaultLayoutNone = exports.sequenceSchemaWithoutFrom = exports.sequenceSchema = exports.freezeField = exports.fromField = exports.durationInFramesField = exports.extendSchemaWithSequenceName = exports.sequenceNameField = exports.hiddenField = exports.sequenceStyleSchema = exports.sequencePremountSchema = exports.sequenceVisualStyleSchema = void 0;
|
|
4
|
+
exports.sequenceVisualStyleSchema = {
|
|
5
|
+
'style.transformOrigin': {
|
|
6
|
+
type: 'transform-origin',
|
|
7
|
+
step: 1,
|
|
8
|
+
default: '50% 50%',
|
|
9
|
+
description: 'Transform origin',
|
|
10
|
+
},
|
|
11
|
+
'style.translate': {
|
|
12
|
+
type: 'translate',
|
|
13
|
+
step: 1,
|
|
14
|
+
default: '0px 0px',
|
|
15
|
+
description: 'Offset',
|
|
16
|
+
},
|
|
17
|
+
'style.scale': {
|
|
18
|
+
type: 'scale',
|
|
19
|
+
max: 100,
|
|
20
|
+
step: 0.01,
|
|
21
|
+
default: 1,
|
|
22
|
+
description: 'Scale',
|
|
23
|
+
},
|
|
24
|
+
'style.rotate': {
|
|
25
|
+
type: 'rotation-css',
|
|
26
|
+
step: 1,
|
|
27
|
+
default: '0deg',
|
|
28
|
+
description: 'Rotation',
|
|
29
|
+
},
|
|
30
|
+
'style.opacity': {
|
|
31
|
+
type: 'number',
|
|
32
|
+
min: 0,
|
|
33
|
+
max: 1,
|
|
34
|
+
step: 0.01,
|
|
35
|
+
default: 1,
|
|
36
|
+
description: 'Opacity',
|
|
37
|
+
hiddenFromList: false,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
exports.sequencePremountSchema = {
|
|
41
|
+
premountFor: {
|
|
42
|
+
type: 'number',
|
|
43
|
+
default: 0,
|
|
44
|
+
description: 'Premount For',
|
|
45
|
+
min: 0,
|
|
46
|
+
step: 1,
|
|
47
|
+
hiddenFromList: false,
|
|
48
|
+
},
|
|
49
|
+
postmountFor: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
default: 0,
|
|
52
|
+
min: 0,
|
|
53
|
+
step: 1,
|
|
54
|
+
hiddenFromList: true,
|
|
55
|
+
},
|
|
56
|
+
styleWhilePremounted: {
|
|
57
|
+
type: 'hidden',
|
|
58
|
+
},
|
|
59
|
+
styleWhilePostmounted: {
|
|
60
|
+
type: 'hidden',
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
exports.sequenceStyleSchema = {
|
|
64
|
+
...exports.sequenceVisualStyleSchema,
|
|
65
|
+
...exports.sequencePremountSchema,
|
|
66
|
+
};
|
|
67
|
+
exports.hiddenField = {
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
default: false,
|
|
70
|
+
description: 'Hidden',
|
|
71
|
+
};
|
|
72
|
+
const showInTimelineField = {
|
|
73
|
+
type: 'hidden',
|
|
74
|
+
};
|
|
75
|
+
exports.sequenceNameField = {
|
|
76
|
+
type: 'hidden',
|
|
77
|
+
};
|
|
78
|
+
const extendSchemaWithSequenceName = (schema) => {
|
|
79
|
+
return {
|
|
80
|
+
name: exports.sequenceNameField,
|
|
81
|
+
...schema,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
exports.extendSchemaWithSequenceName = extendSchemaWithSequenceName;
|
|
85
|
+
exports.durationInFramesField = {
|
|
86
|
+
type: 'number',
|
|
87
|
+
default: undefined,
|
|
88
|
+
min: 1,
|
|
89
|
+
step: 1,
|
|
90
|
+
hiddenFromList: true,
|
|
91
|
+
};
|
|
92
|
+
exports.fromField = {
|
|
93
|
+
type: 'number',
|
|
94
|
+
default: 0,
|
|
95
|
+
step: 1,
|
|
96
|
+
hiddenFromList: true,
|
|
97
|
+
};
|
|
98
|
+
exports.freezeField = {
|
|
99
|
+
type: 'number',
|
|
100
|
+
default: null,
|
|
101
|
+
step: 1,
|
|
102
|
+
hiddenFromList: true,
|
|
103
|
+
};
|
|
104
|
+
exports.sequenceSchema = (0, exports.extendSchemaWithSequenceName)({
|
|
105
|
+
hidden: exports.hiddenField,
|
|
106
|
+
showInTimeline: showInTimelineField,
|
|
107
|
+
from: exports.fromField,
|
|
108
|
+
freeze: exports.freezeField,
|
|
109
|
+
durationInFrames: exports.durationInFramesField,
|
|
110
|
+
layout: {
|
|
111
|
+
type: 'enum',
|
|
112
|
+
default: 'absolute-fill',
|
|
113
|
+
description: 'Layout',
|
|
114
|
+
variants: {
|
|
115
|
+
'absolute-fill': exports.sequenceStyleSchema,
|
|
116
|
+
none: {},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
exports.sequenceSchemaWithoutFrom = (0, exports.extendSchemaWithSequenceName)({
|
|
121
|
+
hidden: exports.hiddenField,
|
|
122
|
+
showInTimeline: showInTimelineField,
|
|
123
|
+
freeze: exports.freezeField,
|
|
124
|
+
durationInFrames: exports.durationInFramesField,
|
|
125
|
+
layout: exports.sequenceSchema.layout,
|
|
126
|
+
});
|
|
127
|
+
exports.sequenceSchemaDefaultLayoutNone = {
|
|
128
|
+
...exports.sequenceSchema,
|
|
129
|
+
layout: {
|
|
130
|
+
...exports.sequenceSchema.layout,
|
|
131
|
+
default: 'none',
|
|
132
|
+
},
|
|
133
|
+
};
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -47,6 +47,7 @@ const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
|
47
47
|
const use_current_frame_js_1 = require("./use-current-frame.js");
|
|
48
48
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
49
49
|
const use_schema_js_1 = require("./use-schema.js");
|
|
50
|
+
const use_unsafe_video_config_js_1 = require("./use-unsafe-video-config.js");
|
|
50
51
|
const getNestedValue = (obj, key) => {
|
|
51
52
|
const parts = key.split('.');
|
|
52
53
|
let current = obj;
|
|
@@ -156,6 +157,24 @@ const withInteractivitySchema = ({ Component, componentName, componentIdentity,
|
|
|
156
157
|
const nodePathMapping = (0, react_1.useContext)(sequence_node_path_js_1.OverrideIdsToNodePathsGettersContext);
|
|
157
158
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
158
159
|
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
160
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
161
|
+
const videoConfig = (0, use_unsafe_video_config_js_1.useUnsafeVideoConfig)();
|
|
162
|
+
const durationInFrames = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames;
|
|
163
|
+
const fps = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.fps;
|
|
164
|
+
const height = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.height;
|
|
165
|
+
const width = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.width;
|
|
166
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
167
|
+
const videoConfigValues = (0, react_1.useMemo)(() => durationInFrames === undefined ||
|
|
168
|
+
fps === undefined ||
|
|
169
|
+
height === undefined ||
|
|
170
|
+
width === undefined
|
|
171
|
+
? null
|
|
172
|
+
: {
|
|
173
|
+
durationInFrames,
|
|
174
|
+
fps,
|
|
175
|
+
height,
|
|
176
|
+
width,
|
|
177
|
+
}, [durationInFrames, fps, height, width]);
|
|
159
178
|
// If the parent has passed `controls`, we should not override it.
|
|
160
179
|
// @ts-expect-error
|
|
161
180
|
if (cleanProps.controls) {
|
|
@@ -212,12 +231,18 @@ const withInteractivitySchema = ({ Component, componentName, componentIdentity,
|
|
|
212
231
|
schema: schemaWithSequenceName,
|
|
213
232
|
currentRuntimeValueDotNotation,
|
|
214
233
|
runtimeValues: runtimeValueStore.store,
|
|
234
|
+
videoConfigValues,
|
|
215
235
|
overrideId,
|
|
216
236
|
supportsEffects,
|
|
217
237
|
componentIdentity,
|
|
218
238
|
componentName,
|
|
219
239
|
};
|
|
220
|
-
}, [
|
|
240
|
+
}, [
|
|
241
|
+
currentRuntimeValueDotNotation,
|
|
242
|
+
overrideId,
|
|
243
|
+
runtimeValueStore.store,
|
|
244
|
+
videoConfigValues,
|
|
245
|
+
]);
|
|
221
246
|
(0, enable_sequence_stack_traces_js_1.setStackForControls)(controls, internalStack);
|
|
222
247
|
// 3. Apply drag/code overrides on top of the runtime values.
|
|
223
248
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SequenceControls } from './CompositionManager.js';
|
|
3
|
+
import { type SequenceSchema } from './sequence-field-schema.js';
|
|
4
|
+
export declare const getNestedValue: (obj: Record<string, unknown>, key: string) => unknown;
|
|
5
|
+
export declare const readValuesFromProps: (props: Record<string, unknown>, keys: string[]) => Record<string, unknown>;
|
|
6
|
+
export declare const selectActiveKeys: (schema: SequenceSchema, values: Record<string, unknown>) => string[];
|
|
7
|
+
export declare const mergeValues: ({ props, valuesDotNotation, schemaKeys, propsToDelete, }: {
|
|
8
|
+
props: Record<string, unknown>;
|
|
9
|
+
valuesDotNotation: Record<string, unknown>;
|
|
10
|
+
schemaKeys: string[];
|
|
11
|
+
propsToDelete: Set<string>;
|
|
12
|
+
}) => Record<string, unknown>;
|
|
13
|
+
export declare const wrapInSchema: <S extends SequenceSchema, Props extends object>({ Component, componentIdentity, schema, supportsEffects, }: {
|
|
14
|
+
Component: React.ComponentType<Props & {
|
|
15
|
+
readonly _experimentalControls: SequenceControls | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
componentIdentity: string | null;
|
|
18
|
+
schema: S;
|
|
19
|
+
supportsEffects: boolean;
|
|
20
|
+
}) => React.ComponentType<Props>;
|
|
@@ -0,0 +1,203 @@
|
|
|
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.wrapInSchema = exports.mergeValues = exports.selectActiveKeys = exports.readValuesFromProps = exports.getNestedValue = void 0;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const delete_nested_key_js_1 = require("./delete-nested-key.js");
|
|
39
|
+
const use_memoized_effects_js_1 = require("./effects/use-memoized-effects.js");
|
|
40
|
+
const flatten_schema_js_1 = require("./flatten-schema.js");
|
|
41
|
+
const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
|
|
42
|
+
const sequence_node_path_js_1 = require("./sequence-node-path.js");
|
|
43
|
+
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
44
|
+
const use_current_frame_js_1 = require("./use-current-frame.js");
|
|
45
|
+
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
46
|
+
const use_schema_js_1 = require("./use-schema.js");
|
|
47
|
+
const getNestedValue = (obj, key) => {
|
|
48
|
+
const parts = key.split('.');
|
|
49
|
+
let current = obj;
|
|
50
|
+
for (const part of parts) {
|
|
51
|
+
if (current === null ||
|
|
52
|
+
current === undefined ||
|
|
53
|
+
typeof current !== 'object')
|
|
54
|
+
return undefined;
|
|
55
|
+
current = current[part];
|
|
56
|
+
}
|
|
57
|
+
return current;
|
|
58
|
+
};
|
|
59
|
+
exports.getNestedValue = getNestedValue;
|
|
60
|
+
const readValuesFromProps = (props, keys) => {
|
|
61
|
+
const out = {};
|
|
62
|
+
for (const key of keys) {
|
|
63
|
+
out[key] = (0, exports.getNestedValue)(props, key);
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
};
|
|
67
|
+
exports.readValuesFromProps = readValuesFromProps;
|
|
68
|
+
const selectActiveKeys = (schema, values) => {
|
|
69
|
+
return Object.keys((0, flatten_schema_js_1.flattenActiveSchema)(schema, (key) => values[key]));
|
|
70
|
+
};
|
|
71
|
+
exports.selectActiveKeys = selectActiveKeys;
|
|
72
|
+
const mergeValues = ({ props, valuesDotNotation, schemaKeys, propsToDelete, }) => {
|
|
73
|
+
const merged = { ...props };
|
|
74
|
+
for (const key of schemaKeys) {
|
|
75
|
+
const value = valuesDotNotation[key];
|
|
76
|
+
const parts = key.split('.');
|
|
77
|
+
if (parts.length === 1) {
|
|
78
|
+
merged[key] = value;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
// For dot-notation keys like 'style.opacity',
|
|
82
|
+
// clone and set the nested path
|
|
83
|
+
let current = merged;
|
|
84
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
85
|
+
const part = parts[i];
|
|
86
|
+
if (typeof current[part] === 'object' && current[part] !== null) {
|
|
87
|
+
current[part] = { ...current[part] };
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
current[part] = {};
|
|
91
|
+
}
|
|
92
|
+
current = current[part];
|
|
93
|
+
}
|
|
94
|
+
current[parts[parts.length - 1]] = value;
|
|
95
|
+
}
|
|
96
|
+
(0, delete_nested_key_js_1.deleteNestedKey)(merged, propsToDelete);
|
|
97
|
+
return merged;
|
|
98
|
+
};
|
|
99
|
+
exports.mergeValues = mergeValues;
|
|
100
|
+
const stackToOverrideMap = {};
|
|
101
|
+
const wrapInSchema = ({ Component, componentIdentity, schema, supportsEffects, }) => {
|
|
102
|
+
// Schema is static for a component, so we move this outside
|
|
103
|
+
const schemaWithSequenceName = (0, sequence_field_schema_js_1.extendSchemaWithSequenceName)(schema);
|
|
104
|
+
const flatSchema = (0, flatten_schema_js_1.getFlatSchemaWithAllKeys)(schemaWithSequenceName);
|
|
105
|
+
const flatKeys = Object.keys(flatSchema);
|
|
106
|
+
const Wrapped = (0, react_1.forwardRef)((props, ref) => {
|
|
107
|
+
var _a;
|
|
108
|
+
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
109
|
+
if (!env.isStudio || env.isReadOnlyStudio || env.isRendering) {
|
|
110
|
+
return react_1.default.createElement(Component, {
|
|
111
|
+
...props,
|
|
112
|
+
_experimentalControls: null,
|
|
113
|
+
ref,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
117
|
+
const { propStatuses } = (0, react_1.useContext)(SequenceManager_js_1.VisualModePropStatusesContext);
|
|
118
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
119
|
+
const { getDragOverrides } = (0, react_1.useContext)(SequenceManager_js_1.VisualModeDragOverridesContext);
|
|
120
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
121
|
+
const nodePathMapping = (0, react_1.useContext)(sequence_node_path_js_1.OverrideIdsToNodePathsGettersContext);
|
|
122
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
123
|
+
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
124
|
+
// If the parent has passed `_experimentalControls`, we should not override it.
|
|
125
|
+
// @ts-expect-error
|
|
126
|
+
if (props._experimentalControls) {
|
|
127
|
+
return react_1.default.createElement(Component, {
|
|
128
|
+
...props,
|
|
129
|
+
ref,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
133
|
+
const [overrideId] = (0, react_1.useState)(() => {
|
|
134
|
+
const { stack } = props;
|
|
135
|
+
if (!stack) {
|
|
136
|
+
return String(Math.random());
|
|
137
|
+
}
|
|
138
|
+
const existingOverrideId = stackToOverrideMap[stack];
|
|
139
|
+
if (existingOverrideId) {
|
|
140
|
+
return existingOverrideId;
|
|
141
|
+
}
|
|
142
|
+
const newOverrideId = String(Math.random());
|
|
143
|
+
stackToOverrideMap[stack] = newOverrideId;
|
|
144
|
+
return newOverrideId;
|
|
145
|
+
});
|
|
146
|
+
const nodePath = (_a = nodePathMapping.overrideIdToNodePathMappings[overrideId]) !== null && _a !== void 0 ? _a : null;
|
|
147
|
+
// Read the runtime values for every flat key from the JSX props,
|
|
148
|
+
// memoized on the leaf values so the object reference is stable
|
|
149
|
+
// when nothing changed — otherwise downstream `useMemo`s churn and
|
|
150
|
+
// effects (e.g. Sequence registration) re-fire every render.
|
|
151
|
+
const runtimeValues = flatKeys.map((k) => (0, exports.getNestedValue)(props, k));
|
|
152
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
153
|
+
const currentRuntimeValueDotNotation = (0, react_1.useMemo)(() => (0, exports.readValuesFromProps)(props, flatKeys),
|
|
154
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
155
|
+
runtimeValues);
|
|
156
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
157
|
+
const controls = (0, react_1.useMemo)(() => {
|
|
158
|
+
return {
|
|
159
|
+
schema: schemaWithSequenceName,
|
|
160
|
+
currentRuntimeValueDotNotation,
|
|
161
|
+
overrideId,
|
|
162
|
+
supportsEffects,
|
|
163
|
+
componentIdentity,
|
|
164
|
+
};
|
|
165
|
+
}, [currentRuntimeValueDotNotation, overrideId]);
|
|
166
|
+
// 3. Apply drag/code overrides on top of the runtime values.
|
|
167
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
168
|
+
const { merged: valuesDotNotation, propsToDelete } = (0, react_1.useMemo)(() => {
|
|
169
|
+
return (0, use_schema_js_1.computeEffectiveSchemaValuesDotNotation)({
|
|
170
|
+
schema: schemaWithSequenceName,
|
|
171
|
+
currentValue: currentRuntimeValueDotNotation,
|
|
172
|
+
overrideValues: nodePath === null ? {} : getDragOverrides(nodePath),
|
|
173
|
+
propStatus: nodePath === null
|
|
174
|
+
? undefined
|
|
175
|
+
: (0, use_memoized_effects_js_1.getPropStatusesCtx)(propStatuses, nodePath),
|
|
176
|
+
frame,
|
|
177
|
+
});
|
|
178
|
+
}, [
|
|
179
|
+
currentRuntimeValueDotNotation,
|
|
180
|
+
getDragOverrides,
|
|
181
|
+
nodePath,
|
|
182
|
+
propStatuses,
|
|
183
|
+
frame,
|
|
184
|
+
]);
|
|
185
|
+
// 4. Eliminate values forbidden by the resolved discriminated union.
|
|
186
|
+
const activeKeys = (0, exports.selectActiveKeys)(schemaWithSequenceName, valuesDotNotation);
|
|
187
|
+
// 5. Apply the active values back onto the props.
|
|
188
|
+
const mergedProps = (0, exports.mergeValues)({
|
|
189
|
+
props: props,
|
|
190
|
+
valuesDotNotation,
|
|
191
|
+
schemaKeys: activeKeys,
|
|
192
|
+
propsToDelete,
|
|
193
|
+
});
|
|
194
|
+
return react_1.default.createElement(Component, {
|
|
195
|
+
...mergedProps,
|
|
196
|
+
_experimentalControls: controls,
|
|
197
|
+
ref,
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
Wrapped.displayName = `wrapInSchema(${Component.displayName || Component.name || 'Component'})`;
|
|
201
|
+
return Wrapped;
|
|
202
|
+
};
|
|
203
|
+
exports.wrapInSchema = wrapInSchema;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1537,7 +1537,7 @@ var Composition = (props) => {
|
|
|
1537
1537
|
};
|
|
1538
1538
|
|
|
1539
1539
|
// src/version.ts
|
|
1540
|
-
var VERSION = "4.0.
|
|
1540
|
+
var VERSION = "4.0.522";
|
|
1541
1541
|
|
|
1542
1542
|
// src/multiple-versions-warning.ts
|
|
1543
1543
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -5242,6 +5242,17 @@ var withInteractivitySchema = ({
|
|
|
5242
5242
|
const { getDragOverrides } = useContext19(VisualModeDragOverridesContext);
|
|
5243
5243
|
const nodePathMapping = useContext19(OverrideIdsToNodePathsGettersContext);
|
|
5244
5244
|
const frame = useCurrentFrame();
|
|
5245
|
+
const videoConfig = useUnsafeVideoConfig();
|
|
5246
|
+
const durationInFrames = videoConfig?.durationInFrames;
|
|
5247
|
+
const fps = videoConfig?.fps;
|
|
5248
|
+
const height = videoConfig?.height;
|
|
5249
|
+
const width = videoConfig?.width;
|
|
5250
|
+
const videoConfigValues = useMemo12(() => durationInFrames === undefined || fps === undefined || height === undefined || width === undefined ? null : {
|
|
5251
|
+
durationInFrames,
|
|
5252
|
+
fps,
|
|
5253
|
+
height,
|
|
5254
|
+
width
|
|
5255
|
+
}, [durationInFrames, fps, height, width]);
|
|
5245
5256
|
if (cleanProps.controls) {
|
|
5246
5257
|
const passedControls = cleanProps.controls;
|
|
5247
5258
|
if (getStackForControls(passedControls) === null) {
|
|
@@ -5280,12 +5291,18 @@ var withInteractivitySchema = ({
|
|
|
5280
5291
|
schema: schemaWithSequenceName,
|
|
5281
5292
|
currentRuntimeValueDotNotation,
|
|
5282
5293
|
runtimeValues: runtimeValueStore.store,
|
|
5294
|
+
videoConfigValues,
|
|
5283
5295
|
overrideId,
|
|
5284
5296
|
supportsEffects,
|
|
5285
5297
|
componentIdentity,
|
|
5286
5298
|
componentName
|
|
5287
5299
|
};
|
|
5288
|
-
}, [
|
|
5300
|
+
}, [
|
|
5301
|
+
currentRuntimeValueDotNotation,
|
|
5302
|
+
overrideId,
|
|
5303
|
+
runtimeValueStore.store,
|
|
5304
|
+
videoConfigValues
|
|
5305
|
+
]);
|
|
5289
5306
|
setStackForControls(controls, internalStack);
|
|
5290
5307
|
const { merged: valuesDotNotation, propsToDelete } = useMemo12(() => {
|
|
5291
5308
|
return computeEffectiveSchemaValuesDotNotation({
|
|
@@ -5478,9 +5495,10 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5478
5495
|
const controlsSupportsEffects = controls?.supportsEffects;
|
|
5479
5496
|
const controlsComponentIdentity = controls?.componentIdentity;
|
|
5480
5497
|
const controlsComponentName = controls?.componentName;
|
|
5498
|
+
const controlsVideoConfigValues = controls?.videoConfigValues;
|
|
5481
5499
|
const effectRuntimeValues = useMemo13(() => _remotionInternalEffects?.runtimeValues ?? null, [_remotionInternalEffects]);
|
|
5482
5500
|
const registrationControls = useMemo13(() => {
|
|
5483
|
-
if (controlsSchema === undefined || controlsRuntimeValues === undefined || controlsOverrideId === undefined || controlsSupportsEffects === undefined || controlsComponentIdentity === undefined || controlsComponentName === undefined) {
|
|
5501
|
+
if (controlsSchema === undefined || controlsRuntimeValues === undefined || controlsOverrideId === undefined || controlsSupportsEffects === undefined || controlsComponentIdentity === undefined || controlsComponentName === undefined || controlsVideoConfigValues === undefined) {
|
|
5484
5502
|
return null;
|
|
5485
5503
|
}
|
|
5486
5504
|
return {
|
|
@@ -5489,11 +5507,13 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5489
5507
|
overrideId: controlsOverrideId,
|
|
5490
5508
|
supportsEffects: controlsSupportsEffects,
|
|
5491
5509
|
componentIdentity: controlsComponentIdentity,
|
|
5492
|
-
componentName: controlsComponentName
|
|
5510
|
+
componentName: controlsComponentName,
|
|
5511
|
+
videoConfigValues: controlsVideoConfigValues
|
|
5493
5512
|
};
|
|
5494
5513
|
}, [
|
|
5495
5514
|
controlsComponentIdentity,
|
|
5496
5515
|
controlsComponentName,
|
|
5516
|
+
controlsVideoConfigValues,
|
|
5497
5517
|
controlsOverrideId,
|
|
5498
5518
|
controlsRuntimeValues,
|
|
5499
5519
|
controlsSchema,
|
package/dist/esm/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
|
|
4
4
|
},
|
|
5
5
|
"name": "remotion",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.522",
|
|
7
7
|
"description": "Make videos programmatically",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"react-dom": "19.2.3",
|
|
36
36
|
"webpack": "5.105.0",
|
|
37
37
|
"zod": "4.5.4",
|
|
38
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
38
|
+
"@remotion/eslint-config-internal": "4.0.522",
|
|
39
39
|
"eslint": "9.19.0",
|
|
40
40
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
41
41
|
},
|