-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add initial transform API #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why list
? I think we can just have transform: fn (List(Transform)) -> Style
, and we're good, no? We get rid of Transform
, rename TransformFunction
to Transform
, and add None
to Transform
. 🙂
Also, could you please rebase on main?
Having sketch.transform([
transform.none(),
transform.rotateX(size.px(2.))
]) IMO an invalid state should not be representable, but it is a tradeoff. Maybe accept it and add documentation can be a workaround. An alternative suggestion for the API is to expose two functions: transform: Transform -> Style
transforms: List(Transform) -> Style But the problem with inlining |
Hmm, I did not thought about this… What about the empty list of transform functions? Isn't it the case where we'd like to output |
This can be a valid solution, but IMO |
Rebased on main |
To start, sorry for being missing so long & thanks a lot for your changes! I'd like the subject to advance before I make any change to Sketch in future, because I'm excited to get I don't understand why there's so much noise in your patch set. It looks like your repo is not up-to-date with main branch. Could you try an other rebase to see if it removes the noise? Apart from this, one quick remark: there's no more |
transform.to_string([]) is now None, the None constructor doesn't exists the only way to construct none is with transform.to_string([]). Besides that, Transform type represents the TransformFunction type of CSS WG spec
3a78593
to
970f490
Compare
Hey, rebased on main and added Now i hope everything is okay, please let me know if i should change anything |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a last small bugfix, and we're good to go!
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry coming back once, everything is fine, but tests are not correct. Could you fix them?
Thanks a lot! |
Here is a suggestion of the transform API, it was implemented based on css-transform-1 spec but i noticed that there is a newer version css-transform-2 spec that has some additions/changes.
From the first version of the spec, only the
matrix()
function is not implemented.I dispose myself to update the current implementation to
css-transform-2
after review of the API status, but would like to know if it is preferable to do it in this PR or create a new one.