@remotion/cli 3.3.82 → 3.3.84

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 (79) hide show
  1. package/dist/codemods/update-default-props.js +7 -8
  2. package/dist/color-math.d.ts +1 -0
  3. package/dist/color-math.js +12 -0
  4. package/dist/config/index.d.ts +1 -0
  5. package/dist/config/index.js +3 -0
  6. package/dist/config/user-agent.d.ts +4 -0
  7. package/dist/config/user-agent.js +12 -0
  8. package/dist/editor/components/Canvas.js +1 -4
  9. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +7 -0
  10. package/dist/editor/components/NewComposition/RemInputTypeColor.js +53 -0
  11. package/dist/editor/components/RenderButton.js +4 -1
  12. package/dist/editor/components/RenderModal/CrfSetting.js +1 -1
  13. package/dist/editor/components/RenderModal/EnvInput.js +1 -1
  14. package/dist/editor/components/RenderModal/FrameRangeSetting.js +1 -1
  15. package/dist/editor/components/RenderModal/NumberOfLoopsSetting.js +1 -1
  16. package/dist/editor/components/RenderModal/NumberSetting.js +1 -1
  17. package/dist/editor/components/RenderModal/RenderModal.js +25 -15
  18. package/dist/editor/components/RenderModal/RenderModalAdvanced.js +2 -0
  19. package/dist/editor/components/RenderModal/RenderModalAudio.js +1 -1
  20. package/dist/editor/components/RenderModal/RenderModalBasic.js +1 -1
  21. package/dist/editor/components/RenderModal/RenderModalData.js +71 -12
  22. package/dist/editor/components/RenderModal/RenderModalInput.js +1 -1
  23. package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.d.ts +1 -0
  24. package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.js +22 -2
  25. package/dist/editor/components/RenderModal/RenderModalPicture.js +1 -1
  26. package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +3 -40
  27. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +11 -0
  28. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +55 -0
  29. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +14 -0
  30. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +108 -0
  31. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
  32. package/dist/editor/components/RenderModal/SchemaEditor/{ZodOrNullEditor.d.ts → ZodNullableEditor.d.ts} +1 -2
  33. package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.js +10 -0
  34. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
  35. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +14 -0
  36. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +10 -0
  37. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +1 -2
  38. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
  39. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +12 -0
  40. package/dist/editor/components/RenderModal/SchemaEditor/create-zod-values.js +3 -0
  41. package/dist/editor/components/RenderModal/layout.js +0 -1
  42. package/dist/editor/components/RenderModal/out-name-checker.d.ts +0 -1
  43. package/dist/editor/components/RenderModal/out-name-checker.js +3 -3
  44. package/dist/editor/components/RenderQueue/actions.d.ts +0 -2
  45. package/dist/editor/components/RenderQueue/actions.js +10 -11
  46. package/dist/editor/components/RenderQueue/index.js +25 -1
  47. package/dist/editor/components/RenderToolbarIcon.js +22 -7
  48. package/dist/editor/components/RendersTab.js +3 -3
  49. package/dist/editor/components/RightPanel.js +2 -7
  50. package/dist/editor/components/SegmentedControl.d.ts +0 -5
  51. package/dist/editor/components/SegmentedControl.js +2 -3
  52. package/dist/editor/components/SidebarCollapserControls.js +81 -10
  53. package/dist/editor/components/SizeSelector.js +1 -1
  54. package/dist/editor/components/Splitter/SplitterElement.js +1 -0
  55. package/dist/editor/components/Tabs/index.js +9 -2
  56. package/dist/editor/components/Tabs/vertical.d.ts +7 -0
  57. package/dist/editor/components/Tabs/vertical.js +43 -0
  58. package/dist/editor/components/TimeValue.js +3 -4
  59. package/dist/editor/components/Timeline/TimelineListItem.js +9 -1
  60. package/dist/ffmpeg.js +2 -2
  61. package/dist/get-cli-options.js +1 -0
  62. package/dist/parse-command-line.d.ts +1 -0
  63. package/dist/parse-command-line.js +3 -0
  64. package/dist/preview-server/api-types.d.ts +0 -4
  65. package/dist/preview-server/render-queue/job.d.ts +1 -1
  66. package/dist/preview-server/render-queue/queue.d.ts +1 -13
  67. package/dist/preview-server/render-queue/queue.js +6 -9
  68. package/dist/preview-server/routes/can-update-default-props.d.ts +4 -0
  69. package/dist/preview-server/routes/can-update-default-props.js +38 -0
  70. package/package.json +6 -6
  71. package/dist/editor/components/CheckerboardContext.d.ts +0 -0
  72. package/dist/editor/components/CheckerboardContext.js +0 -1
  73. package/dist/editor/components/CollapsedSidebarExpander.d.ts +0 -5
  74. package/dist/editor/components/CollapsedSidebarExpander.js +0 -40
  75. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullEditor.js +0 -45
  76. package/dist/editor/components/RenderModal/SchemaEditor/schema-serialization.d.ts +0 -2
  77. package/dist/editor/components/RenderModal/SchemaEditor/schema-serialization.js +0 -21
  78. package/dist/editor/components/SidebarContent.d.ts +0 -5
  79. package/dist/editor/components/SidebarContent.js +0 -53
@@ -27,6 +27,7 @@ exports.RenderModalJSONInputPropsEditor = void 0;
27
27
  const jsx_runtime_1 = require("react/jsx-runtime");
28
28
  const react_1 = __importStar(require("react"));
29
29
  const Button_1 = require("../../../preview-server/error-overlay/remotion-overlay/Button");
30
+ const use_keybinding_1 = require("../../helpers/use-keybinding");
30
31
  const layout_1 = require("../layout");
31
32
  const RemTextarea_1 = require("../NewComposition/RemTextarea");
32
33
  const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
@@ -58,7 +59,8 @@ const scrollable = {
58
59
  flex: 1,
59
60
  };
60
61
  // TODO: Note if custom 'remotion-date:' pattern has been used
61
- const RenderModalJSONInputPropsEditor = ({ setValue, value, zodValidationResult, switchToSchema, onSave, valBeforeSafe, }) => {
62
+ const RenderModalJSONInputPropsEditor = ({ setValue, value, zodValidationResult, switchToSchema, onSave, valBeforeSafe, showSaveButton, }) => {
63
+ const keybindings = (0, use_keybinding_1.useKeybinding)();
62
64
  const [localValue, setLocalValue] = react_1.default.useState(() => {
63
65
  return parseJSON((0, date_serialization_1.serializeJSONWithDate)(value, 2));
64
66
  });
@@ -92,7 +94,25 @@ const RenderModalJSONInputPropsEditor = ({ setValue, value, zodValidationResult,
92
94
  const hasChanged = (0, react_1.useMemo)(() => {
93
95
  return value && JSON.stringify(value) !== JSON.stringify(valBeforeSafe);
94
96
  }, [valBeforeSafe, value]);
97
+ const onQuickSave = (0, react_1.useCallback)(() => {
98
+ if (hasChanged) {
99
+ onSave();
100
+ }
101
+ }, [hasChanged, onSave]);
102
+ (0, react_1.useEffect)(() => {
103
+ const save = keybindings.registerKeybinding({
104
+ event: 'keydown',
105
+ key: 's',
106
+ commandCtrlKey: true,
107
+ callback: onQuickSave,
108
+ preventDefault: true,
109
+ triggerIfInputFieldFocused: true,
110
+ });
111
+ return () => {
112
+ save.unregister();
113
+ };
114
+ }, [keybindings, onQuickSave, onSave]);
95
115
  // TODO: Indicate saving progress
96
- return ((0, jsx_runtime_1.jsxs)("div", { style: scrollable, children: [(0, jsx_runtime_1.jsx)(RemTextarea_1.RemTextarea, { onChange: onChange, value: localValue.str, status: localValue.validJSON ? 'ok' : 'error', style: style }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), localValue.validJSON === false ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.error, type: "error" })) : zodValidationResult.success === false ? ((0, jsx_runtime_1.jsx)("button", { type: "button", style: schemaButton, onClick: switchToSchema, children: (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: "Does not match schema", type: "warning" }) })) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { disabled: !localValue.validJSON, onClick: onPretty, children: "Format JSON" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onSave, disabled: !zodValidationResult.success || !hasChanged, children: "Save" })] })] }));
116
+ return ((0, jsx_runtime_1.jsxs)("div", { style: scrollable, children: [(0, jsx_runtime_1.jsx)(RemTextarea_1.RemTextarea, { onChange: onChange, value: localValue.str, status: localValue.validJSON ? 'ok' : 'error', style: style }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), localValue.validJSON === false ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.error, type: "error" })) : zodValidationResult.success === false ? ((0, jsx_runtime_1.jsx)("button", { type: "button", style: schemaButton, onClick: switchToSchema, children: (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: "Does not match schema", type: "warning" }) })) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { disabled: !localValue.validJSON, onClick: onPretty, children: "Format JSON" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onSave, disabled: !zodValidationResult.success || !hasChanged || !showSaveButton, children: "Save" })] })] }));
97
117
  };
