I’d like to add to @fredguth’s reply by expanding on elembic a bit (see full discussion: Elembic 1.0.0: Custom elements and types!).
As has been extensively discussed above by @Mc-Zen and others, I believe Typst’s own styling system will probably be the future of configuration of templates and packages, as it’s handy to set values applying to nested elements, without needing multiple levels of configuration. Something like:
#set template.appendix(supplement: [My Appendix])
#set template.figure-outline(use-boxes: false)
#show template.front-page: set template.text(sans-font: "Source Sans Pro")
#show template.theorem: emph
// instead of
#show: template.with(
appendix: (supplement: [My Appendix]),
figure-outline: (use-boxes: false),
front-page: (text: (sans-font: "Source Sans Pro")),
show_: (theorem: emph),
// ...
)
For this reason, I created elembic which rewrites Typst’s styling system from scratch - show rules, set rules on functions (elements), typechecking - so we can experiment with creating our own settable properties and the like until this is implemented in the compiler itself (without using state). Following the same example, it allows for something that is fairly close:
#show: e.set_(template.appendix, supplement: [My Appendix])
#show: e.set_(template.figure-outline, use-boxes: false)
#show: e.filtered(template.front-page, e.set_(template.text, sans-font: "Source Sans Pro"))
#show: e.show_(template.theorem, emph)
For a full example on how to add settable properties to a template, you can check the handbook: Simple Thesis - The Elembic Handbook
The idea is, of course, still maturing. Someone pointed out that using set rules makes it harder to turn certain fields mandatory, requiring some duplication. There is some discussion on how to potentially improve this here, and contributions are welcome: Rewrite thesis template by siefkenj · Pull Request #69 · PgBiel/elembic · GitHub
All in all, I think elembic might be a great option to experiment with for templates today and gather feedback. But it must be noted that the end goal is to have its core features (notably custom setable and showable functions, as well as some form of typechecking) available in Typst itself, without needing a package.