@remotion/studio 4.0.500 → 4.0.502

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 (156) hide show
  1. package/dist/Studio.js +1 -1
  2. package/dist/api/delete-static-file.js +8 -3
  3. package/dist/api/rename-static-file.js +8 -0
  4. package/dist/api/watch-public-folder.js +2 -1
  5. package/dist/api/watch-static-file.js +2 -1
  6. package/dist/api/write-static-file.js +8 -3
  7. package/dist/components/AssetSelector.js +3 -1
  8. package/dist/components/AssetSelectorItem.d.ts +2 -1
  9. package/dist/components/AssetSelectorItem.js +7 -4
  10. package/dist/components/Canvas.js +9 -4
  11. package/dist/components/CaptionInspector.d.ts +10 -0
  12. package/dist/components/CaptionInspector.js +24 -0
  13. package/dist/components/CaptionTextEditor.d.ts +9 -0
  14. package/dist/components/CaptionTextEditor.js +132 -0
  15. package/dist/components/CompositionSelector.js +4 -4
  16. package/dist/components/CompositionSelectorItem.js +5 -5
  17. package/dist/components/CurrentAsset.js +3 -2
  18. package/dist/components/EditorContent.js +1 -1
  19. package/dist/components/EditorContexts.d.ts +0 -1
  20. package/dist/components/EditorContexts.js +2 -2
  21. package/dist/components/FpsCounter.js +3 -3
  22. package/dist/components/FullscreenToggle.d.ts +3 -1
  23. package/dist/components/FullscreenToggle.js +3 -2
  24. package/dist/components/GlobalKeybindings.js +2 -0
  25. package/dist/components/InitialCompositionLoader.d.ts +1 -1
  26. package/dist/components/InlineAction.js +2 -1
  27. package/dist/components/InlineCaptionInspector.d.ts +11 -0
  28. package/dist/components/InlineCaptionInspector.js +108 -0
  29. package/dist/components/InspectorPanel/CompositionInspector.js +5 -3
  30. package/dist/components/InspectorPanel/SelectedInspector.d.ts +1 -0
  31. package/dist/components/InspectorPanel/SelectedInspector.js +2 -2
  32. package/dist/components/InspectorPanel/SequenceSelectionInspector.d.ts +1 -0
  33. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +4 -4
  34. package/dist/components/InspectorPanel/inspector-section-collapse.d.ts +22 -0
  35. package/dist/components/InspectorPanel/inspector-section-collapse.js +165 -0
  36. package/dist/components/InspectorPanel/styles.js +7 -1
  37. package/dist/components/InspectorPanel/use-composition-actions.d.ts +4 -1
  38. package/dist/components/InspectorPanel/use-composition-actions.js +135 -7
  39. package/dist/components/InspectorPanel.js +2 -2
  40. package/dist/components/InspectorSequenceSection.d.ts +2 -1
  41. package/dist/components/InspectorSequenceSection.js +238 -8
  42. package/dist/components/LoopToggle.d.ts +1 -0
  43. package/dist/components/LoopToggle.js +9 -5
  44. package/dist/components/Menu/MenuSubItem.js +9 -1
  45. package/dist/components/MenuToolbar.js +8 -1
  46. package/dist/components/Modals.js +1 -1
  47. package/dist/components/ObserveDefaultPropsContext.js +7 -4
  48. package/dist/components/PlayPause.d.ts +1 -0
  49. package/dist/components/PlayPause.js +2 -4
  50. package/dist/components/PlaybackRateSelector.d.ts +9 -2
  51. package/dist/components/PlaybackRateSelector.js +21 -10
  52. package/dist/components/PreviewToolbar.js +19 -109
  53. package/dist/components/PreviewToolbarOverflowButton.d.ts +12 -0
  54. package/dist/components/PreviewToolbarOverflowButton.js +217 -0
  55. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +1 -0
  56. package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +6 -0
  57. package/dist/components/QuickSwitcher/QuickSwitcher.js +2 -2
  58. package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +6 -0
  59. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +42 -9
  60. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +2 -0
  61. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +7 -1
  62. package/dist/components/RenderButton.d.ts +1 -0
  63. package/dist/components/RenderButton.js +6 -4
  64. package/dist/components/RenderQueue/ClientRenderQueueProcessor.d.ts +0 -1
  65. package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +3 -14
  66. package/dist/components/RenderQueue/RenderQueueDownloadItem.js +2 -2
  67. package/dist/components/SelectedOutlineElement.js +1 -4
  68. package/dist/components/SelectedOutlineOverlay.js +17 -8
  69. package/dist/components/ShowOutlinesProvider.js +4 -1
  70. package/dist/components/SizeSelector.d.ts +6 -0
  71. package/dist/components/SizeSelector.js +17 -8
  72. package/dist/components/Splitter/SplitterContainer.d.ts +1 -0
  73. package/dist/components/Splitter/SplitterContainer.js +23 -3
  74. package/dist/components/Splitter/SplitterContext.d.ts +14 -0
  75. package/dist/components/Splitter/SplitterContext.js +16 -1
  76. package/dist/components/Splitter/SplitterHandle.js +8 -6
  77. package/dist/components/Timeline/Timeline.js +21 -6
  78. package/dist/components/Timeline/TimelineAssetField.d.ts +1 -1
  79. package/dist/components/Timeline/TimelineAssetField.js +37 -1
  80. package/dist/components/Timeline/TimelineDragHandler.js +1 -1
  81. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +8 -2
  82. package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +7 -2
  83. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +3 -1
  84. package/dist/components/Timeline/TimelineRowChrome.d.ts +3 -0
  85. package/dist/components/Timeline/TimelineRowChrome.js +4 -3
  86. package/dist/components/Timeline/TimelineSelection.d.ts +4 -2
  87. package/dist/components/Timeline/TimelineSelection.js +9 -6
  88. package/dist/components/Timeline/TimelineSequence.js +1 -4
  89. package/dist/components/Timeline/TimelineSequenceItem.js +4 -5
  90. package/dist/components/Timeline/TimelineSequencePropItem.js +9 -10
  91. package/dist/components/Timeline/TimelineStack/get-stack.js +8 -0
  92. package/dist/components/Timeline/TimelineTrack.js +4 -2
  93. package/dist/components/Timeline/border-radius-representation.d.ts +16 -0
  94. package/dist/components/Timeline/border-radius-representation.js +60 -0
  95. package/dist/components/Timeline/delete-selected-timeline-item.js +1 -6
  96. package/dist/components/Timeline/get-sequence-prop-reset-changes.d.ts +10 -0
  97. package/dist/components/Timeline/get-sequence-prop-reset-changes.js +33 -0
  98. package/dist/components/Timeline/reset-selected-timeline-props.js +2 -8
  99. package/dist/components/Timeline/save-sequence-prop.d.ts +12 -1
  100. package/dist/components/Timeline/save-sequence-prop.js +28 -4
  101. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -2
  102. package/dist/components/Timeline/sequence-props-subscription-store.js +3 -3
  103. package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
  104. package/dist/components/Timeline/use-timeline-asset-drop.js +4 -0
  105. package/dist/components/TopPanel.js +1 -1
  106. package/dist/components/UndoRedoButtons.js +15 -6
  107. package/dist/components/UpdateCheck.js +11 -4
  108. package/dist/components/default-props-api.d.ts +3 -0
  109. package/dist/components/default-props-api.js +19 -0
  110. package/dist/components/drop-handler-data.d.ts +1 -1
  111. package/dist/components/drop-handler-data.js +6 -6
  112. package/dist/components/effect-drag-and-drop.d.ts +1 -1
  113. package/dist/components/effect-drag-and-drop.js +3 -3
  114. package/dist/components/element-drag-and-drop.d.ts +1 -1
  115. package/dist/components/element-drag-and-drop.js +3 -3
  116. package/dist/components/handle-drop.d.ts +3 -2
  117. package/dist/components/handle-drop.js +2 -1
  118. package/dist/components/import-assets.d.ts +8 -6
  119. package/dist/components/import-assets.js +20 -7
  120. package/dist/components/sequence-props-api.d.ts +4 -0
  121. package/dist/components/sequence-props-api.js +26 -0
  122. package/dist/components/use-element-overwrite-confirmation.d.ts +2 -0
  123. package/dist/components/use-element-overwrite-confirmation.js +73 -0
  124. package/dist/components/use-static-files.js +7 -2
  125. package/dist/error-overlay/react-overlay/effects/resolve-file-source.js +13 -2
  126. package/dist/error-overlay/remotion-overlay/ErrorDisplay.d.ts +1 -0
  127. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +29 -5
  128. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +4 -20
  129. package/dist/esm/{chunk-dr1y1vm3.js → chunk-fjv75ty4.js} +8478 -6609
  130. package/dist/esm/index.mjs +24 -8
  131. package/dist/esm/internals.mjs +8478 -6609
  132. package/dist/esm/previewEntry.mjs +8535 -6666
  133. package/dist/esm/renderEntry.mjs +1 -1
  134. package/dist/helpers/browser-studio-operations.d.ts +3 -0
  135. package/dist/helpers/browser-studio-operations.js +14 -0
  136. package/dist/helpers/client-id.d.ts +0 -1
  137. package/dist/helpers/client-id.js +15 -10
  138. package/dist/helpers/download-blob.d.ts +1 -0
  139. package/dist/helpers/download-blob.js +15 -0
  140. package/dist/helpers/inject-css.js +5 -3
  141. package/dist/helpers/open-in-editor.js +26 -5
  142. package/dist/helpers/preview-server-events.js +46 -9
  143. package/dist/helpers/use-create-composition.js +8 -6
  144. package/dist/helpers/use-menu-structure.js +29 -0
  145. package/dist/hot-middleware-client/client.js +3 -3
  146. package/dist/icons/border-radius.d.ts +4 -0
  147. package/dist/icons/border-radius.js +8 -0
  148. package/dist/icons/fullscreen.d.ts +4 -0
  149. package/dist/icons/fullscreen.js +6 -0
  150. package/dist/icons/upload.d.ts +4 -0
  151. package/dist/icons/upload.js +8 -0
  152. package/dist/previewEntry.js +1 -1
  153. package/dist/state/modals.d.ts +5 -0
  154. package/dist/state/timeline-sequence-hover.d.ts +17 -0
  155. package/dist/state/timeline-sequence-hover.js +33 -0
  156. package/package.json +13 -12
