@craftile/core 1.2.0 → 1.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craftile/core",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Framework-agnostic block editor engine for Craftile",
5
5
  "keywords": [
6
6
  "craftile",
@@ -26,8 +26,8 @@
26
26
  "src"
27
27
  ],
28
28
  "dependencies": {
29
- "@craftile/event-bus": "1.2.0",
30
- "@craftile/types": "1.2.0"
29
+ "@craftile/event-bus": "1.2.1",
30
+ "@craftile/types": "1.2.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "vitest": "^3.2.4",
@@ -76,6 +76,7 @@ export class InsertBlockFromPresetCommand implements Command {
76
76
 
77
77
  if (this.presetData) {
78
78
  this.insertedBlock = {
79
+ ...structuredClone(this.presetData),
79
80
  type: this.blockType,
80
81
  id: this.blockId,
81
82
  name: this.presetData.name || blockSchema?.meta?.name || this.blockType,
@@ -83,10 +84,6 @@ export class InsertBlockFromPresetCommand implements Command {
83
84
  properties: this.properties,
84
85
  children: [],
85
86
  parentId: undefined,
86
- static: this.presetData.static,
87
- disabled: this.presetData.disabled,
88
- repeated: this.presetData.repeated,
89
- ghost: this.presetData.ghost,
90
87
  };
91
88
 
92
89
  this.page.blocks[this.blockId] = this.insertedBlock;
@@ -195,6 +192,7 @@ export class InsertBlockFromPresetCommand implements Command {
195
192
  const childProperties = this.buildProperties(childSchema, structure.properties);
196
193
 
197
194
  const childBlock: Block = {
195
+ ...structuredClone(structure),
198
196
  type: structure.type,
199
197
  id: childId,
200
198
  name: structure.name || childSchema.meta?.name || structure.type,
@@ -202,10 +200,6 @@ export class InsertBlockFromPresetCommand implements Command {
202
200
  properties: childProperties,
203
201
  children: [],
204
202
  parentId,
205
- static: structure.static,
206
- disabled: structure.disabled,
207
- repeated: structure.repeated,
208
- ghost: structure.ghost,
209
203
  };
210
204
 
211
205
  this.page.blocks[childId] = childBlock;
@@ -65,6 +65,7 @@ export class ReplaceRegionCommand implements Command {
65
65
 
66
66
  const blockId = generateId();
67
67
  const block: Block = {
68
+ ...structuredClone(structure),
68
69
  type: structure.type,
69
70
  id: blockId,
70
71
  name: structure.name || blockSchema.meta?.name || structure.type,
@@ -72,10 +73,6 @@ export class ReplaceRegionCommand implements Command {
72
73
  properties: this.buildProperties(blockSchema, structure.properties),
73
74
  children: [],
74
75
  parentId,
75
- static: structure.static,
76
- disabled: structure.disabled,
77
- repeated: structure.repeated,
78
- ghost: structure.ghost,
79
76
  };
80
77
 
81
78
  target[blockId] = block;
package/src/engine.ts CHANGED
@@ -278,15 +278,9 @@ export class Engine extends EventBus<EngineEvents> {
278
278
  throw new Error(`Block not found: ${blockId}`);
279
279
  }
280
280
 
281
+ const { parentId: _parentId, children: _children, ...rest } = structuredClone(block);
281
282
  const structure: BlockStructure = {
282
- type: block.type,
283
- id: block.id,
284
- semanticId: block.semanticId,
285
- properties: structuredClone(block.properties),
286
- name: block.name,
287
- static: block.static,
288
- disabled: block.disabled,
289
- repeated: block.repeated,
283
+ ...rest,
290
284
  children: [],
291
285
  };
292
286