@remotion/studio 4.0.477 → 4.0.479

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 (191) hide show
  1. package/dist/components/AssetSelector.js +8 -14
  2. package/dist/components/Button.d.ts +1 -0
  3. package/dist/components/Button.js +8 -5
  4. package/dist/components/CanvasIfSizeIsAvailable.js +2 -6
  5. package/dist/components/CompactExplanation.d.ts +12 -0
  6. package/dist/components/CompactExplanation.js +52 -0
  7. package/dist/components/CompositionSelector.js +2 -4
  8. package/dist/components/CurrentAsset.d.ts +3 -1
  9. package/dist/components/CurrentAsset.js +42 -34
  10. package/dist/components/CurrentComposition.d.ts +1 -1
  11. package/dist/components/CurrentComposition.js +38 -31
  12. package/dist/components/DefaultPropsEditor.d.ts +12 -2
  13. package/dist/components/DefaultPropsEditor.js +2 -2
  14. package/dist/components/EditorGuides/Guide.js +37 -9
  15. package/dist/components/EditorRuler/Ruler.js +4 -14
  16. package/dist/components/EditorRuler/index.js +9 -4
  17. package/dist/components/EffectPickerModal.d.ts +5 -0
  18. package/dist/components/EffectPickerModal.js +179 -0
  19. package/dist/components/InlineAction.js +1 -0
  20. package/dist/components/InspectorInfoHeader.d.ts +11 -0
  21. package/dist/components/InspectorInfoHeader.js +55 -0
  22. package/dist/components/InspectorPanel/DefaultInspector.d.ts +8 -0
  23. package/dist/components/InspectorPanel/DefaultInspector.js +93 -0
  24. package/dist/components/InspectorPanel/EasingInspector.d.ts +5 -0
  25. package/dist/components/InspectorPanel/EasingInspector.js +41 -0
  26. package/dist/components/InspectorPanel/GuideInspector.d.ts +7 -0
  27. package/dist/components/InspectorPanel/GuideInspector.js +55 -0
  28. package/dist/components/InspectorPanel/KeyframeInspector.d.ts +7 -0
  29. package/dist/components/InspectorPanel/KeyframeInspector.js +109 -0
  30. package/dist/components/InspectorPanel/SelectedInspector.d.ts +5 -0
  31. package/dist/components/InspectorPanel/SelectedInspector.js +26 -0
  32. package/dist/components/InspectorPanel/SequenceSelectionInspector.d.ts +5 -0
  33. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +116 -0
  34. package/dist/components/InspectorPanel/common.d.ts +15 -0
  35. package/dist/components/InspectorPanel/common.js +18 -0
  36. package/dist/components/InspectorPanel/inspector-selection.d.ts +10 -0
  37. package/dist/components/InspectorPanel/inspector-selection.js +34 -0
  38. package/dist/components/InspectorPanel/styles.d.ts +27 -0
  39. package/dist/components/InspectorPanel/styles.js +178 -0
  40. package/dist/components/InspectorPanel/use-track-for-selection.d.ts +2 -0
  41. package/dist/components/InspectorPanel/use-track-for-selection.js +22 -0
  42. package/dist/components/InspectorPanel.d.ts +8 -0
  43. package/dist/components/InspectorPanel.js +26 -0
  44. package/dist/components/InspectorPanelLayout.d.ts +1 -0
  45. package/dist/components/InspectorPanelLayout.js +4 -0
  46. package/dist/components/InspectorSequenceSection.d.ts +16 -0
  47. package/dist/components/InspectorSequenceSection.js +147 -0
  48. package/dist/components/InspectorSourceLocation.d.ts +7 -0
  49. package/dist/components/InspectorSourceLocation.js +71 -0
  50. package/dist/components/MenuToolbar.d.ts +1 -0
  51. package/dist/components/MenuToolbar.js +4 -1
  52. package/dist/components/Modals.js +3 -3
  53. package/dist/components/NewComposition/InputDragger.js +1 -1
  54. package/dist/components/NewComposition/RemInput.d.ts +1 -0
  55. package/dist/components/NewComposition/RemInput.js +8 -2
  56. package/dist/components/NewComposition/RemTextarea.d.ts +1 -0
  57. package/dist/components/NewComposition/RemTextarea.js +8 -2
  58. package/dist/components/NewComposition/ValidationMessage.d.ts +3 -0
  59. package/dist/components/NewComposition/ValidationMessage.js +16 -5
  60. package/dist/components/OptionsPanel.d.ts +1 -1
  61. package/dist/components/OptionsPanel.js +8 -17
  62. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +2 -7
  63. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +3 -10
  64. package/dist/components/QuickSwitcher/shared.d.ts +4 -0
  65. package/dist/components/QuickSwitcher/shared.js +24 -0
  66. package/dist/components/RenderModal/DataEditor.d.ts +29 -2
  67. package/dist/components/RenderModal/DataEditor.js +107 -56
  68. package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -0
  69. package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +25 -7
  70. package/dist/components/RenderModal/SchemaEditor/Fieldset.d.ts +2 -1
  71. package/dist/components/RenderModal/SchemaEditor/Fieldset.js +10 -5
  72. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +4 -0
  73. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +27 -4
  74. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +12 -4
  75. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +23 -9
  76. package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +3 -3
  77. package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +8 -1
  78. package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +1 -1
  79. package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
  80. package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +1 -1
  81. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
  82. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +1 -0
  83. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +23 -6
  84. package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +2 -2
  85. package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +2 -1
  86. package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
  87. package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +9 -11
  88. package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +1 -1
  89. package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
  90. package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
  91. package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +1 -1
  92. package/dist/components/RenderModal/WarningIndicatorButton.d.ts +1 -0
  93. package/dist/components/RenderModal/WarningIndicatorButton.js +17 -4
  94. package/dist/components/RenderModal/get-render-modal-warnings.d.ts +2 -1
  95. package/dist/components/RenderModal/get-render-modal-warnings.js +6 -3
  96. package/dist/components/RendersTab.js +1 -1
  97. package/dist/components/SegmentedControl.d.ts +3 -0
  98. package/dist/components/SegmentedControl.js +11 -5
  99. package/dist/components/SelectedOutlineElement.js +135 -31
  100. package/dist/components/SelectedOutlineOverlay.d.ts +1 -1
  101. package/dist/components/SelectedOutlineOverlay.js +45 -29
  102. package/dist/components/SelectedOutlineUvControls.d.ts +9 -0
  103. package/dist/components/SelectedOutlineUvControls.js +64 -10
  104. package/dist/components/Tabs/index.js +4 -4
  105. package/dist/components/Timeline/EasingEditorModal.d.ts +5 -4
  106. package/dist/components/Timeline/EasingEditorModal.js +597 -124
  107. package/dist/components/Timeline/KeyframeSettingsModal.d.ts +2 -2
  108. package/dist/components/Timeline/SubscribeToNodePaths.d.ts +2 -2
  109. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +15 -3
  110. package/dist/components/Timeline/TimelineClipboardKeybindings.js +85 -1
  111. package/dist/components/Timeline/TimelineDeleteKeybindings.js +10 -3
  112. package/dist/components/Timeline/TimelineEffectItem.d.ts +2 -2
  113. package/dist/components/Timeline/TimelineEffectPropItem.d.ts +8 -0
  114. package/dist/components/Timeline/TimelineEffectPropItem.js +24 -20
  115. package/dist/components/Timeline/TimelineExpandedRow.d.ts +5 -2
  116. package/dist/components/Timeline/TimelineExpandedRow.js +4 -4
  117. package/dist/components/Timeline/TimelineExpandedSection.d.ts +1 -1
  118. package/dist/components/Timeline/TimelineExpandedSection.js +5 -19
  119. package/dist/components/Timeline/TimelineKeyframeControls.d.ts +8 -2
  120. package/dist/components/Timeline/TimelineKeyframeControls.js +24 -3
  121. package/dist/components/Timeline/TimelineKeyframeEasingLine.js +2 -47
  122. package/dist/components/Timeline/TimelineKeyframedValue.d.ts +1 -1
  123. package/dist/components/Timeline/TimelineKeyframedValue.js +8 -10
  124. package/dist/components/Timeline/TimelineNumberField.js +5 -11
  125. package/dist/components/Timeline/TimelineRotationField.js +5 -6
  126. package/dist/components/Timeline/TimelineScaleField.js +4 -8
  127. package/dist/components/Timeline/TimelineSelection.d.ts +6 -0
  128. package/dist/components/Timeline/TimelineSelection.js +109 -14
  129. package/dist/components/Timeline/TimelineSequence.js +22 -14
  130. package/dist/components/Timeline/TimelineSequenceItem.js +12 -67
  131. package/dist/components/Timeline/TimelineSequencePropItem.d.ts +12 -2
  132. package/dist/components/Timeline/TimelineSequencePropItem.js +56 -52
  133. package/dist/components/Timeline/TimelineTransformOriginField.js +4 -5
  134. package/dist/components/Timeline/TimelineTranslateField.js +4 -5
  135. package/dist/components/Timeline/TimelineUvCoordinateField.js +4 -4
  136. package/dist/components/Timeline/TimelineVideoInfo.d.ts +1 -0
  137. package/dist/components/Timeline/TimelineVideoInfo.js +93 -8
  138. package/dist/components/Timeline/call-add-keyframe.d.ts +4 -4
  139. package/dist/components/Timeline/call-delete-keyframe.d.ts +4 -4
  140. package/dist/components/Timeline/call-move-keyframe.d.ts +2 -2
  141. package/dist/components/Timeline/call-update-keyframe-settings.d.ts +3 -3
  142. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +2 -1
  143. package/dist/components/Timeline/delete-selected-timeline-item.js +27 -1
  144. package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +7 -0
  145. package/dist/components/Timeline/duplicate-selected-timeline-item.js +32 -3
  146. package/dist/components/Timeline/parse-keyframe-field-from-node-path.js +2 -2
  147. package/dist/components/Timeline/reset-selected-timeline-props.d.ts +3 -3
  148. package/dist/components/Timeline/reset-selected-timeline-props.js +19 -5
  149. package/dist/components/Timeline/save-effect-prop.d.ts +2 -2
  150. package/dist/components/Timeline/save-sequence-prop.d.ts +2 -2
  151. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +3 -3
  152. package/dist/components/Timeline/timeline-field-display-utils.d.ts +5 -0
  153. package/dist/components/Timeline/timeline-field-display-utils.js +244 -0
  154. package/dist/components/Timeline/timeline-video-filmstrip-times.d.ts +17 -0
  155. package/dist/components/Timeline/timeline-video-filmstrip-times.js +22 -0
  156. package/dist/components/Timeline/update-selected-easing.d.ts +47 -4
  157. package/dist/components/Timeline/update-selected-easing.js +40 -9
  158. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +13 -0
  159. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +73 -0
  160. package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -3
  161. package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +11 -0
  162. package/dist/components/Timeline/use-timeline-expanded-tree.js +33 -0
  163. package/dist/components/VisualControls/VisualControlsContent.d.ts +1 -1
  164. package/dist/components/VisualControls/VisualControlsContent.js +4 -5
  165. package/dist/components/effect-drag-and-drop.d.ts +10 -0
  166. package/dist/components/effect-drag-and-drop.js +17 -8
  167. package/dist/components/effect-picker-search.d.ts +5 -0
  168. package/dist/components/effect-picker-search.js +77 -0
  169. package/dist/components/import-assets.d.ts +11 -2
  170. package/dist/components/import-assets.js +61 -6
  171. package/dist/components/selected-outline-drag.d.ts +44 -2
  172. package/dist/components/selected-outline-drag.js +74 -1
  173. package/dist/components/selected-outline-types.d.ts +7 -7
  174. package/dist/components/selected-outline-uv.d.ts +4 -3
  175. package/dist/components/selected-outline-uv.js +6 -2
  176. package/dist/error-overlay/remotion-overlay/Overlay.js +3 -0
  177. package/dist/esm/{chunk-t8fjnw2d.js → chunk-fge2mq5p.js} +17004 -13432
  178. package/dist/esm/internals.mjs +17004 -13432
  179. package/dist/esm/previewEntry.mjs +26617 -23041
  180. package/dist/esm/renderEntry.mjs +1 -1
  181. package/dist/helpers/editor-guide-selection.js +1 -1
  182. package/dist/helpers/get-preview-file-type.js +1 -1
  183. package/dist/helpers/render-codec-label.d.ts +2 -0
  184. package/dist/helpers/render-codec-label.js +49 -0
  185. package/dist/helpers/ruler-canvas-size.d.ts +5 -0
  186. package/dist/helpers/ruler-canvas-size.js +17 -0
  187. package/dist/helpers/timeline-layout.d.ts +4 -4
  188. package/dist/helpers/use-media-metadata.d.ts +8 -2
  189. package/dist/helpers/use-media-metadata.js +17 -4
  190. package/dist/state/modals.d.ts +9 -4
  191. package/package.json +12 -12
@@ -1,8 +1,11 @@
1
1
  import React from 'react';
2
- import type { _InternalTypes } from 'remotion';
3
- import type { TypeCanSaveState } from './get-render-modal-warnings';
2
+ import type { _InternalTypes, SerializedJSONWithCustomFields } from 'remotion';
3
+ import type { RenderModalWarning, TypeCanSaveState } from './get-render-modal-warnings';
4
+ import { type SchemaErrorMode } from './SchemaEditor/SchemaErrorMessages';
4
5
  import type { ZodSafeParseResult } from './SchemaEditor/zod-schema-type';
5
6
  import type { UpdaterFunction } from './SchemaEditor/ZodSwitch';
7
+ export type { RenderModalWarning };
8
+ export type DataEditorMode = 'json' | 'schema';
6
9
  export type State = {
7
10
  str: string;
8
11
  value: Record<string, unknown>;
@@ -14,10 +17,34 @@ export type State = {
14
17
  error: string;
15
18
  };
16
19
  export type PropsEditType = 'input-props' | 'default-props';
20
+ export type DataEditorLayout = 'default' | 'inspector';
21
+ export declare const useDataEditorWarnings: ({ canSaveDefaultProps, defaultProps, mode, propsEditType, showCannotSaveDefaultPropsWarning, }: {
22
+ readonly canSaveDefaultProps: TypeCanSaveState | null;
23
+ readonly defaultProps: Record<string, unknown>;
24
+ readonly mode: DataEditorMode;
25
+ readonly propsEditType: PropsEditType;
26
+ readonly showCannotSaveDefaultPropsWarning: boolean;
27
+ }) => {
28
+ serializedJSON: SerializedJSONWithCustomFields | null;
29
+ warnings: RenderModalWarning[];
30
+ };
31
+ export declare const useDataEditorWarningVisibility: () => {
32
+ setShowWarning: React.Dispatch<React.SetStateAction<boolean>>;
33
+ showWarning: boolean;
34
+ };
17
35
  export declare const DataEditor: React.FC<{
18
36
  readonly unresolvedComposition: _InternalTypes['AnyComposition'];
19
37
  readonly defaultProps: Record<string, unknown>;
20
38
  readonly setDefaultProps: UpdaterFunction<Record<string, unknown>>;
21
39
  readonly propsEditType: PropsEditType;
22
40
  readonly canSaveDefaultProps: TypeCanSaveState | null;
41
+ readonly schemaErrorMode?: SchemaErrorMode;
42
+ readonly layout?: DataEditorLayout;
43
+ readonly mode?: DataEditorMode;
44
+ readonly onModeChange?: (mode: DataEditorMode) => void;
45
+ readonly hideModeControls?: boolean;
46
+ readonly warnings?: RenderModalWarning[];
47
+ readonly showWarning?: boolean;
48
+ readonly setShowWarning?: React.Dispatch<React.SetStateAction<boolean>>;
49
+ readonly hideWarningButton?: boolean;
23
50
  }>;
@@ -33,14 +33,16 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.DataEditor = void 0;
36
+ exports.DataEditor = exports.useDataEditorWarningVisibility = exports.useDataEditorWarnings = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const react_1 = __importStar(require("react"));
39
39
  const remotion_1 = require("remotion");
40
40
  const no_react_1 = require("remotion/no-react");
41
41
  const client_id_1 = require("../../helpers/client-id");
42
42
  const colors_1 = require("../../helpers/colors");
43
+ const CompactExplanation_1 = require("../CompactExplanation");
43
44
  const get_zod_if_possible_1 = require("../get-zod-if-possible");
45
+ const InspectorPanelLayout_1 = require("../InspectorPanelLayout");
44
46
  const layout_1 = require("../layout");
45
47
  const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
46
48
  const SegmentedControl_1 = require("../SegmentedControl");
@@ -60,10 +62,9 @@ const explainer = {
60
62
  display: 'flex',
61
63
  flex: 1,
62
64
  flexDirection: 'column',
63
- padding: '0 12px',
64
- justifyContent: 'center',
65
- alignItems: 'center',
66
- textAlign: 'center',
65
+ padding: 12,
66
+ alignItems: 'flex-start',
67
+ textAlign: 'left',
67
68
  };
68
69
  const outer = {
69
70
  display: 'flex',
@@ -72,12 +73,21 @@ const outer = {
72
73
  overflow: 'hidden',
73
74
  backgroundColor: colors_1.BACKGROUND,
74
75
  };
76
+ const inspectorOuter = {
77
+ ...outer,
78
+ flex: 'none',
79
+ overflow: 'visible',
80
+ };
75
81
  const controlContainer = {
76
82
  flexDirection: 'column',
77
83
  display: 'flex',
78
84
  padding: 12,
79
85
  borderBottom: `1px solid ${colors_1.BORDER_COLOR}`,
80
86
  };
87
+ const inspectorControlContainer = {
88
+ ...controlContainer,
89
+ borderBottom: 'none',
90
+ };
81
91
  const tabWrapper = {
82
92
  display: 'flex',
83
93
  marginBottom: '4px',
@@ -91,6 +101,10 @@ const resolveLinkStyle = {
91
101
  textDecoration: 'underline',
92
102
  whiteSpace: 'nowrap',
93
103
  };
104
+ const compactResolveLinkStyle = {
105
+ ...resolveLinkStyle,
106
+ fontSize: 12,
107
+ };
94
108
  const persistanceKey = 'remotion.show-render-modalwarning';
95
109
  const getPersistedShowWarningState = () => {
96
110
  const val = localStorage.getItem(persistanceKey);
@@ -102,28 +116,85 @@ const getPersistedShowWarningState = () => {
102
116
  const setPersistedShowWarningState = (val) => {
103
117
  localStorage.setItem(persistanceKey, String(Boolean(val)));
104
118
  };
105
- const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, propsEditType, canSaveDefaultProps, }) => {
106
- const [mode, setMode] = (0, react_1.useState)('schema');
107
- const [showWarning, setShowWarningWithoutPersistance] = (0, react_1.useState)(() => getPersistedShowWarningState());
108
- const jsonEditorSetValue = (0, react_1.useCallback)((newProps) => {
109
- setDefaultProps(typeof newProps === 'function' ? newProps : () => newProps, { shouldSave: false });
110
- }, [setDefaultProps]);
111
- const onSave = (0, react_1.useCallback)(() => {
112
- setDefaultProps((p) => p, { shouldSave: true });
113
- }, [setDefaultProps]);
119
+ const useDataEditorWarnings = ({ canSaveDefaultProps, defaultProps, mode, propsEditType, showCannotSaveDefaultPropsWarning, }) => {
114
120
  const inJSONEditor = mode === 'json';
115
121
  const serializedJSON = (0, react_1.useMemo)(() => {
116
122
  if (!inJSONEditor) {
117
123
  return null;
118
124
  }
119
- const value = defaultProps;
120
125
  return no_react_1.NoReactInternals.serializeJSONWithSpecialTypes({
121
- data: value,
126
+ data: defaultProps,
122
127
  indent: 2,
123
128
  staticBase: window.remotion_staticBase,
124
129
  });
125
130
  }, [inJSONEditor, defaultProps]);
126
131
  const cliProps = (0, remotion_1.getInputProps)();
132
+ const warnings = (0, react_1.useMemo)(() => {
133
+ return (0, get_render_modal_warnings_1.getRenderModalWarnings)({
134
+ canSaveDefaultProps,
135
+ cliProps,
136
+ isCustomDateUsed: serializedJSON ? serializedJSON.customDateUsed : false,
137
+ customFileUsed: serializedJSON ? serializedJSON.customFileUsed : false,
138
+ inJSONEditor,
139
+ propsEditType,
140
+ jsMapUsed: serializedJSON ? serializedJSON.mapUsed : false,
141
+ jsSetUsed: serializedJSON ? serializedJSON.setUsed : false,
142
+ showCannotSaveDefaultPropsWarning,
143
+ });
144
+ }, [
145
+ cliProps,
146
+ canSaveDefaultProps,
147
+ inJSONEditor,
148
+ propsEditType,
149
+ serializedJSON,
150
+ showCannotSaveDefaultPropsWarning,
151
+ ]);
152
+ return { serializedJSON, warnings };
153
+ };
154
+ exports.useDataEditorWarnings = useDataEditorWarnings;
155
+ const useDataEditorWarningVisibility = () => {
156
+ const [showWarning, setShowWarningWithoutPersistance] = (0, react_1.useState)(() => getPersistedShowWarningState());
157
+ const setShowWarning = (0, react_1.useCallback)((val) => {
158
+ setShowWarningWithoutPersistance((prevVal) => {
159
+ if (typeof val === 'boolean') {
160
+ setPersistedShowWarningState(val);
161
+ return val;
162
+ }
163
+ const nextVal = val(prevVal);
164
+ setPersistedShowWarningState(nextVal);
165
+ return nextVal;
166
+ });
167
+ }, []);
168
+ return { setShowWarning, showWarning };
169
+ };
170
+ exports.useDataEditorWarningVisibility = useDataEditorWarningVisibility;
171
+ const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, propsEditType, canSaveDefaultProps, schemaErrorMode = 'full', layout = 'default', mode: controlledMode, onModeChange, hideModeControls = false, warnings: controlledWarnings, showWarning: controlledShowWarning, setShowWarning: controlledSetShowWarning, hideWarningButton = false, }) => {
172
+ const [internalMode, setInternalMode] = (0, react_1.useState)('schema');
173
+ const mode = controlledMode !== null && controlledMode !== void 0 ? controlledMode : internalMode;
174
+ const setMode = (0, react_1.useCallback)((nextMode) => {
175
+ if (onModeChange) {
176
+ onModeChange(nextMode);
177
+ return;
178
+ }
179
+ setInternalMode(nextMode);
180
+ }, [onModeChange]);
181
+ const { setShowWarning: internalSetShowWarning, showWarning: internalShowWarning, } = (0, exports.useDataEditorWarningVisibility)();
182
+ const showWarning = controlledShowWarning !== null && controlledShowWarning !== void 0 ? controlledShowWarning : internalShowWarning;
183
+ const setShowWarning = controlledSetShowWarning !== null && controlledSetShowWarning !== void 0 ? controlledSetShowWarning : internalSetShowWarning;
184
+ const { serializedJSON, warnings: computedWarnings } = (0, exports.useDataEditorWarnings)({
185
+ canSaveDefaultProps,
186
+ defaultProps,
187
+ mode,
188
+ propsEditType,
189
+ showCannotSaveDefaultPropsWarning: true,
190
+ });
191
+ const warnings = controlledWarnings !== null && controlledWarnings !== void 0 ? controlledWarnings : computedWarnings;
192
+ const jsonEditorSetValue = (0, react_1.useCallback)((newProps) => {
193
+ setDefaultProps(typeof newProps === 'function' ? newProps : () => newProps, { shouldSave: false });
194
+ }, [setDefaultProps]);
195
+ const onSave = (0, react_1.useCallback)(() => {
196
+ setDefaultProps((p) => p, { shouldSave: true });
197
+ }, [setDefaultProps]);
127
198
  const z = (0, get_zod_if_possible_1.useZodIfPossible)();
128
199
  const schema = (0, react_1.useMemo)(() => {
129
200
  if (!z) {
@@ -147,16 +218,6 @@ const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, prop
147
218
  }
148
219
  return (0, zod_schema_type_1.zodSafeParse)(schema, defaultProps);
149
220
  }, [defaultProps, schema]);
150
- const setShowWarning = (0, react_1.useCallback)((val) => {
151
- setShowWarningWithoutPersistance((prevVal) => {
152
- if (typeof val === 'boolean') {
153
- setPersistedShowWarningState(val);
154
- return val;
155
- }
156
- setPersistedShowWarningState(val(prevVal));
157
- return val(prevVal);
158
- });
159
- }, []);
160
221
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
161
222
  const modeItems = (0, react_1.useMemo)(() => {
162
223
  return [
@@ -177,36 +238,22 @@ const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, prop
177
238
  selected: mode === 'json',
178
239
  },
179
240
  ];
180
- }, [mode]);
241
+ }, [mode, setMode]);
181
242
  const connectionStatus = previewServerState.type;
182
- const warnings = (0, react_1.useMemo)(() => {
183
- return (0, get_render_modal_warnings_1.getRenderModalWarnings)({
184
- canSaveDefaultProps,
185
- cliProps,
186
- isCustomDateUsed: serializedJSON ? serializedJSON.customDateUsed : false,
187
- customFileUsed: serializedJSON ? serializedJSON.customFileUsed : false,
188
- inJSONEditor,
189
- propsEditType,
190
- jsMapUsed: serializedJSON ? serializedJSON.mapUsed : false,
191
- jsSetUsed: serializedJSON ? serializedJSON.setUsed : false,
192
- });
193
- }, [
194
- cliProps,
195
- canSaveDefaultProps,
196
- inJSONEditor,
197
- propsEditType,
198
- serializedJSON,
199
- ]);
200
243
  if (connectionStatus === 'disconnected') {
244
+ const message = 'The studio server has disconnected. Reconnect to edit the schema.';
245
+ if (schemaErrorMode === 'compact') {
246
+ return jsx_runtime_1.jsx(CompactExplanation_1.CompactExplanation, { children: message });
247
+ }
201
248
  return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
202
- jsx_runtime_1.jsx(layout_1.Spacing, { y: 5 }), jsx_runtime_1.jsx("div", { style: errorExplanation, children: "The studio server has disconnected. Reconnect to edit the schema." }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 2, block: true })
249
+ jsx_runtime_1.jsx(layout_1.Spacing, { y: 5 }), jsx_runtime_1.jsx("div", { style: errorExplanation, children: message }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 2, block: true })
203
250
  ] }));
204
251
  }
205
252
  if (schema === 'no-zod') {
206
- return jsx_runtime_1.jsx(SchemaErrorMessages_1.ZodNotInstalled, {});
253
+ return jsx_runtime_1.jsx(SchemaErrorMessages_1.ZodNotInstalled, { mode: schemaErrorMode });
207
254
  }
208
255
  if (schema === 'no-schema') {
209
- return jsx_runtime_1.jsx(SchemaErrorMessages_1.NoSchemaDefined, {});
256
+ return jsx_runtime_1.jsx(SchemaErrorMessages_1.NoSchemaDefined, { mode: schemaErrorMode });
210
257
  }
211
258
  if (!z) {
212
259
  throw new Error('expected zod');
@@ -219,17 +266,21 @@ const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, prop
219
266
  }
220
267
  const typeName = (0, zod_schema_type_1.getZodSchemaType)(schema);
221
268
  if (typeName === 'any') {
222
- return jsx_runtime_1.jsx(SchemaErrorMessages_1.NoSchemaDefined, {});
269
+ return jsx_runtime_1.jsx(SchemaErrorMessages_1.NoSchemaDefined, { mode: schemaErrorMode });
223
270
  }
224
271
  if (!unresolvedComposition.defaultProps) {
225
- return jsx_runtime_1.jsx(SchemaErrorMessages_1.NoDefaultProps, {});
272
+ return jsx_runtime_1.jsx(SchemaErrorMessages_1.NoDefaultProps, { mode: schemaErrorMode });
226
273
  }