@@ -115,6 +115,7 @@ const GlobalKeybindings = () => {
115
115
  : 'compositions',
116
116
  invocationTimestamp: Date.now(),
117
117
  assetSelection: null,
118
+ compositionSelection: null,
118
119
  });
119
120
  },
120
121
  triggerIfInputFieldFocused: true,
@@ -165,6 +166,7 @@ const GlobalKeybindings = () => {
165
166
  mode: 'docs',
166
167
  invocationTimestamp: Date.now(),
167
168
  assetSelection: null,
169
+ compositionSelection: null,
168
170
  });
169
171
  },
170
172
  commandCtrlKey: false,
@@ -1,3 +1,3 @@
1
1
  import type React from 'react';
2
- export declare const useSelectComposition: () => (c: import("remotion").AnyComposition, push: boolean, frame?: number | null) => void;
2
+ export declare const useSelectComposition: () => (c: Pick<import("remotion").AnyComposition, "folderName" | "id" | "parentFolderName">, push: boolean, frame?: number | null) => void;
3
3
  export declare const InitialCompositionLoader: React.FC;
@@ -27,9 +27,10 @@ const InlineAction = ({ renderAction, onClick, disabled, title, unhoveredColor =
27
27
  justifyContent: 'center',
28
28
  alignItems: 'center',
29
29
  borderRadius: 3,
30
+ opacity: disabled ? 0.5 : 1,
30
31
  pointerEvents: disabled ? 'none' : 'auto',
31
32
  };
32
33
  }, [disabled, hovered]);
