@remotion/studio 4.0.466 → 4.0.467

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 (28) hide show
  1. package/dist/components/CurrentAsset.js +8 -54
  2. package/dist/components/NewComposition/ValidationMessage.d.ts +1 -0
  3. package/dist/components/NewComposition/ValidationMessage.js +3 -3
  4. package/dist/components/RenderModal/DataEditor.js +8 -2
  5. package/dist/components/RenderModal/get-render-modal-warnings.d.ts +7 -1
  6. package/dist/components/RenderModal/get-render-modal-warnings.js +21 -7
  7. package/dist/components/Timeline/TimelineExpandedSection.js +9 -2
  8. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +1 -0
  9. package/dist/components/Timeline/TimelineListItem.js +21 -3
  10. package/dist/components/Timeline/TimelineMediaInfo.d.ts +5 -0
  11. package/dist/components/Timeline/TimelineMediaInfo.js +173 -0
  12. package/dist/components/Timeline/TimelineVideoInfo.js +2 -2
  13. package/dist/esm/chunk-5gtx3pza.js +9 -0
  14. package/dist/esm/{chunk-sa3dm85y.js → chunk-vwnse6c9.js} +2438 -2125
  15. package/dist/esm/index.mjs +0 -16
  16. package/dist/esm/internals.mjs +2436 -2138
  17. package/dist/esm/previewEntry.mjs +2444 -2146
  18. package/dist/esm/renderEntry.mjs +3 -4
  19. package/dist/helpers/format-media-duration.d.ts +1 -0
  20. package/dist/helpers/format-media-duration.js +14 -0
  21. package/dist/helpers/get-timeline-sequence-layout.js +4 -3
  22. package/dist/helpers/timeline-layout.d.ts +10 -6
  23. package/dist/helpers/timeline-layout.js +22 -7
  24. package/dist/helpers/use-max-media-duration.js +25 -28
  25. package/dist/helpers/use-media-metadata.d.ts +10 -0
  26. package/dist/helpers/use-media-metadata.js +135 -0
  27. package/package.json +10 -10
  28. package/dist/esm/chunk-6jf1natv.js +0 -25
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CurrentAsset = exports.CURRENT_ASSET_HEIGHT = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const studio_shared_1 = require("@remotion/studio-shared");
6
- const mediabunny_1 = require("mediabunny");
7
6
  const react_1 = require("react");
8
7
  const remotion_1 = require("remotion");
9
8
  const colors_1 = require("../helpers/colors");
10
- const get_duration_or_compute_1 = require("../helpers/get-duration-or-compute");
9
+ const format_media_duration_1 = require("../helpers/format-media-duration");
10
+ const use_media_metadata_1 = require("../helpers/use-media-metadata");
11
11
  const use_static_files_1 = require("./use-static-files");
12
12
  exports.CURRENT_ASSET_HEIGHT = 80;
