@remotion/studio 4.0.467 → 4.0.469

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 (77) hide show
  1. package/dist/components/AudioWaveform.d.ts +1 -0
  2. package/dist/components/AudioWaveform.js +23 -22
  3. package/dist/components/CompositionSelectorItem.js +1 -1
  4. package/dist/components/ContextMenu.d.ts +1 -0
  5. package/dist/components/ContextMenu.js +3 -2
  6. package/dist/components/EditorGuides/Guide.js +1 -1
  7. package/dist/components/ExpandedTracksProvider.js +3 -8
  8. package/dist/components/Menu/MenuItem.js +2 -2
  9. package/dist/components/Menu/MenuSubItem.js +5 -5
  10. package/dist/components/PreviewToolbar.js +2 -4
  11. package/dist/components/Timeline/Timeline.js +14 -13
  12. package/dist/components/Timeline/TimelineDragHandler.js +1 -1
  13. package/dist/components/Timeline/TimelineEffectFieldRow.d.ts +2 -0
  14. package/dist/components/Timeline/TimelineEffectFieldRow.js +9 -14
  15. package/dist/components/Timeline/TimelineEffectGroupRow.js +13 -4
  16. package/dist/components/Timeline/TimelineExpandedKeyframeRow.d.ts +11 -0
  17. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +23 -0
  18. package/dist/components/Timeline/TimelineExpandedRow.js +22 -6
  19. package/dist/components/Timeline/TimelineExpandedSection.js +2 -2
  20. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +2 -1
  21. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +11 -116
  22. package/dist/components/Timeline/TimelineFieldLabel.d.ts +6 -0
  23. package/dist/components/Timeline/TimelineFieldLabel.js +30 -0
  24. package/dist/components/Timeline/TimelineFieldRow.d.ts +3 -2
  25. package/dist/components/Timeline/TimelineFieldRow.js +7 -13
  26. package/dist/components/Timeline/TimelineItemStack.d.ts +5 -0
  27. package/dist/components/Timeline/TimelineItemStack.js +82 -0
  28. package/dist/components/Timeline/TimelineKeyframeDiamond.d.ts +7 -0
  29. package/dist/components/Timeline/TimelineKeyframeDiamond.js +87 -0
  30. package/dist/components/Timeline/TimelineLayerEye.js +1 -0
  31. package/dist/components/Timeline/TimelineList.js +13 -9
  32. package/dist/components/Timeline/TimelineListItem.d.ts +0 -1
  33. package/dist/components/Timeline/TimelineListItem.js +100 -31
  34. package/dist/components/Timeline/TimelineMediaInfo.d.ts +13 -1
  35. package/dist/components/Timeline/TimelineMediaInfo.js +33 -80
  36. package/dist/components/Timeline/TimelineRowChrome.d.ts +8 -1
  37. package/dist/components/Timeline/TimelineRowChrome.js +46 -6
  38. package/dist/components/Timeline/TimelineSchemaField.js +7 -2
  39. package/dist/components/Timeline/TimelineSelection.d.ts +41 -0
  40. package/dist/components/Timeline/TimelineSelection.js +160 -0
  41. package/dist/components/Timeline/TimelineSequence.js +1 -1
  42. package/dist/components/Timeline/TimelineSequenceName.d.ts +7 -0
  43. package/dist/components/Timeline/TimelineSequenceName.js +50 -0
  44. package/dist/components/Timeline/TimelineTrack.d.ts +5 -0
  45. package/dist/components/Timeline/TimelineTrack.js +64 -0
  46. package/dist/components/Timeline/TimelineTracks.js +2 -16
  47. package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +11 -0
  48. package/dist/components/Timeline/TimelineUvCoordinateField.js +126 -0
  49. package/dist/components/Timeline/TimelineVideoInfo.js +11 -12
  50. package/dist/components/Timeline/get-node-keyframes.d.ts +11 -0
  51. package/dist/components/Timeline/get-node-keyframes.js +23 -0
  52. package/dist/components/Timeline/get-timeline-keyframes.d.ts +1 -1
  53. package/dist/components/Timeline/get-timeline-keyframes.js +14 -9
  54. package/dist/components/Timeline/timeline-field-row-layout.d.ts +1 -0
  55. package/dist/components/Timeline/timeline-field-row-layout.js +11 -1
  56. package/dist/components/Timeline/use-expanded-track-keyframe-rows.d.ts +17 -0
  57. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +45 -0
  58. package/dist/components/Timeline/use-open-sequence-in-editor.d.ts +6 -0
  59. package/dist/components/Timeline/use-open-sequence-in-editor.js +31 -0
  60. package/dist/esm/{chunk-vwnse6c9.js → chunk-1mp51e0w.js} +3353 -2712
  61. package/dist/esm/chunk-6jf1natv.js +25 -0
  62. package/dist/esm/index.mjs +16 -0
  63. package/dist/esm/internals.mjs +3366 -2710
  64. package/dist/esm/previewEntry.mjs +3376 -2720
  65. package/dist/esm/renderEntry.mjs +4 -3
  66. package/dist/helpers/calculate-timeline.js +4 -0
  67. package/dist/helpers/colors.d.ts +1 -1
  68. package/dist/helpers/colors.js +1 -1
  69. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +1 -0
  70. package/dist/helpers/timeline-layout.d.ts +8 -7
  71. package/dist/helpers/timeline-layout.js +9 -8
  72. package/dist/helpers/timeline-node-path-key.d.ts +2 -0
  73. package/dist/helpers/timeline-node-path-key.js +10 -0
  74. package/package.json +10 -10
  75. package/dist/components/Timeline/TimelineStack/index.d.ts +0 -8
  76. package/dist/components/Timeline/TimelineStack/index.js +0 -119
  77. package/dist/esm/chunk-5gtx3pza.js +0 -9
