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

Add types and coercions for "variable" types like stroke and fill #30

Open
jneug opened this issue Jun 7, 2024 · 2 comments
Open

Add types and coercions for "variable" types like stroke and fill #30

jneug opened this issue Jun 7, 2024 · 2 comments
Labels
coercions Issue or PR relating to valkyrie coercions types Issue or PR relating to valkyrie types
Milestone

Comments

@jneug
Copy link
Contributor

jneug commented Jun 7, 2024

#18 added a schema for the Typst builtin type "stroke". But most of the time stroke arguments accept either one of stroke, length, color or dict. Similarly fill usually accepts color, gradient or pattern.

There should be types to support this, since those are very common use-cases in Typst.

I suggest these compound types:

  • strokes: z.either(z.stroke(), z.length(), z.color(), z.dictionary( (thickness: z.length(optional:true), ...) ))
  • fill: z.either(z.color(), z.gradient(), z.pattern()) (pattern is still missing as a base-type, I think)
  • inset: z.either(z.length(), z.dictionary( (x: z.length(optional:true), ...) ))

I probably missed some.

@jamesrswift
Copy link
Member

A lot of these will be getting coercions in a future update. Most likely it will be in the form of additionally accepted types followed by a default post-transform.

Will keep this open to track.

@jamesrswift jamesrswift added coercions Issue or PR relating to valkyrie coercions types Issue or PR relating to valkyrie types labels Jun 7, 2024
@jamesrswift
Copy link
Member

Regarding inset and other such things, these would make for a good addition as a schema rather than a type (see schema folder for examples)

@jamesrswift jamesrswift added this to the 0.2.2 milestone Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coercions Issue or PR relating to valkyrie coercions types Issue or PR relating to valkyrie types
Projects
None yet
Development

No branches or pull requests

2 participants