Nesting & Pipeline
Nesting & safety
Components can use other components. The composer resolves recursively up to 8 levels deep, baking scoped data at each level.
- Tenant isolation — a
useonly resolves within the same tenant. - Circular detection — the composer tracks visited handles and rejects cycles (
A → B → A). - Collision check — duplicate
metadata.nameacross the component library fails at load, never silently at render.
Composition pipeline
1. Load the document
2. TemplateComposer resolves every use (recursive, depth-limited) — merges config,
bakes per-use data, stamps section styles, assembles content
3. TemplateDataResolver resolves remaining $data / $item tokens with the caller's data
4. Globals ($global.PAGE, …) and the renderer produce the final PDF / DOCX
Composition runs before the global data pass, so components can carry $data references that resolve with the caller's data.