jw
02/10/2021, 8:33 PMspierce7
02/11/2021, 2:11 AMjw
02/11/2021, 2:17 AMjw
02/11/2021, 2:20 AMaltavir
02/11/2021, 5:53 AMjw
02/11/2021, 2:46 PMspierce7
02/11/2021, 3:23 PMEverything renders to Canvas and you ignore native DOM elements?That doesn’t sound that terrible, except for scraping / SEO purposes. However would be a potentially great approach for anything behind an auth system. Flutter is taking the approach of generating DOM elements, and that seems to be working for them, however it’s significantly more difficult I imagine.
jw
02/11/2021, 4:56 PMspierce7
02/11/2021, 6:15 PMjw
02/11/2021, 6:47 PMaltavir
02/11/2021, 8:29 PMspierce7
02/12/2021, 3:01 AMOnly if you want to drag along Compose UI. Writing fresh composables that target the DOM is trivialFair point. It’s not the dream, but it’s better than having to deal with each system UI individually. What do you think about Compose UI on iOS? Surely that’d be beneficial. While you might not care about material widgets inside of an iOS app, it wouldn’t come with the same tradeoffs, and you would care about the layouts, and things like Modifiers.
androidx.compose.ui
encompasses quite a bit.jw
02/12/2021, 3:07 AMspierce7
02/12/2021, 3:34 AMchristophsturm
02/13/2021, 2:39 PMjw
02/13/2021, 3:25 PM@Composable
that calls ComposeNode
and creates the associated DOM element. Then you just add parameters and updater setters to assign values.
Something like
@Composeable
Anchor(href: String, children: @Composable () -> Unit) {
ComposeNode(
factory = { document.createElement("a") },
updater = {
set(href) {
this.href = href
}
},
children = children,
)
}
Ideally you'd auto-generate all of these from the HTML spec.
Then you write a DomApplier that subclasses AbstractApplier and can manipulate DOM trees and you're basically done.jw
02/13/2021, 3:27 PMspierce7
02/26/2021, 4:49 PMspierce7
02/26/2021, 4:51 PMjw
02/26/2021, 5:02 PMhfhbd
03/04/2021, 10:05 AMID
like SwiftUI? In SwiftUI, each Model needs to conform to Identifiable
, which has only one id
property, to compare between the changed objects, because the reference of the object could be changed, but the semantic id
did not.