@remotion/cli 4.0.0-alpha5 → 4.0.0-alpha7

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 (160) hide show
  1. package/dist/benchmark.js +9 -4
  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 +3 -1
  8. package/dist/codemods/update-default-props.js +3 -17
  9. package/dist/color-math.js +3 -1
  10. package/dist/compositions.js +1 -0
  11. package/dist/config/log.d.ts +1 -3
  12. package/dist/config/log.js +2 -9
  13. package/dist/convert-entry-point-to-serve-url.js +2 -2
  14. package/dist/download-progress.d.ts +1 -1
  15. package/dist/download-progress.js +1 -5
  16. package/dist/editor/components/MenuToolbar.js +15 -3
  17. package/dist/editor/components/NewComposition/ComboBox.js +2 -2
  18. package/dist/editor/components/NewComposition/MenuContent.js +1 -1
  19. package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
  20. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  21. package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
  22. package/dist/editor/components/RenderModal/CliCopyButton.js +42 -9
  23. package/dist/editor/components/RenderModal/InfoTooltip.js +2 -1
  24. package/dist/editor/components/RenderModal/OptionExplainer.js +13 -3
  25. package/dist/editor/components/RenderModal/RenderModalData.js +21 -7
  26. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
  27. package/dist/editor/components/RenderModal/RenderModalPicture.js +1 -1
  28. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -1
  29. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +3 -2
  30. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
  31. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -1
  32. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +1 -1
  33. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -1
  34. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +8 -8
  35. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -1
  36. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +5 -5
  37. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +1 -1
  38. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +3 -2
  39. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +3 -2
  40. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -4
  41. package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +1 -1
  42. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -1
  43. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +9 -6
  44. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +1 -1
  45. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +1 -1
  46. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +1 -1
  47. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +40 -7
  48. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +16 -0
  49. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +73 -0
  50. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -1
  51. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +5 -5
  52. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -1
  53. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +4 -0
  54. package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +1 -1
  55. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -0
  56. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +126 -0
  57. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +12 -0
  58. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +32 -0
  59. package/dist/editor/components/RenderModal/get-render-modal-warnings.d.ts +3 -2
  60. package/dist/editor/components/RenderModal/get-render-modal-warnings.js +9 -2
  61. package/dist/editor/components/RenderQueue/actions.d.ts +2 -1
  62. package/dist/editor/components/RenderQueue/actions.js +8 -4
  63. package/dist/editor/components/SidebarCollapserControls.js +12 -6
  64. package/dist/editor/components/Timeline/TimelineSequence.js +6 -4
  65. package/dist/editor/helpers/calculate-timeline.js +1 -1
  66. package/dist/editor/helpers/colors.d.ts +1 -1
  67. package/dist/editor/helpers/colors.js +1 -1
  68. package/dist/entry-point.js +17 -17
  69. package/dist/ffmpeg.js +12 -3
  70. package/dist/file-watcher.js +5 -5
  71. package/dist/get-cli-options.js +4 -4
  72. package/dist/get-config-file-name.js +6 -6
  73. package/dist/get-env.js +10 -10
  74. package/dist/get-input-props.js +9 -9
  75. package/dist/get-network-address.js +2 -2
  76. package/dist/handle-common-errors.d.ts +2 -1
  77. package/dist/handle-common-errors.js +2 -2
  78. package/dist/index.d.ts +9 -5
  79. package/dist/index.js +4 -1
  80. package/dist/load-config.js +8 -8
  81. package/dist/log.d.ts +5 -5
  82. package/dist/log.js +3 -42
  83. package/dist/parse-command-line.d.ts +1 -0
  84. package/dist/preview-server/api-types.d.ts +1 -1
  85. package/dist/preview-server/dev-middleware/compatible-api.d.ts +2 -2
  86. package/dist/preview-server/dev-middleware/middleware.d.ts +1 -1
  87. package/dist/preview-server/dev-middleware/middleware.js +7 -7
  88. package/dist/preview-server/dev-middleware/setup-hooks.js +2 -2
  89. package/dist/preview-server/error-overlay/react-overlay/utils/get-file-source.js +5 -5
  90. package/dist/preview-server/error-overlay/react-overlay/utils/open-in-editor.js +17 -17
  91. package/dist/preview-server/file-existence-watchers.js +3 -3
  92. package/dist/preview-server/get-absolute-public-dir.js +3 -3
  93. package/dist/preview-server/get-package-manager.js +3 -3
  94. package/dist/preview-server/handler.d.ts +1 -1
  95. package/dist/preview-server/hot-middleware/index.d.ts +1 -1
  96. package/dist/preview-server/hot-middleware/index.js +2 -2
  97. package/dist/preview-server/live-events.d.ts +1 -1
  98. package/dist/preview-server/parse-body.d.ts +1 -1
  99. package/dist/preview-server/project-info.js +5 -5
  100. package/dist/preview-server/public-folder.js +8 -8
  101. package/dist/preview-server/render-queue/job.d.ts +2 -0
  102. package/dist/preview-server/render-queue/open-directory-in-finder.js +8 -8
  103. package/dist/preview-server/render-queue/queue.js +4 -3
  104. package/dist/preview-server/routes/can-update-default-props.js +3 -2
  105. package/dist/preview-server/routes/update-default-props.js +7 -6
  106. package/dist/preview-server/routes.d.ts +1 -1
  107. package/dist/preview-server/routes.js +8 -8
  108. package/dist/preview-server/serve-static.d.ts +1 -1
  109. package/dist/preview-server/serve-static.js +7 -7
  110. package/dist/preview-server/start-server.js +2 -2
  111. package/dist/preview.js +4 -4
  112. package/dist/print-error.d.ts +2 -1
  113. package/dist/print-error.js +8 -5
  114. package/dist/progress-bar.d.ts +5 -4
  115. package/dist/progress-bar.js +42 -29
  116. package/dist/render-flows/render.js +50 -23
  117. package/dist/render-flows/still.js +20 -15
  118. package/dist/resolve-from.js +5 -5
  119. package/dist/setup-cache.d.ts +2 -1
  120. package/dist/setup-cache.js +8 -4
  121. package/dist/should-use-non-overlaying-logger.d.ts +4 -0
  122. package/dist/should-use-non-overlaying-logger.js +12 -0
  123. package/dist/upgrade.js +2 -2
  124. package/dist/user-passed-output-location.js +7 -2
  125. package/dist/versions.js +2 -2
  126. package/package.json +7 -7
  127. package/dist/ansi/ansi-regex.d.ts +0 -2
  128. package/dist/ansi/ansi-regex.js +0 -18
  129. package/dist/config/ffmpeg-executable.d.ts +0 -5
  130. package/dist/config/ffmpeg-executable.js +0 -21
  131. package/dist/config/quality.d.ts +0 -2
  132. package/dist/config/quality.js +0 -17
  133. package/dist/editor/components/ClipboardIcon.d.ts +0 -2
  134. package/dist/editor/components/ClipboardIcon.js +0 -12
  135. package/dist/editor/components/CollapsedCompositionSelector.d.ts +0 -4
  136. package/dist/editor/components/CollapsedCompositionSelector.js +0 -39
  137. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.d.ts +0 -6
  138. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.js +0 -24
  139. package/dist/editor/components/RichTimelineToggle.d.ts +0 -2
  140. package/dist/editor/components/RichTimelineToggle.js +0 -29
  141. package/dist/editor/components/Thumbnail.d.ts +0 -8
  142. package/dist/editor/components/Thumbnail.js +0 -76
  143. package/dist/editor/helpers/use-compact-ui.d.ts +0 -1
  144. package/dist/editor/helpers/use-compact-ui.js +0 -18
  145. package/dist/editor/icons/film.d.ts +0 -3
  146. package/dist/editor/icons/film.js +0 -8
  147. package/dist/editor/icons/timeline.d.ts +0 -3
  148. package/dist/editor/icons/timeline.js +0 -9
  149. package/dist/editor/state/rich-timeline.d.ts +0 -9
  150. package/dist/editor/state/rich-timeline.js +0 -17
  151. package/dist/get-render-media-options.d.ts +0 -8
  152. package/dist/get-render-media-options.js +0 -55
  153. package/dist/install.d.ts +0 -2
  154. package/dist/install.js +0 -36
  155. package/dist/is-javascript.d.ts +0 -2
  156. package/dist/is-javascript.js +0 -9
  157. package/dist/preview-server/dev-middleware/is-color-supported.d.ts +0 -1
  158. package/dist/preview-server/dev-middleware/is-color-supported.js +0 -37
  159. package/dist/preview-server/hot-middleware/strip-ansi.d.ts +0 -1
  160. 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,12 @@
