@remotion/cli 4.0.0-alpha6 → 4.0.0-alpha8

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 (131) hide show
  1. package/dist/benchmark.js +9 -4
  2. package/dist/chalk/index.d.ts +45 -54
  3. package/dist/chalk/index.js +2 -135
  4. package/dist/codemods/stringify-with-path.d.ts +5 -0
  5. package/dist/codemods/stringify-with-path.js +44 -0
  6. package/dist/codemods/update-default-props.d.ts +3 -1
  7. package/dist/codemods/update-default-props.js +3 -17
  8. package/dist/compositions.js +1 -0
  9. package/dist/config/log.d.ts +1 -3
  10. package/dist/config/log.js +2 -9
  11. package/dist/download-progress.d.ts +1 -1
  12. package/dist/download-progress.js +1 -5
  13. package/dist/editor/components/MenuBuildIndicator.js +20 -1
  14. package/dist/editor/components/Modals.js +1 -1
  15. package/dist/editor/components/NewComposition/ComboBox.js +2 -2
  16. package/dist/editor/components/NewComposition/MenuContent.js +1 -1
  17. package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
  18. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  19. package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
  20. package/dist/editor/components/OpenEditorButton.d.ts +2 -0
  21. package/dist/editor/components/OpenEditorButton.js +52 -0
  22. package/dist/editor/components/RenderButton.js +5 -1
  23. package/dist/editor/components/RenderModal/CliCopyButton.js +7 -6
  24. package/dist/editor/components/RenderModal/OptionExplainer.js +1 -0
  25. package/dist/editor/components/RenderModal/RenderModal.d.ts +2 -0
  26. package/dist/editor/components/RenderModal/RenderModal.js +3 -3
  27. package/dist/editor/components/RenderModal/RenderModalData.js +55 -27
  28. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
  29. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -1
  30. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +3 -2
  31. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
  32. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -1
  33. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +1 -1
  34. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -1
  35. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +8 -8
  36. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -1
  37. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +5 -5
  38. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +1 -1
  39. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +3 -2
  40. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +3 -2
  41. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -4
  42. package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +1 -1
  43. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -1
  44. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +9 -6
  45. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +1 -1
  46. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +1 -1
  47. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +1 -1
  48. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +40 -7
  49. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +16 -0
  50. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +73 -0
  51. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -1
  52. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +5 -5
  53. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -1
  54. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +4 -0
  55. package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +1 -1
  56. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -0
  57. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +126 -0
  58. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +14 -0
  59. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +42 -0
  60. package/dist/editor/components/RenderModal/get-render-modal-warnings.d.ts +6 -2
  61. package/dist/editor/components/RenderModal/get-render-modal-warnings.js +29 -3
  62. package/dist/editor/components/RenderQueue/actions.d.ts +2 -1
  63. package/dist/editor/components/RenderQueue/actions.js +8 -4
  64. package/dist/editor/components/SidebarRenderButton.js +2 -0
  65. package/dist/editor/components/Spinner.d.ts +4 -0
  66. package/dist/editor/components/Spinner.js +42 -0
  67. package/dist/editor/components/Timeline/TimelineSequence.js +6 -4
  68. package/dist/editor/helpers/calculate-timeline.js +1 -1
  69. package/dist/editor/state/modals.d.ts +2 -0
  70. package/dist/ffmpeg.js +6 -2
  71. package/dist/handle-common-errors.d.ts +2 -1
  72. package/dist/handle-common-errors.js +2 -2
  73. package/dist/index.d.ts +9 -5
  74. package/dist/index.js +4 -5
  75. package/dist/log.d.ts +5 -5
  76. package/dist/log.js +3 -42
  77. package/dist/parse-command-line.d.ts +1 -0
  78. package/dist/preview-server/dev-middleware/setup-hooks.js +2 -2
  79. package/dist/preview-server/render-queue/job.d.ts +2 -0
  80. package/dist/preview-server/render-queue/make-retry-payload.js +4 -0
  81. package/dist/preview-server/render-queue/queue.js +2 -1
  82. package/dist/preview-server/routes/can-update-default-props.js +1 -0
  83. package/dist/preview-server/routes/update-default-props.js +4 -3
  84. package/dist/print-error.d.ts +2 -1
  85. package/dist/print-error.js +8 -5
  86. package/dist/progress-bar.d.ts +5 -4
  87. package/dist/progress-bar.js +42 -29
  88. package/dist/render-flows/render.js +46 -19
  89. package/dist/render-flows/still.js +17 -12
  90. package/dist/setup-cache.d.ts +2 -1
  91. package/dist/setup-cache.js +8 -4
  92. package/dist/should-use-non-overlaying-logger.d.ts +4 -0
  93. package/dist/should-use-non-overlaying-logger.js +12 -0
  94. package/dist/user-passed-output-location.js +7 -2
  95. package/package.json +7 -7
  96. package/dist/ansi/ansi-regex.d.ts +0 -2
  97. package/dist/ansi/ansi-regex.js +0 -18
  98. package/dist/cloudrun-command.d.ts +0 -1
  99. package/dist/cloudrun-command.js +0 -27
  100. package/dist/config/ffmpeg-executable.d.ts +0 -5
  101. package/dist/config/ffmpeg-executable.js +0 -21
  102. package/dist/config/quality.d.ts +0 -2
  103. package/dist/config/quality.js +0 -17
  104. package/dist/editor/components/ClipboardIcon.d.ts +0 -2
  105. package/dist/editor/components/ClipboardIcon.js +0 -12
  106. package/dist/editor/components/CollapsedCompositionSelector.d.ts +0 -4
  107. package/dist/editor/components/CollapsedCompositionSelector.js +0 -39
  108. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.d.ts +0 -6
  109. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.js +0 -24
  110. package/dist/editor/components/RichTimelineToggle.d.ts +0 -2
  111. package/dist/editor/components/RichTimelineToggle.js +0 -29
  112. package/dist/editor/components/Thumbnail.d.ts +0 -8
  113. package/dist/editor/components/Thumbnail.js +0 -76
  114. package/dist/editor/helpers/use-compact-ui.d.ts +0 -1
  115. package/dist/editor/helpers/use-compact-ui.js +0 -18
  116. package/dist/editor/icons/film.d.ts +0 -3
  117. package/dist/editor/icons/film.js +0 -8
  118. package/dist/editor/icons/timeline.d.ts +0 -3
  119. package/dist/editor/icons/timeline.js +0 -9
  120. package/dist/editor/state/rich-timeline.d.ts +0 -9
  121. package/dist/editor/state/rich-timeline.js +0 -17
  122. package/dist/get-render-media-options.d.ts +0 -8
  123. package/dist/get-render-media-options.js +0 -55
  124. package/dist/install.d.ts +0 -2
  125. package/dist/install.js +0 -36
  126. package/dist/is-javascript.d.ts +0 -2
  127. package/dist/is-javascript.js +0 -9
  128. package/dist/preview-server/dev-middleware/is-color-supported.d.ts +0 -1
  129. package/dist/preview-server/dev-middleware/is-color-supported.js +0 -37
  130. package/dist/preview-server/hot-middleware/strip-ansi.d.ts +0 -1
  131. package/dist/preview-server/hot-middleware/strip-ansi.js +0 -21
@@ -32,17 +32,50 @@ const ZodOrNullishEditor = ({ jsonPath, compact, schema, setValue, onSave, defau
32
32
  }
33
33
  const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
34
34
  const isChecked = value === nullishValue;
35
- const onValueChange = (0, react_1.useCallback)((newValue) => {
36
- setValue(newValue);
37
- }, [setValue]);
35
+ const [localNonNullishValueValue, setLocalNonNullishValue] = (0, react_1.useState)(() => {
36
+ return {
37
+ value,
38
+ zodValidation: value === nullishValue
39
+ ? { success: true, data: value }
40
+ : schema.safeParse(value),
41
+ };
42
+ });
43
+ const onValueChange = (0, react_1.useCallback)((updater) => {
44
+ setLocalNonNullishValue((oldState) => {
45
+ const newValue = updater(oldState.value);
46
+ if (newValue === nullishValue) {
47
+ return oldState;
48
+ }
49
+ return {
50
+ value: newValue,
51
+ zodValidation: schema.safeParse(newValue),
52
+ };
53
+ });
54
+ setValue(updater);
55
+ }, [nullishValue, schema, setValue]);
38
56
  const onCheckBoxChange = (0, react_1.useCallback)((e) => {
39
57
  const val = e.target.checked
40
58
  ? nullishValue
41
- : (0, create_zod_values_1.createZodValues)(schema, z, zodTypes);
42
- onValueChange(val);
43
- }, [nullishValue, onValueChange, schema, z, zodTypes]);
59
+ : localNonNullishValueValue.value === nullishValue
60
+ ? (0, create_zod_values_1.createZodValues)(schema, z, zodTypes)
61
+ : localNonNullishValueValue.value;
62
+ if (val !== nullishValue) {
63
+ setLocalNonNullishValue({
64
+ value: val,
65
+ zodValidation: schema.safeParse(val),
66
+ });
67
+ }
68
+ onValueChange(() => val);
69
+ }, [
70
+ localNonNullishValueValue,
71
+ nullishValue,
72
+ onValueChange,
73
+ schema,
74
+ z,
75
+ zodTypes,
76
+ ]);
44
77
  const reset = (0, react_1.useCallback)(() => {
45
- onValueChange(defaultValue);
78
+ onValueChange(() => defaultValue);
46
79
  }, [defaultValue, onValueChange]);
