@remotion/cli 4.0.0-alpha8 → 4.0.0-alpha9

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 (92) hide show
  1. package/dist/codemods/update-default-props.d.ts +1 -1
  2. package/dist/codemods/update-default-props.js +0 -1
  3. package/dist/editor/components/CheckboardToggle.js +2 -1
  4. package/dist/editor/components/InlineAction.d.ts +1 -1
  5. package/dist/editor/components/InlineAction.js +6 -3
  6. package/dist/editor/components/LoopToggle.js +2 -1
  7. package/dist/editor/components/Menu/MenuItem.js +1 -1
  8. package/dist/editor/components/Menu/SubMenu.js +1 -1
  9. package/dist/editor/components/NewComposition/ComboBox.js +19 -4
  10. package/dist/editor/components/NewComposition/InputDragger.js +3 -2
  11. package/dist/editor/components/NewComposition/MenuContent.d.ts +1 -0
  12. package/dist/editor/components/NewComposition/MenuContent.js +11 -3
  13. package/dist/editor/components/RenderModal/EnforceAudioTrackSetting.js +3 -2
  14. package/dist/editor/components/RenderModal/MutedSetting.js +3 -2
  15. package/dist/editor/components/RenderModal/RenderModal.d.ts +1 -1
  16. package/dist/editor/components/RenderModal/RenderModal.js +6 -4
  17. package/dist/editor/components/RenderModal/RenderModalAdvanced.js +0 -2
  18. package/dist/editor/components/RenderModal/RenderModalAudio.js +1 -1
  19. package/dist/editor/components/RenderModal/RenderModalBasic.js +3 -2
  20. package/dist/editor/components/RenderModal/RenderModalData.d.ts +3 -3
  21. package/dist/editor/components/RenderModal/RenderModalData.js +16 -5
  22. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -1
  23. package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +5 -4
  24. package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -4
  25. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -0
  26. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +6 -2
  27. package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +4 -0
  28. package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +5 -4
  29. package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.d.ts +1 -1
  30. package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.js +4 -4
  31. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +1 -0
  32. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +38 -26
  33. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +4 -2
  34. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +4 -4
  35. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -1
  36. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +7 -7
  37. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -1
  38. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +17 -60
  39. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -1
  40. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +10 -18
  41. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +3 -2
  42. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -19
  43. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +12 -26
  44. package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
  45. package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +4 -2
  46. package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -2
  47. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -1
  48. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +15 -34
  49. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +6 -4
  50. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +17 -10
  51. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +4 -2
  52. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -2
  53. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +4 -2
  54. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +6 -6
  55. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +1 -0
  56. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +11 -25
  57. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -1
  58. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +12 -23
  59. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +3 -2
  60. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +12 -12
  61. package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +4 -2
  62. package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.js +2 -2
  63. package/dist/editor/components/RenderModal/SchemaEditor/local-state.d.ts +16 -0
  64. package/dist/editor/components/RenderModal/SchemaEditor/local-state.js +44 -0
  65. package/dist/editor/components/RenderModal/out-name-checker.js +1 -11
  66. package/dist/editor/components/RenderQueue/actions.d.ts +3 -3
  67. package/dist/editor/components/RightPanel.js +3 -3
  68. package/dist/editor/components/Tabs/index.js +12 -14
  69. package/dist/editor/components/Timeline/TimelineSequence.js +2 -2
  70. package/dist/editor/components/TimelineInOutToggle.js +2 -1
  71. package/dist/editor/components/UpdateCheck.js +2 -1
  72. package/dist/editor/helpers/colors.d.ts +2 -0
  73. package/dist/editor/helpers/colors.js +3 -1
  74. package/dist/editor/icons/media-volume.js +2 -1
  75. package/dist/editor/state/modals.d.ts +1 -1
  76. package/dist/get-cli-options.d.ts +1 -1
  77. package/dist/get-input-props.d.ts +1 -1
  78. package/dist/index.d.ts +1 -1
  79. package/dist/list-of-remotion-packages.js +1 -0
  80. package/dist/preview-server/api-types.d.ts +2 -2
  81. package/dist/preview-server/error-overlay/remotion-overlay/HelpLink.js +2 -1
  82. package/dist/preview-server/render-queue/job.d.ts +9 -2
  83. package/dist/preview-server/render-queue/make-retry-payload.js +1 -1
  84. package/dist/preview-server/render-queue/queue.js +0 -1
  85. package/dist/preview-server/routes/update-default-props.d.ts +2 -2
  86. package/dist/preview-server/routes/update-default-props.js +23 -13
  87. package/dist/preview-server/routes.d.ts +2 -1
  88. package/dist/preview-server/start-server.js +1 -1
  89. package/dist/render-flows/render.d.ts +1 -1
  90. package/dist/render-flows/still.d.ts +1 -1
  91. package/package.json +13 -11
  92. package/styles/styles.css +4 -5
@@ -2,6 +2,6 @@ import type { EnumPath } from '../editor/components/RenderModal/SchemaEditor/ext
2
2
  export declare const updateDefaultProps: ({ input, compositionId, newDefaultProps, enumPaths, }: {
3
3
  input: string;
4
4
  compositionId: string;
5
- newDefaultProps: unknown;
5
+ newDefaultProps: Record<string, unknown>;
6
6
  enumPaths: EnumPath[];
7
7
  }) => Promise<string>;
@@ -86,7 +86,6 @@ const findTerminators = (input, position) => {
86
86
  }
87
87
  return Infinity;
88
88
  };
89
- // TODO: Add more sanity checks
90
89
  const updateDefaultProps = async ({ input, compositionId, newDefaultProps, enumPaths, }) => {
91
90
  const starter = findStarter({ input, compositionId });
92
91
  const START_TOKEN = 'defaultProps={';
@@ -4,6 +4,7 @@ exports.CheckboardToggle = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const truthy_1 = require("../../truthy");
7
+ const colors_1 = require("../helpers/colors");
7
8
  const use_keybinding_1 = require("../helpers/use-keybinding");
8
9
  const checkerboard_1 = require("../state/checkerboard");
9
10
  const ControlButton_1 = require("./ControlButton");
@@ -20,6 +21,6 @@ const CheckboardToggle = () => {
20
21
  return !c;
21
22
  });
22
23
  }, [setCheckerboard]);
