@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.
Files changed (88) hide show
  1. package/dist/api/create-composition.d.ts +1 -2
  2. package/dist/api/helpers/calc-new-props.d.ts +1 -2
  3. package/dist/components/AssetSelector.js +1 -1
  4. package/dist/components/AssetSelectorItem.d.ts +1 -0
  5. package/dist/components/AssetSelectorItem.js +9 -8
  6. package/dist/components/InitialCompositionLoader.js +13 -1
  7. package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
  8. package/dist/components/NewComposition/CodemodFooter.js +3 -1
  9. package/dist/components/NewComposition/DeleteComposition.js +1 -1
  10. package/dist/components/NewComposition/DuplicateComposition.js +5 -1
  11. package/dist/components/NewComposition/RenameComposition.js +1 -1
  12. package/dist/components/RenderModal/DataEditor.d.ts +2 -1
  13. package/dist/components/RenderModal/DataEditor.js +6 -6
  14. package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
  15. package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +3 -2
  16. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +3 -3
  17. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -5
  18. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -3
  19. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -0
  20. package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +2 -2
  21. package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +4 -3
  22. package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +2 -2
  23. package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +3 -6
  24. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +2 -1
  25. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
  26. package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -2
  27. package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -2
  28. package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -2
  29. package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +3 -3
  30. package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -1
  31. package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +2 -2
  32. package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +18 -18
  33. package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +2 -2
  34. package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -10
  35. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +2 -2
  36. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -12
  37. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +2 -2
  38. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +2 -2
  39. package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +4 -3
  40. package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +2 -2
  41. package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +3 -2
  42. package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +2 -2
  43. package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -1
  44. package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -2
  45. package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +49 -21
  46. package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +2 -2
  47. package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +4 -9
  48. package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +2 -2
  49. package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -1
  50. package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +3 -3
  51. package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +2 -2
  52. package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +0 -10
  53. package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -2
  54. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -2
  55. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +38 -33
  56. package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +2 -2
  57. package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.d.ts +2 -2
  58. package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +3 -6
  59. package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.d.ts +2 -1
  60. package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.js +2 -2
  61. package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +2 -2
  62. package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.js +11 -15
  63. package/dist/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
  64. package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +108 -110
  65. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -3
  66. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +72 -87
  67. package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +3 -3
  68. package/dist/components/RenderModal/SchemaEditor/local-state.js +5 -4
  69. package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +176 -0
  70. package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +330 -0
  71. package/dist/components/Tabs/index.js +2 -0
  72. package/dist/components/Tabs/vertical.js +2 -0
  73. package/dist/components/TimeValue.js +0 -2
  74. package/dist/components/Timeline/TimelineDragHandler.js +6 -0
  75. package/dist/components/get-zod-if-possible.d.ts +3 -0
  76. package/dist/components/get-zod-if-possible.js +23 -2
  77. package/dist/esm/{chunk-3g77e2p9.js → chunk-kde77jse.js} +589 -373
  78. package/dist/esm/index.mjs +170 -81
  79. package/dist/esm/internals.mjs +589 -373
  80. package/dist/esm/previewEntry.mjs +598 -375
  81. package/dist/esm/renderEntry.mjs +1 -1
  82. package/dist/helpers/inject-css.js +2 -1
  83. package/dist/index.d.ts +2 -2
  84. package/dist/previewEntry.d.ts +5 -0
  85. package/dist/previewEntry.js +11 -2
  86. package/dist/visual-controls/VisualControls.d.ts +4 -4
  87. package/dist/visual-controls/VisualControls.js +1 -1
  88. package/package.json +11 -11
@@ -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 def = schema._def;
212
- const typeName = def.typeName;
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 zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
215
- const shape = def.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 zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
333
+ case "array": {
227
334
  return extractEnumJsonPaths({
228
- schema: def.type,
335
+ schema: getArrayElement(schema),
229
336
  zodRuntime,
230
337
  currentPath: [...currentPath, "[]"],
231
338
  zodTypes
232
339
  });
233
340
  }
