@platforma-sdk/block-tools 2.10.16 → 2.10.17

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.
@@ -30,17 +30,17 @@ type InnerWhenHandler = (trigger: TriggerFn, body: () => void) => boolean;
30
30
  * `content-rules.ts` at load time to avoid a circular import). */
31
31
  export declare function registerInnerWhenHandler(h: InnerWhenHandler): void;
32
32
  /**
33
- * Conditionally run `body`. Two dispatch modes by active state:
34
- * - inside `defineStructure(...)` → push a `WhenFrame` into the tree;
35
- * trigger fires later at runner time per `FlatItem`.
36
- * - inside a `managed(...)` body → evaluate `trigger` immediately
37
- * against the runner-supplied `TriggerContext`; run/skip `body`
38
- * synchronously.
33
+ * Conditionally run `body`, with an optional `elseBody`. One `when` symbol for
34
+ * both layers — `dispatchWhen` picks the timing:
35
+ * - inside `defineStructure(...)` → register a `WhenFrame`; its trigger fires
36
+ * later, per module, at runner time.
37
+ * - inside a `managed(...)` body → evaluate the trigger against the live block
38
+ * now and run/skip synchronously.
39
39
  *
40
- * One `when` symbol for both layers — same user contract, dispatch
41
- * picks the matching execution timing.
40
+ * `else` is just the negated trigger dispatched the same way, so exactly one
41
+ * branch applies (in either layer).
42
42
  */
43
- export declare function when(trigger: TriggerFn, body: () => void): void;
43
+ export declare function when(trigger: TriggerFn, body: () => void, elseBody?: () => void): void;
44
44
  /** Trigger factory: true when at least one file in the leaf's module
45
45
  * matches `glob` (module-relative — see `TriggerContext.filesMatch`). Use
46
46
  * to gate a rule on the presence of co-located files, e.g. add a vitest