33
- return (jsx_runtime_1.jsx("button", { type: "button", disabled: disabled, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, style: style, tabIndex: tabIndex, title: title, children: renderAction(hovered ? colors_1.WHITE : unhoveredColor) }));
34
+ return (jsx_runtime_1.jsx("button", { type: "button", disabled: disabled, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, style: style, tabIndex: tabIndex, title: title, "aria-label": title, children: renderAction(hovered ? colors_1.WHITE : unhoveredColor) }));
34
35
  };
35
36
  exports.InlineAction = InlineAction;
@@ -0,0 +1,11 @@
1
+ import type { Caption } from '@remotion/captions';
2
+ import React from 'react';
3
+ import type { SequenceControls, SequencePropsSubscriptionKey } from 'remotion';
4
+ import type { CodePosition } from '../error-overlay/react-overlay/utils/get-source-map';
5
+ export declare const InlineCaptionInspector: React.FC<{
6
+ readonly captions: Caption[];
7
+ readonly controls: SequenceControls;
8
+ readonly nodePath: SequencePropsSubscriptionKey;
9
+ readonly readOnlyStudio: boolean;
10
+ readonly validatedLocation: CodePosition;
11
+ }>;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InlineCaptionInspector = 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 client_id_1 = require("../helpers/client-id");
8
+ const CaptionInspector_1 = require("./CaptionInspector");
9
+ const save_sequence_prop_1 = require("./Timeline/save-sequence-prop");
10
+ const serializeCaptions = (captions) => {
11
+ return JSON.stringify(captions);
12
+ };
13
+ const getCaptionPatches = ({ previous, next, }) => {
14
+ if (previous.length !== next.length) {
15
+ return null;
16
+ }
17
+ const patches = [];
18
+ for (const [index, before] of previous.entries()) {
19
+ const after = next[index];
20
+ if (!after) {
21
+ return null;
22
+ }
23
+ if (before.text !== after.text) {
24
+ patches.push({
25
+ index,
26
+ before,
27
+ changes: { text: after.text },
28
+ });
29
+ }
30
+ }
31
+ return patches;
32
+ };
33
+ const InlineCaptionInspector = ({ captions, controls, nodePath, readOnlyStudio, validatedLocation }) => {
34
+ var _a;
35
+ const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
36
+ const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
37
+ const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
38
+ const captionStatus = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a.captions;
39
+ const clientId = previewServerState.type === 'connected'
40
+ ? previewServerState.clientId
41
+ : null;
42
+ const canSave = !readOnlyStudio && clientId !== null && (captionStatus === null || captionStatus === void 0 ? void 0 : captionStatus.status) === 'static';
43
+ const [draftCaptions, setDraftCaptions] = (0, react_1.useState)(captions);
44
+ const savedCaptions = (0, react_1.useRef)(captions);
45
+ const runtimeSignature = serializeCaptions(captions);
46
+ const lastRuntimeSignature = (0, react_1.useRef)(runtimeSignature);
47
+ (0, react_1.useEffect)(() => {
48
+ if (lastRuntimeSignature.current === runtimeSignature) {
49
+ return;
50
+ }
51
+ lastRuntimeSignature.current = runtimeSignature;
52
+ savedCaptions.current = captions;
53
+ setDraftCaptions(captions);
54
+ clearDragOverrides(nodePath);
55
+ }, [captions, clearDragOverrides, nodePath, runtimeSignature]);
56
+ const updateCaptions = (0, react_1.useCallback)((nextCaptions) => {
57
+ setDraftCaptions(nextCaptions);
58
+ setDragOverrides(nodePath, 'captions', remotion_1.Internals.makeStaticDragOverride(nextCaptions));
59
+ }, [nodePath, setDragOverrides]);
60
+ const cancelCaptions = (0, react_1.useCallback)(() => {
61
+ setDraftCaptions(savedCaptions.current);
62
+ clearDragOverrides(nodePath);
63
+ }, [clearDragOverrides, nodePath]);
64
+ const saveCaptions = (0, react_1.useCallback)((nextCaptions) => {
65
+ const patches = getCaptionPatches({
66
+ previous: savedCaptions.current,
67
+ next: nextCaptions,
68
+ });
69
+ setDraftCaptions(nextCaptions);
70
+ if (!canSave ||
71
+ clientId === null ||
72
+ patches === null ||
73
+ patches.length === 0) {
74
+ clearDragOverrides(nodePath);
75
+ return;
76
+ }
77
+ savedCaptions.current = nextCaptions;
78
+ (0, save_sequence_prop_1.saveInlineCaptionPatches)({
79
+ fileName: validatedLocation.source,
80
+ nodePath,
81
+ schema: controls.schema,
82
+ patches,
83
+ nextCaptions,
84
+ setPropStatuses,
85
+ clientId,
86
+ undoLabel: 'Update captions',
87
+ redoLabel: 'Update captions again',
88
+ });
89
+ clearDragOverrides(nodePath);
90
+ }, [
91
+ canSave,
92
+ clearDragOverrides,
93
+ clientId,
94
+ controls.schema,
95
+ nodePath,
96
+ setPropStatuses,
97
+ validatedLocation.source,
98
+ ]);
99
+ const readOnlyTitle = readOnlyStudio
100
+ ? 'Caption editing is unavailable in read-only Studio'
101
+ : clientId === null
102
+ ? 'Caption editing requires a Studio server connection'
103
+ : (captionStatus === null || captionStatus === void 0 ? void 0 : captionStatus.status) === 'computed'
104
+ ? 'Captions must be a direct inline JSX array to edit them'
105
+ : 'Captions are not ready for editing';
106
+ return (jsx_runtime_1.jsx(CaptionInspector_1.CaptionInspector, { captions: draftCaptions, onTextChange: updateCaptions, onTextSave: saveCaptions, onTextCancel: cancelCaptions, readOnly: !canSave, readOnlyTitle: canSave ? null : readOnlyTitle }));
107
+ };
108
+ exports.InlineCaptionInspector = InlineCaptionInspector;
@@ -6,6 +6,7 @@ const react_1 = require("react");
6
6
  const interactivity_enabled_1 = require("../../helpers/interactivity-enabled");
