@remotion/studio 4.0.478 → 4.0.481
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.
- package/dist/components/AssetSelector.js +8 -14
- package/dist/components/AudioWaveform.js +19 -11
- package/dist/components/Button.d.ts +2 -0
- package/dist/components/Button.js +9 -6
- package/dist/components/CompactExplanation.d.ts +12 -0
- package/dist/components/CompactExplanation.js +52 -0
- package/dist/components/CompositionSelector.js +2 -4
- package/dist/components/CurrentAsset.d.ts +3 -1
- package/dist/components/CurrentAsset.js +42 -34
- package/dist/components/CurrentComposition.d.ts +1 -1
- package/dist/components/CurrentComposition.js +38 -31
- package/dist/components/CurrentCompositionSideEffects.d.ts +0 -3
- package/dist/components/CurrentCompositionSideEffects.js +1 -37
- package/dist/components/DefaultPropsEditor.d.ts +12 -2
- package/dist/components/DefaultPropsEditor.js +2 -2
- package/dist/components/Editor.js +2 -5
- package/dist/components/EditorContent.js +2 -1
- package/dist/components/EffectPickerModal.d.ts +5 -0
- package/dist/components/EffectPickerModal.js +179 -0
- package/dist/components/ExpandedTracksProvider.d.ts +1 -0
- package/dist/components/ExpandedTracksProvider.js +81 -7
- package/dist/components/GlobalKeybindings.d.ts +3 -1
- package/dist/components/GlobalKeybindings.js +104 -10
- package/dist/components/InspectorInfoHeader.d.ts +11 -0
- package/dist/components/InspectorInfoHeader.js +55 -0
- package/dist/components/InspectorPanel/DefaultInspector.d.ts +8 -0
- package/dist/components/InspectorPanel/DefaultInspector.js +93 -0
- package/dist/components/InspectorPanel/EasingInspector.d.ts +5 -0
- package/dist/components/InspectorPanel/EasingInspector.js +41 -0
- package/dist/components/InspectorPanel/GuideInspector.d.ts +7 -0
- package/dist/components/InspectorPanel/GuideInspector.js +55 -0
- package/dist/components/InspectorPanel/KeyframeInspector.d.ts +7 -0
- package/dist/components/InspectorPanel/KeyframeInspector.js +109 -0
- package/dist/components/InspectorPanel/SelectedInspector.d.ts +5 -0
- package/dist/components/InspectorPanel/SelectedInspector.js +26 -0
- package/dist/components/InspectorPanel/SequenceSelectionInspector.d.ts +5 -0
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +117 -0
- package/dist/components/InspectorPanel/common.d.ts +15 -0
- package/dist/components/InspectorPanel/common.js +18 -0
- package/dist/components/InspectorPanel/inspector-selection.d.ts +10 -0
- package/dist/components/InspectorPanel/inspector-selection.js +35 -0
- package/dist/components/InspectorPanel/styles.d.ts +28 -0
- package/dist/components/InspectorPanel/styles.js +196 -0
- package/dist/components/InspectorPanel/use-track-for-selection.d.ts +2 -0
- package/dist/components/InspectorPanel/use-track-for-selection.js +22 -0
- package/dist/components/InspectorPanel.d.ts +8 -0
- package/dist/components/InspectorPanel.js +26 -0
- package/dist/components/InspectorPanelLayout.d.ts +1 -0
- package/dist/components/InspectorPanelLayout.js +4 -0
- package/dist/components/InspectorSequenceSection.d.ts +19 -0
- package/dist/components/InspectorSequenceSection.js +157 -0
- package/dist/components/InspectorSourceLocation.d.ts +7 -0
- package/dist/components/InspectorSourceLocation.js +71 -0
- package/dist/components/KeyboardShortcutsExplainer.js +10 -2
- package/dist/components/Modals.js +3 -3
- package/dist/components/NewComposition/InputDragger.js +1 -1
- package/dist/components/NewComposition/RemInput.d.ts +1 -0
- package/dist/components/NewComposition/RemInput.js +8 -2
- package/dist/components/NewComposition/RemTextarea.d.ts +1 -0
- package/dist/components/NewComposition/RemTextarea.js +8 -2
- package/dist/components/NewComposition/ValidationMessage.d.ts +3 -0
- package/dist/components/NewComposition/ValidationMessage.js +16 -5
- package/dist/components/OptionsPanel.d.ts +1 -1
- package/dist/components/OptionsPanel.js +8 -17
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +2 -7
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +3 -10
- package/dist/components/QuickSwitcher/shared.d.ts +4 -0
- package/dist/components/QuickSwitcher/shared.js +24 -0
- package/dist/components/RenderModal/DataEditor.d.ts +29 -2
- package/dist/components/RenderModal/DataEditor.js +107 -56
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -0
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +25 -7
- package/dist/components/RenderModal/SchemaEditor/Fieldset.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/Fieldset.js +10 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +4 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +27 -4
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +12 -4
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +23 -9
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +8 -1
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +23 -6
- package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +9 -11
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +1 -1
- package/dist/components/RenderModal/WarningIndicatorButton.d.ts +1 -0
- package/dist/components/RenderModal/WarningIndicatorButton.js +17 -4
- package/dist/components/RenderModal/get-render-modal-warnings.d.ts +2 -1
- package/dist/components/RenderModal/get-render-modal-warnings.js +6 -3
- package/dist/components/RendersTab.js +1 -1
- package/dist/components/ResetZoomButton.d.ts +2 -1
- package/dist/components/ResetZoomButton.js +5 -1
- package/dist/components/SegmentedControl.d.ts +3 -0
- package/dist/components/SegmentedControl.js +11 -5
- package/dist/components/SelectedOutlineElement.js +96 -24
- package/dist/components/SelectedOutlineOverlay.d.ts +1 -1
- package/dist/components/SelectedOutlineOverlay.js +44 -30
- package/dist/components/SelectedOutlineUvControls.d.ts +9 -0
- package/dist/components/SelectedOutlineUvControls.js +64 -10
- package/dist/components/Tabs/index.js +4 -4
- package/dist/components/Timeline/EasingEditorModal.d.ts +5 -4
- package/dist/components/Timeline/EasingEditorModal.js +597 -124
- package/dist/components/Timeline/KeyframeSettingsModal.d.ts +2 -2
- package/dist/components/Timeline/SubscribeToNodePaths.d.ts +2 -2
- package/dist/components/Timeline/Timeline.js +9 -9
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +15 -3
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +85 -1
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +10 -3
- package/dist/components/Timeline/TimelineEffectItem.d.ts +2 -2
- package/dist/components/Timeline/TimelineEffectItem.js +1 -1
- package/dist/components/Timeline/TimelineEffectPropItem.d.ts +8 -0
- package/dist/components/Timeline/TimelineEffectPropItem.js +25 -21
- package/dist/components/Timeline/TimelineExpandArrowButton.js +42 -2
- package/dist/components/Timeline/TimelineExpandedRow.d.ts +5 -2
- package/dist/components/Timeline/TimelineExpandedRow.js +6 -6
- package/dist/components/Timeline/TimelineExpandedSection.d.ts +1 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +10 -25
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +8 -2
- package/dist/components/Timeline/TimelineKeyframeControls.js +24 -3
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +2 -47
- package/dist/components/Timeline/TimelineKeyframedValue.d.ts +1 -1
- package/dist/components/Timeline/TimelineKeyframedValue.js +8 -10
- package/dist/components/Timeline/TimelineNumberField.js +5 -11
- package/dist/components/Timeline/TimelineRotationField.js +5 -6
- package/dist/components/Timeline/TimelineRowChrome.d.ts +2 -0
- package/dist/components/Timeline/TimelineRowChrome.js +5 -3
- package/dist/components/Timeline/TimelineScaleField.js +4 -8
- package/dist/components/Timeline/TimelineSelection.d.ts +28 -2
- package/dist/components/Timeline/TimelineSelection.js +342 -61
- package/dist/components/Timeline/TimelineSequence.js +19 -3
- package/dist/components/Timeline/TimelineSequenceItem.js +68 -64
- package/dist/components/Timeline/TimelineSequencePropItem.d.ts +12 -2
- package/dist/components/Timeline/TimelineSequencePropItem.js +57 -53
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +6 -4
- package/dist/components/Timeline/TimelineTransformOriginField.js +4 -5
- package/dist/components/Timeline/TimelineTranslateField.js +4 -5
- package/dist/components/Timeline/TimelineUvCoordinateField.js +4 -4
- package/dist/components/Timeline/call-add-keyframe.d.ts +4 -4
- package/dist/components/Timeline/call-delete-keyframe.d.ts +4 -4
- package/dist/components/Timeline/call-move-keyframe.d.ts +2 -2
- package/dist/components/Timeline/call-update-keyframe-settings.d.ts +3 -3
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +2 -1
- package/dist/components/Timeline/delete-selected-timeline-item.js +27 -1
- package/dist/components/Timeline/find-track-for-node-path-info.js +2 -2
- package/dist/components/Timeline/get-node-keyframes.d.ts +7 -0
- package/dist/components/Timeline/get-node-keyframes.js +26 -1
- package/dist/components/Timeline/parse-keyframe-field-from-node-path.js +2 -2
- package/dist/components/Timeline/reset-selected-timeline-props.d.ts +3 -3
- package/dist/components/Timeline/reset-selected-timeline-props.js +34 -7
- package/dist/components/Timeline/save-effect-prop.d.ts +2 -2
- package/dist/components/Timeline/save-sequence-prop.d.ts +2 -2
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +3 -3
- package/dist/components/Timeline/timeline-expanded-filter.d.ts +12 -0
- package/dist/components/Timeline/timeline-expanded-filter.js +38 -0
- package/dist/components/Timeline/timeline-field-display-utils.d.ts +5 -0
- package/dist/components/Timeline/timeline-field-display-utils.js +244 -0
- package/dist/components/Timeline/update-selected-easing.d.ts +47 -4
- package/dist/components/Timeline/update-selected-easing.js +40 -9
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +50 -18
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +13 -0
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +73 -0
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -3
- package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +12 -0
- package/dist/components/Timeline/use-timeline-expanded-tree.js +60 -0
- package/dist/components/Timeline/use-timeline-height.js +51 -7
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +12 -6
- package/dist/components/TopPanel.js +1 -1
- package/dist/components/VisualControls/VisualControlsContent.d.ts +1 -1
- package/dist/components/VisualControls/VisualControlsContent.js +4 -5
- package/dist/components/effect-drag-and-drop.d.ts +10 -0
- package/dist/components/effect-drag-and-drop.js +17 -8
- package/dist/components/effect-picker-search.d.ts +5 -0
- package/dist/components/effect-picker-search.js +77 -0
- package/dist/components/selected-outline-drag.d.ts +21 -2
- package/dist/components/selected-outline-drag.js +31 -6
- package/dist/components/selected-outline-measurement.js +48 -14
- package/dist/components/selected-outline-types.d.ts +7 -7
- package/dist/components/selected-outline-uv.d.ts +4 -3
- package/dist/components/selected-outline-uv.js +6 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +8 -1
- package/dist/esm/{chunk-hrw9799x.js → chunk-4rq5gt8c.js} +30557 -26640
- package/dist/esm/internals.mjs +30557 -26640
- package/dist/esm/previewEntry.mjs +18584 -14665
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/migrate-expanded-tracks-for-subscription-key.js +3 -3
- package/dist/helpers/render-codec-label.d.ts +2 -0
- package/dist/helpers/render-codec-label.js +49 -0
- package/dist/helpers/timeline-layout.d.ts +4 -4
- package/dist/helpers/use-media-metadata.d.ts +8 -2
- package/dist/helpers/use-media-metadata.js +17 -4
- package/dist/state/modals.d.ts +9 -4
- package/package.json +12 -12
|
@@ -20,6 +20,11 @@ exports.inputBaseStyle = {
|
|
|
20
20
|
borderWidth: 1,
|
|
21
21
|
fontSize: 14,
|
|
22
22
|
};
|
|
23
|
+
const compactInputStyle = {
|
|
24
|
+
fontSize: 12,
|
|
25
|
+
lineHeight: '16px',
|
|
26
|
+
padding: '4px 6px',
|
|
27
|
+
};
|
|
23
28
|
const getInputBorderColor = ({ status, isFocused, isHovered, }) => status === 'warning'
|
|
24
29
|
? colors_1.WARNING_COLOR
|
|
25
30
|
: status === 'error'
|
|
@@ -30,7 +35,7 @@ const getInputBorderColor = ({ status, isFocused, isHovered, }) => status === 'w
|
|
|
30
35
|
? colors_1.INPUT_BORDER_COLOR_HOVERED
|
|
31
36
|
: colors_1.INPUT_BORDER_COLOR_UNHOVERED;
|
|
32
37
|
exports.getInputBorderColor = getInputBorderColor;
|
|
33
|
-
const RemInputForwardRef = ({ status, rightAlign, ...props }, ref) => {
|
|
38
|
+
const RemInputForwardRef = ({ status, rightAlign, small = false, ...props }, ref) => {
|
|
34
39
|
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
35
40
|
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
36
41
|
const inputRef = (0, react_1.useRef)(null);
|
|
@@ -40,12 +45,13 @@ const RemInputForwardRef = ({ status, rightAlign, ...props }, ref) => {
|
|
|
40
45
|
return {
|
|
41
46
|
backgroundColor: colors_1.INPUT_BACKGROUND,
|
|
42
47
|
...exports.inputBaseStyle,
|
|
48
|
+
...(small ? compactInputStyle : null),
|
|
43
49
|
width: '100%',
|
|
44
50
|
borderColor: (0, exports.getInputBorderColor)({ isFocused, isHovered, status }),
|
|
45
51
|
textAlign: rightAlign ? 'right' : 'left',
|
|
46
52
|
...((_a = props.style) !== null && _a !== void 0 ? _a : {}),
|
|
47
53
|
};
|
|
48
|
-
}, [isFocused, isHovered, rightAlign, props.style, status]);
|
|
54
|
+
}, [isFocused, isHovered, rightAlign, props.style, small, status]);
|
|
49
55
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
50
56
|
return inputRef.current;
|
|
51
57
|
}, []);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> & {
|
|
3
3
|
readonly status: 'error' | 'warning' | 'ok';
|
|
4
|
+
readonly small?: boolean;
|
|
4
5
|
};
|
|
5
6
|
export declare const RemTextarea: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
6
7
|
export {};
|
|
@@ -16,7 +16,12 @@ const inputBaseStyle = {
|
|
|
16
16
|
resize: 'none',
|
|
17
17
|
overflowX: 'hidden',
|
|
18
18
|
};
|
|
19
|
-
const
|
|
19
|
+
const compactInputStyle = {
|
|
20
|
+
fontSize: 12,
|
|
21
|
+
lineHeight: '16px',
|
|
22
|
+
padding: '4px 6px',
|
|
23
|
+
};
|
|
24
|
+
const RemTextareaFRFunction = ({ status, small = false, ...props }, ref) => {
|
|
20
25
|
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
21
26
|
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
22
27
|
const inputRef = (0, react_1.useRef)(null);
|
|
@@ -29,11 +34,12 @@ const RemTextareaFRFunction = ({ status, ...props }, ref) => {
|
|
|
29
34
|
return {
|
|
30
35
|
backgroundColor: colors_1.INPUT_BACKGROUND,
|
|
31
36
|
...inputBaseStyle,
|
|
37
|
+
...(small ? compactInputStyle : null),
|
|
32
38
|
width: '100%',
|
|
33
39
|
borderColor: (0, RemInput_1.getInputBorderColor)({ isFocused, isHovered, status }),
|
|
34
40
|
...((_a = props.style) !== null && _a !== void 0 ? _a : {}),
|
|
35
41
|
};
|
|
36
|
-
}, [isFocused, isHovered, props.style, status]);
|
|
42
|
+
}, [isFocused, isHovered, props.style, small, status]);
|
|
37
43
|
(0, react_1.useEffect)(() => {
|
|
38
44
|
if (!inputRef.current) {
|
|
39
45
|
return;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { SVGProps } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export declare const WarningTriangle: React.FC<SVGProps<SVGSVGElement>>;
|
|
4
|
+
type ValidationMessageSize = 'default' | 'compact';
|
|
4
5
|
export declare const ValidationMessage: React.FC<{
|
|
5
6
|
readonly message: string;
|
|
6
7
|
readonly align: 'flex-start' | 'flex-end';
|
|
7
8
|
readonly type: 'warning' | 'error';
|
|
8
9
|
readonly action?: React.ReactNode;
|
|
10
|
+
readonly size?: ValidationMessageSize;
|
|
9
11
|
}>;
|
|
12
|
+
export {};
|
|
@@ -14,6 +14,11 @@ const style = {
|
|
|
14
14
|
height: 12,
|
|
15
15
|
flexShrink: 0,
|
|
16
16
|
};
|
|
17
|
+
const compactStyle = {
|
|
18
|
+
...style,
|
|
19
|
+
width: 10,
|
|
20
|
+
height: 10,
|
|
21
|
+
};
|
|
17
22
|
const container = {
|
|
18
23
|
maxWidth: 500,
|
|
19
24
|
};
|
|
@@ -22,15 +27,21 @@ const label = {
|
|
|
22
27
|
color: 'white',
|
|
23
28
|
fontFamily: 'sans-serif',
|
|
24
29
|
};
|
|
25
|
-
const
|
|
30
|
+
const compactLabel = {
|
|
31
|
+
...label,
|
|
32
|
+
fontSize: 12,
|
|
33
|
+
};
|
|
34
|
+
const ValidationMessage = ({ message, align, type, action, size = 'default' }) => {
|
|
35
|
+
const iconStyle = size === 'compact' ? compactStyle : style;
|
|
36
|
+
const labelStyle = size === 'compact' ? compactLabel : label;
|
|
26
37
|
const finalStyle = (0, react_1.useMemo)(() => {
|
|
27
38
|
return {
|
|
28
|
-
...
|
|
39
|
+
...iconStyle,
|
|
29
40
|
fill: type === 'warning' ? colors_1.WARNING_COLOR : colors_1.FAIL_COLOR,
|
|
30
41
|
};
|
|
31
|
-
}, [type]);
|
|
42
|
+
}, [iconStyle, type]);
|
|
32
43
|
return (jsx_runtime_1.jsx("div", { style: container, children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", justify: align, children: [
|
|
33
|
-
jsx_runtime_1.jsx(exports.WarningTriangle, { style: finalStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style:
|
|
34
|
-
jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), action] })) : null] }) }));
|
|
44
|
+
jsx_runtime_1.jsx(exports.WarningTriangle, { style: finalStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: size === 'compact' ? 0.75 : 1 }), jsx_runtime_1.jsx("div", { style: labelStyle, children: message }), action ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
45
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { x: size === 'compact' ? 0.75 : 1 }), action] })) : null] }) }));
|
|
35
46
|
};
|
|
36
47
|
exports.ValidationMessage = ValidationMessage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
type OptionsSidebarPanel = '
|
|
2
|
+
type OptionsSidebarPanel = 'inspector' | 'renders';
|
|
3
3
|
export declare const persistSelectedOptionsSidebarPanel: (panel: OptionsSidebarPanel) => void;
|
|
4
4
|
export declare const optionsSidebarTabs: React.RefObject<{
|
|
5
5
|
selectRendersPanel: () => void;
|
|
@@ -7,9 +7,8 @@ const remotion_1 = require("remotion");
|
|
|
7
7
|
const colors_1 = require("../helpers/colors");
|
|
8
8
|
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
9
9
|
const show_browser_rendering_1 = require("../helpers/show-browser-rendering");
|
|
10
|
-
const VisualControls_1 = require("../visual-controls/VisualControls");
|
|
11
|
-
const DefaultPropsEditor_1 = require("./DefaultPropsEditor");
|
|
12
10
|
const get_zod_if_possible_1 = require("./get-zod-if-possible");
|
|
11
|
+
const InspectorPanel_1 = require("./InspectorPanel");
|
|
13
12
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
14
13
|
const deep_equal_1 = require("./RenderModal/SchemaEditor/deep-equal");
|
|
15
14
|
const extract_enum_json_paths_1 = require("./RenderModal/SchemaEditor/extract-enum-json-paths");
|
|
@@ -18,20 +17,16 @@ const RenderQueue_1 = require("./RenderQueue");
|
|
|
18
17
|
const actions_1 = require("./RenderQueue/actions");
|
|
19
18
|
const RendersTab_1 = require("./RendersTab");
|
|
20
19
|
const Tabs_1 = require("./Tabs");
|
|
21
|
-
const VisualControlsContent_1 = require("./VisualControls/VisualControlsContent");
|
|
22
20
|
const localStorageKey = 'remotion.sidebarPanel';
|
|
23
21
|
const getSelectedPanel = (renderingAvailable) => {
|
|
24
22
|
if (!renderingAvailable) {
|
|
25
|
-
return '
|
|
23
|
+
return 'inspector';
|
|
26
24
|
}
|
|
27
25
|
const panel = localStorage.getItem(localStorageKey);
|
|
28
26
|
if (panel === 'renders') {
|
|
29
27
|
return 'renders';
|
|
30
28
|
}
|
|
31
|
-
|
|
32
|
-
return 'visual-controls';
|
|
33
|
-
}
|
|
34
|
-
return 'input-props';
|
|
29
|
+
return 'inspector';
|
|
35
30
|
};
|
|
36
31
|
const tabsContainer = {
|
|
37
32
|
backgroundColor: colors_1.BACKGROUND,
|
|
@@ -45,7 +40,6 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
45
40
|
const { props, updateProps } = (0, react_1.useContext)(remotion_1.Internals.EditorPropsContext);
|
|
46
41
|
const renderingAvailable = !readOnlyStudio || show_browser_rendering_1.SHOW_BROWSER_RENDERING;
|
|
47
42
|
const isMobileLayout = (0, mobile_layout_1.useMobileLayout)();
|
|
48
|
-
const visualControlsTabActivated = (0, react_1.useContext)(VisualControls_1.VisualControlsTabActivatedContext);
|
|
49
43
|
const container = (0, react_1.useMemo)(() => ({
|
|
50
44
|
height: '100%',
|
|
51
45
|
width: '100%',
|
|
@@ -55,18 +49,14 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
55
49
|
flex: 1,
|
|
56
50
|
}), [isMobileLayout]);
|
|
57
51
|
const [panel, setPanel] = (0, react_1.useState)(() => getSelectedPanel(renderingAvailable));
|
|
58
|
-
const
|
|
59
|
-
setPanel('
|
|
60
|
-
(0, exports.persistSelectedOptionsSidebarPanel)('
|
|
52
|
+
const onInspectorSelected = (0, react_1.useCallback)(() => {
|
|
53
|
+
setPanel('inspector');
|
|
54
|
+
(0, exports.persistSelectedOptionsSidebarPanel)('inspector');
|
|
61
55
|
}, []);
|
|
62
56
|
const onRendersSelected = (0, react_1.useCallback)(() => {
|
|
63
57
|
setPanel('renders');
|
|
64
58
|
(0, exports.persistSelectedOptionsSidebarPanel)('renders');
|
|
65
59
|
}, []);
|
|
66
|
-
const onVisualControlsSelected = (0, react_1.useCallback)(() => {
|
|
67
|
-
setPanel('visual-controls');
|
|
68
|
-
(0, exports.persistSelectedOptionsSidebarPanel)('visual-controls');
|
|
69
|
-
}, []);
|
|
70
60
|
(0, react_1.useImperativeHandle)(exports.optionsSidebarTabs, () => {
|
|
71
61
|
return {
|
|
72
62
|
selectRendersPanel: () => {
|
|
@@ -186,6 +176,7 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
186
176
|
e.stopPropagation();
|
|
187
177
|
}, []);
|
|
188
178
|
return (jsx_runtime_1.jsxs("div", { style: container, className: "css-reset", onPointerDown: onPointerDown, children: [
|
|
189
|
-
jsx_runtime_1.jsx("div", { style: tabsContainer, children: jsx_runtime_1.jsxs(Tabs_1.Tabs, { children: [
|
|
179
|
+
jsx_runtime_1.jsx("div", { style: tabsContainer, children: jsx_runtime_1.jsxs(Tabs_1.Tabs, { children: [
|
|
180
|
+
jsx_runtime_1.jsxs(Tabs_1.Tab, { selected: panel === 'inspector', onClick: onInspectorSelected, style: { justifyContent: 'space-between' }, children: ["Inspector", hasLocalModifications ? (jsx_runtime_1.jsx(SchemaResetButton_1.SchemaResetButton, { onClick: resetToOriginal })) : null] }), renderingAvailable ? (jsx_runtime_1.jsx(RendersTab_1.RendersTab, { onClick: onRendersSelected, selected: panel === 'renders' })) : null] }) }), panel === 'inspector' ? (jsx_runtime_1.jsx(InspectorPanel_1.InspectorPanel, { composition: composition, currentDefaultProps: currentDefaultProps, setDefaultProps: setDefaultProps })) : !renderingAvailable ? null : (jsx_runtime_1.jsx(RenderQueue_1.RenderQueue, {}))] }));
|
|
190
181
|
};
|
|
191
182
|
exports.OptionsPanel = OptionsPanel;
|
|
@@ -19,6 +19,7 @@ const AlgoliaCredit_1 = require("./AlgoliaCredit");
|
|
|
19
19
|
const fuzzy_search_1 = require("./fuzzy-search");
|
|
20
20
|
const NoResults_1 = require("./NoResults");
|
|
21
21
|
const QuickSwitcherResult_1 = require("./QuickSwitcherResult");
|
|
22
|
+
const shared_1 = require("./shared");
|
|
22
23
|
const input = {
|
|
23
24
|
width: '100%',
|
|
24
25
|
};
|
|
@@ -56,12 +57,6 @@ const content = {
|
|
|
56
57
|
flexDirection: 'row',
|
|
57
58
|
alignItems: 'center',
|
|
58
59
|
};
|
|
59
|
-
const loopIndex = (index, length) => {
|
|
60
|
-
if (index < 0) {
|
|
61
|
-
index += length;
|
|
62
|
-
}
|
|
63
|
-
return index % length;
|
|
64
|
-
};
|
|
65
60
|
const stripQuery = (query) => {
|
|
66
61
|
if (query.startsWith('>') || query.startsWith('?')) {
|
|
67
62
|
return query.substring(1).trim();
|
|
@@ -232,7 +227,7 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
232
227
|
const onTextChange = (0, react_1.useCallback)((e) => {
|
|
233
228
|
setState({ query: e.target.value, selectedIndex: 0 });
|
|
234
229
|
}, []);
|
|
235
|
-
const selectedIndexRounded = loopIndex(state.selectedIndex, resultsArray.length);
|
|
230
|
+
const selectedIndexRounded = (0, shared_1.loopIndex)(state.selectedIndex, resultsArray.length);
|
|
236
231
|
const onActionsSelected = (0, react_1.useCallback)(() => {
|
|
237
232
|
var _a;
|
|
238
233
|
setState((s) => ({
|
|
@@ -8,6 +8,7 @@ const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
|
8
8
|
const still_1 = require("../../icons/still");
|
|
9
9
|
const video_1 = require("../../icons/video");
|
|
10
10
|
const layout_1 = require("../layout");
|
|
11
|
+
const shared_1 = require("./shared");
|
|
11
12
|
const container = {
|
|
12
13
|
paddingLeft: 16,
|
|
13
14
|
paddingRight: 16,
|
|
@@ -70,15 +71,7 @@ const QuickSwitcherResult = ({ result, selected }) => {
|
|
|
70
71
|
binding.unregister();
|
|
71
72
|
};
|
|
72
73
|
}, [keybindings, result.onSelected, selected]);
|
|
73
|
-
(0,
|
|
74
|
-
var _a;
|
|
75
|
-
if (selected) {
|
|
76
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
77
|
-
block: 'nearest',
|
|
78
|
-
inline: 'center',
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}, [selected]);
|
|
74
|
+
(0, shared_1.useScrollIntoViewOnSelected)(ref, selected);
|
|
82
75
|
const style = (0, react_1.useMemo)(() => {
|
|
83
76
|
return {
|
|
84
77
|
...container,
|
|
@@ -96,7 +89,7 @@ const QuickSwitcherResult = ({ result, selected }) => {
|
|
|
96
89
|
: selected || hovered
|
|
97
90
|
? 'white'
|
|
98
91
|
: colors_1.LIGHT_TEXT,
|
|
99
|
-
fontSize:
|
|
92
|
+
fontSize: shared_1.QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE,
|
|
100
93
|
};
|
|
101
94
|
}, [hovered, result.type, selected]);
|
|
102
95
|
return (jsx_runtime_1.jsxs("div", { ref: ref, style: style, onClick: result.onSelected, children: [result.type === 'composition' ? (result.compositionType === 'still' ? (jsx_runtime_1.jsx(still_1.StillIcon, { color: selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle })) : (jsx_runtime_1.jsx(video_1.FilmIcon, { color: selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle }))) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelContainer, children: result.type === 'search-result' ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export declare const QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE = 15;
|
|
3
|
+
export declare const loopIndex: (index: number, length: number) => number;
|
|
4
|
+
export declare const useScrollIntoViewOnSelected: <T extends HTMLElement>(ref: RefObject<T | null>, selected: boolean) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useScrollIntoViewOnSelected = exports.loopIndex = exports.QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE = 15;
|
|
6
|
+
const loopIndex = (index, length) => {
|
|
7
|
+
if (index < 0) {
|
|
8
|
+
index += length;
|
|
9
|
+
}
|
|
10
|
+
return index % length;
|
|
11
|
+
};
|
|
12
|
+
exports.loopIndex = loopIndex;
|
|
13
|
+
const useScrollIntoViewOnSelected = (ref, selected) => {
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (selected) {
|
|
17
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
18
|
+
block: 'nearest',
|
|
19
|
+
inline: 'center',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}, [ref, selected]);
|
|
23
|
+
};
|
|
24
|
+
exports.useScrollIntoViewOnSelected = useScrollIntoViewOnSelected;
|
|
@@ -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:
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
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:
|
|
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:
|
|
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
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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:
|
|
233
|
-
|
|
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;
|