-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Minimal demo of assigning style properties via just passing js object #1636
base: master
Are you sure you want to change the base?
Conversation
@@ -31,6 +31,7 @@ kotlin { | |||
dependencies { | |||
implementation(project(":internal-web-core-runtime")) | |||
implementation(kotlin("stdlib-js")) | |||
implementation("org.jetbrains.kotlin-wrappers:kotlin-csstype:3.0.10-pre.283-kotlin-1.6.10") |
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.
do we need this dependency in web/core?
I thought it's going to be added by users in their projects.
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.
Your understanding is 100% correct - just like I said at the meeting it's a fake PR - nobody is going to merge this one - it was just to illustrate so that we check whether we need this (and this dependency was added for test)
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.
got it, thanks! :)
i forgot that it's a fake PR
@@ -43,6 +48,14 @@ open class AttrsBuilder<TElement : Element> : EventsListenerBuilder() { | |||
styleBuilder.apply(builder) | |||
} | |||
|
|||
fun style(propertyHolder: Any) { |
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.
maybe adding one of our @Experimental
annotation can be beneficial in this case.
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.
UPD: not now, since this PR won't be merged for now (as discussed above)
@@ -43,6 +48,14 @@ open class AttrsBuilder<TElement : Element> : EventsListenerBuilder() { | |||
styleBuilder.apply(builder) | |||
} | |||
|
|||
fun style(propertyHolder: Any) { | |||
styleBuilder.apply { | |||
Object.entries(propertyHolder).forEach { (k, v) -> |
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.
Did you want to try with Object.assign()
?
It seems that with Object.assign()
we can avoid having forEach
loop.
No description provided.