@remotion/studio 4.0.443 → 4.0.445

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.
Files changed (39) hide show
  1. package/dist/components/Canvas.js +197 -42
  2. package/dist/components/CanvasOrLoading.js +5 -0
  3. package/dist/components/Editor.js +10 -2
  4. package/dist/components/RenderErrorContext.d.ts +4 -0
  5. package/dist/components/RenderErrorContext.js +7 -0
  6. package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +7 -5
  7. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +5 -1
  8. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +5 -3
  9. package/dist/components/Timeline/Timeline.js +8 -5
  10. package/dist/components/Timeline/TimelineListItem.js +71 -8
  11. package/dist/components/Timeline/TimelinePinchZoom.d.ts +2 -0
  12. package/dist/components/Timeline/TimelinePinchZoom.js +240 -0
  13. package/dist/components/Timeline/TimelineSlider.js +22 -8
  14. package/dist/components/Timeline/TimelineVideoInfo.js +1 -18
  15. package/dist/components/Timeline/TimelineZoomControls.js +6 -3
  16. package/dist/components/Timeline/timeline-scroll-logic.d.ts +13 -1
  17. package/dist/components/Timeline/timeline-scroll-logic.js +20 -6
  18. package/dist/components/Timeline/use-sequence-props-subscription.d.ts +1 -1
  19. package/dist/components/Timeline/use-sequence-props-subscription.js +25 -6
  20. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +1 -5
  21. package/dist/error-overlay/remotion-overlay/CopyStackTrace.d.ts +5 -0
  22. package/dist/error-overlay/remotion-overlay/CopyStackTrace.js +50 -0
  23. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +16 -13
  24. package/dist/error-overlay/remotion-overlay/MediaPlaybackErrorExplainer.d.ts +4 -0
  25. package/dist/error-overlay/remotion-overlay/MediaPlaybackErrorExplainer.js +87 -0
  26. package/dist/esm/{chunk-cpv44d93.js → chunk-bqd9dhnk.js} +3532 -2899
  27. package/dist/esm/internals.mjs +3532 -2899
  28. package/dist/esm/previewEntry.mjs +3727 -3098
  29. package/dist/esm/renderEntry.mjs +1 -1
  30. package/dist/helpers/frame-database.d.ts +2 -2
  31. package/dist/helpers/frame-database.js +36 -25
  32. package/dist/helpers/get-effective-translation.d.ts +13 -1
  33. package/dist/helpers/get-effective-translation.js +45 -1
  34. package/dist/helpers/use-max-media-duration.js +1 -1
  35. package/dist/state/timeline-zoom.d.ts +5 -1
  36. package/dist/state/timeline-zoom.js +21 -16
  37. package/package.json +9 -9
  38. package/dist/error-overlay/remotion-overlay/CompositionIdsDropdown.d.ts +0 -5
  39. package/dist/error-overlay/remotion-overlay/CompositionIdsDropdown.js +0 -108
@@ -4,15 +4,16 @@ exports.ErrorDisplay = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const studio_shared_1 = require("@remotion/studio-shared");
6
6
  const react_1 = require("react");
7
+ const remotion_1 = require("remotion");
7
8
  const layout_1 = require("../../components/layout");
8
9
  const is_menu_item_1 = require("../../components/Menu/is-menu-item");
9
- const url_state_1 = require("../../helpers/url-state");
10
10
  const AskOnDiscord_1 = require("./AskOnDiscord");
11
11
  const CalculateMetadataErrorExplainer_1 = require("./CalculateMetadataErrorExplainer");
12
- const CompositionIdsDropdown_1 = require("./CompositionIdsDropdown");
12
+ const CopyStackTrace_1 = require("./CopyStackTrace");
13
13
  const ErrorTitle_1 = require("./ErrorTitle");
14
14
  const get_help_link_1 = require("./get-help-link");
15
15
  const HelpLink_1 = require("./HelpLink");
16
+ const MediaPlaybackErrorExplainer_1 = require("./MediaPlaybackErrorExplainer");
16
17
  const OpenInEditor_1 = require("./OpenInEditor");
17
18
  const Retry_1 = require("./Retry");
18
19
  const SearchGitHubIssues_1 = require("./SearchGitHubIssues");
@@ -27,8 +28,6 @@ const spacer = {
27
28
  display: 'inline-block',
28
29
  };
29
30
  const ErrorDisplay = ({ display, keyboardShortcuts, onRetry, canHaveDismissButton, calculateMetadata, }) => {
30
- var _a;
31
- const compositionIds = (_a = window === null || window === void 0 ? void 0 : window.remotion_seenCompositionIds) !== null && _a !== void 0 ? _a : [];
32
31
  const highestLineNumber = Math.max(...display.stackFrames
33
32
  .map((s) => s.originalScriptCode)
34
33
  .flat(1)
@@ -50,23 +49,27 @@ const ErrorDisplay = ({ display, keyboardShortcuts, onRetry, canHaveDismissButto
50
49
  }, [display.error]);
51
50
  const lineNumberWidth = String(highestLineNumber).length;
52
51
  const helpLink = (0, get_help_link_1.getHelpLink)(message);
53
- const getCurrentCompositionId = () => {
54
- var _a;
55
- const route = (0, url_state_1.getRoute)();
56
- const id = route.startsWith('/') ? route.slice(1) : route;
57
- return compositionIds.includes(id) ? id : ((_a = compositionIds[0]) !== null && _a !== void 0 ? _a : null);
58
- };
52
+ const errorTextForCopy = (0, react_1.useMemo)(() => {
53
+ const header = `${display.error.name}: ${message}`;
54
+ if (display.stackFrames.length > 0) {
55
+ const stackLines = display.stackFrames
56
+ .map((frame) => `at ${frame.originalFunctionName || '<anonymous>'} (${frame.originalFileName || 'unknown'}:${frame.originalLineNumber || '?'}:${frame.originalColumnNumber || '?'})`)
57
+ .join('\n');
58
+ return `${header}\n${stackLines}`;
59
+ }
60
+ return display.error.stack || header;
61
+ }, [display.stackFrames, display.error, message]);
59
62
  return (jsx_runtime_1.jsxs("div", { children: [
60
63
  jsx_runtime_1.jsx(ErrorTitle_1.ErrorTitle, { symbolicating: false, name: display.error.name, message: message, canHaveDismissButton: canHaveDismissButton }), helpLink ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
61
64
  jsx_runtime_1.jsx(HelpLink_1.HelpLink, { link: helpLink, canHaveKeyboardShortcuts: keyboardShortcuts }), jsx_runtime_1.jsx("div", { style: spacer })
62
65
  ] })) : null, display.stackFrames.length > 0 && window.remotion_editorName ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
63
66
  jsx_runtime_1.jsx(OpenInEditor_1.OpenInEditor, { canHaveKeyboardShortcuts: keyboardShortcuts, stack: display.stackFrames[0] }), jsx_runtime_1.jsx("div", { style: spacer })
64
- ] })) : null, compositionIds.length > 0 ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
65
- jsx_runtime_1.jsx(CompositionIdsDropdown_1.CompositionIdsDropdown, { compositionIds: compositionIds, currentId: getCurrentCompositionId() }), jsx_runtime_1.jsx("div", { style: spacer })
66
- ] })) : null, jsx_runtime_1.jsx(SearchGitHubIssues_1.SearchGithubIssues, { canHaveKeyboardShortcuts: keyboardShortcuts, message: display.error.message }), jsx_runtime_1.jsx("div", { style: spacer }), jsx_runtime_1.jsx(AskOnDiscord_1.AskOnDiscord, { canHaveKeyboardShortcuts: keyboardShortcuts }), onRetry ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
67
+ ] })) : null, jsx_runtime_1.jsx(CopyStackTrace_1.CopyStackTrace, { canHaveKeyboardShortcuts: keyboardShortcuts, errorText: errorTextForCopy }), jsx_runtime_1.jsx("div", { style: spacer }), jsx_runtime_1.jsx(SearchGitHubIssues_1.SearchGithubIssues, { canHaveKeyboardShortcuts: keyboardShortcuts, message: display.error.message }), jsx_runtime_1.jsx("div", { style: spacer }), jsx_runtime_1.jsx(AskOnDiscord_1.AskOnDiscord, { canHaveKeyboardShortcuts: keyboardShortcuts }), onRetry ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
67
68
  jsx_runtime_1.jsx("div", { style: spacer }), jsx_runtime_1.jsx(Retry_1.RetryButton, { onClick: onRetry })
68
69
  ] })) : null, calculateMetadata ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
69
70
  jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx(layout_1.Spacing, { y: 0.5 }), jsx_runtime_1.jsx(CalculateMetadataErrorExplainer_1.CalculateMetadataErrorExplainer, {})