1
+ export declare type SerializedJSONWithCustomFields = {
2
+ serializedString: string;
3
+ customDateUsed: boolean;
4
+ customFileUsed: boolean;
5
+ };
6
+ export declare const FILE_TOKEN = "remotion-file:";
7
+ export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
8
+ data: unknown;
9
+ indent: number | undefined;
10
+ staticBase: string;
11
+ }) => SerializedJSONWithCustomFields;
12
+ export declare const deserializeJSONWithCustomFields: (data: string) => any;
@@ -0,0 +1,32 @@
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
+ const serializedString = JSON.stringify(data, function (key, value) {
10
+ const item = this[key];
11
+ if (item instanceof Date) {
12
+ customDateUsed = true;
13
+ return `${DATE_TOKEN}${item.toISOString()}`;
14
+ }
15
+ if (typeof item === 'string' && item.startsWith(staticBase)) {
16
+ customFileUsed = true;
17
+ return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
18
+ }
19
+ return value;
20
+ }, indent);
21
+ return { serializedString, customDateUsed, customFileUsed };
22
+ };
23
+ exports.serializeJSONWithDate = serializeJSONWithDate;
24
+ const deserializeJSONWithCustomFields = (data) => {
25
+ return JSON.parse(data, (_, value) => {
26
+ if (typeof value === 'string' && value.startsWith(DATE_TOKEN)) {
27
+ return new Date(value.replace(DATE_TOKEN, ''));
28
+ }
29
+ return value;
30
+ });
31
+ };
32
+ exports.deserializeJSONWithCustomFields = deserializeJSONWithCustomFields;
@@ -6,10 +6,11 @@ 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 getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, inJSONEditor, propsEditType, }: {
10
10
  cliProps: unknown;
11
11
  canSaveDefaultProps: TypeCanSaveState;
12
- isCustomDateUsed: boolean | undefined;
12
+ isCustomDateUsed: boolean;
13
+ customFileUsed: boolean;
13
14
  inJSONEditor: boolean;
14
15
  propsEditType: PropsEditType;
15
16
  }) => string[];