98
118
  exports.RenderModalJSONInputPropsEditor = RenderModalJSONInputPropsEditor;
@@ -51,6 +51,6 @@ const RenderModalPicture = ({ renderMode, scale, setScale, pixelFormat, setPixel
51
51
  }, [setCustomTargetVideoBitrateValue]);
52
52
  return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Image Format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: false }) })] })) : null, renderMode === 'video' && videoImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsx)(JpegQualitySetting_1.JpegQualitySetting, { jpegQuality: jpegQuality, setJpegQuality: setJpegQuality })), renderMode === 'still' && stillImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsx)(JpegQualitySetting_1.JpegQualitySetting, { jpegQuality: jpegQuality, setJpegQuality: setJpegQuality })), renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Quality control" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: qualityControlOptions, needsWrapping: true }) })] })) : null, shouldDisplayCrfOption &&
53
53
  qualityControlType === 'crf' &&
54
- renderMode !== 'still' ? ((0, jsx_runtime_1.jsx)(CrfSetting_1.CrfSetting, { crf: crf, min: minCrf, max: maxCrf, setCrf: setCrf, option: client_1.BrowserSafeApis.options.crfOption })) : null, qualityControlType === 'bitrate' && renderMode !== 'still' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Target video bitrate" }), (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: client_1.BrowserSafeApis.options.videoBitrate }) }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { style: layout_1.input, value: customTargetVideoBitrate, onChange: onTargetVideoBitrateChanged, status: "ok" }) }) })] })) : null, renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, (0, jsx_runtime_1.jsx)(ScaleSetting_1.ScaleSetting, { scale: scale, setScale: setScale }), renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Pixel format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: pixelFormatOptions, selectedId: pixelFormat, title: "Pixel Format" }) })] })) : null] }));
54
+ renderMode !== 'still' ? ((0, jsx_runtime_1.jsx)(CrfSetting_1.CrfSetting, { crf: crf, min: minCrf, max: maxCrf, setCrf: setCrf, option: client_1.BrowserSafeApis.options.crfOption })) : null, qualityControlType === 'bitrate' && renderMode !== 'still' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Target video bitrate" }), (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: client_1.BrowserSafeApis.options.videoBitrate }) }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { style: layout_1.input, value: customTargetVideoBitrate, onChange: onTargetVideoBitrateChanged, status: "ok", rightAlign: true }) }) })] })) : null, renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, (0, jsx_runtime_1.jsx)(ScaleSetting_1.ScaleSetting, { scale: scale, setScale: setScale }), renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Pixel format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: pixelFormatOptions, selectedId: pixelFormat, title: "Pixel Format" }) })] })) : null] }));
55
55
  };
56
56
  exports.RenderModalPicture = RenderModalPicture;
@@ -4,39 +4,15 @@ exports.SchemaEditor = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
- const Button_1 = require("../../../../preview-server/error-overlay/remotion-overlay/Button");
8
- const colors_1 = require("../../../helpers/colors");
9
- const layout_1 = require("../../layout");
10
7
  const is_menu_item_1 = require("../../Menu/is-menu-item");
11
- const SchemaEmptyStateGraphic_1 = require("./SchemaEmptyStateGraphic");
12
- const ZodErrorMessages_1 = require("./ZodErrorMessages");
8
+ const SchemaErrorMessages_1 = require("./SchemaErrorMessages");
13
9
  const ZodObjectEditor_1 = require("./ZodObjectEditor");
14
- const errorExplanation = {
15
- fontSize: 14,
16
- color: colors_1.LIGHT_TEXT,
17
- fontFamily: 'sans-serif',
18
- lineHeight: 1.5,
19
- };
20
- const codeSnippet = {
21
- fontSize: 14,
22
- color: 'var(--blue)',
23
- fontFamily: 'monospace',
24
- };
25
10
  const scrollable = {
26
11
  padding: '8px 12px',
27
12
  display: 'flex',
28
13
  flexDirection: 'column',
29
14
  overflowY: 'auto',
30
15
  };