@@ -1,124 +1,19 @@
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
- })();
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
35
5
  Object.defineProperty(exports, "__esModule", { value: true });
36
6
  exports.TimelineExpandedTrackKeyframes = void 0;
37
7
  const jsx_runtime_1 = require("react/jsx-runtime");
38
- const react_1 = __importStar(require("react"));
39
- const remotion_1 = require("remotion");
40
- const colors_1 = require("../../helpers/colors");
41
- const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
42
- const timeline_layout_1 = require("../../helpers/timeline-layout");
43
- const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
44
- const get_timeline_keyframes_1 = require("./get-timeline-keyframes");
45
- const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
46
- const row = {
47
- position: 'relative',
48
- };
49
- const separator = {
50
- height: 1,
51
- backgroundColor: colors_1.TIMELINE_TRACK_SEPARATOR,
52
- };
53
- const section = {
54
- borderBottom: `1px solid ${colors_1.TIMELINE_TRACK_SEPARATOR}`,
55
- };
56
- const diamondBase = {
57
- position: 'absolute',
58
- width: 8,
59
- height: 8,
60
- backgroundColor: colors_1.LIGHT_TEXT,
61
- borderRadius: 1,
62
- boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.4)',
63
- pointerEvents: 'none',
64
- };
65
- const getNodeKeyframes = ({ node, nodePath, codeValues, }) => {
66
- var _a, _b;
67
- if (node.kind !== 'field' || node.field === null) {
68
- return [];
69
- }
70
- if (node.field.kind === 'sequence-field') {
71
- return (0, get_timeline_keyframes_1.getTimelineKeyframes)((_a = remotion_1.Internals.getCodeValuesCtx(codeValues, nodePath)) === null || _a === void 0 ? void 0 : _a[node.field.key]);
72
- }
73
- const effectStatus = remotion_1.Internals.getEffectCodeValuesCtx({
74
- codeValues,
75
- nodePath,
76
- effectIndex: node.field.effectIndex,
77
- });
78
- return (0, get_timeline_keyframes_1.getTimelineKeyframes)(effectStatus.type === 'can-update-effect'
79
- ? (_b = effectStatus.props) === null || _b === void 0 ? void 0 : _b[node.field.key]
80
- : null);
81
- };
82
- const TimelineExpandedTrackKeyframesInner = ({ nodePathInfo, sequence }) => {
83
- const videoConfig = (0, remotion_1.useVideoConfig)();
84
- const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
85
- const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
86
- const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
87
- const tree = (0, react_1.useMemo)(() => (0, timeline_layout_1.buildTimelineTree)({
8
+ const react_1 = __importDefault(require("react"));
9
+ const TimelineExpandedKeyframeRow_1 = require("./TimelineExpandedKeyframeRow");
10
+ const use_expanded_track_keyframe_rows_1 = require("./use-expanded-track-keyframe-rows");
11
+ const TimelineExpandedTrackKeyframesInner = ({ nodePathInfo, sequence, keyframeDisplayOffset }) => {
12
+ const { rows, expandedHeight } = (0, use_expanded_track_keyframe_rows_1.useExpandedTrackKeyframeRows)({
88
13
  sequence,
89
14
  nodePathInfo,
90
- getDragOverrides: () => ({}),
91
- getEffectDragOverrides: () => ({}),
92
- codeValues,
93
- }), [codeValues, nodePathInfo, sequence]);
94
- const flat = (0, react_1.useMemo)(() => (0, timeline_layout_1.flattenVisibleTreeNodes)({ nodes: tree, getIsExpanded }), [tree, getIsExpanded]);
95
- const expandedHeight = (0, react_1.useMemo)(() => (0, timeline_layout_1.getExpandedTrackHeight)({
96
- sequence,
97
- nodePathInfo,
98
- getIsExpanded,
99
- codeValues,
100
- }), [codeValues, getIsExpanded, nodePathInfo, sequence]);
101
- const rows = (0, react_1.useMemo)(() => flat.map(({ node }) => ({
102
- height: (0, timeline_layout_1.getTreeRowHeight)(node),
103
- keyframes: getNodeKeyframes({
104
- node,
105
- nodePath: nodePathInfo.sequenceSubscriptionKey,
106
- codeValues,
107
- }),
108
- key: JSON.stringify(node.nodePathInfo),
109
- })), [codeValues, flat, nodePathInfo.sequenceSubscriptionKey]);
110
- return (jsx_runtime_1.jsx("div", { style: {
111
- height: expandedHeight + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
112
- }, children: jsx_runtime_1.jsx("div", { style: { ...section, height: expandedHeight }, children: rows.map(({ height, keyframes, key }, i) => {
113
- return (jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [i > 0 ? jsx_runtime_1.jsx("div", { style: separator }) : null, jsx_runtime_1.jsx("div", { style: { ...row, height }, children: timelineWidth === null
114
- ? null
115
- : keyframes.map((keyframe) => (jsx_runtime_1.jsx("div", { style: {
116
- ...diamondBase,
117
- left: (0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(keyframe.frame, videoConfig.durationInFrames, timelineWidth) - timeline_layout_1.TIMELINE_PADDING,
118
- top: height / 2,
119
- transform: 'translate(-50%, -50%) rotate(45deg)',
120
- }, title: `Keyframe at frame ${keyframe.frame}` }, String(keyframe.frame)))) })
121
- ] }, key));
122
- }) }) }));
15
+ keyframeDisplayOffset,
16
+ });
17
+ return (jsx_runtime_1.jsx("div", { style: { height: expandedHeight }, children: rows.map((row, index) => (jsx_runtime_1.jsx(TimelineExpandedKeyframeRow_1.TimelineExpandedKeyframeRow, { height: row.height, keyframes: row.keyframes, nodePathInfo: row.nodePathInfo, showSeparator: index > 0 }, row.rowKey))) }));
123
18
  };