7
7
  const frame_1 = require("../../icons/frame");
8
8
  const solid_1 = require("../../icons/solid");
9
+ const video_1 = require("../../icons/video");
9
10
  const VisualControls_1 = require("../../visual-controls/VisualControls");
10
11
  const DefaultPropsEditor_1 = require("../DefaultPropsEditor");
11
12
  const get_zod_if_possible_1 = require("../get-zod-if-possible");
@@ -26,11 +27,12 @@ const actionIconStyle = {
26
27
  width: 18,
27
28
  };
28
29
  const CompositionActions = ({ readOnlyStudio }) => {
29
- const { canInsertAsset, canInsertSolid, canShowInsertAsset, canShowInsertSolid, insertAsset, insertSolid, } = (0, use_composition_actions_1.useCompositionActions)();
30
- if (readOnlyStudio || (!canShowInsertAsset && !canShowInsertSolid)) {
30
+ const { canInsertAsset, canInsertComposition, canInsertSolid, canShowInsertAsset, canShowInsertComposition, canShowInsertSolid, insertAsset, insertComposition, insertSolid, } = (0, use_composition_actions_1.useCompositionActions)();
31
+ if ((readOnlyStudio && !canShowInsertSolid) ||
32
+ (!canShowInsertAsset && !canShowInsertComposition && !canShowInsertSolid)) {
31
33
  return null;
32
34
  }
33
- return (jsx_runtime_1.jsxs(common_1.InspectorActionSection, { children: [canShowInsertSolid ? (jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: !canInsertSolid, onClick: insertSolid, renderIcon: (color) => (jsx_runtime_1.jsx(solid_1.SolidIcon, { color: color, style: actionIconStyle })), children: "Add Solid" })) : null, canShowInsertAsset ? (jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: !canInsertAsset, onClick: insertAsset, renderIcon: (color) => (jsx_runtime_1.jsx(frame_1.PicIcon, { color: color, style: actionIconStyle })), children: "Add asset..." })) : null] }));
35
+ return (jsx_runtime_1.jsxs(common_1.InspectorActionSection, { children: [canShowInsertSolid ? (jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: !canInsertSolid, onClick: insertSolid, renderIcon: (color) => (jsx_runtime_1.jsx(solid_1.SolidIcon, { color: color, style: actionIconStyle })), children: "Add Solid" })) : null, canShowInsertAsset ? (jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: !canInsertAsset, onClick: insertAsset, renderIcon: (color) => (jsx_runtime_1.jsx(frame_1.PicIcon, { color: color, style: actionIconStyle })), children: "Add asset..." })) : null, canShowInsertComposition ? (jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: !canInsertComposition, onClick: insertComposition, renderIcon: (color) => (jsx_runtime_1.jsx(video_1.FilmIcon, { color: color, style: actionIconStyle })), children: "Add composition..." })) : null] }));
34
36
  };