227
- return (jsx_runtime_1.jsxs("div", { style: outer, children: [
228
- jsx_runtime_1.jsxs("div", { style: controlContainer, children: [
229
- jsx_runtime_1.jsxs("div", { style: tabWrapper, children: [
230
- jsx_runtime_1.jsx(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), jsx_runtime_1.jsx(layout_1.Flex, {}), warnings.length > 0 ? (jsx_runtime_1.jsx(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
274
+ const shouldRenderControlRow = !hideModeControls || (!hideWarningButton && warnings.length > 0);
275
+ const shouldRenderWarningMessages = showWarning && warnings.length > 0;
276
+ const compactLayout = layout === 'inspector';
277
+ return (jsx_runtime_1.jsxs("div", { style: layout === 'inspector' ? inspectorOuter : outer, children: [shouldRenderControlRow || shouldRenderWarningMessages ? (jsx_runtime_1.jsxs("div", { style: layout === 'inspector'
278
+ ? inspectorControlContainer
279
+ : controlContainer, children: [shouldRenderControlRow ? (jsx_runtime_1.jsxs("div", { style: tabWrapper, children: [hideModeControls ? null : (jsx_runtime_1.jsx(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false })), jsx_runtime_1.jsx(layout_1.Flex, {}), !hideWarningButton && warnings.length > 0 ? (jsx_runtime_1.jsx(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] })) : null, shouldRenderWarningMessages
231
280
  ? warnings.map((warning) => (jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [
232
- jsx_runtime_1.jsx(layout_1.Spacing, { y: 1 }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: warning.message, align: "flex-start", type: "warning", action: warning.resolveLink ? (jsx_runtime_1.jsx("a", { href: warning.resolveLink, target: "_blank", rel: "noopener noreferrer", style: resolveLinkStyle, children: "Resolve" })) : null })] }, warning.id)))
233
- : null] }), mode === 'schema' ? (jsx_runtime_1.jsx(SchemaEditor_1.SchemaEditor, { value: defaultProps, setValue: setDefaultProps, schema: schema })) : (jsx_runtime_1.jsx(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: defaultProps !== null && defaultProps !== void 0 ? defaultProps : {}, setValue: jsonEditorSetValue, onSave: onSave, serializedJSON: serializedJSON, defaultProps: unresolvedComposition.defaultProps, schema: schema, compositionId: unresolvedComposition.id }))] }));
281
+ jsx_runtime_1.jsx(layout_1.Spacing, { y: 1 }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: warning.message, align: "flex-start", type: "warning", size: compactLayout ? 'compact' : 'default', action: warning.resolveLink ? (jsx_runtime_1.jsx("a", { href: warning.resolveLink, target: "_blank", rel: "noopener noreferrer", style: compactLayout
282
+ ? compactResolveLinkStyle
283
+ : resolveLinkStyle, children: "Resolve" })) : null })] }, warning.id)))
284
+ : null] })) : null, mode === 'schema' ? (jsx_runtime_1.jsx(SchemaEditor_1.SchemaEditor, { value: defaultProps, setValue: setDefaultProps, schema: schema, scrollableContainer: !compactLayout, contentInset: compactLayout ? InspectorPanelLayout_1.INSPECTOR_PANEL_HORIZONTAL_PADDING : undefined, errorMode: schemaErrorMode })) : (jsx_runtime_1.jsx(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: defaultProps !== null && defaultProps !== void 0 ? defaultProps : {}, setValue: jsonEditorSetValue, onSave: onSave, serializedJSON: serializedJSON, defaultProps: unresolvedComposition.defaultProps, schema: schema, compositionId: unresolvedComposition.id, layout: layout }))] }));
234
285
  };
235
286
  exports.DataEditor = DataEditor;
@@ -9,4 +9,5 @@ export declare const RenderModalJSONPropsEditor: React.FC<{
9
9
  readonly defaultProps: Record<string, unknown>;
10
10
  readonly schema: AnyZodSchema;
11
11
  readonly compositionId: string;
12
+ readonly layout?: 'default' | 'inspector';
12
13
  }>;
@@ -51,12 +51,28 @@ const style = {
51
51
  fontFamily: 'monospace',
52
52
  flex: 1,
53
53
  };
54
+ const inspectorStyle = {
55
+ fontFamily: 'monospace',
56
+ boxSizing: 'border-box',
57
+ flex: 'none',
58
+ fontSize: 11,
59
+ lineHeight: '15px',
60
+ minHeight: 220,
61
+ overflowY: 'hidden',
62
+ ...{
63
+ fieldSizing: 'content',
64
+ },
65
+ };
54
66
  const scrollable = {
55
67
  padding: '8px 12px',
56
68
  display: 'flex',
57
69
  flexDirection: 'column',
58
70
  flex: 1,
59
71
  };