124
19
  exports.TimelineExpandedTrackKeyframes = react_1.default.memo(TimelineExpandedTrackKeyframesInner);
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare const TimelineFieldLabel: React.FC<{
3
+ readonly rowDepth: number;
4
+ readonly selected: boolean;
5
+ readonly label: string;
6
+ }>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimelineFieldLabel = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
7
+ const TimelineSelection_1 = require("./TimelineSelection");
8
+ const fieldNameBase = {
9
+ fontSize: 12,
10
+ color: 'rgba(255, 255, 255, 0.8)',
11
+ userSelect: 'none',
12
+ whiteSpace: 'nowrap',
13
+ overflow: 'hidden',
14
+ textOverflow: 'ellipsis',
15
+ flex: 1,
16
+ minWidth: 0,
17
+ };
18
+ const TimelineFieldLabel = ({ rowDepth, selected, label }) => {
19
+ const labelRowStyle = (0, react_1.useMemo)(() => ({
20
+ ...(0, timeline_field_row_layout_1.getTimelineFieldLabelRowStyle)(rowDepth),
21
+ ...(0, TimelineSelection_1.getTimelineSelectedLabelStyle)(selected, true),
22
+ alignSelf: 'stretch',
23
+ }), [rowDepth, selected]);
24
+ const fieldNameStyle = (0, react_1.useMemo)(() => ({
25
+ ...fieldNameBase,
26
+ color: (0, TimelineSelection_1.getTimelineColor)(selected, true),
27
+ }), [selected]);
28
+ return (jsx_runtime_1.jsx("div", { style: labelRowStyle, children: jsx_runtime_1.jsx("span", { style: fieldNameStyle, title: label, children: label }) }));
29
+ };
30
+ exports.TimelineFieldLabel = TimelineFieldLabel;
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
- import type { SequencePropsSubscriptionKey } from 'remotion';
3
- import type { SequenceSchema } from 'remotion';
2
+ import type { SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
4
3
  import type { CodePosition } from '../../error-overlay/react-overlay/utils/get-source-map';
4
+ import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
5
5
  import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
6
6
  export declare const TimelineFieldRow: React.FC<{
7
7
  readonly field: SchemaFieldInfo;
8
8
  readonly validatedLocation: CodePosition;
9
9
  readonly rowDepth: number;
10
10
  readonly nodePath: SequencePropsSubscriptionKey;
11
+ readonly nodePathInfo: SequenceNodePathInfo;
11
12
  readonly schema: SequenceSchema;
12
13
  }>;
@@ -5,21 +5,15 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
7
  const client_id_1 = require("../../helpers/client-id");
8
- const timeline_layout_1 = require("../../helpers/timeline-layout");
9
8
  const save_sequence_prop_1 = require("./save-sequence-prop");
10
9
  const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
11
10
  const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
11
+ const TimelineFieldLabel_1 = require("./TimelineFieldLabel");
12
12
  const TimelineLayerEye_1 = require("./TimelineLayerEye");
13
13
  const TimelineRowChrome_1 = require("./TimelineRowChrome");
14
14
  const TimelineSchemaField_1 = require("./TimelineSchemaField");
15
- const fieldRowBase = {
16
- paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
17
- };
18
- const fieldName = {
19
- fontSize: 12,
20
- color: 'rgba(255, 255, 255, 0.8)',
21
- userSelect: 'none',
22
- };
15
+ const TimelineSelection_1 = require("./TimelineSelection");
16
+ const fieldRowBase = {};
23
17
  const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
24
18
  const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
25
19
  const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
@@ -92,9 +86,10 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
92
86
  }, [clearDragOverrides, nodePath]);