35
37
  const CompositionDefaultPropsSection = ({ composition, currentDefaultProps, readOnlyStudio, setDefaultProps }) => {
36
38
  var _a;
@@ -2,4 +2,5 @@ import React from 'react';
2
2
  import type { TimelineSelection } from '../Timeline/TimelineSelection';
3
3
  export declare const SelectedInspector: React.FC<{
4
4
  readonly selection: TimelineSelection;
5
+ readonly readOnlyStudio: boolean;
5
6
  }>;
@@ -8,9 +8,9 @@ const GuideInspector_1 = require("./GuideInspector");
8
8
  const inspector_selection_1 = require("./inspector-selection");
9
9
  const KeyframeInspector_1 = require("./KeyframeInspector");
10
10
  const SequenceSelectionInspector_1 = require("./SequenceSelectionInspector");
11
- const SelectedInspector = ({ selection }) => {
11
+ const SelectedInspector = ({ selection, readOnlyStudio }) => {
12
12
  if ((0, inspector_selection_1.isSequenceSectionSelection)(selection)) {
13
- return jsx_runtime_1.jsx(SequenceSelectionInspector_1.SequenceSelectionInspector, { selection: selection });
13
+ return (jsx_runtime_1.jsx(SequenceSelectionInspector_1.SequenceSelectionInspector, { selection: selection, readOnlyStudio: readOnlyStudio }));
14
14
  }
15
15
  if (selection.type === 'keyframe') {
16
16
  return jsx_runtime_1.jsx(KeyframeInspector_1.KeyframeInspector, { selection: selection });
@@ -2,4 +2,5 @@ import React from 'react';
2
2
  import type { SequenceSectionSelection } from './inspector-selection';
3
3
  export declare const SequenceSelectionInspector: React.FC<{
4
4
  readonly selection: SequenceSectionSelection;
5
+ readonly readOnlyStudio: boolean;
5
6
  }>;
@@ -99,7 +99,7 @@ const SequenceSourceActions = ({ selection, track, validatedSource }) => {
99
99
  }, [confirm, selection.nodePathInfo, sourceActionsDisabled]);
100
100
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [(freezeFrameMenuItem === null || freezeFrameMenuItem === void 0 ? void 0 : freezeFrameMenuItem.type) === 'item' ? (jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: Boolean(freezeFrameMenuItem.disabled), onClick: () => freezeFrameMenuItem.onClick(freezeFrameMenuItem.id, null), renderIcon: (color) => (jsx_runtime_1.jsx(snowflake_1.SnowflakeIcon, { style: largeActionIconStyle, color: color })), children: freezeFrameMenuItem.label })) : null, jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: sourceActionsDisabled, onClick: onDuplicate, renderIcon: (color) => (jsx_runtime_1.jsx(duplicate_1.DuplicateIcon, { style: largeActionIconStyle, color: color })), children: "Duplicate" }), jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: sourceActionsDisabled, onClick: onDelete, renderIcon: (color) => (jsx_runtime_1.jsx(trash_1.TrashIcon, { style: actionIconStyle, color: color })), children: "Delete" })] }));
101
101
  };