13
13
  const container = {
@@ -38,16 +38,6 @@ const row = {
38
38
  lineHeight: '18px',
39
39
  backgroundColor: colors_1.BACKGROUND,
40
40
  };
41
- const formatDuration = (seconds) => {
42
- const h = Math.floor(seconds / 3600);
43
- const m = Math.floor((seconds % 3600) / 60);
44
- const s = seconds % 60;
45
- const sFixed = s.toFixed(2).padStart(5, '0');
46
- if (h > 0) {
47
- return `${h}:${String(m).padStart(2, '0')}:${sFixed}`;
48
- }
49
- return `${String(m).padStart(2, '0')}:${sFixed}`;
50
- };
51
41
  const CurrentAsset = () => {
52
42
  var _a;
53
43
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
@@ -61,46 +51,8 @@ const CurrentAsset = () => {
61
51
  const file = staticFiles.find((f) => f.name === assetName);
62
52
  return (_a = file === null || file === void 0 ? void 0 : file.sizeInBytes) !== null && _a !== void 0 ? _a : null;
63
53
  }, [assetName, staticFiles]);
64
- const [mediaMetadata, setMediaMetadata] = (0, react_1.useState)(null);
65
- (0, react_1.useEffect)(() => {
66
- setMediaMetadata(null);
67
- if (!assetName) {
68
- return;
69
- }
70
- const url = (0, remotion_1.staticFile)(assetName);
71
- const input = new mediabunny_1.Input({
72
- formats: mediabunny_1.ALL_FORMATS,
73
- source: new mediabunny_1.UrlSource(url),
74
- });
75
- Promise.all([
76
- (0, get_duration_or_compute_1.getDurationOrCompute)(input),
77
- input.getFormat(),
78
- input.getPrimaryVideoTrack(),
79
- ])
80
- .then(async ([duration, format, videoTrack]) => {
81
- if (videoTrack && (await videoTrack.isLive())) {
82
- throw new Error('Live streams are not currently supported by Remotion. Sorry! Source: ' +
83
- url);
84
- }
85
- if (videoTrack && (await videoTrack.isRelativeToUnixEpoch())) {
86
- throw new Error('Streams with UNIX timestamps are not currently supported by Remotion. Sorry! Source: ' +
87
- url);
88
- }
89
- setMediaMetadata({
90
- duration,
91
- format: format.name,
92
- width: videoTrack ? await videoTrack.getDisplayWidth() : null,
93
- height: videoTrack ? await videoTrack.getDisplayHeight() : null,
94
- });
95
- })
96
- .catch(() => {
97
- // InputDisposedError (user navigated away) and
98
- // non-media files (e.g. .png, .json) — ignore silently
99
- });
100
- return () => {
101
- input.dispose();
102
- };
103
- }, [assetName]);
54
+ const src = assetName ? (0, remotion_1.staticFile)(assetName) : null;
55
+ const mediaMetadata = (0, use_media_metadata_1.useMediaMetadata)(src);
104
56
  if (!assetName) {
105
57
  return jsx_runtime_1.jsx("div", { style: container });
106
58
  }
@@ -110,12 +62,14 @@ const CurrentAsset = () => {
110
62
  subtitleParts.push((0, studio_shared_1.formatBytes)(sizeInBytes));
111
63
  }
112
64
  if (mediaMetadata) {
113
- subtitleParts.push(mediaMetadata.format);
65
+ if (mediaMetadata.format) {
66
+ subtitleParts.push(mediaMetadata.format);
67
+ }
114
68
  if (mediaMetadata.width !== null && mediaMetadata.height !== null) {
115
69
  subtitleParts.push(`${mediaMetadata.width}x${mediaMetadata.height}`);
116
70
  }
117
71
  }
118
72
  return (jsx_runtime_1.jsx("div", { style: container, children: jsx_runtime_1.jsx("div", { style: row, children: jsx_runtime_1.jsxs("div", { children: [
119
- jsx_runtime_1.jsx("div", { style: title, children: fileName }), subtitleParts.length > 0 ? (jsx_runtime_1.jsx("div", { style: subtitle, children: subtitleParts.join(' · ') })) : null, mediaMetadata ? (jsx_runtime_1.jsx("div", { style: subtitle, children: formatDuration(mediaMetadata.duration) })) : null] }) }) }));
73
+ jsx_runtime_1.jsx("div", { style: title, children: fileName }), subtitleParts.length > 0 ? (jsx_runtime_1.jsx("div", { style: subtitle, children: subtitleParts.join(' · ') })) : null, mediaMetadata ? (jsx_runtime_1.jsx("div", { style: subtitle, children: (0, format_media_duration_1.formatMediaDuration)(mediaMetadata.duration) })) : null] }) }) }));
120
74
  };
121
75
  exports.CurrentAsset = CurrentAsset;
@@ -5,4 +5,5 @@ export declare const ValidationMessage: React.FC<{
5
5
  readonly message: string;
6
6
  readonly align: 'flex-start' | 'flex-end';
7
7
  readonly type: 'warning' | 'error';
8
+ readonly action?: React.ReactNode;
8
9
  }>;
@@ -22,7 +22,7 @@ const label = {
22
22
  color: 'white',
23
23
  fontFamily: 'sans-serif',
24
24
  };
25
- const ValidationMessage = ({ message, align, type }) => {
25
+ const ValidationMessage = ({ message, align, type, action }) => {
26
26
  const finalStyle = (0, react_1.useMemo)(() => {
27
27
  return {
28
28
  ...style,
@@ -30,7 +30,7 @@ const ValidationMessage = ({ message, align, type }) => {
30
30
  };
31
31
  }, [type]);
32
32
  return (jsx_runtime_1.jsx("div", { style: container, children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", justify: align, children: [
33
- jsx_runtime_1.jsx(exports.WarningTriangle, { style: finalStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: message })
34
- ] }) }));
33
+ jsx_runtime_1.jsx(exports.WarningTriangle, { style: finalStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: message }), action ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
34
+ jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), action] })) : null] }) }));
35
35
  };
36
36
  exports.ValidationMessage = ValidationMessage;
@@ -84,6 +84,13 @@ const tabWrapper = {
84
84
  flexDirection: 'row',
85
85
  alignItems: 'center',
86
86
  };
87
+ const resolveLinkStyle = {
88
+ color: colors_1.BLUE,
89
+ fontSize: 13,
90
+ fontFamily: 'sans-serif',
91
+ textDecoration: 'underline',
92
+ whiteSpace: 'nowrap',
93
+ };
87
94
  const persistanceKey = 'remotion.show-render-modalwarning';
88
95
  const getPersistedShowWarningState = () => {
89
96
  const val = localStorage.getItem(persistanceKey);
@@ -222,8 +229,7 @@ const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, prop
222
229
  jsx_runtime_1.jsxs("div", { style: tabWrapper, children: [
223
230
  jsx_runtime_1.jsx(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), jsx_runtime_1.jsx(layout_1.Flex, {}), warnings.length > 0 ? (jsx_runtime_1.jsx(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
224
231
  ? warnings.map((warning) => (jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [
225
- jsx_runtime_1.jsx(layout_1.Spacing, { y: 1 }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: warning, align: "flex-start", type: "warning" })
226
- ] }, warning)))
232
+ jsx_runtime_1.jsx(layout_1.Spacing, { y: 1 }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: warning.message, align: "flex-start", type: "warning", action: warning.resolveLink ? (jsx_runtime_1.jsx("a", { href: warning.resolveLink, target: "_blank", rel: "noopener noreferrer", style: resolveLinkStyle, children: "Resolve" })) : null })] }, warning.id)))
227
233
  : null] }), mode === 'schema' ? (jsx_runtime_1.jsx(SchemaEditor_1.SchemaEditor, { value: defaultProps, setValue: setDefaultProps, schema: schema })) : (jsx_runtime_1.jsx(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: defaultProps !== null && defaultProps !== void 0 ? defaultProps : {}, setValue: jsonEditorSetValue, onSave: onSave, serializedJSON: serializedJSON, defaultProps: unresolvedComposition.defaultProps, schema: schema, compositionId: unresolvedComposition.id }))] }));
228
234
  };
229
235
  exports.DataEditor = DataEditor;
@@ -1,4 +1,10 @@
1
1
  import type { PropsEditType } from './DataEditor';
2
+ export declare const CANNOT_SAVE_DEFAULT_PROPS_DOCS = "https://www.remotion.dev/docs/troubleshooting/cannot-save-default-props";
3
+ export type RenderModalWarning = {
4
+ readonly id: string;
5
+ readonly message: string;
6
+ readonly resolveLink?: string;
7
+ };
2
8
  export type TypeCanSaveState = {
3
9
  canUpdate: true;
4
10
  } | {
@@ -15,4 +21,4 @@ export declare const getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, i
15
21
  jsSetUsed: boolean;
16
22
  inJSONEditor: boolean;
17
23
  propsEditType: PropsEditType;
18
- }) => string[];
24
+ }) => RenderModalWarning[];
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRenderModalWarnings = void 0;
3
+ exports.getRenderModalWarnings = exports.CANNOT_SAVE_DEFAULT_PROPS_DOCS = void 0;
4
4
  const no_react_1 = require("remotion/no-react");
