Essentially, we are generating all the params (including recursive children) upfront before compiling templates.
Until now, params generation and children traversal has been coupled to compilation making it hard to test and certain statements impossible. "will any of this node's children render in this template?" is a better and different question than, "does this node have children with a snippet template?" which is different than the more primitive and currently supported, "does this node have children?"
This is no longer a limitation, allowing statements like {{?figma.children}} (if any children will render for this template) and {{!figma.children}} (if no children render for this template).
See test.ts for a sense of what's possible. Params objects can contain children and child templates. They hydrate templates and can be compared to expected strings. This means we can test and preview full recursive template compilation outside the Figma environment.
Still have some cleanup to do, but this is a big first step towards optimal params generation.
Working to improve params generation per #48
Essentially, we are generating all the params (including recursive children) upfront before compiling templates.
Until now, params generation and children traversal has been coupled to compilation making it hard to test and certain statements impossible. "will any of this node's children render in this template?" is a better and different question than, "does this node have children with a snippet template?" which is different than the more primitive and currently supported, "does this node have children?"
This is no longer a limitation, allowing statements like
{{?figma.children}}
(if any children will render for this template) and{{!figma.children}}
(if no children render for this template).See test.ts for a sense of what's possible. Params objects can contain children and child templates. They hydrate templates and can be compared to expected strings. This means we can test and preview full recursive template compilation outside the Figma environment.
Still have some cleanup to do, but this is a big first step towards optimal params generation.