47
80
  const save = (0, react_1.useCallback)(() => {
48
81
  onSave(() => value);
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { z } from 'zod';
3
+ import type { JSONPath } from './zod-types';
4
+ import type { UpdaterFunction } from './ZodSwitch';
5
+ export declare const ZodStaticFileEditor: React.FC<{
6
+ schema: z.ZodTypeAny;
7
+ jsonPath: JSONPath;
8
+ value: string;
9
+ defaultValue: string;
10
+ setValue: UpdaterFunction<string>;
11
+ onSave: (updater: (oldState: string) => string) => void;
12
+ compact: boolean;
13
+ showSaveButton: boolean;
14
+ onRemove: null | (() => void);
15
+ saving: boolean;
16
+ }>;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZodStaticFileEditor = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const remotion_1 = require("remotion");
7
+ const Checkmark_1 = require("../../../icons/Checkmark");
8
+ const get_zod_if_possible_1 = require("../../get-zod-if-possible");
9
+ const layout_1 = require("../../layout");
10
+ const ComboBox_1 = require("../../NewComposition/ComboBox");
11
+ const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
12
+ const layout_2 = require("../layout");
13
+ const SchemaLabel_1 = require("./SchemaLabel");
14
+ const container = {
15
+ width: '100%',
16
+ };
17
+ const ZodStaticFileEditor = ({ schema, jsonPath, compact, setValue: updateValue, defaultValue, value, onSave, showSaveButton, onRemove, saving, }) => {
18
+ const z = (0, get_zod_if_possible_1.useZodIfPossible)();
19
+ if (!z) {
20
+ throw new Error('expected zod');
21
+ }
22
+ const [localValue, setLocalValue] = (0, react_1.useState)(() => {
23
+ return {
24
+ value,
25
+ zodValidation: schema.safeParse(value),
26
+ revision: 0,
27
+ };
28
+ });
29
+ const def = schema._def;
30
+ const typeName = def.typeName;
31
+ if (typeName !== z.ZodFirstPartyTypeKind.ZodString) {
32
+ throw new Error('expected enum');
33
+ }
34
+ const isRoot = jsonPath.length === 0;
35
+ const onChange = (0, react_1.useCallback)((updater, forceApply) => {
36
+ setLocalValue((oldLocalState) => {
37
+ const newValue = updater(oldLocalState.value);
38
+ const safeParse = schema.safeParse(newValue);
39
+ if (safeParse.success || forceApply) {
40
+ updateValue(updater);
41
+ }
42
+ return {
43
+ value: newValue,
44
+ zodValidation: safeParse,
45
+ };
46
+ });
47
+ }, [schema, updateValue]);
48
+ const reset = (0, react_1.useCallback)(() => {
49
+ onChange(() => defaultValue, true);
50
+ }, [defaultValue, onChange]);
51
+ const comboBoxValues = (0, react_1.useMemo)(() => {
52
+ return (0, remotion_1.getStaticFiles)().map((option) => {
53
+ return {
54
+ value: option.src,
55
+ label: option.name,
56
+ id: option.src,
57
+ keyHint: null,
58
+ leftItem: option.src === value ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
59
+ onClick: (id) => {
60
+ onChange(() => id, false);
61
+ },
62
+ quickSwitcherLabel: null,
63
+ subMenu: null,
64
+ type: 'item',
65
+ };
66
+ });
67
+ }, [onChange, value]);
68
+ const save = (0, react_1.useCallback)(() => {
69
+ onSave(() => value);
70
+ }, [onSave, value]);
71
+ return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { onSave: save, showSaveButton: showSaveButton, isDefaultValue: value === defaultValue, compact: compact, onReset: reset, jsonPath: jsonPath, onRemove: onRemove, saving: saving }), (0, jsx_runtime_1.jsx)("div", { style: isRoot ? undefined : container, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: localValue.value, title: value }) }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] }));
72
+ };
73
+ exports.ZodStaticFileEditor = ZodStaticFileEditor;
@@ -1,12 +1,13 @@
1
1
  import React from '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 ZodStringEditor: React.FC<{