@@ -20,15 +20,22 @@ const getCannotSaveDefaultProps = (canSaveDefaultProps) => {
20
20
  };
21
21
  const customDateUsed = (used, inJSONEditor) => {
22
22
  if (used && inJSONEditor) {
23
- return "There is a Date in the schema which can't be serialized. It has been converted into a string.";
23
+ return 'There is a Date in the schema which was serialized. Note the custom syntax.';
24
24
  }
25
25
  return null;
26
26
  };
27
- const getRenderModalWarnings = ({ cliProps, canSaveDefaultProps, isCustomDateUsed, inJSONEditor, propsEditType, }) => {
27
+ const staticFileUsed = (used, inJSONEditor) => {
28
+ if (used && inJSONEditor) {
29
+ return 'There is a staticFile() in the schema which was serialized. Note the custom syntax.';
30
+ }
31
+ return null;
32
+ };
33
+ const getRenderModalWarnings = ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, inJSONEditor, propsEditType, }) => {
28
34
  return [
29
35
  getInputPropsWarning({ cliProps, propsEditType }),
30
36
  getCannotSaveDefaultProps(canSaveDefaultProps),
31
37
  customDateUsed(isCustomDateUsed, inJSONEditor),
38
+ staticFileUsed(customFileUsed, inJSONEditor),
32
39
  ].filter(truthy_1.truthy);
33
40
  };
34
41
  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;