102
- const SequenceExpandedInspector = ({ track }) => {
102
+ const SequenceExpandedInspector = ({ track, readOnlyStudio }) => {
103
103
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
104
104
  const { selectedItems, selectItems } = (0, TimelineSelection_1.useTimelineSelection)();
105
105
  const sourceLocation = (0, SequenceInspectorHeader_1.useSequenceInspectorSourceLocation)(track.sequence);
@@ -143,17 +143,17 @@ const SequenceExpandedInspector = ({ track }) => {
143
143
  return (jsx_runtime_1.jsxs("div", { style: styles_1.selectedContainer, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, onPointerDown: selectSequenceOnInspectorPointerDown, children: [
144
144
  jsx_runtime_1.jsx(SequenceInspectorHeader_1.SequenceInspectorHeader, { sourceLocation: sourceLocation, track: track }), connectedCompositions.length > 0 ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
145
145
  jsx_runtime_1.jsx(common_1.InspectorSectionDivider, {}), jsx_runtime_1.jsx(ConnectedCompositionsSection_1.ConnectedCompositionsSection, { connectedCompositions: connectedCompositions })
146
- ] })) : null, validatedLocation ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [jsx_runtime_1.jsx(InspectorSequenceSection_1.InspectorSequenceSection, { sequence: track.sequence, validatedLocation: validatedLocation, nodePathInfo: track.nodePathInfo, keyframeDisplayOffset: track.keyframeDisplayOffset, renderTransformControls: () => jsx_runtime_1.jsx(AlignmentControls_1.AlignmentControls, { track: track }) }), jsx_runtime_1.jsxs(common_1.InspectorActionSection, { children: [
146
+ ] })) : null, validatedLocation ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [jsx_runtime_1.jsx(InspectorSequenceSection_1.InspectorSequenceSection, { sequence: track.sequence, readOnlyStudio: readOnlyStudio, validatedLocation: validatedLocation, nodePathInfo: track.nodePathInfo, keyframeDisplayOffset: track.keyframeDisplayOffset, renderTransformControls: () => jsx_runtime_1.jsx(AlignmentControls_1.AlignmentControls, { track: track }) }), jsx_runtime_1.jsxs(common_1.InspectorActionSection, { children: [
147
147
  jsx_runtime_1.jsx(SplitSequenceAction, { selection: sequenceSelection, track: track }), jsx_runtime_1.jsx(SequenceSourceActions, { selection: sequenceSelection, track: track, validatedSource: validatedLocation.source })
148
148
  ] })
149
149
  ] })) : (jsx_runtime_1.jsx(common_1.InspectorMessage, { children: "Source controls unavailable" }))] }));
150
150
  };