31
- const explainer = {
32
- display: 'flex',
33
- flex: 1,
34
- flexDirection: 'column',
35
- padding: '0 12px',
36
- justifyContent: 'center',
37
- alignItems: 'center',
38
- textAlign: 'center',
39
- };
40
16
  const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, defaultProps, onSave, showSaveButton, }) => {
41
17
  const def = schema._def;
42
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -44,25 +20,12 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, d
44
20
  const reset = (0, react_1.useCallback)(() => {
45
21
  setValue(defaultProps);
46
22
  }, [defaultProps, setValue]);
47
- const openDocs = (0, react_1.useCallback)(() => {
48
- window.open(
49
- // TODO: Make sure to update this link when we release v4
50
- 'https://v4.remotion.dev/docs/parametrized-rendering#define-a-schema-');
51
- }, []);
52
- if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodAny) {
53
- return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(SchemaEmptyStateGraphic_1.SchemaEmptyStateGraphic, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Make the props of this composition interactively editable by adding a", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "schema" }), " prop to the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: '<Composition>' }), " component."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: openDocs, children: "Learn how" })] }));
54
- }
55
23
  if (!zodValidationResult.success) {
56
- if (defaultProps === undefined) {
57
- return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " prop in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: '<Composition>' }), " does not exist."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Fix the schema by adding a", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " prop to your composition."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: openDocs, children: "Learn more" })] }));
58
- }
59
24
  const defaultPropsValid = schema.safeParse(defaultProps);
60
25
  if (!defaultPropsValid.success) {
61
- // TODO: Layout is not nice
62
- // TODO: Does not react to when schema is updated
63
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " prop in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: '<Composition>' }), " is not valid:"] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Fix the schema by changing the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " prop in your composition so it does not give a type error."] })] }));
26
+ return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.InvalidDefaultProps, { zodValidationResult: zodValidationResult });
64
27
  }
65
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the ", (0, jsx_runtime_1.jsx)("code", { children: "defaultProps" }), " that you have defined."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: reset, children: "Reset props" })] }));
28
+ return ((0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.InvalidSchema, { reset: reset, zodValidationResult: zodValidationResult }));
66
29
  }
67
30
  if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodObject) {
68
31
  return ((0, jsx_runtime_1.jsx)("div", { style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { value: value, setValue: setValue, jsonPath: [], schema: schema, compact: compact, defaultValue: defaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null }) }));
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import type { z } from 'remotion';
3
+ export declare const NoSchemaDefined: () => JSX.Element;
4
+ export declare const NoDefaultProps: () => JSX.Element;
5
+ export declare const InvalidDefaultProps: React.FC<{
6
+ zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
7
+ }>;
8
+ export declare const InvalidSchema: React.FC<{
9
+ zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
10
+ reset: () => void;
11
+ }>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidSchema = exports.InvalidDefaultProps = exports.NoDefaultProps = exports.NoSchemaDefined = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Button_1 = require("../../../../preview-server/error-overlay/remotion-overlay/Button");
6
+ const colors_1 = require("../../../helpers/colors");
7
+ const layout_1 = require("../../layout");
8
+ const SchemaEmptyStateGraphic_1 = require("./SchemaEmptyStateGraphic");
9
+ const ZodErrorMessages_1 = require("./ZodErrorMessages");
10
+ const explainer = {
11
+ display: 'flex',
12
+ flex: 1,
13
+ flexDirection: 'column',
14
+ padding: '0 12px',
15
+ justifyContent: 'center',
16
+ alignItems: 'center',
17
+ textAlign: 'center',
18
+ };
19
+ const errorExplanation = {
20
+ fontSize: 14,
21
+ color: colors_1.LIGHT_TEXT,
22
+ fontFamily: 'sans-serif',
23
+ lineHeight: 1.5,
24
+ };
25
+ const codeSnippet = {
26
+ fontSize: 14,
27
+ color: 'var(--blue)',
28
+ fontFamily: 'monospace',
29
+ };
30
+ const errorContainer = {
31
+ padding: '8px 12px',
32
+ overflowY: 'auto',
33
+ };
34
+ const openDocs = () => {
35
+ window.open(
36
+ // TODO: Make sure to update this link when we release v4
37
+ 'https://v4.remotion.dev/docs/parametrized-rendering#define-a-schema-');
38
+ };
39
+ const NoSchemaDefined = () => {
40
+ return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(SchemaEmptyStateGraphic_1.SchemaEmptyStateGraphic, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Make the props of this composition interactively editable by adding a", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "schema" }), " prop to the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: '<Composition>' }), " component."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: openDocs, children: "Learn how" })] }));
41
+ };
42
+ exports.NoSchemaDefined = NoSchemaDefined;
43
+ const NoDefaultProps = () => {
44
+ return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " prop in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: '<Composition>' }), " does not exist."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Fix the schema by adding a ", (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), ' ', "prop to your composition."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: openDocs, children: "Learn more" })] }));
45
+ };
46
+ exports.NoDefaultProps = NoDefaultProps;
47
+ const InvalidDefaultProps = ({ zodValidationResult }) => {
48
+ // TODO: Does not react to when schema is updated
49
+ return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " prop in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: '<Composition>' }), " is not valid:"] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Fix the schema by changing the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " prop in your composition so it does not give a type error."] })] }));
50
+ };
51
+ exports.InvalidDefaultProps = InvalidDefaultProps;
52
+ const InvalidSchema = ({ zodValidationResult, reset }) => {
53
+ return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the ", (0, jsx_runtime_1.jsx)("code", { children: "defaultProps" }), " that you have defined."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: reset, children: "Reset props" })] }));
54
+ };
55
+ exports.InvalidSchema = InvalidSchema;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { z } from 'remotion';
3
+ import type { JSONPath } from './zod-types';
4
+ export declare const ZodColorEditor: React.FC<{
5
+ schema: z.ZodTypeAny;
6
+ jsonPath: JSONPath;
7
+ value: string;
8
+ defaultValue: string;
9
+ setValue: React.Dispatch<React.SetStateAction<string>>;
10
+ onSave: (updater: (oldNum: unknown) => string) => void;
11
+ onRemove: null | (() => void);
12
+ compact: boolean;
13
+ showSaveButton: boolean;
14
+ }>;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZodColorEditor = 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 color_math_1 = require("../../../../color-math");
8
+ const layout_1 = require("../../layout");
9
+ const InputDragger_1 = require("../../NewComposition/InputDragger");
10
+ const RemInput_1 = require("../../NewComposition/RemInput");
11
+ const RemInputTypeColor_1 = require("../../NewComposition/RemInputTypeColor");
12
+ const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
13
+ const layout_2 = require("../layout");
14
+ const SchemaLabel_1 = require("./SchemaLabel");
15
+ const fullWidth = {
16
+ width: '100%',
17
+ };
18
+ const ZodColorEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValue, schema, compact, onSave, onRemove, }) => {
19
+ const [localValue, setLocalValue] = (0, react_1.useState)(() => {
20
+ return {
21
+ value,
22
+ zodValidation: schema.safeParse(value),
23
+ };
24
+ });
25
+ const onValueChange = (0, react_1.useCallback)((newValue) => {
26
+ const safeParse = schema.safeParse(newValue);
27
+ const newLocalState = {
28
+ value: newValue,
29
+ zodValidation: safeParse,
30
+ };
31
+ setLocalValue(newLocalState);
32
+ if (safeParse.success) {
33
+ setValue(newValue);
34
+ }
35
+ }, [schema, setValue]);
36
+ const { a, b, g, r } = localValue.zodValidation.success
37
+ ? remotion_1.Internals.parseColor(localValue.value)
38
+ : { a: 1, b: 0, g: 0, r: 0 };
39
+ const onChange = (0, react_1.useCallback)((e) => {
40
+ const newColor = (0, color_math_1.colorWithNewOpacity)(e.target.value, Math.round(a));
41
+ const safeParse = schema.safeParse(newColor);
42
+ const newLocalState = {
43
+ value: newColor,
44
+ zodValidation: safeParse,
45
+ };
46
+ setLocalValue(newLocalState);
47
+ if (safeParse.success) {
48
+ setValue(newColor);
49
+ }
50
+ }, [a, schema, setValue]);
51
+ const onTextChange = (0, react_1.useCallback)((e) => {
52
+ const newValue = e.target.value;
53
+ const safeParse = schema.safeParse(newValue);
54
+ const newLocalState = {
55
+ value: newValue,
56
+ zodValidation: safeParse,
57
+ };
58
+ setLocalValue(newLocalState);
59
+ if (safeParse.success) {
60
+ setValue(newValue);
61
+ }
62
+ }, [schema, setValue]);
63
+ const reset = (0, react_1.useCallback)(() => {
64
+ onValueChange(defaultValue);
65
+ }, [defaultValue, onValueChange]);
66
+ const save = (0, react_1.useCallback)(() => {
67
+ onSave(() => value);
68
+ }, [onSave, value]);
69
+ const rgb = `#${r.toString(16).padStart(2, '0')}${g
70
+ .toString(16)
71
+ .padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
72
+ const status = localValue.zodValidation.success ? 'ok' : 'error';
73
+ const colorPicker = (0, react_1.useMemo)(() => {
74
+ return {
75
+ height: 39,
76
+ width: 45,
77
+ display: 'inline-block',
78
+ };
79
+ }, []);
80
+ const onOpacityChange = (0, react_1.useCallback)((newValue) => {
81
+ const newColor = (0, color_math_1.colorWithNewOpacity)(localValue.value, Math.round((Number(newValue) / 100) * 255));
82
+ const safeParse = schema.safeParse(newColor);
83
+ const newLocalState = {
84
+ value: newColor,
85
+ zodValidation: safeParse,
86
+ };
87
+ setLocalValue(newLocalState);
88
+ if (safeParse.success) {
89
+ setValue(newColor);
90
+ }
91
+ }, [localValue.value, schema, setValue]);
92
+ const onOpacityValueChange = (0, react_1.useCallback)((newValue) => {
93
+ const newColor = (0, color_math_1.colorWithNewOpacity)(localValue.value, Math.round((Number(newValue) / 100) * 255));
94
+ const safeParse = schema.safeParse(newColor);
95
+ const newLocalState = {
96
+ value: String(newColor),
97
+ zodValidation: safeParse,
98
+ };
99
+ setLocalValue(newLocalState);
100
+ if (safeParse.success) {
101
+ setValue(newColor);
102
+ }
103
+ }, [localValue.value, schema, setValue]);
104
+ return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { compact: compact, isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: colorPicker, children: (0, jsx_runtime_1.jsx)(RemInputTypeColor_1.RemInputTypeColor, { type: "color", style: {
105
+ height: 39,
106
+ }, value: rgb, onChange: onChange, className: "__remotion_color_picker", status: status }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1, block: true }), (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: localValue.value, status: status, placeholder: jsonPath.join('.'), onChange: onTextChange, rightAlign: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { onTextChange: onOpacityChange, onValueChange: onOpacityValueChange, status: status, value: (a / 255) * 100, min: 0, max: 100, step: 1, formatter: (v) => `${Math.round(Number(v))}%`, rightAlign: false })] }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
107
+ };
108
+ exports.ZodColorEditor = ZodColorEditor;
@@ -71,6 +71,6 @@ const ZodDateEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValue
71
71
  const save = (0, react_1.useCallback)(() => {
72
72
  onSave(() => value);
73
73
  }, [onSave, value]);
74
- return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { compact: compact, isDefaultValue: value.getTime() === defaultValue.getTime(), jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: formatDate(localValue.value), type: "datetime-local", status: localValue.zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, style: inputStyle }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: explainer, children: "Date is in local format" }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
74
+ return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { compact: compact, isDefaultValue: value.getTime() === defaultValue.getTime(), jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: formatDate(localValue.value), type: "datetime-local", status: localValue.zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, style: inputStyle, rightAlign: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: explainer, children: "Date is in local format" }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
75
75
  };
76
76
  exports.ZodDateEditor = ZodDateEditor;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { z } from 'remotion';
3
3
  import type { JSONPath } from './zod-types';
4
- export declare const ZodOrNullEditor: React.FC<{
4
+ export declare const ZodNullableEditor: React.FC<{
5
5
  showSaveButton: boolean;
6
6
  jsonPath: JSONPath;
7
7
  compact: boolean;
@@ -11,5 +11,4 @@ export declare const ZodOrNullEditor: React.FC<{
11
11
  setValue: React.Dispatch<React.SetStateAction<unknown>>;
12
12
  onSave: (updater: (oldNum: unknown) => unknown) => void;
13
13
  onRemove: null | (() => void);
14
- nullishValue: null | undefined;
15
14
  }>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZodNullableEditor = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const ZodOrNullishEditor_1 = require("./ZodOrNullishEditor");
6
+ const ZodNullableEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, }) => {
7
+ const { innerType } = schema._def;
8
+ return ((0, jsx_runtime_1.jsx)(ZodOrNullishEditor_1.ZodOrNullishEditor, { compact: compact, defaultValue: defaultValue, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, schema: innerType, setValue: setValue, showSaveButton: showSaveButton, value: value, nullishValue: null }));
9
+ };
10
+ exports.ZodNullableEditor = ZodNullableEditor;
@@ -84,6 +84,6 @@ const ZodNumberEditor = ({ jsonPath, value, schema, setValue, onSave, compact, d
84
84
  const save = (0, react_1.useCallback)(() => {
85
85
  onSave(() => value);
86
86
  }, [onSave, value]);
87
- return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: isDefault, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { type: 'number', value: localValue.value, style: fullWidth, status: localValue.zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onTextChange: onChange, onValueChange: onValueChange, min: getMinValue(schema), max: getMaxValue(schema), step: getStep(schema) }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
87
+ return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: isDefault, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { type: 'number', value: localValue.value, style: fullWidth, status: localValue.zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onTextChange: onChange, onValueChange: onValueChange, min: getMinValue(schema), max: getMaxValue(schema), step: getStep(schema), rightAlign: false }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
88
88
  };
89
89
  exports.ZodNumberEditor = ZodNumberEditor;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import type { z } from 'remotion';
3
+ import type { JSONPath } from './zod-types';
4
+ export declare const ZodOptionalEditor: React.FC<{
5
+ showSaveButton: boolean;
6
+ jsonPath: JSONPath;
7
+ compact: boolean;
8
+ value: unknown;
9
+ defaultValue: unknown;
10
+ schema: z.ZodTypeAny;
11
+ setValue: React.Dispatch<React.SetStateAction<unknown>>;
12
+ onSave: (updater: (oldNum: unknown) => unknown) => void;
13
+ onRemove: null | (() => void);
14
+ }>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZodOptionalEditor = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const ZodOrNullishEditor_1 = require("./ZodOrNullishEditor");
6
+ const ZodOptionalEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, }) => {
7
+ const { innerType } = schema._def;
8
+ return ((0, jsx_runtime_1.jsx)(ZodOrNullishEditor_1.ZodOrNullishEditor, { compact: compact, defaultValue: defaultValue, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, schema: innerType, setValue: setValue, showSaveButton: showSaveButton, value: value, nullishValue: undefined }));
9
+ };
10
+ exports.ZodOptionalEditor = ZodOptionalEditor;
@@ -30,7 +30,6 @@ const ZodOrNullishEditor = ({ jsonPath, compact, schema, setValue, onSave, defau
30
30
  setValue(newValue);
31
31
  }, [setValue]);
32
32
  const onCheckBoxChange = (0, react_1.useCallback)((e) => {
33
- console.log({ schema, newVal: (0, create_zod_values_1.createZodValues)(schema) });
34
33
  const val = e.target.checked ? nullishValue : (0, create_zod_values_1.createZodValues)(schema);
35
34
  onValueChange(val);
36
35
  }, [nullishValue, onValueChange, schema]);
@@ -40,6 +39,6 @@ const ZodOrNullishEditor = ({ jsonPath, compact, schema, setValue, onSave, defau
40
39
  const save = (0, react_1.useCallback)(() => {
41
40
  onSave(() => value);
42
41
  }, [onSave, value]);
43
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [value === null ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove })) : ((0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: value, setValue: onValueChange, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }) })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
42
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [value === nullishValue ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove })) : ((0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: value, setValue: onValueChange, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }) })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
44
43
  };
45
44
  exports.ZodOrNullishEditor = ZodOrNullishEditor;
@@ -38,6 +38,6 @@ const ZodStringEditor = ({ jsonPath, value, setValue, showSaveButton, defaultVal
38
38
  const save = (0, react_1.useCallback)(() => {
39
39
  onSave(() => value);
40
40
  }, [onSave, value]);
41
- return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { compact: compact, isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: localValue.value, status: localValue.zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
41
+ return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { compact: compact, isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: localValue.value, status: localValue.zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, rightAlign: false }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
42
42
  };
43
43
  exports.ZodStringEditor = ZodStringEditor;
@@ -5,12 +5,15 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const remotion_1 = require("remotion");
6
6
  const ZodArrayEditor_1 = require("./ZodArrayEditor");
7
7
  const ZodBooleanEditor_1 = require("./ZodBooleanEditor");
8
+ const ZodColorEditor_1 = require("./ZodColorEditor");
8
9
  const ZodDateEditor_1 = require("./ZodDateEditor");
9
10
  const ZodEffectEditor_1 = require("./ZodEffectEditor");
10
11
  const ZodEnumEditor_1 = require("./ZodEnumEditor");
11
12
  const ZodNonEditableValue_1 = require("./ZodNonEditableValue");
13
+ const ZodNullableEditor_1 = require("./ZodNullableEditor");
12
14
  const ZodNumberEditor_1 = require("./ZodNumberEditor");
13
15
  const ZodObjectEditor_1 = require("./ZodObjectEditor");
16
+ const ZodOptionalEditor_1 = require("./ZodOptionalEditor");
14
17
  const ZodStringEditor_1 = require("./ZodStringEditor");
15
18
  const ZodUnionEditor_1 = require("./ZodUnionEditor");
16
19
  const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, onSave, showSaveButton, onRemove, }) => {
@@ -55,11 +58,20 @@ const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, o
55
58
  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 }));
56
59
  }
57
60
  if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodEffects) {
61
+ if (schema._def.description === remotion_1.Internals.REMOTION_COLOR_BRAND) {
62
+ 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 }));
63
+ }
58
64
  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 }));
59
65
  }
60
66
  if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodUnion) {
61
67
  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 }));
62
68
  }
69
+ if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodOptional) {
70
+ 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 }));
71
+ }
72
+ if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodNullable) {
73
+ 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 }));
74
+ }
63
75
  return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: `${typeName} (not editable)` }));
64
76
  };
65
77
  exports.ZodSwitch = ZodSwitch;
@@ -59,6 +59,9 @@ const createZodValues = (schema) => {
59
59
  return def.value;
60
60
  }
61
61
  case remotion_1.z.ZodFirstPartyTypeKind.ZodEffects: {
62
+ if (schema._def.description === remotion_1.Internals.REMOTION_COLOR_BRAND) {
63
+ return '#ffffff';
64
+ }
62
65
  return (0, exports.createZodValues)(def.schema);
63
66
  }
64
67
  case remotion_1.z.ZodFirstPartyTypeKind.ZodIntersection: {
@@ -31,7 +31,6 @@ exports.rightRow = {
31
31
  };
32
32
  exports.input = {
33
33
  minWidth: 250,
34
- textAlign: 'right',
35
34
  };
36
35
  exports.fieldsetLabel = {
37
36
  color: colors_1.LIGHT_TEXT,
@@ -1,6 +1,5 @@
1
1
  import type { AudioCodec, Codec, StillImageFormat } from '@remotion/renderer';
2
2
  import type { RenderType } from './RenderModalAdvanced';
3
- export declare const invalidCharacters: string[];
4
3
  export declare const validateOutnameGui: ({ outName, codec, audioCodec, renderMode, stillImageFormat, }: {
5
4
  outName: string;
6
5
  codec: Codec;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateOutnameGui = exports.invalidCharacters = void 0;
3
+ exports.validateOutnameGui = void 0;
4
4
  const client_1 = require("@remotion/renderer/client");
5
- exports.invalidCharacters = ['?', '*', '+', ':', '%'];
5
+ const invalidCharacters = ['?', '*', '+', ':', '%'];
6
6
  const isValidStillExtension = (extension, stillImageFormat) => {
7
7
  if (stillImageFormat === 'jpeg' && extension === 'jpg') {
8
8
  return true;
@@ -43,7 +43,7 @@ const isValidOutName = ({ outName, codec, audioCodec, renderMode, stillImageForm
43
43
  return false;
44
44
  };
45
45
  const hasInvalidChar = () => {
46
- return prefix.split('').some((char) => exports.invalidCharacters.includes(char));
46
+ return prefix.split('').some((char) => invalidCharacters.includes(char));
47
47
  };
48
48
  if (renderMode === 'video') {
49
49
  client_1.BrowserSafeApis.validateOutputFilename({
@@ -1,8 +1,6 @@
1
1
  import type { AudioCodec, Codec, PixelFormat, ProResProfile, StillImageFormat, VideoImageFormat } from '@remotion/renderer';
2
- import type { ApiRoutes } from '../../../preview-server/api-types';
3
2
  import type { RenderJob } from '../../../preview-server/render-queue/job';
4
3
  import type { RequiredChromiumOptions } from '../../../required-chromium-options';
5
- export declare const callApi: <Endpoint extends keyof ApiRoutes>(endpoint: Endpoint, body: ApiRoutes[Endpoint]["Request"]) => Promise<ApiRoutes[Endpoint]["Response"]>;
6
4
  export declare const addStillRenderJob: ({ compositionId, outName, imageFormat, jpegQuality, frame, scale, verbose, chromiumOptions, delayRenderTimeout, envVariables, inputProps, }: {
7
5
  compositionId: string;
8
6
  outName: string;