Can I share Compose code from Android/Desktop with...
# compose-web
m
Can I share Compose code from Android/Desktop with a website project to get the same UI on the web? I heard there are two versions of Compose Web, one based on HTML and one on canvas rendering. What's the current situation?
h
https://kotlinlang.slack.com/archives/C01F2HV7868/p1640344426333700 Currently, not without
expect/actual
because HTML api is quite different than canvas. Canvas support is work in progress.
c
From the JB team: there are a lot of pieces that need to line up to get Skia-based canvas rendering enabled for Web and iOS, but they are well along in the process. However, there is no telling when we'll get the first previews, so while we can be sure that this is something to look forward to in the future, you probably shouldn't put your web app plans on hold until it's available https://kotlinlang.slack.com/archives/C01F2HV7868/p1642004644028300?thread_ts=1641953978.027700&cid=C01F2HV7868
☝️ 1
m
So today, I shouldn't be trying to use Compose Web? Because the current HTML based version is going away, and the new canvas version doesn't exist yet?
c
I highly doubt the HTML version will be going away once the Canvas version is ready. There will always be a strong use-case for HTML/DOM based web (using existing CSS frameworks, for example), i'd guess there will be separate Compose artifacts one would pick from to use either Material or HTML, just like with Desktop one can choose to use Material, or skip that and use another Desktop theme for the same programming style but with a completely different UI toolkit
m
@Casey Brooks Isn't it what the message from @[JB] Shagen linked above is saying? That the HTML version of Compose Web is deprecated? Or am I misunderstanding?
u
@Marcin Wisniowski we should separate DOM API which will never be obsoleted (it’s impossible to have a web framework without it) and will evolve to cover all needs of web developers and the so-called dom widgets - an experimental attempt to move in direction of compose-like API via DOM - this one indeed is deprecated, Sorry for this confusion.
🙏 1
c
"Web Widgets" was the term for functions in the existing Compose Web DOM-based model that attempted to emulate some of the functionality of Material layouts (Box, Column, Row, etc.), which were basically reimplemented using CSS. Those specific functions are deprecated, because they're working to make the complete canvas-based version of Compose for those that wish to use those type of layouts and widgets. But the rest of the DOM-based model will stay around, basically making Compose a competitor to React for those that wish to continue using normal HTML+CSS layout/styling.
🙌 1