@kubuild/core 0.0.1 → 0.1.0
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/LICENSE +21 -0
- package/dist/commands.d.ts +17 -2
- package/dist/commands.d.ts.map +1 -1
- package/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -12
package/dist/index.js
CHANGED
|
@@ -851,7 +851,8 @@ function findMissingComponentNodes(rootNode, registry, knownTypes) {
|
|
|
851
851
|
// src/commands.ts
|
|
852
852
|
import {
|
|
853
853
|
StyleDefinitionSchema,
|
|
854
|
-
ResponsiveStylesSchema
|
|
854
|
+
ResponsiveStylesSchema,
|
|
855
|
+
AnimationConfigSchema
|
|
855
856
|
} from "@kubuild/schema";
|
|
856
857
|
|
|
857
858
|
// src/command-tree-utils.ts
|
|
@@ -1280,6 +1281,36 @@ function duplicateNode(document, params) {
|
|
|
1280
1281
|
}
|
|
1281
1282
|
};
|
|
1282
1283
|
}
|
|
1284
|
+
function updateAnimation(document, params) {
|
|
1285
|
+
const { nodeId, animation, merge = true } = params;
|
|
1286
|
+
const newDoc = deepClone(document);
|
|
1287
|
+
const loc = findNodeLocation(newDoc.document, nodeId);
|
|
1288
|
+
if (!loc) {
|
|
1289
|
+
throw new Error(`Cannot update animation: Node with ID "${nodeId}" not found in document.`);
|
|
1290
|
+
}
|
|
1291
|
+
const targetNode = loc.node;
|
|
1292
|
+
const previousAnimation = targetNode.animation ? deepClone(targetNode.animation) : void 0;
|
|
1293
|
+
if (animation === null) {
|
|
1294
|
+
delete targetNode.animation;
|
|
1295
|
+
} else {
|
|
1296
|
+
const currentAnimation = targetNode.animation ? deepClone(targetNode.animation) : {};
|
|
1297
|
+
const candidate = merge ? { ...currentAnimation, ...deepClone(animation) } : deepClone(animation);
|
|
1298
|
+
targetNode.animation = AnimationConfigSchema.parse(candidate);
|
|
1299
|
+
}
|
|
1300
|
+
return {
|
|
1301
|
+
document: newDoc,
|
|
1302
|
+
event: {
|
|
1303
|
+
type: "ANIMATION_UPDATED",
|
|
1304
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1305
|
+
nodeId,
|
|
1306
|
+
parentId: loc.parent ? loc.parent.id : void 0,
|
|
1307
|
+
payload: {
|
|
1308
|
+
animation: targetNode.animation,
|
|
1309
|
+
previousAnimation
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1283
1314
|
|
|
1284
1315
|
// src/history.ts
|
|
1285
1316
|
var DEFAULT_MAX_HISTORY = 50;
|
|
@@ -3605,6 +3636,7 @@ export {
|
|
|
3605
3636
|
sanitizeUrl,
|
|
3606
3637
|
saveDraftAsTemplate,
|
|
3607
3638
|
sha256Sync,
|
|
3639
|
+
updateAnimation,
|
|
3608
3640
|
updateProps,
|
|
3609
3641
|
updateStyle,
|
|
3610
3642
|
validateDocument,
|