5
+ exports.CANNOT_SAVE_DEFAULT_PROPS_DOCS = 'https://www.remotion.dev/docs/troubleshooting/cannot-save-default-props';
6
+ const warningOrNull = (id, message) => {
7
+ if (message === null) {
8
+ return null;
9
+ }
10
+ return {
11
+ id,
12
+ message,
13
+ };
14
+ };
5
15
  const getInputPropsWarning = ({ cliProps, propsEditType, }) => {
6
16
  if (Object.keys(cliProps).length > 0 &&
7
17
  propsEditType === 'default-props') {
@@ -19,7 +29,11 @@ const getCannotSaveDefaultProps = (canSaveDefaultProps) => {
19
29
  if (!canSaveDefaultProps.determined) {
20
30
  return null;
21
31
  }
22
- return `Can't save default props: ${canSaveDefaultProps.reason}.`;
32
+ return {
33
+ id: 'cannot-save-default-props',
34
+ message: `Can't save default props: ${canSaveDefaultProps.reason}.`,
35
+ resolveLink: exports.CANNOT_SAVE_DEFAULT_PROPS_DOCS,
36
+ };
23
37
  };
24
38
  const customDateUsed = (used, inJSONEditor) => {
25
39
  if (used && inJSONEditor) {
@@ -47,12 +61,12 @@ const setUsed = (used, inJSONEditor) => {
47
61
  };
48
62
  const getRenderModalWarnings = ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, }) => {
49
63
  return [
50
- getInputPropsWarning({ cliProps, propsEditType }),
64
+ warningOrNull('input-props-override', getInputPropsWarning({ cliProps, propsEditType })),
51
65
  getCannotSaveDefaultProps(canSaveDefaultProps),
52
- customDateUsed(isCustomDateUsed, inJSONEditor),
53
- staticFileUsed(customFileUsed, inJSONEditor),
54
- mapUsed(jsMapUsed, inJSONEditor),
55
- setUsed(jsSetUsed, inJSONEditor),
66
+ warningOrNull('custom-date-used', customDateUsed(isCustomDateUsed, inJSONEditor)),
67
+ warningOrNull('static-file-used', staticFileUsed(customFileUsed, inJSONEditor)),
68
+ warningOrNull('map-used', mapUsed(jsMapUsed, inJSONEditor)),
69
+ warningOrNull('set-used', setUsed(jsSetUsed, inJSONEditor)),
56
70
  ].filter(no_react_1.NoReactInternals.truthy);
57
71
  };
58
72
  exports.getRenderModalWarnings = getRenderModalWarnings;
@@ -57,13 +57,20 @@ const TimelineExpandedSection = ({ sequence, validatedLocation, nodePathInfo, ne
57
57
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
58
58
  const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
59
59
  const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
60
- const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
60
+ const { getDragOverrides, getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
61
61
  const tree = (0, react_1.useMemo)(() => (0, timeline_layout_1.buildTimelineTree)({
62
62
  sequence,
63
63
  nodePathInfo,
64
64
  getDragOverrides,
65
+ getEffectDragOverrides,
65
66
  codeValues: visualModeCodeValues,
66
- }), [sequence, nodePathInfo, getDragOverrides, visualModeCodeValues]);
67
+ }), [
68
+ sequence,
69
+ nodePathInfo,
70
+ getDragOverrides,
71
+ getEffectDragOverrides,
72
+ visualModeCodeValues,
73
+ ]);
67
74
  const flat = (0, react_1.useMemo)(() => (0, timeline_layout_1.flattenVisibleTreeNodes)({ nodes: tree, getIsExpanded }), [tree, getIsExpanded]);
68
75
  const expandedHeight = (0, react_1.useMemo)(() => (0, timeline_layout_1.getExpandedTrackHeight)({
69
76
  sequence,
@@ -88,6 +88,7 @@ const TimelineExpandedTrackKeyframesInner = ({ nodePathInfo, sequence }) => {
88
88
  sequence,
89
89
  nodePathInfo,
90
90
  getDragOverrides: () => ({}),
91
+ getEffectDragOverrides: () => ({}),
91
92
  codeValues,
92
93
  }), [codeValues, nodePathInfo, sequence]);
93
94
  const flat = (0, react_1.useMemo)(() => (0, timeline_layout_1.flattenVisibleTreeNodes)({ nodes: tree, getIsExpanded }), [tree, getIsExpanded]);
@@ -12,9 +12,11 @@ const ContextMenu_1 = require("../ContextMenu");
12
12
  const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
13
13
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
14
14
  const save_sequence_prop_1 = require("./save-sequence-prop");
15
+ const timeline_row_layout_1 = require("./timeline-row-layout");
15
16
  const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
16
17
  const TimelineExpandedSection_1 = require("./TimelineExpandedSection");
17
18
  const TimelineLayerEye_1 = require("./TimelineLayerEye");
19
+ const TimelineMediaInfo_1 = require("./TimelineMediaInfo");
18
20
  const TimelineRowChrome_1 = require("./TimelineRowChrome");
19
21
  const TimelineStack_1 = require("./TimelineStack");
20
22
  const use_resolved_stack_react_to_change_1 = require("./use-resolved-stack-react-to-change");
@@ -211,18 +213,34 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
211
213
  return {
212
214
  height: (0, timeline_layout_1.getTimelineLayerHeight)(sequence.type) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
213
215
  borderBottom: `1px solid ${colors_1.TIMELINE_TRACK_SEPARATOR}`,
216
+ display: 'flex',
217
+ flexDirection: 'column',
214
218
  };
215
219
  }, [sequence.type]);
216
220
  const inner = (0, react_1.useMemo)(() => {
217
221
  return {
218
- // TODO: Not so small
219
- height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO,
222
+ height: timeline_layout_1.TIMELINE_LIST_ITEM_ROW_HEIGHT,
220
223
  color: 'white',
221
224
  fontFamily: 'Arial, Helvetica, sans-serif',
222
225
  wordBreak: 'break-all',
223
226
  textAlign: 'left',
227
+ flexShrink: 0,
224
228
  };
225
229
  }, []);
230
+ const mediaInfoStyle = (0, react_1.useMemo)(() => {
231
+ return {
232
+ paddingLeft: (0, timeline_row_layout_1.getTimelineRowLeftChromeWidth)(nestedDepth),
233
+ paddingRight: 8,
234
+ marginTop: -6,
235
+ overflow: 'hidden',
236
+ minHeight: 0,
237
+ };
238
+ }, [nestedDepth]);
239
+ const mediaSrc = sequence.type === 'audio' ||
240
+ sequence.type === 'video' ||
241
+ sequence.type === 'image'
242
+ ? sequence.src
243
+ : null;
226
244
  const hasExpandableContent = Boolean(sequence.controls) || sequence.effects.length > 0;
227
245
  const canToggleVisibility = previewConnected &&
228
246
  Boolean(sequence.controls) &&
@@ -231,7 +249,7 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
231
249
  codeHiddenStatus !== undefined &&
232
250
  codeHiddenStatus !== null &&
233
251
  codeHiddenStatus.canUpdate;
234
- const trackRow = (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: nestedDepth, eye: canToggleVisibility ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: hasExpandableContent ? (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: onToggleExpand, label: "track properties", disabled: !previewConnected || nodePathInfo === null })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: inner, children: jsx_runtime_1.jsx(TimelineStack_1.TimelineStack, { sequence: sequence, isCompact: isCompact, originalLocation: originalLocation }) }) }));
252
+ const trackRow = (jsx_runtime_1.jsxs("div", { style: outer, children: [jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: nestedDepth, eye: canToggleVisibility ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: hasExpandableContent ? (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: onToggleExpand, label: "track properties", disabled: !previewConnected || nodePathInfo === null })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: inner, children: jsx_runtime_1.jsx(TimelineStack_1.TimelineStack, { sequence: sequence, isCompact: isCompact, originalLocation: originalLocation }) }), mediaSrc ? (jsx_runtime_1.jsx("div", { style: mediaInfoStyle, children: jsx_runtime_1.jsx(TimelineMediaInfo_1.TimelineMediaInfo, { src: mediaSrc, type: sequence.type }) })) : null] }));
235
253
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, children: trackRow })) : (trackRow), previewConnected &&
236
254
  isExpanded &&
