@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
|
@@ -0,0 +1,312 @@
|
|
|
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.SelectedOutlineTransformOriginHandle = 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 no_react_1 = require("remotion/no-react");
|
|
41
|
+
const colors_1 = require("../helpers/colors");
|
|
42
|
+
const pointer_session_1 = require("../helpers/pointer-session");
|
|
43
|
+
const editor_snapping_1 = require("../state/editor-snapping");
|
|
44
|
+
const ForceSpecificCursor_1 = require("./ForceSpecificCursor");
|
|
45
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
46
|
+
const selected_outline_drag_1 = require("./selected-outline-drag");
|
|
47
|
+
const selected_outline_measurement_1 = require("./selected-outline-measurement");
|
|
48
|
+
const selected_outline_types_1 = require("./selected-outline-types");
|
|
49
|
+
const selected_outline_uv_1 = require("./selected-outline-uv");
|
|
50
|
+
const call_add_keyframe_1 = require("./Timeline/call-add-keyframe");
|
|
51
|
+
const save_sequence_prop_1 = require("./Timeline/save-sequence-prop");
|
|
52
|
+
const timeline_rotation_utils_1 = require("./Timeline/timeline-rotation-utils");
|
|
53
|
+
const timeline_translate_utils_1 = require("./Timeline/timeline-translate-utils");
|
|
54
|
+
const transform_origin_utils_1 = require("./Timeline/transform-origin-utils");
|
|
55
|
+
const SelectedOutlineTransformOriginHandle = ({ getLatestTargetByKey, layoutTarget, outline, onDraggingChange }) => {
|
|
56
|
+
var _a, _b, _c;
|
|
57
|
+
const { setDragOverrides, clearDragOverrides, setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
58
|
+
const { editorSnapping } = (0, react_1.useContext)(editor_snapping_1.EditorSnappingContext);
|
|
59
|
+
const target = (layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.selectedForTransformOrigin) ||
|
|
60
|
+
(layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.selectedForRotation)
|
|
61
|
+
? getLatestTargetByKey(layoutTarget.key)
|
|
62
|
+
: undefined;
|
|
63
|
+
const transformOriginDrag = (_a = target === null || target === void 0 ? void 0 : target.transformOriginDrag) !== null && _a !== void 0 ? _a : null;
|
|
64
|
+
const transformOriginValue = (_b = transformOriginDrag === null || transformOriginDrag === void 0 ? void 0 : transformOriginDrag.originValue) !== null && _b !== void 0 ? _b : ((layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.selectedForRotation)
|
|
65
|
+
? layoutTarget.transformOriginValue
|
|
66
|
+
: null);
|
|
67
|
+
const crop = target === null || target === void 0 ? void 0 : target.crop;
|
|
68
|
+
const transformOriginPoints = (_c = outline.uncroppedPoints) !== null && _c !== void 0 ? _c : outline.points;
|
|
69
|
+
const parsed = (0, react_1.useMemo)(() => transformOriginValue === null
|
|
70
|
+
? null
|
|
71
|
+
: (0, transform_origin_utils_1.parseTransformOrigin)(transformOriginValue), [transformOriginValue]);
|
|
72
|
+
const uv = (0, react_1.useMemo)(() => {
|
|
73
|
+
if (parsed === null || outline.dimensions === null) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return (0, transform_origin_utils_1.parsedTransformOriginToUv)({
|
|
77
|
+
parsed,
|
|
78
|
+
width: outline.dimensions.width,
|
|
79
|
+
height: outline.dimensions.height,
|
|
80
|
+
});
|
|
81
|
+
}, [outline.dimensions, parsed]);
|
|
82
|
+
const position = (0, react_1.useMemo)(() => {
|
|
83
|
+
if (layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.selectedForRotation) {
|
|
84
|
+
return (0, selected_outline_measurement_1.getSelectedOutlineRotationPivot)({
|
|
85
|
+
dimensions: outline.dimensions,
|
|
86
|
+
points: transformOriginPoints,
|
|
87
|
+
transformOriginValue: layoutTarget.transformOriginValue,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return uv === null ? null : (0, selected_outline_uv_1.getUvHandlePosition)(transformOriginPoints, uv);
|
|
91
|
+
}, [
|
|
92
|
+
layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.selectedForRotation,
|
|
93
|
+
layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.transformOriginValue,
|
|
94
|
+
outline.dimensions,
|
|
95
|
+
transformOriginPoints,
|
|
96
|
+
uv,
|
|
97
|
+
]);
|
|
98
|
+
const onPointerDown = react_1.default.useCallback((event) => {
|
|
99
|
+
if (event.button !== 0 ||
|
|
100
|
+
transformOriginDrag === null ||
|
|
101
|
+
parsed === null ||
|
|
102
|
+
uv === null ||
|
|
103
|
+
outline.dimensions === null) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
event.stopPropagation();
|
|
108
|
+
const svg = event.currentTarget.ownerSVGElement;
|
|
109
|
+
if (svg === null) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const rotation = (0, timeline_rotation_utils_1.parseCssRotation)(transformOriginDrag.rotateValue);
|
|
113
|
+
if (rotation === null) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const { dimensions } = outline;
|
|
117
|
+
if (dimensions === null) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const scale = no_react_1.NoReactInternals.parseScaleValue(transformOriginDrag.scaleValue);
|
|
121
|
+
const startTranslate = (0, timeline_translate_utils_1.parseTranslate)(transformOriginDrag.translateValue);
|
|
122
|
+
const svgRect = svg.getBoundingClientRect();
|
|
123
|
+
let last = null;
|
|
124
|
+
let currentPointerX = event.clientX;
|
|
125
|
+
let currentPointerY = event.clientY;
|
|
126
|
+
let axisLocked = event.shiftKey;
|
|
127
|
+
onDraggingChange(true);
|
|
128
|
+
(0, ForceSpecificCursor_1.forceSpecificCursor)('crosshair');
|
|
129
|
+
const updateFromPointerPosition = () => {
|
|
130
|
+
const point = {
|
|
131
|
+
x: currentPointerX - svgRect.left,
|
|
132
|
+
y: currentPointerY - svgRect.top,
|
|
133
|
+
};
|
|
134
|
+
const rawUv = (0, selected_outline_uv_1.getUvCoordinateForPoint)(transformOriginPoints, point);
|
|
135
|
+
const lockedAxis = (0, selected_outline_drag_1.getSelectedOutlineTransformOriginLockedAxis)({
|
|
136
|
+
axisLocked,
|
|
137
|
+
dimensions,
|
|
138
|
+
startUv: uv,
|
|
139
|
+
uv: rawUv,
|
|
140
|
+
});
|
|
141
|
+
const axisLockedUv = (0, selected_outline_drag_1.applySelectedOutlineTransformOriginAxisLock)({
|
|
142
|
+
lockedAxis,
|
|
143
|
+
startUv: uv,
|
|
144
|
+
uv: rawUv,
|
|
145
|
+
});
|
|
146
|
+
const snapPoint = lockedAxis === null
|
|
147
|
+
? point
|
|
148
|
+
: (0, selected_outline_uv_1.getUvHandlePosition)(transformOriginPoints, axisLockedUv);
|
|
149
|
+
const snappedUv = editorSnapping
|
|
150
|
+
? (0, selected_outline_drag_1.snapSelectedOutlineTransformOriginUv)({
|
|
151
|
+
crop: crop !== null && crop !== void 0 ? crop : null,
|
|
152
|
+
point: snapPoint,
|
|
153
|
+
points: transformOriginPoints,
|
|
154
|
+
thresholdPx: null,
|
|
155
|
+
uv: axisLockedUv,
|
|
156
|
+
})
|
|
157
|
+
: axisLockedUv;
|
|
158
|
+
const nextUv = (0, selected_outline_drag_1.applySelectedOutlineTransformOriginAxisLock)({
|
|
159
|
+
lockedAxis,
|
|
160
|
+
startUv: uv,
|
|
161
|
+
uv: snappedUv,
|
|
162
|
+
});
|
|
163
|
+
const deltaOrigin = [
|
|
164
|
+
(nextUv[0] - uv[0]) * dimensions.width,
|
|
165
|
+
(nextUv[1] - uv[1]) * dimensions.height,
|
|
166
|
+
];
|
|
167
|
+
const [nextTranslateX, nextTranslateY] = (0, selected_outline_drag_1.compensateTranslateForTransformOrigin)({
|
|
168
|
+
startTranslate: [startTranslate[0], startTranslate[1]],
|
|
169
|
+
deltaOrigin,
|
|
170
|
+
rotation,
|
|
171
|
+
scale,
|
|
172
|
+
});
|
|
173
|
+
const origin = (0, transform_origin_utils_1.serializeTransformOrigin)({
|
|
174
|
+
uv: nextUv,
|
|
175
|
+
z: parsed.z,
|
|
176
|
+
});
|
|
177
|
+
const translate = (0, timeline_translate_utils_1.serializeTranslate)([
|
|
178
|
+
nextTranslateX,
|
|
179
|
+
nextTranslateY,
|
|
180
|
+
startTranslate[2],
|
|
181
|
+
]);
|
|
182
|
+
last = { uv: nextUv, origin, translate };
|
|
183
|
+
setDragOverrides(transformOriginDrag.nodePath, selected_outline_types_1.transformOriginFieldKey, transformOriginDrag.originPropStatus.status === 'keyframed'
|
|
184
|
+
? remotion_1.Internals.makeKeyframedDragOverride({
|
|
185
|
+
status: transformOriginDrag.originPropStatus,
|
|
186
|
+
frame: transformOriginDrag.sourceFrame,
|
|
187
|
+
value: origin,
|
|
188
|
+
})
|
|
189
|
+
: remotion_1.Internals.makeStaticDragOverride(origin));
|
|
190
|
+
setDragOverrides(transformOriginDrag.nodePath, selected_outline_types_1.translateFieldKey, transformOriginDrag.translatePropStatus.status === 'keyframed'
|
|
191
|
+
? transformOriginDrag.originPropStatus.status === 'keyframed'
|
|
192
|
+
? remotion_1.Internals.makeKeyframedDragOverride({
|
|
193
|
+
status: transformOriginDrag.translatePropStatus,
|
|
194
|
+
frame: transformOriginDrag.sourceFrame,
|
|
195
|
+
value: translate,
|
|
196
|
+
})
|
|
197
|
+
: {
|
|
198
|
+
type: 'keyframed',
|
|
199
|
+
status: {
|
|
200
|
+
...transformOriginDrag.translatePropStatus,
|
|
201
|
+
keyframes: transformOriginDrag.translatePropStatus.keyframes.map((keyframe) => {
|
|
202
|
+
const keyframeTranslate = (0, timeline_translate_utils_1.parseTranslate)(String(keyframe.value));
|
|
203
|
+
return {
|
|
204
|
+
...keyframe,
|
|
205
|
+
value: (0, timeline_translate_utils_1.serializeTranslate)([
|
|
206
|
+
keyframeTranslate[0] +
|
|
207
|
+
nextTranslateX -
|
|
208
|
+
startTranslate[0],
|
|
209
|
+
keyframeTranslate[1] +
|
|
210
|
+
nextTranslateY -
|
|
211
|
+
startTranslate[1],
|
|
212
|
+
keyframeTranslate[2],
|
|
213
|
+
]),
|
|
214
|
+
};
|
|
215
|
+
}),
|
|
216
|
+
},
|
|
217
|
+
}
|
|
218
|
+
: remotion_1.Internals.makeStaticDragOverride(translate));
|
|
219
|
+
};
|
|
220
|
+
updateFromPointerPosition();
|
|
221
|
+
const onPointerMove = (moveEvent) => {
|
|
222
|
+
moveEvent.preventDefault();
|
|
223
|
+
currentPointerX = moveEvent.clientX;
|
|
224
|
+
currentPointerY = moveEvent.clientY;
|
|
225
|
+
axisLocked = moveEvent.shiftKey;
|
|
226
|
+
updateFromPointerPosition();
|
|
227
|
+
};
|
|
228
|
+
const onKeyChange = (keyEvent) => {
|
|
229
|
+
if (keyEvent.key !== 'Shift') {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const nextAxisLocked = keyEvent.type === 'keydown';
|
|
233
|
+
if (nextAxisLocked === axisLocked) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
axisLocked = nextAxisLocked;
|
|
237
|
+
updateFromPointerPosition();
|
|
238
|
+
};
|
|
239
|
+
const onPointerUp = () => {
|
|
240
|
+
window.removeEventListener('keydown', onKeyChange);
|
|
241
|
+
window.removeEventListener('keyup', onKeyChange);
|
|
242
|
+
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
243
|
+
onDraggingChange(false);
|
|
244
|
+
if (last === null || (0, selected_outline_drag_1.uvsEqual)(last.uv, uv)) {
|
|
245
|
+
clearDragOverrides(transformOriginDrag.nodePath);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const { staticChanges, keyframedChanges } = (0, selected_outline_drag_1.getSelectedOutlineTransformOriginDragChanges)({
|
|
249
|
+
target: transformOriginDrag,
|
|
250
|
+
startTranslate,
|
|
251
|
+
origin: last.origin,
|
|
252
|
+
translate: last.translate,
|
|
253
|
+
});
|
|
254
|
+
if (staticChanges.length === 0 && keyframedChanges.length === 0) {
|
|
255
|
+
clearDragOverrides(transformOriginDrag.nodePath);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const promise = staticChanges.length === 0
|
|
259
|
+
? (0, call_add_keyframe_1.callAddKeyframes)({
|
|
260
|
+
sequenceKeyframes: keyframedChanges,
|
|
261
|
+
effectKeyframes: [],
|
|
262
|
+
setPropStatuses,
|
|
263
|
+
clientId: transformOriginDrag.clientId,
|
|
264
|
+
})
|
|
265
|
+
: (0, save_sequence_prop_1.saveSequenceProps)({
|
|
266
|
+
changes: staticChanges,
|
|
267
|
+
addedKeyframes: keyframedChanges,
|
|
268
|
+
movedKeyframes: null,
|
|
269
|
+
setPropStatuses,
|
|
270
|
+
clientId: transformOriginDrag.clientId,
|
|
271
|
+
undoLabel: 'Move transform origin',
|
|
272
|
+
redoLabel: 'Move transform origin back',
|
|
273
|
+
});
|
|
274
|
+
promise
|
|
275
|
+
.catch((err) => {
|
|
276
|
+
(0, NotificationCenter_1.showNotification)(`Could not save transform origin: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
277
|
+
})
|
|
278
|
+
.finally(() => {
|
|
279
|
+
clearDragOverrides(transformOriginDrag.nodePath);
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
(0, pointer_session_1.startPointerSession)({
|
|
283
|
+
event,
|
|
284
|
+
target: event.currentTarget,
|
|
285
|
+
onMove: onPointerMove,
|
|
286
|
+
onEnd: onPointerUp,
|
|
287
|
+
});
|
|
288
|
+
window.addEventListener('keydown', onKeyChange);
|
|
289
|
+
window.addEventListener('keyup', onKeyChange);
|
|
290
|
+
}, [
|
|
291
|
+
clearDragOverrides,
|
|
292
|
+
crop,
|
|
293
|
+
editorSnapping,
|
|
294
|
+
onDraggingChange,
|
|
295
|
+
outline,
|
|
296
|
+
parsed,
|
|
297
|
+
setDragOverrides,
|
|
298
|
+
setPropStatuses,
|
|
299
|
+
transformOriginDrag,
|
|
300
|
+
transformOriginPoints,
|
|
301
|
+
uv,
|
|
302
|
+
]);
|
|
303
|
+
if (position === null) {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
return (jsx_runtime_1.jsxs("g", { "data-remotion-studio-transform-origin-handle": true, pointerEvents: transformOriginDrag === null ? 'none' : 'all', cursor: transformOriginDrag === null ? undefined : 'crosshair', onPointerDown: onPointerDown, "aria-hidden": "true", style: {
|
|
307
|
+
filter: colors_1.SELECTED_OUTLINE_DROP_SHADOW,
|
|
308
|
+
}, children: [
|
|
309
|
+
jsx_runtime_1.jsx("circle", { cx: position.x, cy: position.y, r: 4, stroke: colors_1.BLUE, fill: "none", strokeWidth: 2, vectorEffect: "non-scaling-stroke" }), jsx_runtime_1.jsx("line", { x1: position.x - 8, y1: position.y, x2: position.x + 8, y2: position.y, stroke: colors_1.BLUE, strokeWidth: 2, vectorEffect: "non-scaling-stroke" }), jsx_runtime_1.jsx("line", { x1: position.x, y1: position.y - 8, x2: position.x, y2: position.y + 8, stroke: colors_1.BLUE, strokeWidth: 2, vectorEffect: "non-scaling-stroke" })
|
|
310
|
+
] }));
|
|
311
|
+
};
|
|
312
|
+
exports.SelectedOutlineTransformOriginHandle = SelectedOutlineTransformOriginHandle;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SequenceNodePathInfo } from '../helpers/get-timeline-sequence-sort-key';
|
|
3
3
|
import type { SelectedOutline } from './selected-outline-geometry';
|
|
4
|
-
import {
|
|
4
|
+
import type { SelectedOutlineLayoutTarget } from './selected-outline-types';
|
|
5
5
|
import type { TimelineSelection, TimelineSelectionInteraction } from './Timeline/TimelineSelection';
|
|
6
6
|
export declare const getSelectedOutlineUvHandleTimelineSelection: ({ effectIndex, fieldKey, nodePathInfo, }: {
|
|
7
7
|
readonly effectIndex: number;
|
|
8
8
|
readonly fieldKey: string;
|
|
9
9
|
readonly nodePathInfo: SequenceNodePathInfo;
|
|
10
10
|
}) => TimelineSelection;
|
|
11
|
-
type UvTarget = {
|
|
12
|
-
readonly containsSelection: boolean;
|
|
13
|
-
readonly nodePathInfo: SequenceNodePathInfo;
|
|
14
|
-
readonly uvHandles: readonly SelectedOutlineUvHandle[];
|
|
15
|
-
};
|
|
16
11
|
export declare const SelectedOutlineUvHandleConnectionLayer: React.FC<{
|
|
12
|
+
readonly layoutTarget: SelectedOutlineLayoutTarget | undefined;
|
|
17
13
|
readonly outline: SelectedOutline;
|
|
18
|
-
readonly target: UvTarget | undefined;
|
|
19
14
|
}>;
|
|
20
15
|
export declare const SelectedOutlineUvHandleCircleLayer: React.FC<{
|
|
16
|
+
readonly layoutTarget: SelectedOutlineLayoutTarget | undefined;
|
|
21
17
|
readonly onDraggingChange: (dragging: boolean) => void;
|
|
22
18
|
readonly onSelect: (item: TimelineSelection, interaction?: TimelineSelectionInteraction) => void;
|
|
23
19
|
readonly outline: SelectedOutline;
|
|
24
|
-
readonly target: UvTarget | undefined;
|
|
25
20
|
}>;
|
|
26
|
-
export {};
|
|
@@ -37,6 +37,7 @@ exports.SelectedOutlineUvHandleCircleLayer = exports.SelectedOutlineUvHandleConn
|
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const remotion_1 = require("remotion");
|
|
40
|
+
const client_id_1 = require("../helpers/client-id");
|
|
40
41
|
const colors_1 = require("../helpers/colors");
|
|
41
42
|
const pointer_session_1 = require("../helpers/pointer-session");
|
|
42
43
|
const editor_snapping_1 = require("../state/editor-snapping");
|
|
@@ -47,6 +48,7 @@ const selected_outline_measurement_2 = require("./selected-outline-measurement")
|
|
|
47
48
|
const selected_outline_uv_1 = require("./selected-outline-uv");
|
|
48
49
|
const call_add_keyframe_1 = require("./Timeline/call-add-keyframe");
|
|
49
50
|
const save_effect_prop_1 = require("./Timeline/save-effect-prop");
|
|
51
|
+
const TimelineSelection_1 = require("./Timeline/TimelineSelection");
|
|
50
52
|
const getSvgPointFromPointerEvent = ({ event, rect, }) => {
|
|
51
53
|
return {
|
|
52
54
|
x: event.clientX - rect.left,
|
|
@@ -662,27 +664,70 @@ const SelectedUvHandleCircle = ({ handle, nodePathInfo, onDraggingChange, onSele
|
|
|
662
664
|
]);
|
|
663
665
|
return (jsx_runtime_1.jsx("circle", { cx: position.x, cy: position.y, r: handle.isSelected ? selectedUvHandleRadius : uvHandleRadius, fill: colors_1.WHITE, stroke: colors_1.BLUE, strokeWidth: 2, style: uvHandleStyle, vectorEffect: "non-scaling-stroke", pointerEvents: "all", cursor: "default", onPointerDown: onPointerDown }));
|
|
664
666
|
};
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
+
const useSelectedOutlineUvTarget = (layoutTarget) => {
|
|
668
|
+
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
669
|
+
const { selectedItems } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
670
|
+
const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
671
|
+
const { getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
672
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
673
|
+
const selectedEffectsBySequenceKey = (0, react_1.useMemo)(() => (0, selected_outline_measurement_1.getSelectedEffectFieldsBySequenceKey)(selectedItems), [selectedItems]);
|
|
674
|
+
return (0, react_1.useMemo)(() => {
|
|
675
|
+
return {
|
|
676
|
+
containsSelection: layoutTarget.containsSelection,
|
|
677
|
+
nodePathInfo: layoutTarget.nodePathInfo,
|
|
678
|
+
uvHandles: (0, selected_outline_uv_1.getSelectedUvHandles)({
|
|
679
|
+
propStatuses,
|
|
680
|
+
clientId: previewServerState.type === 'connected'
|
|
681
|
+
? previewServerState.clientId
|
|
682
|
+
: null,
|
|
683
|
+
getEffectDragOverrides,
|
|
684
|
+
nodePath: layoutTarget.nodePathInfo.sequenceSubscriptionKey,
|
|
685
|
+
selectedEffects: selectedEffectsBySequenceKey.get(layoutTarget.key),
|
|
686
|
+
sequence: layoutTarget.sequence,
|
|
687
|
+
sourceFrame: timelinePosition - layoutTarget.keyframeDisplayOffset,
|
|
688
|
+
}),
|
|
689
|
+
};
|
|
690
|
+
}, [
|
|
691
|
+
getEffectDragOverrides,
|
|
692
|
+
layoutTarget,
|
|
693
|
+
previewServerState,
|
|
694
|
+
propStatuses,
|
|
695
|
+
selectedEffectsBySequenceKey,
|
|
696
|
+
timelinePosition,
|
|
697
|
+
]);
|
|
698
|
+
};
|
|
699
|
+
const SelectedOutlineUvHandleConnectionLayerActive = ({ layoutTarget, outline }) => {
|
|
700
|
+
const target = useSelectedOutlineUvTarget(layoutTarget);
|
|
701
|
+
if (!target.containsSelection || target.uvHandles.length === 0) {
|
|
667
702
|
return null;
|
|
668
703
|
}
|
|
669
704
|
return (jsx_runtime_1.jsx(SelectedUvHandleConnectionLines, { handles: target.uvHandles, outline: outline }));
|
|
670
705
|
};
|
|
706
|
+
const SelectedOutlineUvHandleConnectionLayer = ({ layoutTarget, outline }) => {
|
|
707
|
+
if ((layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.selectedForUvHandles) !== true) {
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
return (jsx_runtime_1.jsx(SelectedOutlineUvHandleConnectionLayerActive, { layoutTarget: layoutTarget, outline: outline }));
|
|
711
|
+
};
|
|
671
712
|
exports.SelectedOutlineUvHandleConnectionLayer = SelectedOutlineUvHandleConnectionLayer;
|
|
672
|
-
const
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
}, [outline.dimensions, outline.points, target === null || target === void 0 ? void 0 : target.uvHandles]);
|
|
681
|
-
if (!(target === null || target === void 0 ? void 0 : target.containsSelection) || target.uvHandles.length === 0) {
|
|
713
|
+
const SelectedOutlineUvHandleCircleLayerActive = ({ layoutTarget, onDraggingChange, onSelect, outline }) => {
|
|
714
|
+
const target = useSelectedOutlineUvTarget(layoutTarget);
|
|
715
|
+
const ellipseControls = (0, react_1.useMemo)(() => (0, selected_outline_uv_1.getUvEllipseInteractiveControls)({
|
|
716
|
+
handles: target.uvHandles,
|
|
717
|
+
dimensions: outline.dimensions,
|
|
718
|
+
points: outline.points,
|
|
719
|
+
}), [outline.dimensions, outline.points, target.uvHandles]);
|
|
720
|
+
if (!target.containsSelection || target.uvHandles.length === 0) {
|
|
682
721
|
return null;
|
|
683
722
|
}
|
|
684
723
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [ellipseControls.map((control) => (jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [
|
|
685
724
|
jsx_runtime_1.jsx(SelectedUvEllipseStartHandle, { control: control, onDraggingChange: onDraggingChange, outline: outline }), jsx_runtime_1.jsx(SelectedUvEllipseResizeHandle, { axis: "width", control: control, onDraggingChange: onDraggingChange, outline: outline }), jsx_runtime_1.jsx(SelectedUvEllipseResizeHandle, { axis: "height", control: control, onDraggingChange: onDraggingChange, outline: outline }), jsx_runtime_1.jsx(SelectedUvEllipseRotationHandle, { control: control, onDraggingChange: onDraggingChange })
|
|
686
725
|
] }, `${control.handle.effectIndex}-${control.handle.fieldKey}-ellipse-controls`))), target.uvHandles.map((handle) => (jsx_runtime_1.jsx(SelectedUvHandleCircle, { handle: handle, nodePathInfo: target.nodePathInfo, onDraggingChange: onDraggingChange, onSelect: onSelect, outline: outline }, `${handle.effectIndex}-${handle.fieldKey}`)))] }));
|
|
687
726
|
};
|
|
727
|
+
const SelectedOutlineUvHandleCircleLayer = ({ layoutTarget, onDraggingChange, onSelect, outline }) => {
|
|
728
|
+
if ((layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.selectedForUvHandles) !== true) {
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
return (jsx_runtime_1.jsx(SelectedOutlineUvHandleCircleLayerActive, { layoutTarget: layoutTarget, onDraggingChange: onDraggingChange, onSelect: onSelect, outline: outline }));
|
|
732
|
+
};
|
|
688
733
|
exports.SelectedOutlineUvHandleCircleLayer = SelectedOutlineUvHandleCircleLayer;
|
|
@@ -35,6 +35,14 @@ const SequencePropsSubscriptionProvider = ({ children }) => {
|
|
|
35
35
|
const setOverrideIdToNodePath = (0, react_1.useCallback)((overrideId, state) => {
|
|
36
36
|
setOverrideIdToNodePathMap((prev) => {
|
|
37
37
|
const existing = prev[overrideId];
|
|
38
|
+
if (state === null) {
|
|
39
|
+
if (!existing) {
|
|
40
|
+
return prev;
|
|
41
|
+
}
|
|
42
|
+
const next = { ...prev };
|
|
43
|
+
delete next[overrideId];
|
|
44
|
+
return next;
|
|
45
|
+
}
|
|
38
46
|
if (existing && existing === state) {
|
|
39
47
|
return prev;
|
|
40
48
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GetDefaultCodingAgentInfoResponse, GetDefaultEditorInfoResponse } from '@remotion/studio-shared';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type SettingsContextValue = {
|
|
4
|
+
readonly codingAgentInfo: GetDefaultCodingAgentInfoResponse | null;
|
|
5
|
+
readonly editorInfo: GetDefaultEditorInfoResponse | null;
|
|
6
|
+
readonly error: string | null;
|
|
7
|
+
readonly publicLicenseKey: string | null;
|
|
8
|
+
readonly revision: number;
|
|
9
|
+
readonly setPublicLicenseKey: (publicLicenseKey: string | null) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const SettingsProvider: React.FC<{
|
|
12
|
+
readonly children: React.ReactNode;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const useSettings: () => SettingsContextValue;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSettings = exports.SettingsProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
|
|
7
|
+
const client_id_1 = require("../helpers/client-id");
|
|
8
|
+
const call_api_1 = require("./call-api");
|
|
9
|
+
const SettingsContext = (0, react_1.createContext)(null);
|
|
10
|
+
const SettingsProvider = ({ children }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
var _b;
|
|
13
|
+
const { previewServerState, subscribeToEvent } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
14
|
+
const [settings, setSettings] = (0, react_1.useState)({
|
|
15
|
+
codingAgentInfo: null,
|
|
16
|
+
editorInfo: null,
|
|
17
|
+
error: null,
|
|
18
|
+
publicLicenseKey: (_b = (_a = window.remotion_studioConfig) === null || _a === void 0 ? void 0 : _a.publicLicenseKey) !== null && _b !== void 0 ? _b : null,
|
|
19
|
+
revision: 0,
|
|
20
|
+
});
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
if (previewServerState.type !== 'connected' ||
|
|
23
|
+
(0, browser_studio_operations_1.getBrowserStudioOperations)() !== null) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
setSettings((currentSettings) => ({
|
|
28
|
+
...currentSettings,
|
|
29
|
+
error: null,
|
|
30
|
+
}));
|
|
31
|
+
Promise.all([
|
|
32
|
+
(0, call_api_1.callApi)('/api/default-editor-info', {}, controller.signal),
|
|
33
|
+
(0, call_api_1.callApi)('/api/default-coding-agent-info', {}, controller.signal),
|
|
34
|
+
])
|
|
35
|
+
.then(([editorInfo, codingAgentInfo]) => {
|
|
36
|
+
const runtimeConfig = window.remotion_studioConfig;
|
|
37
|
+
setSettings((currentSettings) => ({
|
|
38
|
+
...currentSettings,
|
|
39
|
+
codingAgentInfo: {
|
|
40
|
+
...codingAgentInfo,
|
|
41
|
+
defaultCodingAgent: runtimeConfig
|
|
42
|
+
? runtimeConfig.defaultCodingAgent
|
|
43
|
+
: codingAgentInfo.defaultCodingAgent,
|
|
44
|
+
},
|
|
45
|
+
editorInfo: {
|
|
46
|
+
...editorInfo,
|
|
47
|
+
defaultEditor: runtimeConfig
|
|
48
|
+
? runtimeConfig.defaultEditor
|
|
49
|
+
: editorInfo.defaultEditor,
|
|
50
|
+
},
|
|
51
|
+
error: null,
|
|
52
|
+
revision: currentSettings.revision + 1,
|
|
53
|
+
}));
|
|
54
|
+
})
|
|
55
|
+
.catch((err) => {
|
|
56
|
+
if (controller.signal.aborted) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
setSettings((currentSettings) => ({
|
|
60
|
+
...currentSettings,
|
|
61
|
+
error: err.message,
|
|
62
|
+
}));
|
|
63
|
+
});
|
|
64
|
+
return () => controller.abort();
|
|
65
|
+
}, [previewServerState.type]);
|
|
66
|
+
(0, react_1.useEffect)(() => {
|
|
67
|
+
return subscribeToEvent('config-file-changed', (event) => {
|
|
68
|
+
if (event.type !== 'config-file-changed') {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setSettings((currentSettings) => ({
|
|
72
|
+
...currentSettings,
|
|
73
|
+
codingAgentInfo: currentSettings.codingAgentInfo
|
|
74
|
+
? {
|
|
75
|
+
...currentSettings.codingAgentInfo,
|
|
76
|
+
defaultCodingAgent: event.studioRuntimeConfig.defaultCodingAgent,
|
|
77
|
+
}
|
|
78
|
+
: null,
|
|
79
|
+
editorInfo: currentSettings.editorInfo
|
|
80
|
+
? {
|
|
81
|
+
...currentSettings.editorInfo,
|
|
82
|
+
defaultEditor: event.studioRuntimeConfig.defaultEditor,
|
|
83
|
+
}
|
|
84
|
+
: null,
|
|
85
|
+
error: null,
|
|
86
|
+
publicLicenseKey: event.studioRuntimeConfig.publicLicenseKey,
|
|
87
|
+
revision: currentSettings.revision + 1,
|
|
88
|
+
}));
|
|
89
|
+
});
|
|
90
|
+
}, [subscribeToEvent]);
|
|
91
|
+
const setPublicLicenseKey = (0, react_1.useCallback)((publicLicenseKey) => {
|
|
92
|
+
setSettings((currentSettings) => {
|
|
93
|
+
if (currentSettings.publicLicenseKey === publicLicenseKey) {
|
|
94
|
+
return currentSettings;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
...currentSettings,
|
|
98
|
+
publicLicenseKey,
|
|
99
|
+
revision: currentSettings.revision + 1,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
}, []);
|
|
103
|
+
const value = (0, react_1.useMemo)(() => {
|
|
104
|
+
return { ...settings, setPublicLicenseKey };
|
|
105
|
+
}, [setPublicLicenseKey, settings]);
|
|
106
|
+
return (jsx_runtime_1.jsx(SettingsContext.Provider, { value: value, children: children }));
|
|
107
|
+
};
|
|
108
|
+
exports.SettingsProvider = SettingsProvider;
|
|
109
|
+
const useSettings = () => {
|
|
110
|
+
const context = (0, react_1.useContext)(SettingsContext);
|
|
111
|
+
if (context === null) {
|
|
112
|
+
throw new Error('useSettings must be used inside SettingsProvider');
|
|
113
|
+
}
|
|
114
|
+
return context;
|
|
115
|
+
};
|
|
116
|
+
exports.useSettings = useSettings;
|
|
@@ -12,6 +12,8 @@ const is_menu_item_1 = require("./Menu/is-menu-item");
|
|
|
12
12
|
const ModalHeader_1 = require("./ModalHeader");
|
|
13
13
|
const DismissableModal_1 = require("./NewComposition/DismissableModal");
|
|
14
14
|
const render_modals_1 = require("./RenderModal/render-modals");
|
|
15
|
+
const SettingsContext_1 = require("./SettingsContext");
|
|
16
|
+
const SettingsModalFooter_1 = require("./SettingsModalFooter");
|
|
15
17
|
const vertical_1 = require("./Tabs/vertical");
|
|
16
18
|
const hiddenPanel = {
|
|
17
19
|
display: 'none',
|
|
@@ -28,6 +30,7 @@ const appsIconContainer = {
|
|
|
28
30
|
};
|
|
29
31
|
const SettingsModal = ({ initialPublicLicenseKey, initialTab }) => {
|
|
30
32
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
|
|
33
|
+
const { setPublicLicenseKey } = (0, SettingsContext_1.useSettings)();
|
|
31
34
|
const [tab, setTab] = (0, react_1.useState)(initialTab);
|
|
32
35
|
const [openedTabs, setOpenedTabs] = (0, react_1.useState)([initialTab]);
|
|
33
36
|
const dismiss = (0, react_1.useCallback)(() => {
|
|
@@ -42,9 +45,12 @@ const SettingsModal = ({ initialPublicLicenseKey, initialTab }) => {
|
|
|
42
45
|
return [...currentOpenedTabs, newTab];
|
|
43
46
|
});
|
|
44
47
|
}, []);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
49
|
+
setPublicLicenseKey(initialPublicLicenseKey);
|
|
50
|
+
}, [initialPublicLicenseKey, setPublicLicenseKey]);
|
|
51
|
+
return (jsx_runtime_1.jsx(DismissableModal_1.DismissableModal, { panelStyle: render_modals_1.outerModalStyle, children: jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
52
|
+
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "Settings", onClose: dismiss }), jsx_runtime_1.jsxs("div", { style: render_modals_1.horizontalLayout, children: [
|
|
53
|
+
jsx_runtime_1.jsxs("div", { style: render_modals_1.leftSidebar, children: [jsx_runtime_1.jsx(vertical_1.VerticalTab, { style: render_modals_1.horizontalTab, selected: tab === 'apps', onClick: () => selectTab('apps'), renderIcon: (color) => (jsx_runtime_1.jsx("div", { style: appsIconContainer, children: jsx_runtime_1.jsx(apps_1.AppsIcon, { color: color, style: appsIcon }) })), children: "Apps" }), jsx_runtime_1.jsx(vertical_1.VerticalTab, { style: render_modals_1.horizontalTab, selected: tab === 'license', onClick: () => selectTab('license'), renderIcon: (color) => (jsx_runtime_1.jsx("div", { style: render_modals_1.iconContainer, children: jsx_runtime_1.jsx(certificate_1.CertificateIcon, { color: color, style: render_modals_1.icon }) })), children: "License" })] }), openedTabs.includes('apps') ? (jsx_runtime_1.jsx("div", { style: tab === 'apps' ? render_modals_1.optionsPanel : hiddenPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: jsx_runtime_1.jsx(ConfigureDefaultEditorModal_1.DefaultEditorSettings, {}) })) : null, openedTabs.includes('license') ? (jsx_runtime_1.jsx("div", { style: tab === 'license' ? render_modals_1.optionsPanel : hiddenPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: jsx_runtime_1.jsx(ConfigureLicenseModal_1.LicenseSettings, {}) })) : null] }), jsx_runtime_1.jsx(SettingsModalFooter_1.SettingsModalFooter, {})
|
|
54
|
+
] }) }));
|
|
49
55
|
};
|
|
50
56
|
exports.SettingsModal = SettingsModal;
|