23
- return ((0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { "aria-hidden": "true", focusable: "false", "data-prefix": "fas", "data-icon": "game-board-alt", className: "svg-inline--fa fa-game-board-alt fa-w-16", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", style: { width: 16, height: 16 }, children: (0, jsx_runtime_1.jsx)("path", { fill: checkerboard ? 'var(--blue)' : 'white', d: "M480 0H32A32 32 0 0 0 0 32v448a32 32 0 0 0 32 32h448a32 32 0 0 0 32-32V32a32 32 0 0 0-32-32zm-32 256H256v192H64V256h192V64h192z" }) }) }));
24
+ return ((0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { "aria-hidden": "true", focusable: "false", "data-prefix": "fas", "data-icon": "game-board-alt", className: "svg-inline--fa fa-game-board-alt fa-w-16", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", style: { width: 16, height: 16 }, children: (0, jsx_runtime_1.jsx)("path", { fill: checkerboard ? colors_1.BLUE : 'white', d: "M480 0H32A32 32 0 0 0 0 32v448a32 32 0 0 0 32 32h448a32 32 0 0 0 32-32V32a32 32 0 0 0-32-32zm-32 256H256v192H64V256h192V64h192z" }) }) }));
24
25
  };
25
26
  exports.CheckboardToggle = CheckboardToggle;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  export declare type RenderInlineAction = (color: string) => React.ReactNode;
3
3
  export declare const InlineAction: React.FC<{
4
- onClick: React.MouseEventHandler<HTMLButtonElement>;
4
+ onClick: React.MouseEventHandler<HTMLAnchorElement>;
5
5
  disabled?: boolean;
6
6
  renderAction: RenderInlineAction;
7
7
  }>;
@@ -17,15 +17,18 @@ const InlineAction = ({ renderAction, onClick, disabled }) => {
17
17
  const style = (0, react_1.useMemo)(() => {
18
18
  return {
19
19
  border: 'none',
20
- background: (0, colors_1.getBackgroundFromHoverState)({ hovered, selected: false }),
20
+ background: disabled
21
+ ? 'transparent'
22
+ : (0, colors_1.getBackgroundFromHoverState)({ hovered, selected: false }),
21
23
  height: 24,
22
24
  width: 24,
23
25
  display: 'inline-flex',
24
26
  justifyContent: 'center',
25
27
  alignItems: 'center',
26
28
  borderRadius: 3,
29
+ pointerEvents: disabled ? 'none' : 'auto',
27
30
  };
28
- }, [hovered]);
29
- return ((0, jsx_runtime_1.jsx)("button", { type: "button", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, style: style, tabIndex: tabIndex, disabled: disabled, children: renderAction(hovered ? 'white' : colors_1.LIGHT_TEXT) }));
31
+ }, [disabled, hovered]);
32
+ return ((0, jsx_runtime_1.jsx)("a", { type: "button", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, style: style, tabIndex: tabIndex, children: renderAction(hovered ? 'white' : colors_1.LIGHT_TEXT) }));
30
33
  };
31
34
  exports.InlineAction = InlineAction;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LoopToggle = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const colors_1 = require("../helpers/colors");
6
7
  const is_current_selected_still_1 = require("../helpers/is-current-selected-still");
7
8
  const loop_1 = require("../state/loop");
8
9
  const ControlButton_1 = require("./ControlButton");
@@ -18,6 +19,6 @@ const LoopToggle = ({ loop, setLoop }) => {
18
19
  if (isStill) {
19
20
  return null;
20
21
  }
21
- return ((0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 512 512", style: { width: 18, height: 18 }, children: (0, jsx_runtime_1.jsx)("path", { fill: loop ? 'var(--blue)' : 'white', d: "M493.544 181.463c11.956 22.605 18.655 48.4 18.452 75.75C511.339 345.365 438.56 416 350.404 416H192v47.495c0 22.475-26.177 32.268-40.971 17.475l-80-80c-9.372-9.373-9.372-24.569 0-33.941l80-80C166.138 271.92 192 282.686 192 304v48h158.875c52.812 0 96.575-42.182 97.12-94.992.155-15.045-3.17-29.312-9.218-42.046-4.362-9.185-2.421-20.124 4.8-27.284 4.745-4.706 8.641-8.555 11.876-11.786 11.368-11.352 30.579-8.631 38.091 5.571zM64.005 254.992c.545-52.81 44.308-94.992 97.12-94.992H320v47.505c0 22.374 26.121 32.312 40.971 17.465l80-80c9.372-9.373 9.372-24.569 0-33.941l-80-80C346.014 16.077 320 26.256 320 48.545V96H161.596C73.44 96 .661 166.635.005 254.788c-.204 27.35 6.495 53.145 18.452 75.75 7.512 14.202 26.723 16.923 38.091 5.57 3.235-3.231 7.13-7.08 11.876-11.786 7.22-7.16 9.162-18.098 4.8-27.284-6.049-12.735-9.374-27.001-9.219-42.046z" }) }) }));
22
+ return ((0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 512 512", style: { width: 18, height: 18 }, children: (0, jsx_runtime_1.jsx)("path", { fill: loop ? colors_1.BLUE : 'white', d: "M493.544 181.463c11.956 22.605 18.655 48.4 18.452 75.75C511.339 345.365 438.56 416 350.404 416H192v47.495c0 22.475-26.177 32.268-40.971 17.475l-80-80c-9.372-9.373-9.372-24.569 0-33.941l80-80C166.138 271.92 192 282.686 192 304v48h158.875c52.812 0 96.575-42.182 97.12-94.992.155-15.045-3.17-29.312-9.218-42.046-4.362-9.185-2.421-20.124 4.8-27.284 4.745-4.706 8.641-8.555 11.876-11.786 11.368-11.352 30.579-8.631 38.091 5.571zM64.005 254.992c.545-52.81 44.308-94.992 97.12-94.992H320v47.505c0 22.374 26.121 32.312 40.971 17.465l80-80c9.372-9.373 9.372-24.569 0-33.941l-80-80C346.014 16.077 320 26.256 320 48.545V96H161.596C73.44 96 .661 166.635.005 254.788c-.204 27.35 6.495 53.145 18.452 75.75 7.512 14.202 26.723 16.923 38.091 5.57 3.235-3.231 7.13-7.08 11.876-11.786 7.22-7.16 9.162-18.098 4.8-27.284-6.049-12.735-9.374-27.001-9.219-42.046z" }) }) }));
22
23
  };
23
24
  exports.LoopToggle = LoopToggle;
@@ -87,7 +87,7 @@ const MenuItem = ({ label: itemName, selected, id, onItemSelected, onItemHovered
87
87
  };
88
88
  }, [size]);
89
89
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("button", { ref: ref, role: "button", tabIndex: tabIndex, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onPointerDown: onPointerDown, onClick: onClick, style: containerStyle, type: "button", className: is_menu_item_1.MENU_INITIATOR_CLASSNAME, children: itemName }), portalStyle
90
- ? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { className: "css-reset", style: outerStyle, children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onEscape: onItemQuit, onOutsideClick: onItemQuit, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: onPreviousMenu, onPreviousMenu: onNextMenu, values: menu.items, onHide: onItemQuit, leaveLeftSpace: menu.leaveLeftPadding, preselectIndex: false, topItemCanBeUnselected: true }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
90
+ ? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { className: "css-reset", style: outerStyle, children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onEscape: onItemQuit, onOutsideClick: onItemQuit, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: onPreviousMenu, onPreviousMenu: onNextMenu, values: menu.items, onHide: onItemQuit, leaveLeftSpace: menu.leaveLeftPadding, preselectIndex: false, topItemCanBeUnselected: true, fixedHeight: null }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
91
91
  : null] }));
92
92
  };
93
93
  exports.MenuItem = MenuItem;
@@ -9,6 +9,6 @@ const SubMenuComponent = ({ portalStyle, subMenuActivated, subMenu, onQuitFullMe
9
9
  return ((0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onEscape: onQuitFullMenu, onOutsideClick: noop_1.noop, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, className: "css-reset", children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: noop_1.noop, onPreviousMenu: onQuitSubMenu, values: subMenu.items, onHide: noop_1.noop, leaveLeftSpace: subMenu.leaveLeftSpace, preselectIndex: subMenuActivated === 'without-mouse' &&
10
10
  typeof subMenu.preselectIndex === 'number'
11
11
  ? subMenu.preselectIndex
12
- : false, topItemCanBeUnselected: false }) }) }));
12
+ : false, topItemCanBeUnselected: false, fixedHeight: null }) }) }));
13
13
  };
