@hyperframes/studio-server 0.8.115 → 0.8.116
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/index.js +18 -22
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -591,6 +591,7 @@ import {
|
|
|
591
591
|
addMotionPathToScript,
|
|
592
592
|
removeArcPathFromScript,
|
|
593
593
|
addAnimationWithKeyframesToScript,
|
|
594
|
+
replaceTweenWithKeyframesInScript,
|
|
594
595
|
splitAnimationsInScript,
|
|
595
596
|
splitIntoPropertyGroupsFromScript,
|
|
596
597
|
shiftPositionsInScript,
|
|
@@ -1462,6 +1463,21 @@ function bakeVisibilityOnDelete(document, anim) {
|
|
|
1462
1463
|
} catch {
|
|
1463
1464
|
}
|
|
1464
1465
|
}
|
|
1466
|
+
function replaceInPlaceUnlessSetOrUnknown(scriptText, body) {
|
|
1467
|
+
const edit = { ...body, easeEach: resolveReplacementEaseEach(scriptText, body) };
|
|
1468
|
+
const inPlace = replaceTweenWithKeyframesInScript(scriptText, body.animationId, edit);
|
|
1469
|
+
if (inPlace !== null) return inPlace;
|
|
1470
|
+
const script = removeAnimationFromScript(scriptText, body.animationId);
|
|
1471
|
+
return addAnimationWithKeyframesToScript(
|
|
1472
|
+
script,
|
|
1473
|
+
body.targetSelector,
|
|
1474
|
+
body.position,
|
|
1475
|
+
body.duration,
|
|
1476
|
+
body.keyframes,
|
|
1477
|
+
body.ease,
|
|
1478
|
+
edit.easeEach
|
|
1479
|
+
).script;
|
|
1480
|
+
}
|
|
1465
1481
|
function resolveReplacementEaseEach(scriptText, request) {
|
|
1466
1482
|
if (request.easeEach !== void 0) return request.easeEach;
|
|
1467
1483
|
const original = parseGsapScriptAcorn(scriptText).animations.find(
|
|
@@ -1868,17 +1884,7 @@ function executeGsapMutationAcorn(body, block, respond) {
|
|
|
1868
1884
|
if (keyframesWritePosition(body.keyframes) || keyframesWriteRotation(body.keyframes)) {
|
|
1869
1885
|
stripStudioEditsFromTarget(block.document, body.targetSelector);
|
|
1870
1886
|
}
|
|
1871
|
-
|
|
1872
|
-
const added = addAnimationWithKeyframesToScript(
|
|
1873
|
-
script,
|
|
1874
|
-
body.targetSelector,
|
|
1875
|
-
body.position,
|
|
1876
|
-
body.duration,
|
|
1877
|
-
body.keyframes,
|
|
1878
|
-
body.ease,
|
|
1879
|
-
resolveReplacementEaseEach(block.scriptText, body)
|
|
1880
|
-
);
|
|
1881
|
-
return added.script;
|
|
1887
|
+
return replaceInPlaceUnlessSetOrUnknown(block.scriptText, body);
|
|
1882
1888
|
}
|
|
1883
1889
|
case "split-animations": {
|
|
1884
1890
|
if (typeof body.originalId !== "string" || !body.originalId || typeof body.newId !== "string" || !body.newId || typeof body.splitTime !== "number" || !Number.isFinite(body.splitTime) || typeof body.elementStart !== "number" || !Number.isFinite(body.elementStart) || typeof body.elementDuration !== "number" || !Number.isFinite(body.elementDuration) || body.elementDuration <= 0) {
|
|
@@ -2200,17 +2206,7 @@ async function executeGsapMutationRecast(body, block, respond) {
|
|
|
2200
2206
|
if (keyframesWritePosition(body.keyframes) || keyframesWriteRotation(body.keyframes)) {
|
|
2201
2207
|
stripStudioEditsFromTarget(block.document, body.targetSelector);
|
|
2202
2208
|
}
|
|
2203
|
-
|
|
2204
|
-
const added = addAnimationWithKeyframesToScript2(
|
|
2205
|
-
script,
|
|
2206
|
-
body.targetSelector,
|
|
2207
|
-
body.position,
|
|
2208
|
-
body.duration,
|
|
2209
|
-
body.keyframes,
|
|
2210
|
-
body.ease,
|
|
2211
|
-
resolveReplacementEaseEach(block.scriptText, body)
|
|
2212
|
-
);
|
|
2213
|
-
return added.script;
|
|
2209
|
+
return replaceInPlaceUnlessSetOrUnknown(block.scriptText, body);
|
|
2214
2210
|
}
|
|
2215
2211
|
case "split-animations": {
|
|
2216
2212
|
if (typeof body.originalId !== "string" || !body.originalId || typeof body.newId !== "string" || !body.newId || typeof body.splitTime !== "number" || !Number.isFinite(body.splitTime) || typeof body.elementStart !== "number" || !Number.isFinite(body.elementStart) || typeof body.elementDuration !== "number" || !Number.isFinite(body.elementDuration) || body.elementDuration <= 0) {
|