5
6
  schema: z.ZodTypeAny;
6
7
  jsonPath: JSONPath;
7
8
  value: string;
8
9
  defaultValue: string;
9
- setValue: React.Dispatch<React.SetStateAction<string>>;
10
+ setValue: UpdaterFunction<string>;
10
11
  onSave: (updater: (oldNum: unknown) => string) => void;
11
12
  onRemove: null | (() => void);
12
13
  compact: boolean;
@@ -23,22 +23,22 @@ const ZodStringEditor = ({ jsonPath, value, setValue, showSaveButton, defaultVal
23
23
  zodValidation: schema.safeParse(value),
24
24
  };
25
25
  });
26
- const onValueChange = (0, react_1.useCallback)((newValue) => {
26
+ const onValueChange = (0, react_1.useCallback)((newValue, forceApply) => {
27
27
  const safeParse = schema.safeParse(newValue);
28
28
  const newLocalState = {
29
29
  value: newValue,
30
30
  zodValidation: safeParse,
31
31
  };
32
32
  setLocalValue(newLocalState);
33
- if (safeParse.success) {
34
- setValue(newValue);
33
+ if (safeParse.success || forceApply) {
34
+ setValue(() => newValue);
35
35
  }
36
36
  }, [schema, setValue]);
37
37
  const onChange = (0, react_1.useCallback)((e) => {
38
- onValueChange(e.target.value);
38
+ onValueChange(e.target.value, false);
39
39
  }, [onValueChange]);
40
40
  const reset = (0, react_1.useCallback)(() => {
41
- onValueChange(defaultValue);
41
+ onValueChange(defaultValue, true);
42
42
  }, [defaultValue, onValueChange]);
43
43
  const save = (0, react_1.useCallback)(() => {
44
44
  onSave(() => value);
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { z } from 'zod';
3
3
  import type { JSONPath } from './zod-types';
4
+ export declare type UpdaterFunction<T> = (updater: (oldValue: T) => T) => void;
4
5
  export declare const ZodSwitch: React.FC<{
5
6
  schema: z.ZodTypeAny;
6
7
  jsonPath: JSONPath;
7
8
  value: unknown;
8
9
  defaultValue: unknown;
9
- setValue: React.Dispatch<React.SetStateAction<unknown>>;
10
+ setValue: UpdaterFunction<unknown>;
10
11
  onSave: (newValue: (oldVal: unknown) => unknown) => void;
11
12
  compact: boolean;
12
13
  showSaveButton: boolean;
@@ -14,6 +14,7 @@ const ZodNullableEditor_1 = require("./ZodNullableEditor");
14
14
  const ZodNumberEditor_1 = require("./ZodNumberEditor");
15
15
  const ZodObjectEditor_1 = require("./ZodObjectEditor");
16
16
  const ZodOptionalEditor_1 = require("./ZodOptionalEditor");
17
+ const ZodStaticFileEditor_1 = require("./ZodStaticFileEditor");
17
18
  const ZodStringEditor_1 = require("./ZodStringEditor");
18
19
  const ZodUnionEditor_1 = require("./ZodUnionEditor");
19
20
  const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, onSave, showSaveButton, onRemove, saving, }) => {
@@ -30,6 +31,9 @@ const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, o
30
31
  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 }));
31
32
  }
32
33
  if (typeName === z.ZodFirstPartyTypeKind.ZodString) {
34
+ if (value.startsWith(window.remotion_staticBase)) {
35
+ 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 }));
36
+ }
33
37
  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 }));
34
38
  }
35
39
  if (typeName === z.ZodFirstPartyTypeKind.ZodDate) {
@@ -8,7 +8,7 @@ export declare const ZodUnionEditor: React.FC<{
8
8
  value: unknown;
9
9
  defaultValue: unknown;
10
10
  schema: z.ZodTypeAny;
11
- setValue: React.Dispatch<React.SetStateAction<unknown>>;
11
+ setValue: (updater: (oldState: unknown) => unknown) => void;
12
12
  onSave: (updater: (oldNum: unknown) => unknown) => void;
13
13
  onRemove: null | (() => void);
14
14
  saving: boolean;
@@ -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;
@@ -6,10 +6,14 @@ export declare type TypeCanSaveState = {
6
6
  reason: string;
7
7
  determined: boolean;
8
8
  };
9
- export declare const getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, isCustomDateUsed, inJSONEditor, propsEditType, }: {
9
+ export declare const defaultTypeCanSaveState: TypeCanSaveState;
10
+ export declare const getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, }: {
10
11
  cliProps: unknown;
11
12
  canSaveDefaultProps: TypeCanSaveState;
12
- isCustomDateUsed: boolean | undefined;
13
+ isCustomDateUsed: boolean;
14
+ customFileUsed: boolean;
15
+ jsMapUsed: boolean;
16
+ jsSetUsed: boolean;
13
17
  inJSONEditor: boolean;
14
18
  propsEditType: PropsEditType;
15
19
  }) => string[];
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRenderModalWarnings = void 0;
3
+ exports.getRenderModalWarnings = exports.defaultTypeCanSaveState = void 0;
4
4
  const truthy_1 = require("../../../truthy");