14
14
  exports.SubMenuComponent = SubMenuComponent;
@@ -91,12 +91,27 @@ const Combobox = ({ values, selectedId, style: customStyle, title }) => {
91
91
  current.removeEventListener('click', onClick);
92
92
  };
93
93
  }, [refresh]);
94
+ const spaceToBottom = (0, react_1.useMemo)(() => {
95
+ const margin = 10;
96
+ if (size && opened) {
97
+ return size.windowSize.height - (size.top + size.height) - margin;
98
+ }
99
+ return 0;
100
+ }, [opened, size]);
101
+ const spaceToTop = (0, react_1.useMemo)(() => {
102
+ const margin = 10;
103
+ if (size && opened) {
104
+ return size.top - margin;
105
+ }
106
+ return 0;
107
+ }, [opened, size]);
108
+ const derivedMaxHeight = (0, react_1.useMemo)(() => {
109
+ return spaceToTop > spaceToBottom ? spaceToTop : spaceToBottom;
110
+ }, [spaceToBottom, spaceToTop]);
94
111
  const portalStyle = (0, react_1.useMemo)(() => {
95
112
  if (!opened || !size) {
96
113
  return null;
97
114
  }
98
- const spaceToBottom = size.windowSize.height - (size.top + size.height);
99
- const spaceToTop = size.top;
100
115
  const spaceToRight = size.windowSize.width - (size.left + size.width);
101
116
  const minSpaceToRightRequired = styles_1.MAX_MENU_WIDTH;
102
117
  const verticalLayout = spaceToTop > spaceToBottom ? 'bottom' : 'top';
@@ -119,7 +134,7 @@ const Combobox = ({ values, selectedId, style: customStyle, title }) => {
119
134
  right: size.windowSize.width - size.left - size.width,
120
135
  }),
121
136
  };
122
- }, [opened, size]);
137
+ }, [opened, size, spaceToBottom, spaceToTop]);
123
138
  const selected = values.find((v) => v.id === selectedId);
124
139
  const style = (0, react_1.useMemo)(() => {
125
140
  return {
@@ -138,7 +153,7 @@ const Combobox = ({ values, selectedId, style: customStyle, title }) => {
138
153
  };
139
154
  }, [customStyle, hovered, opened]);
140
155
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("button", { ref: ref, title: title, tabIndex: tabIndex, type: "button", style: style, className: is_menu_item_1.MENU_INITIATOR_CLASSNAME, children: [selected ? ((0, jsx_runtime_1.jsx)("div", { title: typeof selected.label === 'string' ? selected.label : undefined, style: label, children: selected === null || selected === void 0 ? void 0 : selected.label })) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), " ", (0, jsx_runtime_1.jsx)(caret_1.CaretDown, {})] }), portalStyle
141
- ? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { style: styles_1.fullScreenOverlay, children: (0, jsx_runtime_1.jsx)("div", { style: styles_1.outerPortal, className: "css-reset", children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: noop_1.noop, onPreviousMenu: noop_1.noop, values: values, onHide: onHide, leaveLeftSpace: true, preselectIndex: values.findIndex((v) => selected && v.id === selected.id), topItemCanBeUnselected: false }) }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
156
+ ? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { style: styles_1.fullScreenOverlay, children: (0, jsx_runtime_1.jsx)("div", { style: styles_1.outerPortal, className: "css-reset", children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: noop_1.noop, onPreviousMenu: noop_1.noop, values: values, onHide: onHide, leaveLeftSpace: true, preselectIndex: values.findIndex((v) => selected && v.id === selected.id), topItemCanBeUnselected: false, fixedHeight: derivedMaxHeight }) }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
142
157
  : null] }));
143
158
  };
144
159
  exports.Combobox = Combobox;
@@ -4,6 +4,7 @@ exports.InputDragger = 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 colors_1 = require("../../helpers/colors");
7
8
  const noop_1 = require("../../helpers/noop");
8
9
  const input_dragger_click_lock_1 = require("../../state/input-dragger-click-lock");
9
10
  const z_index_1 = require("../../state/z-index");
@@ -19,9 +20,9 @@ const InputDragger = ({ onValueChange, min: _min, max: _max, step: _step, value,
19
20
  };
20
21
  }, []);
21
22
  const span = (0, react_1.useMemo)(() => ({
22
- borderBottom: '1px dotted var(--blue)',
23
+ borderBottom: '1px dotted ' + colors_1.BLUE,
23
24
  paddingBottom: 1,
24
- color: 'var(--blue)',
25
+ color: colors_1.BLUE,
25
26
  cursor: 'ew-resize',
26
27
  userSelect: 'none',
27
28
  fontSize: 13,
@@ -8,4 +8,5 @@ export declare const MenuContent: React.FC<{
8
8
  leaveLeftSpace: boolean;
9
9
  preselectIndex: false | number;
10
10
  topItemCanBeUnselected: boolean;
11
+ fixedHeight: number | null;
11
12
  }>;
@@ -19,9 +19,8 @@ const container = {
19
19
  overflowX: 'hidden',
20
20
  minWidth: 200,
21
21
  maxWidth: styles_1.MAX_MENU_WIDTH,
22
- maxHeight: 600,
23
22
  };
24
- const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMenu, leaveLeftSpace, topItemCanBeUnselected, }) => {
23
+ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMenu, leaveLeftSpace, topItemCanBeUnselected, fixedHeight, }) => {
25
24
  const keybindings = (0, use_keybinding_1.useKeybinding)();
26
25
  const containerRef = (0, react_1.useRef)(null);
27
26
  const [subMenuActivated, setSubMenuActivated] = (0, react_1.useState)(false);
@@ -107,6 +106,15 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
107
106
  }
108
107
  setSubMenuActivated('without-mouse');
109
108
  }, [onNextMenu, selectedItem, values]);
109
+ const containerWithHeight = (0, react_1.useMemo)(() => {
110
+ if (fixedHeight === null) {
111
+ return { ...container, maxHeight: 600 };
112
+ }
113
+ return {
114
+ ...container,
115
+ maxHeight: fixedHeight,
116
+ };
117
+ }, [fixedHeight]);
110
118
  (0, react_1.useEffect)(() => {
111
119
  const escapeBinding = keybindings.registerKeybinding({
112
120
  event: 'keydown',
@@ -216,7 +224,7 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
216
224
  current.addEventListener('pointerleave', onPointerLeave);
217
225
  return () => current.removeEventListener('pointerleave', onPointerLeave);
218
226
  }, [onHide, subMenuActivated]);
219
- return ((0, jsx_runtime_1.jsx)("div", { ref: containerRef, style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: values.map((item) => {
227
+ return ((0, jsx_runtime_1.jsx)("div", { ref: containerRef, style: containerWithHeight, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: values.map((item) => {
220
228
  if (item.type === 'divider') {
221
229
  return (0, jsx_runtime_1.jsx)(MenuDivider_1.MenuDivider, {}, item.id);
222
230
  }
@@ -4,13 +4,14 @@ exports.EnforceAudioTrackSetting = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const Checkbox_1 = require("../Checkbox");
7
+ const layout_1 = require("../layout");
7
8
  const InfoBubble_1 = require("./InfoBubble");
8
- const layout_1 = require("./layout");
9
+ const layout_2 = require("./layout");
9
10
  const OptionExplainer_1 = require("./OptionExplainer");
10
11
  const EnforceAudioTrackSetting = ({ enforceAudioTrack, muted, setEnforceAudioTrack, option }) => {
11
12
  const onEnforceAudioTrackChanged = (0, react_1.useCallback)((e) => {
12
13
  setEnforceAudioTrack(e.target.checked);
13
14
  }, [setEnforceAudioTrack]);
14
- return ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: layout_1.label, children: ["Enforce Audio Track", (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: option }) })] }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { disabled: muted && !enforceAudioTrack, checked: enforceAudioTrack, onChange: onEnforceAudioTrackChanged }) })] }));
15
+ return ((0, jsx_runtime_1.jsxs)("div", { style: layout_2.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: layout_2.label, children: ["Enforce Audio Track", (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: option }) })] }), (0, jsx_runtime_1.jsx)("div", { style: layout_2.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { disabled: muted && !enforceAudioTrack, checked: enforceAudioTrack, onChange: onEnforceAudioTrackChanged }) })] }));
15
16
  };
16
17
  exports.EnforceAudioTrackSetting = EnforceAudioTrackSetting;
@@ -4,13 +4,14 @@ exports.MutedSetting = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const Checkbox_1 = require("../Checkbox");
7
+ const layout_1 = require("../layout");
7
8
  const InfoBubble_1 = require("./InfoBubble");
8
- const layout_1 = require("./layout");
9
+ const layout_2 = require("./layout");
9
10
  const OptionExplainer_1 = require("./OptionExplainer");
10
11
  const MutedSetting = ({ muted, setMuted, enforceAudioTrack, hint }) => {
11
12
  const onMutedChanged = (0, react_1.useCallback)((e) => {
12
13
  setMuted(e.target.checked);
13
14
  }, [setMuted]);
14
- return ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: layout_1.label, children: ["Muted", (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: hint }) })] }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: muted, disabled: enforceAudioTrack && !muted, onChange: onMutedChanged }) })] }));
15
+ return ((0, jsx_runtime_1.jsxs)("div", { style: layout_2.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: layout_2.label, children: ["Muted", (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: hint }) })] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.25 }), (0, jsx_runtime_1.jsx)("div", { style: layout_2.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: muted, disabled: enforceAudioTrack && !muted, onChange: onMutedChanged }) })] }));
15
16
  };
16
17
  exports.MutedSetting = MutedSetting;
@@ -31,7 +31,7 @@ export declare const RenderModal: React.FC<{
31
31
  initialGl: OpenGlRenderer | null;
32
32
  initialIgnoreCertificateErrors: boolean;
33
33
  initialHeadless: boolean;
34
- defaultProps: unknown;
34
+ defaultProps: Record<string, unknown>;
35
35
  inFrameMark: number | null;
36
36
  outFrameMark: number | null;
37
37
  }>;
@@ -16,6 +16,7 @@ const file_1 = require("../../icons/file");
16
16
  const frame_1 = require("../../icons/frame");
17
17
  const gear_1 = require("../../icons/gear");
18
18
  const gif_1 = require("../../icons/gif");
19
+ const colors_1 = require("../../helpers/colors");
19
20
  const modals_1 = require("../../state/modals");
20
21
  const sidebar_1 = require("../../state/sidebar");
21
22
  const is_menu_item_1 = require("../Menu/is-menu-item");
@@ -97,7 +98,7 @@ const icon = {
97
98
  height: 20,
98
99
  };
99
100
  const buttonStyle = {
100
- backgroundColor: 'var(--blue)',
101
+ backgroundColor: colors_1.BLUE,
101
102
  color: 'white',
102
103
  };
103
104
  const flexer = {
@@ -218,6 +219,9 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
218
219
  if (renderMode === 'video') {
219
220
  return enforceAudioTrackState;
220
221
  }
222
+ if (renderMode === 'audio') {
223
+ return enforceAudioTrackState;
224
+ }
221
225
  return false;
222
226
  }, [enforceAudioTrackState, renderMode]);