151
- const SequenceSelectionInspector = ({ selection }) => {
151
+ const SequenceSelectionInspector = ({ selection, readOnlyStudio }) => {
152
152
  const track = (0, use_track_for_selection_1.useTrackForSelection)(selection);
153
153
  if (!track) {
154
154
  return jsx_runtime_1.jsx(common_1.InspectorMessage, { children: "Sequence inspector unavailable" });
155
155
  }
156
156
  const stackKey = track.sequence.getStack();
157
- return (jsx_runtime_1.jsx(SequenceExpandedInspector, { track: track }, stackKey !== null && stackKey !== void 0 ? stackKey : track.sequence.id));
157
+ return (jsx_runtime_1.jsx(SequenceExpandedInspector, { track: track, readOnlyStudio: readOnlyStudio }, stackKey !== null && stackKey !== void 0 ? stackKey : track.sequence.id));
158
158
  };
159
159
  exports.SequenceSelectionInspector = SequenceSelectionInspector;
@@ -0,0 +1,22 @@
1
+ import type { SchemaFieldGroup } from '@remotion/studio-shared';
2
+ import { type InteractivitySchema } from 'remotion';
3
+ export type SmartCollapsibleInspectorGroup = Extract<SchemaFieldGroup, 'background' | 'border' | 'border-radius' | 'crop' | 'layout'>;
4
+ export type InspectorSectionActivity = 'active' | 'inactive' | 'unknown';
5
+ type InspectorSectionPropStatus = {
6
+ readonly status: 'static';
7
+ readonly codeValue: unknown;
8
+ } | {
9
+ readonly status: 'computed' | 'keyframed';
10
+ };
11
+ export declare const isSmartCollapsibleInspectorGroup: (group: SchemaFieldGroup) => group is SmartCollapsibleInspectorGroup;
12
+ export declare const isInspectorSectionEffectivelyInactive: ({ group, propStatuses, schema, }: {
13
+ readonly group: SmartCollapsibleInspectorGroup;
14
+ readonly propStatuses: Readonly<Record<string, InspectorSectionPropStatus>> | undefined;
15
+ readonly schema?: InteractivitySchema | undefined;
16
+ }) => boolean;
17
+ export declare const getInspectorSectionActivity: ({ group, propStatuses, schema, }: {
18
+ readonly group: SmartCollapsibleInspectorGroup;
19
+ readonly propStatuses: Readonly<Record<string, InspectorSectionPropStatus>> | undefined;
20
+ readonly schema?: InteractivitySchema | undefined;
21
+ }) => InspectorSectionActivity;
22
+ export {};
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInspectorSectionActivity = exports.isInspectorSectionEffectivelyInactive = exports.isSmartCollapsibleInspectorGroup = void 0;
4
+ const remotion_1 = require("remotion");
5
+ const color_conversion_1 = require("../../helpers/color-conversion");
6
+ const BORDER_KEYS = [
7
+ 'style.borderWidth',
8
+ 'style.borderStyle',
9
+ 'style.borderColor',
10
+ ];
11
+ const BORDER_RADIUS_SHORTHAND_KEY = 'style.borderRadius';
12
+ const BORDER_RADIUS_LONGHAND_KEYS = [
13
+ 'style.borderTopLeftRadius',
14
+ 'style.borderTopRightRadius',
15
+ 'style.borderBottomRightRadius',
16
+ 'style.borderBottomLeftRadius',
17
+ ];
18
+ const CROP_KEYS = ['cropLeft', 'cropRight', 'cropTop', 'cropBottom'];
19
+ const LAYOUT_KEYS = ['layout', 'premountFor'];
20
+ const BACKGROUND_COLOR_KEY = 'style.backgroundColor';
21
+ const isSmartCollapsibleInspectorGroup = (group) => {
22
+ return (group === 'background' ||
23
+ group === 'border' ||
24
+ group === 'border-radius' ||
25
+ group === 'crop' ||
26
+ group === 'layout');
27
+ };
28
+ exports.isSmartCollapsibleInspectorGroup = isSmartCollapsibleInspectorGroup;
29
+ const getStaticValue = ({ key, propStatuses, }) => {
30
+ const status = propStatuses === null || propStatuses === void 0 ? void 0 : propStatuses[key];
31
+ if ((status === null || status === void 0 ? void 0 : status.status) !== 'static') {
32
+ return { found: false };
33
+ }
34
+ return { found: true, value: status.codeValue };
35
+ };
36
+ const isZeroOrUndefined = (value) => {
37
+ return value === undefined || value === 0;
38
+ };
39
+ const isTransparentOrUndefined = (value) => {
40
+ if (value === undefined) {
41
+ return true;
42
+ }
43
+ if (typeof value !== 'string') {
44
+ return false;
45
+ }
46
+ return (0, color_conversion_1.parseAnyColor)(value).a === 0;
47
+ };
48
+ const hasOnlyStaticZeroValues = ({ keys, propStatuses, }) => {
49
+ for (const key of keys) {
50
+ const result = getStaticValue({ key, propStatuses });
51
+ if (!result.found || !isZeroOrUndefined(result.value)) {
52
+ return false;
53
+ }
54
+ }
55
+ return true;
56
+ };
57
+ const isBorderInactive = (propStatuses) => {
58
+ const [width, style, color] = BORDER_KEYS.map((key) => getStaticValue({ key, propStatuses }));
59
+ if (!width.found || !style.found || !color.found) {
60
+ return false;
61
+ }
62
+ if (style.value === undefined ||
63
+ style.value === 'none' ||
64
+ style.value === 'hidden') {
65
+ return true;
66
+ }
67
+ if (width.value === 0) {
68
+ return true;
69
+ }
70
+ return isTransparentOrUndefined(color.value) && color.value !== undefined;
71
+ };
72
+ const isBorderRadiusInactive = (propStatuses) => {
73
+ const shorthandStatus = propStatuses === null || propStatuses === void 0 ? void 0 : propStatuses[BORDER_RADIUS_SHORTHAND_KEY];
74
+ if (shorthandStatus && shorthandStatus.status !== 'static') {
75
+ return false;
76
+ }
77
+ if ((shorthandStatus === null || shorthandStatus === void 0 ? void 0 : shorthandStatus.codeValue) !== undefined) {
78
+ return shorthandStatus.codeValue === 0;
79
+ }
80
+ return hasOnlyStaticZeroValues({
81
+ keys: BORDER_RADIUS_LONGHAND_KEYS,
82
+ propStatuses,
83
+ });
84
+ };
85
+ const isLayoutInactive = ({ propStatuses, schema, }) => {
86
+ if (!schema) {
87
+ return false;
88
+ }
89
+ const flatSchema = remotion_1.Internals.getFlatSchemaWithAllKeys(schema);
90
+ const layoutKeys = LAYOUT_KEYS.filter((key) => flatSchema[key] !== undefined);
91
+ if (layoutKeys.length === 0) {
92
+ return false;
93
+ }
94
+ return layoutKeys.every((key) => {
95
+ const result = getStaticValue({ key, propStatuses });
96
+ const field = flatSchema[key];
97
+ if (!result.found || !field || field.type === 'hidden') {
98
+ return false;
99
+ }
100
+ const effectiveValue = result.value === undefined ? field.default : result.value;
101
+ return Object.is(effectiveValue, field.default);
102
+ });
103
+ };
104
+ const isInspectorSectionEffectivelyInactive = ({ group, propStatuses, schema, }) => {
105
+ if (group === 'layout') {
106
+ return isLayoutInactive({ propStatuses, schema });
107
+ }
108
+ if (group === 'border') {
109
+ return isBorderInactive(propStatuses);
110
+ }
111
+ if (group === 'border-radius') {
112
+ return isBorderRadiusInactive(propStatuses);
113
+ }
114
+ if (group === 'crop') {
115
+ return hasOnlyStaticZeroValues({ keys: CROP_KEYS, propStatuses });
116
+ }
117
+ const backgroundColor = getStaticValue({
118
+ key: BACKGROUND_COLOR_KEY,
119
+ propStatuses,
120
+ });
121
+ return (backgroundColor.found && isTransparentOrUndefined(backgroundColor.value));
122
+ };
123
+ exports.isInspectorSectionEffectivelyInactive = isInspectorSectionEffectivelyInactive;
124
+ const hasOwnStatus = ({ key, propStatuses, }) => {
125
+ return (propStatuses !== undefined &&
126
+ Object.prototype.hasOwnProperty.call(propStatuses, key));
127
+ };
128
+ const hasEveryStatus = ({ keys, propStatuses, }) => {
129
+ return keys.every((key) => hasOwnStatus({ key, propStatuses }));
130
+ };
131
+ const getInspectorSectionActivity = ({ group, propStatuses, schema, }) => {
132
+ let resolved = false;
133
+ if (group === 'border') {
134
+ resolved = hasEveryStatus({ keys: BORDER_KEYS, propStatuses });
135
+ }
136
+ else if (group === 'border-radius') {
137
+ const shorthandStatus = propStatuses === null || propStatuses === void 0 ? void 0 : propStatuses[BORDER_RADIUS_SHORTHAND_KEY];
138
+ resolved =
139
+ (shorthandStatus !== undefined &&
140
+ (shorthandStatus.status !== 'static' ||
141
+ shorthandStatus.codeValue !== undefined)) ||
142
+ hasEveryStatus({ keys: BORDER_RADIUS_LONGHAND_KEYS, propStatuses });
143
+ }
144
+ else if (group === 'crop') {
145
+ resolved = hasEveryStatus({ keys: CROP_KEYS, propStatuses });
146
+ }
147
+ else if (group === 'layout') {
148
+ const flatSchema = schema
149
+ ? remotion_1.Internals.getFlatSchemaWithAllKeys(schema)
150
+ : undefined;
151
+ const layoutKeys = LAYOUT_KEYS.filter((key) => (flatSchema === null || flatSchema === void 0 ? void 0 : flatSchema[key]) !== undefined);
152
+ resolved =
153
+ layoutKeys.length > 0 && hasEveryStatus({ keys: layoutKeys, propStatuses });
154
+ }
155
+ else {
156
+ resolved = hasOwnStatus({ key: BACKGROUND_COLOR_KEY, propStatuses });
157
+ }
158
+ if (!resolved) {
159
+ return 'unknown';
160
+ }
161
+ return (0, exports.isInspectorSectionEffectivelyInactive)({ group, propStatuses, schema })
162
+ ? 'inactive'
163
+ : 'active';
164
+ };
165
+ exports.getInspectorSectionActivity = getInspectorSectionActivity;
@@ -39,9 +39,11 @@ exports.sequenceHeaderDivider = {
39
39
  };
40
40
  exports.sectionHeader = {
41
41
  color: colors_1.LIGHT_TEXT,
42
+ fontFamily: 'sans-serif',
42
43
  fontSize: 12,
43
44
  fontWeight: 'bold',
44
- padding: `8px ${InspectorPanelLayout_1.INSPECTOR_PANEL_HORIZONTAL_PADDING}px`,
45
+ lineHeight: '24px',
46
+ padding: `4px ${InspectorPanelLayout_1.INSPECTOR_PANEL_HORIZONTAL_PADDING}px`,
45
47
  userSelect: 'none',
46
48
  };
47
49
  exports.inspectorSectionBody = {
@@ -76,11 +78,15 @@ exports.sectionHeaderRow = {
76
78
  minWidth: 0,
77
79
  };
78
80
  exports.sectionHeaderTitle = {
81
+ alignItems: 'center',
79
82
  color: colors_1.LIGHT_TEXT,
83
+ display: 'flex',
80
84
  flexShrink: 0,
85
+ fontFamily: 'sans-serif',
81
86
  fontSize: 12,
82
87
  fontWeight: 'bold',
83
88
  lineHeight: '16px',
89
+ minHeight: 24,
84
90
  minWidth: 0,
85
91
  overflow: 'hidden',
86
92
  textOverflow: 'ellipsis',
@@ -1,8 +1,11 @@
1
1
  export declare const useCompositionActions: () => {
2
2
  canInsertAsset: boolean;
3
+ canInsertComposition: boolean;
3
4
  canInsertSolid: boolean;
4
5
  canShowInsertAsset: boolean;
6
+ canShowInsertComposition: boolean;
5
7
  canShowInsertSolid: boolean;
6
- insertAsset: () => Promise<void>;
8
+ insertAsset: () => void;
9
+ insertComposition: () => void;
7
10
  insertSolid: () => Promise<void>;
8
11
  };