5
+ exports.defaultTypeCanSaveState = {
6
+ canUpdate: false,
7
+ reason: 'Loading...',
8
+ determined: false,
9
+ };
5
10
  const getInputPropsWarning = ({ cliProps, propsEditType, }) => {
6
11
  if (Object.keys(cliProps).length > 0 &&
7
12
  propsEditType === 'default-props') {
@@ -20,15 +25,36 @@ const getCannotSaveDefaultProps = (canSaveDefaultProps) => {
20
25
  };
21
26
  const customDateUsed = (used, inJSONEditor) => {
22
27
  if (used && inJSONEditor) {
23
- return "There is a Date in the schema which can't be serialized. It has been converted into a string.";
28
+ return 'There is a Date in the schema which was serialized. Note the custom syntax.';
29
+ }
30
+ return null;
31
+ };
32
+ const staticFileUsed = (used, inJSONEditor) => {
33
+ if (used && inJSONEditor) {
34
+ return 'There is a staticFile() in the schema which was serialized. Note the custom syntax.';
35
+ }
36
+ return null;
37
+ };
38
+ const mapUsed = (used, inJSONEditor) => {
39
+ if (used && inJSONEditor) {
40
+ return 'A `Map` was used in the schema which can not be serialized to JSON.';
41
+ }
42
+ return null;
43
+ };
44
+ const setUsed = (used, inJSONEditor) => {
45
+ if (used && inJSONEditor) {
46
+ return 'A `Set` was used in the schema which can not be serialized to JSON.';
24
47
  }
25
48
  return null;
26
49
  };
27
- const getRenderModalWarnings = ({ cliProps, canSaveDefaultProps, isCustomDateUsed, inJSONEditor, propsEditType, }) => {
50
+ const getRenderModalWarnings = ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, }) => {
28
51
  return [
29
52
  getInputPropsWarning({ cliProps, propsEditType }),
30
53
  getCannotSaveDefaultProps(canSaveDefaultProps),
31
54
  customDateUsed(isCustomDateUsed, inJSONEditor),
55
+ staticFileUsed(customFileUsed, inJSONEditor),
56
+ mapUsed(jsMapUsed, inJSONEditor),
57
+ setUsed(jsSetUsed, inJSONEditor),
32
58
  ].filter(truthy_1.truthy);
33
59
  };
34
60
  exports.getRenderModalWarnings = getRenderModalWarnings;
@@ -1,6 +1,7 @@
1
1
  import type { AudioCodec, Codec, PixelFormat, ProResProfile, StillImageFormat, VideoImageFormat } from '@remotion/renderer';
2
2
  import type { RenderJob } from '../../../preview-server/render-queue/job';
3
3
  import type { RequiredChromiumOptions } from '../../../required-chromium-options';
4
+ import type { EnumPath } from '../RenderModal/SchemaEditor/extract-enum-json-paths';
4
5
  export declare const addStillRenderJob: ({ compositionId, outName, imageFormat, jpegQuality, frame, scale, verbose, chromiumOptions, delayRenderTimeout, envVariables, inputProps, }: {
5
6
  compositionId: string;
6
7
  outName: string;
@@ -54,5 +55,5 @@ export declare const openInFileExplorer: ({ directory }: {
54
55
  }) => Promise<void>;
55
56
  export declare const removeRenderJob: (job: RenderJob) => Promise<undefined>;
56
57
  export declare const cancelRenderJob: (job: RenderJob) => Promise<import("../../../preview-server/render-queue/job").CancelRenderResponse>;
57
- export declare const updateDefaultProps: (compositionId: string, defaultProps: unknown) => Promise<void>;
58
+ export declare const updateDefaultProps: (compositionId: string, defaultProps: unknown, enumPaths: EnumPath[]) => Promise<void>;
58
59
  export declare const canUpdateDefaultProps: (compositionId: string) => Promise<import("../../../preview-server/render-queue/job").CanUpdateDefaultPropsResponse>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.canUpdateDefaultProps = exports.updateDefaultProps = exports.cancelRenderJob = exports.removeRenderJob = exports.openInFileExplorer = exports.subscribeToFileExistenceWatcher = exports.unsubscribeFromFileExistenceWatcher = exports.addVideoRenderJob = exports.addStillRenderJob = void 0;
4
- const date_serialization_1 = require("../RenderModal/SchemaEditor/date-serialization");
4
+ const input_props_serialization_1 = require("../RenderModal/SchemaEditor/input-props-serialization");
5
5
  const callApi = (endpoint, body) => {
6
6
  return new Promise((resolve, reject) => {
7
7
  fetch(endpoint, {
@@ -104,11 +104,15 @@ const cancelRenderJob = (job) => {
104
104
  });
105
105
  };
106
106
  exports.cancelRenderJob = cancelRenderJob;
107
- const updateDefaultProps = (compositionId, defaultProps) => {
107
+ const updateDefaultProps = (compositionId, defaultProps, enumPaths) => {
108
108
  return callApi('/api/update-default-props', {
109
109
  compositionId,
110
- defaultProps: (0, date_serialization_1.serializeJSONWithDate)(defaultProps, undefined)
111
- .serializedString,
110
+ defaultProps: (0, input_props_serialization_1.serializeJSONWithDate)({
111
+ data: defaultProps,
112
+ indent: undefined,
113
+ staticBase: window.remotion_staticBase,
114
+ }).serializedString,
115
+ enumPaths,
112
116
  });
113
117
  };
114
118
  exports.updateDefaultProps = updateDefaultProps;
@@ -72,6 +72,8 @@ const SidebarRenderButton = ({ composition, visible }) => {
72
72
  initialHeadless: defaults.headless,
73
73
  initialIgnoreCertificateErrors: defaults.ignoreCertificateErrors,
74
74
  defaultProps: (_a = props[composition.id]) !== null && _a !== void 0 ? _a : composition.defaultProps,
75
+ inFrameMark: null,
76
+ outFrameMark: null,
75
77
  });
76
78
  }, [composition.defaultProps, composition.id, isVideo, props, setSelectedModal]);
77
79
  const renderAction = (0, react_1.useCallback)((color) => {
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const Spinner: React.FC<{
3
+ size: number;
4
+ }>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Spinner = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const colors_1 = require("../helpers/colors");
7
+ const viewBox = 100;
8
+ const lines = 6;
9
+ const className = '__remotion_spinner_line';
10
+ const remotionSpinnerAnimation = '__remotion_spinner_animation';
11
+ // Generated from https://github.com/remotion-dev/template-next/commit/9282c93f7c51ada31a42e18a94680fa09a14eee3
12
+ const translated = 'M 44 0 L 50 0 a 6 6 0 0 1 6 6 L 56 26 a 6 6 0 0 1 -6 6 L 50 32 a 6 6 0 0 1 -6 -6 L 44 6 a 6 6 0 0 1 6 -6 Z';
13
+ const totalDuration = 0.5;
14
+ const Spinner = ({ size }) => {
15
+ const style = (0, react_1.useMemo)(() => {
16
+ return {
17
+ width: size,
18
+ height: size,
19
+ };
20
+ }, [size]);
21
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("style", { type: "text/css", children: `
22
+ @keyframes ${remotionSpinnerAnimation} {
23
+ 0% {
24
+ opacity: 1;
25
+ }
26
+ 100% {
27
+ opacity: 0.15;
28
+ }
29
+ }
30
+
31
+ .${className} {
32
+ animation: ${remotionSpinnerAnimation} ${totalDuration}s linear infinite;
33
+ }
34
+ ` }), (0, jsx_runtime_1.jsx)("svg", { style: style, viewBox: `0 0 ${viewBox} ${viewBox}`, children: new Array(lines).fill(true).map((_, index) => {
35
+ return ((0, jsx_runtime_1.jsx)("path", { className: className, style: {
36
+ rotate: `${(index * Math.PI * 2) / lines}rad`,
37
+ transformOrigin: 'center center',
38
+ animationDelay: `${index * (totalDuration / lines) - totalDuration}s`,
39
+ }, d: translated, fill: colors_1.LIGHT_TEXT }, index));
40
+ }) })] }));
41
+ };
42
+ exports.Spinner = Spinner;
@@ -15,7 +15,7 @@ const SEQUENCE_GRADIENT = 'var(--blue)';
15
15
  const AUDIO_GRADIENT = 'linear-gradient(rgb(16 171 58), rgb(43 165 63) 60%)';
16
16
  const VIDEO_GRADIENT = 'linear-gradient(to top, #8e44ad, #9b59b6)';
17
17
  const TimelineSequence = ({ s, fps }) => {
18
- var _a, _b;
18
+ var _a;
19
19
  const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.sliderAreaRef, {
20
20
  triggerOnWindowResize: false,
21
21
  shouldApplyCssTransforms: true,
@@ -30,8 +30,10 @@ const TimelineSequence = ({ s, fps }) => {
30
30
  throw new TypeError('Expected video config');
31
31
  }
32
32
  const { marginLeft, width } = (0, get_timeline_sequence_layout_1.getTimelineSequenceLayout)({
33
- durationInFrames: s.duration * ((_b = s.showLoopTimesInTimeline) !== null && _b !== void 0 ? _b : 1),
34
- startFrom: s.from,
33
+ durationInFrames: s.loopDisplay
34
+ ? s.loopDisplay.durationInFrames * s.loopDisplay.numberOfTimes
35
+ : s.duration,
36
+ startFrom: s.loopDisplay ? s.from + s.loopDisplay.startOffset : s.from,
35
37
  startFromMedia: s.type === 'sequence' ? 0 : s.startMediaFrom,
36
38
  maxMediaDuration,
37
39
  video,
@@ -55,6 +57,6 @@ const TimelineSequence = ({ s, fps }) => {
55
57
  overflow: 'hidden',
56
58
  };
57
59
  }, [marginLeft, s.type, width]);
58
- return ((0, jsx_runtime_1.jsxs)("div", { style: style, title: s.displayName, children: [s.type === 'audio' ? ((0, jsx_runtime_1.jsx)(AudioWaveform_1.AudioWaveform, { src: s.src, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration, fps: fps, volume: s.volume, setMaxMediaDuration: setMaxMediaDuration, playbackRate: s.playbackRate })) : null, s.type === 'video' ? (0, jsx_runtime_1.jsx)(TimelineVideoInfo_1.TimelineVideoInfo, { src: s.src }) : null, s.showLoopTimesInTimeline === undefined ? null : ((0, jsx_runtime_1.jsx)(LoopedTimelineIndicators_1.LoopedTimelineIndicator, { loops: s.showLoopTimesInTimeline }))] }, s.id));
60
+ return ((0, jsx_runtime_1.jsxs)("div", { style: style, title: s.displayName, children: [s.type === 'audio' ? ((0, jsx_runtime_1.jsx)(AudioWaveform_1.AudioWaveform, { src: s.src, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration, fps: fps, volume: s.volume, setMaxMediaDuration: setMaxMediaDuration, playbackRate: s.playbackRate })) : null, s.type === 'video' ? (0, jsx_runtime_1.jsx)(TimelineVideoInfo_1.TimelineVideoInfo, { src: s.src }) : null, s.loopDisplay === undefined ? null : ((0, jsx_runtime_1.jsx)(LoopedTimelineIndicators_1.LoopedTimelineIndicator, { loops: s.loopDisplay.numberOfTimes }))] }, s.id));
59
61
  };
60
62
  exports.TimelineSequence = TimelineSequence;
@@ -29,7 +29,7 @@ const calculateTimeline = ({ sequences, sequenceDuration, }) => {
29
29
  rootId: '-',
30
30
  showInTimeline: true,
31
31
  nonce: 0,
32
- showLoopTimesInTimeline: undefined,
32
+ loopDisplay: undefined,
33
33
  },
34
34
  depth: 0,
35
35
  hash: '-',