Comments (4)
In outwatch, we also handle class
attributes differently, because we make them accumulate multiple assigned values. Currently, we just override the className
member in RefectedAttrs
(https://github.com/OutWatch/outwatch/blob/master/src/main/scala/outwatch/dom/DomTypes.scala#L110).
Style is maybe another "special kind" of attribute where a different handling might be needed. How do we decide, which of the values needs a special handling and which one does not? Why do you not like overriding the value?
from scala-dom-types.
Problem is, I want to be able to do pass both Observable[String]
and Observable[Map[String, Boolean]]
to the <-- method, but without allowing a custom type for cls
in SDT that's not possible because with a String codec Laminar's ReactiveClassAttr
expects the <--
method to accept Observable[String]
, whereas I need it to accept Observable[String | Map[String, Boolean]]
as I can't create another <--
method that would accept Observable[Map[String, Boolean]]
because of type erasure. (I hope that because-chain is not too confusing, lol)
I guess I could work around this in Laminar with e.g. implicit value classes, but I'm not a fan of using implicits for such a popular use case. Besides, it's merely coincidental that I want to retain a string-based API in this case, and if I didn't want that I wouldn't have been able to accomplish what I want at all.
I'm working on this now on Laminar side, we'll see how it goes...
from scala-dom-types.
I see, that is indeed a good use case! In your dsl, you cannot diverge from the type signature of SDT and you are forced to expose it. Only changing semantics is possible.
Totally agree with your initial approach of using an OpinionatedAttr
trait then. At least, we can then circumvent the problem for some of the likely candidates.
from scala-dom-types.
Alright, coming soon as v0.9. Existing consuming libraries will just need to mix in two more traits (HTML and SVG) to retain current functionality.
from scala-dom-types.
Related Issues (20)
- Unescaped text entity -- raw() HOT 9
- Separation of reflected attributes and attributes with complex keys HOT 5
- Automatically generate dom types HOT 4
- Key renaming proposals HOT 4
- Discussion about lazy val definitions HOT 8
- implicit def eventPropToEventPropTransformation interferes sometimes HOT 2
- img loading attribute not supported HOT 2
- Support fullscreenchange event HOT 2
- Merge colliding html and svg attr names into shared namespace. HOT 3
- More complete code example HOT 1
- Aria Attributes should be usable from SVG too, not just HTML HOT 3
- Add flow-relative CSS properties HOT 2
- Server Side Rendering HOT 4
- Support HTML Dialog Element HOT 6
- Switch definitions from lazy vals to vals? HOT 2
- RFC: Use concrete types instead of generic type params? HOT 20
- Add info about supported tags to props/attrs HOT 6
- Publish defs (and generators?) for popular web component libraries, e.g. UI5, Material HOT 10
- Add ff4s to list of UI libs that use scala-dom-types HOT 13
- How to add a new property to a img? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scala-dom-types.