93
87
  return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
94
88
  };
95
- const TimelineFieldRow = ({ field, validatedLocation, rowDepth, nodePath, schema }) => {
89
+ const TimelineFieldRow = ({ field, validatedLocation, rowDepth, nodePath, nodePathInfo, schema }) => {
96
90
  var _a, _b;
97
91
  const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
92
+ const selection = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
98
93
  const codeValuesForOverride = remotion_1.Internals.getCodeValuesCtx(visualModeCodeValues, nodePath);
99
94
  const codeValue = (_a = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride[field.key]) !== null && _a !== void 0 ? _a : null;
100
95
  const style = (0, react_1.useMemo)(() => {
@@ -103,11 +98,10 @@ const TimelineFieldRow = ({ field, validatedLocation, rowDepth, nodePath, schema
103
98
  height: field.rowHeight,
104
99
  };
105
100
  }, [field.rowHeight]);
106
- const labelRowStyle = (0, react_1.useMemo)(() => (0, timeline_field_row_layout_1.getTimelineFieldLabelRowStyle)(rowDepth), [rowDepth]);
107
101
  if (codeValue === null) {
108
102
  return null;
109
103
  }
110
- return (jsx_runtime_1.jsxs(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}), style: style, children: [
111
- jsx_runtime_1.jsx("div", { style: labelRowStyle, children: jsx_runtime_1.jsx("span", { style: fieldName, children: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }) }), codeValue.canUpdate ? (jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation, schema: schema, codeValue: codeValue })) : (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineNonEditableStatus, { propStatus: codeValue }))] }));
104
+ return (jsx_runtime_1.jsxs(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}), style: style, selected: selection.selected, selectable: selection.selectable, onSelect: selection.onSelect, showSelectedBackground: true, containsSelection: false, outerHeight: null, children: [
105
+ jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), codeValue.canUpdate ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation, schema: schema, codeValue: codeValue }) })) : (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineNonEditableStatus, { propStatus: codeValue }) }))] }));
112
106
  };
113
107
  exports.TimelineFieldRow = TimelineFieldRow;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { OriginalPosition } from '../../error-overlay/react-overlay/utils/get-source-map';
3
+ export declare const TimelineItemStack: React.FC<{
4
+ readonly originalLocation: OriginalPosition | null;
5
+ }>;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimelineItemStack = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const client_id_1 = require("../../helpers/client-id");
7
+ const colors_1 = require("../../helpers/colors");
8
+ const get_git_menu_item_1 = require("../../helpers/get-git-menu-item");
9
+ const open_in_editor_1 = require("../../helpers/open-in-editor");
10
+ const layout_1 = require("../layout");
11
+ const NotificationCenter_1 = require("../Notifications/NotificationCenter");
12
+ const Spinner_1 = require("../Spinner");
13
+ const TimelineSelection_1 = require("./TimelineSelection");
14
+ const source_attribution_1 = require("./TimelineStack/source-attribution");
15
+ const TimelineItemStack = ({ originalLocation }) => {
16
+ const [hovered, setHovered] = (0, react_1.useState)(false);
17
+ const [opening, setOpening] = (0, react_1.useState)(false);
18
+ const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
19
+ .previewServerState.type;
20
+ const openEditor = (0, react_1.useCallback)(async (location) => {
21
+ if (!window.remotion_editorName) {
22
+ return;
23
+ }
24
+ setOpening(true);
25
+ try {
26
+ await (0, open_in_editor_1.openOriginalPositionInEditor)(location);
27
+ }
28
+ catch (err) {
29
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
30
+ }
31
+ finally {
32
+ setOpening(false);
33
+ }
34
+ }, []);
35
+ const canOpenInEditor = Boolean(window.remotion_editorName &&
36
+ connectionStatus === 'connected' &&
37
+ originalLocation);
38
+ const canOpenInGitHub = Boolean(window.remotion_gitSource && originalLocation);
39
+ const hoverable = !TimelineSelection_1.SELECTION_ENABLED && (canOpenInEditor || canOpenInGitHub);
40
+ const onClick = (0, react_1.useCallback)(() => {
41
+ if (!originalLocation) {
42
+ return;
43
+ }
44
+ if (canOpenInEditor) {
45
+ openEditor(originalLocation);
46
+ return;
47
+ }
48
+ if (canOpenInGitHub) {
49
+ window.open((0, get_git_menu_item_1.getGitRefUrl)(window.remotion_gitSource, originalLocation), '_blank');
50
+ }
51
+ }, [canOpenInEditor, canOpenInGitHub, openEditor, originalLocation]);
52
+ const onPointerEnter = (0, react_1.useCallback)(() => setHovered(true), []);
53
+ const onPointerLeave = (0, react_1.useCallback)(() => setHovered(false), []);
54
+ const style = (0, react_1.useMemo)(() => {
55
+ return {
56
+ fontSize: 12,
57
+ color: opening
58
+ ? colors_1.VERY_LIGHT_TEXT
59
+ : hovered && hoverable
60
+ ? colors_1.LIGHT_TEXT
61
+ : colors_1.VERY_LIGHT_TEXT,
62
+ cursor: hoverable ? 'pointer' : undefined,
63
+ display: 'flex',
64
+ flexDirection: 'row',
65
+ alignItems: 'center',
66
+ whiteSpace: 'nowrap',
67
+ textOverflow: 'ellipsis',
68
+ overflow: 'hidden',
69
+ flexShrink: 100000,
70
+ userSelect: 'none',
71
+ WebkitUserSelect: 'none',
72
+ };
73
+ }, [opening, hovered, hoverable]);
74
+ if (!originalLocation) {
75
+ return null;
76
+ }
77
+ return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
78
+ jsx_runtime_1.jsx("div", { onPointerEnter: hoverable ? onPointerEnter : undefined, onPointerLeave: hoverable ? onPointerLeave : undefined, onClick: hoverable ? onClick : undefined, style: style, children: (0, source_attribution_1.getOriginalSourceAttribution)(originalLocation) }), opening ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
79
+ jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(Spinner_1.Spinner, { duration: 0.5, size: 12 })
80
+ ] })) : null] }));
81
+ };
82
+ exports.TimelineItemStack = TimelineItemStack;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
3
+ export declare const TimelineKeyframeDiamond: React.NamedExoticComponent<{
4
+ readonly frame: number;
5
+ readonly rowHeight: number;
6
+ readonly nodePathInfo: SequenceNodePathInfo;
7
+ }>;
@@ -0,0 +1,87 @@
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.TimelineKeyframeDiamond = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const react_1 = __importStar(require("react"));
39
+ const remotion_1 = require("remotion");
40
+ const colors_1 = require("../../helpers/colors");
41
+ const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
42
+ const timeline_layout_1 = require("../../helpers/timeline-layout");
43
+ const TimelineSelection_1 = require("./TimelineSelection");
44
+ const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
45
+ const diamondBase = {
46
+ position: 'absolute',
47
+ width: 8,
48
+ height: 8,
49
+ backgroundColor: colors_1.LIGHT_TEXT,
50
+ borderRadius: 1,
51
+ boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.4)',
52
+ pointerEvents: 'none',
53
+ };
54
+ const TimelineKeyframeDiamondUnmemoized = ({ frame, rowHeight, nodePathInfo }) => {
55
+ const videoConfig = (0, remotion_1.useVideoConfig)();
56
+ const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
57
+ const { selected, onSelect, selectable } = (0, TimelineSelection_1.useTimelineKeyframeSelection)(nodePathInfo, frame);
58
+ const style = (0, react_1.useMemo)(() => {
59
+ if (timelineWidth === null) {
60
+ return null;
61
+ }
62
+ return {
63
+ ...diamondBase,
64
+ backgroundColor: selected
65
+ ? TimelineSelection_1.TIMELINE_SELECTED_LABEL_BACKGROUND
66
+ : colors_1.LIGHT_TEXT,
67
+ border: 'none',
68
+ cursor: 'default',
69
+ left: (0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(frame, videoConfig.durationInFrames, timelineWidth) - timeline_layout_1.TIMELINE_PADDING,
70
+ padding: 0,
71
+ pointerEvents: 'auto',
72
+ top: rowHeight / 2,
73
+ transform: 'translate(-50%, -50%) rotate(45deg)',
74
+ };
75
+ }, [frame, rowHeight, selected, timelineWidth, videoConfig.durationInFrames]);
76
+ const onPointerDown = (0, react_1.useCallback)((e) => {
77
+ if (e.button === 0) {
78
+ e.stopPropagation();
79
+ onSelect();
80
+ }
81
+ }, [onSelect]);
82
+ if (style === null) {
83
+ return null;
84
+ }
85
+ return (jsx_runtime_1.jsx("button", { type: "button", style: style, title: `Keyframe at frame ${frame}`, "aria-label": `Select keyframe at frame ${frame}`, onPointerDown: selectable ? onPointerDown : undefined }));
86
+ };
87
+ exports.TimelineKeyframeDiamond = react_1.default.memo(TimelineKeyframeDiamondUnmemoized);
@@ -47,6 +47,7 @@ const TimelineLayerEye = ({ onInvoked, hidden, type }) => {
47
47
  if (e.button !== 0) {
48
48
  return;
49
49
  }
50
+ e.stopPropagation();
50
51
  layerPointedDown = hidden ? 'enable' : 'disable';
51
52
  onInvoked(layerPointedDown);
52
53
  window.addEventListener('pointerup', () => {
@@ -2,25 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelineList = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const player_1 = require("@remotion/player");
6
5
  const react_1 = require("react");
7
6
  const colors_1 = require("../../helpers/colors");
8
7
  const TimelineListItem_1 = require("./TimelineListItem");
8
+ const TimelineSelection_1 = require("./TimelineSelection");
9
9
  const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
10
10
  const container = {
11
11
  flex: 1,
12
12
  background: colors_1.BACKGROUND,
13
13
  };
14
14
  const TimelineList = ({ timeline }) => {
15
- const ref = (0, react_1.useRef)(null);
16
- const size = player_1.PlayerInternals.useElementSize(ref, {
17
- shouldApplyCssTransforms: false,
18
- triggerOnWindowResize: false,
19
- });
20
- const isCompact = size ? size.width < 250 : false;
21
- return (jsx_runtime_1.jsxs("div", { ref: ref, style: container, children: [
15
+ const { clearSelection } = (0, TimelineSelection_1.useTimelineSelection)();
16
+ // Selection-triggering click handlers in children call e.stopPropagation(),
17
+ // so any pointerdown that bubbles up here is by definition on empty space
18
+ // and should clear the current selection.
19
+ const onPointerDown = (0, react_1.useCallback)((e) => {
20
+ if (e.button !== 0) {
21
+ return;
22
+ }
23
+ clearSelection();
24
+ }, [clearSelection]);
25
+ return (jsx_runtime_1.jsxs("div", { style: container, onPointerDown: onPointerDown, children: [
22
26
  jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePadding, {}), timeline.map((track) => {
23
- return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(TimelineListItem_1.TimelineListItem, { nestedDepth: track.depth, sequence: track.sequence, isCompact: isCompact, nodePathInfo: track.nodePathInfo }, track.sequence.id) }, track.sequence.id));
27
+ return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(TimelineListItem_1.TimelineListItem, { nestedDepth: track.depth, sequence: track.sequence, nodePathInfo: track.nodePathInfo }, track.sequence.id) }, track.sequence.id));
24
28
  })] }));
25
29
  };
26
30
  exports.TimelineList = TimelineList;
@@ -4,6 +4,5 @@ import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-s
4
4
  export declare const TimelineListItem: React.FC<{
5
5
  readonly sequence: TSequence;
6
6
  readonly nestedDepth: number;
7
- readonly isCompact: boolean;
8
7
  readonly nodePathInfo: SequenceNodePathInfo | null;
9
8
  }>;