@remotion/cli 4.0.0-alpha10 → 4.0.0-alpha12
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/config/index.d.ts +3 -3
- package/dist/config/log.d.ts +1 -1
- package/dist/config/max-timeline-tracks.js +6 -5
- package/dist/config/preview-server.js +2 -2
- package/dist/editor/components/AudioWaveform.d.ts +0 -1
- package/dist/editor/components/AudioWaveform.js +11 -6
- package/dist/editor/components/CurrentCompositionSideEffects.js +1 -1
- package/dist/editor/components/KeyboardShortcutsExplainer.js +1 -1
- package/dist/editor/components/Menu/is-menu-item.d.ts +2 -2
- package/dist/editor/components/Menu/is-menu-item.js +2 -2
- package/dist/editor/components/NewComposition/RemInput.d.ts +2 -2
- package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
- package/dist/editor/components/NewComposition/ValidationMessage.d.ts +2 -0
- package/dist/editor/components/NewComposition/ValidationMessage.js +3 -2
- package/dist/editor/components/Notifications/ServerDisconnected.js +1 -1
- package/dist/editor/components/RenderButton.js +1 -1
- package/dist/editor/components/RenderModal/DataEditor.js +1 -1
- package/dist/editor/components/RenderModal/RenderModalData.d.ts +2 -3
- package/dist/editor/components/RenderModal/RenderModalData.js +34 -23
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +1 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodErrorMessages.js +31 -6
- package/dist/editor/components/RenderQueue/index.js +1 -1
- package/dist/editor/components/Splitter/SplitterContainer.js +1 -0
- package/dist/editor/components/Timeline/MaxTimelineTracks.d.ts +1 -0
- package/dist/editor/components/Timeline/MaxTimelineTracks.js +3 -2
- package/dist/editor/components/Timeline/Timeline.js +4 -5
- package/dist/editor/components/Timeline/TimelineDragHandler.js +26 -11
- package/dist/editor/components/Timeline/TimelineInOutPointer.js +7 -5
- package/dist/editor/components/Timeline/TimelineInOutPointerHandle.js +9 -3
- package/dist/editor/components/Timeline/TimelineSequence.d.ts +0 -1
- package/dist/editor/components/Timeline/TimelineSequence.js +23 -21
- package/dist/editor/components/Timeline/TimelineSlider.js +17 -4
- package/dist/editor/components/Timeline/TimelineTimeIndicators.js +21 -23
- package/dist/editor/components/Timeline/TimelineTracks.d.ts +0 -1
- package/dist/editor/components/Timeline/TimelineTracks.js +2 -2
- package/dist/editor/components/Timeline/TimelineWidthProvider.d.ts +7 -0
- package/dist/editor/components/Timeline/TimelineWidthProvider.js +17 -0
- package/dist/editor/helpers/get-left-of-timeline-slider.d.ts +0 -4
- package/dist/editor/helpers/get-left-of-timeline-slider.js +1 -24
- package/dist/editor/helpers/use-keybinding.js +1 -1
- package/dist/editor/helpers/use-menu-structure.js +1 -1
- package/dist/event-source.js +1 -1
- package/dist/get-cli-options.d.ts +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/log.d.ts +3 -3
- package/dist/preview-server/live-events.js +5 -0
- package/dist/preview-server/render-queue/process-still.js +1 -1
- package/dist/preview-server/render-queue/process-video.js +1 -1
- package/dist/preview-server/start-server.js +4 -4
- package/dist/preview.js +0 -2
- package/dist/print-help.js +1 -1
- package/dist/server-ready-comment.d.ts +2 -0
- package/dist/server-ready-comment.js +13 -0
- package/dist/studio.js +4 -2
- package/package.json +8 -8
- package/dist/ansi/ansi-regex.d.ts +0 -2
- package/dist/ansi/ansi-regex.js +0 -18
- package/dist/config/ffmpeg-executable.d.ts +0 -5
- package/dist/config/ffmpeg-executable.js +0 -21
- package/dist/config/quality.d.ts +0 -2
- package/dist/config/quality.js +0 -17
- package/dist/editor/components/ClipboardIcon.d.ts +0 -2
- package/dist/editor/components/ClipboardIcon.js +0 -12
- package/dist/editor/components/CollapsedCompositionSelector.d.ts +0 -4
- package/dist/editor/components/CollapsedCompositionSelector.js +0 -39
- package/dist/editor/components/RichTimelineToggle.d.ts +0 -2
- package/dist/editor/components/RichTimelineToggle.js +0 -29
- package/dist/editor/components/Thumbnail.d.ts +0 -8
- package/dist/editor/components/Thumbnail.js +0 -76
- package/dist/editor/helpers/use-compact-ui.d.ts +0 -1
- package/dist/editor/helpers/use-compact-ui.js +0 -18
- package/dist/editor/icons/film.d.ts +0 -3
- package/dist/editor/icons/film.js +0 -8
- package/dist/editor/icons/timeline.d.ts +0 -3
- package/dist/editor/icons/timeline.js +0 -9
- package/dist/editor/state/rich-timeline.d.ts +0 -9
- package/dist/editor/state/rich-timeline.js +0 -17
- package/dist/get-render-media-options.d.ts +0 -8
- package/dist/get-render-media-options.js +0 -55
- package/dist/install.d.ts +0 -2
- package/dist/install.js +0 -36
- package/dist/is-javascript.d.ts +0 -2
- package/dist/is-javascript.js +0 -9
- package/dist/preview-server/dev-middleware/is-color-supported.d.ts +0 -1
- package/dist/preview-server/dev-middleware/is-color-supported.js +0 -37
- package/dist/preview-server/hot-middleware/strip-ansi.d.ts +0 -1
- package/dist/preview-server/hot-middleware/strip-ansi.js +0 -21
package/dist/config/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare global {
|
|
|
17
17
|
*/
|
|
18
18
|
readonly setCachingEnabled: (flag: boolean) => void;
|
|
19
19
|
/**
|
|
20
|
-
* Define on which port Remotion should start it's HTTP servers
|
|
20
|
+
* Define on which port Remotion should start it's HTTP servers.
|
|
21
21
|
* By default, Remotion will try to find a free port.
|
|
22
22
|
* If you specify a port, but it's not available, Remotion will throw an error.
|
|
23
23
|
*/
|
|
@@ -50,14 +50,14 @@ declare global {
|
|
|
50
50
|
*/
|
|
51
51
|
readonly setNumberOfSharedAudioTags: (numberOfAudioTags: number) => void;
|
|
52
52
|
/**
|
|
53
|
-
* Enable Webpack polling instead of file system listeners for hot reloading in the
|
|
53
|
+
* Enable Webpack polling instead of file system listeners for hot reloading in the Studio.
|
|
54
54
|
* This is useful if you are using a remote directory or a virtual machine.
|
|
55
55
|
* @param interval
|
|
56
56
|
* @default null
|
|
57
57
|
*/
|
|
58
58
|
readonly setWebpackPollingInMilliseconds: (interval: number | null) => void;
|
|
59
59
|
/**
|
|
60
|
-
* Whether Remotion should open a browser when starting the
|
|
60
|
+
* Whether Remotion should open a browser when starting the Studio.
|
|
61
61
|
* @param should
|
|
62
62
|
* @default true
|
|
63
63
|
*/
|
package/dist/config/log.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getLogLevel: () => "
|
|
1
|
+
export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error", setLogLevel: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMaxTimelineTracks = exports.setMaxTimelineTracks = void 0;
|
|
4
|
-
|
|
4
|
+
const MaxTimelineTracks_1 = require("../editor/components/Timeline/MaxTimelineTracks");
|
|
5
|
+
let maxTimelineTracks = MaxTimelineTracks_1.DEFAULT_TIMELINE_TRACKS;
|
|
5
6
|
const setMaxTimelineTracks = (maxTracks) => {
|
|
6
7
|
if (typeof maxTracks !== 'number') {
|
|
7
|
-
throw new Error(`Need to pass a number to Config.
|
|
8
|
+
throw new Error(`Need to pass a number to Config.setMaxTimelineTracks(), got ${typeof maxTracks}`);
|
|
8
9
|
}
|
|
9
10
|
if (Number.isNaN(maxTracks)) {
|
|
10
|
-
throw new Error(`Need to pass a real number to Config.
|
|
11
|
+
throw new Error(`Need to pass a real number to Config.setMaxTimelineTracks(), got NaN`);
|
|
11
12
|
}
|
|
12
13
|
if (!Number.isFinite(maxTracks)) {
|
|
13
|
-
throw new Error(`Need to pass a real number to Config.
|
|
14
|
+
throw new Error(`Need to pass a real number to Config.setMaxTimelineTracks(), got ${maxTracks}`);
|
|
14
15
|
}
|
|
15
16
|
if (maxTracks < 0) {
|
|
16
|
-
throw new Error(`Need to pass a non-negative number to Config.
|
|
17
|
+
throw new Error(`Need to pass a non-negative number to Config.setMaxTimelineTracks(), got ${maxTracks}`);
|
|
17
18
|
}
|
|
18
19
|
maxTimelineTracks = maxTracks;
|
|
19
20
|
};
|
|
@@ -4,14 +4,14 @@ exports.getServerPort = exports.setPort = void 0;
|
|
|
4
4
|
let serverPort;
|
|
5
5
|
const setPort = (port) => {
|
|
6
6
|
if (!['number', 'undefined'].includes(typeof port)) {
|
|
7
|
-
throw new Error(`
|
|
7
|
+
throw new Error(`Studio server port should be a number. Got ${typeof port} (${JSON.stringify(port)})`);
|
|
8
8
|
}
|
|
9
9
|
if (port === undefined) {
|
|
10
10
|
serverPort = undefined;
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
if (port < 1 || port > 65535) {
|
|
14
|
-
throw new Error(`
|
|
14
|
+
throw new Error(`Studio server port should be a number between 1 and 65535. Got ${port}`);
|
|
15
15
|
}
|
|
16
16
|
serverPort = port;
|
|
17
17
|
};
|
|
@@ -4,6 +4,7 @@ exports.AudioWaveform = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const media_utils_1 = require("@remotion/media-utils");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
+
const remotion_1 = require("remotion");
|
|
7
8
|
const timeline_layout_1 = require("../helpers/timeline-layout");
|
|
8
9
|
const AudioWaveformBar_1 = require("./AudioWaveformBar");
|
|
9
10
|
const container = {
|
|
@@ -26,10 +27,14 @@ const errorMessage = {
|
|
|
26
27
|
const canvasStyle = {
|
|
27
28
|
position: 'absolute',
|
|
28
29
|
};
|
|
29
|
-
const AudioWaveform = ({ src,
|
|
30
|
+
const AudioWaveform = ({ src, startFrom, durationInFrames, visualizationWidth, setMaxMediaDuration, volume, doesVolumeChange, playbackRate, }) => {
|
|
30
31
|
const [metadata, setMetadata] = (0, react_1.useState)(null);
|
|
31
32
|
const [error, setError] = (0, react_1.useState)(null);
|
|
32
33
|
const mountState = (0, react_1.useRef)({ isMounted: true });
|
|
34
|
+
const vidConf = remotion_1.Internals.useUnsafeVideoConfig();
|
|
35
|
+
if (vidConf === null) {
|
|
36
|
+
throw new Error('Expected video config');
|
|
37
|
+
}
|
|
33
38
|
const canvas = (0, react_1.useRef)(null);
|
|
34
39
|
(0, react_1.useEffect)(() => {
|
|
35
40
|
const { current } = mountState;
|
|
@@ -74,7 +79,7 @@ const AudioWaveform = ({ src, fps, startFrom, durationInFrames, visualizationWid
|
|
|
74
79
|
(0, media_utils_1.getAudioData)(src)
|
|
75
80
|
.then((data) => {
|
|
76
81
|
if (mountState.current.isMounted) {
|
|
77
|
-
setMaxMediaDuration(Math.floor(data.durationInSeconds * fps));
|
|
82
|
+
setMaxMediaDuration(Math.floor(data.durationInSeconds * vidConf.fps));
|
|
78
83
|
setMetadata(data);
|
|
79
84
|
}
|
|
80
85
|
})
|
|
@@ -84,7 +89,7 @@ const AudioWaveform = ({ src, fps, startFrom, durationInFrames, visualizationWid
|
|
|
84
89
|
setError(err);
|
|
85
90
|
}
|
|
86
91
|
});
|
|
87
|
-
}, [
|
|
92
|
+
}, [setMaxMediaDuration, src, vidConf.fps]);
|
|
88
93
|
const normalized = (0, react_1.useMemo)(() => {
|
|
89
94
|
if (!metadata || metadata.numberOfChannels === 0) {
|
|
90
95
|
return [];
|
|
@@ -92,13 +97,13 @@ const AudioWaveform = ({ src, fps, startFrom, durationInFrames, visualizationWid
|
|
|
92
97
|
const numberOfSamples = Math.floor(visualizationWidth / (AudioWaveformBar_1.WAVEFORM_BAR_LENGTH + AudioWaveformBar_1.WAVEFORM_BAR_MARGIN));
|
|
93
98
|
return (0, media_utils_1.getWaveformPortion)({
|
|
94
99
|
audioData: metadata,
|
|
95
|
-
startTimeInSeconds: startFrom / fps,
|
|
96
|
-
durationInSeconds: (durationInFrames / fps) * playbackRate,
|
|
100
|
+
startTimeInSeconds: startFrom / vidConf.fps,
|
|
101
|
+
durationInSeconds: (durationInFrames / vidConf.fps) * playbackRate,
|
|
97
102
|
numberOfSamples,
|
|
98
103
|
});
|
|
99
104
|
}, [
|
|
100
105
|
durationInFrames,
|
|
101
|
-
fps,
|
|
106
|
+
vidConf.fps,
|
|
102
107
|
metadata,
|
|
103
108
|
playbackRate,
|
|
104
109
|
startFrom,
|
|
@@ -27,7 +27,7 @@ const CurrentCompositionKeybindings = () => {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
if (type !== 'connected') {
|
|
30
|
-
(0, NotificationCenter_1.sendErrorNotification)('
|
|
30
|
+
(0, NotificationCenter_1.sendErrorNotification)('Studio server is offline');
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
const renderButton = document.getElementById('render-modal-button');
|
|
@@ -52,6 +52,6 @@ const li = {
|
|
|
52
52
|
fontSize: 14,
|
|
53
53
|
};
|
|
54
54
|
const KeyboardShortcutsExplainer = () => {
|
|
55
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? ((0, jsx_runtime_1.jsxs)("div", { style: keyboardShortcutsDisabled, children: ["Keyboard shortcuts disabled either due to:", (0, jsx_runtime_1.jsxs)("ul", { style: ul, children: [(0, jsx_runtime_1.jsx)("li", { style: li, children: "a) --disable-keyboard-shortcuts being passed" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: "b) Config.
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? ((0, jsx_runtime_1.jsxs)("div", { style: keyboardShortcutsDisabled, children: ["Keyboard shortcuts disabled either due to:", (0, jsx_runtime_1.jsxs)("ul", { style: ul, children: [(0, jsx_runtime_1.jsx)("li", { style: li, children: "a) --disable-keyboard-shortcuts being passed" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: "b) Config.setKeyboardShortcutsEnabled(false) being set or" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: " c) a Remotion version mismatch." })] })] })) : null, (0, jsx_runtime_1.jsxs)(layout_1.Row, { style: container, children: [(0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second back" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Previous frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Space" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Next frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second forward" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "A" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to beginning" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "E" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to end" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reverse playback" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "L" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Speed up" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Enter" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause & return to playback start" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Sidebar" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "B" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle left sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle right sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "G" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle both sidebars" })] }), (0, jsx_runtime_1.jsx)("br", {})] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 8 }), (0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Navigation" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "N" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "New composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "R" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Render composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "T" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle checkerboard transparency" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "?" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Show keyboard shortcuts" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Quick Switcher" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback range" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "I" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set In Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "O" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set Out Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "X" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Clear In/Out Points" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Zoom" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "+" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom in" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "-" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom out" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "0" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reset zoom" })] })] })] })] }));
|
|
56
56
|
};
|
|
57
57
|
exports.KeyboardShortcutsExplainer = KeyboardShortcutsExplainer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const MENU_INITIATOR_CLASSNAME = "__remotion-
|
|
2
|
-
export declare const MENU_ITEM_CLASSNAME = "__remotion-
|
|
1
|
+
export declare const MENU_INITIATOR_CLASSNAME = "__remotion-studio-menu-initiator";
|
|
2
|
+
export declare const MENU_ITEM_CLASSNAME = "__remotion-studio-menu-item";
|
|
3
3
|
export declare const HORIZONTAL_SCROLLBAR_CLASSNAME = "__remotion-horizontal-scrollbar";
|
|
4
4
|
export declare const VERTICAL_SCROLLBAR_CLASSNAME = "__remotion-vertical-scrollbar";
|
|
5
5
|
export declare const isMenuItem: (el: HTMLElement) => boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isMenuItem = exports.VERTICAL_SCROLLBAR_CLASSNAME = exports.HORIZONTAL_SCROLLBAR_CLASSNAME = exports.MENU_ITEM_CLASSNAME = exports.MENU_INITIATOR_CLASSNAME = void 0;
|
|
4
|
-
exports.MENU_INITIATOR_CLASSNAME = '__remotion-
|
|
5
|
-
exports.MENU_ITEM_CLASSNAME = '__remotion-
|
|
4
|
+
exports.MENU_INITIATOR_CLASSNAME = '__remotion-studio-menu-initiator';
|
|
5
|
+
exports.MENU_ITEM_CLASSNAME = '__remotion-studio-menu-item';
|
|
6
6
|
exports.HORIZONTAL_SCROLLBAR_CLASSNAME = '__remotion-horizontal-scrollbar';
|
|
7
7
|
exports.VERTICAL_SCROLLBAR_CLASSNAME = '__remotion-vertical-scrollbar';
|
|
8
8
|
const isMenuItem = (el) => {
|
|
@@ -12,6 +12,6 @@ export declare const getInputBorderColor: ({ status, isFocused, isHovered, }: {
|
|
|
12
12
|
status: 'error' | 'warning' | 'ok';
|
|
13
13
|
isFocused: boolean;
|
|
14
14
|
isHovered: boolean;
|
|
15
|
-
}) => "hsla(0, 0%, 100%, 0.15)" | "rgba(
|
|
16
|
-
export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | "rightAlign"
|
|
15
|
+
}) => "hsla(0, 0%, 100%, 0.15)" | "rgba(255, 255, 255, 0.05)" | "rgba(0, 0, 0, 0.6)" | "#ff3232" | "#f1c40f";
|
|
16
|
+
export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status" | "rightAlign"> & React.RefAttributes<HTMLInputElement>>;
|
|
17
17
|
export {};
|
|
@@ -3,5 +3,5 @@ import type { RemInputStatus } from './RemInput';
|
|
|
3
3
|
declare type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
|
|
4
4
|
status: RemInputStatus;
|
|
5
5
|
};
|
|
6
|
-
export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "key" |
|
|
6
|
+
export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status"> & React.RefAttributes<HTMLInputElement>>;
|
|
7
7
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidationMessage = void 0;
|
|
3
|
+
exports.ValidationMessage = exports.WarningTriangle = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const colors_1 = require("../../helpers/colors");
|
|
@@ -8,6 +8,7 @@ const layout_1 = require("../layout");
|
|
|
8
8
|
const WarningTriangle = (props) => {
|
|
9
9
|
return ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 576 512", ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "M248.747 204.705l6.588 112c.373 6.343 5.626 11.295 11.979 11.295h41.37a12 12 0 0 0 11.979-11.295l6.588-112c.405-6.893-5.075-12.705-11.979-12.705h-54.547c-6.903 0-12.383 5.812-11.978 12.705zM330 384c0 23.196-18.804 42-42 42s-42-18.804-42-42 18.804-42 42-42 42 18.804 42 42zm-.423-360.015c-18.433-31.951-64.687-32.009-83.154 0L6.477 440.013C-11.945 471.946 11.118 512 48.054 512H527.94c36.865 0 60.035-39.993 41.577-71.987L329.577 23.985zM53.191 455.002L282.803 57.008c2.309-4.002 8.085-4.002 10.394 0l229.612 397.993c2.308 4-.579 8.998-5.197 8.998H58.388c-4.617.001-7.504-4.997-5.197-8.997z" }) }));
|
|
10
10
|
};
|
|
11
|
+
exports.WarningTriangle = WarningTriangle;
|
|
11
12
|
const style = {
|
|
12
13
|
width: 12,
|
|
13
14
|
height: 12,
|
|
@@ -28,6 +29,6 @@ const ValidationMessage = ({ message, align, type }) => {
|
|
|
28
29
|
fill: type === 'warning' ? colors_1.WARNING_COLOR : colors_1.FAIL_COLOR,
|
|
29
30
|
};
|
|
30
31
|
}, [type]);
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", justify: align, children: [(0, jsx_runtime_1.jsx)(WarningTriangle, { style: finalStyle }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: label, children: message })] }) }));
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", justify: align, children: [(0, jsx_runtime_1.jsx)(exports.WarningTriangle, { style: finalStyle }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: label, children: message })] }) }));
|
|
32
33
|
};
|
|
33
34
|
exports.ValidationMessage = ValidationMessage;
|
|
@@ -44,6 +44,6 @@ const ServerDisconnected = () => {
|
|
|
44
44
|
if (pageIsGoingToReload) {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: container, className: "css-reset", children: (0, jsx_runtime_1.jsxs)("div", { style: message, children: ["The
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: container, className: "css-reset", children: (0, jsx_runtime_1.jsxs)("div", { style: message, children: ["The studio server has disconnected. ", (0, jsx_runtime_1.jsx)("br", {}), window.remotion_studioServerCommand ? ((0, jsx_runtime_1.jsxs)("span", { children: ["Run", ' ', (0, jsx_runtime_1.jsx)("code", { style: inlineCode, children: window.remotion_studioServerCommand }), ' ', "to run it again."] })) : ((0, jsx_runtime_1.jsx)("span", { children: "Fast refresh will not work." }))] }) }));
|
|
48
48
|
};
|
|
49
49
|
exports.ServerDisconnected = ServerDisconnected;
|
|
@@ -31,7 +31,7 @@ const RenderButton = () => {
|
|
|
31
31
|
const shortcut = (0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? '' : '(R)';
|
|
32
32
|
const tooltip = type === 'connected'
|
|
33
33
|
? 'Export the current composition ' + shortcut
|
|
34
|
-
: 'Connect to the
|
|
34
|
+
: 'Connect to the Studio server to render';
|
|
35
35
|
const iconStyle = (0, react_1.useMemo)(() => {
|
|
36
36
|
return {
|
|
37
37
|
style: {
|
|
@@ -260,7 +260,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
260
260
|
serializedJSON,
|
|
261
261
|
]);
|
|
262
262
|
if (connectionStatus === 'disconnected') {
|
|
263
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The
|
|
263
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The studio server has disconnected. Reconnect to edit the schema." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true })] }));
|
|
264
264
|
}
|
|
265
265
|
if (schema === 'no-zod') {
|
|
266
266
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.ZodNotInstalled, {});
|
|
@@ -4,15 +4,14 @@ export declare type State = {
|
|
|
4
4
|
str: string;
|
|
5
5
|
value: Record<string, unknown>;
|
|
6
6
|
validJSON: true;
|
|
7
|
-
zodValidation: Zod.SafeParseReturnType<unknown, unknown>;
|
|
8
7
|
} | {
|
|
9
8
|
str: string;
|
|
10
9
|
validJSON: false;
|
|
11
10
|
error: string;
|
|
12
11
|
};
|
|
13
12
|
export declare type PropsEditType = 'input-props' | 'default-props';
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
13
|
+
export declare const RenderModalData: React.FC<{
|
|
14
|
+
composition: AnyComposition;
|
|
16
15
|
inputProps: Record<string, unknown>;
|
|
17
16
|
setInputProps: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
18
17
|
compact: boolean;
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.RenderModalData = void 0;
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const remotion_1 = require("remotion");
|
|
@@ -62,7 +62,6 @@ const outer = {
|
|
|
62
62
|
flexDirection: 'column',
|
|
63
63
|
flex: 1,
|
|
64
64
|
overflow: 'hidden',
|
|
65
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
66
65
|
};
|
|
67
66
|
const controlContainer = {
|
|
68
67
|
flexDirection: 'column',
|
|
@@ -77,6 +76,15 @@ const tabWrapper = {
|
|
|
77
76
|
alignItems: 'center',
|
|
78
77
|
};
|
|
79
78
|
const persistanceKey = 'remotion.show-render-modalwarning';
|
|
79
|
+
const parseJSON = (str) => {
|
|
80
|
+
try {
|
|
81
|
+
const value = (0, input_props_serialization_1.deserializeJSONWithCustomFields)(str);
|
|
82
|
+
return { str, value, validJSON: true };
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
return { str, validJSON: false, error: e.message };
|
|
86
|
+
}
|
|
87
|
+
};
|
|
80
88
|
const getPersistedShowWarningState = () => {
|
|
81
89
|
const val = localStorage.getItem(persistanceKey);
|
|
82
90
|
if (!val) {
|
|
@@ -87,7 +95,7 @@ const getPersistedShowWarningState = () => {
|
|
|
87
95
|
const setPersistedShowWarningState = (val) => {
|
|
88
96
|
localStorage.setItem(persistanceKey, String(Boolean(val)));
|
|
89
97
|
};
|
|
90
|
-
const
|
|
98
|
+
const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayShowSaveButton, propsEditType, }) => {
|
|
91
99
|
const [mode, setMode] = (0, react_1.useState)('schema');
|
|
92
100
|
const [valBeforeSafe, setValBeforeSafe] = (0, react_1.useState)(inputProps);
|
|
93
101
|
const [saving, setSaving] = (0, react_1.useState)(false);
|
|
@@ -106,21 +114,21 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
106
114
|
}, [inJSONEditor, inputProps]);
|
|
107
115
|
const cliProps = (0, remotion_1.getInputProps)();
|
|
108
116
|
const [canSaveDefaultPropsObjectState, setCanSaveDefaultProps] = (0, react_1.useState)({
|
|
109
|
-
[
|
|
117
|
+
[composition.id]: get_render_modal_warnings_1.defaultTypeCanSaveState,
|
|
110
118
|
});
|
|
111
119
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
112
120
|
const schema = (0, react_1.useMemo)(() => {
|
|
113
121
|
if (!z) {
|
|
114
122
|
return 'no-zod';
|
|
115
123
|
}
|
|
116
|
-
if (!
|
|
124
|
+
if (!composition.schema) {
|
|
117
125
|
return z.object({});
|
|
118
126
|
}
|
|
119
|
-
if (!(typeof
|
|
127
|
+
if (!(typeof composition.schema.safeParse === 'function')) {
|
|
120
128
|
throw new Error('A value which is not a Zod schema was passed to `schema`');
|
|
121
129
|
}
|
|
122
|
-
return
|
|
123
|
-
}, [
|
|
130
|
+
return composition.schema;
|
|
131
|
+
}, [composition.schema, z]);
|
|
124
132
|
const zodValidationResult = (0, react_1.useMemo)(() => {
|
|
125
133
|
if (schema === 'no-zod') {
|
|
126
134
|
return 'no-zod';
|
|
@@ -138,19 +146,19 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
138
146
|
});
|
|
139
147
|
}, []);
|
|
140
148
|
const canSaveDefaultProps = (0, react_1.useMemo)(() => {
|
|
141
|
-
return canSaveDefaultPropsObjectState[
|
|
142
|
-
? canSaveDefaultPropsObjectState[
|
|
149
|
+
return canSaveDefaultPropsObjectState[composition.id]
|
|
150
|
+
? canSaveDefaultPropsObjectState[composition.id]
|
|
143
151
|
: get_render_modal_warnings_1.defaultTypeCanSaveState;
|
|
144
|
-
}, [canSaveDefaultPropsObjectState,
|
|
152
|
+
}, [canSaveDefaultPropsObjectState, composition.id]);
|
|
145
153
|
const showSaveButton = mayShowSaveButton && canSaveDefaultProps.canUpdate;
|
|
146
154
|
const { fastRefreshes } = (0, react_1.useContext)(remotion_1.Internals.NonceContext);
|
|
147
155
|
(0, react_1.useEffect)(() => {
|
|
148
|
-
(0, actions_1.canUpdateDefaultProps)(
|
|
156
|
+
(0, actions_1.canUpdateDefaultProps)(composition.id)
|
|
149
157
|
.then((can) => {
|
|
150
158
|
if (can.canUpdate) {
|
|
151
159
|
setCanSaveDefaultProps((prevState) => ({
|
|
152
160
|
...prevState,
|
|
153
|
-
[
|
|
161
|
+
[composition.id]: {
|
|
154
162
|
canUpdate: true,
|
|
155
163
|
},
|
|
156
164
|
}));
|
|
@@ -158,7 +166,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
158
166
|
else {
|
|
159
167
|
setCanSaveDefaultProps((prevState) => ({
|
|
160
168
|
...prevState,
|
|
161
|
-
[
|
|
169
|
+
[composition.id]: {
|
|
162
170
|
canUpdate: false,
|
|
163
171
|
reason: can.reason,
|
|
164
172
|
determined: true,
|
|
@@ -169,14 +177,14 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
169
177
|
.catch((err) => {
|
|
170
178
|
setCanSaveDefaultProps((prevState) => ({
|
|
171
179
|
...prevState,
|
|
172
|
-
[
|
|
180
|
+
[composition.id]: {
|
|
173
181
|
canUpdate: false,
|
|
174
182
|
reason: err.message,
|
|
175
183
|
determined: true,
|
|
176
184
|
},
|
|
177
185
|
}));
|
|
178
186
|
});
|
|
179
|
-
}, [
|
|
187
|
+
}, [composition.id]);
|
|
180
188
|
const modeItems = (0, react_1.useMemo)(() => {
|
|
181
189
|
return [
|
|
182
190
|
{
|
|
@@ -197,18 +205,21 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
197
205
|
},
|
|
198
206
|
];
|
|
199
207
|
}, [mode]);
|
|
208
|
+
const switchToSchema = (0, react_1.useCallback)(() => {
|
|
209
|
+
setMode('schema');
|
|
210
|
+
}, []);
|
|
200
211
|
const onUpdate = (0, react_1.useCallback)(() => {
|
|
201
212
|
if (schema === 'no-zod' || z === null) {
|
|
202
213
|
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
|
|
203
214
|
return;
|
|
204
215
|
}
|
|
205
216
|
setValBeforeSafe(inputProps);
|
|
206
|
-
(0, actions_1.updateDefaultProps)(
|
|
217
|
+
(0, actions_1.updateDefaultProps)(composition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).then((response) => {
|
|
207
218
|
if (!response.success) {
|
|
208
219
|
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: ' + response.reason);
|
|
209
220
|
}
|
|
210
221
|
});
|
|
211
|
-
}, [
|
|
222
|
+
}, [composition.id, inputProps, schema, z]);
|
|
212
223
|
(0, react_1.useEffect)(() => {
|
|
213
224
|
setSaving(false);
|
|
214
225
|
}, [fastRefreshes]);
|
|
@@ -218,7 +229,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
218
229
|
return;
|
|
219
230
|
}
|
|
220
231
|
setSaving(true);
|
|
221
|
-
(0, actions_1.updateDefaultProps)(
|
|
232
|
+
(0, actions_1.updateDefaultProps)(composition.id, updater(composition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
222
233
|
.then((response) => {
|
|
223
234
|
if (!response.success) {
|
|
224
235
|
console.log(response.stack);
|
|
@@ -229,7 +240,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
229
240
|
(0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${err.message}`);
|
|
230
241
|
setSaving(false);
|
|
231
242
|
});
|
|
232
|
-
}, [
|
|
243
|
+
}, [composition.defaultProps, composition.id, schema, z]);
|
|
233
244
|
const connectionStatus = (0, react_1.useContext)(client_id_1.PreviewServerConnectionCtx).type;
|
|
234
245
|
const warnings = (0, react_1.useMemo)(() => {
|
|
235
246
|
return (0, get_render_modal_warnings_1.getRenderModalWarnings)({
|
|
@@ -267,11 +278,11 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
267
278
|
if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
|
|
268
279
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.NoSchemaDefined, {});
|
|
269
280
|
}
|
|
270
|
-
if (!
|
|
281
|
+
if (!composition.defaultProps) {
|
|
271
282
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.NoDefaultProps, {});
|
|
272
283
|
}
|
|
273
284
|
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: tabWrapper, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), warnings.length > 0 ? ((0, jsx_runtime_1.jsx)(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
|
|
274
285
|
? warnings.map((warning) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: warning, align: "flex-start", type: "warning" })] }, warning)))
|
|
275
|
-
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps:
|
|
286
|
+
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps: composition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: !zodValidationResult.success })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, zodValidationResult: zodValidationResult, switchToSchema: switchToSchema, onSave: onUpdate, valBeforeSafe: valBeforeSafe, showSaveButton: showSaveButton, serializedJSON: serializedJSON, parseJSON: parseJSON }))] }));
|
|
276
287
|
};
|
|
277
|
-
exports.
|
|
288
|
+
exports.RenderModalData = RenderModalData;
|
|
@@ -130,7 +130,7 @@ const RenderModalJSONPropsEditor = ({ setValue, value, defaultProps, onSave, val
|
|
|
130
130
|
borderColor: colors_1.FAIL_COLOR,
|
|
131
131
|
};
|
|
132
132
|
}, [localValue]);
|
|
133
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: scrollable, children: [(0, jsx_runtime_1.jsx)(RemTextarea_1.RemTextarea, { onChange: onChange, value: localValue.str, status: localValue.validJSON ? 'ok' : 'error', style: textAreaStyle }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), localValue.validJSON === false ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.error, type: "error" })) : localValue.zodValidation.success === false ? ((0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: localValue.zodValidation })) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { disabled: !localValue.validJSON ||
|
|
133
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: scrollable, children: [(0, jsx_runtime_1.jsx)(RemTextarea_1.RemTextarea, { onChange: onChange, value: localValue.str, status: localValue.validJSON ? 'ok' : 'error', style: textAreaStyle }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), localValue.validJSON === false ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.error, type: "error" })) : localValue.zodValidation.success === false ? ((0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: localValue.zodValidation, viewTab: "json" })) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { disabled: !localValue.validJSON ||
|
|
134
134
|
!(localValue.validJSON && !localValue.zodValidation.success), onClick: reset, children: "Reset" }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsx)(Button_1.Button, { disabled: !localValue.validJSON, onClick: onPretty, children: "Format" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onSave, disabled: !(localValue.validJSON && localValue.zodValidation.success) ||
|
|
135
135
|
!localValue.validJSON ||
|
|
136
136
|
!hasChanged ||
|
|
@@ -51,11 +51,11 @@ const NoDefaultProps = () => {
|
|
|
51
51
|
exports.NoDefaultProps = NoDefaultProps;
|
|
52
52
|
const InvalidDefaultProps = ({ zodValidationResult }) => {
|
|
53
53
|
// TODO: Does not react to when schema is updated
|
|
54
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " prop in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: '<Composition>' }), " is not valid:"] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Fix the schema by changing the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " prop in your composition so it does not give a type error."] })] }));
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " prop in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: '<Composition>' }), " is not valid:"] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult, viewTab: "schema" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Fix the schema by changing the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " prop in your composition so it does not give a type error."] })] }));
|
|
55
55
|
};
|
|
56
56
|
exports.InvalidDefaultProps = InvalidDefaultProps;
|
|
57
57
|
const InvalidSchema = ({ zodValidationResult, reset }) => {
|
|
58
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " that you have defined."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: reset, children: "Reset props" })] }));
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult, viewTab: "schema" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " that you have defined."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: reset, children: "Reset props" })] }));
|
|
59
59
|
};
|
|
60
60
|
exports.InvalidSchema = InvalidSchema;
|
|
61
61
|
const TopLevelZodValue = ({ typeReceived }) => {
|
|
@@ -2,22 +2,47 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZodErrorMessages = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const colors_1 = require("../../../helpers/colors");
|
|
6
|
-
const
|
|
7
|
+
const layout_1 = require("../../layout");
|
|
8
|
+
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
9
|
+
const schemaLabel = {
|
|
7
10
|
fontSize: 14,
|
|
8
11
|
color: colors_1.LIGHT_TEXT,
|
|
12
|
+
};
|
|
13
|
+
const jsonLabel = {
|
|
14
|
+
color: 'white',
|
|
15
|
+
fontSize: 13,
|
|
9
16
|
fontFamily: 'sans-serif',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
10
19
|
};
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
const triangleStyle = {
|
|
21
|
+
width: 12,
|
|
22
|
+
height: 12,
|
|
23
|
+
flexShrink: 0,
|
|
24
|
+
fill: colors_1.FAIL_COLOR,
|
|
14
25
|
};
|
|
15
|
-
const ZodErrorMessages = ({ zodValidationResult }) => {
|
|
26
|
+
const ZodErrorMessages = ({ zodValidationResult, viewTab }) => {
|
|
16
27
|
if (zodValidationResult.success) {
|
|
17
28
|
throw new Error('Expected error');
|
|
18
29
|
}
|
|
30
|
+
const style = (0, react_1.useMemo)(() => {
|
|
31
|
+
return viewTab === 'json' ? jsonLabel : schemaLabel;
|
|
32
|
+
}, [viewTab]);
|
|
33
|
+
const code = (0, react_1.useMemo)(() => {
|
|
34
|
+
return {
|
|
35
|
+
...schemaLabel,
|
|
36
|
+
fontFamily: 'monospace',
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
if (viewTab === 'json') {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: zodValidationResult.error.errors.map((error) => {
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: style, children: [(0, jsx_runtime_1.jsx)(ValidationMessage_1.WarningTriangle, { style: triangleStyle }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), error.path.length === 0 ? 'Root' : error.path.join('.'), ":", ' ', error.message] }, error.path.join('.')));
|
|
42
|
+
}) }));
|
|
43
|
+
}
|
|
19
44
|
return ((0, jsx_runtime_1.jsx)("div", { children: zodValidationResult.error.errors.map((error) => {
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style:
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: style, children: ["-", ' ', (0, jsx_runtime_1.jsx)("code", { style: code, children: error.path.length === 0 ? 'Root' : error.path.join('.') }), ": ", error.message] }, error.path.join('.')));
|
|
21
46
|
}) }));
|
|
22
47
|
};
|
|
23
48
|
exports.ZodErrorMessages = ZodErrorMessages;
|
|
@@ -38,7 +38,7 @@ const RenderQueue = () => {
|
|
|
38
38
|
const { jobs } = (0, react_1.useContext)(context_1.RenderQueueContext);
|
|
39
39
|
const jobCount = jobs.length;
|
|
40
40
|
if (connectionStatus === 'disconnected') {
|
|
41
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The studio server has disconnected." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true })] }));
|
|
42
42
|
}
|
|
43
43
|
if (jobCount === 0) {
|
|
44
44
|
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "No renders in the queue." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true })] }));
|