223
227
  const proResProfile = (0, react_1.useMemo)(() => {
@@ -587,9 +591,7 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
587
591
  }, [registerKeybinding, trigger]);
588
592
  return ((0, jsx_runtime_1.jsx)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: (0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: `Render ${compositionId}` }), (0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: renderTabOptions, needsWrapping: false }), (0, jsx_runtime_1.jsx)("div", { style: flexer }), (0, jsx_runtime_1.jsxs)(Button_1.Button, { autoFocus: true, onClick: trigger, disabled: renderDisabled, style: {
589
593
  ...buttonStyle,
590
- backgroundColor: outnameValidation.valid
591
- ? 'var(--blue)'
592
- : 'var(--blue-disabled)',
594
+ backgroundColor: outnameValidation.valid ? colors_1.BLUE : colors_1.BLUE_DISABLED,
593
595
  }, children: [state.type === 'idle' ? `Render ${renderMode}` : 'Rendering...', (0, jsx_runtime_1.jsx)(ShortcutHint_1.ShortcutHint, { keyToPress: "\u21B5", cmdOrCtrl: true })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: horizontalLayout, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftSidebar, children: [shownTabs.includes('general') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'general', onClick: () => setTab('general'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(file_1.FileIcon, { style: icon }) }), "General"] })) : null, shownTabs.includes('data') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'data', onClick: () => setTab('data'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(data_1.DataIcon, { style: icon }) }), "Input Props"] })) : null, shownTabs.includes('picture') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'picture', onClick: () => setTab('picture'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(frame_1.PicIcon, { style: icon }) }), "Picture"] })) : null, shownTabs.includes('audio') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'audio', onClick: () => setTab('audio'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(audio_1.AudioIcon, { style: icon }) }), "Audio"] })) : null, shownTabs.includes('gif') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'gif', onClick: () => setTab('gif'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gif_1.GifIcon, { style: icon }) }), "GIF"] })) : null, shownTabs.includes('advanced') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'advanced', onClick: () => setTab('advanced'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gear_1.GearIcon, { style: icon }) }), "Other"] })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: rightPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: tab === 'general' ? ((0, jsx_runtime_1.jsx)(RenderModalBasic_1.RenderModalBasic, { codec: codec, currentComposition: currentComposition, frame: frame, imageFormatOptions: imageFormatOptions, outName: outName, proResProfile: proResProfile, renderMode: renderMode, setVideoCodec: setCodec, setFrame: setFrame, setOutName: setOutName, setProResProfile: setProResProfile, endFrame: endFrame, setEndFrame: setEndFrame, setStartFrame: setStartFrame, startFrame: startFrame, validationMessage: outnameValidation.valid
594
596
  ? null
595
597
  : outnameValidation.error.message })) : tab === 'picture' ? ((0, jsx_runtime_1.jsx)(RenderModalPicture_1.RenderModalPicture, { renderMode: renderMode, scale: scale, setScale: setScale, pixelFormat: pixelFormat, setPixelFormat: setPixelFormat, imageFormatOptions: imageFormatOptions, crf: crf, setCrf: setCrf, customTargetVideoBitrate: customTargetVideoBitrate, maxCrf: maxCrf, minCrf: minCrf, jpegQuality: jpegQuality, qualityControlType: qualityControlType, setJpegQuality: setJpegQuality, setCustomTargetVideoBitrateValue: setCustomTargetVideoBitrateValue, setQualityControl: setQualityControl, videoImageFormat: videoImageFormat, stillImageFormat: stillImageFormat, shouldDisplayQualityControlPicker: supportsBothQualityControls })) : tab === 'audio' ? ((0, jsx_runtime_1.jsx)(RenderModalAudio_1.RenderModalAudio, { muted: muted, renderMode: renderMode, setMuted: setMuted, codec: codec, audioCodec: audioCodec, setAudioCodec: setAudioCodec, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrackState: setEnforceAudioTrackState, customTargetAudioBitrate: customTargetAudioBitrate, setCustomTargetAudioBitrateValue: setCustomTargetAudioBitrateValue, setShouldHaveCustomTargetAudioBitrate: setShouldHaveCustomTargetAudioBitrate, shouldHaveCustomTargetAudioBitrate: shouldHaveCustomTargetAudioBitrate })) : tab === 'gif' ? ((0, jsx_runtime_1.jsx)(RenderModalGif_1.RenderModalGif, { everyNthFrame: everyNthFrame, limitNumberOfGifLoops: limitNumberOfGifLoops, numberOfGifLoopsSetting: numberOfGifLoopsSetting, setEveryNthFrameSetting: setEveryNthFrameSetting, setLimitNumberOfGifLoops: setLimitNumberOfGifLoops, setNumberOfGifLoopsSetting: setNumberOfGifLoopsSetting })) : tab === 'data' ? ((0, jsx_runtime_1.jsx)(RenderModalData_1.RenderModalData, { inputProps: inputProps, setInputProps: setInputProps, composition: currentComposition, compact: false, mayShowSaveButton: false, propsEditType: "input-props" })) : ((0, jsx_runtime_1.jsx)(RenderModalAdvanced_1.RenderModalAdvanced, { concurrency: concurrency, maxConcurrency: maxConcurrency, minConcurrency: minConcurrency, renderMode: renderMode, setConcurrency: setConcurrency, setVerboseLogging: setVerboseLogging, verbose: verbose, delayRenderTimeout: delayRenderTimeout, setDelayRenderTimeout: setDelayRenderTimeout, disallowParallelEncoding: disallowParallelEncoding, setDisallowParallelEncoding: setDisallowParallelEncoding, setDisableWebSecurity: setDisableWebSecurity, setIgnoreCertificateErrors: setIgnoreCertificateErrors, setHeadless: setHeadless, headless: headless, ignoreCertificateErrors: ignoreCertificateErrors, disableWebSecurity: disableWebSecurity, openGlOption: openGlOption, setOpenGlOption: setOpenGlOption, setEnvVariables: setEnvVariables, envVariables: envVariables })) })] })] }) }));
@@ -51,10 +51,8 @@ const RenderModalAdvanced = ({ renderMode, maxConcurrency, minConcurrency, setCo
51
51
  });
52
52
  }, [extendedOpenGlOptions, openGlOption, setOpenGlOption]);
