-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Extract StyleSetters (eg. for colors) into traits and mix them into revelant objects #2
Comments
Agreed. However, I would like to evaluate other options of dealing with styles before spending too much time polishing the current setup. What we have now I inherited from ScalaTags, and I haven't given it much thought yet. For one thing, I don't like that we're extending the I'm thinking maybe to rewrite the styles as e.g.
where
With desired usage like this:
Were we to adopt this kind of API, my biggest concern is discoverability of available values. I gotta check how helpful would IntelliJ be in this scenario. |
Alternatively, with a different set of tradeoffs:
|
Interesting! This would allow for implicits for different color-libraries. And in the worst case one could even provide an implicit from |
Note: This is also relevant to SVG attributes, they have exact same typing problems as CSS properties. |
I'm wondering if we can borrow anything from ScalaCSS. |
Yeah, I'll need to look at how ScalaCSS organizes its types. One of the reasons I'm not delegating the entirety of SDT's CSS business to ScalaCSS is that it's apparently quite bulky in terms of bundle size (low hundreds of KBs in fullopt for 200LoC of CSS, as alleged here: http://scalapro.net/scalacss-is-it-time-for-using-it/). I'm hoping all that size is coming not from the Value/ValueT traits but from all the other irrelevant-to-us machinery required for style generation. |
I think I might actually get this done. Kinda need it for raquo/Laminar#95. Looking into it now. So far it looks like the style props will look like This pattern removes any instantiation of the |
The StyleSetters for the css attribute
color
are also relevant for other css attributes accepting the color property likebackground-color
,border-color
,box-shadow
,outline-color
,text-shadow
.I think code sharing makes sense here.
scala-dom-types/shared/src/main/scala/com/raquo/domtypes/generic/defs/styles/Styles.scala
Line 505 in 06dab59
(I'm writing down ideas I have while porting a project to the current outwatch PR.)
The text was updated successfully, but these errors were encountered: