@remotion/studio 4.0.517 → 4.0.519
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppLaunchButton.d.ts +16 -0
- package/dist/components/AppLaunchButton.js +90 -0
- package/dist/components/AssetSelector.js +64 -22
- package/dist/components/AssetSelectorItem.d.ts +14 -1
- package/dist/components/AssetSelectorItem.js +219 -70
- package/dist/components/Button.js +20 -7
- package/dist/components/Canvas.js +109 -78
- package/dist/components/CanvasOrLoading.js +7 -7
- package/dist/components/CaptionTextEditor.js +32 -8
- package/dist/components/CodingAgentButton.d.ts +7 -0
- package/dist/components/CodingAgentButton.js +59 -0
- package/dist/components/CompositionContextButton.d.ts +1 -0
- package/dist/components/CompositionContextButton.js +7 -3
- package/dist/components/CompositionSelector.js +16 -11
- package/dist/components/CompositionSelectorItem.js +16 -23
- package/dist/components/ConfigureLicenseModal.js +4 -48
- package/dist/components/CurrentAsset.js +1 -1
- package/dist/components/EditorContent.js +6 -3
- package/dist/components/ElementInstallConfirmation.d.ts +25 -7
- package/dist/components/ElementInstallConfirmation.js +347 -30
- package/dist/components/ElementLibraryModal.js +3 -1
- package/dist/components/FixComputedValueModal.js +5 -131
- package/dist/components/InitialCompositionLoader.js +3 -2
- package/dist/components/InlineCaptionInspector.js +13 -2
- package/dist/components/InspectorOpenInEditor.js +48 -33
- package/dist/components/InspectorPanel/CompositionInspector.js +35 -3
- package/dist/components/InspectorPanel/CompositionInspectorHeader.js +22 -14
- package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +3 -1
- package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +1 -1
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +10 -5
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +1 -1
- package/dist/components/InspectorPanel/common.js +1 -0
- package/dist/components/InspectorPanel/styles.js +1 -0
- package/dist/components/InspectorSequenceSection.js +8 -3
- package/dist/components/InspectorSourceLocation.js +5 -1
- package/dist/components/KnownBugs.d.ts +1 -1
- package/dist/components/KnownBugs.js +1 -1
- package/dist/components/LicenseExplanation.d.ts +2 -0
- package/dist/components/LicenseExplanation.js +63 -0
- package/dist/components/MenuToolbar.js +7 -1
- package/dist/components/Modals.js +50 -2
- package/dist/components/NewComposition/InputDragger.js +29 -2
- package/dist/components/NewComposition/NewCompDuration.js +1 -1
- package/dist/components/NewComposition/NewComposition.d.ts +23 -0
- package/dist/components/NewComposition/NewComposition.js +217 -80
- package/dist/components/{UpdateModal/OpenIssueButton.js → OpenIssueButton.js} +1 -1
- package/dist/components/PlaybackRateSelector.js +2 -5
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +2 -0
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +28 -7
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +21 -13
- package/dist/components/RenderQueue/actions.d.ts +1 -0
- package/dist/components/RenderQueue/actions.js +5 -1
- package/dist/components/SelectedOutlineCanvasRotation.js +27 -1
- package/dist/components/SelectedOutlineElement.js +2 -1
- package/dist/components/SelectedOutlineOverlay.js +9 -10
- package/dist/components/SelectedOutlinePolygon.d.ts +1 -0
- package/dist/components/SelectedOutlinePolygon.js +12 -4
- package/dist/components/SelectedOutlineRenderer.d.ts +1 -1
- package/dist/components/SelectedOutlineRenderer.js +33 -35
- package/dist/components/SettingsContext.js +2 -1
- package/dist/components/SettingsModal.d.ts +1 -1
- package/dist/components/SettingsModal.js +19 -3
- package/dist/components/SidebarRenderButton.d.ts +1 -0
- package/dist/components/SidebarRenderButton.js +15 -5
- package/dist/components/Timeline/SequencePropsObserver.js +29 -14
- package/dist/components/Timeline/TimelineKeyframeControls.js +3 -1
- package/dist/components/Timeline/TimelineRowChrome.js +4 -2
- package/dist/components/Timeline/TimelineSequence.js +40 -8
- package/dist/components/Timeline/TimelineSequenceItem.js +34 -1
- package/dist/components/Timeline/TimelineStack/get-stack.d.ts +1 -0
- package/dist/components/Timeline/TimelineStack/get-stack.js +35 -3
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +23 -25
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +6 -0
- package/dist/components/Timeline/get-sequence-context-menu-items.js +34 -1
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -0
- package/dist/components/Timeline/sequence-props-subscription-store.js +22 -1
- package/dist/components/Timeline/use-sequence-props-subscription.js +7 -0
- package/dist/components/TimelineCombobox.js +1 -0
- package/dist/components/UpdateCheck.d.ts +0 -8
- package/dist/components/UpdateCheck.js +7 -54
- package/dist/components/UpdateStatusContext.d.ts +18 -0
- package/dist/components/UpdateStatusContext.js +74 -0
- package/dist/components/UpdatesSettings.d.ts +2 -0
- package/dist/components/UpdatesSettings.js +251 -0
- package/dist/components/WebMcp.d.ts +2 -0
- package/dist/components/WebMcp.js +945 -0
- package/dist/components/composition-menu-items.js +26 -0
- package/dist/components/get-open-in-menu-items.d.ts +4 -0
- package/dist/components/get-open-in-menu-items.js +28 -24
- package/dist/components/root-composition-menu-items.d.ts +4 -1
- package/dist/components/root-composition-menu-items.js +38 -1
- package/dist/components/selected-outline-measurement.d.ts +11 -0
- package/dist/components/selected-outline-measurement.js +13 -5
- package/dist/components/use-configure-default-apps.d.ts +1 -0
- package/dist/components/use-configure-default-apps.js +24 -0
- package/dist/error-overlay/remotion-overlay/CodeFrame.js +5 -6
- package/dist/error-overlay/remotion-overlay/CopyStackTrace.js +1 -1
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +47 -18
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +1 -1
- package/dist/error-overlay/remotion-overlay/ErrorTitle.js +5 -4
- package/dist/error-overlay/remotion-overlay/OpenInEditor.js +48 -76
- package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js +1 -1
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -2
- package/dist/error-overlay/remotion-overlay/StackFrame.js +13 -8
- package/dist/error-overlay/remotion-overlay/Symbolicating.js +1 -1
- package/dist/esm/{chunk-gzqm3g2m.js → chunk-1fkq5bfq.js} +24093 -21093
- package/dist/esm/chunk-6jf1natv.js +25 -0
- package/dist/esm/{chunk-4bxz1d3g.js → chunk-je0h1bgt.js} +1 -28
- package/dist/esm/chunk-m0jqdbkr.js +14571 -0
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/internals.mjs +43231 -25675
- package/dist/esm/previewEntry.mjs +46334 -28776
- package/dist/esm/renderEntry.mjs +6 -3
- package/dist/helpers/can-show-updates.d.ts +5 -0
- package/dist/helpers/can-show-updates.js +7 -0
- package/dist/helpers/colors.d.ts +0 -3
- package/dist/helpers/colors.js +2 -5
- package/dist/helpers/create-folder-tree.d.ts +5 -0
- package/dist/helpers/create-folder-tree.js +40 -2
- package/dist/helpers/format-file-location.d.ts +8 -0
- package/dist/helpers/format-file-location.js +14 -3
- package/dist/helpers/get-asset-metadata.js +1 -1
- package/dist/helpers/get-git-menu-item.d.ts +5 -0
- package/dist/helpers/get-git-menu-item.js +15 -1
- package/dist/helpers/get-timeline-max-zoom.d.ts +8 -0
- package/dist/helpers/get-timeline-max-zoom.js +17 -6
- package/dist/helpers/hoverable.d.ts +1 -0
- package/dist/helpers/hoverable.js +14 -6
- package/dist/helpers/open-in-editor.js +51 -1
- package/dist/helpers/preview-server-events.js +3 -0
- package/dist/helpers/timeline-layout.d.ts +0 -1
- package/dist/helpers/timeline-layout.js +1 -5
- package/dist/helpers/url-state.d.ts +1 -0
- package/dist/helpers/url-state.js +12 -5
- package/dist/icons/enter.d.ts +4 -0
- package/dist/icons/enter.js +10 -0
- package/dist/renderEntry.js +2 -0
- package/dist/state/folders.d.ts +3 -0
- package/dist/state/folders.js +40 -1
- package/dist/state/modals.d.ts +1 -6
- package/dist/state/playbackrate.d.ts +1 -0
- package/dist/state/playbackrate.js +4 -1
- package/package.json +17 -14
- package/dist/components/UpdateModal/UpdateModal.d.ts +0 -6
- package/dist/components/UpdateModal/UpdateModal.js +0 -104
- /package/dist/components/{UpdateModal/OpenIssueButton.d.ts → OpenIssueButton.d.ts} +0 -0
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ElementInstallConfirmation = void 0;
|
|
3
|
+
exports.ElementInstallConfirmation = exports.ElementLibraryAddConfirmation = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const react_dom_1 = require("react-dom");
|
|
8
|
+
const remotion_1 = require("remotion");
|
|
9
|
+
const ShortcutHint_1 = require("../error-overlay/remotion-overlay/ShortcutHint");
|
|
5
10
|
const colors_1 = require("../helpers/colors");
|
|
11
|
+
const hoverable_1 = require("../helpers/hoverable");
|
|
12
|
+
const resolved_stack_to_symbolicated_1 = require("../helpers/resolved-stack-to-symbolicated");
|
|
13
|
+
const use_create_composition_1 = require("../helpers/use-create-composition");
|
|
14
|
+
const validate_new_comp_data_1 = require("../helpers/validate-new-comp-data");
|
|
15
|
+
const z_index_1 = require("../state/z-index");
|
|
16
|
+
const Button_1 = require("./Button");
|
|
17
|
+
const element_install_api_1 = require("./element-install-api");
|
|
18
|
+
const import_assets_1 = require("./import-assets");
|
|
19
|
+
const layout_1 = require("./layout");
|
|
20
|
+
const portals_1 = require("./Menu/portals");
|
|
21
|
+
const ModalButton_1 = require("./ModalButton");
|
|
22
|
+
const ModalContainer_1 = require("./ModalContainer");
|
|
23
|
+
const ModalFooter_1 = require("./ModalFooter");
|
|
24
|
+
const ModalHeader_1 = require("./ModalHeader");
|
|
25
|
+
const NewComposition_1 = require("./NewComposition/NewComposition");
|
|
6
26
|
const ValidationMessage_1 = require("./NewComposition/ValidationMessage");
|
|
27
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
28
|
+
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
7
29
|
const container = {
|
|
8
30
|
display: 'flex',
|
|
9
31
|
flexDirection: 'column',
|
|
@@ -13,6 +35,13 @@ const container = {
|
|
|
13
35
|
fontSize: 13,
|
|
14
36
|
lineHeight: 1.5,
|
|
15
37
|
};
|
|
38
|
+
const dialogContent = {
|
|
39
|
+
...container,
|
|
40
|
+
padding: 16,
|
|
41
|
+
width: 'min(640px, calc(100vw - 40px))',
|
|
42
|
+
maxHeight: 'min(720px, calc(100vh - 140px))',
|
|
43
|
+
overflowY: 'auto',
|
|
44
|
+
};
|
|
16
45
|
const sectionStyle = {
|
|
17
46
|
display: 'flex',
|
|
18
47
|
flexDirection: 'column',
|
|
@@ -34,7 +63,7 @@ const metadataStyle = {
|
|
|
34
63
|
};
|
|
35
64
|
const metadataRowStyle = {
|
|
36
65
|
display: 'grid',
|
|
37
|
-
gridTemplateColumns: '
|
|
66
|
+
gridTemplateColumns: '120px minmax(0, 1fr)',
|
|
38
67
|
alignItems: 'baseline',
|
|
39
68
|
gap: 12,
|
|
40
69
|
};
|
|
@@ -130,6 +159,13 @@ const warningDescriptionStyle = {
|
|
|
130
159
|
fontWeight: 400,
|
|
131
160
|
lineHeight: 1.5,
|
|
132
161
|
};
|
|
162
|
+
const browseElementsStyle = {
|
|
163
|
+
color: 'inherit',
|
|
164
|
+
fontFamily: 'inherit',
|
|
165
|
+
fontSize: 'inherit',
|
|
166
|
+
fontWeight: 600,
|
|
167
|
+
lineHeight: 'inherit',
|
|
168
|
+
};
|
|
133
169
|
const sourceDetailsStyle = {
|
|
134
170
|
paddingTop: 2,
|
|
135
171
|
fontFamily: 'sans-serif',
|
|
@@ -165,43 +201,324 @@ const sourceCodeStyle = {
|
|
|
165
201
|
fontSize: 'inherit',
|
|
166
202
|
lineHeight: 'inherit',
|
|
167
203
|
};
|
|
204
|
+
const destinationControlStyle = {
|
|
205
|
+
display: 'flex',
|
|
206
|
+
alignItems: 'center',
|
|
207
|
+
justifyContent: 'space-between',
|
|
208
|
+
gap: 16,
|
|
209
|
+
};
|
|
210
|
+
const destinationOptionsStyle = {
|
|
211
|
+
display: 'flex',
|
|
212
|
+
overflow: 'hidden',
|
|
213
|
+
border: `1px solid ${colors_1.WHITE_ALPHA_12}`,
|
|
214
|
+
borderRadius: 4,
|
|
215
|
+
};
|
|
216
|
+
const destinationOptionStyle = {
|
|
217
|
+
appearance: 'none',
|
|
218
|
+
border: 0,
|
|
219
|
+
cursor: 'default',
|
|
220
|
+
fontFamily: 'sans-serif',
|
|
221
|
+
fontSize: 11,
|
|
222
|
+
fontWeight: 400,
|
|
223
|
+
lineHeight: 1.5,
|
|
224
|
+
padding: '2px 7px',
|
|
225
|
+
};
|
|
226
|
+
const getDestinationOptionStyle = ({ disabled, selected, }) => ({
|
|
227
|
+
...destinationOptionStyle,
|
|
228
|
+
opacity: disabled ? 0.5 : 1,
|
|
229
|
+
...(0, hoverable_1.hoverableStyle)({
|
|
230
|
+
idleBackground: selected ? colors_1.INPUT_BACKGROUND : colors_1.TRANSPARENT,
|
|
231
|
+
hoverBackground: selected ? colors_1.INPUT_BACKGROUND : colors_1.TRANSPARENT,
|
|
232
|
+
idleColor: selected ? colors_1.WHITE : colors_1.LIGHT_TEXT,
|
|
233
|
+
hoverColor: disabled ? colors_1.LIGHT_TEXT : colors_1.WHITE,
|
|
234
|
+
}),
|
|
235
|
+
});
|
|
236
|
+
const footerStyle = {
|
|
237
|
+
minWidth: 0,
|
|
238
|
+
};
|
|
239
|
+
const cancelStyle = {
|
|
240
|
+
minWidth: 90,
|
|
241
|
+
};
|
|
168
242
|
const makeSourceControlsVisible = (sourceCode) => {
|
|
169
243
|
return sourceCode.replace(/[\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff]/g, (character) => {
|
|
170
244
|
var _a;
|
|
171
245
|
return `\\u${(_a = character.codePointAt(0)) === null || _a === void 0 ? void 0 : _a.toString(16).padStart(4, '0')}`;
|
|
172
246
|
});
|
|
173
247
|
};
|
|
174
|
-
const
|
|
248
|
+
const ElementLibraryAddConfirmation = ({ displayName, origin, url }) => {
|
|
175
249
|
return (jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
176
|
-
jsx_runtime_1.jsxs("dl", { style: metadataStyle, "aria-label": "
|
|
177
|
-
|
|
178
|
-
|
|
250
|
+
jsx_runtime_1.jsxs("dl", { style: metadataStyle, "aria-label": "Catalog details", children: [displayName === null ? null : (jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
251
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Display name" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: displayName })
|
|
252
|
+
] })), jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
253
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Request source" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: origin })
|
|
179
254
|
] }), jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
180
|
-
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Destination" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: jsx_runtime_1.jsx("code", { style: codeStyle, children: filePath }) })
|
|
187
|
-
] }), overwritesExistingFile ? (jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
188
|
-
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "File change" }), jsx_runtime_1.jsx("dd", { style: overwriteStyle, children: "Replace existing source file" })
|
|
189
|
-
] })) : null] }), dependenciesToReview.length > 0 ? (jsx_runtime_1.jsxs("section", { style: sectionStyle, "aria-labelledby": "element-install-dependencies", children: [
|
|
190
|
-
jsx_runtime_1.jsx("h3", { id: "element-install-dependencies", style: sectionTitleStyle, children: "Dependencies" }), jsx_runtime_1.jsx("ul", { style: dependencyListStyle, role: "list", children: dependenciesToReview.map((packageName) => {
|
|
191
|
-
const willInstall = missingPackages.includes(packageName);
|
|
192
|
-
return (jsx_runtime_1.jsxs("li", { style: dependencyRowStyle, children: [
|
|
193
|
-
jsx_runtime_1.jsx("div", { style: dependencyNameStyle, children: packageName }), jsx_runtime_1.jsx("div", { style: willInstall
|
|
194
|
-
? dependencyInstallStatusStyle
|
|
195
|
-
: dependencyInstalledStatusStyle, children: willInstall ? 'Will be installed' : 'Installed' })
|
|
196
|
-
] }, packageName));
|
|
197
|
-
}) })
|
|
198
|
-
] })) : null, jsx_runtime_1.jsxs("div", { style: warningStyle, children: [
|
|
199
|
-
jsx_runtime_1.jsx(ValidationMessage_1.WarningTriangle, { style: warningIconStyle }), jsx_runtime_1.jsxs("p", { style: warningDescriptionStyle, children: ["This adds executable source code to your project.", usesBrowserDependencyResolution
|
|
200
|
-
? null
|
|
201
|
-
: ' Package lifecycle scripts may also run during installation, with access to your files and the network.'] })
|
|
202
|
-
] }), jsx_runtime_1.jsxs("details", { style: sourceDetailsStyle, children: [
|
|
203
|
-
jsx_runtime_1.jsx("summary", { style: sourceSummaryStyle, children: "Source code" }), jsx_runtime_1.jsx("pre", { style: sourceCodeBlockStyle, children: jsx_runtime_1.jsx("code", { style: sourceCodeStyle, children: makeSourceControlsVisible(sourceCode) }) })
|
|
255
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Catalog URL" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: jsx_runtime_1.jsx("code", { style: codeStyle, children: url }) })
|
|
256
|
+
] })
|
|
257
|
+
] }), jsx_runtime_1.jsxs("div", { style: warningStyle, children: [
|
|
258
|
+
jsx_runtime_1.jsx(ValidationMessage_1.WarningTriangle, { style: warningIconStyle }), jsx_runtime_1.jsxs("p", { style: warningDescriptionStyle, children: ["This adds the catalog to", ' ', jsx_runtime_1.jsx("strong", { style: browseElementsStyle, children: "Browse Elements" }),
|
|
259
|
+
" when nothing is selected on the canvas. It is saved in", ' ', jsx_runtime_1.jsx("code", { style: codeStyle, children: "remotion.config.ts" }),
|
|
260
|
+
"."] })
|
|
204
261
|
] })
|
|
205
262
|
] }));
|
|
206
263
|
};
|
|
264
|
+
exports.ElementLibraryAddConfirmation = ElementLibraryAddConfirmation;
|
|
265
|
+
const ElementInstallConfirmation = ({ currentCompositionMetadata, currentPlan, dependenciesToReview, missingPackages, newPlan, onClose, request, sourceIsUnverified, sourceLabel, usesBrowserDependencyResolution, }) => {
|
|
266
|
+
var _a, _b;
|
|
267
|
+
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
268
|
+
const { currentZIndex } = (0, z_index_1.useZIndex)();
|
|
269
|
+
const [mode, setMode] = (0, react_1.useState)(currentPlan === null ? 'new-composition' : 'current-composition');
|
|
270
|
+
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
271
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
272
|
+
const [newCompositionValues, setNewCompositionValues] = (0, react_1.useState)(() => {
|
|
273
|
+
var _a, _b, _c, _d, _e;
|
|
274
|
+
const elementComponentName = (_a = studio_protocol_1.StudioProtocolInternals.getElementComponentNameFromSourceCode(request.element.sourceCode)) !== null && _a !== void 0 ? _a : 'Element';
|
|
275
|
+
const baseName = `${elementComponentName}Composition`;
|
|
276
|
+
let candidate = baseName;
|
|
277
|
+
let suffix = 2;
|
|
278
|
+
while ((0, validate_new_comp_data_1.validateCompositionName)(candidate, compositions) !== null) {
|
|
279
|
+
candidate = `${baseName}${suffix}`;
|
|
280
|
+
suffix++;
|
|
281
|
+
}
|
|
282
|
+
const size = (_b = request.element.dimensions) !== null && _b !== void 0 ? _b : (currentCompositionMetadata === null
|
|
283
|
+
? { width: 1920, height: 1080 }
|
|
284
|
+
: {
|
|
285
|
+
width: currentCompositionMetadata.width,
|
|
286
|
+
height: currentCompositionMetadata.height,
|
|
287
|
+
});
|
|
288
|
+
return {
|
|
289
|
+
durationInFrames: (_d = (_c = request.element.durationInFrames) !== null && _c !== void 0 ? _c : currentCompositionMetadata === null || currentCompositionMetadata === void 0 ? void 0 : currentCompositionMetadata.durationInFrames) !== null && _d !== void 0 ? _d : 150,
|
|
290
|
+
folder: { folderName: null, parentName: null, stack: null },
|
|
291
|
+
fps: (_e = currentCompositionMetadata === null || currentCompositionMetadata === void 0 ? void 0 : currentCompositionMetadata.fps) !== null && _e !== void 0 ? _e : 30,
|
|
292
|
+
id: candidate,
|
|
293
|
+
size,
|
|
294
|
+
};
|
|
295
|
+
});
|
|
296
|
+
const selectedFolderStack = newCompositionValues.folder.stack;
|
|
297
|
+
const resolvedFolderLocation = (0, use_resolved_stack_1.useResolvedStack)(selectedFolderStack);
|
|
298
|
+
const folderSymbolicatedStack = (0, react_1.useMemo)(() => (0, resolved_stack_to_symbolicated_1.resolvedStackToSymbolicated)(resolvedFolderLocation), [resolvedFolderLocation]);
|
|
299
|
+
const folderCompositionFile = (_a = folderSymbolicatedStack === null || folderSymbolicatedStack === void 0 ? void 0 : folderSymbolicatedStack.originalFileName) !== null && _a !== void 0 ? _a : null;
|
|
300
|
+
const [newCompositionPlanState, setNewCompositionPlanState] = (0, react_1.useState)({
|
|
301
|
+
folderStack: null,
|
|
302
|
+
type: 'ready',
|
|
303
|
+
plan: newPlan,
|
|
304
|
+
});
|
|
305
|
+
(0, react_1.useEffect)(() => {
|
|
306
|
+
if (selectedFolderStack === null) {
|
|
307
|
+
setNewCompositionPlanState({
|
|
308
|
+
folderStack: null,
|
|
309
|
+
type: 'ready',
|
|
310
|
+
plan: newPlan,
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (!(0, use_resolved_stack_1.hasResolvedStack)(selectedFolderStack)) {
|
|
315
|
+
setNewCompositionPlanState({
|
|
316
|
+
folderStack: selectedFolderStack,
|
|
317
|
+
type: 'loading',
|
|
318
|
+
});
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (folderCompositionFile === null) {
|
|
322
|
+
setNewCompositionPlanState({
|
|
323
|
+
folderStack: selectedFolderStack,
|
|
324
|
+
type: 'error',
|
|
325
|
+
reason: 'Could not determine where the new composition should be created.',
|
|
326
|
+
});
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
let canceled = false;
|
|
330
|
+
setNewCompositionPlanState({
|
|
331
|
+
folderStack: selectedFolderStack,
|
|
332
|
+
type: 'loading',
|
|
333
|
+
});
|
|
334
|
+
(0, element_install_api_1.prepareElementInstall)({
|
|
335
|
+
destination: {
|
|
336
|
+
type: 'new-composition',
|
|
337
|
+
compositionFile: folderCompositionFile,
|
|
338
|
+
},
|
|
339
|
+
element: request.element,
|
|
340
|
+
})
|
|
341
|
+
.then((result) => {
|
|
342
|
+
if (canceled) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
setNewCompositionPlanState(result.success
|
|
346
|
+
? {
|
|
347
|
+
folderStack: selectedFolderStack,
|
|
348
|
+
type: 'ready',
|
|
349
|
+
plan: result.plan,
|
|
350
|
+
}
|
|
351
|
+
: {
|
|
352
|
+
folderStack: selectedFolderStack,
|
|
353
|
+
type: 'error',
|
|
354
|
+
reason: result.reason,
|
|
355
|
+
});
|
|
356
|
+
})
|
|
357
|
+
.catch((error) => {
|
|
358
|
+
if (!canceled) {
|
|
359
|
+
setNewCompositionPlanState({
|
|
360
|
+
folderStack: selectedFolderStack,
|
|
361
|
+
type: 'error',
|
|
362
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
return () => {
|
|
367
|
+
canceled = true;
|
|
368
|
+
};
|
|
369
|
+
}, [folderCompositionFile, newPlan, request.element, selectedFolderStack]);
|
|
370
|
+
const { createComposition, heightValidationMessage, nameValidationMessage, valid: newCompositionValuesAreValid, widthValidationMessage, } = (0, use_create_composition_1.useCreateComposition)({
|
|
371
|
+
canvasCapture: null,
|
|
372
|
+
compositions,
|
|
373
|
+
durationInFrames: newCompositionValues.durationInFrames,
|
|
374
|
+
folderName: newCompositionValues.folder.folderName,
|
|
375
|
+
newId: newCompositionValues.id,
|
|
376
|
+
parentName: newCompositionValues.folder.parentName,
|
|
377
|
+
selectedFrameRate: newCompositionValues.fps,
|
|
378
|
+
size: newCompositionValues.size,
|
|
379
|
+
});
|
|
380
|
+
const activeNewCompositionPlanState = newCompositionPlanState.folderStack === selectedFolderStack
|
|
381
|
+
? newCompositionPlanState
|
|
382
|
+
: null;
|
|
383
|
+
const selectedNewCompositionPlan = (activeNewCompositionPlanState === null || activeNewCompositionPlanState === void 0 ? void 0 : activeNewCompositionPlanState.type) === 'ready'
|
|
384
|
+
? activeNewCompositionPlanState.plan
|
|
385
|
+
: null;
|
|
386
|
+
const selectedPlan = mode === 'current-composition' ? currentPlan : selectedNewCompositionPlan;
|
|
387
|
+
const folderTargetIsReady = selectedFolderStack === null ||
|
|
388
|
+
((0, use_resolved_stack_1.hasResolvedStack)(selectedFolderStack) && folderCompositionFile !== null);
|
|
389
|
+
const canSubmit = !submitting &&
|
|
390
|
+
(mode === 'current-composition'
|
|
391
|
+
? currentPlan !== null
|
|
392
|
+
: newCompositionValuesAreValid &&
|
|
393
|
+
folderTargetIsReady &&
|
|
394
|
+
selectedNewCompositionPlan !== null);
|
|
395
|
+
const submit = (0, react_1.useCallback)(async () => {
|
|
396
|
+
if (!canSubmit) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
setSubmitting(true);
|
|
400
|
+
if (mode === 'new-composition') {
|
|
401
|
+
if (selectedNewCompositionPlan === null) {
|
|
402
|
+
setSubmitting(false);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const created = await createComposition({
|
|
406
|
+
signal: new AbortController().signal,
|
|
407
|
+
symbolicatedStack: selectedFolderStack === null ? null : folderSymbolicatedStack,
|
|
408
|
+
});
|
|
409
|
+
if (!created.success) {
|
|
410
|
+
(0, NotificationCenter_1.showNotification)(`Could not create composition: ${created.reason}`, 4000);
|
|
411
|
+
setSubmitting(false);
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
await (0, import_assets_1.insertElement)({
|
|
415
|
+
compositionFile: selectedNewCompositionPlan.compositionFile,
|
|
416
|
+
compositionId: newCompositionValues.id,
|
|
417
|
+
element: request.element,
|
|
418
|
+
expectedFileState: selectedNewCompositionPlan.expectedFileState,
|
|
419
|
+
from: null,
|
|
420
|
+
overwriteExisting: selectedNewCompositionPlan.expectedFileState.exists,
|
|
421
|
+
position: null,
|
|
422
|
+
});
|
|
423
|
+
onClose();
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (currentPlan === null) {
|
|
427
|
+
setSubmitting(false);
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
await (0, import_assets_1.insertElement)({
|
|
431
|
+
compositionFile: request.compositionFile,
|
|
432
|
+
compositionId: request.compositionId,
|
|
433
|
+
element: request.element,
|
|
434
|
+
expectedFileState: currentPlan.expectedFileState,
|
|
435
|
+
from: request.from,
|
|
436
|
+
overwriteExisting: currentPlan.expectedFileState.exists,
|
|
437
|
+
position: request.position,
|
|
438
|
+
});
|
|
439
|
+
onClose();
|
|
440
|
+
}, [
|
|
441
|
+
canSubmit,
|
|
442
|
+
createComposition,
|
|
443
|
+
currentPlan,
|
|
444
|
+
folderSymbolicatedStack,
|
|
445
|
+
mode,
|
|
446
|
+
newCompositionValues.id,
|
|
447
|
+
onClose,
|
|
448
|
+
request,
|
|
449
|
+
selectedFolderStack,
|
|
450
|
+
selectedNewCompositionPlan,
|
|
451
|
+
]);
|
|
452
|
+
const cancel = (0, react_1.useCallback)(() => {
|
|
453
|
+
if (!submitting) {
|
|
454
|
+
onClose();
|
|
455
|
+
}
|
|
456
|
+
}, [onClose, submitting]);
|
|
457
|
+
const onSubmit = (0, react_1.useCallback)((event) => {
|
|
458
|
+
event.preventDefault();
|
|
459
|
+
submit();
|
|
460
|
+
}, [submit]);
|
|
461
|
+
return (0, react_dom_1.createPortal)(jsx_runtime_1.jsxs(ModalContainer_1.ModalContainer, { onOutsideClick: cancel, onEscape: cancel, children: [
|
|
462
|
+
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "Install Element", onClose: cancel }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
|
|
463
|
+
jsx_runtime_1.jsxs("div", { style: dialogContent, children: [
|
|
464
|
+
jsx_runtime_1.jsxs("div", { style: destinationControlStyle, children: [
|
|
465
|
+
jsx_runtime_1.jsx("div", { style: sectionTitleStyle, children: "Add to" }), jsx_runtime_1.jsxs("div", { "aria-label": "Installation destination", role: "group", style: destinationOptionsStyle, children: [
|
|
466
|
+
jsx_runtime_1.jsx("button", { "aria-pressed": mode === 'current-composition', className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME}`, disabled: currentPlan === null, onClick: () => setMode('current-composition'), style: getDestinationOptionStyle({
|
|
467
|
+
disabled: currentPlan === null,
|
|
468
|
+
selected: mode === 'current-composition',
|
|
469
|
+
}), type: "button", children: "Current composition" }), jsx_runtime_1.jsx("button", { "aria-pressed": mode === 'new-composition', className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME}`, onClick: () => {
|
|
470
|
+
setMode('new-composition');
|
|
471
|
+
requestAnimationFrame(() => {
|
|
472
|
+
var _a;
|
|
473
|
+
return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
474
|
+
});
|
|
475
|
+
}, style: {
|
|
476
|
+
...getDestinationOptionStyle({
|
|
477
|
+
disabled: false,
|
|
478
|
+
selected: mode === 'new-composition',
|
|
479
|
+
}),
|
|
480
|
+
borderLeft: `1px solid ${colors_1.WHITE_ALPHA_12}`,
|
|
481
|
+
}, type: "button", children: "New composition" })
|
|
482
|
+
] })
|
|
483
|
+
] }), currentPlan === null ? (jsx_runtime_1.jsxs("div", { style: warningStyle, role: "status", children: [
|
|
484
|
+
jsx_runtime_1.jsx(ValidationMessage_1.WarningTriangle, { style: warningIconStyle }), jsx_runtime_1.jsxs("p", { style: warningDescriptionStyle, children: ["Studio could not find a safe place in \u201C", request.compositionId, "\u201D to insert the Element. Install it into a new composition instead."] })
|
|
485
|
+
] })) : null, mode === 'new-composition' ? (jsx_runtime_1.jsxs("section", { style: sectionStyle, "aria-label": "New composition settings", children: [
|
|
486
|
+
jsx_runtime_1.jsx(NewComposition_1.NewCompositionFields, { heightValidationMessage: heightValidationMessage, inputRef: inputRef, nameValidationMessage: nameValidationMessage, setValues: setNewCompositionValues, values: newCompositionValues, widthValidationMessage: widthValidationMessage }), (activeNewCompositionPlanState === null || activeNewCompositionPlanState === void 0 ? void 0 : activeNewCompositionPlanState.type) === 'error' ? (jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: activeNewCompositionPlanState.reason, type: "error" })) : null] })) : null, jsx_runtime_1.jsxs("dl", { style: metadataStyle, "aria-label": "Installation details", children: [
|
|
487
|
+
jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
488
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Element" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: request.element.displayName })
|
|
489
|
+
] }), jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
490
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Request source" }), jsx_runtime_1.jsx("dd", { style: sourceIsUnverified
|
|
491
|
+
? unverifiedSourceStyle
|
|
492
|
+
: metadataDescriptionStyle, children: sourceLabel })
|
|
493
|
+
] }), jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
494
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Composition" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: jsx_runtime_1.jsx("code", { style: codeStyle, children: mode === 'current-composition'
|
|
495
|
+
? request.compositionId
|
|
496
|
+
: newCompositionValues.id }) })
|
|
497
|
+
] }), jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
498
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Destination" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: jsx_runtime_1.jsx("code", { style: codeStyle, children: (_b = selectedPlan === null || selectedPlan === void 0 ? void 0 : selectedPlan.filePath) !== null && _b !== void 0 ? _b : 'Reviewing destination…' }) })
|
|
499
|
+
] }), (selectedPlan === null || selectedPlan === void 0 ? void 0 : selectedPlan.expectedFileState.exists) ? (jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
500
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "File change" }), jsx_runtime_1.jsx("dd", { style: overwriteStyle, children: "Replace existing source file" })
|
|
501
|
+
] })) : null] }), dependenciesToReview.length > 0 ? (jsx_runtime_1.jsxs("section", { style: sectionStyle, "aria-labelledby": "element-install-dependencies", children: [
|
|
502
|
+
jsx_runtime_1.jsx("h3", { id: "element-install-dependencies", style: sectionTitleStyle, children: "Dependencies" }), jsx_runtime_1.jsx("ul", { style: dependencyListStyle, role: "list", children: dependenciesToReview.map((packageName) => {
|
|
503
|
+
const willInstall = missingPackages.includes(packageName);
|
|
504
|
+
return (jsx_runtime_1.jsxs("li", { style: dependencyRowStyle, children: [
|
|
505
|
+
jsx_runtime_1.jsx("div", { style: dependencyNameStyle, children: packageName }), jsx_runtime_1.jsx("div", { style: willInstall
|
|
506
|
+
? dependencyInstallStatusStyle
|
|
507
|
+
: dependencyInstalledStatusStyle, children: willInstall ? 'Will be installed' : 'Installed' })
|
|
508
|
+
] }, packageName));
|
|
509
|
+
}) })
|
|
510
|
+
] })) : null, jsx_runtime_1.jsxs("div", { style: warningStyle, children: [
|
|
511
|
+
jsx_runtime_1.jsx(ValidationMessage_1.WarningTriangle, { style: warningIconStyle }), jsx_runtime_1.jsxs("p", { style: warningDescriptionStyle, children: ["This adds executable source code to your project.", usesBrowserDependencyResolution
|
|
512
|
+
? null
|
|
513
|
+
: ' Package lifecycle scripts may also run during installation, with access to your files and the network.'] })
|
|
514
|
+
] }), jsx_runtime_1.jsxs("details", { style: sourceDetailsStyle, children: [
|
|
515
|
+
jsx_runtime_1.jsx("summary", { style: sourceSummaryStyle, children: "Source code" }), jsx_runtime_1.jsx("pre", { style: sourceCodeBlockStyle, children: jsx_runtime_1.jsx("code", { style: sourceCodeStyle, children: makeSourceControlsVisible(request.element.sourceCode) }) })
|
|
516
|
+
] })
|
|
517
|
+
] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { style: footerStyle, children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
518
|
+
jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsx(Button_1.Button, { disabled: submitting, onClick: cancel, style: cancelStyle, children: "Cancel" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs(ModalButton_1.ModalButton, { autoFocus: mode === 'current-composition', disabled: !canSubmit, onClick: submit, children: [submitting ? 'Installing…' : 'Install', jsx_runtime_1.jsx(ShortcutHint_1.ShortcutHint, { keyToPress: "\u21B5", cmdOrCtrl: false })
|
|
519
|
+
] })
|
|
520
|
+
] }) })
|
|
521
|
+
] })
|
|
522
|
+
] }), (0, portals_1.getPortal)(currentZIndex));
|
|
523
|
+
};
|
|
207
524
|
exports.ElementInstallConfirmation = ElementInstallConfirmation;
|
|
@@ -29,7 +29,9 @@ const ElementLibraryModal = ({ name, url }) => {
|
|
|
29
29
|
// Studio is cross-origin isolated. A credentialless iframe may embed a
|
|
30
30
|
// library that does not set Cross-Origin-Resource-Policy headers.
|
|
31
31
|
iframe.setAttribute('credentialless', '');
|
|
32
|
-
|
|
32
|
+
const iframeUrl = new URL(url);
|
|
33
|
+
iframeUrl.searchParams.set('remotion-studio', 'true');
|
|
34
|
+
iframe.src = iframeUrl.toString();
|
|
33
35
|
}, [url]);
|
|
34
36
|
return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { panelStyle: panelStyle, children: [
|
|
35
37
|
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: name }), jsx_runtime_1.jsx("iframe", { ref: iframeRef, allow: "local-network-access; loopback-network", style: iframeStyle, title: `${name} library` })
|
|
@@ -1,53 +1,17 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.FixComputedValueModal = void 0;
|
|
37
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
-
const react_1 =
|
|
5
|
+
const react_1 = require("react");
|
|
39
6
|
const colors_1 = require("../helpers/colors");
|
|
40
7
|
const copy_text_1 = require("../helpers/copy-text");
|
|
41
|
-
const open_in_editor_1 = require("../helpers/open-in-editor");
|
|
42
|
-
const caret_1 = require("../icons/caret");
|
|
43
8
|
const clipboard_1 = require("../icons/clipboard");
|
|
44
|
-
const
|
|
9
|
+
const CodingAgentButton_1 = require("./CodingAgentButton");
|
|
45
10
|
const InlineAction_1 = require("./InlineAction");
|
|
46
11
|
const ModalFooter_1 = require("./ModalFooter");
|
|
47
12
|
const ModalHeader_1 = require("./ModalHeader");
|
|
48
13
|
const DismissableModal_1 = require("./NewComposition/DismissableModal");
|
|
49
14
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
50
|
-
const SegmentedButton_1 = require("./SegmentedButton");
|
|
51
15
|
const SettingsContext_1 = require("./SettingsContext");
|
|
52
16
|
const panelStyle = {
|
|
53
17
|
borderRadius: 6,
|
|
@@ -93,28 +57,12 @@ const footer = {
|
|
|
93
57
|
flex: 'none',
|
|
94
58
|
justifyContent: 'flex-end',
|
|
95
59
|
};
|
|
96
|
-
const mainSegmentStyle = {
|
|
97
|
-
gap: 6,
|
|
98
|
-
padding: '0 9px',
|
|
99
|
-
};
|
|
100
|
-
const dropdownSegmentStyle = {
|
|
101
|
-
padding: 0,
|
|
102
|
-
width: 20,
|
|
103
|
-
};
|
|
104
|
-
const menuLabel = {
|
|
105
|
-
color: 'inherit',
|
|
106
|
-
fontFamily: 'sans-serif',
|
|
107
|
-
fontSize: 13,
|
|
108
|
-
lineHeight: '16px',
|
|
109
|
-
};
|
|
110
60
|
const FixComputedValueModal = ({ state }) => {
|
|
111
|
-
var _a
|
|
61
|
+
var _a;
|
|
112
62
|
const { codingAgentInfo } = (0, SettingsContext_1.useSettings)();
|
|
113
63
|
const prompt = `/remotion-interactivity ${state.context} make "${state.prop}" interactive`;
|
|
114
64
|
const installCommand = 'npx remotion skills add';
|
|
115
|
-
const
|
|
116
|
-
const defaultCodingAgent = (_b = installedCodingAgents.find((agent) => agent.id === (codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.defaultCodingAgent))) !== null && _b !== void 0 ? _b : installedCodingAgents[0];
|
|
117
|
-
const alternativeCodingAgents = installedCodingAgents.filter((agent) => agent.id !== (defaultCodingAgent === null || defaultCodingAgent === void 0 ? void 0 : defaultCodingAgent.id));
|
|
65
|
+
const hasCodingAgent = ((_a = codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.installedCodingAgents.length) !== null && _a !== void 0 ? _a : 0) > 0;
|
|
118
66
|
const onCopyPrompt = (0, react_1.useCallback)(() => {
|
|
119
67
|
(0, copy_text_1.copyText)(prompt).catch((err) => {
|
|
120
68
|
(0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
|
|
@@ -128,80 +76,6 @@ const FixComputedValueModal = ({ state }) => {
|
|
|
128
76
|
const renderCopyAction = (0, react_1.useCallback)((color) => {
|
|
129
77
|
return jsx_runtime_1.jsx(clipboard_1.ClipboardIcon, { color: color, style: copyIcon });
|
|
130
78
|
}, []);
|
|
131
|
-
const openWithCodingAgent = (0, react_1.useCallback)(async (codingAgentId, codingAgentName) => {
|
|
132
|
-
try {
|
|
133
|
-
const response = await (0, open_in_editor_1.openInCodingAgent)(codingAgentId, codingAgentId === 'copilot' ? null : prompt);
|
|
134
|
-
if (!response.success) {
|
|
135
|
-
(0, NotificationCenter_1.showNotification)(`Could not open ${codingAgentName}`, 2000);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
(0, NotificationCenter_1.showNotification)(err.message, 2000);
|
|
140
|
-
}
|
|
141
|
-
}, [prompt]);
|
|
142
|
-
const agentMenuItems = react_1.default.useMemo(() => {
|
|
143
|
-
return alternativeCodingAgents.map((codingAgent) => ({
|
|
144
|
-
id: `fix-computed-value-in-${codingAgent.id}`,
|
|
145
|
-
keyHint: null,
|
|
146
|
-
label: jsx_runtime_1.jsx("span", { style: menuLabel, children: codingAgent.name }),
|
|
147
|
-
leftItem: jsx_runtime_1.jsx(CodingAgentIcon_1.CodingAgentIcon, { codingAgentId: codingAgent.id, size: 18 }),
|
|
148
|
-
onClick: () => {
|
|
149
|
-
openWithCodingAgent(codingAgent.id, codingAgent.nameWithType).catch(() => undefined);
|
|
150
|
-
},
|
|
151
|
-
quickSwitcherLabel: null,
|
|
152
|
-
subMenu: null,
|
|
153
|
-
type: 'item',
|
|
154
|
-
value: `coding-agent-${codingAgent.id}`,
|
|
155
|
-
}));
|
|
156
|
-
}, [alternativeCodingAgents, openWithCodingAgent]);
|
|
157
|
-
const segments = react_1.default.useMemo(() => {
|
|
158
|
-
if (!defaultCodingAgent) {
|
|
159
|
-
return [];
|
|
160
|
-
}
|
|
161
|
-
return [
|
|
162
|
-
{
|
|
163
|
-
ariaLabel: `Open in ${defaultCodingAgent.nameWithType}`,
|
|
164
|
-
buttonId: null,
|
|
165
|
-
disabled: false,
|
|
166
|
-
idleColor: colors_1.LIGHT_TEXT,
|
|
167
|
-
onClick: () => {
|
|
168
|
-
openWithCodingAgent(defaultCodingAgent.id, defaultCodingAgent.nameWithType).catch(() => undefined);
|
|
169
|
-
},
|
|
170
|
-
onPointerDown: null,
|
|
171
|
-
renderContent: () => (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
172
|
-
jsx_runtime_1.jsx(CodingAgentIcon_1.CodingAgentIcon, { codingAgentId: defaultCodingAgent.id, size: 18 }),
|
|
173
|
-
"Open in ", defaultCodingAgent.name] })),
|
|
174
|
-
segmentId: 'default-coding-agent',
|
|
175
|
-
style: mainSegmentStyle,
|
|
176
|
-
title: `Open in ${defaultCodingAgent.nameWithType}`,
|
|
177
|
-
type: 'action',
|
|
178
|
-
},
|
|
179
|
-
...(alternativeCodingAgents.length > 0
|
|
180
|
-
? [
|
|
181
|
-
{
|
|
182
|
-
ariaLabel: 'Open in another coding agent',
|
|
183
|
-
buttonId: null,
|
|
184
|
-
disabled: false,
|
|
185
|
-
idleColor: colors_1.LIGHT_TEXT,
|
|
186
|
-
leaveLeftSpace: true,
|
|
187
|
-
onOpenChange: null,
|
|
188
|
-
renderContent: (color) => jsx_runtime_1.jsx(caret_1.CaretDown, { color: color }),
|
|
189
|
-
segmentId: 'another-coding-agent',
|
|
190
|
-
selectedId: null,
|
|
191
|
-
style: dropdownSegmentStyle,
|
|
192
|
-
title: 'Open in another coding agent',
|
|
193
|
-
type: 'menu',
|
|
194
|
-
values: agentMenuItems,
|
|
195
|
-
},
|
|
196
|
-
]
|
|
197
|
-
: []),
|
|
198
|
-
];
|
|
199
|
-
}, [
|
|
200
|
-
agentMenuItems,
|
|
201
|
-
alternativeCodingAgents.length,
|
|
202
|
-
defaultCodingAgent,
|
|
203
|
-
openWithCodingAgent,
|
|
204
|
-
]);
|
|
205
79
|
return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { panelStyle: panelStyle, children: [
|
|
206
80
|
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "Fix computed value" }), jsx_runtime_1.jsxs("div", { style: container, children: [state.remotionInteractivitySkillAvailable ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
207
81
|
jsx_runtime_1.jsx("div", { style: text, children: "First, install the Remotion Agent Skills:" }), jsx_runtime_1.jsxs("div", { style: commandField, children: [
|
|
@@ -215,6 +89,6 @@ const FixComputedValueModal = ({ state }) => {
|
|
|
215
89
|
: 'Then, paste this prompt into your coding agent:' }), jsx_runtime_1.jsxs("div", { style: commandField, children: [
|
|
216
90
|
jsx_runtime_1.jsx("pre", { style: code, children: prompt }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, onClick: onCopyPrompt, renderAction: renderCopyAction, title: "Copy prompt" })
|
|
217
91
|
] })
|
|
218
|
-
] }),
|
|
92
|
+
] }), hasCodingAgent ? (jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { style: footer, children: jsx_runtime_1.jsx(CodingAgentButton_1.CodingAgentButton, { label: "Open in", prompt: prompt, size: "compact", style: null }) })) : null] }));
|
|
219
93
|
};
|
|
220
94
|
exports.FixComputedValueModal = FixComputedValueModal;
|
|
@@ -131,8 +131,9 @@ const InitialCompositionLoader = () => {
|
|
|
131
131
|
}
|
|
132
132
|
setCanvasContent(newCanvas);
|
|
133
133
|
};
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
const navigationWindow = (0, url_state_1.getNavigationWindow)();
|
|
135
|
+
navigationWindow.addEventListener('popstate', onchange);
|
|
136
|
+
return () => navigationWindow.removeEventListener('popstate', onchange);
|
|
136
137
|
}, [
|
|
137
138
|
compositions,
|
|
138
139
|
selectAsset,
|