53
53
  return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: [renderMode === 'still' ? null : ((0, jsx_runtime_1.jsx)(NumberSetting_1.NumberSetting, { min: minConcurrency, max: maxConcurrency, step: 1, name: "Concurrency", formatter: (w) => `${w}x`, onValueChanged: setConcurrency, value: concurrency })), (0, jsx_runtime_1.jsx)(NumberSetting_1.NumberSetting
54
- // TODO: Should be right aligned
55
54
  // Also appears in packages/renderer/src/validate-puppeteer-timeout.ts
56
55
  , {
57
- // TODO: Should be right aligned
58
56
  // Also appears in packages/renderer/src/validate-puppeteer-timeout.ts
59
57
  min: 7000, max: 900000, name: "delayRender() timeout", onValueChanged: setDelayRenderTimeout, formatter: (w) => `${w}ms`, step: 1000, value: delayRenderTimeout }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "No parallel encoding" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: disallowParallelEncoding, onChange: onDisallowParallelEncodingChanged }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Verbose logging" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: verbose, onChange: onVerboseLoggingChanged }) })] }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Disable web security" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: disableWebSecurity, onChange: onDisableWebSecurityChanged }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Ignore certificate errors " }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: ignoreCertificateErrors, onChange: onIgnoreCertificatErrors }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Headless mode" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: headless, onChange: onHeadless }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "OpenGL render backend" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: openGlOptions, selectedId: openGlOption, title: "OpenGl option" }) })] }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}), (0, jsx_runtime_1.jsx)(RenderModalEnvironmentVariables_1.RenderModalEnvironmentVariables, { envVariables: envVariables, setEnvVariables: setEnvVariables })] }));
60
58
  };
@@ -41,6 +41,6 @@ const RenderModalAudio = ({ muted, setMuted, renderMode, enforceAudioTrack, setE
41
41
  };
42
42
  });
43
43
  }, [codec, setAudioCodec]);
44
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'video' && audioCodecOptions(codec).length >= 2 ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Audio Codec" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: audioCodecOptions(codec), selectedId: audioCodec, title: "AudioCodec" }) })] })) : null, renderMode === 'video' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(MutedSetting_1.MutedSetting, { enforceAudioTrack: enforceAudioTrack, muted: muted, setMuted: setMuted, hint: client_1.BrowserSafeApis.options.muteOption }), (0, jsx_runtime_1.jsx)(EnforceAudioTrackSetting_1.EnforceAudioTrackSetting, { muted: muted, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrack: setEnforceAudioTrackState, option: client_1.BrowserSafeApis.options.enforceAudioOption }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {})] })), renderMode === 'still' ? null : ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Custom audio bitrate" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: shouldHaveCustomTargetAudioBitrate, onChange: onShouldHaveTargetAudioBitrateChanged }) })] })), shouldHaveCustomTargetAudioBitrate && 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 audio 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.audioBitrateOption }) }), (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: customTargetAudioBitrate, onChange: onTargetAudioBitrateChanged, status: "ok", rightAlign: true }) }) })] })) : null] }));
44
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'video' && audioCodecOptions(codec).length >= 2 ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Audio Codec" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: audioCodecOptions(codec), selectedId: audioCodec, title: "AudioCodec" }) })] })) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsx)(MutedSetting_1.MutedSetting, { enforceAudioTrack: enforceAudioTrack, muted: muted, setMuted: setMuted, hint: client_1.BrowserSafeApis.options.muteOption })) : null, (renderMode === 'video' || renderMode === 'audio') && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EnforceAudioTrackSetting_1.EnforceAudioTrackSetting, { muted: muted, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrack: setEnforceAudioTrackState, option: client_1.BrowserSafeApis.options.enforceAudioOption }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {})] })), renderMode === 'still' ? null : ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Custom audio bitrate" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: shouldHaveCustomTargetAudioBitrate, onChange: onShouldHaveTargetAudioBitrateChanged }) })] })), shouldHaveCustomTargetAudioBitrate && 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 audio 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.audioBitrateOption }) }), (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: customTargetAudioBitrate, onChange: onTargetAudioBitrateChanged, status: "ok", rightAlign: true }) }) })] })) : null] }));
45
45
  };
46
46
  exports.RenderModalAudio = RenderModalAudio;
@@ -7,6 +7,7 @@ const react_1 = require("react");
7
7
  const prores_labels_1 = require("../../helpers/prores-labels");
8
8
  const use_file_existence_1 = require("../../helpers/use-file-existence");
9
9
  const Checkmark_1 = require("../../icons/Checkmark");
10
+ const layout_1 = require("../layout");
10
11
  const ComboBox_1 = require("../NewComposition/ComboBox");
11
12
  const InputDragger_1 = require("../NewComposition/InputDragger");
12
13
  const RemInput_1 = require("../NewComposition/RemInput");
@@ -14,7 +15,7 @@ const SegmentedControl_1 = require("../SegmentedControl");
14
15
  const FrameRangeSetting_1 = require("./FrameRangeSetting");
15
16
  const human_readable_codec_1 = require("./human-readable-codec");
16
17
  const InfoBubble_1 = require("./InfoBubble");
17
- const layout_1 = require("./layout");
18
+ const layout_2 = require("./layout");
18
19
  const OptionExplainer_1 = require("./OptionExplainer");
19
20
  const RenderModalInput_1 = require("./RenderModalInput");
