Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive Params #49

Merged
merged 1 commit into from
Mar 11, 2024
Merged

Recursive Params #49

merged 1 commit into from
Mar 11, 2024

Conversation

jake-figma
Copy link
Collaborator

@jake-figma jake-figma commented Mar 11, 2024

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.

@jake-figma jake-figma self-assigned this Mar 11, 2024
@jake-figma jake-figma added the enhancement New feature or request label Mar 11, 2024
@jake-figma jake-figma merged commit c6bd81f into main Mar 11, 2024
@jake-figma jake-figma deleted the jake/recursive-params branch March 11, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant