@remotion/studio 4.0.291 → 4.0.292

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 (77) hide show
  1. package/.turbo/turbo-make.log +2 -2
  2. package/dist/api/get-zod-schema-from-primitive.js +6 -1
  3. package/dist/api/save-default-props.js +13 -1
  4. package/dist/api/update-default-props.js +1 -1
  5. package/dist/api/use-visual-control.js +1 -2
  6. package/dist/api/use-visual-controls.d.ts +7 -0
  7. package/dist/api/use-visual-controls.js +57 -0
  8. package/dist/api/visual-control.d.ts +2 -0
  9. package/dist/api/visual-control.js +11 -0
  10. package/dist/components/AskAiModal.d.ts +7 -0
  11. package/dist/components/AskAiModal.js +65 -0
  12. package/dist/components/Canvas.d.ts +0 -1
  13. package/dist/components/Canvas.js +2 -2
  14. package/dist/components/CanvasOrLoading.js +1 -1
  15. package/dist/components/EditorContexts.js +2 -1
  16. package/dist/components/GlobalKeybindings.js +14 -0
  17. package/dist/components/GlobalPropsEditorUpdateButton.js +6 -2
  18. package/dist/components/KeyboardShortcutsExplainer.js +1 -1
  19. package/dist/components/ModalContainer.d.ts +1 -0
  20. package/dist/components/ModalContainer.js +2 -2
  21. package/dist/components/ModalHeader.d.ts +1 -0
  22. package/dist/components/ModalHeader.js +2 -2
  23. package/dist/components/Modals.js +2 -1
  24. package/dist/components/OptionsPanel.d.ts +1 -1
  25. package/dist/components/OptionsPanel.js +12 -2
  26. package/dist/components/Preview.d.ts +0 -1
  27. package/dist/components/Preview.js +3 -5
  28. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +1 -1
  29. package/dist/components/RenderModal/DataEditor.js +11 -4
  30. package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +1 -1
  31. package/dist/components/RenderModal/SchemaEditor/Fieldset.d.ts +1 -0
  32. package/dist/components/RenderModal/SchemaEditor/Fieldset.js +5 -5
  33. package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +1 -1
  34. package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
  35. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +1 -0
  36. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
  37. package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +3 -6
  38. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +6 -0
  39. package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +9 -0
  40. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +7 -2
  41. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +96 -22
  42. package/dist/components/RenderQueue/actions.d.ts +5 -1
  43. package/dist/components/RenderQueue/actions.js +12 -5
  44. package/dist/components/Tabs/index.js +3 -1
  45. package/dist/components/Timeline/TimelineStack/get-stack.d.ts +1 -1
  46. package/dist/components/Timeline/TimelineStack/get-stack.js +4 -2
  47. package/dist/components/Timeline/TimelineStack/index.js +2 -8
  48. package/dist/components/VisualControls/ClickableFileName.d.ts +12 -2
  49. package/dist/components/VisualControls/ClickableFileName.js +17 -13
  50. package/dist/components/VisualControls/VisualControlHandle.d.ts +0 -2
  51. package/dist/components/VisualControls/VisualControlHandle.js +69 -7
  52. package/dist/components/VisualControls/VisualControlHandleHeader.d.ts +4 -0
  53. package/dist/components/VisualControls/VisualControlHandleHeader.js +9 -0
  54. package/dist/components/VisualControls/VisualControlsContent.js +40 -16
  55. package/dist/components/VisualControls/get-original-stack-trace.d.ts +2 -2
  56. package/dist/components/VisualControls/get-original-stack-trace.js +10 -2
  57. package/dist/esm/index.mjs +153 -29
  58. package/dist/esm/internals.mjs +4430 -3644
  59. package/dist/esm/previewEntry.mjs +4520 -3734
  60. package/dist/esm/renderEntry.mjs +4545 -3721
  61. package/dist/helpers/get-location-of-sequence.d.ts +1 -0
  62. package/dist/helpers/get-location-of-sequence.js +18 -1
  63. package/dist/helpers/open-in-editor.d.ts +2 -0
  64. package/dist/helpers/open-in-editor.js +11 -1
  65. package/dist/helpers/retry-payload.js +3 -3
  66. package/dist/helpers/use-menu-structure.js +16 -0
  67. package/dist/index.d.ts +1 -0
  68. package/dist/index.js +3 -1
  69. package/dist/renderEntry.js +5 -5
  70. package/dist/state/z-index.d.ts +1 -0
  71. package/dist/state/z-index.js +13 -5
  72. package/dist/visual-controls/VisualControls.d.ts +11 -18
  73. package/dist/visual-controls/VisualControls.js +69 -64
  74. package/dist/visual-controls/get-current-edited-value.d.ts +2 -3
  75. package/dist/visual-controls/get-current-edited-value.js +3 -3
  76. package/package.json +9 -9
  77. package/tsconfig.tsbuildinfo +0 -1
@@ -3,32 +3,94 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VisualControlHandle = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const remotion_1 = require("remotion");
7
+ const no_react_1 = require("remotion/no-react");
6
8
  const VisualControls_1 = require("../../visual-controls/VisualControls");
7
9
  const get_current_edited_value_1 = require("../../visual-controls/get-current-edited-value");
10
+ const NotificationCenter_1 = require("../Notifications/NotificationCenter");
8
11
  const ZodSwitch_1 = require("../RenderModal/SchemaEditor/ZodSwitch");
12
+ const extract_enum_json_paths_1 = require("../RenderModal/SchemaEditor/extract-enum-json-paths");
9
13
  const local_state_1 = require("../RenderModal/SchemaEditor/local-state");
14
+ const actions_1 = require("../RenderQueue/actions");
10
15
  const get_zod_if_possible_1 = require("../get-zod-if-possible");
11
- const container = {
12
- marginBottom: 10,
13
- };
14
- const VisualControlHandle = ({ value, keyName, hook }) => {
16
+ const layout_1 = require("../layout");
17
+ const VisualControlHandleHeader_1 = require("./VisualControlHandleHeader");
18
+ const get_original_stack_trace_1 = require("./get-original-stack-trace");
19
+ const VisualControlHandle = ({ value, keyName }) => {
15
20
  const z = (0, get_zod_if_possible_1.useZodIfPossible)();
16
21
  if (!z) {
17
22
  throw new Error('expected zod');
18
23
  }
24
+ const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
19
25
  const state = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
20
26
  const { updateValue } = (0, react_1.useContext)(VisualControls_1.SetVisualControlsContext);
27
+ const { fastRefreshes } = (0, react_1.useContext)(remotion_1.Internals.NonceContext);
28
+ const { increaseManualRefreshes } = (0, react_1.useContext)(remotion_1.Internals.SetNonceContext);
29
+ const [saving, setSaving] = (0, react_1.useState)(false);
21
30
  const currentValue = (0, get_current_edited_value_1.getVisualControlEditedValue)({
22
31
  handles: state.handles,
23
- hook,
24
32
  key: keyName,
25
33
  });
34
+ const originalFileName = (0, get_original_stack_trace_1.useOriginalFileName)(value.stack);
26
35
  const { localValue, RevisionContextProvider, onChange } = (0, local_state_1.useLocalState)({
27
36
  schema: value.schema,
28
- setValue: (updater) => updateValue(hook, keyName, updater(currentValue)),
37
+ setValue: (updater) => {
38
+ updateValue(keyName, updater(currentValue));
39
+ increaseManualRefreshes();
40
+ },
29
41
  unsavedValue: currentValue,
30
42
  savedValue: value.valueInCode,
31
43
  });
32
- return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsx)(RevisionContextProvider, { children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { mayPad: true, schema: value.schema, showSaveButton: true, saving: false, saveDisabledByParent: false, onSave: () => undefined, jsonPath: [keyName], value: localValue.value, defaultValue: value.valueInCode, setValue: onChange, onRemove: null }) }) }));
44
+ const disableSave = window.remotion_isReadOnlyStudio || originalFileName.type !== 'loaded';
45
+ const onSave = (0, react_1.useCallback)((updater) => {
46
+ if (disableSave) {
47
+ return;
48
+ }
49
+ if (originalFileName.type !== 'loaded') {
50
+ throw new Error('Original file name is not loaded');
51
+ }
52
+ const val = updater(value.valueInCode);
53
+ window.remotion_ignoreFastRefreshUpdate = fastRefreshes + 1;
54
+ const enumPaths = (0, extract_enum_json_paths_1.extractEnumJsonPaths)({
55
+ schema: value.schema,
56
+ zodRuntime: z,
57
+ currentPath: [],
58
+ zodTypes,
59
+ });
60
+ setSaving(true);
61
+ Promise.resolve()
62
+ .then(() => {
63
+ return (0, actions_1.applyVisualControlChange)({
64
+ fileName: originalFileName.originalFileName.source,
65
+ changes: [
66
+ {
67
+ id: keyName,
68
+ newValueSerialized: no_react_1.NoReactInternals.serializeJSONWithSpecialTypes({
69
+ data: val,
70
+ indent: 2,
71
+ staticBase: window.remotion_staticBase,
72
+ }).serializedString,
73
+ enumPaths,
74
+ },
75
+ ],
76
+ });
77
+ })
78
+ .catch((e) => {
79
+ (0, NotificationCenter_1.showNotification)(`Could not save visual control: ${e.message}`, 3000);
80
+ });
81
+ }, [
82
+ disableSave,
83
+ value.valueInCode,
84
+ value.schema,
85
+ fastRefreshes,
86
+ z,
87
+ originalFileName,
88
+ keyName,
89
+ zodTypes,
90
+ ]);
91
+ (0, react_1.useEffect)(() => {
92
+ setSaving(false);
93
+ }, [fastRefreshes]);
94
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(VisualControlHandleHeader_1.VisualControlHandleHeader, { originalFileName: originalFileName }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsx)(RevisionContextProvider, { children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { mayPad: true, schema: value.schema, showSaveButton: !disableSave, saving: saving, saveDisabledByParent: false, onSave: onSave, jsonPath: [keyName], value: localValue.value, defaultValue: value.valueInCode, setValue: onChange, onRemove: null }) })] }));
33
95
  };
34
96
  exports.VisualControlHandle = VisualControlHandle;
@@ -0,0 +1,4 @@
1
+ import type { OriginalFileNameState } from './ClickableFileName';
2
+ export declare const VisualControlHandleHeader: React.FC<{
3
+ readonly originalFileName: OriginalFileNameState;
4
+ }>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VisualControlHandleHeader = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const ClickableFileName_1 = require("./ClickableFileName");
6
+ const VisualControlHandleHeader = ({ originalFileName }) => {
7
+ return (0, jsx_runtime_1.jsx)(ClickableFileName_1.ClickableFileName, { originalFileName: originalFileName });
8
+ };
9
+ exports.VisualControlHandleHeader = VisualControlHandleHeader;
@@ -1,29 +1,53 @@
1
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.VisualControlsContent = void 0;
4
37
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
38
+ const react_1 = __importStar(require("react"));
6
39
  const VisualControls_1 = require("../../visual-controls/VisualControls");
7
- const layout_1 = require("../layout");
8
40
  const is_menu_item_1 = require("../Menu/is-menu-item");
9
- const ClickableFileName_1 = require("./ClickableFileName");
41
+ const SchemaSeparationLine_1 = require("../RenderModal/SchemaEditor/SchemaSeparationLine");
10
42
  const VisualControlHandle_1 = require("./VisualControlHandle");
11
- const Control = ({ hook }) => {
12
- const { handles } = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
13
- const handle = handles[hook.id];
14
- if (!handle) {
15
- return null;
16
- }
17
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(ClickableFileName_1.ClickableFileName, { stack: hook.stack }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 1 }), Object.entries(handle).map(([key, value]) => {
18
- return ((0, jsx_runtime_1.jsx)(VisualControlHandle_1.VisualControlHandle, { keyName: key, value: value, hook: hook }, key));
19
- })] }, hook.id));
20
- };
21
43
  const container = {
22
- padding: 12,
23
44
  overflowY: 'auto',
24
45
  };
25
46
  const VisualControlsContent = () => {
26
- const { hooks: controls } = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
27
- return ((0, jsx_runtime_1.jsx)("div", { style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: controls.map((hook) => ((0, jsx_runtime_1.jsx)(Control, { hook: hook }, hook.id))) }));
47
+ const { handles } = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
48
+ const entries = Object.entries(handles);
49
+ return ((0, jsx_runtime_1.jsx)("div", { style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: entries.map(([key, value], i) => {
50
+ return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(VisualControlHandle_1.VisualControlHandle, { keyName: key, value: value }), i === entries.length - 1 ? null : (0, jsx_runtime_1.jsx)(SchemaSeparationLine_1.SchemaSeparationLine, {})] }, key));
51
+ }) }));
28
52
  };
29
53
  exports.VisualControlsContent = VisualControlsContent;
@@ -1,2 +1,2 @@
1
- import type { OriginalPosition } from '../../error-overlay/react-overlay/utils/get-source-map';
2
- export declare const useOriginalFileName: (stack: string) => OriginalPosition | null;
1
+ import type { OriginalFileNameState } from './ClickableFileName';
2
+ export declare const useOriginalFileName: (stack: string) => OriginalFileNameState;
@@ -4,14 +4,22 @@ exports.useOriginalFileName = void 0;
4
4
  const react_1 = require("react");
5
5
  const get_stack_1 = require("../Timeline/TimelineStack/get-stack");
6
6
  const useOriginalFileName = (stack) => {
7
- const [originalFileName, setOriginalFileName] = (0, react_1.useState)(null);
7
+ const [originalFileName, setOriginalFileName] = (0, react_1.useState)({ type: 'loading' });
8
8
  (0, react_1.useEffect)(() => {
9
9
  if (!stack) {
10
10
  return;
11
11
  }
12
12
  (0, get_stack_1.getOriginalLocationFromStack)(stack, 'visual-control')
13
13
  .then((frame) => {
14
- setOriginalFileName(frame);
14
+ if (frame === null) {
15
+ setOriginalFileName({
16
+ type: 'error',
17
+ error: new Error('No frame found'),
18
+ });
19
+ }
20
+ else {
21
+ setOriginalFileName({ type: 'loaded', originalFileName: frame });
22
+ }
15
23
  })
16
24
  .catch((err) => {
17
25
  // eslint-disable-next-line no-console
@@ -202,7 +202,12 @@ var restartStudio = () => {
202
202
  import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
203
203
 
204
204
  // src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
205
- var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
205
+ var extractEnumJsonPaths = ({
206
+ schema,
207
+ zodRuntime,
208
+ currentPath,
209
+ zodTypes
210
+ }) => {
206
211
  const def = schema._def;
207
212
  const typeName = def.typeName;
208
213
  switch (typeName) {
@@ -210,45 +215,87 @@ var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
210
215
  const shape = def.shape();
211
216
  const keys = Object.keys(shape);
212
217
  return keys.map((key) => {
213
- return extractEnumJsonPaths(shape[key], zodRuntime, [
214
- ...currentPath,
215
- key
216
- ]);
218
+ return extractEnumJsonPaths({
219
+ schema: shape[key],
220
+ zodRuntime,
221
+ currentPath: [...currentPath, key],
222
+ zodTypes
223
+ });
217
224
  }).flat(1);
218
225
  }
219
226
  case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
220
- return extractEnumJsonPaths(def.type, zodRuntime, [
221
- ...currentPath,
222
- "[]"
223
- ]);
227
+ return extractEnumJsonPaths({
228
+ schema: def.type,
229
+ zodRuntime,
230
+ currentPath: [...currentPath, "[]"],
231
+ zodTypes
232
+ });
224
233
  }
225
234
  case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
226
235
  return def.options.map((option) => {
227
- return extractEnumJsonPaths(option, zodRuntime, currentPath);
236
+ return extractEnumJsonPaths({
237
+ schema: option,
238
+ zodRuntime,
239
+ currentPath,
240
+ zodTypes
241
+ });
228
242
  }).flat(1);
229
243
  }
230
244
  case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
231
245
  return def.options.map((op) => {
232
- return extractEnumJsonPaths(op, zodRuntime, currentPath);
246
+ return extractEnumJsonPaths({
247
+ schema: op,
248
+ zodRuntime,
249
+ currentPath,
250
+ zodTypes
251
+ });
233
252
  }).flat(1);
234
253
  }
235
254
  case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
236
255
  return [currentPath];
237
256
  }
238
257
  case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
239
- return extractEnumJsonPaths(def.schema, zodRuntime, currentPath);
258
+ if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
259
+ return [currentPath];
260
+ }
261
+ return extractEnumJsonPaths({
262
+ schema: def.schema,
263
+ zodRuntime,
264
+ currentPath,
265
+ zodTypes
266
+ });
240
267
  }
241
268
  case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
242
269
  const { left, right } = def;
243
- const leftValue = extractEnumJsonPaths(left, zodRuntime, currentPath);
244
- const rightValue = extractEnumJsonPaths(right, zodRuntime, currentPath);
270
+ const leftValue = extractEnumJsonPaths({
271
+ schema: left,
272
+ zodRuntime,
273
+ currentPath,
274
+ zodTypes
275
+ });
276
+ const rightValue = extractEnumJsonPaths({
277
+ schema: right,
278
+ zodRuntime,
279
+ currentPath,
280
+ zodTypes
281
+ });
245
282
  return [...leftValue, ...rightValue];
246
283
  }
247
284
  case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
248
- return def.items.map((item, i) => extractEnumJsonPaths(item, zodRuntime, [...currentPath, i])).flat(1);
285
+ return def.items.map((item, i) => extractEnumJsonPaths({
286
+ schema: item,
287
+ zodRuntime,
288
+ currentPath: [...currentPath, i],
289
+ zodTypes
290
+ })).flat(1);
249
291
  }
250
292
  case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
251
- const values = extractEnumJsonPaths(def.valueType, zodRuntime, [...currentPath, "{}"]);
293
+ const values = extractEnumJsonPaths({
294
+ schema: def.valueType,
295
+ zodRuntime,
296
+ currentPath: [...currentPath, "{}"],
297
+ zodTypes
298
+ });
252
299
  return values;
253
300
  }
254
301
  case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
@@ -262,33 +309,63 @@ var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
262
309
  }
263
310
  case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
264
311
  const defType = def;
265
- const value = extractEnumJsonPaths(defType.innerType, zodRuntime, currentPath);
312
+ const value = extractEnumJsonPaths({
313
+ schema: defType.innerType,
314
+ zodRuntime,
315
+ currentPath,
316
+ zodTypes
317
+ });
266
318
  return value;
267
319
  }
268
320
  case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
269
321
  const defType = def;
270
- const value = extractEnumJsonPaths(defType.innerType, zodRuntime, currentPath);
322
+ const value = extractEnumJsonPaths({
323
+ schema: defType.innerType,
324
+ zodRuntime,
325
+ currentPath,
326
+ zodTypes
327
+ });
271
328
  return value;
272
329
  }
273
330
  case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
274
331
  const defType = def;
275
- return extractEnumJsonPaths(defType.innerType, zodRuntime, currentPath);
332
+ return extractEnumJsonPaths({
333
+ schema: defType.innerType,
334
+ zodRuntime,
335
+ currentPath,
336
+ zodTypes
337
+ });
276
338
  }
277
339
  case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
278
340
  const defType = def;
279
- return extractEnumJsonPaths(defType.innerType, zodRuntime, currentPath);
341
+ return extractEnumJsonPaths({
342
+ schema: defType.innerType,
343
+ zodRuntime,
344
+ currentPath,
345
+ zodTypes
346
+ });
280
347
  }
281
348
  case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
282
349
  return [];
283
350
  }
284
351
  case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
285
352
  const defType = def;
286
- const value = extractEnumJsonPaths(defType.type, zodRuntime, currentPath);
353
+ const value = extractEnumJsonPaths({
354
+ schema: defType.type,
355
+ zodRuntime,
356
+ currentPath,
357
+ zodTypes
358
+ });
287
359
  return value;
288
360
  }
289
361
  case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
290
362
  const defType = def;
291
- const value = extractEnumJsonPaths(defType.out, zodRuntime, currentPath);
363
+ const value = extractEnumJsonPaths({
364
+ schema: defType.out,
365
+ zodRuntime,
366
+ currentPath,
367
+ zodTypes
368
+ });
292
369
  return value;
293
370
  }
294
371
  case zodRuntime.ZodFirstPartyTypeKind.ZodString:
@@ -319,7 +396,7 @@ import { NoReactInternals } from "remotion/no-react";
319
396
  var callUpdateDefaultPropsApi = (compositionId, defaultProps, enumPaths) => {
320
397
  return callApi("/api/update-default-props", {
321
398
  compositionId,
322
- defaultProps: NoReactInternals.serializeJSONWithDate({
399
+ defaultProps: NoReactInternals.serializeJSONWithSpecialTypes({
323
400
  data: defaultProps,
324
401
  indent: undefined,
325
402
  staticBase: window.remotion_staticBase
@@ -345,8 +422,17 @@ var saveDefaultProps = async ({
345
422
  throw new Error('"zod" is required to use saveDefaultProps(), but is not installed.');
346
423
  }
347
424
  const z = await import("zod");
425
+ let zodTypes = null;
426
+ try {
427
+ zodTypes = await import("@remotion/zod-types");
428
+ } catch {}
348
429
  const { generatedDefaultProps, composition } = calcNewProps(compositionId, defaultProps);
349
- const res = await callUpdateDefaultPropsApi(compositionId, generatedDefaultProps, composition.schema ? extractEnumJsonPaths(composition.schema, z, []) : []);
430
+ const res = await callUpdateDefaultPropsApi(compositionId, generatedDefaultProps, composition.schema ? extractEnumJsonPaths({
431
+ schema: composition.schema,
432
+ zodRuntime: z,
433
+ currentPath: [],
434
+ zodTypes
435
+ }) : []);
350
436
  if (res.success) {
351
437
  return Promise.resolve();
352
438
  }
@@ -383,15 +469,52 @@ var updateDefaultProps = ({
383
469
  });
384
470
  window.dispatchEvent(new CustomEvent(Internals8.PROPS_UPDATED_EXTERNALLY, {
385
471
  detail: {
386
- resetUnsaved: false
472
+ resetUnsaved: null
387
473
  }
388
474
  }));
389
475
  };
390
- // src/api/watch-public-folder.ts
476
+ // src/visual-controls/VisualControls.tsx
477
+ import {
478
+ createContext,
479
+ createRef,
480
+ useCallback,
481
+ useEffect,
482
+ useImperativeHandle,
483
+ useMemo,
484
+ useRef,
485
+ useState
486
+ } from "react";
391
487
  import { getRemotionEnvironment as getRemotionEnvironment5 } from "remotion";
488
+ import { jsx as jsx2 } from "react/jsx-runtime";
489
+ var VisualControlsTabActivatedContext = createContext(false);
490
+ var VisualControlsContext = createContext({
491
+ handles: {}
492
+ });
493
+ var visualControlRef = createRef();
494
+ var SetVisualControlsContext = createContext({
495
+ updateHandles: () => {
496
+ throw new Error("updateHandles is not implemented");
497
+ },
498
+ updateValue: () => {
499
+ throw new Error("updateValue is not implemented");
500
+ },
501
+ visualControl: () => {
502
+ throw new Error("visualControl is not implemented");
503
+ }
504
+ });
505
+
506
+ // src/api/visual-control.ts
507
+ var visualControl = (key, value, schema) => {
508
+ if (!visualControlRef.current) {
509
+ throw new Error("visualControlRef is not set");
510
+ }
511
+ return visualControlRef.current.globalVisualControl(key, value, schema);
512
+ };
513
+ // src/api/watch-public-folder.ts
514
+ import { getRemotionEnvironment as getRemotionEnvironment6 } from "remotion";
392
515
  var WATCH_REMOTION_STATIC_FILES = "remotion_staticFilesChanged";
393
516
  var watchPublicFolder = (callback) => {
394
- if (!getRemotionEnvironment5().isStudio) {
517
+ if (!getRemotionEnvironment6().isStudio) {
395
518
  console.warn("The watchPublicFolder() API is only available while using the Remotion Studio.");
396
519
  return { cancel: () => {
397
520
  return;
@@ -410,9 +533,9 @@ var watchPublicFolder = (callback) => {
410
533
  return { cancel };
411
534
  };
412
535
  // src/api/watch-static-file.ts
413
- import { getRemotionEnvironment as getRemotionEnvironment6 } from "remotion";
536
+ import { getRemotionEnvironment as getRemotionEnvironment7 } from "remotion";
414
537
  var watchStaticFile = (fileName, callback) => {
415
- if (!getRemotionEnvironment6().isStudio) {
538
+ if (!getRemotionEnvironment7().isStudio) {
416
539
  console.warn("watchStaticFile() is only available while using the Remotion Studio.");
417
540
  return { cancel: () => {
418
541
  return;
@@ -477,6 +600,7 @@ export {
477
600
  writeStaticFile,
478
601
  watchStaticFile,
479
602
  watchPublicFolder,
603
+ visualControl,
480
604
  updateDefaultProps,
481
605
  toggle,
482
606
  seek,