20
21
  const container = {
@@ -74,6 +75,6 @@ const RenderModalBasic = ({ renderMode, imageFormatOptions, outName, codec, setV
74
75
  const onValueChange = (0, react_1.useCallback)((e) => {
75
76
  setOutName(e.target.value);
76
77
  }, [setOutName]);
77
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'still' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: true }) })] })) : ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: layout_1.label, children: ["Codec", (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.videoCodecOption }) })] }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: videoCodecOptions, selectedId: codec, title: "Codec" }) })] })), renderMode === 'still' && currentComposition.durationInFrames > 1 ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Frame" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(RemInput_1.RightAlignInput, { children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: frame, onTextChange: onFrameChanged, placeholder: `0-${currentComposition.durationInFrames - 1}`, onValueChange: onFrameSetDirectly, name: "frame", step: 1, min: 0, status: "ok", max: currentComposition.durationInFrames - 1, rightAlign: true }) }) })] })) : null, renderMode === 'video' && codec === 'prores' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "ProRes profile" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { title: proResProfile, selectedId: proResProfile, values: proResProfileOptions }) })] })) : null, renderMode === 'still' ? null : ((0, jsx_runtime_1.jsx)(FrameRangeSetting_1.FrameRangeSetting, { durationInFrames: currentComposition.durationInFrames, endFrame: endFrame, setEndFrame: setEndFrame, setStartFrame: setStartFrame, startFrame: startFrame })), (0, jsx_runtime_1.jsx)(RenderModalInput_1.RenderModalInput, { existence: existence, inputStyle: layout_1.input, outName: outName, onValueChange: onValueChange, validationMessage: validationMessage })] }));
78
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'still' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_2.label, children: "Format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_2.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: true }) })] })) : ((0, jsx_runtime_1.jsxs)("div", { style: layout_2.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: layout_2.label, children: ["Codec", (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (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.videoCodecOption }) })] }), (0, jsx_runtime_1.jsx)("div", { style: layout_2.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: videoCodecOptions, selectedId: codec, title: "Codec" }) })] })), renderMode === 'still' && currentComposition.durationInFrames > 1 ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_2.label, children: "Frame" }), (0, jsx_runtime_1.jsx)("div", { style: layout_2.rightRow, children: (0, jsx_runtime_1.jsx)(RemInput_1.RightAlignInput, { children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: frame, onTextChange: onFrameChanged, placeholder: `0-${currentComposition.durationInFrames - 1}`, onValueChange: onFrameSetDirectly, name: "frame", step: 1, min: 0, status: "ok", max: currentComposition.durationInFrames - 1, rightAlign: true }) }) })] })) : null, renderMode === 'video' && codec === 'prores' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_2.label, children: "ProRes profile" }), (0, jsx_runtime_1.jsx)("div", { style: layout_2.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { title: proResProfile, selectedId: proResProfile, values: proResProfileOptions }) })] })) : null, renderMode === 'still' ? null : ((0, jsx_runtime_1.jsx)(FrameRangeSetting_1.FrameRangeSetting, { durationInFrames: currentComposition.durationInFrames, endFrame: endFrame, setEndFrame: setEndFrame, setStartFrame: setStartFrame, startFrame: startFrame })), (0, jsx_runtime_1.jsx)(RenderModalInput_1.RenderModalInput, { existence: existence, inputStyle: layout_2.input, outName: outName, onValueChange: onValueChange, validationMessage: validationMessage })] }));
78
79
  };
79
80
  exports.RenderModalBasic = RenderModalBasic;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { AnyComposition } from 'remotion';
3
3
  export declare type State = {
4
4
  str: string;
5
- value: unknown;
5
+ value: Record<string, unknown>;
6
6
  validJSON: true;
7
7
  } | {
8
8
  str: string;
@@ -12,8 +12,8 @@ export declare type State = {
12
12
  export declare type PropsEditType = 'input-props' | 'default-props';
13
13
  export declare const RenderModalData: React.FC<{
14
14
  composition: AnyComposition;
15
- inputProps: unknown;
16
- setInputProps: React.Dispatch<React.SetStateAction<unknown>>;
15
+ inputProps: Record<string, unknown>;
16
+ setInputProps: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
17
17
  compact: boolean;
18
18
  mayShowSaveButton: boolean;
19
19
  propsEditType: PropsEditType;
@@ -105,7 +105,7 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
105
105
  if (!inJSONEditor) {
106
106
  return null;
107
107
  }
108
- const value = inputProps !== null && inputProps !== void 0 ? inputProps : {};
108
+ const value = inputProps;
109
109
  return (0, input_props_serialization_1.serializeJSONWithDate)({
110
110
  data: value,
111
111
  indent: 2,
@@ -122,7 +122,7 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
122
122
  return 'no-zod';
123
123
  }
124
124
  if (!composition.schema) {
125
- return z.any();
125
+ return z.object({});
126
126
  }
127
127
  if (!(typeof composition.schema.safeParse === 'function')) {
128
128
  throw new Error('A value which is not a Zod schema was passed to `schema`');
@@ -214,7 +214,11 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
214
214
  return;
215
215
  }
216
216
  setValBeforeSafe(inputProps);
217
- (0, actions_1.updateDefaultProps)(composition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []));
217
+ (0, actions_1.updateDefaultProps)(composition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).then((response) => {
218
+ if (!response.success) {
219
+ (0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: ' + response.reason);
220
+ }
221
+ });
218
222
  }, [composition.id, inputProps, schema, z]);
219
223
  (0, react_1.useEffect)(() => {
220
224
  setSaving(false);
@@ -225,7 +229,14 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
225
229
  return;
226
230
  }
227
231
  setSaving(true);
228
- (0, actions_1.updateDefaultProps)(composition.id, updater(composition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).catch((err) => {
232
+ (0, actions_1.updateDefaultProps)(composition.id, updater(composition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
233
+ .then((response) => {
234
+ if (!response.success) {
235
+ console.log(response.stack);
236
+ (0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${response.reason}. See console for more information.`);
237
+ }
238
+ })
239
+ .catch((err) => {
229
240
  (0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${err.message}`);
230
241
  setSaving(false);
231
242
  });
@@ -272,6 +283,6 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
272
283
  }
273
284
  return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: tabWrapper, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), warnings.length > 0 ? ((0, jsx_runtime_1.jsx)(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
274
285
  ? warnings.map((warning) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: warning, align: "flex-start", type: "warning" })] }, warning)))
275
- : null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps: composition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, zodValidationResult: zodValidationResult, switchToSchema: switchToSchema, onSave: onUpdate, valBeforeSafe: valBeforeSafe, showSaveButton: showSaveButton, serializedJSON: serializedJSON, parseJSON: parseJSON }))] }));
286
+ : null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps: composition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: !zodValidationResult.success })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, zodValidationResult: zodValidationResult, switchToSchema: switchToSchema, onSave: onUpdate, valBeforeSafe: valBeforeSafe, showSaveButton: showSaveButton, serializedJSON: serializedJSON, parseJSON: parseJSON }))] }));
276
287
  };
277
288
  exports.RenderModalData = RenderModalData;
@@ -4,7 +4,7 @@ import type { SerializedJSONWithCustomFields } from './SchemaEditor/input-props-
4
4
  export declare type EditType = 'inputProps' | 'defaultProps';
