@remotion/studio 4.0.290 → 4.0.292
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/.turbo/turbo-make.log +2 -2
- package/dist/api/get-zod-schema-from-primitive.d.ts +2 -0
- package/dist/api/get-zod-schema-from-primitive.js +18 -0
- package/dist/api/save-default-props.js +13 -1
- package/dist/api/update-default-props.js +1 -1
- package/dist/api/use-visual-control.d.ts +7 -0
- package/dist/api/use-visual-control.js +57 -0
- package/dist/api/use-visual-controls.d.ts +7 -0
- package/dist/api/use-visual-controls.js +57 -0
- package/dist/api/visual-control.d.ts +2 -0
- package/dist/api/visual-control.js +11 -0
- package/dist/components/AskAiModal.d.ts +7 -0
- package/dist/components/AskAiModal.js +65 -0
- package/dist/components/Canvas.d.ts +0 -1
- package/dist/components/Canvas.js +2 -2
- package/dist/components/CanvasOrLoading.js +1 -1
- package/dist/components/EditorContexts.js +2 -1
- package/dist/components/GlobalKeybindings.js +14 -0
- package/dist/components/GlobalPropsEditorUpdateButton.js +6 -2
- package/dist/components/KeyboardShortcutsExplainer.js +1 -1
- package/dist/components/ModalContainer.d.ts +1 -0
- package/dist/components/ModalContainer.js +2 -2
- package/dist/components/ModalHeader.d.ts +1 -0
- package/dist/components/ModalHeader.js +2 -2
- package/dist/components/Modals.js +2 -1
- package/dist/components/OptionsPanel.d.ts +1 -1
- package/dist/components/OptionsPanel.js +12 -2
- package/dist/components/Preview.d.ts +0 -1
- package/dist/components/Preview.js +3 -5
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +1 -1
- package/dist/components/RenderModal/DataEditor.js +11 -4
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/Fieldset.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/Fieldset.js +5 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +17 -0
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +98 -0
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +6 -0
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +9 -0
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +7 -2
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +96 -22
- package/dist/components/RenderQueue/actions.d.ts +5 -1
- package/dist/components/RenderQueue/actions.js +12 -5
- package/dist/components/Tabs/index.js +3 -1
- package/dist/components/Timeline/TimelineStack/get-stack.d.ts +1 -1
- package/dist/components/Timeline/TimelineStack/get-stack.js +4 -2
- package/dist/components/Timeline/TimelineStack/index.js +2 -8
- package/dist/components/VisualControls/ClickableFileName.d.ts +13 -0
- package/dist/components/VisualControls/ClickableFileName.js +43 -0
- package/dist/components/VisualControls/VisualControlHandle.d.ts +6 -0
- package/dist/components/VisualControls/VisualControlHandle.js +96 -0
- package/dist/components/VisualControls/VisualControlHandleHeader.d.ts +4 -0
- package/dist/components/VisualControls/VisualControlHandleHeader.js +9 -0
- package/dist/components/VisualControls/VisualControlsContent.d.ts +1 -0
- package/dist/components/VisualControls/VisualControlsContent.js +53 -0
- package/dist/components/VisualControls/get-original-stack-trace.d.ts +2 -0
- package/dist/components/VisualControls/get-original-stack-trace.js +31 -0
- package/dist/esm/index.mjs +153 -29
- package/dist/esm/internals.mjs +4430 -3644
- package/dist/esm/previewEntry.mjs +4520 -3734
- package/dist/esm/renderEntry.mjs +4545 -3721
- package/dist/helpers/get-location-of-sequence.d.ts +1 -0
- package/dist/helpers/get-location-of-sequence.js +18 -1
- package/dist/helpers/open-in-editor.d.ts +2 -0
- package/dist/helpers/open-in-editor.js +11 -1
- package/dist/helpers/retry-payload.js +3 -3
- package/dist/helpers/use-menu-structure.js +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/renderEntry.js +5 -5
- package/dist/state/z-index.d.ts +1 -0
- package/dist/state/z-index.js +13 -5
- package/dist/visual-controls/VisualControls.d.ts +29 -0
- package/dist/visual-controls/VisualControls.js +123 -0
- package/dist/visual-controls/get-current-edited-value.d.ts +5 -0
- package/dist/visual-controls/get-current-edited-value.js +9 -0
- package/package.json +9 -9
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getOriginalLocationFromStack: (stack: string) => Promise<import("../../../error-overlay/react-overlay/utils/get-source-map").OriginalPosition | null>;
|
|
1
|
+
export declare const getOriginalLocationFromStack: (stack: string, type: "sequence" | "visual-control") => Promise<import("../../../error-overlay/react-overlay/utils/get-source-map").OriginalPosition | null>;
|
|
@@ -39,8 +39,10 @@ const getSourceMapCache = async (fileName) => {
|
|
|
39
39
|
isCreating[fileName] = false;
|
|
40
40
|
return map;
|
|
41
41
|
};
|
|
42
|
-
const getOriginalLocationFromStack = async (stack) => {
|
|
43
|
-
const location =
|
|
42
|
+
const getOriginalLocationFromStack = async (stack, type) => {
|
|
43
|
+
const location = type === 'sequence'
|
|
44
|
+
? (0, get_location_of_sequence_1.getLocationOfSequence)(stack)
|
|
45
|
+
: (0, get_location_of_sequence_1.getLocationOfFunctionCall)(stack, 'visualControl');
|
|
44
46
|
if (!location) {
|
|
45
47
|
return null;
|
|
46
48
|
}
|
|
@@ -50,13 +50,7 @@ const TimelineStack = ({ isCompact, sequence }) => {
|
|
|
50
50
|
}
|
|
51
51
|
setOpening(true);
|
|
52
52
|
try {
|
|
53
|
-
await (0, open_in_editor_1.
|
|
54
|
-
originalColumnNumber: location.column,
|
|
55
|
-
originalFileName: location.source,
|
|
56
|
-
originalFunctionName: null,
|
|
57
|
-
originalLineNumber: location.line,
|
|
58
|
-
originalScriptCode: null,
|
|
59
|
-
});
|
|
53
|
+
await (0, open_in_editor_1.openOriginalPositionInEditor)(location);
|
|
60
54
|
}
|
|
61
55
|
catch (err) {
|
|
62
56
|
(0, NotificationCenter_1.showNotification)(err.message, 2000);
|
|
@@ -114,7 +108,7 @@ const TimelineStack = ({ isCompact, sequence }) => {
|
|
|
114
108
|
if (!sequence.stack) {
|
|
115
109
|
return;
|
|
116
110
|
}
|
|
117
|
-
(0, get_stack_1.getOriginalLocationFromStack)(sequence.stack)
|
|
111
|
+
(0, get_stack_1.getOriginalLocationFromStack)(sequence.stack, 'sequence')
|
|
118
112
|
.then((frame) => {
|
|
119
113
|
setOriginalLocation(frame);
|
|
120
114
|
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OriginalPosition } from '../../error-overlay/react-overlay/utils/get-source-map';
|
|
2
|
+
export type OriginalFileNameState = {
|
|
3
|
+
type: 'loaded';
|
|
4
|
+
originalFileName: OriginalPosition;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'error';
|
|
7
|
+
error: Error;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'loading';
|
|
10
|
+
};
|
|
11
|
+
export declare const ClickableFileName: ({ originalFileName, }: {
|
|
12
|
+
readonly originalFileName: OriginalFileNameState;
|
|
13
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClickableFileName = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const colors_1 = require("../../helpers/colors");
|
|
7
|
+
const open_in_editor_1 = require("../../helpers/open-in-editor");
|
|
8
|
+
const Fieldset_1 = require("../RenderModal/SchemaEditor/Fieldset");
|
|
9
|
+
const source_attribution_1 = require("../Timeline/TimelineStack/source-attribution");
|
|
10
|
+
const container = {
|
|
11
|
+
paddingLeft: Fieldset_1.SCHEMA_EDITOR_FIELDSET_PADDING,
|
|
12
|
+
paddingTop: Fieldset_1.SCHEMA_EDITOR_FIELDSET_PADDING / 2,
|
|
13
|
+
};
|
|
14
|
+
const ClickableFileName = ({ originalFileName, }) => {
|
|
15
|
+
const [titleHovered, setTitleHovered] = (0, react_1.useState)(false);
|
|
16
|
+
const hoverEffect = titleHovered && originalFileName.type === 'loaded';
|
|
17
|
+
const onTitlePointerEnter = (0, react_1.useCallback)(() => {
|
|
18
|
+
setTitleHovered(true);
|
|
19
|
+
}, []);
|
|
20
|
+
const onTitlePointerLeave = (0, react_1.useCallback)(() => {
|
|
21
|
+
setTitleHovered(false);
|
|
22
|
+
}, []);
|
|
23
|
+
const style = (0, react_1.useMemo)(() => {
|
|
24
|
+
return {
|
|
25
|
+
fontSize: 12,
|
|
26
|
+
cursor: originalFileName.type === 'loaded' ? 'pointer' : undefined,
|
|
27
|
+
borderBottom: hoverEffect ? '1px solid #fff' : 'none',
|
|
28
|
+
color: hoverEffect ? '#fff' : colors_1.LIGHT_COLOR,
|
|
29
|
+
};
|
|
30
|
+
}, [originalFileName, hoverEffect]);
|
|
31
|
+
const onClick = (0, react_1.useCallback)(async () => {
|
|
32
|
+
if (originalFileName.type !== 'loaded') {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
await (0, open_in_editor_1.openOriginalPositionInEditor)(originalFileName.originalFileName);
|
|
36
|
+
}, [originalFileName]);
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsx)("span", { style: style, onClick: onClick, onPointerEnter: onTitlePointerEnter, onPointerLeave: onTitlePointerLeave, children: originalFileName.type === 'loaded'
|
|
38
|
+
? (0, source_attribution_1.getOriginalSourceAttribution)(originalFileName.originalFileName)
|
|
39
|
+
: originalFileName.type === 'loading'
|
|
40
|
+
? 'Loading...'
|
|
41
|
+
: 'Error loading' }) }));
|
|
42
|
+
};
|
|
43
|
+
exports.ClickableFileName = ClickableFileName;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisualControlHandle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const no_react_1 = require("remotion/no-react");
|
|
8
|
+
const VisualControls_1 = require("../../visual-controls/VisualControls");
|
|
9
|
+
const get_current_edited_value_1 = require("../../visual-controls/get-current-edited-value");
|
|
10
|
+
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
11
|
+
const ZodSwitch_1 = require("../RenderModal/SchemaEditor/ZodSwitch");
|
|
12
|
+
const extract_enum_json_paths_1 = require("../RenderModal/SchemaEditor/extract-enum-json-paths");
|
|
13
|
+
const local_state_1 = require("../RenderModal/SchemaEditor/local-state");
|
|
14
|
+
const actions_1 = require("../RenderQueue/actions");
|
|
15
|
+
const get_zod_if_possible_1 = require("../get-zod-if-possible");
|
|
16
|
+
const layout_1 = require("../layout");
|
|
17
|
+
const VisualControlHandleHeader_1 = require("./VisualControlHandleHeader");
|
|
18
|
+
const get_original_stack_trace_1 = require("./get-original-stack-trace");
|
|
19
|
+
const VisualControlHandle = ({ value, keyName }) => {
|
|
20
|
+
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
21
|
+
if (!z) {
|
|
22
|
+
throw new Error('expected zod');
|
|
23
|
+
}
|
|
24
|
+
const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
|
|
25
|
+
const state = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
|
|
26
|
+
const { updateValue } = (0, react_1.useContext)(VisualControls_1.SetVisualControlsContext);
|
|
27
|
+
const { fastRefreshes } = (0, react_1.useContext)(remotion_1.Internals.NonceContext);
|
|
28
|
+
const { increaseManualRefreshes } = (0, react_1.useContext)(remotion_1.Internals.SetNonceContext);
|
|
29
|
+
const [saving, setSaving] = (0, react_1.useState)(false);
|
|
30
|
+
const currentValue = (0, get_current_edited_value_1.getVisualControlEditedValue)({
|
|
31
|
+
handles: state.handles,
|
|
32
|
+
key: keyName,
|
|
33
|
+
});
|
|
34
|
+
const originalFileName = (0, get_original_stack_trace_1.useOriginalFileName)(value.stack);
|
|
35
|
+
const { localValue, RevisionContextProvider, onChange } = (0, local_state_1.useLocalState)({
|
|
36
|
+
schema: value.schema,
|
|
37
|
+
setValue: (updater) => {
|
|
38
|
+
updateValue(keyName, updater(currentValue));
|
|
39
|
+
increaseManualRefreshes();
|
|
40
|
+
},
|
|
41
|
+
unsavedValue: currentValue,
|
|
42
|
+
savedValue: value.valueInCode,
|
|
43
|
+
});
|
|
44
|
+
const disableSave = window.remotion_isReadOnlyStudio || originalFileName.type !== 'loaded';
|
|
45
|
+
const onSave = (0, react_1.useCallback)((updater) => {
|
|
46
|
+
if (disableSave) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (originalFileName.type !== 'loaded') {
|
|
50
|
+
throw new Error('Original file name is not loaded');
|
|
51
|
+
}
|
|
52
|
+
const val = updater(value.valueInCode);
|
|
53
|
+
window.remotion_ignoreFastRefreshUpdate = fastRefreshes + 1;
|
|
54
|
+
const enumPaths = (0, extract_enum_json_paths_1.extractEnumJsonPaths)({
|
|
55
|
+
schema: value.schema,
|
|
56
|
+
zodRuntime: z,
|
|
57
|
+
currentPath: [],
|
|
58
|
+
zodTypes,
|
|
59
|
+
});
|
|
60
|
+
setSaving(true);
|
|
61
|
+
Promise.resolve()
|
|
62
|
+
.then(() => {
|
|
63
|
+
return (0, actions_1.applyVisualControlChange)({
|
|
64
|
+
fileName: originalFileName.originalFileName.source,
|
|
65
|
+
changes: [
|
|
66
|
+
{
|
|
67
|
+
id: keyName,
|
|
68
|
+
newValueSerialized: no_react_1.NoReactInternals.serializeJSONWithSpecialTypes({
|
|
69
|
+
data: val,
|
|
70
|
+
indent: 2,
|
|
71
|
+
staticBase: window.remotion_staticBase,
|
|
72
|
+
}).serializedString,
|
|
73
|
+
enumPaths,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
})
|
|
78
|
+
.catch((e) => {
|
|
79
|
+
(0, NotificationCenter_1.showNotification)(`Could not save visual control: ${e.message}`, 3000);
|
|
80
|
+
});
|
|
81
|
+
}, [
|
|
82
|
+
disableSave,
|
|
83
|
+
value.valueInCode,
|
|
84
|
+
value.schema,
|
|
85
|
+
fastRefreshes,
|
|
86
|
+
z,
|
|
87
|
+
originalFileName,
|
|
88
|
+
keyName,
|
|
89
|
+
zodTypes,
|
|
90
|
+
]);
|
|
91
|
+
(0, react_1.useEffect)(() => {
|
|
92
|
+
setSaving(false);
|
|
93
|
+
}, [fastRefreshes]);
|
|
94
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(VisualControlHandleHeader_1.VisualControlHandleHeader, { originalFileName: originalFileName }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsx)(RevisionContextProvider, { children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { mayPad: true, schema: value.schema, showSaveButton: !disableSave, saving: saving, saveDisabledByParent: false, onSave: onSave, jsonPath: [keyName], value: localValue.value, defaultValue: value.valueInCode, setValue: onChange, onRemove: null }) })] }));
|
|
95
|
+
};
|
|
96
|
+
exports.VisualControlHandle = VisualControlHandle;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisualControlHandleHeader = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ClickableFileName_1 = require("./ClickableFileName");
|
|
6
|
+
const VisualControlHandleHeader = ({ originalFileName }) => {
|
|
7
|
+
return (0, jsx_runtime_1.jsx)(ClickableFileName_1.ClickableFileName, { originalFileName: originalFileName });
|
|
8
|
+
};
|
|
9
|
+
exports.VisualControlHandleHeader = VisualControlHandleHeader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VisualControlsContent: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.VisualControlsContent = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const VisualControls_1 = require("../../visual-controls/VisualControls");
|
|
40
|
+
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
41
|
+
const SchemaSeparationLine_1 = require("../RenderModal/SchemaEditor/SchemaSeparationLine");
|
|
42
|
+
const VisualControlHandle_1 = require("./VisualControlHandle");
|
|
43
|
+
const container = {
|
|
44
|
+
overflowY: 'auto',
|
|
45
|
+
};
|
|
46
|
+
const VisualControlsContent = () => {
|
|
47
|
+
const { handles } = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
|
|
48
|
+
const entries = Object.entries(handles);
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: entries.map(([key, value], i) => {
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(VisualControlHandle_1.VisualControlHandle, { keyName: key, value: value }), i === entries.length - 1 ? null : (0, jsx_runtime_1.jsx)(SchemaSeparationLine_1.SchemaSeparationLine, {})] }, key));
|
|
51
|
+
}) }));
|
|
52
|
+
};
|
|
53
|
+
exports.VisualControlsContent = VisualControlsContent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOriginalFileName = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const get_stack_1 = require("../Timeline/TimelineStack/get-stack");
|
|
6
|
+
const useOriginalFileName = (stack) => {
|
|
7
|
+
const [originalFileName, setOriginalFileName] = (0, react_1.useState)({ type: 'loading' });
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
if (!stack) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
(0, get_stack_1.getOriginalLocationFromStack)(stack, 'visual-control')
|
|
13
|
+
.then((frame) => {
|
|
14
|
+
if (frame === null) {
|
|
15
|
+
setOriginalFileName({
|
|
16
|
+
type: 'error',
|
|
17
|
+
error: new Error('No frame found'),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
setOriginalFileName({ type: 'loaded', originalFileName: frame });
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
.catch((err) => {
|
|
25
|
+
// eslint-disable-next-line no-console
|
|
26
|
+
console.error('Could not get original location of Sequence', err);
|
|
27
|
+
});
|
|
28
|
+
}, [stack]);
|
|
29
|
+
return originalFileName;
|
|
30
|
+
};
|
|
31
|
+
exports.useOriginalFileName = useOriginalFileName;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -202,7 +202,12 @@ var restartStudio = () => {
|
|
|
202
202
|
import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
|
|
203
203
|
|
|
204
204
|
// src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
|
|
205
|
-
var extractEnumJsonPaths = (
|
|
205
|
+
var extractEnumJsonPaths = ({
|
|
206
|
+
schema,
|
|
207
|
+
zodRuntime,
|
|
208
|
+
currentPath,
|
|
209
|
+
zodTypes
|
|
210
|
+
}) => {
|
|
206
211
|
const def = schema._def;
|
|
207
212
|
const typeName = def.typeName;
|
|
208
213
|
switch (typeName) {
|
|
@@ -210,45 +215,87 @@ var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
|
|
|
210
215
|
const shape = def.shape();
|
|
211
216
|
const keys = Object.keys(shape);
|
|
212
217
|
return keys.map((key) => {
|
|
213
|
-
return extractEnumJsonPaths(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
218
|
+
return extractEnumJsonPaths({
|
|
219
|
+
schema: shape[key],
|
|
220
|
+
zodRuntime,
|
|
221
|
+
currentPath: [...currentPath, key],
|
|
222
|
+
zodTypes
|
|
223
|
+
});
|
|
217
224
|
}).flat(1);
|
|
218
225
|
}
|
|
219
226
|
case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
|
|
220
|
-
return extractEnumJsonPaths(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
227
|
+
return extractEnumJsonPaths({
|
|
228
|
+
schema: def.type,
|
|
229
|
+
zodRuntime,
|
|
230
|
+
currentPath: [...currentPath, "[]"],
|
|
231
|
+
zodTypes
|
|
232
|
+
});
|
|
224
233
|
}
|
|
225
234
|
case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
|
|
226
235
|
return def.options.map((option) => {
|
|
227
|
-
return extractEnumJsonPaths(
|
|
236
|
+
return extractEnumJsonPaths({
|
|
237
|
+
schema: option,
|
|
238
|
+
zodRuntime,
|
|
239
|
+
currentPath,
|
|
240
|
+
zodTypes
|
|
241
|
+
});
|
|
228
242
|
}).flat(1);
|
|
229
243
|
}
|
|
230
244
|
case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
|
|
231
245
|
return def.options.map((op) => {
|
|
232
|
-
return extractEnumJsonPaths(
|
|
246
|
+
return extractEnumJsonPaths({
|
|
247
|
+
schema: op,
|
|
248
|
+
zodRuntime,
|
|
249
|
+
currentPath,
|
|
250
|
+
zodTypes
|
|
251
|
+
});
|
|
233
252
|
}).flat(1);
|
|
234
253
|
}
|
|
235
254
|
case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
|
|
236
255
|
return [currentPath];
|
|
237
256
|
}
|
|
238
257
|
case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
|
|
239
|
-
|
|
258
|
+
if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
259
|
+
return [currentPath];
|
|
260
|
+
}
|
|
261
|
+
return extractEnumJsonPaths({
|
|
262
|
+
schema: def.schema,
|
|
263
|
+
zodRuntime,
|
|
264
|
+
currentPath,
|
|
265
|
+
zodTypes
|
|
266
|
+
});
|
|
240
267
|
}
|
|
241
268
|
case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
|
|
242
269
|
const { left, right } = def;
|
|
243
|
-
const leftValue = extractEnumJsonPaths(
|
|
244
|
-
|
|
270
|
+
const leftValue = extractEnumJsonPaths({
|
|
271
|
+
schema: left,
|
|
272
|
+
zodRuntime,
|
|
273
|
+
currentPath,
|
|
274
|
+
zodTypes
|
|
275
|
+
});
|
|
276
|
+
const rightValue = extractEnumJsonPaths({
|
|
277
|
+
schema: right,
|
|
278
|
+
zodRuntime,
|
|
279
|
+
currentPath,
|
|
280
|
+
zodTypes
|
|
281
|
+
});
|
|
245
282
|
return [...leftValue, ...rightValue];
|
|
246
283
|
}
|
|
247
284
|
case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
|
|
248
|
-
return def.items.map((item, i) => extractEnumJsonPaths(
|
|
285
|
+
return def.items.map((item, i) => extractEnumJsonPaths({
|
|
286
|
+
schema: item,
|
|
287
|
+
zodRuntime,
|
|
288
|
+
currentPath: [...currentPath, i],
|
|
289
|
+
zodTypes
|
|
290
|
+
})).flat(1);
|
|
249
291
|
}
|
|
250
292
|
case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
|
|
251
|
-
const values = extractEnumJsonPaths(
|
|
293
|
+
const values = extractEnumJsonPaths({
|
|
294
|
+
schema: def.valueType,
|
|
295
|
+
zodRuntime,
|
|
296
|
+
currentPath: [...currentPath, "{}"],
|
|
297
|
+
zodTypes
|
|
298
|
+
});
|
|
252
299
|
return values;
|
|
253
300
|
}
|
|
254
301
|
case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
|
|
@@ -262,33 +309,63 @@ var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
|
|
|
262
309
|
}
|
|
263
310
|
case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
|
|
264
311
|
const defType = def;
|
|
265
|
-
const value = extractEnumJsonPaths(
|
|
312
|
+
const value = extractEnumJsonPaths({
|
|
313
|
+
schema: defType.innerType,
|
|
314
|
+
zodRuntime,
|
|
315
|
+
currentPath,
|
|
316
|
+
zodTypes
|
|
317
|
+
});
|
|
266
318
|
return value;
|
|
267
319
|
}
|
|
268
320
|
case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
|
|
269
321
|
const defType = def;
|
|
270
|
-
const value = extractEnumJsonPaths(
|
|
322
|
+
const value = extractEnumJsonPaths({
|
|
323
|
+
schema: defType.innerType,
|
|
324
|
+
zodRuntime,
|
|
325
|
+
currentPath,
|
|
326
|
+
zodTypes
|
|
327
|
+
});
|
|
271
328
|
return value;
|
|
272
329
|
}
|
|
273
330
|
case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
|
|
274
331
|
const defType = def;
|
|
275
|
-
return extractEnumJsonPaths(
|
|
332
|
+
return extractEnumJsonPaths({
|
|
333
|
+
schema: defType.innerType,
|
|
334
|
+
zodRuntime,
|
|
335
|
+
currentPath,
|
|
336
|
+
zodTypes
|
|
337
|
+
});
|
|
276
338
|
}
|
|
277
339
|
case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
|
|
278
340
|
const defType = def;
|
|
279
|
-
return extractEnumJsonPaths(
|
|
341
|
+
return extractEnumJsonPaths({
|
|
342
|
+
schema: defType.innerType,
|
|
343
|
+
zodRuntime,
|
|
344
|
+
currentPath,
|
|
345
|
+
zodTypes
|
|
346
|
+
});
|
|
280
347
|
}
|
|
281
348
|
case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
|
|
282
349
|
return [];
|
|
283
350
|
}
|
|
284
351
|
case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
|
|
285
352
|
const defType = def;
|
|
286
|
-
const value = extractEnumJsonPaths(
|
|
353
|
+
const value = extractEnumJsonPaths({
|
|
354
|
+
schema: defType.type,
|
|
355
|
+
zodRuntime,
|
|
356
|
+
currentPath,
|
|
357
|
+
zodTypes
|
|
358
|
+
});
|
|
287
359
|
return value;
|
|
288
360
|
}
|
|
289
361
|
case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
|
|
290
362
|
const defType = def;
|
|
291
|
-
const value = extractEnumJsonPaths(
|
|
363
|
+
const value = extractEnumJsonPaths({
|
|
364
|
+
schema: defType.out,
|
|
365
|
+
zodRuntime,
|
|
366
|
+
currentPath,
|
|
367
|
+
zodTypes
|
|
368
|
+
});
|
|
292
369
|
return value;
|
|
293
370
|
}
|
|
294
371
|
case zodRuntime.ZodFirstPartyTypeKind.ZodString:
|
|
@@ -319,7 +396,7 @@ import { NoReactInternals } from "remotion/no-react";
|
|
|
319
396
|
var callUpdateDefaultPropsApi = (compositionId, defaultProps, enumPaths) => {
|
|
320
397
|
return callApi("/api/update-default-props", {
|
|
321
398
|
compositionId,
|
|
322
|
-
defaultProps: NoReactInternals.
|
|
399
|
+
defaultProps: NoReactInternals.serializeJSONWithSpecialTypes({
|
|
323
400
|
data: defaultProps,
|
|
324
401
|
indent: undefined,
|
|
325
402
|
staticBase: window.remotion_staticBase
|
|
@@ -345,8 +422,17 @@ var saveDefaultProps = async ({
|
|
|
345
422
|
throw new Error('"zod" is required to use saveDefaultProps(), but is not installed.');
|
|
346
423
|
}
|
|
347
424
|
const z = await import("zod");
|
|
425
|
+
let zodTypes = null;
|
|
426
|
+
try {
|
|
427
|
+
zodTypes = await import("@remotion/zod-types");
|
|
428
|
+
} catch {}
|
|
348
429
|
const { generatedDefaultProps, composition } = calcNewProps(compositionId, defaultProps);
|
|
349
|
-
const res = await callUpdateDefaultPropsApi(compositionId, generatedDefaultProps, composition.schema ? extractEnumJsonPaths(
|
|
430
|
+
const res = await callUpdateDefaultPropsApi(compositionId, generatedDefaultProps, composition.schema ? extractEnumJsonPaths({
|
|
431
|
+
schema: composition.schema,
|
|
432
|
+
zodRuntime: z,
|
|
433
|
+
currentPath: [],
|
|
434
|
+
zodTypes
|
|
435
|
+
}) : []);
|
|
350
436
|
if (res.success) {
|
|
351
437
|
return Promise.resolve();
|
|
352
438
|
}
|
|
@@ -383,15 +469,52 @@ var updateDefaultProps = ({
|
|
|
383
469
|
});
|
|
384
470
|
window.dispatchEvent(new CustomEvent(Internals8.PROPS_UPDATED_EXTERNALLY, {
|
|
385
471
|
detail: {
|
|
386
|
-
resetUnsaved:
|
|
472
|
+
resetUnsaved: null
|
|
387
473
|
}
|
|
388
474
|
}));
|
|
389
475
|
};
|
|
390
|
-
// src/
|
|
476
|
+
// src/visual-controls/VisualControls.tsx
|
|
477
|
+
import {
|
|
478
|
+
createContext,
|
|
479
|
+
createRef,
|
|
480
|
+
useCallback,
|
|
481
|
+
useEffect,
|
|
482
|
+
useImperativeHandle,
|
|
483
|
+
useMemo,
|
|
484
|
+
useRef,
|
|
485
|
+
useState
|
|
486
|
+
} from "react";
|
|
391
487
|
import { getRemotionEnvironment as getRemotionEnvironment5 } from "remotion";
|
|
488
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
489
|
+
var VisualControlsTabActivatedContext = createContext(false);
|
|
490
|
+
var VisualControlsContext = createContext({
|
|
491
|
+
handles: {}
|
|
492
|
+
});
|
|
493
|
+
var visualControlRef = createRef();
|
|
494
|
+
var SetVisualControlsContext = createContext({
|
|
495
|
+
updateHandles: () => {
|
|
496
|
+
throw new Error("updateHandles is not implemented");
|
|
497
|
+
},
|
|
498
|
+
updateValue: () => {
|
|
499
|
+
throw new Error("updateValue is not implemented");
|
|
500
|
+
},
|
|
501
|
+
visualControl: () => {
|
|
502
|
+
throw new Error("visualControl is not implemented");
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
// src/api/visual-control.ts
|
|
507
|
+
var visualControl = (key, value, schema) => {
|
|
508
|
+
if (!visualControlRef.current) {
|
|
509
|
+
throw new Error("visualControlRef is not set");
|
|
510
|
+
}
|
|
511
|
+
return visualControlRef.current.globalVisualControl(key, value, schema);
|
|
512
|
+
};
|
|
513
|
+
// src/api/watch-public-folder.ts
|
|
514
|
+
import { getRemotionEnvironment as getRemotionEnvironment6 } from "remotion";
|
|
392
515
|
var WATCH_REMOTION_STATIC_FILES = "remotion_staticFilesChanged";
|
|
393
516
|
var watchPublicFolder = (callback) => {
|
|
394
|
-
if (!
|
|
517
|
+
if (!getRemotionEnvironment6().isStudio) {
|
|
395
518
|
console.warn("The watchPublicFolder() API is only available while using the Remotion Studio.");
|
|
396
519
|
return { cancel: () => {
|
|
397
520
|
return;
|
|
@@ -410,9 +533,9 @@ var watchPublicFolder = (callback) => {
|
|
|
410
533
|
return { cancel };
|
|
411
534
|
};
|
|
412
535
|
// src/api/watch-static-file.ts
|
|
413
|
-
import { getRemotionEnvironment as
|
|
536
|
+
import { getRemotionEnvironment as getRemotionEnvironment7 } from "remotion";
|
|
414
537
|
var watchStaticFile = (fileName, callback) => {
|
|
415
|
-
if (!
|
|
538
|
+
if (!getRemotionEnvironment7().isStudio) {
|
|
416
539
|
console.warn("watchStaticFile() is only available while using the Remotion Studio.");
|
|
417
540
|
return { cancel: () => {
|
|
418
541
|
return;
|
|
@@ -477,6 +600,7 @@ export {
|
|
|
477
600
|
writeStaticFile,
|
|
478
601
|
watchStaticFile,
|
|
479
602
|
watchPublicFolder,
|
|
603
|
+
visualControl,
|
|
480
604
|
updateDefaultProps,
|
|
481
605
|
toggle,
|
|
482
606
|
seek,
|