@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
|
@@ -15,6 +15,7 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, componentI
|
|
|
15
15
|
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
16
16
|
const { migrateExpandedTracksForSubscriptionKey } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
|
|
17
17
|
const { previewServerState: state } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
18
|
+
const [refreshToken, setRefreshToken] = (0, react_1.useState)(0);
|
|
18
19
|
const previousNodePathRef = (0, react_1.useRef)(null);
|
|
19
20
|
const overrideIdToNodePathMappingsRef = (0, react_1.useRef)(overrideIdToNodePathMappings);
|
|
20
21
|
overrideIdToNodePathMappingsRef.current = overrideIdToNodePathMappings;
|
|
@@ -37,6 +38,11 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, componentI
|
|
|
37
38
|
const locationSource = (_a = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) !== null && _a !== void 0 ? _a : null;
|
|
38
39
|
const locationLine = (_b = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.line) !== null && _b !== void 0 ? _b : null;
|
|
39
40
|
const locationColumn = (_c = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.column) !== null && _c !== void 0 ? _c : null;
|
|
41
|
+
(0, react_1.useEffect)(() => {
|
|
42
|
+
return (0, sequence_props_subscription_store_1.subscribeToSequencePropsRefresh)(overrideId, () => {
|
|
43
|
+
setRefreshToken((token) => token + 1);
|
|
44
|
+
});
|
|
45
|
+
}, [overrideId]);
|
|
40
46
|
(0, react_1.useEffect)(() => {
|
|
41
47
|
var _a, _b;
|
|
42
48
|
if (!clientId ||
|
|
@@ -108,6 +114,7 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, componentI
|
|
|
108
114
|
migrateExpandedTracksForSubscriptionKey,
|
|
109
115
|
overrideId,
|
|
110
116
|
preferMappedNodePath,
|
|
117
|
+
refreshToken,
|
|
111
118
|
schema,
|
|
112
119
|
setPropStatuses,
|
|
113
120
|
setOverrideIdToNodePath,
|
|
@@ -18,6 +18,7 @@ const label = {
|
|
|
18
18
|
overflow: 'hidden',
|
|
19
19
|
textAlign: 'left',
|
|
20
20
|
textOverflow: 'ellipsis',
|
|
21
|
+
userSelect: 'none',
|
|
21
22
|
whiteSpace: 'nowrap',
|
|
22
23
|
};
|
|
23
24
|
const TimelineCombobox = ({ values, selectedId, title, labelWidth = 32, renderLeftItem, unhoveredIconColor = colors_1.LIGHT_TEXT, }) => {
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import type { GetRemotionSkillsInfoResponse, UpdateAvailableResponse } from '@remotion/studio-shared';
|
|
2
|
-
export type UpdateInfo = UpdateAvailableResponse & Pick<GetRemotionSkillsInfoResponse, 'remotionUpgradeSkillAvailable'>;
|
|
3
|
-
export type Bug = {
|
|
4
|
-
title: string;
|
|
5
|
-
description: string;
|
|
6
|
-
link: string;
|
|
7
|
-
versions: string[];
|
|
8
|
-
};
|
|
9
1
|
export declare const UpdateCheck: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -3,13 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UpdateCheck = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const remotion_1 = require("remotion");
|
|
7
6
|
const colors_1 = require("../helpers/colors");
|
|
8
7
|
const modals_1 = require("../state/modals");
|
|
9
8
|
const z_index_1 = require("../state/z-index");
|
|
10
9
|
const InlineAction_1 = require("./InlineAction");
|
|
11
|
-
const
|
|
12
|
-
const SettingsContext_1 = require("./SettingsContext");
|
|
10
|
+
const UpdateStatusContext_1 = require("./UpdateStatusContext");
|
|
13
11
|
const buttonStyle = {
|
|
14
12
|
appearance: 'none',
|
|
15
13
|
border: 'none',
|
|
@@ -27,67 +25,22 @@ const updateIconContainer = {
|
|
|
27
25
|
flexShrink: 0,
|
|
28
26
|
};
|
|
29
27
|
const UpdateCheck = () => {
|
|
30
|
-
const [info, setInfo] = (0, react_1.useState)(null);
|
|
31
28
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
|
|
32
|
-
const { remotionSkillsInfo } = (0, SettingsContext_1.useSettings)();
|
|
33
29
|
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
34
|
-
const
|
|
30
|
+
const { info, knownBugs } = (0, UpdateStatusContext_1.useUpdateStatus)();
|
|
35
31
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
36
32
|
const hasBugfixesAvailable = (0, react_1.useMemo)(() => {
|
|
37
33
|
return Boolean((info === null || info === void 0 ? void 0 : info.updateAvailable) && knownBugs && knownBugs.length > 0);
|
|
38
34
|
}, [info === null || info === void 0 ? void 0 : info.updateAvailable, knownBugs]);
|
|
39
|
-
const checkForUpdates = (0, react_1.useCallback)(() => {
|
|
40
|
-
const controller = new AbortController();
|
|
41
|
-
(0, actions_1.updateAvailable)(controller.signal)
|
|
42
|
-
.then((d) => {
|
|
43
|
-
setInfo(d);
|
|
44
|
-
})
|
|
45
|
-
.catch((err) => {
|
|
46
|
-
if (err.message.includes('aborted')) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
// eslint-disable-next-line no-console
|
|
50
|
-
console.log('Could not check for updates', err);
|
|
51
|
-
});
|
|
52
|
-
return controller;
|
|
53
|
-
}, []);
|
|
54
|
-
const checkForBugs = (0, react_1.useCallback)(() => {
|
|
55
|
-
const controller = new AbortController();
|
|
56
|
-
fetch(`https://bugs.remotion.dev/api/${remotion_1.VERSION}`, {
|
|
57
|
-
signal: controller.signal,
|
|
58
|
-
})
|
|
59
|
-
.then(async (res) => {
|
|
60
|
-
const body = await res.json();
|
|
61
|
-
setKnownBugs(body.bugs);
|
|
62
|
-
})
|
|
63
|
-
.catch((err) => {
|
|
64
|
-
if (err.message.includes('aborted')) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
// eslint-disable-next-line no-console
|
|
68
|
-
console.log('Could not check for bugs in this version', err);
|
|
69
|
-
});
|
|
70
|
-
return controller;
|
|
71
|
-
}, []);
|
|
72
|
-
(0, react_1.useEffect)(() => {
|
|
73
|
-
const abortUpdate = checkForUpdates();
|
|
74
|
-
const abortBugs = checkForBugs();
|
|
75
|
-
return () => {
|
|
76
|
-
abortUpdate.abort();
|
|
77
|
-
abortBugs.abort();
|
|
78
|
-
};
|
|
79
|
-
}, [checkForBugs, checkForUpdates]);
|
|
80
35
|
const openModal = (0, react_1.useCallback)(() => {
|
|
81
36
|
var _a;
|
|
37
|
+
var _b;
|
|
82
38
|
setSelectedModal({
|
|
83
|
-
type: '
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
remotionUpgradeSkillAvailable: (_a = remotionSkillsInfo === null || remotionSkillsInfo === void 0 ? void 0 : remotionSkillsInfo.remotionUpgradeSkillAvailable) !== null && _a !== void 0 ? _a : false,
|
|
87
|
-
},
|
|
88
|
-
knownBugs: knownBugs,
|
|
39
|
+
type: 'settings',
|
|
40
|
+
initialTab: 'updates',
|
|
41
|
+
initialPublicLicenseKey: (_b = (_a = window.remotion_renderDefaults) === null || _a === void 0 ? void 0 : _a.publicLicenseKey) !== null && _b !== void 0 ? _b : null,
|
|
89
42
|
});
|
|
90
|
-
}, [
|
|
43
|
+
}, [setSelectedModal]);
|
|
91
44
|
const dynButtonStyle = (0, react_1.useMemo)(() => {
|
|
92
45
|
return {
|
|
93
46
|
...buttonStyle,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UpdateAvailableResponse } from '@remotion/studio-shared';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type Bug = {
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
link: string;
|
|
7
|
+
versions: string[];
|
|
8
|
+
};
|
|
9
|
+
type UpdateStatusContextValue = {
|
|
10
|
+
readonly error: string | null;
|
|
11
|
+
readonly info: UpdateAvailableResponse | null;
|
|
12
|
+
readonly knownBugs: Bug[] | null;
|
|
13
|
+
};
|
|
14
|
+
export declare const UpdateStatusProvider: React.FC<{
|
|
15
|
+
readonly children: React.ReactNode;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const useUpdateStatus: () => UpdateStatusContextValue;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUpdateStatus = exports.UpdateStatusProvider = 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 browser_studio_operations_1 = require("../helpers/browser-studio-operations");
|
|
8
|
+
const can_show_updates_1 = require("../helpers/can-show-updates");
|
|
9
|
+
const client_id_1 = require("../helpers/client-id");
|
|
10
|
+
const actions_1 = require("./RenderQueue/actions");
|
|
11
|
+
const UpdateStatusContext = (0, react_1.createContext)(null);
|
|
12
|
+
const UpdateStatusProvider = ({ children }) => {
|
|
13
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
14
|
+
const [info, setInfo] = (0, react_1.useState)(null);
|
|
15
|
+
const [knownBugs, setKnownBugs] = (0, react_1.useState)(null);
|
|
16
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
17
|
+
const showUpdates = (0, can_show_updates_1.canShowUpdates)({
|
|
18
|
+
connectionStatus: previewServerState.type,
|
|
19
|
+
isBrowserStudio: (0, browser_studio_operations_1.getBrowserStudioOperations)() !== null,
|
|
20
|
+
readOnlyStudio: window.remotion_isReadOnlyStudio,
|
|
21
|
+
});
|
|
22
|
+
(0, react_1.useEffect)(() => {
|
|
23
|
+
if (!showUpdates) {
|
|
24
|
+
setInfo(null);
|
|
25
|
+
setKnownBugs(null);
|
|
26
|
+
setError(null);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const updateController = new AbortController();
|
|
30
|
+
const bugsController = new AbortController();
|
|
31
|
+
(0, actions_1.updateAvailable)(updateController.signal)
|
|
32
|
+
.then((response) => {
|
|
33
|
+
setInfo(response);
|
|
34
|
+
setError(null);
|
|
35
|
+
})
|
|
36
|
+
.catch((err) => {
|
|
37
|
+
if (updateController.signal.aborted) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
setError(err.message);
|
|
41
|
+
});
|
|
42
|
+
fetch('https://bugs.remotion.dev/api/' + remotion_1.VERSION, {
|
|
43
|
+
signal: bugsController.signal,
|
|
44
|
+
})
|
|
45
|
+
.then(async (response) => {
|
|
46
|
+
const body = await response.json();
|
|
47
|
+
setKnownBugs(body.bugs);
|
|
48
|
+
})
|
|
49
|
+
.catch((err) => {
|
|
50
|
+
if (bugsController.signal.aborted) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// eslint-disable-next-line no-console
|
|
54
|
+
console.log('Could not check for bugs in this version', err);
|
|
55
|
+
});
|
|
56
|
+
return () => {
|
|
57
|
+
updateController.abort();
|
|
58
|
+
bugsController.abort();
|
|
59
|
+
};
|
|
60
|
+
}, [showUpdates]);
|
|
61
|
+
const value = (0, react_1.useMemo)(() => {
|
|
62
|
+
return { error, info, knownBugs };
|
|
63
|
+
}, [error, info, knownBugs]);
|
|
64
|
+
return (jsx_runtime_1.jsx(UpdateStatusContext.Provider, { value: value, children: children }));
|
|
65
|
+
};
|
|
66
|
+
exports.UpdateStatusProvider = UpdateStatusProvider;
|
|
67
|
+
const useUpdateStatus = () => {
|
|
68
|
+
const context = (0, react_1.useContext)(UpdateStatusContext);
|
|
69
|
+
if (context === null) {
|
|
70
|
+
throw new Error('useUpdateStatus must be used inside UpdateStatusProvider');
|
|
71
|
+
}
|
|
72
|
+
return context;
|
|
73
|
+
};
|
|
74
|
+
exports.useUpdateStatus = useUpdateStatus;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdatesSettings = 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 copy_text_1 = require("../helpers/copy-text");
|
|
8
|
+
const clipboard_1 = require("../icons/clipboard");
|
|
9
|
+
const InlineAction_1 = require("./InlineAction");
|
|
10
|
+
const KnownBugs_1 = require("./KnownBugs");
|
|
11
|
+
const ValidationMessage_1 = require("./NewComposition/ValidationMessage");
|
|
12
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
13
|
+
const actions_1 = require("./RenderQueue/actions");
|
|
14
|
+
const SettingsContext_1 = require("./SettingsContext");
|
|
15
|
+
const UpdateStatusContext_1 = require("./UpdateStatusContext");
|
|
16
|
+
const container = {
|
|
17
|
+
alignSelf: 'flex-start',
|
|
18
|
+
boxSizing: 'border-box',
|
|
19
|
+
flex: 1,
|
|
20
|
+
minWidth: 0,
|
|
21
|
+
padding: '4px 16px 0',
|
|
22
|
+
};
|
|
23
|
+
const text = {
|
|
24
|
+
color: colors_1.LIGHT_TEXT,
|
|
25
|
+
fontFamily: 'sans-serif',
|
|
26
|
+
fontSize: 14,
|
|
27
|
+
lineHeight: 1.5,
|
|
28
|
+
};
|
|
29
|
+
const title = {
|
|
30
|
+
paddingTop: 12,
|
|
31
|
+
paddingBottom: 8,
|
|
32
|
+
...text,
|
|
33
|
+
};
|
|
34
|
+
const titleBeforeCommand = {
|
|
35
|
+
...title,
|
|
36
|
+
paddingBottom: 0,
|
|
37
|
+
};
|
|
38
|
+
const commandField = {
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
background: colors_1.SELECTED_BACKGROUND,
|
|
41
|
+
borderRadius: 6,
|
|
42
|
+
boxSizing: 'border-box',
|
|
43
|
+
display: 'flex',
|
|
44
|
+
marginBottom: 10,
|
|
45
|
+
marginTop: 10,
|
|
46
|
+
padding: '8px 8px 8px 10px',
|
|
47
|
+
width: '100%',
|
|
48
|
+
};
|
|
49
|
+
const code = {
|
|
50
|
+
color: colors_1.WHITE,
|
|
51
|
+
flex: 1,
|
|
52
|
+
fontFamily: 'monospace',
|
|
53
|
+
fontSize: 14,
|
|
54
|
+
lineHeight: 1.5,
|
|
55
|
+
margin: 0,
|
|
56
|
+
minWidth: 0,
|
|
57
|
+
overflowX: 'auto',
|
|
58
|
+
whiteSpace: 'pre',
|
|
59
|
+
};
|
|
60
|
+
const copyIcon = {
|
|
61
|
+
flexShrink: 0,
|
|
62
|
+
height: 12,
|
|
63
|
+
width: 12,
|
|
64
|
+
};
|
|
65
|
+
const link = {
|
|
66
|
+
...text,
|
|
67
|
+
fontWeight: 'bold',
|
|
68
|
+
color: colors_1.BLUE,
|
|
69
|
+
textDecoration: 'none',
|
|
70
|
+
};
|
|
71
|
+
const releaseNotesFrame = {
|
|
72
|
+
backgroundColor: colors_1.BACKGROUND,
|
|
73
|
+
border: 0,
|
|
74
|
+
display: 'block',
|
|
75
|
+
marginTop: 8,
|
|
76
|
+
overflow: 'hidden',
|
|
77
|
+
width: '100%',
|
|
78
|
+
};
|
|
79
|
+
const releaseNotesTitle = {
|
|
80
|
+
...title,
|
|
81
|
+
borderBottom: colors_1.BORDER_WHITE_ALPHA_12,
|
|
82
|
+
width: '100%',
|
|
83
|
+
};
|
|
84
|
+
const commands = {
|
|
85
|
+
npm: 'npx remotion upgrade',
|
|
86
|
+
yarn: 'yarn remotion upgrade',
|
|
87
|
+
pnpm: 'pnpm exec remotion upgrade',
|
|
88
|
+
bun: 'bun remotion upgrade',
|
|
89
|
+
unknown: 'npx remotion upgrade',
|
|
90
|
+
};
|
|
91
|
+
const skillsUpdateCommand = 'npx remotion skills update';
|
|
92
|
+
const remotionUpgradeSkill = '/remotion-upgrade';
|
|
93
|
+
const formatReleaseDate = (publishedAt) => {
|
|
94
|
+
if (publishedAt === null) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const date = new Date(publishedAt);
|
|
98
|
+
if (Number.isNaN(date.getTime())) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const day = date.getDate();
|
|
102
|
+
const lastTwoDigits = day % 100;
|
|
103
|
+
const suffix = lastTwoDigits >= 11 && lastTwoDigits <= 13
|
|
104
|
+
? 'th'
|
|
105
|
+
: day % 10 === 1
|
|
106
|
+
? 'st'
|
|
107
|
+
: day % 10 === 2
|
|
108
|
+
? 'nd'
|
|
109
|
+
: day % 10 === 3
|
|
110
|
+
? 'rd'
|
|
111
|
+
: 'th';
|
|
112
|
+
const month = new Intl.DateTimeFormat('en-US', {
|
|
113
|
+
month: 'long',
|
|
114
|
+
}).format(date);
|
|
115
|
+
return `${month} ${day}${suffix}, ${date.getFullYear()}`;
|
|
116
|
+
};
|
|
117
|
+
const RenderedReleaseNotes = ({ release }) => {
|
|
118
|
+
const [height, setHeight] = (0, react_1.useState)(220);
|
|
119
|
+
const frameRef = (0, react_1.useRef)(null);
|
|
120
|
+
const resizeObserver = (0, react_1.useRef)(null);
|
|
121
|
+
const formattedReleaseDate = formatReleaseDate(release.publishedAt);
|
|
122
|
+
const document = (0, react_1.useMemo)(() => {
|
|
123
|
+
if (release.releaseNotesHtml === null) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
return `<!doctype html><html><head><base href="https://github.com/remotion-dev/remotion/" target="_blank"><style>
|
|
127
|
+
:root { color-scheme: dark; }
|
|
128
|
+
html, body { overflow: hidden; }
|
|
129
|
+
body { background: ${colors_1.BACKGROUND}; color: ${colors_1.LIGHT_TEXT}; font-family: sans-serif; font-size: 13px; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
|
|
130
|
+
h1, h2, h3, h4, h5, h6 { color: ${colors_1.WHITE}; line-height: 1.25; margin: 16px 0 8px; }
|
|
131
|
+
h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }
|
|
132
|
+
h1 { font-size: 18px; } h2 { font-size: 16px; } h3, h4, h5, h6 { font-size: 14px; }
|
|
133
|
+
p, ul, ol, pre, blockquote { margin: 8px 0; }
|
|
134
|
+
ul, ol { padding-left: 22px; }
|
|
135
|
+
a { color: ${colors_1.BLUE}; text-decoration: none; }
|
|
136
|
+
code { background: transparent; color: ${colors_1.LIGHT_TEXT}; font-family: monospace; padding: 0; }
|
|
137
|
+
pre { background: ${colors_1.SELECTED_BACKGROUND}; border-radius: 6px; overflow-x: auto; padding: 10px; }
|
|
138
|
+
pre code { background: transparent; padding: 0; }
|
|
139
|
+
img { max-width: 100%; }
|
|
140
|
+
blockquote { border-left: 3px solid ${colors_1.SELECTED_BACKGROUND}; margin-left: 0; padding-left: 10px; }
|
|
141
|
+
hr { border: 0; border-top: 1px solid ${colors_1.SELECTED_BACKGROUND}; }
|
|
142
|
+
</style></head><body>${release.releaseNotesHtml}</body></html>`;
|
|
143
|
+
}, [release.releaseNotesHtml]);
|
|
144
|
+
(0, react_1.useEffect)(() => {
|
|
145
|
+
return () => {
|
|
146
|
+
var _a;
|
|
147
|
+
return (_a = resizeObserver.current) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
148
|
+
};
|
|
149
|
+
}, []);
|
|
150
|
+
const onLoad = (0, react_1.useCallback)(() => {
|
|
151
|
+
var _a, _b;
|
|
152
|
+
(_a = resizeObserver.current) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
153
|
+
const iframeDocument = (_b = frameRef.current) === null || _b === void 0 ? void 0 : _b.contentDocument;
|
|
154
|
+
if (!(iframeDocument === null || iframeDocument === void 0 ? void 0 : iframeDocument.body)) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const updateHeight = () => {
|
|
158
|
+
setHeight(iframeDocument.documentElement.scrollHeight + 2);
|
|
159
|
+
};
|
|
160
|
+
updateHeight();
|
|
161
|
+
const observer = new ResizeObserver(updateHeight);
|
|
162
|
+
observer.observe(iframeDocument.body);
|
|
163
|
+
resizeObserver.current = observer;
|
|
164
|
+
}, []);
|
|
165
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
166
|
+
jsx_runtime_1.jsxs("div", { style: releaseNotesTitle, children: [release.version, formattedReleaseDate === null
|
|
167
|
+
? null
|
|
168
|
+
: ` \u2013\u00a0${formattedReleaseDate}`] }), document === null ? (jsx_runtime_1.jsxs("div", { style: text, children: ["Release notes could not be loaded.", ' ', jsx_runtime_1.jsx("a", { style: link, target: "_blank", href: `https://github.com/remotion-dev/remotion/releases/tag/v${release.version}`, children: "View them on GitHub" }),
|
|
169
|
+
"."] })) : (jsx_runtime_1.jsx("iframe", { ref: frameRef, onLoad: onLoad, sandbox: "allow-popups allow-popups-to-escape-sandbox allow-same-origin", scrolling: "no", srcDoc: document, style: { ...releaseNotesFrame, height }, title: `Release notes for Remotion ${release.version}` }))] }));
|
|
170
|
+
};
|
|
171
|
+
const UpdatesSettings = () => {
|
|
172
|
+
const { remotionSkillsInfo } = (0, SettingsContext_1.useSettings)();
|
|
173
|
+
const { error, info, knownBugs } = (0, UpdateStatusContext_1.useUpdateStatus)();
|
|
174
|
+
const [releaseNotes, setReleaseNotes] = (0, react_1.useState)(null);
|
|
175
|
+
(0, react_1.useEffect)(() => {
|
|
176
|
+
if (!(info === null || info === void 0 ? void 0 : info.updateAvailable)) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const controller = new AbortController();
|
|
180
|
+
(0, actions_1.getReleaseNotes)(info.currentVersion, info.latestVersion, controller.signal)
|
|
181
|
+
.then((response) => {
|
|
182
|
+
setReleaseNotes({
|
|
183
|
+
...response,
|
|
184
|
+
currentVersion: info.currentVersion,
|
|
185
|
+
latestVersion: info.latestVersion,
|
|
186
|
+
});
|
|
187
|
+
})
|
|
188
|
+
.catch(() => {
|
|
189
|
+
if (!controller.signal.aborted) {
|
|
190
|
+
setReleaseNotes({
|
|
191
|
+
currentVersion: info.currentVersion,
|
|
192
|
+
hasMore: false,
|
|
193
|
+
latestVersion: info.latestVersion,
|
|
194
|
+
releases: [],
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
return () => controller.abort();
|
|
199
|
+
}, [info]);
|
|
200
|
+
const hasKnownBugs = (0, react_1.useMemo)(() => {
|
|
201
|
+
var _a;
|
|
202
|
+
return ((_a = knownBugs === null || knownBugs === void 0 ? void 0 : knownBugs.length) !== null && _a !== void 0 ? _a : 0) > 0;
|
|
203
|
+
}, [knownBugs]);
|
|
204
|
+
const updateAction = info
|
|
205
|
+
? (remotionSkillsInfo === null || remotionSkillsInfo === void 0 ? void 0 : remotionSkillsInfo.remotionUpgradeSkillAvailable)
|
|
206
|
+
? remotionUpgradeSkill
|
|
207
|
+
: info.updateAvailable
|
|
208
|
+
? commands[info.packageManager]
|
|
209
|
+
: skillsUpdateCommand
|
|
210
|
+
: null;
|
|
211
|
+
const updateActionType = (remotionSkillsInfo === null || remotionSkillsInfo === void 0 ? void 0 : remotionSkillsInfo.remotionUpgradeSkillAvailable)
|
|
212
|
+
? 'skill'
|
|
213
|
+
: 'command';
|
|
214
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
215
|
+
if (updateAction === null) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
(0, copy_text_1.copyText)(updateAction).catch((err) => {
|
|
219
|
+
(0, NotificationCenter_1.showNotification)('Could not copy: ' + err.message, 2000);
|
|
220
|
+
});
|
|
221
|
+
}, [updateAction]);
|
|
222
|
+
const renderCopyAction = (0, react_1.useCallback)((color) => {
|
|
223
|
+
return jsx_runtime_1.jsx(clipboard_1.ClipboardIcon, { color: color, style: copyIcon });
|
|
224
|
+
}, []);
|
|
225
|
+
if (info === null) {
|
|
226
|
+
return (jsx_runtime_1.jsx("div", { style: container, children: error ? (jsx_runtime_1.jsx("div", { style: { paddingTop: 12 }, children: jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: 'Could not check for updates: ' + error, align: "flex-start", type: "error" }) })) : (jsx_runtime_1.jsx("div", { style: title, children: "Checking for updates..." })) }));
|
|
227
|
+
}
|
|
228
|
+
if (info.timedOut && !info.skillsUpdateAvailable) {
|
|
229
|
+
return (jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
230
|
+
jsx_runtime_1.jsx("div", { style: title, children: "Could not check for updates." }), jsx_runtime_1.jsx("div", { style: text, children: "The update check timed out. Try again later." })
|
|
231
|
+
] }));
|
|
232
|
+
}
|
|
233
|
+
if (!info.updateAvailable && !info.skillsUpdateAvailable) {
|
|
234
|
+
return (jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
235
|
+
jsx_runtime_1.jsxs("div", { style: title, children: ["You", "'re", " up to date."] }), jsx_runtime_1.jsxs("div", { style: text, children: ["Remotion ", info.currentVersion, " and your Remotion Agent Skills are up to date."] })
|
|
236
|
+
] }));
|
|
237
|
+
}
|
|
238
|
+
return (jsx_runtime_1.jsxs("div", { style: container, children: [hasKnownBugs && info.updateAvailable ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
239
|
+
jsx_runtime_1.jsxs("div", { style: title, children: ["The currently installed version ", info.currentVersion, " has the following known bugs:"] }), jsx_runtime_1.jsx(KnownBugs_1.KnownBugs, { bugs: knownBugs !== null && knownBugs !== void 0 ? knownBugs : [] }), jsx_runtime_1.jsx("div", { style: { height: '20px' } }), jsx_runtime_1.jsxs("div", { style: text, children: ["To update, run the following ", updateActionType, ":"] })
|
|
240
|
+
] })) : info.updateAvailable ? (jsx_runtime_1.jsxs("div", { style: titleBeforeCommand, children: ["A new Remotion update is available. Run the following", ' ', updateActionType, ":"] })) : (jsx_runtime_1.jsxs("div", { style: titleBeforeCommand, children: ["Your Remotion Agent Skills are out of date. Run the following", ' ', updateActionType, ":"] })), jsx_runtime_1.jsxs("div", { style: commandField, children: [
|
|
241
|
+
jsx_runtime_1.jsx("pre", { style: code, children: updateAction }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, onClick: onClick, renderAction: renderCopyAction, title: "Copy command" })
|
|
242
|
+
] }), info.updateAvailable ? (jsx_runtime_1.jsxs("div", { style: text, children: ["This will update Remotion from ", info.currentVersion, " to", ' ', info.latestVersion, info.skillsUpdateAvailable
|
|
243
|
+
? ' and update your project Remotion Agent Skills.'
|
|
244
|
+
: '.'] })) : null, info.updateAvailable ? ((releaseNotes === null || releaseNotes === void 0 ? void 0 : releaseNotes.currentVersion) === info.currentVersion &&
|
|
245
|
+
releaseNotes.latestVersion === info.latestVersion ? (releaseNotes.releases.length === 0 ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
246
|
+
jsx_runtime_1.jsx("div", { style: releaseNotesTitle, children: info.latestVersion }), jsx_runtime_1.jsxs("div", { style: text, children: ["Release notes could not be loaded.", ' ', jsx_runtime_1.jsx("a", { style: link, target: "_blank", href: "https://github.com/remotion-dev/remotion/releases", children: "View them on GitHub" }),
|
|
247
|
+
"."] })
|
|
248
|
+
] })) : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [releaseNotes.releases.map((release) => (jsx_runtime_1.jsx(RenderedReleaseNotes, { release: release }, release.version))), releaseNotes.hasMore ? (jsx_runtime_1.jsxs("div", { style: { ...text, paddingTop: 12 }, children: ["Showing the 5 most recent releases.", ' ', jsx_runtime_1.jsx("a", { style: link, target: "_blank", href: "https://github.com/remotion-dev/remotion/releases", children: "View all releases on GitHub" }),
|
|
249
|
+
"."] })) : null] }))) : (jsx_runtime_1.jsx("div", { style: text, children: "Loading release notes..." }))) : null] }));
|
|
250
|
+
};
|
|
251
|
+
exports.UpdatesSettings = UpdatesSettings;
|