5
5
  export declare const RenderModalJSONPropsEditor: React.FC<{
6
6
  value: unknown;
7
- setValue: React.Dispatch<React.SetStateAction<unknown>>;
7
+ setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
8
8
  zodValidationResult: Zod.SafeParseReturnType<unknown, unknown>;
9
9
  switchToSchema: () => void;
10
10
  onSave: () => void;
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
- import type { z } from 'zod';
2
+ import type { AnyZodObject, z } from 'zod';
3
3
  export declare const SchemaEditor: React.FC<{
4
- schema: z.ZodTypeAny;
4
+ schema: AnyZodObject;
5
5
  value: unknown;
6
- setValue: React.Dispatch<React.SetStateAction<unknown>>;
6
+ setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
7
7
  zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
8
8
  compact: boolean;
9
- defaultProps: unknown;
9
+ defaultProps: Record<string, unknown>;
10
10
  onSave: (updater: (oldState: unknown) => unknown) => void;
11
11
  showSaveButton: boolean;
12
12
  saving: boolean;
13
+ saveDisabledByParent: boolean;
13
14
  }>;
@@ -13,7 +13,7 @@ const scrollable = {
13
13
  flexDirection: 'column',
14
14
  overflowY: 'auto',
15
15
  };
16
- const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, defaultProps, onSave, showSaveButton, saving, }) => {
16
+ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, defaultProps, onSave, showSaveButton, saving, saveDisabledByParent, }) => {
17
17
  const z = (0, get_zod_if_possible_1.useZodIfPossible)();
18
18
  if (!z) {
19
19
  throw new Error('expected zod');
@@ -31,9 +31,9 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, d
31
31
  }
32
32
  return ((0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.InvalidSchema, { reset: reset, zodValidationResult: zodValidationResult }));
33
33
  }
34
- if (typeName === z.ZodFirstPartyTypeKind.ZodObject) {
35
- 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, saving: saving }) }));
34
+ if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
35
+ return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
36
36
  }
37
- return null;
37
+ 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, saving: saving, saveDisabledByParent: saveDisabledByParent }) }));
38
38
  };
39
39
  exports.SchemaEditor = SchemaEditor;
@@ -10,3 +10,6 @@ export declare const InvalidSchema: React.FC<{
10
10
  zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
11
11
  reset: () => void;
12
12
  }>;
13
+ export declare const TopLevelZodValue: React.FC<{
14
+ typeReceived: string;
15
+ }>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InvalidSchema = exports.InvalidDefaultProps = exports.NoDefaultProps = exports.NoSchemaDefined = exports.ZodNotInstalled = void 0;
3
+ exports.TopLevelZodValue = exports.InvalidSchema = exports.InvalidDefaultProps = exports.NoDefaultProps = exports.NoSchemaDefined = exports.ZodNotInstalled = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const Button_1 = require("../../../../preview-server/error-overlay/remotion-overlay/Button");
6
6
  const colors_1 = require("../../../helpers/colors");
@@ -24,7 +24,7 @@ const errorExplanation = {
24
24
  };
25
25
  const codeSnippet = {
26
26
  fontSize: 14,
27
- color: 'var(--blue)',
27
+ color: colors_1.BLUE,
28
28
  fontFamily: 'monospace',
29
29
  };
30
30
  const errorContainer = {
@@ -57,3 +57,7 @@ const InvalidSchema = ({ zodValidationResult, reset }) => {
57
57
  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", { style: codeSnippet, 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" })] }));
58
58
  };
59
59
  exports.InvalidSchema = InvalidSchema;
60
+ const TopLevelZodValue = ({ typeReceived }) => {
61
+ return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The top-level type of the schema must be a pure", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "z.object" }), ". Instead got a schema of type", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: typeReceived })] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema by changing the top-level Zod type to an object." }), (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" })] }));
62
+ };
63
+ exports.TopLevelZodValue = TopLevelZodValue;
@@ -9,8 +9,12 @@ export declare const SchemaLabel: React.FC<{
9
9
  showSaveButton: boolean;
10
10
  compact: boolean;
11
11
  saving: boolean;
12
+ valid: boolean;
13
+ saveDisabledByParent: boolean;
12
14
  }>;
13
15
  export declare const SchemaFieldsetLabel: React.FC<{
14
16
  jsonPath: JSONPath;
15
17
  onRemove: null | (() => void);
18
+ isDefaultValue: boolean;
19
+ onReset: () => void;
16
20
  }>;
@@ -30,11 +30,12 @@ const labelStyle = {
30
30
  color: colors_1.LIGHT_TEXT,
31
31
  lineHeight: '40px',
32
32
  };
33
- const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton, compact, onRemove, saving, }) => {
34
- return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? compactStyles : wideStyles, children: [(0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: (0, get_schema_label_1.getSchemaLabel)(jsonPath) }), compact ? (0, jsx_runtime_1.jsx)(layout_1.Flex, {}) : (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), isDefaultValue ? null : (0, jsx_runtime_1.jsx)(SchemaResetButton_1.SchemaResetButton, { onClick: onReset }), isDefaultValue ? null : showSaveButton ? ((0, jsx_runtime_1.jsx)(SchemaSaveButton_1.SchemaSaveButton, { onClick: onSave, isSaving: saving })) : null, onRemove ? (0, jsx_runtime_1.jsx)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove }) : null] }));
33
+ const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton, compact, onRemove, saving, valid, saveDisabledByParent, }) => {
34
+ const disableSave = saving || !valid || saveDisabledByParent;
35
+ return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? compactStyles : wideStyles, children: [(0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: (0, get_schema_label_1.getSchemaLabel)(jsonPath) }), compact ? (0, jsx_runtime_1.jsx)(layout_1.Flex, {}) : (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), isDefaultValue ? null : (0, jsx_runtime_1.jsx)(SchemaResetButton_1.SchemaResetButton, { onClick: onReset }), isDefaultValue ? null : showSaveButton ? ((0, jsx_runtime_1.jsx)(SchemaSaveButton_1.SchemaSaveButton, { onClick: onSave, disabled: disableSave })) : null, onRemove ? (0, jsx_runtime_1.jsx)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove }) : null] }));
35
36
  };
36
37
  exports.SchemaLabel = SchemaLabel;
37
- const SchemaFieldsetLabel = ({ jsonPath, onRemove }) => {
38
- return ((0, jsx_runtime_1.jsxs)("legend", { style: layout_2.fieldsetLabel, children: [(0, get_schema_label_1.getSchemaLabel)(jsonPath), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), onRemove ? ((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)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove })] })) : null] }));
38
+ const SchemaFieldsetLabel = ({ jsonPath, onRemove, isDefaultValue, onReset }) => {
39
+ return ((0, jsx_runtime_1.jsxs)("legend", { style: layout_2.fieldsetLabel, children: [(0, get_schema_label_1.getSchemaLabel)(jsonPath), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), isDefaultValue ? null : (0, jsx_runtime_1.jsx)(SchemaResetButton_1.SchemaResetButton, { onClick: onReset }), onRemove ? ((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)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove })] })) : null] }));
39
40
  };
40
41
  exports.SchemaFieldsetLabel = SchemaFieldsetLabel;