@remotion/studio 4.0.507 → 4.0.508
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/FastRefreshProvider.js +13 -9
- package/dist/components/CodingAgentIcon.d.ts +3 -1
- package/dist/components/CodingAgentIcon.js +4 -9
- package/dist/components/ConfigureDefaultEditorModal.js +1 -1
- package/dist/components/ContextMenu.d.ts +1 -0
- package/dist/components/ContextMenu.js +32 -5
- package/dist/components/EditorContent.js +4 -3
- package/dist/components/InlineAction.d.ts +2 -1
- package/dist/components/InlineAction.js +3 -3
- package/dist/components/InspectorLocationCopy.js +1 -1
- package/dist/components/InspectorOpenInEditor.d.ts +1 -0
- package/dist/components/InspectorOpenInEditor.js +44 -3
- package/dist/components/InspectorPanel/AlignmentControls.js +2 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +3 -1
- package/dist/components/InspectorPanel/styles.js +1 -1
- package/dist/components/InspectorSequenceSection.js +36 -4
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/PlayPause.d.ts +1 -1
- package/dist/components/PlayPause.js +61 -12
- package/dist/components/RenderButton.js +16 -12
- package/dist/components/RenderModal/GuiRenderStatus.js +23 -6
- package/dist/components/RenderModal/InfoBubble.d.ts +1 -0
- package/dist/components/RenderModal/InfoBubble.js +6 -4
- package/dist/components/RenderModal/InfoTooltip.d.ts +1 -0
- package/dist/components/RenderModal/InfoTooltip.js +12 -12
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +5 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +16 -3
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -0
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +3 -2
- 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 +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +6 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +12 -1
- package/dist/components/SelectedOutlineCanvasRotation.d.ts +9 -0
- package/dist/components/SelectedOutlineCanvasRotation.js +237 -0
- package/dist/components/SelectedOutlineElement.d.ts +2 -1
- package/dist/components/SelectedOutlineElement.js +36 -5
- package/dist/components/SelectedOutlineOverlay.d.ts +1 -1
- package/dist/components/SelectedOutlineOverlay.js +55 -26
- package/dist/components/SelectedOutlinePolygon.d.ts +1 -0
- package/dist/components/SelectedOutlinePolygon.js +4 -3
- package/dist/components/SelectedOutlineRenderer.d.ts +1 -0
- package/dist/components/SelectedOutlineRenderer.js +24 -7
- package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +1 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.js +7 -5
- package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +1 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.js +9 -5
- package/dist/components/SelectedOutlineTransformOriginHandle.js +48 -22
- package/dist/components/SequencePropsSubscriptionProvider.js +8 -0
- package/dist/components/SettingsModalFooter.js +1 -1
- package/dist/components/Timeline/SequencePropsObserver.js +97 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +4 -2
- package/dist/components/Timeline/TimelineEffectItem.js +1 -4
- package/dist/components/Timeline/TimelineFieldRowContent.js +10 -3
- package/dist/components/Timeline/TimelineRotationField.js +84 -12
- package/dist/components/Timeline/TimelineScaleField.js +58 -4
- package/dist/components/Timeline/TimelineSelection.d.ts +4 -0
- package/dist/components/Timeline/TimelineSelection.js +45 -2
- package/dist/components/Timeline/TimelineSequenceItem.js +42 -1
- package/dist/components/Timeline/TimelineSequencePropItem.js +5 -2
- package/dist/components/Timeline/TimelineTransformOriginField.js +78 -4
- package/dist/components/Timeline/TimelineTranslateField.js +55 -15
- package/dist/components/Timeline/Transform3DModeContext.d.ts +1 -0
- package/dist/components/Timeline/Transform3DModeContext.js +5 -0
- package/dist/components/Timeline/delete-selected-timeline-item.js +0 -6
- package/dist/components/Timeline/get-sequence-context-menu-items.js +13 -6
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
- package/dist/components/Timeline/sequence-props-subscription-store.js +5 -2
- package/dist/components/Timeline/timeline-field-display-utils.js +2 -2
- package/dist/components/Timeline/timeline-field-row-layout.d.ts +6 -0
- package/dist/components/Timeline/timeline-field-row-layout.js +16 -1
- package/dist/components/Timeline/timeline-rotation-utils.d.ts +16 -0
- package/dist/components/Timeline/timeline-rotation-utils.js +145 -4
- package/dist/components/Timeline/timeline-translate-utils.d.ts +3 -2
- package/dist/components/Timeline/timeline-translate-utils.js +8 -4
- package/dist/components/Timeline/transform-3d-mode.d.ts +6 -0
- package/dist/components/Timeline/transform-3d-mode.js +36 -0
- package/dist/components/Timeline/transform-origin-utils.d.ts +4 -0
- package/dist/components/Timeline/transform-origin-utils.js +12 -6
- package/dist/components/Timeline/use-open-sequence-in-apps.js +1 -1
- package/dist/components/Timeline/use-resolved-stack-react-to-change.d.ts +5 -1
- package/dist/components/Timeline/use-resolved-stack-react-to-change.js +45 -9
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -1
- package/dist/components/Timeline/use-sequence-props-subscription.js +7 -2
- package/dist/components/call-api.js +2 -0
- package/dist/components/canvas-rotation-cursor.d.ts +1 -0
- package/dist/components/canvas-rotation-cursor.js +14 -0
- package/dist/components/get-open-in-menu-items.d.ts +6 -1
- package/dist/components/get-open-in-menu-items.js +69 -8
- package/dist/components/selected-outline-drag.d.ts +11 -5
- package/dist/components/selected-outline-drag.js +80 -42
- package/dist/components/selected-outline-measurement.d.ts +5 -0
- package/dist/components/selected-outline-measurement.js +28 -1
- package/dist/components/selected-outline-types.d.ts +6 -0
- package/dist/esm/{chunk-ptnd65a9.js → chunk-zpn4m49r.js} +8458 -6911
- package/dist/esm/index.mjs +357 -2
- package/dist/esm/internals.mjs +8458 -6911
- package/dist/esm/previewEntry.mjs +8363 -6816
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/get-box-quads-polyfill-internals.js +10 -2
- package/dist/helpers/open-in-editor.d.ts +3 -1
- package/dist/helpers/open-in-editor.js +5 -1
- package/dist/helpers/preview-server-events.js +4 -0
- package/dist/helpers/sequence-node-path-mutations.d.ts +4 -0
- package/dist/helpers/sequence-node-path-mutations.js +31 -0
- package/dist/icons/cube.d.ts +4 -0
- package/dist/icons/cube.js +6 -0
- package/dist/icons/finder.d.ts +4 -0
- package/dist/icons/finder.js +8 -0
- package/dist/icons/terminal.d.ts +6 -0
- package/dist/icons/terminal.js +46 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -0
- package/dist/state/transform-3d-mode.d.ts +10 -0
- package/dist/state/transform-3d-mode.js +27 -0
- package/dist/state/z-index.js +5 -8
- package/package.json +12 -12
|
@@ -390,17 +390,21 @@ const RenderButtonInner = ({ readOnlyStudio, size: controlSize = 'default', narr
|
|
|
390
390
|
];
|
|
391
391
|
}
|
|
392
392
|
return [
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
393
|
+
...(canServerRender
|
|
394
|
+
? [
|
|
395
|
+
{
|
|
396
|
+
type: 'item',
|
|
397
|
+
id: 'server-render',
|
|
398
|
+
label: 'Server-side render',
|
|
399
|
+
value: 'server-render',
|
|
400
|
+
onClick: () => handleRenderTypeChange('server-render'),
|
|
401
|
+
keyHint: null,
|
|
402
|
+
leftItem: null,
|
|
403
|
+
subMenu: null,
|
|
404
|
+
quickSwitcherLabel: null,
|
|
405
|
+
},
|
|
406
|
+
]
|
|
407
|
+
: []),
|
|
404
408
|
{
|
|
405
409
|
type: 'item',
|
|
406
410
|
id: 'client-render',
|
|
@@ -413,7 +417,7 @@ const RenderButtonInner = ({ readOnlyStudio, size: controlSize = 'default', narr
|
|
|
413
417
|
quickSwitcherLabel: null,
|
|
414
418
|
},
|
|
415
419
|
];
|
|
416
|
-
}, [handleRenderTypeChange, readOnlyStudio]);
|
|
420
|
+
}, [canServerRender, handleRenderTypeChange, readOnlyStudio]);
|
|
417
421
|
const spaceToBottom = (0, react_1.useMemo)(() => {
|
|
418
422
|
const margin = 10;
|
|
419
423
|
if (size && dropdownOpened) {
|
|
@@ -29,12 +29,29 @@ const right = {
|
|
|
29
29
|
const BundlingProgress = ({ progress, doneIn }) => {
|
|
30
30
|
return (jsx_runtime_1.jsxs("div", { style: progressItem, children: [progress === 1 ? (jsx_runtime_1.jsx(SuccessIcon_1.SuccessIcon, {})) : (jsx_runtime_1.jsx(CircularProgress_1.CircularProgress, { progress: progress })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: progress === 1 ? 'Bundled' : `Bundling ${progress * 100}%` }), doneIn ? jsx_runtime_1.jsxs("div", { style: right, children: [doneIn, "ms"] }) : null] }));
|
|
31
31
|
};
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
const failIconStyle = {
|
|
33
|
+
width: 16,
|
|
34
|
+
height: 16,
|
|
35
|
+
};
|
|
36
|
+
const FailIcon = () => {
|
|
37
|
+
return (jsx_runtime_1.jsx("svg", { style: failIconStyle, viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: colors_1.FAIL_COLOR, d: "M0 160V352L160 512H352L512 352V160L352 0H160L0 160zm353.9 32l-17 17-47 47 47 47 17 17L320 353.9l-17-17-47-47-47 47-17 17L158.1 320l17-17 47-47-47-47-17-17L192 158.1l17 17 47 47 47-47 17-17L353.9 192z" }) }));
|
|
38
|
+
};
|
|
39
|
+
const BrowserSetupProgress = ({ progress, doneIn, startedBundling, alreadyAvailable, error }) => {
|
|
40
|
+
if (error) {
|
|
41
|
+
return (jsx_runtime_1.jsxs("div", { style: progressItem, children: [
|
|
42
|
+
jsx_runtime_1.jsx(FailIcon, {}), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: "Failed to download Headless Shell" })
|
|
43
|
+
] }));
|
|
44
|
+
}
|
|
45
|
+
// Before the first download callback or the bundling phase, we don't know
|
|
46
|
+
// yet whether the browser is available - don't show a success state.
|
|
47
|
+
const stillChecking = alreadyAvailable && progress === 0 && !startedBundling;
|
|
48
|
+
return (jsx_runtime_1.jsxs("div", { style: progressItem, children: [stillChecking ? (jsx_runtime_1.jsx(CircularProgress_1.CircularProgress, { progress: 0 })) : progress === 1 || alreadyAvailable ? (jsx_runtime_1.jsx(SuccessIcon_1.SuccessIcon, {})) : (jsx_runtime_1.jsx(CircularProgress_1.CircularProgress, { progress: progress })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: stillChecking
|
|
49
|
+
? 'Checking for Headless Shell'
|
|
50
|
+
: alreadyAvailable && startedBundling
|
|
51
|
+
? 'Headless browser already available'
|
|
52
|
+
: progress === 1
|
|
53
|
+
? 'Downloaded Headless Shell'
|
|
54
|
+
: `Downloading Headless Shell ${Math.round(progress * 100)}%` }), doneIn ? jsx_runtime_1.jsxs("div", { style: right, children: [doneIn, "ms"] }) : null] }));
|
|
38
55
|
};
|
|
39
56
|
const RenderingProgress = ({ progress }) => {
|
|
40
57
|
return (jsx_runtime_1.jsxs("div", { style: progressItem, children: [progress.frames === progress.totalFrames ? (jsx_runtime_1.jsx(SuccessIcon_1.SuccessIcon, {})) : (jsx_runtime_1.jsx(CircularProgress_1.CircularProgress, { progress: progress.frames / progress.totalFrames })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: progress.doneIn
|
|
@@ -23,7 +23,7 @@ const container = {
|
|
|
23
23
|
fontSize: 14,
|
|
24
24
|
verticalAlign: 'text-bottom',
|
|
25
25
|
};
|
|
26
|
-
const InfoBubble = ({ title, children }) => {
|
|
26
|
+
const InfoBubble = ({ title, children, horizontalAlignment = 'left' }) => {
|
|
27
27
|
const [hovered, setIsHovered] = (0, react_1.useState)(false);
|
|
28
28
|
const [opened, setOpened] = (0, react_1.useState)(false);
|
|
29
29
|
const ref = (0, react_1.useRef)(null);
|
|
@@ -95,9 +95,11 @@ const InfoBubble = ({ title, children }) => {
|
|
|
95
95
|
position: 'fixed',
|
|
96
96
|
bottom: size.windowSize.height - size.top,
|
|
97
97
|
}),
|
|
98
|
-
|
|
98
|
+
...(horizontalAlignment === 'left'
|
|
99
|
+
? { left: size.left }
|
|
100
|
+
: { right: size.windowSize.width - (size.left + size.width) }),
|
|
99
101
|
};
|
|
100
|
-
}, [layout, opened, size]);
|
|
102
|
+
}, [horizontalAlignment, layout, opened, size]);
|
|
101
103
|
const style = (0, react_1.useMemo)(() => {
|
|
102
104
|
return {
|
|
103
105
|
...container,
|
|
@@ -112,7 +114,7 @@ const InfoBubble = ({ title, children }) => {
|
|
|
112
114
|
}, []);
|
|
113
115
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
114
116
|
jsx_runtime_1.jsx("button", { ref: ref, tabIndex: tabIndex, style: style, title: title, type: "button", children: jsx_runtime_1.jsx("svg", { style: icon, viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, d: "M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336c-13.3 0-24 10.7-24 24s10.7 24 24 24h80c13.3 0 24-10.7 24-24s-10.7-24-24-24h-8V248c0-13.3-10.7-24-24-24H216c-13.3 0-24 10.7-24 24s10.7 24 24 24h24v64H216zm40-144a32 32 0 1 0 0-64 32 32 0 1 0 0 64z" }) }) }), portalStyle
|
|
115
|
-
? react_dom_1.default.createPortal(jsx_runtime_1.jsx("div", { style: styles_1.outerPortal, className: "css-reset", children: jsx_runtime_1.jsx(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: jsx_runtime_1.jsx("div", { style: portalStyle, children: jsx_runtime_1.jsx(InfoTooltip_1.InfoTooltip, { backgroundColor: colors_1.INPUT_BACKGROUND, arrowDirection: layout, children: children }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
|
|
117
|
+
? react_dom_1.default.createPortal(jsx_runtime_1.jsx("div", { style: styles_1.outerPortal, className: "css-reset", children: jsx_runtime_1.jsx(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: jsx_runtime_1.jsx("div", { style: portalStyle, children: jsx_runtime_1.jsx(InfoTooltip_1.InfoTooltip, { backgroundColor: colors_1.INPUT_BACKGROUND, arrowDirection: layout, horizontalAlignment: horizontalAlignment, children: children }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
|
|
116
118
|
: null] }));
|
|
117
119
|
};
|
|
118
120
|
exports.InfoBubble = InfoBubble;
|
|
@@ -10,17 +10,8 @@ const arrow = {
|
|
|
10
10
|
height: 7,
|
|
11
11
|
display: 'block',
|
|
12
12
|
overflow: 'visible',
|
|
13
|
-
marginLeft: 7,
|
|
14
13
|
};
|
|
15
|
-
const
|
|
16
|
-
...arrow,
|
|
17
|
-
transform: `translateY(1px)`,
|
|
18
|
-
};
|
|
19
|
-
const arrowDown = {
|
|
20
|
-
...arrow,
|
|
21
|
-
marginTop: -1,
|
|
22
|
-
};
|
|
23
|
-
const InfoTooltip = ({ children, arrowDirection, backgroundColor }) => {
|
|
14
|
+
const InfoTooltip = ({ children, arrowDirection, backgroundColor, horizontalAlignment }) => {
|
|
24
15
|
const container = (0, react_1.useMemo)(() => {
|
|
25
16
|
return {
|
|
26
17
|
boxShadow: arrowDirection === 'down' ? styles_1.SHADOW_TOWARDS_TOP : styles_1.SHADOW_TOWARDS_BOTTOM,
|
|
@@ -32,11 +23,20 @@ const InfoTooltip = ({ children, arrowDirection, backgroundColor }) => {
|
|
|
32
23
|
borderRadius: '4px',
|
|
33
24
|
};
|
|
34
25
|
}, [arrowDirection, backgroundColor]);
|
|
26
|
+
const arrowStyle = (0, react_1.useMemo)(() => {
|
|
27
|
+
return {
|
|
28
|
+
...arrow,
|
|
29
|
+
...(horizontalAlignment === 'left' ? { marginLeft: 7 } : { marginRight: 7 }),
|
|
30
|
+
...(arrowDirection === 'up'
|
|
31
|
+
? { transform: `translateY(1px)` }
|
|
32
|
+
: { marginTop: -1 }),
|
|
33
|
+
};
|
|
34
|
+
}, [arrowDirection, horizontalAlignment]);
|
|
35
35
|
return (jsx_runtime_1.jsxs("div", { style: {
|
|
36
36
|
display: 'flex',
|
|
37
37
|
flexDirection: arrowDirection === 'up' ? 'column-reverse' : 'column',
|
|
38
|
-
alignItems: 'flex-start',
|
|
38
|
+
alignItems: horizontalAlignment === 'left' ? 'flex-start' : 'flex-end',
|
|
39
39
|
}, children: [
|
|
40
|
-
jsx_runtime_1.jsx("div", { style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: children }), arrowDirection === 'down' ? (jsx_runtime_1.jsx("svg", { viewBox: "0 0 14 7", style:
|
|
40
|
+
jsx_runtime_1.jsx("div", { style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: children }), arrowDirection === 'down' ? (jsx_runtime_1.jsx("svg", { viewBox: "0 0 14 7", style: arrowStyle, children: jsx_runtime_1.jsx("path", { d: `M 14 0 L 7 7 L 0 0`, fill: backgroundColor, strokeLinecap: "butt", stroke: colors_1.BLACK_HEX, strokeWidth: 0.5 }) })) : null, arrowDirection === 'up' ? (jsx_runtime_1.jsx("svg", { viewBox: "0 0 14 7", style: arrowStyle, children: jsx_runtime_1.jsx("path", { d: `M 0 7 L 7 0 L 14 7`, fill: backgroundColor, strokeLinecap: "butt", stroke: colors_1.BLACK_HEX, strokeWidth: 0.5 }) })) : null] }));
|
|
41
41
|
};
|
|
42
42
|
exports.InfoTooltip = InfoTooltip;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { JSONPath } from './zod-types';
|
|
3
|
+
export declare const SchemaDescriptionOverrideContext: React.Context<{
|
|
4
|
+
readonly jsonPath: JSONPath;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
} | null>;
|
|
3
7
|
export declare const SchemaLabel: React.FC<{
|
|
4
8
|
readonly jsonPath: JSONPath;
|
|
5
9
|
readonly onRemove: null | (() => void);
|
|
6
10
|
readonly valid: boolean;
|
|
7
11
|
readonly suffix: string | null;
|
|
8
12
|
readonly handleClick: null | (() => void);
|
|
13
|
+
readonly description: string | null;
|
|
9
14
|
}>;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SchemaLabel = void 0;
|
|
3
|
+
exports.SchemaLabel = exports.SchemaDescriptionOverrideContext = 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");
|
|
7
7
|
const layout_1 = require("../../layout");
|
|
8
|
+
const InfoBubble_1 = require("../InfoBubble");
|
|
8
9
|
const InlineRemoveButton_1 = require("../InlineRemoveButton");
|
|
9
10
|
const get_schema_label_1 = require("./get-schema-label");
|
|
10
11
|
const scroll_to_default_props_path_1 = require("./scroll-to-default-props-path");
|
|
12
|
+
exports.SchemaDescriptionOverrideContext = (0, react_1.createContext)(null);
|
|
11
13
|
const compactStyles = {
|
|
12
14
|
fontSize: 12,
|
|
13
15
|
color: colors_1.LIGHT_TEXT,
|
|
@@ -17,8 +19,19 @@ const compactStyles = {
|
|
|
17
19
|
alignItems: 'center',
|
|
18
20
|
flex: 1,
|
|
19
21
|
};
|
|
20
|
-
const
|
|
22
|
+
const descriptionStyle = {
|
|
23
|
+
fontSize: 12,
|
|
24
|
+
maxWidth: 360,
|
|
25
|
+
overflowWrap: 'anywhere',
|
|
26
|
+
padding: 10,
|
|
27
|
+
};
|
|
28
|
+
const SchemaLabel = ({ jsonPath, onRemove, valid, suffix, handleClick, description }) => {
|
|
21
29
|
const [clickableButtonHovered, setClickableButtonHovered] = (0, react_1.useState)(false);
|
|
30
|
+
const descriptionOverride = (0, react_1.useContext)(exports.SchemaDescriptionOverrideContext);
|
|
31
|
+
const displayedDescription = (descriptionOverride === null || descriptionOverride === void 0 ? void 0 : descriptionOverride.jsonPath.length) === jsonPath.length &&
|
|
32
|
+
descriptionOverride.jsonPath.every((part, index) => part === jsonPath[index])
|
|
33
|
+
? descriptionOverride.description
|
|
34
|
+
: description;
|
|
22
35
|
const labelStyle = (0, react_1.useMemo)(() => {
|
|
23
36
|
return {
|
|
24
37
|
fontFamily: 'monospace',
|
|
@@ -36,6 +49,6 @@ const SchemaLabel = ({ jsonPath, onRemove, valid, suffix, handleClick }) => {
|
|
|
36
49
|
const labelContent = (jsx_runtime_1.jsxs("span", { style: labelStyle, children: [(0, get_schema_label_1.getSchemaLabel)(jsonPath), " ", suffix ? suffix : null] }));
|
|
37
50
|
return (jsx_runtime_1.jsxs("div", { style: compactStyles, className: scroll_to_default_props_path_1.DEFAULT_PROPS_PATH_CLASSNAME, "data-json-path": jsonPath.join('.'), children: [handleClick ? (
|
|
38
51
|
// Minus the padding that a button has (user agent padding-line-start)
|
|
39
|
-
jsx_runtime_1.jsx("button", { onPointerEnter: onClickablePointerEnter, onPointerLeave: onClickablePointerLeave, type: "button", onClick: handleClick, style: { border: 'none', padding: 0 }, children: labelContent })) : (labelContent), jsx_runtime_1.jsx(layout_1.Flex, {}), onRemove ? jsx_runtime_1.jsx(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove }) : null] }));
|
|
52
|
+
jsx_runtime_1.jsx("button", { onPointerEnter: onClickablePointerEnter, onPointerLeave: onClickablePointerLeave, type: "button", onClick: handleClick, style: { border: 'none', padding: 0 }, children: labelContent })) : (labelContent), displayedDescription ? (jsx_runtime_1.jsx(InfoBubble_1.InfoBubble, { title: "Field description", horizontalAlignment: "right", children: jsx_runtime_1.jsx("div", { style: descriptionStyle, children: displayedDescription }) })) : null, jsx_runtime_1.jsx(layout_1.Flex, {}), onRemove ? jsx_runtime_1.jsx(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove }) : null] }));
|
|
40
53
|
};
|
|
41
54
|
exports.SchemaLabel = SchemaLabel;
|
|
@@ -63,7 +63,7 @@ const ZodArrayEditor = ({ schema, jsonPath, setValue, value, onRemove, mayPad })
|
|
|
63
63
|
jsx_runtime_1.jsx("div", { style: {
|
|
64
64
|
display: 'flex',
|
|
65
65
|
flexDirection: 'row',
|
|
66
|
-
}, children: jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, valid: zodValidation.success, handleClick: () => setExpanded(!expanded) }) }), expanded ? (jsx_runtime_1.jsxs(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: false, children: [value.map((child, i) => {
|
|
66
|
+
}, children: jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, description: (0, zod_schema_type_1.getUserFacingDescription)(schema), valid: zodValidation.success, handleClick: () => setExpanded(!expanded) }) }), expanded ? (jsx_runtime_1.jsxs(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: false, children: [value.map((child, i) => {
|
|
67
67
|
return (
|
|
68
68
|
// eslint-disable-next-line react/no-array-index-key
|
|
69
69
|
jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type AnyZodSchema } from './zod-schema-type';
|
|
2
3
|
import type { JSONPath } from './zod-types';
|
|
3
4
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
4
5
|
export declare const ZodBooleanEditor: React.FC<{
|
|
@@ -7,4 +8,5 @@ export declare const ZodBooleanEditor: React.FC<{
|
|
|
7
8
|
readonly setValue: UpdaterFunction<boolean>;
|
|
8
9
|
readonly onRemove: null | (() => void);
|
|
9
10
|
readonly mayPad: boolean;
|
|
11
|
+
readonly schema: AnyZodSchema;
|
|
10
12
|
}>;
|
|
@@ -6,15 +6,16 @@ const react_1 = require("react");
|
|
|
6
6
|
const Checkbox_1 = require("../../Checkbox");
|
|
7
7
|
const Fieldset_1 = require("./Fieldset");
|
|
8
8
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
9
|
+
const zod_schema_type_1 = require("./zod-schema-type");
|
|
9
10
|
const fullWidth = {
|
|
10
11
|
width: '100%',
|
|
11
12
|
};
|
|
12
|
-
const ZodBooleanEditor = ({ jsonPath, value, setValue, onRemove, mayPad }) => {
|
|
13
|
+
const ZodBooleanEditor = ({ jsonPath, value, setValue, onRemove, mayPad, schema }) => {
|
|
13
14
|
const onToggle = (0, react_1.useCallback)((e) => {
|
|
14
15
|
setValue(() => e.target.checked, { shouldSave: true });
|
|
15
16
|
}, [setValue]);
|
|
16
17
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
17
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: true, suffix: null }), jsx_runtime_1.jsx("div", { style: fullWidth, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { name: jsonPath.join('.'), checked: value, onChange: onToggle, disabled: false }) })
|
|
18
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: true, suffix: null, description: (0, zod_schema_type_1.getUserFacingDescription)(schema) }), jsx_runtime_1.jsx("div", { style: fullWidth, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { name: jsonPath.join('.'), checked: value, onChange: onToggle, disabled: false }) })
|
|
18
19
|
] }));
|
|
19
20
|
};
|
|
20
21
|
exports.ZodBooleanEditor = ZodBooleanEditor;
|
|
@@ -30,7 +30,7 @@ const ZodColorEditor = ({ jsonPath, value, setValue, schema, onRemove, mayPad })
|
|
|
30
30
|
}, [setValue, value]);
|
|
31
31
|
const status = localValue.success ? 'ok' : 'error';
|
|
32
32
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
33
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: localValue.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
33
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: localValue.success, suffix: null, description: (0, zod_schema_type_1.getUserFacingDescription)(schema) }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
34
34
|
jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
35
35
|
jsx_runtime_1.jsx(ColorPicker_1.ColorPicker, { value: value, status: status, onChange: onPickerChange, onChangeComplete: onPickerComplete, width: 45, height: 39, name: jsonPath.join('.') }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1, block: true }), jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: value, status: status, placeholder: jsonPath.join('.'), onChange: onTextChange, onBlur: onTextBlur, rightAlign: false, small: true })
|
|
36
36
|
] }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: localValue })
|
|
@@ -54,7 +54,7 @@ const ZodDateEditor = ({ jsonPath, value, setValue, schema, onRemove, mayPad })
|
|
|
54
54
|
}, [setValue]);
|
|
55
55
|
const zodValidation = (0, react_1.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
56
56
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
57
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
57
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null, description: (0, zod_schema_type_1.getUserFacingDescription)(schema) }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
58
58
|
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: formatDate(value), type: "datetime-local", status: zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, onBlur: onBlur, style: inputStyle, rightAlign: false, small: true }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx("div", { style: explainer, children: "Date is in local format" }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
59
59
|
] })
|
|
60
60
|
] }));
|
|
@@ -47,7 +47,7 @@ const ZodDiscriminatedUnionEditor = ({ schema, setValue, value, mayPad, jsonPath
|
|
|
47
47
|
return {
|
|
48
48
|
discriminator,
|
|
49
49
|
markup: (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
50
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: [...jsonPath, discriminator], onRemove: onRemove, suffix: null, valid: zodValidation.success }), jsx_runtime_1.jsx(ComboBox_1.Combobox, { title: "Select type", values: comboBoxValues, selectedId: value[discriminator], size: "small" })
|
|
50
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: [...jsonPath, discriminator], onRemove: onRemove, suffix: null, description: (0, zod_schema_type_1.getUserFacingDescription)(schema), valid: zodValidation.success }), jsx_runtime_1.jsx(ComboBox_1.Combobox, { title: "Select type", values: comboBoxValues, selectedId: value[discriminator], size: "small" })
|
|
51
51
|
] }, 'replacement')),
|
|
52
52
|
};
|
|
53
53
|
}, [
|
|
@@ -56,6 +56,7 @@ const ZodDiscriminatedUnionEditor = ({ schema, setValue, value, mayPad, jsonPath
|
|
|
56
56
|
mayPad,
|
|
57
57
|
onRemove,
|
|
58
58
|
discriminator,
|
|
59
|
+
schema,
|
|
59
60
|
value,
|
|
60
61
|
zodValidation.success,
|
|
61
62
|
]);
|
|
@@ -39,7 +39,7 @@ const ZodEnumEditor = ({ schema, jsonPath, setValue, value, onRemove, mayPad })
|
|
|
39
39
|
}, [enumValues, onChange, value]);
|
|
40
40
|
const zodValidation = (0, react_1.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
41
41
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
42
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsx("div", { style: isRoot ? undefined : container, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value, size: "small" }) }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
42
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null, description: (0, zod_schema_type_1.getUserFacingDescription)(schema) }), jsx_runtime_1.jsx("div", { style: isRoot ? undefined : container, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value, size: "small" }) }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
43
43
|
] }));
|
|
44
44
|
};
|
|
45
45
|
exports.ZodEnumEditor = ZodEnumEditor;
|
|
@@ -78,7 +78,7 @@ const ZodMatrixEditor = ({ schema, jsonPath, setValue, value, onRemove, mayPad }
|
|
|
78
78
|
}, []);
|
|
79
79
|
}, [value, dimensions]);
|
|
80
80
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
81
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, valid: zodValidation.success, handleClick: () => setExpanded(!expanded) }), expanded ? (jsx_runtime_1.jsxs(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: false, children: [chunkedItems.map((row, rowIndex) => {
|
|
81
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, description: (0, zod_schema_type_1.getUserFacingDescription)(schema), valid: zodValidation.success, handleClick: () => setExpanded(!expanded) }), expanded ? (jsx_runtime_1.jsxs(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: false, children: [chunkedItems.map((row, rowIndex) => {
|
|
82
82
|
return (jsx_runtime_1.jsx(react_1.default.Fragment
|
|
83
83
|
// eslint-disable-next-line react/no-array-index-key
|
|
84
84
|
, { children: jsx_runtime_1.jsx("div", { style: rowStyle, children: row.map((item, _index) => {
|
|
@@ -21,7 +21,7 @@ const wideEmptyLabel = {
|
|
|
21
21
|
};
|
|
22
22
|
const ZonNonEditableValue = ({ jsonPath, label, mayPad }) => {
|
|
23
23
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
24
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: null, valid: true, suffix: null }), jsx_runtime_1.jsx("div", { style: fullWidth, children: jsx_runtime_1.jsx("em", { style: wideEmptyLabel, children: label }) })
|
|
24
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: null, valid: true, suffix: null, description: null }), jsx_runtime_1.jsx("div", { style: fullWidth, children: jsx_runtime_1.jsx("em", { style: wideEmptyLabel, children: label }) })
|
|
25
25
|
] }));
|
|
26
26
|
};
|
|
27
27
|
exports.ZonNonEditableValue = ZonNonEditableValue;
|
|
@@ -25,7 +25,7 @@ const ZodNumberEditor = ({ jsonPath, value, schema, setValue, onRemove, mayPad }
|
|
|
25
25
|
}, [setValue]);
|
|
26
26
|
const zodValidation = (0, react_1.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
27
27
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
28
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
28
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null, description: (0, zod_schema_type_1.getUserFacingDescription)(schema) }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
29
29
|
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: 'number', value: value, style: fullWidth, status: zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onTextChange: onTextChange, onValueChange: onNumberChange, onValueChangeEnd: onNumberChangeEnd, min: (0, zod_number_constraints_1.getZodNumberMinimum)(schema), max: (0, zod_number_constraints_1.getZodNumberMaximum)(schema), step: (0, zod_number_constraints_1.getZodNumberStep)(schema), rightAlign: false, small: true }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
30
30
|
] })
|
|
31
31
|
] }));
|
|
@@ -60,7 +60,7 @@ const ZodObjectEditor = ({ schema, jsonPath, setValue, value, onRemove, mayPad,
|
|
|
60
60
|
return expanded ? ' {' : ' {...}';
|
|
61
61
|
}, [expanded]);
|
|
62
62
|
const zodValidation = (0, react_2.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
63
|
-
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: !isRoot && mayPad, children: [isRoot ? null : (jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, valid: zodValidation.success, handleClick: () => setExpanded(!expanded) })), expanded ? (jsx_runtime_1.jsx(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: isRoot, children: keys.map((key) => {
|
|
63
|
+
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: !isRoot && mayPad, children: [isRoot ? null : (jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, description: (0, zod_schema_type_1.getUserFacingDescription)(schema), valid: zodValidation.success, handleClick: () => setExpanded(!expanded) })), expanded ? (jsx_runtime_1.jsx(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: isRoot, children: keys.map((key) => {
|
|
64
64
|
if (discriminatedUnionReplacement &&
|
|
65
65
|
key === discriminatedUnionReplacement.discriminator) {
|
|
66
66
|
return discriminatedUnionReplacement.markup;
|
|
@@ -25,6 +25,7 @@ const checkBoxWrapper = {
|
|
|
25
25
|
marginTop: '5px',
|
|
26
26
|
};
|
|
27
27
|
const ZodOrNullishEditor = ({ jsonPath, schema, setValue, value, onRemove, nullishValue, mayPad, innerSchema, }) => {
|
|
28
|
+
var _a;
|
|
28
29
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
29
30
|
if (!z) {
|
|
30
31
|
throw new Error('expected zod');
|
|
@@ -32,13 +33,17 @@ const ZodOrNullishEditor = ({ jsonPath, schema, setValue, value, onRemove, nulli
|
|
|
32
33
|
const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
|
|
33
34
|
const isChecked = value === nullishValue;
|
|
34
35
|
const zodValidation = (0, react_1.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
36
|
+
const description = (0, zod_schema_type_1.getUserFacingDescription)(schema);
|
|
37
|
+
const descriptionOverride = (0, react_1.useMemo)(() => {
|
|
38
|
+
return description ? { jsonPath, description } : null;
|
|
39
|
+
}, [description, jsonPath]);
|
|
35
40
|
const onCheckBoxChange = (0, react_2.useCallback)((e) => {
|
|
36
41
|
const val = e.target.checked
|
|
37
42
|
? nullishValue
|
|
38
43
|
: (0, create_zod_values_1.createZodValues)(innerSchema, z, zodTypes);
|
|
39
44
|
setValue(() => val, { shouldSave: true });
|
|
40
45
|
}, [innerSchema, nullishValue, setValue, z, zodTypes]);
|
|
41
|
-
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [value === nullishValue ? (jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null })) : (jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { value: value, setValue: setValue, jsonPath: jsonPath, schema: innerSchema, onRemove: onRemove, mayPad: false })), jsx_runtime_1.jsxs("label", { style: checkBoxWrapper, children: [
|
|
46
|
+
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [value === nullishValue ? (jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null, description: (_a = (0, zod_schema_type_1.getUserFacingDescription)(schema)) !== null && _a !== void 0 ? _a : (0, zod_schema_type_1.getUserFacingDescription)(innerSchema) })) : descriptionOverride ? (jsx_runtime_1.jsx(SchemaLabel_1.SchemaDescriptionOverrideContext.Provider, { value: descriptionOverride, children: jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { value: value, setValue: setValue, jsonPath: jsonPath, schema: innerSchema, onRemove: onRemove, mayPad: false }) })) : (jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { value: value, setValue: setValue, jsonPath: jsonPath, schema: innerSchema, onRemove: onRemove, mayPad: false })), jsx_runtime_1.jsxs("label", { style: checkBoxWrapper, children: [
|
|
42
47
|
jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false, name: jsonPath.join('.') }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs("code", { style: labelStyle, children: ["<", String(nullishValue), ">"] })
|
|
43
48
|
] })
|
|
44
49
|
] }));
|
|
@@ -38,7 +38,7 @@ const ZodStaticFileEditor = ({ schema, jsonPath, setValue, value, onRemove, mayP
|
|
|
38
38
|
});
|
|
39
39
|
}, [onChange, staticFiles, value]);
|
|
40
40
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
41
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsx("div", { style: isRoot ? undefined : container, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value, size: "small" }) }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
41
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null, description: (0, zod_schema_type_1.getUserFacingDescription)(schema) }), jsx_runtime_1.jsx("div", { style: isRoot ? undefined : container, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value, size: "small" }) }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
42
42
|
] }));
|
|
43
43
|
};
|
|
44
44
|
exports.ZodStaticFileEditor = ZodStaticFileEditor;
|
|
@@ -26,7 +26,7 @@ const ZodStringEditor = ({ jsonPath, value, setValue, schema, onRemove, mayPad }
|
|
|
26
26
|
setValue(() => value, { shouldSave: true });
|
|
27
27
|
}, [setValue, value]);
|
|
28
28
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
29
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
29
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null, description: (0, zod_schema_type_1.getUserFacingDescription)(schema) }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
30
30
|
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: value, status: zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, onBlur: onBlur, rightAlign: false, name: jsonPath.join('.'), small: true }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
31
31
|
] })
|
|
32
32
|
] }));
|
|
@@ -52,7 +52,7 @@ const ZodSwitch = ({ schema, jsonPath, value, setValue, onRemove, mayPad }) => {
|
|
|
52
52
|
return (jsx_runtime_1.jsx(ZodNumberEditor_1.ZodNumberEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, onRemove: onRemove, mayPad: mayPad }));
|
|
53
53
|
}
|
|
54
54
|
if (typeName === 'boolean') {
|
|
55
|
-
return (jsx_runtime_1.jsx(ZodBooleanEditor_1.ZodBooleanEditor, { value: value, setValue: setValue, jsonPath: jsonPath, onRemove: onRemove, mayPad: mayPad }));
|
|
55
|
+
return (jsx_runtime_1.jsx(ZodBooleanEditor_1.ZodBooleanEditor, { value: value, setValue: setValue, jsonPath: jsonPath, onRemove: onRemove, mayPad: mayPad, schema: schema }));
|
|
56
56
|
}
|
|
57
57
|
if (typeName === 'undefined') {
|
|
58
58
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'undefined', mayPad: mayPad }));
|
|
@@ -66,7 +66,7 @@ const ZodTextareaEditor = ({ jsonPath, value, setValue, schema, onRemove, mayPad
|
|
|
66
66
|
}, [setValue, value]);
|
|
67
67
|
const zodValidation = react_1.default.useMemo(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
68
68
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
69
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
69
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null, description: (0, zod_schema_type_1.getUserFacingDescription)(schema) }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
70
70
|
jsx_runtime_1.jsx(RemTextarea_1.RemTextarea, { onChange: onChange, onBlur: onBlur, value: value, status: zodValidation ? 'ok' : 'error', placeholder: jsonPath.join('.'), name: jsonPath.join('.'), style: textareaStyle, small: true }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
71
71
|
] })
|
|
72
72
|
] }));
|
|
@@ -63,7 +63,7 @@ const ZodTupleEditor = ({ schema, jsonPath, setValue, value, onRemove, mayPad })
|
|
|
63
63
|
jsx_runtime_1.jsx("div", { style: {
|
|
64
64
|
display: 'flex',
|
|
65
65
|
flexDirection: 'row',
|
|
66
|
-
}, children: jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, valid: zodValidation.success, handleClick: () => setExpanded(!expanded) }) }), expanded ? (jsx_runtime_1.jsxs(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: false, children: [value.map((child, i) => {
|
|
66
|
+
}, children: jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, description: (0, zod_schema_type_1.getUserFacingDescription)(schema), valid: zodValidation.success, handleClick: () => setExpanded(!expanded) }) }), expanded ? (jsx_runtime_1.jsxs(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: false, children: [value.map((child, i) => {
|
|
67
67
|
return (
|
|
68
68
|
// eslint-disable-next-line react/no-array-index-key
|
|
69
69
|
jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [
|
|
@@ -63,6 +63,7 @@ export declare const getZodSchemaType: (schema: AnyZodSchema) => ZodSchemaType;
|
|
|
63
63
|
* v4: schema.description
|
|
64
64
|
*/
|
|
65
65
|
export declare const getZodSchemaDescription: (schema: AnyZodSchema) => string | undefined;
|
|
66
|
+
export declare const getUserFacingDescription: (schema: AnyZodSchema) => string | null;
|
|
66
67
|
/**
|
|
67
68
|
* Get the shape of an object schema.
|
|
68
69
|
* v3: _def.shape() (function)
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* and accessor helpers that abstract v3/v4 `_def` property differences.
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getBrandedInner = exports.getPipelineInput = exports.getPipelineOutput = exports.getRecordKeyType = exports.getRecordValueType = exports.getTupleItems = exports.getIntersectionSchemas = exports.getDiscriminatedOption = exports.getDiscriminatedOptionKeys = exports.getDiscriminator = exports.getDefaultValue = exports.getUnionOptions = exports.getFirstEnumValue = exports.getEnumValues = exports.getLiteralValue = exports.getEffectsInner = exports.getInnerType = exports.getArrayElement = exports.getObjectShape = exports.getZodSchemaDescription = exports.getZodSchemaType = exports.isZodV3Schema = exports.getZodDef = exports.zodSafeParse = void 0;
|
|
12
|
+
exports.getBrandedInner = exports.getPipelineInput = exports.getPipelineOutput = exports.getRecordKeyType = exports.getRecordValueType = exports.getTupleItems = exports.getIntersectionSchemas = exports.getDiscriminatedOption = exports.getDiscriminatedOptionKeys = exports.getDiscriminator = exports.getDefaultValue = exports.getUnionOptions = exports.getFirstEnumValue = exports.getEnumValues = exports.getLiteralValue = exports.getEffectsInner = exports.getInnerType = exports.getArrayElement = exports.getObjectShape = exports.getUserFacingDescription = exports.getZodSchemaDescription = exports.getZodSchemaType = exports.isZodV3Schema = exports.getZodDef = exports.zodSafeParse = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* Call safeParse on any Zod schema (v3 or v4).
|
|
15
15
|
* All Zod schemas have safeParse at runtime, but some v4 internal types
|
|
@@ -106,6 +106,17 @@ const getZodSchemaDescription = (schema) => {
|
|
|
106
106
|
return schema.description;
|
|
107
107
|
};
|
|
108
108
|
exports.getZodSchemaDescription = getZodSchemaDescription;
|
|
109
|
+
// Branded types (zColor(), zTextarea(), zMatrix()) store their marker in the
|
|
110
|
+
// description, so those must not surface as user-facing text.
|
|
111
|
+
const REMOTION_BRAND_PREFIX = '__remotion-';
|
|
112
|
+
const getUserFacingDescription = (schema) => {
|
|
113
|
+
const description = (0, exports.getZodSchemaDescription)(schema);
|
|
114
|
+
if (!description || description.startsWith(REMOTION_BRAND_PREFIX)) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
return description;
|
|
118
|
+
};
|
|
119
|
+
exports.getUserFacingDescription = getUserFacingDescription;
|
|
109
120
|
/**
|
|
110
121
|
* Get the shape of an object schema.
|
|
111
122
|
* v3: _def.shape() (function)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SelectedOutline } from './selected-outline-geometry';
|
|
3
|
+
import { type SelectedOutlineLayoutTarget, type SelectedOutlineTarget } from './selected-outline-types';
|
|
4
|
+
export declare const SelectedOutlineCanvasRotation: React.FC<{
|
|
5
|
+
readonly getLatestTargetByKey: (key: string) => SelectedOutlineTarget | undefined;
|
|
6
|
+
readonly layoutTarget: SelectedOutlineLayoutTarget;
|
|
7
|
+
readonly onDraggingChange: (dragging: boolean) => void;
|
|
8
|
+
readonly outline: SelectedOutline;
|
|
9
|
+
}>;
|