237
255
  hasExpandableContent &&
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const TimelineMediaInfo: React.FC<{
3
+ readonly src: string;
4
+ readonly type: 'audio' | 'video' | 'image';
5
+ }>;
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TimelineMediaInfo = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const media_utils_1 = require("@remotion/media-utils");
39
+ const react_1 = __importStar(require("react"));
40
+ const remotion_1 = require("remotion");
41
+ const colors_1 = require("../../helpers/colors");
42
+ const format_media_duration_1 = require("../../helpers/format-media-duration");
43
+ const url_state_1 = require("../../helpers/url-state");
44
+ const use_media_metadata_1 = require("../../helpers/use-media-metadata");
45
+ const containerStyle = {
46
+ fontFamily: 'Arial, Helvetica, sans-serif',
47
+ fontSize: 12,
48
+ lineHeight: 1,
49
+ overflow: 'hidden',
50
+ whiteSpace: 'nowrap',
51
+ textOverflow: 'ellipsis',
52
+ minWidth: 0,
53
+ marginTop: 2,
54
+ };
55
+ const lineStyle = {
56
+ whiteSpace: 'nowrap',
57
+ overflow: 'hidden',
58
+ textOverflow: 'ellipsis',
59
+ minWidth: 0,
60
+ fontSize: 12,
61
+ color: colors_1.VERY_LIGHT_TEXT,
62
+ lineHeight: 1.3,
63
+ };
64
+ const getLinkInfo = (src) => {
65
+ const staticBase = typeof window === 'undefined' ? null : window.remotion_staticBase;
66
+ if (staticBase && src.startsWith(staticBase + '/')) {
67
+ const assetPath = src.slice(staticBase.length + 1);
68
+ return {
69
+ kind: 'local',
70
+ assetPath: decodeURIComponent(assetPath),
71
+ title: decodeURIComponent(assetPath),
72
+ };
73
+ }
74
+ if (src.startsWith('http://') ||
75
+ src.startsWith('https://') ||
76
+ src.startsWith('//')) {
77
+ try {
78
+ const url = new URL(src.startsWith('//') ? 'https:' + src : src);
79
+ return { kind: 'remote', href: src, title: url.hostname };
80
+ }
81
+ catch (_a) {
82
+ return { kind: 'remote', href: src, title: src };
83
+ }
84
+ }
85
+ return null;
86
+ };
87
+ const useAssetLink = (src) => {
88
+ const { setCanvasContent } = react_1.default.useContext(remotion_1.Internals.CompositionSetters);
89
+ const [hovered, setHovered] = (0, react_1.useState)(false);
90
+ const linkInfo = (0, react_1.useMemo)(() => getLinkInfo(src), [src]);
91
+ const onClick = (0, react_1.useCallback)((e) => {
92
+ if (!linkInfo) {
93
+ return;
94
+ }
95
+ e.preventDefault();
96
+ e.stopPropagation();
97
+ if (linkInfo.kind === 'local') {
98
+ setCanvasContent({ type: 'asset', asset: linkInfo.assetPath });
99
+ (0, url_state_1.pushUrl)(`/assets/${linkInfo.assetPath}`);
100
+ return;
101
+ }
102
+ window.open(linkInfo.href, '_blank', 'noopener,noreferrer');
103
+ }, [linkInfo, setCanvasContent]);
104
+ const onPointerEnter = (0, react_1.useCallback)(() => setHovered(true), []);
105
+ const onPointerLeave = (0, react_1.useCallback)(() => setHovered(false), []);
106
+ const fileNameStyle = (0, react_1.useMemo)(() => ({
107
+ ...lineStyle,
108
+ color: linkInfo && hovered ? colors_1.LIGHT_TEXT : colors_1.VERY_LIGHT_TEXT,
109
+ cursor: linkInfo ? 'pointer' : undefined,
110
+ textDecoration: 'none',
111
+ display: 'inline-block',
112
+ overflow: 'hidden',
113
+ whiteSpace: 'pre',
114
+ textOverflow: 'ellipsis',
115
+ }), [linkInfo, hovered]);
116
+ return { linkInfo, onClick, onPointerEnter, onPointerLeave, fileNameStyle };
117
+ };
118
+ const TimelineMediaInfo = ({ src, type }) => {
119
+ // Images aren't supported by mediabunny, so don't even try.
120
+ const metadata = (0, use_media_metadata_1.useMediaMetadata)(type === 'image' ? null : src);
121
+ const fileName = (0, react_1.useMemo)(() => remotion_1.Internals.getAssetDisplayName(src), [src]);
122
+ const { linkInfo, onClick, onPointerEnter, onPointerLeave, fileNameStyle } = useAssetLink(src);
123
+ const [imageDimensions, setImageDimensions] = (0, react_1.useState)(null);
124
+ (0, react_1.useEffect)(() => {
125
+ if (type !== 'image') {
126
+ return;
127
+ }
128
+ let cancelled = false;
129
+ setImageDimensions(null);
130
+ (0, media_utils_1.getImageDimensions)(src)
131
+ .then((dims) => {
132
+ if (cancelled) {
133
+ return;
134
+ }
135
+ setImageDimensions({ width: dims.width, height: dims.height });
136
+ })
137
+ .catch(() => {
138
+ // Non-image or load failure — ignore silently.
139
+ });
140
+ return () => {
141
+ cancelled = true;
142
+ };
143
+ }, [src, type]);
144
+ const detailsLine = (0, react_1.useMemo)(() => {
145
+ if (type === 'image') {
146
+ if (!imageDimensions) {
147
+ return null;
148
+ }
149
+ return `${imageDimensions.width}x${imageDimensions.height}`;
150
+ }
151
+ if (!metadata) {
152
+ return null;
153
+ }
154
+ const parts = [];
155
+ if (metadata.format) {
156
+ parts.push(metadata.format);
157
+ }
158
+ if (type === 'video' && metadata.videoCodec) {
159
+ parts.push(metadata.videoCodec);
160
+ }
161
+ if (metadata.audioCodec) {
162
+ parts.push(metadata.audioCodec);
163
+ }
164
+ if (metadata.width !== null && metadata.height !== null) {
165
+ parts.push(`${metadata.width}x${metadata.height}`);
166
+ }
167
+ parts.push((0, format_media_duration_1.formatMediaDuration)(metadata.duration));
168
+ return parts.join(' · ');
169
+ }, [imageDimensions, metadata, type]);
170
+ return (jsx_runtime_1.jsxs("div", { style: containerStyle, children: [
171
+ jsx_runtime_1.jsx("div", { style: fileNameStyle, title: linkInfo ? linkInfo.title : fileName, onClick: linkInfo ? onClick : undefined, onPointerEnter: linkInfo ? onPointerEnter : undefined, onPointerLeave: linkInfo ? onPointerLeave : undefined, children: fileName }), detailsLine ? (jsx_runtime_1.jsx("div", { style: lineStyle, title: detailsLine, children: detailsLine })) : null] }));
172
+ };
173
+ exports.TimelineMediaInfo = TimelineMediaInfo;
@@ -8,7 +8,7 @@ const remotion_1 = require("remotion");
8
8
  const timeline_layout_1 = require("../../helpers/timeline-layout");
9
9
  const AudioWaveform_1 = require("../AudioWaveform");
10
10
  const get_timeline_video_info_widths_1 = require("./get-timeline-video-info-widths");
11
- const FILMSTRIP_HEIGHT = timeline_layout_1.TIMELINE_LAYER_HEIGHT_IMAGE - 2;
11
+ const FILMSTRIP_HEIGHT = 48;
12
12
  const outerStyle = {
13
13
  width: '100%',
14
14
  height: '100%',
@@ -233,7 +233,7 @@ const TimelineVideoInfo = ({ src, visualizationWidth, naturalWidth, trimBefore,
233
233
  }, [mediaVisualizationWidth, premountWidth]);
234
234
  const audioStyle = (0, react_1.useMemo)(() => {
235
235
  return {
236
- height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO,
236
+ height: timeline_layout_1.TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT,
237
237
  width: audioWidth,
238
238
  position: 'relative',
239
239
  marginLeft: premountWidth,
@@ -0,0 +1,9 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ export { __require };