@@ -7,11 +7,11 @@ const ShortcutHint_1 = require("../../preview-server/error-overlay/remotion-over
7
7
  const use_keybinding_1 = require("../helpers/use-keybinding");
8
8
  const sidebar_1 = require("../state/sidebar");
9
9
  const InlineAction_1 = require("./InlineAction");
10
- const layout_1 = require("./layout");
11
10
  const TopPanel_1 = require("./TopPanel");
12
11
  const style = {
13
12
  width: 16,
14
13
  height: 16,
14
+ minWidth: 16,
15
15
  border: '1px solid currentColor',
16
16
  borderRadius: 3,
17
17
  color: 'currentColor',
@@ -118,12 +118,18 @@ const SidebarCollapserControls = () => {
118
118
  const toggleRightTooltip = (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
119
119
  ? 'Toggle Right Sidebar'
120
120
  : `Toggle Right Sidebar (${ShortcutHint_1.cmdOrCtrlCharacter}+J)`;
121
+ const colorStyle = (0, react_1.useCallback)((color) => {
122
+ return {
123
+ ...style,
124
+ color,
125
+ };
126
+ }, []);
121
127
  const toggleLeftAction = (0, react_1.useCallback)((color) => {
122
- return ((0, jsx_runtime_1.jsx)("div", { style: style, title: toggleLeftTooltip, children: (0, jsx_runtime_1.jsx)("div", { style: leftIcon(color) }) }));
123
- }, [leftIcon, toggleLeftTooltip]);
128
+ return ((0, jsx_runtime_1.jsx)("div", { style: colorStyle(color), title: toggleLeftTooltip, children: (0, jsx_runtime_1.jsx)("div", { style: leftIcon(color) }) }));
129
+ }, [colorStyle, leftIcon, toggleLeftTooltip]);
124
130
  const toggleRightAction = (0, react_1.useCallback)((color) => {
125
- return ((0, jsx_runtime_1.jsx)("div", { style: style, title: toggleRightTooltip, children: (0, jsx_runtime_1.jsx)("div", { style: rightIcon(color) }) }));
126
- }, [rightIcon, toggleRightTooltip]);
127
- return ((0, jsx_runtime_1.jsxs)(layout_1.Row, { children: [(0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: toggleLeft, renderAction: toggleLeftAction }), (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: toggleRight, renderAction: toggleRightAction })] }));
131
+ return ((0, jsx_runtime_1.jsx)("div", { style: colorStyle(color), title: toggleRightTooltip, children: (0, jsx_runtime_1.jsx)("div", { style: rightIcon(color) }) }));
132
+ }, [colorStyle, rightIcon, toggleRightTooltip]);
133
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: toggleLeft, renderAction: toggleLeftAction }), (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: toggleRight, renderAction: toggleRightAction })] }));
128
134
  };
129
135
  exports.SidebarCollapserControls = SidebarCollapserControls;
@@ -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: '-',
@@ -3,7 +3,7 @@ export declare const INPUT_BACKGROUND = "#2f363d";
3
3
  export declare const BORDER_COLOR = "#000";
4
4
  export declare const LIGHT_COLOR = "#ddd";
5
5
  export declare const SELECTED_BACKGROUND = "hsla(0, 0%, 100%, 0.15)";
6
- export declare const LIGHT_TEXT = "rgba(255, 255, 255, 0.6)";
6
+ export declare const LIGHT_TEXT = "#A6A7A9";
7
7
  export declare const VERY_LIGHT_TEXT = "rgba(255, 255, 255, 0.3)";
8
8
  export declare const CLEAR_HOVER = "rgba(255, 255, 255, 0.06)";
9
9
  export declare const INPUT_BORDER_COLOR_UNHOVERED = "rgba(0, 0, 0, 0.6)";
@@ -6,7 +6,7 @@ exports.INPUT_BACKGROUND = '#2f363d';
6
6
  exports.BORDER_COLOR = '#000';
7
7
  exports.LIGHT_COLOR = '#ddd';
8
8
  exports.SELECTED_BACKGROUND = 'hsla(0, 0%, 100%, 0.15)';
9
- exports.LIGHT_TEXT = 'rgba(255, 255, 255, 0.6)';
9
+ exports.LIGHT_TEXT = '#A6A7A9';
10
10
  exports.VERY_LIGHT_TEXT = 'rgba(255, 255, 255, 0.3)';
11
11
  const SELECTED_HOVER_BACKGROUND = 'hsla(0, 0%, 100%, 0.25)';
12
12
  exports.CLEAR_HOVER = 'rgba(255, 255, 255, 0.06)';