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

Minimal demo of assigning style properties via just passing js object #1636

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Schahen
Copy link
Collaborator

@Schahen Schahen commented Dec 23, 2021

No description provided.

@@ -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")
Copy link
Member

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.

Copy link
Collaborator Author

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)

Copy link
Member

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) {
Copy link
Member

@eymar eymar Dec 23, 2021

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.

Copy link
Member

@eymar eymar Dec 23, 2021

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) ->
Copy link
Member

@eymar eymar Dec 23, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants