@craftile/core 0.5.0 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craftile/core",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
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": "0.5.0",
30
- "@craftile/types": "0.5.0"
29
+ "@craftile/event-bus": "0.6.0",
30
+ "@craftile/types": "0.6.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "vitest": "^3.2.4",
@@ -75,6 +75,7 @@ export class BlocksManager {
75
75
 
76
76
  /**
77
77
  * Validate if a block type can be a child of another type
78
+ * Private blocks can only be children if explicitly listed in parent's accepts array (no pattern matching)
78
79
  */
79
80
  canBeChild(childType: string, parentType: string): boolean {
80
81
  const parentSchema = this.get(parentType);
@@ -83,6 +84,15 @@ export class BlocksManager {
83
84
  return false;
84
85
  }
85
86
 
87
+ const childSchema = this.get(childType);
88
+ const isPrivate = childSchema?.private === true;
89
+
90
+ // Private blocks: only exact matches allowed (no patterns)
91
+ if (isPrivate) {
92
+ return parentSchema.accepts.includes(childType);
93
+ }
94
+
95
+ // Non-private blocks: existing pattern matching behavior
86
96
  return parentSchema.accepts.some((pattern) => this.matchesPattern(childType, pattern));
87
97
  }
88
98