72
+ const inspectorScrollable = {
73
+ ...scrollable,
74
+ flex: 'none',
75
+ };
60
76
  const parseJS = (value, schema) => {
61
77
  try {
62
78
  const zodValidation = (0, zod_schema_type_1.zodSafeParse)(schema, value);
@@ -85,7 +101,7 @@ const parseJSON = (str, schema) => {
85
101
  return { str, validJSON: false, error: e.message };
86
102
  }
87
103
  };
88
- const RenderModalJSONPropsEditor = ({ setValue, value, defaultProps, onSave, serializedJSON, schema, compositionId, }) => {
104
+ const RenderModalJSONPropsEditor = ({ setValue, value, defaultProps, onSave, serializedJSON, schema, compositionId, layout = 'default', }) => {
89
105
  if (serializedJSON === null) {
90
106
  throw new Error('expecting serializedJSON to be defined');
91
107
  }
@@ -154,17 +170,19 @@ const RenderModalJSONPropsEditor = ({ setValue, value, defaultProps, onSave, ser
154
170
  setLocalValue(parseJSON(JSON.stringify(defaultProps, null, 2), schema));
155
171
  }, [defaultProps, schema, setValue]);
156
172
  const textAreaStyle = (0, react_1.useMemo)(() => {
173
+ const baseStyle = layout === 'inspector' ? inspectorStyle : style;
157
174
  if (!hasError) {
158
- return style;
175
+ return baseStyle;
159
176
  }
160
177
  return {
161
- ...style,
178
+ ...baseStyle,
162
179
  borderColor: colors_1.FAIL_COLOR,
163
180
  };
164
- }, [hasError]);
165
- return (jsx_runtime_1.jsxs("div", { style: scrollable, children: [
166
- jsx_runtime_1.jsx(RemTextarea_1.RemTextarea, { onChange: onChange, onBlur: onQuickSave, value: localValue.str, status: localValue.validJSON ? 'ok' : 'error', style: textAreaStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1 }), jsx_runtime_1.jsx("div", { "data-testid": "json-props-error", children: localValue.validJSON === false ? (jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.error, type: "error" })) : localValue.zodValidation.success === false ? (jsx_runtime_1.jsx(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: localValue.zodValidation, viewTab: "json" })) : null }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1 }), jsx_runtime_1.jsxs(layout_1.Row, { children: [
167
- jsx_runtime_1.jsx(Button_1.Button, { disabled: !(hasChanged || !localValue.validJSON), onClick: reset, children: "Reset" }), jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsx(Button_1.Button, { disabled: !localValue.validJSON, onClick: onPretty, children: "Format" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 })
181
+ }, [hasError, layout]);
182
+ const buttonSize = layout === 'inspector' ? 'condensed' : 'default';
183
+ return (jsx_runtime_1.jsxs("div", { style: layout === 'inspector' ? inspectorScrollable : scrollable, children: [
184
+ jsx_runtime_1.jsx(RemTextarea_1.RemTextarea, { onChange: onChange, onBlur: onQuickSave, value: localValue.str, status: localValue.validJSON ? 'ok' : 'error', style: textAreaStyle, small: layout === 'inspector' }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1 }), jsx_runtime_1.jsx("div", { "data-testid": "json-props-error", children: localValue.validJSON === false ? (jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.error, type: "error", size: layout === 'inspector' ? 'compact' : 'default' })) : localValue.zodValidation.success === false ? (jsx_runtime_1.jsx(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: localValue.zodValidation, viewTab: "json", size: layout === 'inspector' ? 'compact' : 'default' })) : null }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1 }), jsx_runtime_1.jsxs(layout_1.Row, { children: [
185
+ jsx_runtime_1.jsx(Button_1.Button, { disabled: !(hasChanged || !localValue.validJSON), onClick: reset, size: buttonSize, children: "Reset" }), jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsx(Button_1.Button, { disabled: !localValue.validJSON, onClick: onPretty, size: buttonSize, children: "Format" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 })
168
186
  ] })
169
187
  ] }));
170
188
  };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- export declare const SCHEMA_EDITOR_FIELDSET_PADDING = 10;
