@remotion/studio-server 4.0.472 → 4.0.474
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/codemods/effect-param-expression.d.ts +15 -0
- package/dist/codemods/effect-param-expression.js +131 -0
- package/dist/codemods/paste-effects.js +4 -91
- package/dist/codemods/reorder-sequence.d.ts +14 -0
- package/dist/codemods/reorder-sequence.js +109 -0
- package/dist/codemods/update-effect-props/update-effect-props.d.ts +7 -0
- package/dist/codemods/update-effect-props/update-effect-props.js +64 -16
- package/dist/codemods/update-keyframes/update-keyframes.d.ts +14 -1
- package/dist/codemods/update-keyframes/update-keyframes.js +152 -0
- package/dist/helpers/resolve-composition-component.d.ts +1 -1
- package/dist/helpers/resolve-composition-component.js +103 -7
- package/dist/preview-server/api-routes.js +14 -0
- package/dist/preview-server/routes/can-update-effect-props.js +3 -2
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +1 -1
- package/dist/preview-server/routes/can-update-sequence-props.js +52 -17
- package/dist/preview-server/routes/download-remote-asset.d.ts +7 -0
- package/dist/preview-server/routes/download-remote-asset.js +268 -0
- package/dist/preview-server/routes/insert-jsx-element.d.ts +1 -1
- package/dist/preview-server/routes/insert-jsx-element.js +28 -1
- package/dist/preview-server/routes/log-studio-error.d.ts +3 -0
- package/dist/preview-server/routes/log-studio-error.js +58 -0
- package/dist/preview-server/routes/move-keyframes.d.ts +7 -0
- package/dist/preview-server/routes/move-keyframes.js +242 -0
- package/dist/preview-server/routes/rename-static-file.d.ts +3 -0
- package/dist/preview-server/routes/rename-static-file.js +53 -0
- package/dist/preview-server/routes/reorder-sequence.d.ts +3 -0
- package/dist/preview-server/routes/reorder-sequence.js +67 -0
- package/dist/preview-server/routes/save-effect-props.js +24 -9
- package/dist/preview-server/routes/save-sequence-props.js +2 -34
- package/dist/preview-server/routes/update-effect-keyframe-settings.d.ts +3 -0
- package/dist/preview-server/routes/update-effect-keyframe-settings.js +90 -0
- package/dist/preview-server/routes/update-sequence-keyframe-settings.d.ts +3 -0
- package/dist/preview-server/routes/update-sequence-keyframe-settings.js +85 -0
- package/dist/preview-server/undo-stack.d.ts +3 -1
- package/package.json +6 -6
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renameStaticFileHandler = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const resolvePublicPath = ({ publicDir, relativePath, }) => {
|
|
10
|
+
if (relativePath.length === 0) {
|
|
11
|
+
throw new Error('Path cannot be empty');
|
|
12
|
+
}
|
|
13
|
+
const resolved = path_1.default.join(publicDir, relativePath);
|
|
14
|
+
const relativeToPublicDir = path_1.default.relative(publicDir, resolved);
|
|
15
|
+
if (relativeToPublicDir.startsWith('..') ||
|
|
16
|
+
path_1.default.isAbsolute(relativeToPublicDir)) {
|
|
17
|
+
throw new Error(`Not allowed to write to ${relativeToPublicDir}`);
|
|
18
|
+
}
|
|
19
|
+
return resolved;
|
|
20
|
+
};
|
|
21
|
+
const renameStaticFileHandler = ({ input: { oldRelativePath, newRelativePath }, publicDir }) => {
|
|
22
|
+
const oldResolved = resolvePublicPath({
|
|
23
|
+
publicDir,
|
|
24
|
+
relativePath: oldRelativePath,
|
|
25
|
+
});
|
|
26
|
+
const newResolved = resolvePublicPath({
|
|
27
|
+
publicDir,
|
|
28
|
+
relativePath: newRelativePath,
|
|
29
|
+
});
|
|
30
|
+
if (oldResolved === newResolved) {
|
|
31
|
+
return Promise.resolve({ success: true });
|
|
32
|
+
}
|
|
33
|
+
if (!(0, fs_1.existsSync)(oldResolved)) {
|
|
34
|
+
throw new Error(`${oldRelativePath} does not exist`);
|
|
35
|
+
}
|
|
36
|
+
const oldStat = (0, fs_1.statSync)(oldResolved);
|
|
37
|
+
if (!oldStat.isFile()) {
|
|
38
|
+
throw new Error(`${oldRelativePath} is not a file`);
|
|
39
|
+
}
|
|
40
|
+
if ((0, fs_1.existsSync)(newResolved)) {
|
|
41
|
+
const newStat = (0, fs_1.statSync)(newResolved);
|
|
42
|
+
const pointsToSameFile = oldStat.dev === newStat.dev && oldStat.ino === newStat.ino;
|
|
43
|
+
if (!pointsToSameFile) {
|
|
44
|
+
throw new Error(`${newRelativePath} already exists`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
(0, fs_1.mkdirSync)(path_1.default.dirname(newResolved), { recursive: true });
|
|
48
|
+
(0, fs_1.renameSync)(oldResolved, newResolved);
|
|
49
|
+
return Promise.resolve({
|
|
50
|
+
success: true,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
exports.renameStaticFileHandler = renameStaticFileHandler;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reorderSequenceHandler = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const reorder_sequence_1 = require("../../codemods/reorder-sequence");
|
|
7
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
8
|
+
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
|
+
const format_log_file_location_1 = require("../format-log-file-location");
|
|
10
|
+
const undo_stack_1 = require("../undo-stack");
|
|
11
|
+
const formatting_1 = require("./log-updates/formatting");
|
|
12
|
+
const log_update_1 = require("./log-updates/log-update");
|
|
13
|
+
const reorderSequenceHandler = async ({ input: { fileName, sourceNodePath, targetNodePath, position, clientId }, remotionRoot, logLevel, }) => {
|
|
14
|
+
try {
|
|
15
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[reorder-sequence] Received request for fileName="${fileName}" position=${position}`);
|
|
16
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
17
|
+
remotionRoot,
|
|
18
|
+
fileName,
|
|
19
|
+
action: 'modify',
|
|
20
|
+
});
|
|
21
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
22
|
+
const { output, formatted, sequenceLabel, logLine } = await (0, reorder_sequence_1.reorderSequence)({
|
|
23
|
+
input: fileContents,
|
|
24
|
+
sourceNodePath: sourceNodePath.nodePath,
|
|
25
|
+
targetNodePath: targetNodePath.nodePath,
|
|
26
|
+
position,
|
|
27
|
+
});
|
|
28
|
+
(0, undo_stack_1.pushToUndoStack)({
|
|
29
|
+
filePath: absolutePath,
|
|
30
|
+
oldContents: fileContents,
|
|
31
|
+
newContents: null,
|
|
32
|
+
logLevel,
|
|
33
|
+
remotionRoot,
|
|
34
|
+
logLine,
|
|
35
|
+
description: {
|
|
36
|
+
undoMessage: `↩️ Reordering of ${sequenceLabel}`,
|
|
37
|
+
redoMessage: `↪️ Reordering of ${sequenceLabel}`,
|
|
38
|
+
},
|
|
39
|
+
entryType: 'reorder-sequence',
|
|
40
|
+
suppressHmrOnFileRestore: false,
|
|
41
|
+
});
|
|
42
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
43
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
|
|
44
|
+
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
45
|
+
remotionRoot,
|
|
46
|
+
absolutePath,
|
|
47
|
+
line: logLine,
|
|
48
|
+
});
|
|
49
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Reordered ${(0, formatting_1.attrName)(sequenceLabel)}`);
|
|
50
|
+
if (!formatted) {
|
|
51
|
+
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
52
|
+
}
|
|
53
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[reorder-sequence] Wrote ${fileRelativeToRoot}${formatted ? ' (formatted)' : ''}`);
|
|
54
|
+
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
return {
|
|
61
|
+
success: false,
|
|
62
|
+
reason: err.message,
|
|
63
|
+
stack: err.stack,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.reorderSequenceHandler = reorderSequenceHandler;
|
|
@@ -16,7 +16,8 @@ const format_effect_prop_change_1 = require("./log-updates/format-effect-prop-ch
|
|
|
16
16
|
const log_effect_update_1 = require("./log-updates/log-effect-update");
|
|
17
17
|
const log_update_1 = require("./log-updates/log-update");
|
|
18
18
|
const save_props_mutex_1 = require("./save-props-mutex");
|
|
19
|
-
const saveEffectPropsHandler = ({ input
|
|
19
|
+
const saveEffectPropsHandler = ({ input, remotionRoot, logLevel }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
|
|
20
|
+
const { fileName, sequenceNodePath, effectIndex, key, defaultValue, schema, clientId, } = input;
|
|
20
21
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[save-effect-props] Received request for fileName="${fileName}" effectIndex=${effectIndex} key="${key}"`);
|
|
21
22
|
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
22
23
|
remotionRoot,
|
|
@@ -25,20 +26,34 @@ const saveEffectPropsHandler = ({ input: { fileName, sequenceNodePath, effectInd
|
|
|
25
26
|
});
|
|
26
27
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
27
28
|
const parsedDefault = defaultValue !== null ? JSON.parse(defaultValue) : null;
|
|
28
|
-
const
|
|
29
|
+
const update = (() => {
|
|
30
|
+
switch (input.type) {
|
|
31
|
+
case 'value':
|
|
32
|
+
return {
|
|
33
|
+
key,
|
|
34
|
+
value: JSON.parse(input.value),
|
|
35
|
+
defaultValue: parsedDefault,
|
|
36
|
+
};
|
|
37
|
+
case 'effect-param':
|
|
38
|
+
return {
|
|
39
|
+
key,
|
|
40
|
+
effectParam: input.effectParam,
|
|
41
|
+
defaultValue: parsedDefault,
|
|
42
|
+
};
|
|
43
|
+
default:
|
|
44
|
+
throw new Error(`Unsupported save effect props request type: ${input.type}`);
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
const { output, oldValueString, newValueString, formatted, logLine, effectCallee, removedProps, } = await (0, update_effect_props_1.updateEffectProps)({
|
|
29
48
|
input: fileContents,
|
|
30
49
|
sequenceNodePath: sequenceNodePath.nodePath,
|
|
31
50
|
effectIndex,
|
|
32
|
-
update
|
|
33
|
-
key,
|
|
34
|
-
value: JSON.parse(value),
|
|
35
|
-
defaultValue: parsedDefault,
|
|
36
|
-
},
|
|
51
|
+
update,
|
|
37
52
|
schema,
|
|
38
53
|
});
|
|
39
54
|
const defaultValueString = parsedDefault !== null ? JSON.stringify(parsedDefault) : null;
|
|
40
55
|
const normalizedOld = (0, log_update_1.normalizeQuotes)(oldValueString);
|
|
41
|
-
const normalizedNew = (0, log_update_1.normalizeQuotes)(
|
|
56
|
+
const normalizedNew = (0, log_update_1.normalizeQuotes)(newValueString);
|
|
42
57
|
const normalizedDefault = defaultValueString !== null ? (0, log_update_1.normalizeQuotes)(defaultValueString) : null;
|
|
43
58
|
const normalizedRemovedProps = removedProps.map((prop) => ({
|
|
44
59
|
...prop,
|
|
@@ -85,7 +100,7 @@ const saveEffectPropsHandler = ({ input: { fileName, sequenceNodePath, effectInd
|
|
|
85
100
|
effectName: effectCallee,
|
|
86
101
|
propKey: key,
|
|
87
102
|
oldValueString,
|
|
88
|
-
newValueString
|
|
103
|
+
newValueString,
|
|
89
104
|
defaultValueString,
|
|
90
105
|
formatted,
|
|
91
106
|
logLevel,
|
|
@@ -11,7 +11,6 @@ const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside
|
|
|
11
11
|
const undo_stack_1 = require("../undo-stack");
|
|
12
12
|
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
13
13
|
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
14
|
-
const format_prop_change_1 = require("./log-updates/format-prop-change");
|
|
15
14
|
const log_update_1 = require("./log-updates/log-update");
|
|
16
15
|
const save_props_mutex_1 = require("./save-props-mutex");
|
|
17
16
|
const saveSequencePropsHandler = ({ input: { edits, clientId, undoLabel, redoLabel }, remotionRoot, logLevel, }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
|
|
@@ -88,39 +87,8 @@ const saveSequencePropsHandler = ({ input: { edits, clientId, undoLabel, redoLab
|
|
|
88
87
|
});
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
if (!firstResult) {
|
|
94
|
-
throw new Error('Could not compute sequence prop edit result');
|
|
95
|
-
}
|
|
96
|
-
const undoMessage = undoLabel !== null
|
|
97
|
-
? `↩️ ${undoLabel}`
|
|
98
|
-
: edits.length === 1
|
|
99
|
-
? `↩️ ${(0, format_prop_change_1.formatPropChange)({
|
|
100
|
-
key: firstEdit.key,
|
|
101
|
-
oldValueString: (0, log_update_1.normalizeQuotes)(JSON.stringify(JSON.parse(firstEdit.value))),
|
|
102
|
-
newValueString: (0, log_update_1.normalizeQuotes)(firstResult.oldValueString),
|
|
103
|
-
defaultValueString: firstEdit.defaultValue !== null
|
|
104
|
-
? (0, log_update_1.normalizeQuotes)(JSON.stringify(JSON.parse(firstEdit.defaultValue)))
|
|
105
|
-
: null,
|
|
106
|
-
removedProps: [],
|
|
107
|
-
addedProps: firstResult.removedProps,
|
|
108
|
-
})}`
|
|
109
|
-
: '↩️ Update selected sequence props';
|
|
110
|
-
const redoMessage = redoLabel !== null
|
|
111
|
-
? `↪️ ${redoLabel}`
|
|
112
|
-
: edits.length === 1
|
|
113
|
-
? `↪️ ${(0, format_prop_change_1.formatPropChange)({
|
|
114
|
-
key: firstEdit.key,
|
|
115
|
-
oldValueString: (0, log_update_1.normalizeQuotes)(firstResult.oldValueString),
|
|
116
|
-
newValueString: (0, log_update_1.normalizeQuotes)(JSON.stringify(JSON.parse(firstEdit.value))),
|
|
117
|
-
defaultValueString: firstEdit.defaultValue !== null
|
|
118
|
-
? (0, log_update_1.normalizeQuotes)(JSON.stringify(JSON.parse(firstEdit.defaultValue)))
|
|
119
|
-
: null,
|
|
120
|
-
removedProps: firstResult.removedProps,
|
|
121
|
-
addedProps: [],
|
|
122
|
-
})}`
|
|
123
|
-
: '↪️ Update selected sequence props';
|
|
90
|
+
const undoMessage = `↩️ ${undoLabel}`;
|
|
91
|
+
const redoMessage = `↪️ ${redoLabel}`;
|
|
124
92
|
(0, undo_stack_1.pushTransactionToUndoStack)({
|
|
125
93
|
snapshots,
|
|
126
94
|
logLevel,
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { UpdateEffectKeyframeSettingsRequest, UpdateEffectKeyframeSettingsResponse } from '@remotion/studio-shared';
|
|
2
|
+
import type { ApiHandler } from '../api-types';
|
|
3
|
+
export declare const updateEffectKeyframeSettingsHandler: ApiHandler<UpdateEffectKeyframeSettingsRequest, UpdateEffectKeyframeSettingsResponse>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateEffectKeyframeSettingsHandler = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
7
|
+
const parse_ast_1 = require("../../codemods/parse-ast");
|
|
8
|
+
const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
|
|
9
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
10
|
+
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
11
|
+
const undo_stack_1 = require("../undo-stack");
|
|
12
|
+
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
13
|
+
const can_update_effect_props_1 = require("./can-update-effect-props");
|
|
14
|
+
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
15
|
+
const log_effect_update_1 = require("./log-updates/log-effect-update");
|
|
16
|
+
const save_props_mutex_1 = require("./save-props-mutex");
|
|
17
|
+
const updateEffectKeyframeSettingsHandler = ({ input: { fileName, sequenceNodePath, effectIndex, key, settings, schema, clientId, }, remotionRoot, logLevel, }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
|
|
18
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[update-effect-keyframe-settings] Received request for fileName="${fileName}" effectIndex=${effectIndex} key="${key}"`);
|
|
19
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
20
|
+
remotionRoot,
|
|
21
|
+
fileName,
|
|
22
|
+
action: 'modify',
|
|
23
|
+
});
|
|
24
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
25
|
+
const { output, oldValueStrings, newValueStrings, formatted, logLine, effectCallee, updatedSequenceNodePath, } = await (0, update_keyframes_1.updateEffectKeyframes)({
|
|
26
|
+
input: fileContents,
|
|
27
|
+
sequenceNodePath: sequenceNodePath.nodePath,
|
|
28
|
+
effectIndex,
|
|
29
|
+
schema,
|
|
30
|
+
updates: [
|
|
31
|
+
{
|
|
32
|
+
key,
|
|
33
|
+
operation: {
|
|
34
|
+
type: 'settings',
|
|
35
|
+
clamping: settings.clamping,
|
|
36
|
+
posterize: settings.posterize,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
const undoPropChange = `${key} keyframe settings reverted`;
|
|
42
|
+
const redoPropChange = `${key} keyframe settings updated`;
|
|
43
|
+
(0, undo_stack_1.pushToUndoStack)({
|
|
44
|
+
filePath: absolutePath,
|
|
45
|
+
oldContents: fileContents,
|
|
46
|
+
newContents: null,
|
|
47
|
+
logLevel,
|
|
48
|
+
remotionRoot,
|
|
49
|
+
logLine,
|
|
50
|
+
description: {
|
|
51
|
+
undoMessage: `↩️ ${undoPropChange}`,
|
|
52
|
+
redoMessage: `↪️ ${redoPropChange}`,
|
|
53
|
+
},
|
|
54
|
+
entryType: 'effect-props',
|
|
55
|
+
suppressHmrOnFileRestore: true,
|
|
56
|
+
});
|
|
57
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
58
|
+
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
|
|
59
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
|
|
60
|
+
(0, log_effect_update_1.logEffectUpdate)({
|
|
61
|
+
fileRelativeToRoot,
|
|
62
|
+
line: logLine,
|
|
63
|
+
effectName: effectCallee,
|
|
64
|
+
propKey: key,
|
|
65
|
+
oldValueString: oldValueStrings[0],
|
|
66
|
+
newValueString: newValueStrings[0],
|
|
67
|
+
defaultValueString: null,
|
|
68
|
+
formatted,
|
|
69
|
+
logLevel,
|
|
70
|
+
removedProps: [],
|
|
71
|
+
addedProps: [],
|
|
72
|
+
});
|
|
73
|
+
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
74
|
+
const ast = (0, parse_ast_1.parseAst)(output);
|
|
75
|
+
const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, updatedSequenceNodePath);
|
|
76
|
+
if (!jsx) {
|
|
77
|
+
return {
|
|
78
|
+
canUpdate: false,
|
|
79
|
+
effectIndex,
|
|
80
|
+
reason: 'not-found',
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return (0, can_update_effect_props_1.computeEffectPropStatus)({
|
|
84
|
+
ast,
|
|
85
|
+
jsx,
|
|
86
|
+
effectIndex,
|
|
87
|
+
keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
exports.updateEffectKeyframeSettingsHandler = updateEffectKeyframeSettingsHandler;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { UpdateSequenceKeyframeSettingsRequest, UpdateSequenceKeyframeSettingsResponse } from '@remotion/studio-shared';
|
|
2
|
+
import type { ApiHandler } from '../api-types';
|
|
3
|
+
export declare const updateSequenceKeyframeSettingsHandler: ApiHandler<UpdateSequenceKeyframeSettingsRequest, UpdateSequenceKeyframeSettingsResponse>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateSequenceKeyframeSettingsHandler = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
7
|
+
const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
|
|
8
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
9
|
+
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
10
|
+
const undo_stack_1 = require("../undo-stack");
|
|
11
|
+
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
12
|
+
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
13
|
+
const log_update_1 = require("./log-updates/log-update");
|
|
14
|
+
const save_props_mutex_1 = require("./save-props-mutex");
|
|
15
|
+
const updateSequenceKeyframeSettingsHandler = ({ input: { fileName, nodePath, key, settings, schema, clientId }, remotionRoot, logLevel, }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
|
|
16
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[update-sequence-keyframe-settings] Received request for fileName="${fileName}" key="${key}"`);
|
|
17
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
18
|
+
remotionRoot,
|
|
19
|
+
fileName,
|
|
20
|
+
action: 'modify',
|
|
21
|
+
});
|
|
22
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
23
|
+
const { output, oldValueStrings, newValueStrings, formatted, logLine, updatedNodePath, } = await (0, update_keyframes_1.updateSequenceKeyframes)({
|
|
24
|
+
input: fileContents,
|
|
25
|
+
nodePath: nodePath.nodePath,
|
|
26
|
+
schema,
|
|
27
|
+
updates: [
|
|
28
|
+
{
|
|
29
|
+
key,
|
|
30
|
+
operation: {
|
|
31
|
+
type: 'settings',
|
|
32
|
+
clamping: settings.clamping,
|
|
33
|
+
posterize: settings.posterize,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
const undoPropChange = `${key} keyframe settings reverted`;
|
|
39
|
+
const redoPropChange = `${key} keyframe settings updated`;
|
|
40
|
+
(0, undo_stack_1.pushToUndoStack)({
|
|
41
|
+
filePath: absolutePath,
|
|
42
|
+
oldContents: fileContents,
|
|
43
|
+
newContents: null,
|
|
44
|
+
logLevel,
|
|
45
|
+
remotionRoot,
|
|
46
|
+
logLine,
|
|
47
|
+
description: {
|
|
48
|
+
undoMessage: `↩️ ${undoPropChange}`,
|
|
49
|
+
redoMessage: `↪️ ${redoPropChange}`,
|
|
50
|
+
},
|
|
51
|
+
entryType: 'sequence-props',
|
|
52
|
+
suppressHmrOnFileRestore: true,
|
|
53
|
+
});
|
|
54
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
55
|
+
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
|
|
56
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
|
|
57
|
+
(0, log_update_1.logUpdate)({
|
|
58
|
+
fileRelativeToRoot,
|
|
59
|
+
line: logLine,
|
|
60
|
+
key,
|
|
61
|
+
oldValueString: oldValueStrings[0],
|
|
62
|
+
newValueString: newValueStrings[0],
|
|
63
|
+
defaultValueString: null,
|
|
64
|
+
formatted,
|
|
65
|
+
logLevel,
|
|
66
|
+
removedProps: [],
|
|
67
|
+
addedProps: [],
|
|
68
|
+
});
|
|
69
|
+
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
70
|
+
const status = (0, can_update_sequence_props_1.computeSequencePropsStatusFromContent)({
|
|
71
|
+
fileContents: output,
|
|
72
|
+
keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
|
|
73
|
+
nodePath: updatedNodePath,
|
|
74
|
+
effects: [],
|
|
75
|
+
});
|
|
76
|
+
const updatedSubscriptionKey = { ...nodePath, nodePath: updatedNodePath };
|
|
77
|
+
return {
|
|
78
|
+
canUpdate: true,
|
|
79
|
+
props: status.props,
|
|
80
|
+
results: [
|
|
81
|
+
{ fileName, nodePath: updatedSubscriptionKey, props: status.props },
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
exports.updateSequenceKeyframeSettingsHandler = updateSequenceKeyframeSettingsHandler;
|
|
@@ -3,7 +3,7 @@ export interface UndoEntryDescription {
|
|
|
3
3
|
undoMessage: string;
|
|
4
4
|
redoMessage: string;
|
|
5
5
|
}
|
|
6
|
-
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'keyframe-delete' | 'add-effect' | 'delete-effect' | 'paste-effects' | 'reorder-effect' | 'delete-jsx-node' | 'duplicate-jsx-node' | 'insert-jsx-element' | 'delete-composition' | 'rename-composition' | 'duplicate-composition' | 'delete-folder' | 'rename-folder';
|
|
6
|
+
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'keyframe-delete' | 'add-effect' | 'delete-effect' | 'paste-effects' | 'reorder-effect' | 'reorder-sequence' | 'delete-jsx-node' | 'duplicate-jsx-node' | 'insert-jsx-element' | 'delete-composition' | 'rename-composition' | 'duplicate-composition' | 'delete-folder' | 'rename-folder';
|
|
7
7
|
type UndoEntrySnapshot = {
|
|
8
8
|
filePath: string;
|
|
9
9
|
oldContents: string;
|
|
@@ -37,6 +37,8 @@ type UndoEntry = {
|
|
|
37
37
|
entryType: 'paste-effects';
|
|
38
38
|
} | {
|
|
39
39
|
entryType: 'reorder-effect';
|
|
40
|
+
} | {
|
|
41
|
+
entryType: 'reorder-sequence';
|
|
40
42
|
} | {
|
|
41
43
|
entryType: 'delete-jsx-node';
|
|
42
44
|
} | {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-server"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/studio-server",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.474",
|
|
7
7
|
"description": "Run a Remotion Studio with a server backend",
|
|
8
8
|
"main": "dist",
|
|
9
9
|
"scripts": {
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"@babel/parser": "7.24.1",
|
|
28
28
|
"semver": "7.5.3",
|
|
29
29
|
"prettier": "3.8.1",
|
|
30
|
-
"remotion": "4.0.
|
|
30
|
+
"remotion": "4.0.474",
|
|
31
31
|
"recast": "0.23.11",
|
|
32
|
-
"@remotion/bundler": "4.0.
|
|
33
|
-
"@remotion/renderer": "4.0.
|
|
34
|
-
"@remotion/studio-shared": "4.0.
|
|
32
|
+
"@remotion/bundler": "4.0.474",
|
|
33
|
+
"@remotion/renderer": "4.0.474",
|
|
34
|
+
"@remotion/studio-shared": "4.0.474",
|
|
35
35
|
"memfs": "3.4.3",
|
|
36
36
|
"open": "8.4.2"
|
|
37
37
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ast-types": "0.16.1",
|
|
40
40
|
"react": "19.2.3",
|
|
41
41
|
"@types/semver": "7.5.3",
|
|
42
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
42
|
+
"@remotion/eslint-config-internal": "4.0.474",
|
|
43
43
|
"eslint": "9.19.0",
|
|
44
44
|
"@types/node": "20.12.14",
|
|
45
45
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|