@craftile/core 1.1.2 → 1.2.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": "1.1.2",
3
+ "version": "1.2.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": "1.1.2",
30
- "@craftile/types": "1.1.2"
29
+ "@craftile/event-bus": "1.2.0",
30
+ "@craftile/types": "1.2.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "vitest": "^3.2.4",
@@ -76,6 +76,7 @@ export class BlocksManager {
76
76
  /**
77
77
  * Validate if a block type can be a child of another type
78
78
  * Private blocks can only be children if explicitly listed in parent's accepts array (no pattern matching)
79
+ * Patterns in the parent's rejects array remove matches from accepts, including private blocks
79
80
  */
80
81
  canBeChild(childType: string, parentType: string): boolean {
81
82
  const parentSchema = this.get(parentType);
@@ -84,6 +85,10 @@ export class BlocksManager {
84
85
  return false;
85
86
  }
86
87
 
88
+ if (parentSchema.rejects?.some((pattern) => this.matchesPattern(childType, pattern))) {
89
+ return false;
90
+ }
91
+
87
92
  const childSchema = this.get(childType);
88
93
  const isPrivate = childSchema?.private === true;
89
94
 
@@ -104,7 +109,7 @@ export class BlocksManager {
104
109
  }
105
110
 
106
111
  /**
107
- * Check if a child type matches a pattern from the accepts list
112
+ * Check if a child type matches a pattern from the accepts or rejects list
108
113
  * Supports glob-style wildcards: '*', '@theme/*', '*-button', '*type*', etc.
109
114
  */
110
115
  private matchesPattern(childType: string, pattern: string): boolean {