@remotion/studio 4.0.506 → 4.0.508
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FastRefreshProvider.js +13 -9
- package/dist/api/copy-render-output-to-asset.d.ts +4 -0
- package/dist/api/copy-render-output-to-asset.js +11 -0
- package/dist/components/AssetSelector.js +19 -4
- package/dist/components/AssetSelectorItem.js +2 -2
- package/dist/components/CodingAgentIcon.d.ts +6 -0
- package/dist/components/CodingAgentIcon.js +12 -0
- package/dist/components/ConfigureDefaultEditorModal.d.ts +1 -3
- package/dist/components/ConfigureDefaultEditorModal.js +67 -77
- package/dist/components/ConfigureLicenseModal.d.ts +1 -4
- package/dist/components/ConfigureLicenseModal.js +89 -81
- package/dist/components/ContextMenu.d.ts +1 -0
- package/dist/components/ContextMenu.js +42 -13
- package/dist/components/EditorContent.js +4 -3
- package/dist/components/EditorContexts.js +6 -5
- package/dist/components/ExpandedTracksProvider.js +10 -53
- package/dist/components/InlineAction.d.ts +2 -1
- package/dist/components/InlineAction.js +3 -3
- package/dist/components/InspectorLocationCopy.js +8 -8
- package/dist/components/InspectorOpenInEditor.d.ts +2 -0
- package/dist/components/InspectorOpenInEditor.js +81 -50
- package/dist/components/InspectorPanel/AlignmentControls.js +2 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +3 -1
- package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -0
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +22 -4
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +1 -1
- package/dist/components/InspectorPanel/styles.js +1 -1
- package/dist/components/InspectorSequenceSection.js +36 -4
- package/dist/components/Menu/MenuSectionHeader.d.ts +4 -0
- package/dist/components/Menu/MenuSectionHeader.js +20 -0
- package/dist/components/Menu/SubMenu.js +13 -2
- package/dist/components/Menu/menu-tree-context.d.ts +3 -0
- package/dist/components/Menu/menu-tree-context.js +13 -0
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/NewComposition/ComboBox.d.ts +6 -1
- package/dist/components/NewComposition/MenuContent.js +27 -19
- package/dist/components/NewComposition/menu-typeahead.js +2 -2
- package/dist/components/PlayPause.d.ts +1 -1
- package/dist/components/PlayPause.js +61 -12
- package/dist/components/Preview.js +29 -4
- package/dist/components/RenderButton.js +16 -12
- package/dist/components/RenderModal/GuiRenderStatus.js +23 -6
- package/dist/components/RenderModal/InfoBubble.d.ts +1 -0
- package/dist/components/RenderModal/InfoBubble.js +6 -4
- package/dist/components/RenderModal/InfoTooltip.d.ts +1 -0
- package/dist/components/RenderModal/InfoTooltip.js +12 -12
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +5 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +16 -3
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -0
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +8 -3
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +12 -1
- package/dist/components/RenderModal/ServerRenderModal.js +4 -0
- package/dist/components/RenderQueue/RenderQueueItem.js +8 -2
- package/dist/components/RenderQueue/actions.d.ts +4 -2
- package/dist/components/RenderQueue/actions.js +4 -2
- package/dist/components/RenderQueue/index.js +3 -4
- package/dist/components/RenderQueue/use-render-output-file-drag.d.ts +8 -0
- package/dist/components/RenderQueue/use-render-output-file-drag.js +121 -0
- package/dist/components/SegmentedControl.js +0 -1
- package/dist/components/SelectedOutlineCanvasRotation.d.ts +9 -0
- package/dist/components/SelectedOutlineCanvasRotation.js +237 -0
- package/dist/components/SelectedOutlineElement.d.ts +16 -18
- package/dist/components/SelectedOutlineElement.js +144 -931
- package/dist/components/SelectedOutlineKeyboardControls.d.ts +7 -0
- package/dist/components/SelectedOutlineKeyboardControls.js +261 -0
- package/dist/components/SelectedOutlineOverlay.d.ts +7 -14
- package/dist/components/SelectedOutlineOverlay.js +378 -864
- package/dist/components/SelectedOutlinePolygon.d.ts +26 -0
- package/dist/components/SelectedOutlinePolygon.js +360 -0
- package/dist/components/SelectedOutlineRenderer.d.ts +19 -0
- package/dist/components/SelectedOutlineRenderer.js +225 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +17 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.js +271 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +17 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.js +215 -0
- package/dist/components/SelectedOutlineSnapIndicators.d.ts +9 -0
- package/dist/components/SelectedOutlineSnapIndicators.js +29 -0
- package/dist/components/SelectedOutlineTransformOriginHandle.d.ts +9 -0
- package/dist/components/SelectedOutlineTransformOriginHandle.js +312 -0
- package/dist/components/SelectedOutlineUvControls.d.ts +3 -9
- package/dist/components/SelectedOutlineUvControls.js +57 -12
- package/dist/components/SequencePropsSubscriptionProvider.js +8 -0
- package/dist/components/SettingsContext.d.ts +15 -0
- package/dist/components/SettingsContext.js +116 -0
- package/dist/components/SettingsModal.js +10 -4
- package/dist/components/SettingsModalFooter.d.ts +1 -3
- package/dist/components/SettingsModalFooter.js +4 -6
- package/dist/components/ShowOutlinesProvider.js +2 -3
- package/dist/components/Timeline/EasingEditorModal.js +66 -22
- package/dist/components/Timeline/SequencePropsObserver.js +97 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +4 -2
- package/dist/components/Timeline/Timeline.js +22 -5
- package/dist/components/Timeline/TimelineDuplicateCount.d.ts +4 -0
- package/dist/components/Timeline/TimelineDuplicateCount.js +28 -0
- package/dist/components/Timeline/TimelineEffectItem.js +1 -4
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +3 -23
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +4 -2
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +11 -1
- package/dist/components/Timeline/TimelineFieldRowContent.js +10 -3
- package/dist/components/Timeline/TimelineRotationField.js +84 -12
- package/dist/components/Timeline/TimelineScaleField.js +58 -4
- package/dist/components/Timeline/TimelineSelection.d.ts +4 -0
- package/dist/components/Timeline/TimelineSelection.js +45 -2
- package/dist/components/Timeline/TimelineSequence.js +28 -25
- package/dist/components/Timeline/TimelineSequenceItem.js +91 -28
- package/dist/components/Timeline/TimelineSequencePropItem.js +5 -2
- package/dist/components/Timeline/TimelineTrack.js +2 -1
- package/dist/components/Timeline/TimelineTransformOriginField.js +78 -4
- package/dist/components/Timeline/TimelineTranslateField.js +55 -15
- package/dist/components/Timeline/Transform3DModeContext.d.ts +1 -0
- package/dist/components/Timeline/Transform3DModeContext.js +5 -0
- package/dist/components/Timeline/delete-selected-timeline-item.js +0 -6
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +6 -3
- package/dist/components/Timeline/get-sequence-context-menu-items.js +69 -57
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
- package/dist/components/Timeline/sequence-props-subscription-store.js +5 -2
- package/dist/components/Timeline/timeline-field-display-utils.js +2 -2
- package/dist/components/Timeline/timeline-field-row-layout.d.ts +6 -0
- package/dist/components/Timeline/timeline-field-row-layout.js +16 -1
- package/dist/components/Timeline/timeline-rotation-utils.d.ts +16 -0
- package/dist/components/Timeline/timeline-rotation-utils.js +145 -4
- package/dist/components/Timeline/timeline-translate-utils.d.ts +3 -2
- package/dist/components/Timeline/timeline-translate-utils.js +8 -4
- package/dist/components/Timeline/transform-3d-mode.d.ts +6 -0
- package/dist/components/Timeline/transform-3d-mode.js +36 -0
- package/dist/components/Timeline/transform-origin-utils.d.ts +4 -0
- package/dist/components/Timeline/transform-origin-utils.js +12 -6
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +36 -4
- package/dist/components/Timeline/{use-open-sequence-in-editor.d.ts → use-open-sequence-in-apps.d.ts} +4 -1
- package/dist/components/Timeline/{use-open-sequence-in-editor.js → use-open-sequence-in-apps.js} +21 -5
- package/dist/components/Timeline/use-resolved-stack-react-to-change.d.ts +5 -1
- package/dist/components/Timeline/use-resolved-stack-react-to-change.js +45 -9
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -1
- package/dist/components/Timeline/use-sequence-props-subscription.js +7 -2
- package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +4 -0
- package/dist/components/Timeline/use-timeline-expanded-tree.js +45 -1
- package/dist/components/call-api.js +2 -0
- package/dist/components/canvas-rotation-cursor.d.ts +1 -0
- package/dist/components/canvas-rotation-cursor.js +14 -0
- package/dist/components/get-open-in-menu-items.d.ts +17 -0
- package/dist/components/get-open-in-menu-items.js +144 -0
- package/dist/components/selected-outline-drag.d.ts +11 -5
- package/dist/components/selected-outline-drag.js +80 -42
- package/dist/components/selected-outline-measurement.d.ts +7 -2
- package/dist/components/selected-outline-measurement.js +28 -1
- package/dist/components/selected-outline-order.d.ts +12 -0
- package/dist/components/selected-outline-order.js +251 -0
- package/dist/components/selected-outline-types.d.ts +15 -10
- package/dist/components/svg-point-to-client-point.d.ts +2 -0
- package/dist/components/svg-point-to-client-point.js +10 -0
- package/dist/components/use-auto-save-config.d.ts +8 -0
- package/dist/components/use-auto-save-config.js +74 -0
- package/dist/components/use-default-editor-info.d.ts +1 -0
- package/dist/components/use-default-editor-info.js +10 -30
- package/dist/esm/{chunk-jefhcs5z.js → chunk-fgedsvhb.js} +1 -2
- package/dist/esm/{chunk-b49ec3nz.js → chunk-zpn4m49r.js} +12924 -10139
- package/dist/esm/index.mjs +357 -2
- package/dist/esm/internals.mjs +12923 -10138
- package/dist/esm/previewEntry.mjs +12771 -9986
- package/dist/esm/renderEntry.mjs +2 -2
- package/dist/helpers/are-sequence-node-path-infos-equal.d.ts +2 -0
- package/dist/helpers/are-sequence-node-path-infos-equal.js +27 -0
- package/dist/helpers/calculate-timeline.js +3 -3
- package/dist/helpers/client-id.js +8 -1
- package/dist/helpers/format-file-location.d.ts +1 -1
- package/dist/helpers/format-file-location.js +3 -3
- package/dist/helpers/get-box-quads-polyfill-internals.js +10 -2
- package/dist/helpers/migrate-expanded-tracks-for-subscription-key.js +3 -3
- package/dist/helpers/open-in-editor.d.ts +4 -1
- package/dist/helpers/open-in-editor.js +9 -1
- package/dist/helpers/preview-server-events.js +4 -0
- package/dist/helpers/sequence-node-path-mutations.d.ts +4 -0
- package/dist/helpers/sequence-node-path-mutations.js +31 -0
- package/dist/helpers/studio-runtime-config.js +3 -0
- package/dist/helpers/timeline-node-path-key.d.ts +2 -0
- package/dist/helpers/timeline-node-path-key.js +3 -1
- package/dist/helpers/use-asset-drag-events.d.ts +2 -1
- package/dist/helpers/use-asset-drag-events.js +14 -6
- package/dist/helpers/use-menu-structure.js +2 -2
- package/dist/helpers/use-runtime-values.d.ts +1 -3
- package/dist/icons/cube.d.ts +4 -0
- package/dist/icons/cube.js +6 -0
- package/dist/icons/finder.d.ts +4 -0
- package/dist/icons/finder.js +8 -0
- package/dist/icons/terminal.d.ts +6 -0
- package/dist/icons/terminal.js +46 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -0
- package/dist/state/timeline-sequence-hover.d.ts +9 -3
- package/dist/state/timeline-sequence-hover.js +63 -12
- package/dist/state/transform-3d-mode.d.ts +10 -0
- package/dist/state/transform-3d-mode.js +27 -0
- package/dist/state/z-index.js +5 -8
- package/package.json +12 -12
|
@@ -78,12 +78,6 @@ const deleteEffects = (effects) => {
|
|
|
78
78
|
}))
|
|
79
79
|
.then((result) => {
|
|
80
80
|
if (result.success) {
|
|
81
|
-
const singleEffect = effects[0];
|
|
82
|
-
(0, NotificationCenter_1.showNotification)(effects.length === 1 && (singleEffect === null || singleEffect === void 0 ? void 0 : singleEffect.type) === 'single-effect'
|
|
83
|
-
? 'Removed effect from source file'
|
|
84
|
-
: effects.length === 1
|
|
85
|
-
? 'Removed effects from source file'
|
|
86
|
-
: 'Removed effects from source files', 2000);
|
|
87
81
|
return true;
|
|
88
82
|
}
|
|
89
83
|
(0, NotificationCenter_1.showNotification)(result.reason, 4000);
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import type { EditorPickerId, GetDefaultEditorInfoResponse } from '@remotion/studio-shared';
|
|
1
|
+
import type { EditorPickerId, GetDefaultCodingAgentInfoResponse, GetDefaultEditorInfoResponse } from '@remotion/studio-shared';
|
|
2
2
|
import type { ResolvedStackLocation, TSequence } from 'remotion';
|
|
3
3
|
import type { ComboboxValue } from '../NewComposition/ComboBox';
|
|
4
4
|
import type { TimelineAssetLinkInfo } from './timeline-asset-link';
|
|
5
|
-
export declare const getSequenceContextMenuItems: ({ assetLinkInfo, canOpenInEditor, deleteDisabled, disableInteractivityDisabled, duplicateDisabled,
|
|
5
|
+
export declare const getSequenceContextMenuItems: ({ assetLinkInfo, canOpenInEditor, deleteDisabled, disableInteractivityDisabled, duplicateDisabled, isProgrammaticallyDuplicated, includeSourceEditItems, codingAgentInfo, editorInfo, onConfigureApps, onDeleteSequenceFromSource, onDisableSequenceInteractivity, onDuplicateSequenceFromSource, openInCodingAgent, openInEditor, originalLocation, selectAsset, sequence, sourceActions, }: {
|
|
6
6
|
readonly assetLinkInfo: TimelineAssetLinkInfo | null;
|
|
7
7
|
readonly canOpenInEditor: boolean;
|
|
8
8
|
readonly deleteDisabled: boolean;
|
|
9
9
|
readonly disableInteractivityDisabled: boolean;
|
|
10
10
|
readonly duplicateDisabled: boolean;
|
|
11
|
-
readonly
|
|
11
|
+
readonly isProgrammaticallyDuplicated: boolean;
|
|
12
12
|
readonly includeSourceEditItems: boolean;
|
|
13
|
+
readonly codingAgentInfo: GetDefaultCodingAgentInfoResponse | null;
|
|
13
14
|
readonly editorInfo: GetDefaultEditorInfoResponse | null;
|
|
15
|
+
readonly onConfigureApps: (() => void) | null;
|
|
14
16
|
readonly onDeleteSequenceFromSource: () => void;
|
|
15
17
|
readonly onDisableSequenceInteractivity: () => void;
|
|
16
18
|
readonly onDuplicateSequenceFromSource: () => void;
|
|
19
|
+
readonly openInCodingAgent: (codingAgentId: "claude-code" | "codex" | "copilot" | "cursor", codingAgentName: string, contextForAgents: string | null) => void;
|
|
17
20
|
readonly openInEditor: (editorId: EditorPickerId | null) => void;
|
|
18
21
|
readonly originalLocation: ResolvedStackLocation | null;
|
|
19
22
|
readonly selectAsset: (src: string) => void;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSequenceContextMenuItems = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
4
|
const no_react_1 = require("remotion/no-react");
|
|
6
|
-
const
|
|
5
|
+
const format_file_location_1 = require("../../helpers/format-file-location");
|
|
6
|
+
const get_open_in_menu_items_1 = require("../get-open-in-menu-items");
|
|
7
7
|
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
8
|
+
const actions_1 = require("../RenderQueue/actions");
|
|
8
9
|
const timeline_asset_link_1 = require("./timeline-asset-link");
|
|
9
10
|
const normalizeMenuDividers = (items) => {
|
|
10
11
|
var _a;
|
|
@@ -24,13 +25,45 @@ const normalizeMenuDividers = (items) => {
|
|
|
24
25
|
return normalized;
|
|
25
26
|
};
|
|
26
27
|
const interactiveSvgComponentIdentity = 'dev.remotion.remotion.Interactive.Svg';
|
|
27
|
-
const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDisabled, disableInteractivityDisabled, duplicateDisabled,
|
|
28
|
-
var _a, _b;
|
|
29
|
-
var
|
|
28
|
+
const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDisabled, disableInteractivityDisabled, duplicateDisabled, isProgrammaticallyDuplicated, includeSourceEditItems, codingAgentInfo, editorInfo, onConfigureApps, onDeleteSequenceFromSource, onDisableSequenceInteractivity, onDuplicateSequenceFromSource, openInCodingAgent, openInEditor, originalLocation, selectAsset, sequence, sourceActions = [], }) => {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
|
+
var _e, _f, _g;
|
|
30
31
|
const editorName = window.remotion_editorName;
|
|
31
|
-
const { documentationLink } = sequence;
|
|
32
32
|
const isInteractiveSvg = ((_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.componentIdentity) === interactiveSvgComponentIdentity;
|
|
33
|
-
const installedEditors = (
|
|
33
|
+
const installedEditors = (_e = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors) !== null && _e !== void 0 ? _e : [];
|
|
34
|
+
const defaultEditorId = (_f = (_b = installedEditors.find((editor) => editor.nameWithType === editorName)) === null || _b === void 0 ? void 0 : _b.id) !== null && _f !== void 0 ? _f : null;
|
|
35
|
+
const defaultCodingAgent = codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.installedCodingAgents.find((codingAgent) => codingAgent.id === codingAgentInfo.defaultCodingAgent);
|
|
36
|
+
const contextForAgents = (0, format_file_location_1.formatContextForAgents)({
|
|
37
|
+
location: originalLocation,
|
|
38
|
+
name: sequence.displayName || ((_c = sequence.controls) === null || _c === void 0 ? void 0 : _c.componentName) || null,
|
|
39
|
+
root: window.remotion_cwd,
|
|
40
|
+
});
|
|
41
|
+
const openInCodingAgentWithContext = (codingAgentId, codingAgentName) => {
|
|
42
|
+
openInCodingAgent(codingAgentId, codingAgentName, codingAgentId === 'copilot' ? null : contextForAgents);
|
|
43
|
+
};
|
|
44
|
+
const openInMenuItems = onConfigureApps
|
|
45
|
+
? (0, get_open_in_menu_items_1.getOpenInMenuItems)({
|
|
46
|
+
codingAgentInfo,
|
|
47
|
+
editorDisabled: !canOpenInEditor || !originalLocation,
|
|
48
|
+
editorInfo,
|
|
49
|
+
excludeCodingAgentId: (_g = defaultCodingAgent === null || defaultCodingAgent === void 0 ? void 0 : defaultCodingAgent.id) !== null && _g !== void 0 ? _g : null,
|
|
50
|
+
excludeEditorId: defaultEditorId,
|
|
51
|
+
fileManagerDisabled: !(originalLocation === null || originalLocation === void 0 ? void 0 : originalLocation.source),
|
|
52
|
+
folder: false,
|
|
53
|
+
onConfigureApps,
|
|
54
|
+
onOpenInCodingAgent: openInCodingAgentWithContext,
|
|
55
|
+
onOpenInEditor: openInEditor,
|
|
56
|
+
onOpenInFileExplorer: () => {
|
|
57
|
+
if (!(originalLocation === null || originalLocation === void 0 ? void 0 : originalLocation.source)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
(0, actions_1.openInFileExplorer)({ directory: originalLocation.source }).catch((err) => {
|
|
61
|
+
(0, NotificationCenter_1.showNotification)(`Could not open file: ${err.message}`, 2000);
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
onOpenInTerminal: null,
|
|
65
|
+
})
|
|
66
|
+
: [];
|
|
34
67
|
const items = [
|
|
35
68
|
editorName
|
|
36
69
|
? {
|
|
@@ -46,78 +79,57 @@ const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDis
|
|
|
46
79
|
value: 'open-in-editor',
|
|
47
80
|
}
|
|
48
81
|
: null,
|
|
49
|
-
|
|
82
|
+
defaultCodingAgent
|
|
83
|
+
? {
|
|
84
|
+
type: 'item',
|
|
85
|
+
id: 'open-in-default-coding-agent',
|
|
86
|
+
keyHint: null,
|
|
87
|
+
label: `Open in ${defaultCodingAgent.nameWithType}`,
|
|
88
|
+
leftItem: null,
|
|
89
|
+
disabled: false,
|
|
90
|
+
onClick: () => openInCodingAgentWithContext(defaultCodingAgent.id, defaultCodingAgent.nameWithType),
|
|
91
|
+
quickSwitcherLabel: null,
|
|
92
|
+
subMenu: null,
|
|
93
|
+
value: 'open-in-default-coding-agent',
|
|
94
|
+
}
|
|
95
|
+
: null,
|
|
96
|
+
onConfigureApps
|
|
50
97
|
? {
|
|
51
98
|
type: 'item',
|
|
52
|
-
id: 'open-in-another-
|
|
99
|
+
id: 'open-in-another-app',
|
|
53
100
|
keyHint: null,
|
|
54
101
|
label: 'Open in...',
|
|
55
102
|
leftItem: null,
|
|
56
|
-
disabled:
|
|
103
|
+
disabled: false,
|
|
57
104
|
onClick: () => undefined,
|
|
58
105
|
quickSwitcherLabel: null,
|
|
59
106
|
subMenu: {
|
|
60
|
-
items:
|
|
61
|
-
type: 'item',
|
|
62
|
-
id: `open-in-${editor.id}`,
|
|
63
|
-
keyHint: null,
|
|
64
|
-
label: editor.name,
|
|
65
|
-
leftItem: (0, react_1.createElement)(editor_1.EditorIcon, {
|
|
66
|
-
editorId: editor.id,
|
|
67
|
-
size: 18,
|
|
68
|
-
}),
|
|
69
|
-
disabled: false,
|
|
70
|
-
onClick: () => openInEditor(editor.id),
|
|
71
|
-
quickSwitcherLabel: null,
|
|
72
|
-
subMenu: null,
|
|
73
|
-
value: editor.id,
|
|
74
|
-
})),
|
|
107
|
+
items: openInMenuItems,
|
|
75
108
|
leaveLeftSpace: true,
|
|
76
109
|
preselectIndex: false,
|
|
77
110
|
},
|
|
78
|
-
value: 'open-in-another-
|
|
111
|
+
value: 'open-in-another-app',
|
|
79
112
|
}
|
|
80
113
|
: null,
|
|
81
114
|
{
|
|
82
115
|
type: 'item',
|
|
83
|
-
id: 'copy-
|
|
116
|
+
id: 'copy-context-for-agents',
|
|
84
117
|
keyHint: null,
|
|
85
|
-
label: 'Copy
|
|
118
|
+
label: 'Copy context for agents',
|
|
86
119
|
leftItem: null,
|
|
87
|
-
disabled: !
|
|
120
|
+
disabled: !contextForAgents,
|
|
88
121
|
onClick: () => {
|
|
89
|
-
if (!
|
|
122
|
+
if (!contextForAgents) {
|
|
90
123
|
return;
|
|
91
124
|
}
|
|
92
|
-
navigator.clipboard
|
|
93
|
-
.writeText(fileLocation)
|
|
94
|
-
.then(() => {
|
|
95
|
-
(0, NotificationCenter_1.showNotification)('Copied file location to clipboard', 1000);
|
|
96
|
-
})
|
|
97
|
-
.catch((err) => {
|
|
125
|
+
navigator.clipboard.writeText(contextForAgents).catch((err) => {
|
|
98
126
|
(0, NotificationCenter_1.showNotification)(`Could not copy to clipboard: ${err.message}`, 1000);
|
|
99
127
|
});
|
|
100
128
|
},
|
|
101
129
|
quickSwitcherLabel: null,
|
|
102
130
|
subMenu: null,
|
|
103
|
-
value: 'copy-
|
|
131
|
+
value: 'copy-context-for-agents',
|
|
104
132
|
},
|
|
105
|
-
documentationLink
|
|
106
|
-
? {
|
|
107
|
-
type: 'item',
|
|
108
|
-
id: 'open-component-docs',
|
|
109
|
-
keyHint: null,
|
|
110
|
-
label: 'Open component docs',
|
|
111
|
-
leftItem: null,
|
|
112
|
-
disabled: false,
|
|
113
|
-
onClick: () => {
|
|
114
|
-
window.open(documentationLink, '_blank', 'noopener,noreferrer');
|
|
115
|
-
},
|
|
116
|
-
quickSwitcherLabel: null,
|
|
117
|
-
subMenu: null,
|
|
118
|
-
value: 'open-component-docs',
|
|
119
|
-
}
|
|
120
|
-
: null,
|
|
121
133
|
assetLinkInfo
|
|
122
134
|
? {
|
|
123
135
|
type: 'item',
|
|
@@ -134,7 +146,7 @@ const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDis
|
|
|
134
146
|
value: 'show-asset',
|
|
135
147
|
}
|
|
136
148
|
: null,
|
|
137
|
-
|
|
149
|
+
assetLinkInfo
|
|
138
150
|
? {
|
|
139
151
|
type: 'divider',
|
|
140
152
|
id: 'sequence-link-divider',
|
|
@@ -147,7 +159,7 @@ const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDis
|
|
|
147
159
|
keyHint: null,
|
|
148
160
|
label: 'Copy SVG',
|
|
149
161
|
leftItem: null,
|
|
150
|
-
disabled: !((
|
|
162
|
+
disabled: !((_d = sequence.refForOutline) === null || _d === void 0 ? void 0 : _d.current),
|
|
151
163
|
onClick: () => {
|
|
152
164
|
var _a;
|
|
153
165
|
const svg = (_a = sequence.refForOutline) === null || _a === void 0 ? void 0 : _a.current;
|
|
@@ -202,7 +214,7 @@ const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDis
|
|
|
202
214
|
keyHint: null,
|
|
203
215
|
label: 'Duplicate',
|
|
204
216
|
leftItem: null,
|
|
205
|
-
disabled: duplicateDisabled,
|
|
217
|
+
disabled: duplicateDisabled || isProgrammaticallyDuplicated,
|
|
206
218
|
onClick: onDuplicateSequenceFromSource,
|
|
207
219
|
quickSwitcherLabel: null,
|
|
208
220
|
subMenu: null,
|
|
@@ -220,7 +232,7 @@ const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDis
|
|
|
220
232
|
type: 'item',
|
|
221
233
|
id: 'delete-sequence',
|
|
222
234
|
keyHint: null,
|
|
223
|
-
label: 'Delete',
|
|
235
|
+
label: isProgrammaticallyDuplicated ? 'Delete all' : 'Delete',
|
|
224
236
|
leftItem: null,
|
|
225
237
|
disabled: deleteDisabled,
|
|
226
238
|
onClick: onDeleteSequenceFromSource,
|
|
@@ -2,7 +2,7 @@ import type { SequenceNodePath, InteractivitySchema, VideoConfigValues } from 'r
|
|
|
2
2
|
import { subscribeToSequenceProps } from '../sequence-props-api';
|
|
3
3
|
type SubscribeResult = Awaited<ReturnType<typeof subscribeToSequenceProps>>;
|
|
4
4
|
type ApplyResult = (result: SubscribeResult) => void;
|
|
5
|
-
export declare const acquireSequencePropsSubscription: ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, }: {
|
|
5
|
+
export declare const acquireSequencePropsSubscription: ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, stack, }: {
|
|
6
6
|
fileName: string;
|
|
7
7
|
line: number;
|
|
8
8
|
column: number;
|
|
@@ -14,6 +14,7 @@ export declare const acquireSequencePropsSubscription: ({ fileName, line, column
|
|
|
14
14
|
applyOnce: ApplyResult;
|
|
15
15
|
applyEach: ApplyResult;
|
|
16
16
|
videoConfigValues: VideoConfigValues;
|
|
17
|
+
stack: string | null;
|
|
17
18
|
}) => {
|
|
18
19
|
release: () => void;
|
|
19
20
|
};
|
|
@@ -4,9 +4,11 @@ exports.acquireSequencePropsSubscription = void 0;
|
|
|
4
4
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const sequence_props_api_1 = require("../sequence-props-api");
|
|
7
|
-
|
|
7
|
+
// The generated stack distinguishes Fast Refresh instances even when source maps
|
|
8
|
+
// resolve both the old and new JSX nodes to the same line and column.
|
|
9
|
+
const makeKey = ({ fileName, line, column, componentIdentity, sequenceKeys, assetKeys, effectKeys, videoConfigValues, stack, }) => `${fileName}\0${line}\0${column}\0${componentIdentity !== null && componentIdentity !== void 0 ? componentIdentity : ''}\0${sequenceKeys.join('\0')}\0${assetKeys.join('\0')}\0${effectKeys.map((keys) => keys.join('\0')).join('\0\0')}\0${JSON.stringify(videoConfigValues)}\0${stack !== null && stack !== void 0 ? stack : ''}`;
|
|
8
10
|
const entries = new Map();
|
|
9
|
-
const acquireSequencePropsSubscription = ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, }) => {
|
|
11
|
+
const acquireSequencePropsSubscription = ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, stack, }) => {
|
|
10
12
|
const sequenceKeys = (0, studio_shared_1.getAllSchemaKeys)(schema);
|
|
11
13
|
const assetKeys = (0, studio_shared_1.getAssetSchemaKeys)(schema);
|
|
12
14
|
const effectKeys = effects.map((effect) => (0, studio_shared_1.getAllSchemaKeys)(effect));
|
|
@@ -19,6 +21,7 @@ const acquireSequencePropsSubscription = ({ fileName, line, column, schema, comp
|
|
|
19
21
|
assetKeys,
|
|
20
22
|
effectKeys,
|
|
21
23
|
videoConfigValues,
|
|
24
|
+
stack,
|
|
22
25
|
});
|
|
23
26
|
let entry = entries.get(key);
|
|
24
27
|
if (!entry) {
|
|
@@ -150,8 +150,8 @@ const formatTranslateTimelineFieldValueForDisplay = ({ fieldSchema, value, }) =>
|
|
|
150
150
|
if (numericValue !== null) {
|
|
151
151
|
return formatTranslateCoordinateForDisplay(numericValue, decimalPlaces);
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
return (0, timeline_translate_utils_1.serializeTranslate)(
|
|
153
|
+
const translate = (0, timeline_translate_utils_1.parseTranslate)(String(value !== null && value !== void 0 ? value : '0px 0px'));
|
|
154
|
+
return (0, timeline_translate_utils_1.serializeTranslate)(translate, decimalPlaces);
|
|
155
155
|
};
|
|
156
156
|
const formatTransformOriginAxisValueForDisplay = ({ decimalPlaces, unit, value, }) => {
|
|
157
157
|
return `${(0, timeline_field_utils_1.formatTimelineNumber)({
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import { type SchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
3
|
+
export declare const isTimelineFieldStacked: ({ field, transform3DMode, }: {
|
|
4
|
+
readonly field: SchemaFieldInfo;
|
|
5
|
+
readonly transform3DMode: boolean;
|
|
6
|
+
}) => boolean;
|
|
2
7
|
export declare const getTimelineFieldLabelRowStyle: (depth: number, basePadding?: number | undefined) => React.CSSProperties;
|
|
3
8
|
export declare const timelineFieldValueColumnStyle: React.CSSProperties;
|
|
9
|
+
export declare const timelineCompactStackedFieldValueColumnStyle: React.CSSProperties;
|
|
4
10
|
export declare const timelineStackedFieldContentStyle: React.CSSProperties;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.timelineStackedFieldContentStyle = exports.timelineFieldValueColumnStyle = exports.getTimelineFieldLabelRowStyle = void 0;
|
|
3
|
+
exports.timelineStackedFieldContentStyle = exports.timelineCompactStackedFieldValueColumnStyle = exports.timelineFieldValueColumnStyle = exports.getTimelineFieldLabelRowStyle = exports.isTimelineFieldStacked = void 0;
|
|
4
4
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
5
5
|
const timeline_row_layout_1 = require("./timeline-row-layout");
|
|
6
|
+
const isTimelineFieldStacked = ({ field, transform3DMode, }) => {
|
|
7
|
+
return (field.typeName === 'text-content' ||
|
|
8
|
+
(transform3DMode &&
|
|
9
|
+
(field.typeName === 'translate' ||
|
|
10
|
+
field.typeName === 'rotation-css' ||
|
|
11
|
+
field.typeName === 'scale' ||
|
|
12
|
+
field.typeName === 'transform-origin')));
|
|
13
|
+
};
|
|
14
|
+
exports.isTimelineFieldStacked = isTimelineFieldStacked;
|
|
6
15
|
const getTimelineFieldLabelRowStyle = (depth, basePadding) => {
|
|
7
16
|
return {
|
|
8
17
|
flex: `0 0 ${(0, timeline_row_layout_1.getTimelineFieldLabelFlexBasis)(depth, basePadding)}`,
|
|
@@ -22,6 +31,12 @@ exports.timelineFieldValueColumnStyle = {
|
|
|
22
31
|
minWidth: 0,
|
|
23
32
|
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
24
33
|
};
|
|
34
|
+
exports.timelineCompactStackedFieldValueColumnStyle = {
|
|
35
|
+
...exports.timelineFieldValueColumnStyle,
|
|
36
|
+
marginBottom: -2,
|
|
37
|
+
position: 'relative',
|
|
38
|
+
top: -2,
|
|
39
|
+
};
|
|
25
40
|
exports.timelineStackedFieldContentStyle = {
|
|
26
41
|
alignSelf: 'stretch',
|
|
27
42
|
display: 'flex',
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
+
export type ParsedCssRotation = {
|
|
2
|
+
readonly axis: readonly [number, number, number];
|
|
3
|
+
readonly degrees: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const parseCssRotation: (value: string) => ParsedCssRotation | null;
|
|
1
6
|
export declare const parseCssRotationToDegrees: (value: string) => number;
|
|
7
|
+
export type CssRotationEuler = readonly [number, number, number];
|
|
8
|
+
export declare const parseCssRotationToEuler: (value: string) => CssRotationEuler;
|
|
9
|
+
export declare const serializeCssRotation3d: ({ axis, degrees, decimalPlaces, }: {
|
|
10
|
+
readonly axis: readonly [number, number, number];
|
|
11
|
+
readonly degrees: number;
|
|
12
|
+
readonly decimalPlaces?: number | undefined;
|
|
13
|
+
}) => string;
|
|
14
|
+
export declare const serializeCssRotationFromEuler: ({ rotation, decimalPlaces, }: {
|
|
15
|
+
readonly rotation: CssRotationEuler;
|
|
16
|
+
readonly decimalPlaces?: number | undefined;
|
|
17
|
+
}) => string;
|
|
2
18
|
export declare const serializeCssRotation: (value: number, decimalPlaces?: number) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serializeCssRotation = exports.parseCssRotationToDegrees = void 0;
|
|
3
|
+
exports.serializeCssRotation = exports.serializeCssRotationFromEuler = exports.serializeCssRotation3d = exports.parseCssRotationToEuler = exports.parseCssRotationToDegrees = exports.parseCssRotation = void 0;
|
|
4
4
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
5
5
|
const unitPattern = /^([+-]?(?:\d+\.?\d*|\.\d+))(deg|rad|turn|grad)$/;
|
|
6
6
|
const unitToDegrees = {
|
|
@@ -9,10 +9,54 @@ const unitToDegrees = {
|
|
|
9
9
|
turn: 360,
|
|
10
10
|
grad: 360 / 400,
|
|
11
11
|
};
|
|
12
|
+
const parseCssRotation = (value) => {
|
|
13
|
+
const trimmed = value.trim();
|
|
14
|
+
const bareAngle = trimmed.match(unitPattern);
|
|
15
|
+
if (bareAngle) {
|
|
16
|
+
return {
|
|
17
|
+
axis: [0, 0, 1],
|
|
18
|
+
degrees: (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(bareAngle[1]) * unitToDegrees[bareAngle[2]]),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const keywordAxis = /^(x|y|z)\s+(.+)$/i.exec(trimmed);
|
|
22
|
+
if (keywordAxis) {
|
|
23
|
+
const keywordAngle = keywordAxis[2].match(unitPattern);
|
|
24
|
+
if (!keywordAngle) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const keywordAxisName = keywordAxis[1].toLowerCase();
|
|
28
|
+
return {
|
|
29
|
+
axis: keywordAxisName === 'x'
|
|
30
|
+
? [1, 0, 0]
|
|
31
|
+
: keywordAxisName === 'y'
|
|
32
|
+
? [0, 1, 0]
|
|
33
|
+
: [0, 0, 1],
|
|
34
|
+
degrees: (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(keywordAngle[1]) * unitToDegrees[keywordAngle[2]]),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const vectorAxis = /^(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/.exec(trimmed);
|
|
38
|
+
if (!vectorAxis) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const vectorAxisComponents = [
|
|
42
|
+
Number(vectorAxis[1]),
|
|
43
|
+
Number(vectorAxis[2]),
|
|
44
|
+
Number(vectorAxis[3]),
|
|
45
|
+
];
|
|
46
|
+
const vectorAngle = vectorAxis[4].match(unitPattern);
|
|
47
|
+
if (!vectorAxisComponents.every(Number.isFinite) || !vectorAngle) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
axis: vectorAxisComponents,
|
|
52
|
+
degrees: (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(vectorAngle[1]) * unitToDegrees[vectorAngle[2]]),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
exports.parseCssRotation = parseCssRotation;
|
|
12
56
|
const parseCssRotationToDegrees = (value) => {
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
return
|
|
57
|
+
const parsed = (0, exports.parseCssRotation)(value);
|
|
58
|
+
if (parsed) {
|
|
59
|
+
return parsed.degrees;
|
|
16
60
|
}
|
|
17
61
|
if (typeof DOMMatrix === 'undefined') {
|
|
18
62
|
return 0;
|
|
@@ -26,6 +70,103 @@ const parseCssRotationToDegrees = (value) => {
|
|
|
26
70
|
}
|
|
27
71
|
};
|
|
28
72
|
exports.parseCssRotationToDegrees = parseCssRotationToDegrees;
|
|
73
|
+
const parseCssRotationToEuler = (value) => {
|
|
74
|
+
const parsed = (0, exports.parseCssRotation)(value);
|
|
75
|
+
if (parsed === null) {
|
|
76
|
+
return [0, 0, (0, exports.parseCssRotationToDegrees)(value)];
|
|
77
|
+
}
|
|
78
|
+
const [axisX, axisY, axisZ] = parsed.axis;
|
|
79
|
+
if (parsed.degrees === 0) {
|
|
80
|
+
return [0, 0, 0];
|
|
81
|
+
}
|
|
82
|
+
if (axisY === 0 && axisZ === 0 && axisX !== 0) {
|
|
83
|
+
return [Math.sign(axisX) * parsed.degrees, 0, 0];
|
|
84
|
+
}
|
|
85
|
+
if (axisX === 0 && axisZ === 0 && axisY !== 0) {
|
|
86
|
+
return [0, Math.sign(axisY) * parsed.degrees, 0];
|
|
87
|
+
}
|
|
88
|
+
if (axisX === 0 && axisY === 0 && axisZ !== 0) {
|
|
89
|
+
return [0, 0, Math.sign(axisZ) * parsed.degrees];
|
|
90
|
+
}
|
|
91
|
+
const axisLength = Math.hypot(axisX, axisY, axisZ);
|
|
92
|
+
if (axisLength === 0) {
|
|
93
|
+
return [0, 0, 0];
|
|
94
|
+
}
|
|
95
|
+
const halfAngle = (parsed.degrees * Math.PI) / 360;
|
|
96
|
+
const sinHalfAngle = Math.sin(halfAngle);
|
|
97
|
+
const quaternionX = (axisX / axisLength) * sinHalfAngle;
|
|
98
|
+
const quaternionY = (axisY / axisLength) * sinHalfAngle;
|
|
99
|
+
const quaternionZ = (axisZ / axisLength) * sinHalfAngle;
|
|
100
|
+
const quaternionW = Math.cos(halfAngle);
|
|
101
|
+
// Decompose the rotation using the same X → Y → Z order used when serializing.
|
|
102
|
+
const matrix11 = 1 - 2 * (quaternionY * quaternionY + quaternionZ * quaternionZ);
|
|
103
|
+
const matrix12 = 2 * (quaternionX * quaternionY - quaternionZ * quaternionW);
|
|
104
|
+
const matrix13 = 2 * (quaternionX * quaternionZ + quaternionY * quaternionW);
|
|
105
|
+
const matrix22 = 1 - 2 * (quaternionX * quaternionX + quaternionZ * quaternionZ);
|
|
106
|
+
const matrix23 = 2 * (quaternionY * quaternionZ - quaternionX * quaternionW);
|
|
107
|
+
const matrix32 = 2 * (quaternionY * quaternionZ + quaternionX * quaternionW);
|
|
108
|
+
const matrix33 = 1 - 2 * (quaternionX * quaternionX + quaternionY * quaternionY);
|
|
109
|
+
const clampedMatrix13 = Math.max(-1, Math.min(1, matrix13));
|
|
110
|
+
const rotationY = Math.asin(clampedMatrix13);
|
|
111
|
+
const rotationX = Math.abs(clampedMatrix13) < 0.9999999
|
|
112
|
+
? Math.atan2(-matrix23, matrix33)
|
|
113
|
+
: Math.atan2(matrix32, matrix22);
|
|
114
|
+
const rotationZ = Math.abs(clampedMatrix13) < 0.9999999 ? Math.atan2(-matrix12, matrix11) : 0;
|
|
115
|
+
return [rotationX, rotationY, rotationZ].map((rotation) => (0, timeline_field_utils_1.normalizeTimelineNumber)(rotation * (180 / Math.PI)));
|
|
116
|
+
};
|
|
117
|
+
exports.parseCssRotationToEuler = parseCssRotationToEuler;
|
|
118
|
+
const serializeCssRotation3d = ({ axis, degrees, decimalPlaces = 6, }) => {
|
|
119
|
+
const factor = 10 ** decimalPlaces;
|
|
120
|
+
const values = [...axis, degrees].map((value) => {
|
|
121
|
+
const rounded = Math.round((0, timeline_field_utils_1.normalizeTimelineNumber)(value) * factor) / factor;
|
|
122
|
+
return Object.is(rounded, -0) ? 0 : rounded;
|
|
123
|
+
});
|
|
124
|
+
return `${values[0]} ${values[1]} ${values[2]} ${values[3]}deg`;
|
|
125
|
+
};
|
|
126
|
+
exports.serializeCssRotation3d = serializeCssRotation3d;
|
|
127
|
+
const serializeCssRotationFromEuler = ({ rotation, decimalPlaces = 6, }) => {
|
|
128
|
+
const [rotationX, rotationY, rotationZ] = rotation.map((value) => (0, timeline_field_utils_1.normalizeTimelineNumber)(value));
|
|
129
|
+
if (rotationY === 0 && rotationZ === 0) {
|
|
130
|
+
return rotationX === 0
|
|
131
|
+
? (0, exports.serializeCssRotation)(0, decimalPlaces)
|
|
132
|
+
: `x ${(0, exports.serializeCssRotation)(rotationX, decimalPlaces)}`;
|
|
133
|
+
}
|
|
134
|
+
if (rotationX === 0 && rotationZ === 0) {
|
|
135
|
+
return `y ${(0, exports.serializeCssRotation)(rotationY, decimalPlaces)}`;
|
|
136
|
+
}
|
|
137
|
+
if (rotationX === 0 && rotationY === 0) {
|
|
138
|
+
return (0, exports.serializeCssRotation)(rotationZ, decimalPlaces);
|
|
139
|
+
}
|
|
140
|
+
const halfRotationX = (rotationX * Math.PI) / 360;
|
|
141
|
+
const halfRotationY = (rotationY * Math.PI) / 360;
|
|
142
|
+
const halfRotationZ = (rotationZ * Math.PI) / 360;
|
|
143
|
+
const sinX = Math.sin(halfRotationX);
|
|
144
|
+
const cosX = Math.cos(halfRotationX);
|
|
145
|
+
const sinY = Math.sin(halfRotationY);
|
|
146
|
+
const cosY = Math.cos(halfRotationY);
|
|
147
|
+
const sinZ = Math.sin(halfRotationZ);
|
|
148
|
+
const cosZ = Math.cos(halfRotationZ);
|
|
149
|
+
// Compose the three editable angles into the axis-angle form CSS rotate accepts.
|
|
150
|
+
const quaternionX = sinX * cosY * cosZ + cosX * sinY * sinZ;
|
|
151
|
+
const quaternionY = cosX * sinY * cosZ - sinX * cosY * sinZ;
|
|
152
|
+
const quaternionZ = cosX * cosY * sinZ + sinX * sinY * cosZ;
|
|
153
|
+
const quaternionW = cosX * cosY * cosZ - sinX * sinY * sinZ;
|
|
154
|
+
const angle = 2 * Math.acos(Math.max(-1, Math.min(1, quaternionW)));
|
|
155
|
+
const sinHalfAngle = Math.sqrt(Math.max(0, 1 - quaternionW * quaternionW));
|
|
156
|
+
if (sinHalfAngle < 0.0000001) {
|
|
157
|
+
return (0, exports.serializeCssRotation)(0, decimalPlaces);
|
|
158
|
+
}
|
|
159
|
+
return (0, exports.serializeCssRotation3d)({
|
|
160
|
+
axis: [
|
|
161
|
+
quaternionX / sinHalfAngle,
|
|
162
|
+
quaternionY / sinHalfAngle,
|
|
163
|
+
quaternionZ / sinHalfAngle,
|
|
164
|
+
],
|
|
165
|
+
degrees: angle * (180 / Math.PI),
|
|
166
|
+
decimalPlaces,
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
exports.serializeCssRotationFromEuler = serializeCssRotationFromEuler;
|
|
29
170
|
const serializeCssRotation = (value, decimalPlaces = 6) => {
|
|
30
171
|
const factor = 10 ** decimalPlaces;
|
|
31
172
|
const rounded = Math.round((0, timeline_field_utils_1.normalizeTimelineNumber)(value) * factor) / factor;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const
|
|
1
|
+
export type ParsedTranslate = readonly [number, number, number | null];
|
|
2
|
+
export declare const parseTranslate: (value: string) => ParsedTranslate;
|
|
3
|
+
export declare const serializeTranslate: ([x, y, z]: ParsedTranslate, decimalPlaces?: number) => string;
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.serializeTranslate = exports.parseTranslate = void 0;
|
|
4
4
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
5
|
-
const PIXEL_PATTERN = /^(-?\d+(?:\.\d+)?)px(?:\s+(-?\d+(?:\.\d+)?)px)?$/;
|
|
5
|
+
const PIXEL_PATTERN = /^(-?\d+(?:\.\d+)?)px(?:\s+(-?\d+(?:\.\d+)?)px)?(?:\s+(-?\d+(?:\.\d+)?)px)?$/;
|
|
6
6
|
const translateDecimalPlaces = 1;
|
|
7
7
|
const parseTranslate = (value) => {
|
|
8
8
|
const m = value.match(PIXEL_PATTERN);
|
|
9
9
|
if (!m) {
|
|
10
|
-
return [0, 0];
|
|
10
|
+
return [0, 0, null];
|
|
11
11
|
}
|
|
12
12
|
return [
|
|
13
13
|
(0, timeline_field_utils_1.normalizeTimelineNumber)(Number(m[1])),
|
|
14
14
|
m[2] !== undefined ? (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(m[2])) : 0,
|
|
15
|
+
m[3] !== undefined ? (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(m[3])) : null,
|
|
15
16
|
];
|
|
16
17
|
};
|
|
17
18
|
exports.parseTranslate = parseTranslate;
|
|
@@ -20,7 +21,10 @@ const formatTranslateCoordinate = (value, decimalPlaces) => {
|
|
|
20
21
|
const rounded = (0, timeline_field_utils_1.roundToDecimalPlaces)(normalized, decimalPlaces);
|
|
21
22
|
return String(Object.is(rounded, -0) ? 0 : rounded);
|
|
22
23
|
};
|
|
23
|
-
const serializeTranslate = (x, y, decimalPlaces = translateDecimalPlaces) => {
|
|
24
|
-
|
|
24
|
+
const serializeTranslate = ([x, y, z], decimalPlaces = translateDecimalPlaces) => {
|
|
25
|
+
const xy = `${formatTranslateCoordinate(x, decimalPlaces)}px ${formatTranslateCoordinate(y, decimalPlaces)}px`;
|
|
26
|
+
return z === null
|
|
27
|
+
? xy
|
|
28
|
+
: `${xy} ${formatTranslateCoordinate(z, decimalPlaces)}px`;
|
|
25
29
|
};
|
|
26
30
|
exports.serializeTranslate = serializeTranslate;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CanUpdateSequencePropStatus } from 'remotion';
|
|
2
|
+
export declare const propStatusHas3DTransformValue: ({ fieldKey, propStatus, runtimeValue, }: {
|
|
3
|
+
readonly fieldKey: string;
|
|
4
|
+
readonly propStatus: CanUpdateSequencePropStatus | undefined;
|
|
5
|
+
readonly runtimeValue: unknown;
|
|
6
|
+
}) => boolean;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propStatusHas3DTransformValue = void 0;
|
|
4
|
+
const no_react_1 = require("remotion/no-react");
|
|
5
|
+
const timeline_rotation_utils_1 = require("./timeline-rotation-utils");
|
|
6
|
+
const timeline_translate_utils_1 = require("./timeline-translate-utils");
|
|
7
|
+
const transform_origin_utils_1 = require("./transform-origin-utils");
|
|
8
|
+
const has3DTransformValue = ({ fieldKey, value, }) => {
|
|
9
|
+
if (fieldKey === 'style.scale') {
|
|
10
|
+
return no_react_1.NoReactInternals.parseScaleValue(value)[2] !== 1;
|
|
11
|
+
}
|
|
12
|
+
if (fieldKey === 'style.rotate') {
|
|
13
|
+
const rotation = (0, timeline_rotation_utils_1.parseCssRotationToEuler)(String(value !== null && value !== void 0 ? value : '0deg'));
|
|
14
|
+
return rotation[0] !== 0 || rotation[1] !== 0;
|
|
15
|
+
}
|
|
16
|
+
if (fieldKey === 'style.translate') {
|
|
17
|
+
const z = (0, timeline_translate_utils_1.parseTranslate)(String(value !== null && value !== void 0 ? value : '0px 0px'))[2];
|
|
18
|
+
return z !== null && z !== 0;
|
|
19
|
+
}
|
|
20
|
+
if (fieldKey === 'style.transformOrigin') {
|
|
21
|
+
const parsed = (0, transform_origin_utils_1.parseTransformOrigin)(value);
|
|
22
|
+
const z = (parsed === null || parsed === void 0 ? void 0 : parsed.z) ? (0, transform_origin_utils_1.parseTransformOriginZ)(parsed.z) : null;
|
|
23
|
+
return z !== null && z.value !== 0;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
const propStatusHas3DTransformValue = ({ fieldKey, propStatus, runtimeValue, }) => {
|
|
28
|
+
if ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed') {
|
|
29
|
+
return propStatus.keyframes.some((keyframe) => has3DTransformValue({ fieldKey, value: keyframe.value }));
|
|
30
|
+
}
|
|
31
|
+
return has3DTransformValue({
|
|
32
|
+
fieldKey,
|
|
33
|
+
value: (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static' ? propStatus.codeValue : runtimeValue,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.propStatusHas3DTransformValue = propStatusHas3DTransformValue;
|
|
@@ -8,6 +8,10 @@ export type ParsedTransformOrigin = {
|
|
|
8
8
|
readonly y: TransformOriginAxisValue;
|
|
9
9
|
readonly z: string | null;
|
|
10
10
|
};
|
|
11
|
+
export declare const parseTransformOriginZ: (token: string) => {
|
|
12
|
+
readonly value: number;
|
|
13
|
+
readonly unit: string;
|
|
14
|
+
} | null;
|
|
11
15
|
export declare const parseTransformOrigin: (value: unknown) => ParsedTransformOrigin | null;
|
|
12
16
|
export declare const axisValueToUv: (axis: TransformOriginAxisValue, size: number) => number | null;
|
|
13
17
|
export declare const parsedTransformOriginToUv: ({ parsed, width, height, }: {
|