@remotion/studio 4.0.424 → 4.0.426
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/api/create-composition.d.ts +1 -2
- package/dist/api/helpers/calc-new-props.d.ts +1 -2
- package/dist/components/AssetSelector.js +1 -1
- package/dist/components/AssetSelectorItem.d.ts +1 -0
- package/dist/components/AssetSelectorItem.js +9 -8
- package/dist/components/InitialCompositionLoader.js +13 -1
- package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
- package/dist/components/NewComposition/CodemodFooter.js +3 -1
- package/dist/components/NewComposition/DeleteComposition.js +1 -1
- package/dist/components/NewComposition/DuplicateComposition.js +5 -1
- package/dist/components/NewComposition/RenameComposition.js +1 -1
- package/dist/components/RenderModal/DataEditor.d.ts +2 -1
- package/dist/components/RenderModal/DataEditor.js +6 -6
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +4 -3
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +18 -18
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -10
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -12
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +4 -3
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +49 -21
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +4 -9
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +0 -10
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +38 -33
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.js +11 -15
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +108 -110
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +72 -87
- package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/local-state.js +5 -4
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +176 -0
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +330 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tabs/vertical.js +2 -0
- package/dist/components/TimeValue.js +0 -2
- package/dist/components/Timeline/TimelineDragHandler.js +6 -0
- package/dist/components/get-zod-if-possible.d.ts +3 -0
- package/dist/components/get-zod-if-possible.js +23 -2
- package/dist/esm/{chunk-3g77e2p9.js → chunk-kde77jse.js} +589 -373
- package/dist/esm/index.mjs +170 -81
- package/dist/esm/internals.mjs +589 -373
- package/dist/esm/previewEntry.mjs +598 -375
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/inject-css.js +2 -1
- package/dist/index.d.ts +2 -2
- package/dist/previewEntry.d.ts +5 -0
- package/dist/previewEntry.js +11 -2
- package/dist/visual-controls/VisualControls.d.ts +4 -4
- package/dist/visual-controls/VisualControls.js +1 -1
- package/package.json +11 -11
package/dist/esm/index.mjs
CHANGED
|
@@ -201,6 +201,110 @@ var restartStudio = () => {
|
|
|
201
201
|
// src/api/save-default-props.ts
|
|
202
202
|
import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
|
|
203
203
|
|
|
204
|
+
// src/components/RenderModal/SchemaEditor/zod-schema-type.ts
|
|
205
|
+
var getZodDef = (schema) => {
|
|
206
|
+
if (schema._def)
|
|
207
|
+
return schema._def;
|
|
208
|
+
if (schema._zod)
|
|
209
|
+
return schema._zod.def;
|
|
210
|
+
throw new Error("Invalid zod schema: missing _def and _zod");
|
|
211
|
+
};
|
|
212
|
+
var v3TypeNameMap = {
|
|
213
|
+
ZodString: "string",
|
|
214
|
+
ZodNumber: "number",
|
|
215
|
+
ZodBoolean: "boolean",
|
|
216
|
+
ZodObject: "object",
|
|
217
|
+
ZodArray: "array",
|
|
218
|
+
ZodEnum: "enum",
|
|
219
|
+
ZodUnion: "union",
|
|
220
|
+
ZodDiscriminatedUnion: "discriminatedUnion",
|
|
221
|
+
ZodOptional: "optional",
|
|
222
|
+
ZodNullable: "nullable",
|
|
223
|
+
ZodDefault: "default",
|
|
224
|
+
ZodTuple: "tuple",
|
|
225
|
+
ZodDate: "date",
|
|
226
|
+
ZodAny: "any",
|
|
227
|
+
ZodUnknown: "unknown",
|
|
228
|
+
ZodBigInt: "bigint",
|
|
229
|
+
ZodNull: "null",
|
|
230
|
+
ZodUndefined: "undefined",
|
|
231
|
+
ZodEffects: "effects",
|
|
232
|
+
ZodLiteral: "literal",
|
|
233
|
+
ZodRecord: "record",
|
|
234
|
+
ZodNever: "never",
|
|
235
|
+
ZodVoid: "void",
|
|
236
|
+
ZodNaN: "nan",
|
|
237
|
+
ZodSymbol: "symbol",
|
|
238
|
+
ZodIntersection: "intersection",
|
|
239
|
+
ZodMap: "map",
|
|
240
|
+
ZodSet: "set",
|
|
241
|
+
ZodLazy: "lazy",
|
|
242
|
+
ZodFunction: "function",
|
|
243
|
+
ZodNativeEnum: "nativeEnum",
|
|
244
|
+
ZodCatch: "catch",
|
|
245
|
+
ZodPromise: "promise",
|
|
246
|
+
ZodBranded: "branded",
|
|
247
|
+
ZodPipeline: "pipeline"
|
|
248
|
+
};
|
|
249
|
+
var isZodV3Schema = (schema) => {
|
|
250
|
+
const def = getZodDef(schema);
|
|
251
|
+
return "typeName" in def;
|
|
252
|
+
};
|
|
253
|
+
var getZodSchemaType = (schema) => {
|
|
254
|
+
const def = getZodDef(schema);
|
|
255
|
+
if ("typeName" in def) {
|
|
256
|
+
const { typeName } = def;
|
|
257
|
+
return v3TypeNameMap[typeName] ?? typeName;
|
|
258
|
+
}
|
|
259
|
+
const { type } = def;
|
|
260
|
+
if (type === "union" && def.discriminator !== undefined) {
|
|
261
|
+
return "discriminatedUnion";
|
|
262
|
+
}
|
|
263
|
+
return type;
|
|
264
|
+
};
|
|
265
|
+
var getZodSchemaDescription = (schema) => {
|
|
266
|
+
if (isZodV3Schema(schema)) {
|
|
267
|
+
return getZodDef(schema).description;
|
|
268
|
+
}
|
|
269
|
+
return schema.description;
|
|
270
|
+
};
|
|
271
|
+
var getObjectShape = (schema) => {
|
|
272
|
+
const { shape } = getZodDef(schema);
|
|
273
|
+
return typeof shape === "function" ? shape() : shape;
|
|
274
|
+
};
|
|
275
|
+
var getArrayElement = (schema) => {
|
|
276
|
+
const def = getZodDef(schema);
|
|
277
|
+
return isZodV3Schema(schema) ? def.type : def.element;
|
|
278
|
+
};
|
|
279
|
+
var getInnerType = (schema) => {
|
|
280
|
+
return getZodDef(schema).innerType;
|
|
281
|
+
};
|
|
282
|
+
var getEffectsInner = (schema) => {
|
|
283
|
+
return getZodDef(schema).schema;
|
|
284
|
+
};
|
|
285
|
+
var getUnionOptions = (schema) => {
|
|
286
|
+
return getZodDef(schema).options;
|
|
287
|
+
};
|
|
288
|
+
var getIntersectionSchemas = (schema) => {
|
|
289
|
+
const def = getZodDef(schema);
|
|
290
|
+
return { left: def.left, right: def.right };
|
|
291
|
+
};
|
|
292
|
+
var getTupleItems = (schema) => {
|
|
293
|
+
return getZodDef(schema).items;
|
|
294
|
+
};
|
|
295
|
+
var getRecordValueType = (schema) => {
|
|
296
|
+
return getZodDef(schema).valueType;
|
|
297
|
+
};
|
|
298
|
+
var getRecordKeyType = (schema) => {
|
|
299
|
+
return getZodDef(schema).keyType;
|
|
300
|
+
};
|
|
301
|
+
var getPipelineOutput = (schema) => {
|
|
302
|
+
return getZodDef(schema).out;
|
|
303
|
+
};
|
|
304
|
+
var getBrandedInner = (schema) => {
|
|
305
|
+
return isZodV3Schema(schema) ? getZodDef(schema).type : schema;
|
|
306
|
+
};
|
|
307
|
+
|
|
204
308
|
// src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
|
|
205
309
|
var extractEnumJsonPaths = ({
|
|
206
310
|
schema,
|
|
@@ -208,11 +312,14 @@ var extractEnumJsonPaths = ({
|
|
|
208
312
|
currentPath,
|
|
209
313
|
zodTypes
|
|
210
314
|
}) => {
|
|
211
|
-
const
|
|
212
|
-
|
|
315
|
+
const description = getZodSchemaDescription(schema);
|
|
316
|
+
if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
317
|
+
return [currentPath];
|
|
318
|
+
}
|
|
319
|
+
const typeName = getZodSchemaType(schema);
|
|
213
320
|
switch (typeName) {
|
|
214
|
-
case
|
|
215
|
-
const shape =
|
|
321
|
+
case "object": {
|
|
322
|
+
const shape = getObjectShape(schema);
|
|
216
323
|
const keys = Object.keys(shape);
|
|
217
324
|
return keys.map((key) => {
|
|
218
325
|
return extractEnumJsonPaths({
|
|
@@ -223,16 +330,16 @@ var extractEnumJsonPaths = ({
|
|
|
223
330
|
});
|
|
224
331
|
}).flat(1);
|
|
225
332
|
}
|
|
226
|
-
case
|
|
333
|
+
case "array": {
|
|
227
334
|
return extractEnumJsonPaths({
|
|
228
|
-
schema:
|
|
335
|
+
schema: getArrayElement(schema),
|
|
229
336
|
zodRuntime,
|
|
230
337
|
currentPath: [...currentPath, "[]"],
|
|
231
338
|
zodTypes
|
|
232
339
|
});
|
|
233
340
|
}
|
|
234
|
-
case
|
|
235
|
-
return
|
|
341
|
+
case "union": {
|
|
342
|
+
return getUnionOptions(schema).map((option) => {
|
|
236
343
|
return extractEnumJsonPaths({
|
|
237
344
|
schema: option,
|
|
238
345
|
zodRuntime,
|
|
@@ -241,8 +348,8 @@ var extractEnumJsonPaths = ({
|
|
|
241
348
|
});
|
|
242
349
|
}).flat(1);
|
|
243
350
|
}
|
|
244
|
-
case
|
|
245
|
-
return
|
|
351
|
+
case "discriminatedUnion": {
|
|
352
|
+
return getUnionOptions(schema).map((op) => {
|
|
246
353
|
return extractEnumJsonPaths({
|
|
247
354
|
schema: op,
|
|
248
355
|
zodRuntime,
|
|
@@ -251,22 +358,19 @@ var extractEnumJsonPaths = ({
|
|
|
251
358
|
});
|
|
252
359
|
}).flat(1);
|
|
253
360
|
}
|
|
254
|
-
case
|
|
361
|
+
case "literal": {
|
|
255
362
|
return [currentPath];
|
|
256
363
|
}
|
|
257
|
-
case
|
|
258
|
-
if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
259
|
-
return [currentPath];
|
|
260
|
-
}
|
|
364
|
+
case "effects": {
|
|
261
365
|
return extractEnumJsonPaths({
|
|
262
|
-
schema:
|
|
366
|
+
schema: getEffectsInner(schema),
|
|
263
367
|
zodRuntime,
|
|
264
368
|
currentPath,
|
|
265
369
|
zodTypes
|
|
266
370
|
});
|
|
267
371
|
}
|
|
268
|
-
case
|
|
269
|
-
const { left, right } =
|
|
372
|
+
case "intersection": {
|
|
373
|
+
const { left, right } = getIntersectionSchemas(schema);
|
|
270
374
|
const leftValue = extractEnumJsonPaths({
|
|
271
375
|
schema: left,
|
|
272
376
|
zodRuntime,
|
|
@@ -281,109 +385,94 @@ var extractEnumJsonPaths = ({
|
|
|
281
385
|
});
|
|
282
386
|
return [...leftValue, ...rightValue];
|
|
283
387
|
}
|
|
284
|
-
case
|
|
285
|
-
return
|
|
388
|
+
case "tuple": {
|
|
389
|
+
return getTupleItems(schema).map((item, i) => extractEnumJsonPaths({
|
|
286
390
|
schema: item,
|
|
287
391
|
zodRuntime,
|
|
288
392
|
currentPath: [...currentPath, i],
|
|
289
393
|
zodTypes
|
|
290
394
|
})).flat(1);
|
|
291
395
|
}
|
|
292
|
-
case
|
|
293
|
-
const
|
|
294
|
-
|
|
396
|
+
case "record": {
|
|
397
|
+
const recordPath = [...currentPath, "{}"];
|
|
398
|
+
const keyResults = extractEnumJsonPaths({
|
|
399
|
+
schema: getRecordKeyType(schema),
|
|
295
400
|
zodRuntime,
|
|
296
|
-
currentPath:
|
|
401
|
+
currentPath: recordPath,
|
|
297
402
|
zodTypes
|
|
298
403
|
});
|
|
299
|
-
|
|
404
|
+
const valueResults = extractEnumJsonPaths({
|
|
405
|
+
schema: getRecordValueType(schema),
|
|
406
|
+
zodRuntime,
|
|
407
|
+
currentPath: recordPath,
|
|
408
|
+
zodTypes
|
|
409
|
+
});
|
|
410
|
+
return [...keyResults, ...valueResults];
|
|
300
411
|
}
|
|
301
|
-
case
|
|
412
|
+
case "function": {
|
|
302
413
|
throw new Error("Cannot create a value for type function");
|
|
303
414
|
}
|
|
304
|
-
case
|
|
415
|
+
case "enum": {
|
|
305
416
|
return [currentPath];
|
|
306
417
|
}
|
|
307
|
-
case
|
|
418
|
+
case "nativeEnum": {
|
|
308
419
|
return [];
|
|
309
420
|
}
|
|
310
|
-
case
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
schema: defType.innerType,
|
|
314
|
-
zodRuntime,
|
|
315
|
-
currentPath,
|
|
316
|
-
zodTypes
|
|
317
|
-
});
|
|
318
|
-
return value;
|
|
319
|
-
}
|
|
320
|
-
case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
|
|
321
|
-
const defType = def;
|
|
322
|
-
const value = extractEnumJsonPaths({
|
|
323
|
-
schema: defType.innerType,
|
|
324
|
-
zodRuntime,
|
|
325
|
-
currentPath,
|
|
326
|
-
zodTypes
|
|
327
|
-
});
|
|
328
|
-
return value;
|
|
329
|
-
}
|
|
330
|
-
case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
|
|
331
|
-
const defType = def;
|
|
421
|
+
case "optional":
|
|
422
|
+
case "nullable":
|
|
423
|
+
case "catch": {
|
|
332
424
|
return extractEnumJsonPaths({
|
|
333
|
-
schema:
|
|
425
|
+
schema: getInnerType(schema),
|
|
334
426
|
zodRuntime,
|
|
335
427
|
currentPath,
|
|
336
428
|
zodTypes
|
|
337
429
|
});
|
|
338
430
|
}
|
|
339
|
-
case
|
|
340
|
-
const defType = def;
|
|
431
|
+
case "default": {
|
|
341
432
|
return extractEnumJsonPaths({
|
|
342
|
-
schema:
|
|
433
|
+
schema: getInnerType(schema),
|
|
343
434
|
zodRuntime,
|
|
344
435
|
currentPath,
|
|
345
436
|
zodTypes
|
|
346
437
|
});
|
|
347
438
|
}
|
|
348
|
-
case
|
|
439
|
+
case "promise": {
|
|
349
440
|
return [];
|
|
350
441
|
}
|
|
351
|
-
case
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
schema: defType.type,
|
|
442
|
+
case "branded": {
|
|
443
|
+
return extractEnumJsonPaths({
|
|
444
|
+
schema: getBrandedInner(schema),
|
|
355
445
|
zodRuntime,
|
|
356
446
|
currentPath,
|
|
357
447
|
zodTypes
|
|
358
448
|
});
|
|
359
|
-
return value;
|
|
360
449
|
}
|
|
361
|
-
case
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
schema:
|
|
450
|
+
case "pipeline":
|
|
451
|
+
case "pipe": {
|
|
452
|
+
return extractEnumJsonPaths({
|
|
453
|
+
schema: getPipelineOutput(schema),
|
|
365
454
|
zodRuntime,
|
|
366
455
|
currentPath,
|
|
367
456
|
zodTypes
|
|
368
457
|
});
|
|
369
|
-
return value;
|
|
370
458
|
}
|
|
371
|
-
case
|
|
372
|
-
case
|
|
373
|
-
case
|
|
374
|
-
case
|
|
375
|
-
case
|
|
376
|
-
case
|
|
377
|
-
case
|
|
378
|
-
case
|
|
379
|
-
case
|
|
380
|
-
case
|
|
381
|
-
case
|
|
382
|
-
case
|
|
383
|
-
case
|
|
384
|
-
case
|
|
385
|
-
case
|
|
386
|
-
case
|
|
459
|
+
case "string":
|
|
460
|
+
case "number":
|
|
461
|
+
case "bigint":
|
|
462
|
+
case "boolean":
|
|
463
|
+
case "nan":
|
|
464
|
+
case "date":
|
|
465
|
+
case "symbol":
|
|
466
|
+
case "undefined":
|
|
467
|
+
case "null":
|
|
468
|
+
case "any":
|
|
469
|
+
case "unknown":
|
|
470
|
+
case "never":
|
|
471
|
+
case "void":
|
|
472
|
+
case "map":
|
|
473
|
+
case "lazy":
|
|
474
|
+
case "set":
|
|
475
|
+
case "custom": {
|
|
387
476
|
return [];
|
|
388
477
|
}
|
|
389
478
|
default:
|