2
+ export declare const SCHEMA_EDITOR_FIELDSET_PADDING = 6;
3
+ export declare const getSchemaEditorFieldsetPadding: () => number;
3
4
  export declare const Fieldset: React.FC<{
4
5
  readonly children: React.ReactNode;
5
6
  readonly shouldPad: boolean;
@@ -1,18 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Fieldset = exports.SCHEMA_EDITOR_FIELDSET_PADDING = void 0;
3
+ exports.Fieldset = exports.getSchemaEditorFieldsetPadding = exports.SCHEMA_EDITOR_FIELDSET_PADDING = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- exports.SCHEMA_EDITOR_FIELDSET_PADDING = 10;
6
+ exports.SCHEMA_EDITOR_FIELDSET_PADDING = 6;
7
+ const getSchemaEditorFieldsetPadding = () => {
8
+ return exports.SCHEMA_EDITOR_FIELDSET_PADDING;
9
+ };
10
+ exports.getSchemaEditorFieldsetPadding = getSchemaEditorFieldsetPadding;
7
11
  const AlreadyPaddedRightContext = (0, react_1.createContext)(false);
8
12
  const Fieldset = ({ children, shouldPad }) => {
9
13
  const alreadyPadded = (0, react_1.useContext)(AlreadyPaddedRightContext);
10
14
  const style = (0, react_1.useMemo)(() => {
11
15
  if (shouldPad) {
16
+ const padding = (0, exports.getSchemaEditorFieldsetPadding)();
12
17
  return {
13
- padding: exports.SCHEMA_EDITOR_FIELDSET_PADDING,
14
- paddingTop: exports.SCHEMA_EDITOR_FIELDSET_PADDING / 2,
15
- paddingRight: alreadyPadded ? 0 : exports.SCHEMA_EDITOR_FIELDSET_PADDING,
18
+ padding,
19
+ paddingTop: padding / 2,
20
+ paddingRight: alreadyPadded ? 0 : padding,
16
21
  };
17
22
  }
18
23
  return {};
@@ -1,8 +1,12 @@
1
1
  import React from 'react';
2
+ import { type SchemaErrorMode } from './SchemaErrorMessages';
2
3
  import type { AnyZodSchema } from './zod-schema-type';
3
4
  import type { UpdaterFunction } from './ZodSwitch';
4
5
  export declare const SchemaEditor: React.FC<{
5
6
  readonly schema: AnyZodSchema;
6
7
  readonly value: Record<string, unknown>;
7
8
  readonly setValue: UpdaterFunction<Record<string, unknown>>;
9
+ readonly scrollableContainer?: boolean;
10
+ readonly contentInset?: number;
11
+ readonly errorMode?: SchemaErrorMode;
8
12
  }>;
@@ -4,6 +4,7 @@ exports.SchemaEditor = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const get_zod_if_possible_1 = require("../../get-zod-if-possible");
6
6
  const is_menu_item_1 = require("../../Menu/is-menu-item");
7
+ const Fieldset_1 = require("./Fieldset");
7
8
  const SchemaErrorMessages_1 = require("./SchemaErrorMessages");
8
9
  const scroll_to_default_props_path_1 = require("./scroll-to-default-props-path");
9
10
  const zod_schema_type_1 = require("./zod-schema-type");
@@ -14,18 +15,40 @@ const scrollable = {
14
15
  flexDirection: 'column',
15
16
  overflowY: 'auto',
16
17
  };
17
- const SchemaEditor = ({ schema, value, setValue }) => {
18
+ const notScrollable = {
19
+ display: 'flex',
20
+ flexDirection: 'column',
21
+ };
22
+ const getContainerStyle = ({ contentInset, scrollableContainer, }) => {
23
+ const base = scrollableContainer ? scrollable : notScrollable;
24
+ if (contentInset === undefined) {
25
+ return base;
26
+ }
27
+ const fieldsetPadding = (0, Fieldset_1.getSchemaEditorFieldsetPadding)();
28
+ const rootInset = Math.max(0, contentInset - fieldsetPadding);
29
+ return {
30
+ ...base,
31
+ boxSizing: 'border-box',
32
+ paddingLeft: rootInset,
33
+ paddingRight: rootInset,
34
+ };
35
+ };
36
+ const SchemaEditor = ({ schema, value, setValue, scrollableContainer = true, contentInset, errorMode = 'full', }) => {
18
37
  const z = (0, get_zod_if_possible_1.useZodIfPossible)();
19
38
  if (!z) {
20
39
  throw new Error('expected zod');
21
40
  }
22
41
  const typeName = (0, zod_schema_type_1.getZodSchemaType)(schema);
23
42
  if (typeName !== 'object' && typeName !== 'discriminatedUnion') {
24
- return jsx_runtime_1.jsx(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
43
+ return jsx_runtime_1.jsx(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName, mode: errorMode });
25
44
  }
45
+ const containerStyle = getContainerStyle({
46
+ contentInset,
47
+ scrollableContainer,
48
+ });
26
49
  if (typeName === 'discriminatedUnion') {
27
- return (jsx_runtime_1.jsx("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: jsx_runtime_1.jsx(ZodDiscriminatedUnionEditor_1.ZodDiscriminatedUnionEditor, { schema: schema, setValue: setValue, value: value, mayPad: true, jsonPath: [], onRemove: null }) }));
50
+ return (jsx_runtime_1.jsx("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style: containerStyle, className: scrollableContainer ? is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME : undefined, children: jsx_runtime_1.jsx(ZodDiscriminatedUnionEditor_1.ZodDiscriminatedUnionEditor, { schema: schema, setValue: setValue, value: value, mayPad: true, jsonPath: [], onRemove: null }) }));
28
51
  }
29
- return (jsx_runtime_1.jsx("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: jsx_runtime_1.jsx(ZodObjectEditor_1.ZodObjectEditor, { discriminatedUnionReplacement: null, value: value, setValue: setValue, jsonPath: [], schema: schema, onRemove: null, mayPad: true }) }));
52
+ return (jsx_runtime_1.jsx("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style: containerStyle, className: scrollableContainer ? is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME : undefined, children: jsx_runtime_1.jsx(ZodObjectEditor_1.ZodObjectEditor, { discriminatedUnionReplacement: null, value: value, setValue: setValue, jsonPath: [], schema: schema, onRemove: null, mayPad: true }) }));
30
53
  };
31
54
  exports.SchemaEditor = SchemaEditor;
@@ -1,7 +1,14 @@
1
1
  import type { ZodSafeParseResult } from './zod-schema-type';
2
- export declare const ZodNotInstalled: () => import("react/jsx-runtime").JSX.Element;
3
- export declare const NoSchemaDefined: () => import("react/jsx-runtime").JSX.Element;
4
- export declare const NoDefaultProps: () => import("react/jsx-runtime").JSX.Element;
2
+ export type SchemaErrorMode = 'full' | 'compact';
3
+ export declare const ZodNotInstalled: React.FC<{
4
+ readonly mode?: SchemaErrorMode;
5
+ }>;
6
+ export declare const NoSchemaDefined: React.FC<{
7
+ readonly mode?: SchemaErrorMode;
8
+ }>;
9
+ export declare const NoDefaultProps: React.FC<{
10
+ readonly mode?: SchemaErrorMode;
11
+ }>;
5
12
  export declare const InvalidDefaultProps: React.FC<{
6
13
  zodValidationResult: ZodSafeParseResult;
7
14
  }>;
@@ -9,5 +16,6 @@ export declare const InvalidSchema: React.FC<{
9
16
  zodValidationResult: ZodSafeParseResult;
10
17
  }>;
11
18
  export declare const TopLevelZodValue: React.FC<{
12
- typeReceived: string;
19
+ readonly typeReceived: string;
20
+ readonly mode?: SchemaErrorMode;
13
21
  }>;
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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
- // Schema error messages for studio editor
6
5
  const colors_1 = require("../../../helpers/colors");
7
6
  const Button_1 = require("../../Button");
7
+ const CompactExplanation_1 = require("../../CompactExplanation");
8
8
  const layout_1 = require("../../layout");
9
9
  const styles_1 = require("../../Menu/styles");
10
10
  const ZodErrorMessages_1 = require("./ZodErrorMessages");
@@ -12,10 +12,9 @@ const explainer = {
12
12
  display: 'flex',
13
13
  flex: 1,
14
14
  flexDirection: 'column',
15
- padding: '0 12px',
16
- justifyContent: 'center',
17
- alignItems: 'center',
18
- textAlign: 'center',
15
+ padding: 12,
16
+ alignItems: 'flex-start',
17
+ textAlign: 'left',
19
18
  background: colors_1.BACKGROUND,
20
19
  };
21
20
  const errorExplanation = {
@@ -36,7 +35,13 @@ const errorContainer = {
36
35
  const openDocs = () => {
37
36
  window.open('https://www.remotion.dev/docs/schemas');
38
37
  };
39
- const ZodNotInstalled = () => {
38
+ const CompactSchemaError = ({ children }) => {
39
+ return (jsx_runtime_1.jsx(CompactExplanation_1.CompactExplanation, { learnMoreHref: "https://www.remotion.dev/docs/schemas", learnMoreAriaLabel: "Learn more about schemas", children: children }));
40
+ };
41
+ const ZodNotInstalled = ({ mode = 'full' }) => {
42
+ if (mode === 'compact') {
43
+ return jsx_runtime_1.jsx(CompactSchemaError, { children: "Install zod to edit props." });
44
+ }
40
45
  return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
41
46
  jsx_runtime_1.jsxs("div", { style: errorExplanation, children: ["Install ",
42
47
  jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "zod" }),
@@ -44,7 +49,10 @@ const ZodNotInstalled = () => {
44
49
  ] }));
45
50
  };
46
51
  exports.ZodNotInstalled = ZodNotInstalled;
47
- const NoSchemaDefined = () => {
52
+ const NoSchemaDefined = ({ mode = 'full' }) => {
53
+ if (mode === 'compact') {
54
+ return (jsx_runtime_1.jsx(CompactSchemaError, { children: "Add a schema prop to edit props." }));
55
+ }
48
56
  return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
49
57
  jsx_runtime_1.jsxs("div", { style: errorExplanation, children: ["Make the props of this composition interactively editable by adding a", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "schema" }),
50
58
  " prop to the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: '<Composition>' }),
@@ -52,7 +60,10 @@ const NoSchemaDefined = () => {
52
60
  ] }));
53
61
  };
54
62
  exports.NoSchemaDefined = NoSchemaDefined;
55
- const NoDefaultProps = () => {
63
+ const NoDefaultProps = ({ mode = 'full' }) => {
64
+ if (mode === 'compact') {
65
+ return (jsx_runtime_1.jsx(CompactSchemaError, { children: "Add defaultProps to edit the schema." }));
66
+ }
56
67
  return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
57
68
  jsx_runtime_1.jsxs("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }),
58
69
  " prop in the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: '<Composition>' }),
@@ -76,7 +87,10 @@ const InvalidSchema = ({ zodValidationResult }) => {
76
87
  ] }));
77
88
  };
78
89
  exports.InvalidSchema = InvalidSchema;
79
- const TopLevelZodValue = ({ typeReceived }) => {
90
+ const TopLevelZodValue = ({ typeReceived, mode = 'full' }) => {
91
+ if (mode === 'compact') {
92
+ return (jsx_runtime_1.jsx(CompactSchemaError, { children: "Use z.object() or z.discriminatedUnion() for the top-level schema." }));
93
+ }
80
94
  return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
81
95
  jsx_runtime_1.jsxs("div", { style: errorExplanation, children: ["The top-level type of the schema must be", ' ', jsx_runtime_1.jsx("code", { style: codeSnippet, children: "z.object()" }),
82
96
  " or", ' ', jsx_runtime_1.jsx("code", { style: codeSnippet, children: "z.discriminatedUnion()" }),
@@ -9,7 +9,7 @@ const InlineRemoveButton_1 = require("../InlineRemoveButton");
9
9
  const get_schema_label_1 = require("./get-schema-label");
10
10
  const scroll_to_default_props_path_1 = require("./scroll-to-default-props-path");
11
11
  const compactStyles = {
12
- fontSize: 15,
12
+ fontSize: 12,
13
13
  color: colors_1.LIGHT_TEXT,
14
14
  fontFamily: 'sans-serif',
15
15
  display: 'flex',
@@ -22,13 +22,13 @@ const SchemaLabel = ({ jsonPath, onRemove, valid, suffix, handleClick }) => {
22
22
  const labelStyle = (0, react_1.useMemo)(() => {
23
23
  return {
24
24
  fontFamily: 'monospace',
25
- fontSize: 14,
25
+ fontSize: 12,
26
26
  color: valid
27
27
  ? clickableButtonHovered
28
28
  ? 'white'
29
29
  : colors_1.LIGHT_TEXT
30
30
  : colors_1.FAIL_COLOR,
31
- lineHeight: '24px',
31
+ lineHeight: '20px',
32
32
  };
33
33
  }, [clickableButtonHovered, valid]);
34
34
  const onClickablePointerEnter = (0, react_1.useCallback)(() => {
@@ -57,7 +57,11 @@ const SchemaArrayItemSeparationLine = ({ onChange, index, schema, isLast, showAd
57
57
  }, [isLast, outerHovered]);
58
58
  const inner = (0, react_1.useMemo)(() => {
59
59
  return {
60
+ alignItems: 'center',
60
61
  background: colors_1.BACKGROUND,
62
+ display: 'flex',
63
+ height: exports.VERTICAL_GUIDE_HEIGHT,
64
+ justifyContent: 'center',
61
65
  paddingLeft: 10,
62
66
  paddingRight: 10,
63
67
  };
@@ -85,7 +89,10 @@ const SchemaArrayItemSeparationLine = ({ onChange, index, schema, isLast, showAd
85
89
  display: 'flex',
86
90
  flexDirection: 'column',
87
91
  alignItems: 'flex-end',
88
- }, children: [showAddButton && (jsx_runtime_1.jsx("div", { style: dynamicAddButtonStyle, onPointerEnter: onOuterMouseEnter, onPointerLeave: onOuterMouseLeave, children: jsx_runtime_1.jsx("div", { onClick: onAdd, style: inner, onPointerEnter: onInnerMouseEnter, onPointerLeave: onInnerMouseLeave, children: jsx_runtime_1.jsx(plus_1.Plus, { color: innerHovered ? 'white' : colors_1.LIGHT_TEXT, style: { height: exports.VERTICAL_GUIDE_HEIGHT / 2 } }) }) })), jsx_runtime_1.jsx("div", { style: arraySeparationLine })
92
+ }, children: [showAddButton && (jsx_runtime_1.jsx("div", { style: dynamicAddButtonStyle, onPointerEnter: onOuterMouseEnter, onPointerLeave: onOuterMouseLeave, children: jsx_runtime_1.jsx("div", { onClick: onAdd, style: inner, onPointerEnter: onInnerMouseEnter, onPointerLeave: onInnerMouseLeave, children: jsx_runtime_1.jsx(plus_1.Plus, { color: innerHovered ? 'white' : colors_1.LIGHT_TEXT, style: {
93
+ display: 'block',
94
+ height: exports.VERTICAL_GUIDE_HEIGHT / 2,
95
+ } }) }) })), jsx_runtime_1.jsx("div", { style: arraySeparationLine })
89
96
  ] }), isLast ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
90
97
  jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: {
91
98
  ...layout_2.fieldSetText,