71
+ ] })) : null, display.error instanceof remotion_1.MediaPlaybackError ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
72
+ jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx(layout_1.Spacing, { y: 0.5 }), jsx_runtime_1.jsx(MediaPlaybackErrorExplainer_1.MediaPlaybackErrorExplainer, { src: display.error.src })
70
73
  ] })) : null, jsx_runtime_1.jsx("div", { style: stack, className: is_menu_item_1.HORIZONTAL_SCROLLBAR_CLASSNAME, children: display.stackFrames.map((s, i) => {
71
74
  return (jsx_runtime_1.jsx(StackFrame_1.StackElement
72
75
  // eslint-disable-next-line react/no-array-index-key
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const MediaPlaybackErrorExplainer: React.FC<{
3
+ readonly src: string;
4
+ }>;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MediaPlaybackErrorExplainer = 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 container = {
8
+ borderRadius: 3,
9
+ color: 'white',
10
+ padding: 12,
11
+ backgroundColor: colors_1.BORDER_COLOR,
12
+ fontSize: 14,
13
+ fontFamily: 'sans-serif',
14
+ lineHeight: 1.5,
15
+ };
16
+ const codeStyle = {
17
+ backgroundColor: 'rgba(255,255,255,0.1)',
18
+ padding: '2px 5px',
19
+ borderRadius: 3,
20
+ fontFamily: 'monospace',
21
+ fontSize: 13,
22
+ };
23
+ const linkStyle = {
24
+ color: '#58a6ff',
25
+ };
26
+ const MediaPlaybackErrorExplainer = ({ src }) => {
27
+ const [result, setResult] = (0, react_1.useState)({ type: 'loading' });
28
+ (0, react_1.useEffect)(() => {
29
+ fetch(src, { method: 'HEAD' })
30
+ .then((res) => {
31
+ var _a;
32
+ if (res.status === 404) {
33
+ setResult({ type: 'not-found' });
34
+ }
35
+ else if (!res.ok) {
36
+ setResult({ type: 'other-error', statusCode: res.status });
37
+ }
38
+ else {
39
+ const contentType = (_a = res.headers.get('content-type')) !== null && _a !== void 0 ? _a : '';
40
+ if (contentType.includes('text/html') ||
41
+ contentType.includes('application/json')) {
42
+ setResult({ type: 'wrong-content-type', contentType });
43
+ }
44
+ else {
45
+ setResult({ type: 'ok' });
46
+ }
47
+ }
48
+ })
49
+ .catch(() => {
50
+ setResult({ type: 'fetch-error' });
51
+ });
52
+ }, [src]);
53
+ if (result.type === 'loading') {
54
+ return null;
55
+ }
56
+ if (result.type === 'not-found') {
57
+ return (jsx_runtime_1.jsxs("div", { style: container, children: ["The file ",
58
+ jsx_runtime_1.jsx("code", { style: codeStyle, children: src }),
59
+ " was not found (404).",
60
+ jsx_runtime_1.jsx("br", {}),
61
+ "If the file is in your ",
62
+ jsx_runtime_1.jsx("code", { style: codeStyle, children: "public/" }),
63
+ " folder, make sure to use", ' ', jsx_runtime_1.jsx("a", { style: linkStyle, href: "https://remotion.dev/docs/staticfile", target: "_blank", children: jsx_runtime_1.jsx("code", { style: codeStyle, children: "staticFile()" }) }), ' ', "to reference it.",
64
+ jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx("a", { style: linkStyle, href: "https://remotion.dev/docs/media-playback-error", target: "_blank", children: "Learn more" })
65
+ ] }));
66
+ }
67
+ if (result.type === 'other-error') {
68
+ return (jsx_runtime_1.jsxs("div", { style: container, children: ["\u26A0\uFE0F Fetching ",
69
+ jsx_runtime_1.jsx("code", { style: codeStyle, children: src }),
70
+ " returned status code", ' ', result.statusCode, ".",
71
+ jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx("a", { style: linkStyle, href: "https://remotion.dev/docs/media-playback-error", target: "_blank", children: "Learn more" })
72
+ ] }));
73
+ }
74
+ if (result.type === 'wrong-content-type') {
75
+ return (jsx_runtime_1.jsxs("div", { style: container, children: ["\u26A0\uFE0F Fetching ",
76
+ jsx_runtime_1.jsx("code", { style: codeStyle, children: src }),
77
+ " returned a", ' ', jsx_runtime_1.jsx("code", { style: codeStyle, children: result.contentType }),
78
+ " content type.",
79
+ jsx_runtime_1.jsx("br", {}),
80
+ "\uD83D\uDC49 If the file is in your ",
81
+ jsx_runtime_1.jsx("code", { style: codeStyle, children: "public/" }), ' ', "folder, make sure to use", ' ', jsx_runtime_1.jsx("a", { style: linkStyle, href: "https://remotion.dev/docs/staticfile", target: "_blank", children: jsx_runtime_1.jsx("code", { style: codeStyle, children: "staticFile()" }) }), ' ', "to reference it.",
82
+ jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx("a", { style: linkStyle, href: "https://remotion.dev/docs/media-playback-error", target: "_blank", children: "Learn more" })
83
+ ] }));
84
+ }
85
+ return null;
86
+ };
87
+ exports.MediaPlaybackErrorExplainer = MediaPlaybackErrorExplainer;