234
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
235
- return def.options.map((option) => {
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 zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
245
- return def.options.map((op) => {
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 zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
361
+ case "literal": {
255
362
  return [currentPath];
256
363
  }
257
- case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
258
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
259
- return [currentPath];
260
- }
364
+ case "effects": {
261
365
  return extractEnumJsonPaths({
262
- schema: def.schema,
366
+ schema: getEffectsInner(schema),
263
367
  zodRuntime,
264
368
  currentPath,
265
369
  zodTypes
266
370
  });
267
371
  }
268
- case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
269
- const { left, right } = def;
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 zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
285
- return def.items.map((item, i) => extractEnumJsonPaths({
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 zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
293
- const values = extractEnumJsonPaths({
294
- schema: def.valueType,
396
+ case "record": {
397
+ const recordPath = [...currentPath, "{}"];
398
+ const keyResults = extractEnumJsonPaths({
399
+ schema: getRecordKeyType(schema),
295
400
  zodRuntime,
296
- currentPath: [...currentPath, "{}"],
401
+ currentPath: recordPath,
297
402
  zodTypes
298
403
  });
299
- return values;
404
+ const valueResults = extractEnumJsonPaths({
405
+ schema: getRecordValueType(schema),
406
+ zodRuntime,
407
+ currentPath: recordPath,
408
+ zodTypes
409
+ });
410
+ return [...keyResults, ...valueResults];
300
411
  }
301
- case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
412
+ case "function": {
302
413
  throw new Error("Cannot create a value for type function");
303
414
  }
304
- case zodRuntime.ZodFirstPartyTypeKind.ZodEnum: {
415
+ case "enum": {
305
416
  return [currentPath];
306
417
  }
307
- case zodRuntime.ZodFirstPartyTypeKind.ZodNativeEnum: {
418
+ case "nativeEnum": {
308
419
  return [];
309
420
  }
310
- case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
311
- const defType = def;
312
- const value = extractEnumJsonPaths({
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: defType.innerType,
425
+ schema: getInnerType(schema),
334
426
  zodRuntime,
335
427
  currentPath,
336
428
  zodTypes
337
429
  });
338
430
  }
339
- case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
340
- const defType = def;
431
+ case "default": {
341
432
  return extractEnumJsonPaths({
342
- schema: defType.innerType,
433
+ schema: getInnerType(schema),
343
434
  zodRuntime,
344
435
  currentPath,
345
436
  zodTypes
346
437
  });
347
438
  }
348
- case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
439
+ case "promise": {
349
440
  return [];
350
441
  }
351
- case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
352
- const defType = def;
353
- const value = extractEnumJsonPaths({
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 zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
362
- const defType = def;
363
- const value = extractEnumJsonPaths({
364
- schema: defType.out,
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 zodRuntime.ZodFirstPartyTypeKind.ZodString:
372
- case zodRuntime.ZodFirstPartyTypeKind.ZodNumber:
373
- case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
374
- case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
375
- case zodRuntime.ZodFirstPartyTypeKind.ZodNaN:
376
- case zodRuntime.ZodFirstPartyTypeKind.ZodDate:
377
- case zodRuntime.ZodFirstPartyTypeKind.ZodSymbol:
378
- case zodRuntime.ZodFirstPartyTypeKind.ZodUndefined:
379
- case zodRuntime.ZodFirstPartyTypeKind.ZodNull:
380
- case zodRuntime.ZodFirstPartyTypeKind.ZodAny:
381
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnknown:
382
- case zodRuntime.ZodFirstPartyTypeKind.ZodNever:
383
- case zodRuntime.ZodFirstPartyTypeKind.ZodVoid:
384
- case zodRuntime.ZodFirstPartyTypeKind.ZodMap:
385
- case zodRuntime.ZodFirstPartyTypeKind.ZodLazy:
386
- case zodRuntime.ZodFirstPartyTypeKind.ZodSet: {
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: