@remotion/cli 4.0.0-alpha.217 → 4.0.0-alpha10

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 (273) hide show
  1. package/dist/benchmark.js +11 -6
  2. package/dist/better-opn/index.js +3 -3
  3. package/dist/chalk/index.d.ts +45 -54
  4. package/dist/chalk/index.js +2 -135
  5. package/dist/codemods/stringify-with-path.d.ts +5 -0
  6. package/dist/codemods/stringify-with-path.js +44 -0
  7. package/dist/codemods/update-default-props.d.ts +4 -2
  8. package/dist/codemods/update-default-props.js +3 -18
  9. package/dist/color-math.d.ts +2 -2
  10. package/dist/color-math.js +5 -3
  11. package/dist/compositions.js +1 -0
  12. package/dist/config/image-format.d.ts +1 -1
  13. package/dist/config/index.d.ts +2 -2
  14. package/dist/config/log.d.ts +1 -3
  15. package/dist/config/log.js +2 -9
  16. package/dist/convert-entry-point-to-serve-url.js +2 -2
  17. package/dist/download-progress.d.ts +1 -1
  18. package/dist/download-progress.js +1 -4
  19. package/dist/editor/components/CanvasOrLoading.d.ts +5 -0
  20. package/dist/editor/components/CanvasOrLoading.js +66 -0
  21. package/dist/editor/components/CheckboardToggle.js +2 -1
  22. package/dist/editor/components/CompositionSelectorItem.js +2 -2
  23. package/dist/editor/components/CurrentCompositionSideEffects.js +3 -3
  24. package/dist/editor/components/InitialCompositionLoader.js +1 -1
  25. package/dist/editor/components/InlineAction.d.ts +6 -4
  26. package/dist/editor/components/InlineAction.js +7 -8
  27. package/dist/editor/components/LoopToggle.js +2 -1
  28. package/dist/editor/components/Menu/MenuItem.js +1 -1
  29. package/dist/editor/components/Menu/SubMenu.js +1 -1
  30. package/dist/editor/components/Menu/styles.d.ts +1 -0
  31. package/dist/editor/components/Menu/styles.js +6 -1
  32. package/dist/editor/components/MenuBuildIndicator.js +20 -1
  33. package/dist/editor/components/MenuToolbar.js +15 -3
  34. package/dist/editor/components/Modals.js +2 -2
  35. package/dist/editor/components/NewComposition/ComboBox.js +20 -5
  36. package/dist/editor/components/NewComposition/InputDragger.js +3 -2
  37. package/dist/editor/components/NewComposition/MenuContent.d.ts +1 -0
  38. package/dist/editor/components/NewComposition/MenuContent.js +12 -4
  39. package/dist/editor/components/Notifications/ServerDisconnected.js +2 -2
  40. package/dist/editor/components/OpenEditorButton.d.ts +2 -0
  41. package/dist/editor/components/OpenEditorButton.js +52 -0
  42. package/dist/editor/components/PlayPause.js +4 -2
  43. package/dist/editor/components/PreviewToolbar.js +2 -2
  44. package/dist/editor/components/QuickSwitcher/algolia-search.js +1 -1
  45. package/dist/editor/components/RenderButton.d.ts +1 -5
  46. package/dist/editor/components/RenderButton.js +48 -21
  47. package/dist/editor/components/RenderModal/CliCopyButton.js +51 -14
  48. package/dist/editor/components/RenderModal/CrfSetting.d.ts +0 -1
  49. package/dist/editor/components/RenderModal/CrfSetting.js +0 -1
  50. package/dist/editor/components/RenderModal/DataEditor.d.ts +21 -0
  51. package/dist/editor/components/RenderModal/DataEditor.js +287 -0
  52. package/dist/editor/components/RenderModal/EnforceAudioTrackSetting.js +3 -2
  53. package/dist/editor/components/RenderModal/InfoBubble.js +2 -1
  54. package/dist/editor/components/RenderModal/InfoTooltip.d.ts +1 -0
  55. package/dist/editor/components/RenderModal/InfoTooltip.js +6 -5
  56. package/dist/editor/components/RenderModal/InlineEyeIcon.js +6 -3
  57. package/dist/editor/components/RenderModal/InlineRemoveButton.js +6 -1
  58. package/dist/editor/components/RenderModal/MutedSetting.js +3 -2
  59. package/dist/editor/components/RenderModal/OptionExplainer.js +14 -3
  60. package/dist/editor/components/RenderModal/RenderModal.d.ts +7 -3
  61. package/dist/editor/components/RenderModal/RenderModal.js +108 -49
  62. package/dist/editor/components/RenderModal/RenderModalAdvanced.js +0 -2
  63. package/dist/editor/components/RenderModal/RenderModalAudio.js +1 -1
  64. package/dist/editor/components/RenderModal/RenderModalBasic.d.ts +3 -2
  65. package/dist/editor/components/RenderModal/RenderModalBasic.js +4 -3
  66. package/dist/editor/components/RenderModal/RenderModalData.d.ts +16 -4
  67. package/dist/editor/components/RenderModal/RenderModalData.js +109 -42
  68. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +14 -0
  69. package/dist/editor/components/RenderModal/{RenderModalJSONInputPropsEditor.js → RenderModalJSONPropsEditor.js} +51 -30
  70. package/dist/editor/components/RenderModal/RenderModalPicture.d.ts +2 -2
  71. package/dist/editor/components/RenderModal/RenderModalPicture.js +2 -4
  72. package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +6 -4
  73. package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -4
  74. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +4 -0
  75. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +15 -6
  76. package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +5 -0
  77. package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +5 -4
  78. package/dist/editor/components/RenderModal/SchemaEditor/SchemaResetButton.js +6 -1
  79. package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.d.ts +1 -0
  80. package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.js +7 -2
  81. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +5 -2
  82. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +19 -29
  83. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +5 -2
  84. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +4 -4
  85. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +5 -2
  86. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +7 -7
  87. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +5 -2
  88. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +23 -66
  89. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +5 -2
  90. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +13 -21
  91. package/dist/editor/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +17 -0
  92. package/dist/editor/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +10 -0
  93. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +4 -2
  94. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +20 -19
  95. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +4 -2
  96. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +12 -26
  97. package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.d.ts +1 -0
  98. package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +2 -2
  99. package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +5 -2
  100. package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -2
  101. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +5 -2
  102. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +16 -32
  103. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +7 -4
  104. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +18 -11
  105. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +5 -2
  106. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -2
  107. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +5 -2
  108. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +44 -11
  109. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +17 -0
  110. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +59 -0
  111. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +5 -2
  112. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +12 -23
  113. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +5 -2
  114. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +32 -21
  115. package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +5 -2
  116. package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.js +6 -6
  117. package/dist/editor/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
  118. package/dist/editor/components/RenderModal/SchemaEditor/create-zod-values.js +22 -22
  119. package/dist/editor/components/RenderModal/SchemaEditor/deep-equal.d.ts +1 -0
  120. package/dist/editor/components/RenderModal/SchemaEditor/deep-equal.js +27 -0
  121. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -0
  122. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +126 -0
  123. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +14 -0
  124. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +42 -0
  125. package/dist/editor/components/RenderModal/SchemaEditor/local-state.d.ts +16 -0
  126. package/dist/editor/components/RenderModal/SchemaEditor/local-state.js +38 -0
  127. package/dist/editor/components/RenderModal/get-render-modal-warnings.d.ts +9 -1
  128. package/dist/editor/components/RenderModal/get-render-modal-warnings.js +42 -8
  129. package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
  130. package/dist/editor/components/RenderModal/layout.js +3 -0
  131. package/dist/editor/components/RenderModal/out-name-checker.js +1 -11
  132. package/dist/editor/components/RenderQueue/RenderQueueItemCancelButton.js +5 -1
  133. package/dist/editor/components/RenderQueue/RenderQueueOpenInFolder.js +5 -1
  134. package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.js +5 -1
  135. package/dist/editor/components/RenderQueue/RenderQueueRepeat.js +5 -1
  136. package/dist/editor/components/RenderQueue/actions.d.ts +4 -3
  137. package/dist/editor/components/RenderQueue/actions.js +8 -3
  138. package/dist/editor/components/RenderQueue/index.js +9 -2
  139. package/dist/editor/components/RightPanel.js +8 -5
  140. package/dist/editor/components/SidebarCollapserControls.js +22 -9
  141. package/dist/editor/components/SidebarRenderButton.d.ts +6 -0
  142. package/dist/editor/components/{RenderToolbarIcon.js → SidebarRenderButton.js} +27 -41
  143. package/dist/editor/components/Spinner.d.ts +5 -0
  144. package/dist/editor/components/Spinner.js +41 -0
  145. package/dist/editor/components/Tabs/index.js +12 -14
  146. package/dist/editor/components/Timeline/Timeline.js +3 -1
  147. package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.js +4 -3
  148. package/dist/editor/components/Timeline/TimelineSequence.js +8 -6
  149. package/dist/editor/components/TimelineInOutToggle.js +2 -4
  150. package/dist/editor/components/TopPanel.js +2 -2
  151. package/dist/editor/components/UpdateCheck.js +2 -1
  152. package/dist/editor/components/get-zod-if-possible.d.ts +3 -3
  153. package/dist/editor/components/get-zod-if-possible.js +11 -11
  154. package/dist/editor/helpers/calculate-timeline.js +1 -1
  155. package/dist/editor/helpers/client-id.d.ts +2 -2
  156. package/dist/editor/helpers/client-id.js +5 -5
  157. package/dist/editor/helpers/colors.d.ts +4 -2
  158. package/dist/editor/helpers/colors.js +4 -2
  159. package/dist/editor/helpers/get-timeline-sequence-layout.d.ts +2 -2
  160. package/dist/editor/helpers/is-composition-still.d.ts +3 -2
  161. package/dist/editor/helpers/is-current-selected-still.js +3 -4
  162. package/dist/editor/helpers/use-file-existence.js +1 -1
  163. package/dist/editor/helpers/use-menu-structure.js +1 -1
  164. package/dist/editor/icons/media-volume.js +2 -1
  165. package/dist/editor/icons/render.d.ts +1 -0
  166. package/dist/editor/icons/render.js +1 -1
  167. package/dist/editor/state/modals.d.ts +3 -1
  168. package/dist/entry-point.js +17 -17
  169. package/dist/event-source-events.d.ts +2 -0
  170. package/dist/event-source.js +2 -2
  171. package/dist/ffmpeg.js +14 -5
  172. package/dist/file-watcher.js +5 -5
  173. package/dist/get-cli-options.d.ts +3 -3
  174. package/dist/get-cli-options.js +4 -4
  175. package/dist/get-composition-id.d.ts +14 -2
  176. package/dist/get-composition-id.js +32 -8
  177. package/dist/get-composition-with-dimension-override.d.ts +13 -2
  178. package/dist/get-composition-with-dimension-override.js +12 -2
  179. package/dist/get-config-file-name.js +6 -6
  180. package/dist/get-env.js +10 -10
  181. package/dist/get-filename.js +1 -0
  182. package/dist/get-input-props.d.ts +1 -1
  183. package/dist/get-input-props.js +9 -9
  184. package/dist/get-network-address.js +2 -2
  185. package/dist/handle-common-errors.d.ts +2 -1
  186. package/dist/handle-common-errors.js +2 -2
  187. package/dist/index.d.ts +41 -19
  188. package/dist/index.js +9 -6
  189. package/dist/list-of-remotion-packages.js +2 -1
  190. package/dist/load-config.js +8 -8
  191. package/dist/log.d.ts +5 -5
  192. package/dist/log.js +3 -42
  193. package/dist/parse-command-line.d.ts +1 -0
  194. package/dist/preview-server/api-types.d.ts +3 -3
  195. package/dist/preview-server/dev-middleware/compatible-api.d.ts +2 -2
  196. package/dist/preview-server/dev-middleware/middleware.d.ts +1 -1
  197. package/dist/preview-server/dev-middleware/middleware.js +7 -7
  198. package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
  199. package/dist/preview-server/dev-middleware/setup-hooks.js +2 -2
  200. package/dist/preview-server/error-overlay/react-overlay/utils/get-file-source.js +5 -5
  201. package/dist/preview-server/error-overlay/react-overlay/utils/open-in-editor.js +17 -17
  202. package/dist/preview-server/error-overlay/remotion-overlay/CalculateMetadataErrorExplainer.d.ts +2 -0
  203. package/dist/preview-server/error-overlay/remotion-overlay/CalculateMetadataErrorExplainer.js +18 -0
  204. package/dist/preview-server/error-overlay/remotion-overlay/CodeFrame.js +30 -12
  205. package/dist/preview-server/error-overlay/remotion-overlay/ErrorDisplay.d.ts +4 -0
  206. package/dist/preview-server/error-overlay/remotion-overlay/ErrorDisplay.js +5 -2
  207. package/dist/preview-server/error-overlay/remotion-overlay/ErrorLoader.d.ts +4 -0
  208. package/dist/preview-server/error-overlay/remotion-overlay/ErrorLoader.js +5 -5
  209. package/dist/preview-server/error-overlay/remotion-overlay/ErrorTitle.d.ts +1 -0
  210. package/dist/preview-server/error-overlay/remotion-overlay/ErrorTitle.js +4 -3
  211. package/dist/preview-server/error-overlay/remotion-overlay/HelpLink.js +2 -1
  212. package/dist/preview-server/error-overlay/remotion-overlay/Overlay.js +1 -1
  213. package/dist/preview-server/error-overlay/remotion-overlay/Retry.d.ts +4 -0
  214. package/dist/preview-server/error-overlay/remotion-overlay/Retry.js +9 -0
  215. package/dist/preview-server/file-existence-watchers.js +3 -3
  216. package/dist/preview-server/get-absolute-public-dir.js +3 -3
  217. package/dist/preview-server/get-package-manager.js +3 -3
  218. package/dist/preview-server/handler.d.ts +1 -1
  219. package/dist/preview-server/hot-middleware/index.d.ts +1 -1
  220. package/dist/preview-server/hot-middleware/index.js +2 -2
  221. package/dist/preview-server/live-events.d.ts +1 -1
  222. package/dist/preview-server/parse-body.d.ts +1 -1
  223. package/dist/preview-server/project-info.js +5 -5
  224. package/dist/preview-server/public-folder.js +8 -8
  225. package/dist/preview-server/render-queue/job.d.ts +11 -2
  226. package/dist/preview-server/render-queue/make-retry-payload.js +5 -1
  227. package/dist/preview-server/render-queue/open-directory-in-finder.js +8 -8
  228. package/dist/preview-server/render-queue/process-still.js +1 -0
  229. package/dist/preview-server/render-queue/queue.js +4 -4
  230. package/dist/preview-server/routes/can-update-default-props.js +3 -2
  231. package/dist/preview-server/routes/update-default-props.d.ts +2 -2
  232. package/dist/preview-server/routes/update-default-props.js +26 -15
  233. package/dist/preview-server/routes.d.ts +3 -2
  234. package/dist/preview-server/routes.js +10 -10
  235. package/dist/preview-server/serve-static.d.ts +1 -1
  236. package/dist/preview-server/serve-static.js +7 -7
  237. package/dist/preview-server/start-server.js +3 -3
  238. package/dist/preview.js +6 -4
  239. package/dist/print-error.d.ts +2 -1
  240. package/dist/print-error.js +8 -5
  241. package/dist/print-help.js +1 -1
  242. package/dist/progress-bar.d.ts +5 -4
  243. package/dist/progress-bar.js +42 -29
  244. package/dist/render-flows/render.d.ts +1 -1
  245. package/dist/render-flows/render.js +62 -35
  246. package/dist/render-flows/still.d.ts +3 -2
  247. package/dist/render-flows/still.js +34 -28
  248. package/dist/resolve-from.js +5 -5
  249. package/dist/setup-cache.d.ts +2 -1
  250. package/dist/setup-cache.js +10 -6
  251. package/dist/should-use-non-overlaying-logger.d.ts +4 -0
  252. package/dist/should-use-non-overlaying-logger.js +12 -0
  253. package/dist/show-compositions-picker.d.ts +8 -0
  254. package/dist/show-compositions-picker.js +51 -0
  255. package/dist/still.js +1 -0
  256. package/dist/studio.d.ts +1 -0
  257. package/dist/studio.js +140 -0
  258. package/dist/upgrade.js +2 -2
  259. package/dist/user-passed-output-location.d.ts +3 -2
  260. package/dist/user-passed-output-location.js +10 -5
  261. package/dist/versions.js +2 -2
  262. package/dist/watch-root-file.d.ts +1 -0
  263. package/dist/watch-root-file.js +22 -0
  264. package/package.json +89 -88
  265. package/styles/styles.css +4 -5
  266. package/dist/editor/components/CollapsableOptions.d.ts +0 -6
  267. package/dist/editor/components/CollapsableOptions.js +0 -35
  268. package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.d.ts +0 -10
  269. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.d.ts +0 -2
  270. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.js +0 -21
  271. package/dist/editor/components/RenderToolbarIcon.d.ts +0 -2
  272. package/dist/editor/icons/RenderStillIcon.d.ts +0 -3
  273. package/dist/editor/icons/RenderStillIcon.js +0 -8
@@ -7,15 +7,18 @@ const ZodArrayEditor_1 = require("./ZodArrayEditor");
7
7
  const ZodBooleanEditor_1 = require("./ZodBooleanEditor");
8
8
  const ZodColorEditor_1 = require("./ZodColorEditor");
9
9
  const ZodDateEditor_1 = require("./ZodDateEditor");
10
+ const ZodDefaultEditor_1 = require("./ZodDefaultEditor");
11
+ const ZodEffectEditor_1 = require("./ZodEffectEditor");
10
12
  const ZodEnumEditor_1 = require("./ZodEnumEditor");
11
13
  const ZodNonEditableValue_1 = require("./ZodNonEditableValue");
12
14
  const ZodNullableEditor_1 = require("./ZodNullableEditor");
13
15
  const ZodNumberEditor_1 = require("./ZodNumberEditor");
14
16
  const ZodObjectEditor_1 = require("./ZodObjectEditor");
15
17
  const ZodOptionalEditor_1 = require("./ZodOptionalEditor");
18
+ const ZodStaticFileEditor_1 = require("./ZodStaticFileEditor");
16
19
  const ZodStringEditor_1 = require("./ZodStringEditor");
17
20
  const ZodUnionEditor_1 = require("./ZodUnionEditor");
18
- const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, onSave, showSaveButton, onRemove, }) => {
21
+ const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, }) => {
19
22
  const def = schema._def;
20
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
24
  const typeName = def.typeName;
@@ -23,59 +26,67 @@ const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, o
23
26
  if (!z) {
24
27
  throw new Error('expected zod');
25
28
  }
26
- const zodColor = (0, get_zod_if_possible_1.useZodColorIfPossible)();
29
+ const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
27
30
  // TODO: (Maybe?) enable saving of inserted input props by cmd+s /ctrl + s (also for JSON view)
28
31
  if (typeName === z.ZodFirstPartyTypeKind.ZodObject) {
29
- return ((0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { setValue: setValue, value: value, defaultValue: defaultValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
32
+ return ((0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { setValue: setValue, value: value, defaultValue: defaultValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
30
33
  }
31
34
  if (typeName === z.ZodFirstPartyTypeKind.ZodString) {
32
- return ((0, jsx_runtime_1.jsx)(ZodStringEditor_1.ZodStringEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove }));
35
+ if (value.startsWith(window.remotion_staticBase)) {
36
+ return ((0, jsx_runtime_1.jsx)(ZodStaticFileEditor_1.ZodStaticFileEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
37
+ }
38
+ return ((0, jsx_runtime_1.jsx)(ZodStringEditor_1.ZodStringEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
33
39
  }
34
40
  if (typeName === z.ZodFirstPartyTypeKind.ZodDate) {
35
- return ((0, jsx_runtime_1.jsx)(ZodDateEditor_1.ZodDateEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove }));
41
+ return ((0, jsx_runtime_1.jsx)(ZodDateEditor_1.ZodDateEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
36
42
  }
37
43
  if (typeName === z.ZodFirstPartyTypeKind.ZodNumber) {
38
- return ((0, jsx_runtime_1.jsx)(ZodNumberEditor_1.ZodNumberEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
44
+ return ((0, jsx_runtime_1.jsx)(ZodNumberEditor_1.ZodNumberEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
39
45
  }
40
46
  if (typeName === z.ZodFirstPartyTypeKind.ZodBoolean) {
41
- return ((0, jsx_runtime_1.jsx)(ZodBooleanEditor_1.ZodBooleanEditor, { value: value, setValue: setValue, jsonPath: jsonPath, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
47
+ return ((0, jsx_runtime_1.jsx)(ZodBooleanEditor_1.ZodBooleanEditor, { value: value, setValue: setValue, jsonPath: jsonPath, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
42
48
  }
43
49
  if (typeName === z.ZodFirstPartyTypeKind.ZodUndefined) {
44
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'undefined' }));
50
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'undefined', saving: saving }));
45
51
  }
46
52
  if (typeName === z.ZodFirstPartyTypeKind.ZodNull) {
47
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'null' }));
53
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'null', saving: saving }));
48
54
  }
49
55
  if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
50
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'any (not editable)' }));
56
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'any (not editable)', saving: saving }));
51
57
  }
52
58
  if (typeName === z.ZodFirstPartyTypeKind.ZodBigInt) {
53
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'BigInt (not editable)' }));
59
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'BigInt (not editable)', saving: saving }));
54
60
  }
55
61
  if (typeName === z.ZodFirstPartyTypeKind.ZodUnknown) {
56
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'unknown (not editable)' }));
62
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'unknown (not editable)', saving: saving }));
57
63
  }
58
64
  if (typeName === z.ZodFirstPartyTypeKind.ZodArray) {
59
- return ((0, jsx_runtime_1.jsx)(ZodArrayEditor_1.ZodArrayEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
65
+ return ((0, jsx_runtime_1.jsx)(ZodArrayEditor_1.ZodArrayEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
60
66
  }
61
67
  if (typeName === z.ZodFirstPartyTypeKind.ZodEnum) {
62
- return ((0, jsx_runtime_1.jsx)(ZodEnumEditor_1.ZodEnumEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
68
+ return ((0, jsx_runtime_1.jsx)(ZodEnumEditor_1.ZodEnumEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving }));
63
69
  }
64
70
  if (typeName === z.ZodFirstPartyTypeKind.ZodEffects) {
65
- if (zodColor &&
66
- schema._def.description === zodColor.ZColorInternals.REMOTION_COLOR_BRAND) {
67
- return ((0, jsx_runtime_1.jsx)(ZodColorEditor_1.ZodColorEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove }));
71
+ if (zodTypes &&
72
+ schema._def.description ===
73
+ zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
74
+ return ((0, jsx_runtime_1.jsx)(ZodColorEditor_1.ZodColorEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
68
75
  }
76
+ return ((0, jsx_runtime_1.jsx)(ZodEffectEditor_1.ZodEffectEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving }));
69
77
  }
70
78
  if (typeName === z.ZodFirstPartyTypeKind.ZodUnion) {
71
- return ((0, jsx_runtime_1.jsx)(ZodUnionEditor_1.ZodUnionEditor, { schema: schema, showSaveButton: showSaveButton, jsonPath: jsonPath, compact: compact, value: value, defaultValue: defaultValue, setValue: setValue, onSave: onSave, onRemove: onRemove }));
79
+ return ((0, jsx_runtime_1.jsx)(ZodUnionEditor_1.ZodUnionEditor, { schema: schema, showSaveButton: showSaveButton, jsonPath: jsonPath, compact: compact, value: value, defaultValue: defaultValue, setValue: setValue, onSave: onSave, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
72
80
  }
73
81
  if (typeName === z.ZodFirstPartyTypeKind.ZodOptional) {
74
- return ((0, jsx_runtime_1.jsx)(ZodOptionalEditor_1.ZodOptionalEditor, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema }));
82
+ return ((0, jsx_runtime_1.jsx)(ZodOptionalEditor_1.ZodOptionalEditor, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent }));
75
83
  }
76
84
  if (typeName === z.ZodFirstPartyTypeKind.ZodNullable) {
77
- return ((0, jsx_runtime_1.jsx)(ZodNullableEditor_1.ZodNullableEditor, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema }));
85
+ return ((0, jsx_runtime_1.jsx)(ZodNullableEditor_1.ZodNullableEditor, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent }));
86
+ }
87
+ if (typeName === z.ZodFirstPartyTypeKind.ZodDefault) {
88
+ return ((0, jsx_runtime_1.jsx)(ZodDefaultEditor_1.ZodDefaultEditor, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent }));
78
89
  }
79
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: `${typeName} (not editable)` }));
90
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: `${typeName} (not editable)`, saving: saving }));
80
91
  };
81
92
  exports.ZodSwitch = ZodSwitch;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { z } from 'zod';
3
3
  import type { JSONPath } from './zod-types';
4
+ import type { UpdaterFunction } from './ZodSwitch';
4
5
  export declare const ZodUnionEditor: React.FC<{
5
6
  showSaveButton: boolean;
6
7
  jsonPath: JSONPath;
@@ -8,7 +9,9 @@ export declare const ZodUnionEditor: React.FC<{
8
9
  value: unknown;
9
10
  defaultValue: unknown;
10
11
  schema: z.ZodTypeAny;
11
- setValue: React.Dispatch<React.SetStateAction<unknown>>;
12
- onSave: (updater: (oldNum: unknown) => unknown) => void;
12
+ setValue: UpdaterFunction<unknown>;
13
+ onSave: UpdaterFunction<unknown>;
13
14
  onRemove: null | (() => void);
15
+ saving: boolean;
16
+ saveDisabledByParent: boolean;
14
17
  }>;
@@ -24,26 +24,26 @@ const findNull = (value, zodType) => {
24
24
  otherSchemaIsAlsoNullish,
25
25
  };
26
26
  };
27
- const ZodUnionEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, }) => {
27
+ const ZodUnionEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, saving, saveDisabledByParent, }) => {
28
28
  const { options } = schema._def;
29
29
  const z = (0, get_zod_if_possible_1.useZodIfPossible)();
30
30
  if (!z) {
31
31
  throw new Error('expected zod');
32
32
  }
33
33
  if (options.length > 2) {
34
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Union with more than 2 options not editable', compact: compact, showSaveButton: showSaveButton }));
34
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Union with more than 2 options not editable', compact: compact, showSaveButton: showSaveButton, saving: saving }));
35
35
  }
36
36
  if (options.length < 2) {
37
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Union with less than 2 options not editable', compact: compact, showSaveButton: showSaveButton }));
37
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Union with less than 2 options not editable', compact: compact, showSaveButton: showSaveButton, saving: saving }));
38
38
  }
39
39
  const nullResult = findNull(options, z);
40
40
  if (!nullResult) {
41
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Union only editable with 1 value being null', compact: compact, showSaveButton: showSaveButton }));
41
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Union only editable with 1 value being null', compact: compact, showSaveButton: showSaveButton, saving: saving }));
42
42
  }
43
43
  const { otherSchema, nullishValue, otherSchemaIsAlsoNullish } = nullResult;
44
44
  if (otherSchemaIsAlsoNullish) {
45
- return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Not editable - both union values are nullish', compact: compact, showSaveButton: showSaveButton }));
45
+ return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Not editable - both union values are nullish', compact: compact, showSaveButton: showSaveButton, saving: saving }));
46
46
  }
47
- return ((0, jsx_runtime_1.jsx)(ZodOrNullishEditor_1.ZodOrNullishEditor, { compact: compact, defaultValue: defaultValue, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, schema: otherSchema, setValue: setValue, showSaveButton: showSaveButton, value: value, nullishValue: nullishValue }));
47
+ return ((0, jsx_runtime_1.jsx)(ZodOrNullishEditor_1.ZodOrNullishEditor, { compact: compact, defaultValue: defaultValue, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, schema: otherSchema, setValue: setValue, showSaveButton: showSaveButton, value: value, nullishValue: nullishValue, saving: saving, saveDisabledByParent: saveDisabledByParent }));
48
48
  };
49
49
  exports.ZodUnionEditor = ZodUnionEditor;
@@ -1,2 +1,2 @@
1
- import type { ZodColorType, ZodType } from '../../get-zod-if-possible';
2
- export declare const createZodValues: (schema: Zod.ZodTypeAny, zodRuntime: ZodType, zColorRuntime: ZodColorType | null) => unknown;
1
+ import type { ZodType, ZodTypesType } from '../../get-zod-if-possible';
2
+ export declare const createZodValues: (schema: Zod.ZodTypeAny, zodRuntime: ZodType, zodTypes: ZodTypesType | null) => unknown;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createZodValues = void 0;
4
- const createZodValues = (schema, zodRuntime, zColorRuntime) => {
4
+ const createZodValues = (schema, zodRuntime, zodTypes) => {
5
5
  if (!schema) {
6
6
  throw new Error('Invalid zod schema');
7
7
  }
@@ -38,71 +38,71 @@ const createZodValues = (schema, zodRuntime, zColorRuntime) => {
38
38
  const shape = def.shape();
39
39
  const keys = Object.keys(shape);
40
40
  const returnValue = keys.reduce((existing, key) => {
41
- existing[key] = (0, exports.createZodValues)(shape[key], zodRuntime, zColorRuntime);
41
+ existing[key] = (0, exports.createZodValues)(shape[key], zodRuntime, zodTypes);
42
42
  return existing;
43
43
  }, {});
44
44
  return returnValue;
45
45
  }
46
46
  case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
47
47
  return [
48
- (0, exports.createZodValues)(def.type, zodRuntime, zColorRuntime),
48
+ (0, exports.createZodValues)(def.type, zodRuntime, zodTypes),
49
49
  ];
50
50
  }
51
51
  case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
52
52
  const firstOptions = def.options[0];
53
53
  return firstOptions
54
- ? (0, exports.createZodValues)(firstOptions, zodRuntime, zColorRuntime)
54
+ ? (0, exports.createZodValues)(firstOptions, zodRuntime, zodTypes)
55
55
  : undefined;
56
56
  }
57
57
  case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
58
58
  const options = def.options[0];
59
- return (0, exports.createZodValues)(options, zodRuntime, zColorRuntime);
59
+ return (0, exports.createZodValues)(options, zodRuntime, zodTypes);
60
60
  }
61
61
  case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
62
62
  return def.value;
63
63
  }
64
64
  case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
65
- if (zColorRuntime &&
65
+ if (zodTypes &&
66
66
  schema._def.description ===
67
- zColorRuntime.ZColorInternals.REMOTION_COLOR_BRAND) {
67
+ zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
68
68
  return '#ffffff';
69
69
  }
70
- return (0, exports.createZodValues)(def.schema, zodRuntime, zColorRuntime);
70
+ return (0, exports.createZodValues)(def.schema, zodRuntime, zodTypes);
71
71
  }
72
72
  case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
73
73
  const { left, right } = def;
74
- const leftValue = (0, exports.createZodValues)(left, zodRuntime, zColorRuntime);
74
+ const leftValue = (0, exports.createZodValues)(left, zodRuntime, zodTypes);
75
75
  if (typeof leftValue !== 'object') {
76
76
  throw new Error('Cannot create value for type z.intersection: Left side is not an object');
77
77
  }
78
- const rightValue = (0, exports.createZodValues)(right, zodRuntime, zColorRuntime);
78
+ const rightValue = (0, exports.createZodValues)(right, zodRuntime, zodTypes);
79
79
  if (typeof rightValue !== 'object') {
80
80
  throw new Error('Cannot create value for type z.intersection: Right side is not an object');
81
81
  }
82
82
  return { ...leftValue, ...rightValue };
83
83
  }
84
84
  case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
85
- const items = def.items.map((item) => (0, exports.createZodValues)(item, zodRuntime, zColorRuntime));
85
+ const items = def.items.map((item) => (0, exports.createZodValues)(item, zodRuntime, zodTypes));
86
86
  return items;
87
87
  }
88
88
  case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
89
- const values = (0, exports.createZodValues)(def.valueType, zodRuntime, zColorRuntime);
89
+ const values = (0, exports.createZodValues)(def.valueType, zodRuntime, zodTypes);
90
90
  return { key: values };
91
91
  }
92
92
  case zodRuntime.ZodFirstPartyTypeKind.ZodMap: {
93
93
  const defType = def;
94
- const values = (0, exports.createZodValues)(defType.valueType, zodRuntime, zColorRuntime);
95
- const key = (0, exports.createZodValues)(defType.keyType, zodRuntime, zColorRuntime);
94
+ const values = (0, exports.createZodValues)(defType.valueType, zodRuntime, zodTypes);
95
+ const key = (0, exports.createZodValues)(defType.keyType, zodRuntime, zodTypes);
96
96
  return new Map([[key, values]]);
97
97
  }
98
98
  case zodRuntime.ZodFirstPartyTypeKind.ZodLazy: {
99
99
  const defType = def;
100
100
  const type = defType.getter();
101
- return (0, exports.createZodValues)(type, zodRuntime, zColorRuntime);
101
+ return (0, exports.createZodValues)(type, zodRuntime, zodTypes);
102
102
  }
103
103
  case zodRuntime.ZodFirstPartyTypeKind.ZodSet: {
104
104
  const defType = def;
105
- const values = (0, exports.createZodValues)(defType.valueType, zodRuntime, zColorRuntime);
105
+ const values = (0, exports.createZodValues)(defType.valueType, zodRuntime, zodTypes);
106
106
  return new Set([values]);
107
107
  }
108
108
  case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
@@ -117,12 +117,12 @@ const createZodValues = (schema, zodRuntime, zColorRuntime) => {
117
117
  }
118
118
  case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
119
119
  const defType = def;
120
- const value = (0, exports.createZodValues)(defType.innerType, zodRuntime, zColorRuntime);
120
+ const value = (0, exports.createZodValues)(defType.innerType, zodRuntime, zodTypes);
121
121
  return value;
122
122
  }
123
123
  case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
124
124
  const defType = def;
125
- const value = (0, exports.createZodValues)(defType.innerType, zodRuntime, zColorRuntime);
125
+ const value = (0, exports.createZodValues)(defType.innerType, zodRuntime, zodTypes);
126
126
  return value;
127
127
  }
128
128
  case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
@@ -131,24 +131,24 @@ const createZodValues = (schema, zodRuntime, zColorRuntime) => {
131
131
  }
132
132
  case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
133
133
  const defType = def;
134
- const value = (0, exports.createZodValues)(defType.innerType, zodRuntime, zColorRuntime);
134
+ const value = (0, exports.createZodValues)(defType.innerType, zodRuntime, zodTypes);
135
135
  return value;
136
136
  }
137
137
  case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
138
138
  const defType = def;
139
- const value = (0, exports.createZodValues)(defType.type, zodRuntime, zColorRuntime);
139
+ const value = (0, exports.createZodValues)(defType.type, zodRuntime, zodTypes);
140
140
  return Promise.resolve(value);
141
141
  }
142
142
  case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
143
143
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
144
144
  const defType = def;
145
- const value = (0, exports.createZodValues)(defType.type, zodRuntime, zColorRuntime);
145
+ const value = (0, exports.createZodValues)(defType.type, zodRuntime, zodTypes);
146
146
  return value;
147
147
  }
148
148
  case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
149
149
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
150
150
  const defType = def;
151
- const value = (0, exports.createZodValues)(defType.out, zodRuntime, zColorRuntime);
151
+ const value = (0, exports.createZodValues)(defType.out, zodRuntime, zodTypes);
152
152
  return value;
153
153
  }
154
154
  default:
@@ -0,0 +1 @@
1
+ export declare function deepEqual(a: any, b: any): boolean;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deepEqual = void 0;
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ function deepEqual(a, b) {
6
+ if (a === b) {
7
+ return true;
8
+ }
9
+ if (typeof a !== 'object' ||
10
+ a === null ||
11
+ typeof b !== 'object' ||
12
+ b === null) {
13
+ return false;
14
+ }
15
+ const keysA = Object.keys(a);
16
+ const keysB = Object.keys(b);
17
+ if (keysA.length !== keysB.length) {
18
+ return false;
19
+ }
20
+ for (const key of keysA) {
21
+ if (!keysB.includes(key) || !deepEqual(a[key], b[key])) {
22
+ return false;
23
+ }
24
+ }
25
+ return true;
26
+ }
27
+ exports.deepEqual = deepEqual;
@@ -0,0 +1,3 @@
1
+ import type { ZodType } from '../../get-zod-if-possible';
2
+ export declare type EnumPath = (string | number)[];
3
+ export declare const extractEnumJsonPaths: (schema: Zod.ZodTypeAny, zodRuntime: ZodType, currentPath: (string | number)[]) => (string | number)[][];
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractEnumJsonPaths = void 0;
4
+ const extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
5
+ const def = schema._def;
6
+ const typeName = def.typeName;
7
+ switch (typeName) {
8
+ case zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
9
+ const shape = def.shape();
10
+ const keys = Object.keys(shape);
11
+ return keys
12
+ .map((key) => {
13
+ return (0, exports.extractEnumJsonPaths)(shape[key], zodRuntime, [
14
+ ...currentPath,
15
+ key,
16
+ ]);
17
+ })
18
+ .flat(1);
19
+ }
20
+ case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
21
+ return (0, exports.extractEnumJsonPaths)(def.type, zodRuntime, [
22
+ ...currentPath,
23
+ '[]',
24
+ ]);
25
+ }
26
+ case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
27
+ return def.options
28
+ .map((option) => {
29
+ return (0, exports.extractEnumJsonPaths)(option, zodRuntime, currentPath);
30
+ })
31
+ .flat(1);
32
+ }
33
+ case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
34
+ return def.options
35
+ .map((op) => {
36
+ return (0, exports.extractEnumJsonPaths)(op, zodRuntime, currentPath);
37
+ })
38
+ .flat(1);
39
+ }
40
+ case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
41
+ return [currentPath];
42
+ }
43
+ case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
44
+ return (0, exports.extractEnumJsonPaths)(def.schema, zodRuntime, currentPath);
45
+ }
46
+ case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
47
+ const { left, right } = def;
48
+ const leftValue = (0, exports.extractEnumJsonPaths)(left, zodRuntime, currentPath);
49
+ const rightValue = (0, exports.extractEnumJsonPaths)(right, zodRuntime, currentPath);
50
+ return [...leftValue, ...rightValue];
51
+ }
52
+ case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
53
+ return def.items
54
+ .map((item, i) => (0, exports.extractEnumJsonPaths)(item, zodRuntime, [...currentPath, i]))
55
+ .flat(1);
56
+ }
57
+ case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
58
+ const values = (0, exports.extractEnumJsonPaths)(def.valueType, zodRuntime, [...currentPath, '{}']);
59
+ return values;
60
+ }
61
+ case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
62
+ throw new Error('Cannot create a value for type function');
63
+ }
64
+ case zodRuntime.ZodFirstPartyTypeKind.ZodEnum: {
65
+ return [currentPath];
66
+ }
67
+ case zodRuntime.ZodFirstPartyTypeKind.ZodNativeEnum: {
68
+ return [];
69
+ }
70
+ case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
71
+ const defType = def;
72
+ const value = (0, exports.extractEnumJsonPaths)(defType.innerType, zodRuntime, currentPath);
73
+ return value;
74
+ }
75
+ case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
76
+ const defType = def;
77
+ const value = (0, exports.extractEnumJsonPaths)(defType.innerType, zodRuntime, currentPath);
78
+ return value;
79
+ }
80
+ case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
81
+ const defType = def;
82
+ return (0, exports.extractEnumJsonPaths)(defType.innerType, zodRuntime, currentPath);
83
+ }
84
+ case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
85
+ const defType = def;
86
+ return (0, exports.extractEnumJsonPaths)(defType.innerType, zodRuntime, currentPath);
87
+ }
88
+ case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
89
+ return [];
90
+ }
91
+ case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
92
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
+ const defType = def;
94
+ const value = (0, exports.extractEnumJsonPaths)(defType.type, zodRuntime, currentPath);
95
+ return value;
96
+ }
97
+ case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
98
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
99
+ const defType = def;
100
+ const value = (0, exports.extractEnumJsonPaths)(defType.out, zodRuntime, currentPath);
101
+ return value;
102
+ }
103
+ case zodRuntime.ZodFirstPartyTypeKind.ZodString:
104
+ case zodRuntime.ZodFirstPartyTypeKind.ZodNumber:
105
+ case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
106
+ case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
107
+ case zodRuntime.ZodFirstPartyTypeKind.ZodNaN:
108
+ case zodRuntime.ZodFirstPartyTypeKind.ZodDate:
109
+ case zodRuntime.ZodFirstPartyTypeKind.ZodSymbol:
110
+ case zodRuntime.ZodFirstPartyTypeKind.ZodUndefined:
111
+ case zodRuntime.ZodFirstPartyTypeKind.ZodNull:
112
+ case zodRuntime.ZodFirstPartyTypeKind.ZodAny:
113
+ case zodRuntime.ZodFirstPartyTypeKind.ZodUnknown:
114
+ case zodRuntime.ZodFirstPartyTypeKind.ZodNever:
115
+ case zodRuntime.ZodFirstPartyTypeKind.ZodVoid:
116
+ case zodRuntime.ZodFirstPartyTypeKind.ZodMap: // Maps are not serializable
117
+ case zodRuntime.ZodFirstPartyTypeKind.ZodLazy:
118
+ case zodRuntime.ZodFirstPartyTypeKind.ZodSet: {
119
+ // Sets are not serializable
120
+ return [];
121
+ }
122
+ default:
123
+ throw new Error('Not implemented: ' + typeName);
124
+ }
125
+ };
126
+ exports.extractEnumJsonPaths = extractEnumJsonPaths;
@@ -0,0 +1,14 @@
1
+ export declare type SerializedJSONWithCustomFields = {
2
+ serializedString: string;
3
+ customDateUsed: boolean;
4
+ customFileUsed: boolean;
5
+ mapUsed: boolean;
6
+ setUsed: boolean;
7
+ };
8
+ export declare const FILE_TOKEN = "remotion-file:";
9
+ export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
10
+ data: unknown;
11
+ indent: number | undefined;
12
+ staticBase: string;
13
+ }) => SerializedJSONWithCustomFields;
14
+ export declare const deserializeJSONWithCustomFields: (data: string) => any;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeJSONWithCustomFields = exports.serializeJSONWithDate = exports.FILE_TOKEN = void 0;
4
+ const DATE_TOKEN = 'remotion-date:';
5
+ exports.FILE_TOKEN = 'remotion-file:';
6
+ const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
7
+ let customDateUsed = false;
8
+ let customFileUsed = false;
9
+ let mapUsed = false;
10
+ let setUsed = false;
11
+ const serializedString = JSON.stringify(data, function (key, value) {
12
+ const item = this[key];
13
+ if (item instanceof Date) {
14
+ customDateUsed = true;
15
+ return `${DATE_TOKEN}${item.toISOString()}`;
16
+ }
17
+ if (item instanceof Map) {
18
+ mapUsed = true;
19
+ return value;
20
+ }
21
+ if (item instanceof Set) {
22
+ setUsed = true;
23
+ return value;
24
+ }
25
+ if (typeof item === 'string' && item.startsWith(staticBase)) {
26
+ customFileUsed = true;
27
+ return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
28
+ }
29
+ return value;
30
+ }, indent);
31
+ return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
32
+ };
33
+ exports.serializeJSONWithDate = serializeJSONWithDate;
34
+ const deserializeJSONWithCustomFields = (data) => {
35
+ return JSON.parse(data, (_, value) => {
36
+ if (typeof value === 'string' && value.startsWith(DATE_TOKEN)) {
37
+ return new Date(value.replace(DATE_TOKEN, ''));
38
+ }
39
+ return value;
40
+ });
41
+ };
42
+ exports.deserializeJSONWithCustomFields = deserializeJSONWithCustomFields;
@@ -0,0 +1,16 @@
1
+ import type { z } from 'zod';
2
+ import type { UpdaterFunction } from './ZodSwitch';
3
+ declare type LocalState<T> = {
4
+ value: T;
5
+ zodValidation: z.SafeParseReturnType<unknown, unknown>;
6
+ revision: number;
7
+ };
8
+ export declare const useLocalState: <T>({ value, schema, setValue, }: {
9
+ value: T;
10
+ schema: z.ZodTypeAny;
11
+ setValue: UpdaterFunction<T>;
12
+ }) => {
13
+ localValue: LocalState<T>;
14
+ onChange: (updater: (oldV: T) => T, forceApply: boolean) => void;
15
+ };
16
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLocalState = void 0;
4
+ const react_1 = require("react");
5
+ const deep_equal_1 = require("./deep-equal");
6
+ const useLocalState = ({ value, schema, setValue, }) => {
7
+ const [localValue, setLocalValue] = (0, react_1.useState)(() => {
8
+ return {
9
+ value,
10
+ zodValidation: schema.safeParse(value),
11
+ revision: 0,
12
+ };
13
+ });
14
+ const stateRef = (0, react_1.useRef)(localValue);
15
+ stateRef.current = localValue;
16
+ const onChange = (0, react_1.useCallback)((updater, forceApply) => {
17
+ const newValue = updater(stateRef.current.value);
18
+ const isSame = (0, deep_equal_1.deepEqual)(newValue, stateRef.current.value);
19
+ if (isSame) {
20
+ return;
21
+ }
22
+ const safeParse = schema.safeParse(newValue);
23
+ if (safeParse.success || forceApply) {
24
+ setValue(updater, forceApply);
25
+ }
26
+ setLocalValue((oldLocalState) => {
27
+ const newState = {
28
+ revision: oldLocalState.revision + 1,
29
+ value: newValue,
30
+ zodValidation: safeParse,
31
+ };
32
+ stateRef.current = newState;
33
+ return newState;
34
+ });
35
+ }, [schema, setValue]);
36
+ return { localValue, onChange };
37
+ };
38
+ exports.useLocalState = useLocalState;
@@ -1,3 +1,4 @@
1
+ import type { PropsEditType } from './DataEditor';
1
2
  export declare type TypeCanSaveState = {
2
3
  canUpdate: true;
3
4
  } | {
@@ -5,7 +6,14 @@ export declare type TypeCanSaveState = {
5
6
  reason: string;
6
7
  determined: boolean;
7
8
  };
8
- export declare const getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, }: {
9
+ export declare const defaultTypeCanSaveState: TypeCanSaveState;
10
+ export declare const getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, }: {
9
11
  cliProps: unknown;
10
12
  canSaveDefaultProps: TypeCanSaveState;
13
+ isCustomDateUsed: boolean;
14
+ customFileUsed: boolean;
15
+ jsMapUsed: boolean;
16
+ jsSetUsed: boolean;
17
+ inJSONEditor: boolean;
18
+ propsEditType: PropsEditType;
11
19
  }) => string[];