<https://medium.com/@tiz_26128/the-patchwork-jail-...
# feed
t
s
actual library support is basically non-existent
I have to strongly disagree. The most important Multiplatform libraries are available for wasmJS by now. I did https://stefan-oltmann.de/oni-seed-browser , which is a full-featured production app used by thousands of users every day and it’s super stable - despite the tech being officially not production ready. In https://stefan-oltmann.de/pixelsafe/ I even have cryptography included. I did some more projects with Compose for Web and I didn’t miss anything so far.
t
Please let me know the high-level multiplatform libraries that actually can render me a tree or a select with customizable options, dropdowns, context menus, popups etc. I need working application components, not basic building blocks.
1
Not to mention that the "dialog" implementation of Compose the last time I've checked was basically useless. Please show me a complex multiplatform Web app that uses those libraries.
s
That’s not supported for Desktop or Android, too. Compose is mostly basic building blocks. I feel that’s another topic. You claimed that library support for wasmJS is non-existent and I don’t see that.
t
It is non existent for practical, enterprise purposes.
I understand that you can draw things on Canvas. Great. That is not support, that is proof-of-concept.
s
What libraries available for Desktop and Android do you miss on wasmJS?
t
I compare wasmJS to Kotlin/JS with the whole world behind it. I don't need what is available for Android. I need what is available on ALL browsers.
s
See my wasm apps above… they are not proof of concept. They are full function apps.
t
They are from complex web application point of view.
By complex I mean enterprise level, data sensitive web applications.
s
I think that should be possible to build. What’s missing?
t
Everything. Show me a form please. Validation, translation, selects, etc.
Just to give you an idea: can you write the UI of IntelliJ easily with those tools?
s
Yes, some ready-to-use components like drop-downs etc are not included with basic compose, which is mostly basic blocks. Those things are added by libraries. But that’s nothing special to Compose for Web. Compose is the same on all platforms.
t
That's the problem. I have to write working actual web applications like this:
An in this Compose is not especially good I think.
s
I could do it. That’s definitely possible. Do I need to craft some of the missing UI things myself? Sure. Can I? Yes.
t
Yes, the point is that I did craft those things. They are there, they are working, they are open source.
Of course you can do everything if you have a Canvas. Have you done it? Is it there? Is it working?
Why the bloody hell do you attack each of my posts which this nonsense?
s
I agree with you that Compose in comparison to some other UI frameworks is more basic and doesn’t feature many high level components (for example zoom containers) out of the box. That’s indeed unfortunate and I expect that to change in the future. But again, thats not special to web. Compose works for me on all platforms the same and I feel it’s ready for production. At least it didn’t fail me yet.
t
The point is, I - and in my opinion KMP - cannot wait until those things will be there. It takes too long and Compose have some fundamental problems that makes these hard to do well.
Not to mention, that Compose is just one small part of the problem.
s
Why the bloody hell do you attack each of my posts which this nonsense?
Excuse me? I didn’t mean any offense and I’m not aware that we had this discussion before. I was just wondering why you claim that wasmJS has no library support while I see most libraries supporting it.
👍 1
But I feel this isn’t a fruitful discussion if you feel offended, so I’m out.
t
Great, last time we've talked I took 4 months away from Slack... please try to be minimally supportive even if you don't like something.
s
Sorry to hear that. I really don’t remember that. I need to search.
t
It was when I posted a screenshot and written that a demo will be available in two weeks. Your answer was "Where is the link?" which is technically correct, but rather rude. You see, there are a few people who actually does something for Kotlin. I've spent about two years on this, no support from anyone and I've kept going AND I kept it open source. Would a "Please post a link as well as per channel rules." be to hard to write down?
This is not a small library. It has 80+ K lines of Kotlin and 10+ K lines of markdown documentation. And I fought with myself all the way to keep it open.
s
Sorry, I didn’t mean to be rude. 🙏🏻 I wasn’t aware it came across like that.
t
Well, what happened, happend. Just please try keep in mind that others may have very different point of view.
s
Let me review it. I’m searching right now.
It was here in #C0BJ0GTE2 4 months ago?
t
About... 2-3 weeks before Easter.
👀 1
s
I seem to be unable to find what you mean.
t
You see, I actually try pretty hard not to spam #C0BJ0GTE2 and keep to myself, even as I pour countless hours of work into this project. Seeing here that each post about the next Compose color slider gets 10+ likes while that it is like 1/1000th part of what I do... that's hard. Not to belittle the work of the guys who do the color slider, but it is especially discouraging. I understand that people are not interested. Ok. But I cannot accept the blind faith in Compose, because I honestly feel that if Compose keeps going on without actual alternatives it will kill Kotlin.
s
I just did a search and I indeed don't see you spamming #C0BJ0GTE2. This year you shared only another medium article, which I didn't respond to. So if you have a direct link to what you mean this would help me greatly in understanding. I'm interested in your work! Adaptive looks interesting to me. If you feel that there is a gap and you want to provide a solution, that's super great! 💯 I just didn't understand the claim that wasmJS has no library support (see my quotation), because I feel that's not true. That's what I wanted to discuss / understand. And so far you talked about compose only offering basic building blocks. I agree there. But that's the same on all platforms for Compose.
t
I do apologize, it wasn't you, I've checked back.
That is my bad, I'm sorry.
s
I'm glad that this got sorted out! 🙂
t
Anyway, I feel that the competitor of Compose for wasm is not other Compose platforms but the whole JavaScript ecosystem. Hence non-existent.
Which doesn't mean it is lacking in comparison to other Compose platforms, but lacking in applicability for complex projects.
s
Thanks for clarifying that. You see, that quoted line confused me a bit.
m
I have to admit that I feel a little bit like @Tóth István Zoltán. KMP in general and wasmJs in partikular do have a library support problem and I just can’t see how this could be resolved in any foreseeable future. In my projects I constantly stumble over functionality which I need, and which would be readily available on other platforms like Java or JavaScript for example, but which are not available for KMP. It also costs a lot of time having to pick up different libraries from other platforms and combine them into something multi-platform. In addition it is a support nightmare having to keep track of all these different libraries, of different quality on different platforms where you cannot expect to be an expert for in all cases. @Stefan Oltmann You also had to resort to Pako, for example, to get inflate/deflate into your code because there is no KMP support for that. Just last week I finally implemented the missing ZipFileSystem support for wasmJs in Okio just because the makers of this library think it is better to leave out this basic functionality from their library because they are afraid that it otherwise would get too big (which isn’t true, especially when you make this optional). These are just a few examples but they cost time and are a constant source of frustration. Right now I am thinking about how to get QR-Code scanning into a wasmJs PWA which is supposed to work on mobile 🤔. Oh, did I forget to say that I nevertheless like the idea of multi-platform programming 😉.
👍 1
s
@Michael Paus Thank you for the reminder on Pako. 👍 I totally forgot about that. 😅
So if we go that route KMP also missed an image metadata framework, before I stepped in porting and extending Apache Commons Imaging to KMP. It’s still a growing ecosystem. WasmJS was the recent addition, so it took some time to get supported. I had to wait for Ktor 3 until I was able to bring the ONI Seed Browser, which requires networking.
I didn’t try that yet, but I believe all libraries used by Ashampoo Photo Organizer are now targeting wasmJS, too. A web version is on my list.
s
Oh funny, I also ran into the lack of a KMP compression solution and tried porting zlib to pure kotlin. It's like 90% there, passing some but not all tests yet.
👍 1
s
That’s great. The ecosystem needs something pure Kotlin. Actually there is already a pure implementation that’s part of the Korge game engine, but extracting it there looks like a lot of work - so a clean rewrite or a pako port may be the better approach. Why do you plan to add platform specific implementations in addition? For the performance? So that your implementation is just a fallback?
t
Isn't deflate available on all platforms as native function?
s
Nope.
t
Which ones missing it?
s
WasmJS / regular JS needs to use Pako
t
Regular JS has deflate.
s
t
I guess it is available for WASM as well, but I don't know that to be honest.
The one I linked is "browser-native". It does not use any libraries.
s
So your deflate call is somewhere implemented in the std lib? I don’t find it mentioned in the docs, but I’m also bad at googling.
t
Yes, it is a browser API, standard.
It does not build a proper Zip file AFAIK, hence the ZipBuilder I've linked above.
s
Ah, that makes sense. Cool. So only the compression part is missing in Kotlin/Js
Yeah, I can see why browsers can just decompress… the server side is doing the compression.
t
Nah, they can compress and decompress.
I build ZIP files in the browser for download on-the-fly without server interacion.
very nice 1
Actually, I build Xlsx files which are zip...
s
But compression is not build into the standard API? If they can, why does Pako exist?
t
It is, the ZIP file header building is not.
s
Ok, if I got that right I don’t actually need Pako in my lib? I just use it for zlib compression & decompression… not for zips, for PNGs compressed metadata.
t
Yes, that would work I think.
🤔 1
s
I have no idea how to change https://github.com/Ashampoo/kim/blob/main/src/wasmMain/kotlin/com/ashampoo/kim/common/ZLib.wasm.kt accordingly. I got that code with help of the friendly people in #CDFP59223 , because web tech isn’t mine. 😔 ( That’s why I would still prefer pure Kotlin as I can understand what’s going on there. 😅 )
t
Patchwork.... :D
s
Yes, for zlib I agree 100% and I’m sorry I forgot about that in my first post here. 😅 🙈
t
You can check the code I linked above. It does the compression of a byte array.
s
Zlib is too much math for me, otherwise I would have done it already. I ported Adobe XMP & Apache Commons Imaging for my needs.
t
Copy code
import kotlinx.coroutines.await
import org.khronos.webgl.ArrayBuffer
import org.w3c.fetch.Response

internal suspend fun deflate(input: dynamic): ArrayBuffer {
    val readableStream = ReadableStream(js("{ start : function(controller) { controller.enqueue(input); controller.close(); } }"))
    val compressionStream = CompressionStream("deflate-raw")
    val compressedStream = readableStream.pipeThrough(compressionStream)

    return Response(compressedStream).arrayBuffer().await()
}

external class ReadableStream(options: dynamic) {
    fun pipeThrough(transform: dynamic, options: dynamic = definedExternally): dynamic
}

external class CompressionStream(algorithm: String) {
    val readable: ReadableStream
}
👀 1
And then:
Copy code
suspend fun add(filename: String, data: ByteArray) {
        val deflated = deflate(data.toPlatformArray())
        val compressed = Uint8Array(deflated).toKotlinArray()
And...
Copy code
fun Uint8Array.toKotlinArray(): ByteArray =
    Int8Array(buffer, byteOffset, byteLength).unsafeCast<ByteArray>()

@Suppress("NOTHING_TO_INLINE")
inline fun ByteArray.toPlatformArray(): Uint8Array {
    val i8a = unsafeCast<Int8Array>()
    return Uint8Array(i8a.buffer, i8a.byteOffset, i8a.byteLength)
}
I think that's all. 😀
s
Why do you plan to add platform specific implementations in addition? For the performance?
So that your implementation is just a fallback?
I did it mainly for the ease of writing tests and benchmarks against the known working version. So figured I'd include it in the library if someone wants it (also as a library architecture test case for plugging in "different" compression algos)
t
crypto, compression I try to keep distance from because they are time sinks
s
@Tóth István Zoltán Thanks. I’ll give that a shot. Can you lay out how the decompression would look like?
t
I guess the similar but you use DecompressionStream instead of CompressionStream.
👍 1
s
@Sargun Vohra Yes, that sounds reasonable. The native test can just compare with native zlib implementation. For my test if everything works I just compressed and decompressed the text of Alice in wonderland in commonTest 😄
s
The compression streams API only works in an async context, and Kotlin/JS has no runBlocking. So it's not suitable for integrating into kotlinx-io or things like that. It also only works in the browser but not Node. Node provides a zlib API. But Kotlin doesn't support expect/actual between browser and Node targets, so one would have to do some tricks to select the implementation at runtime (keeping in mind the module system you've compiled to, as there's many in the JS world). Or just use Pako or (when it's ready) my pure kotlin implementation
s
crypto, compression I try to keep distance from because they are time sinks
Regarding crypto I’m thankful that we already have a great lib here. 😅
t
I actually prefer the async nature of the compression library. But you are right, it is not a full-fledged solution.
s
@Sargun Vohra I am using Pako and I seek to drop it for a pure Kotlin zlib implementation. 😄 I actually requested such a library month ago and by everyone in #C0BJ0GTE2 that invented just another logging lib. 😬 We have no lack of logging libs in the ecosystem, but we are missing some basics like zlib.
s
My version ported the zlib C code directly, so it's pretty messy Kotlin and hard to debug. So I'm considering whether I should reimplement in idiomatic kotlin based on the RFC, or continue driving the bugs to zero with the port. Inflate should be easy to implement in regular kotlin, but deflate is tough so I'd probably end up porting that straight from C regardless
s
I have no idea what’s best, but I’m thankful if someone who can do that makes it, because I can’t.
t
I think in the particular case of compress/decompress (and crypto) native solutions are better, the Kotlin overhead could hit on those areas hard.
s
I tried to understand Adler, but my head exploded. 😆
s
Logging is something people have lots of different preferences on, it's an easy library to make, and a decent project for someone learning Kotlin or even learning programming. I see why people do it 😅 It's kind of like the classic todo list app project.
💯 1
s
Exactly. It’s easy to make, so really a lot of people did. Not exactly useful.
s
Oh kompress has a fully test passing Adler and CRC implementation. That's only a few lines of code and not too ugly to express in kotlin.
🎉 1
s
I think in the particular case of compress/decompress (and crypto) native solutions are better, the Kotlin overhead could hit on those areas hard.
Maybe for some use cases, but I’m sure for my lib it won’t be an issue.
For zlib I mean. Crypto is surely better not re-done in a pet project.
s
Not useful to others sure, but people spend time on what they want to spend time on, sometimes for fun, sometimes for learning, sometimes because they have a very specific requirement that's not covered by other libraries. Nobody is obligated to build useful things, I've definitely built plenty of useless things for all of those reasons, so I like to be supportive of others on that journey 🙂
s
When Sargun is done we can do some benchmarks and see how hard it really hits.
t
I'm actually quite curious about those benchmarks. If the overhead is not a magnitude, I would prefer the pure Kotlin solution as well.
s
@Sargun Vohra Wise words. 🙂 You are of course right with that. Nobody is obligated to do anything. 😄 I’m just thankful if people like you work on areas that have gaps instead of re-doing existing stuff.
s
Yeah, performance is not critical for my use case, and I was curious about the actual overhead. Pako surprised me with how fast it is. If you just care about getting it working now, the combination of cinterop zlib, java.util.zip, and pako works well and covers all KMP targets (or compression streams if you're fine with async and no Node)
(Really, JS and wasm support is not critical for my use case either. But I enjoy the process of supporting everything even working on a library. I do this for fun, not for work
t
I don't use JS libraries in KMP as a matter of principle. :)
💯 1
I do it for fun and work. 🙂 The library that started this whole thread is for both.
s
I have no pressing needs. My lib Ashampoo Kim uses the mentioned techs to cover all targets. I would prefer just dropping this expect/actual stuff and the Pako dependency for a small clean pure Kotlin zlib implementation. So it would be great if your lib brings just that and doesn’t introduce a Pako dependency again.
I don't use JS libraries in KMP as a matter of principle. :)
100% I do in one single case and I want to get rid of that.
s
I'm at the point where I've ironed out the easy bugs and I need to step through with a debugger on zlib and kompress side by side to catch where they diverge in behavior. So it'll be tedious to get to 100% lol
Well, zlib or pako. Pako might be a bit easier to compare to. I'm confident my bug lies somewhere in the "inf fast" routine
s
I can imagine that. Feel free to ping me once you get a pure Kotlin zlib that doesn’t do any expect/actual.
Pako is easier in the sense that it’s just one file. But you have to understand JavaScript.
I can only do Java & Kotlin and I’m not exactly a math expert. 😅
Sure, I could learn JavaScript, but I don’t want to. 😬
It’s cool that you guys are C and JavaScript experts. That’s surely a great help when porting things. 🙂
t
Or we are just old. 😉
I wrote production code in about 20 languages... but honestly, since I've started using KMP (about 6 years ago or so) I haven't touched anything else.
🙂 1
s
I’m 39. For 17+ years I only did Java, because I hate JS. 😬 For the last 4 years I only did Kotlin, because Java is now legacy to me. If I see Java code I feel the urge to convert it to Kotlin. 😄
When I started developing with 13 it was PHP for the first 5 years, but I was confused back then. Don’t ask me. I learned that I never ever will work with dynamic typing again. So no JavaScript and no Dart for me.
Sometimes I wish to be a bit more polyglot, but I’m really in for developer joy. If I see people complaining about JavaScript or C#, that’s enough for me to stay away. Developing should be fun. Kotlin is a lot of fun.
t
I agree, Kotlin is very well designed and it is fun to use.
Also, this explains why you haven't met the browser troubles. I would say I'm jealous but that's not really true, I actually like working on layout algorithms and table renderers. 🙂 I don't know how the Canvas based Compose renderer for WASM behaves when I have a table with about 20000 rows and 20 columns. It will use lazySomething I guess but still, that's a lot of stuff to render and scroll. Scrolling being the big problem.
I've seen an example project, maybe "Paper" was the name and it was lagging on my top-end iMac with only a few components on the screen.
(And resizing dynamically, oh boy, I spent two weeks making my UI trees resizable as IntelliJ does, there are so many details in there...)
s
I'm very much a polyglot. I really enjoy TypeScript's type system more than anything else, and the TS/JS frontend frameworks these days are engineering marvels. For mobile apps, Kotlin's Compose Multiplatform is a joy to use, and KMP allows me to get my feet wet with Apple native stuff without touching XCode+Swift. I recently tried out Go (building a GBFS scraper) and the simplicity and batteries-included tooling is a breath of fresh air. AI tools are also quite good at go, especially because they can browse library documentation from the command line and so hallucinate fewer things. I do mainly Python at my job, and I used to enjoy Python but for large, complex codebases it's rough.
👍 1
t
I am actually extremely proud that Adaptive have an IntelliJ-like workspace implementation with tools and multiple tabs and you can resize everything properly.
🙂 1
👍 1
👍🏾 1
s
When I was a trainee, I had the option to pursue a career in web development instead of Java desktop development. However, at the time, ensuring consistent appearance and behavior across all browsers was a real headache. If that's what you mean by "browser troubles," then yes — I'm familiar with them. JavaScript never really appealed to me either. In the Java desktop world, you simply bundle the JRE with your application, and everything just works. Only now with Compose for Web I see me bringing to web products. JetBrains handles the issues, I just write Kotlin code. 😄
t
Sounds good, only JetBrains does not handle the really hard issues.. or I guess it depends on the kind of application you develop, there are areas where it is perfectly fine.
s
Regarding the big tables: Just like with the Desktop or Android app you use a LazyGrid or LazyRow. It behaves the same. Compose for Web is just your Desktop app running in the Browser as WebAssembly
t
In my experience the first few basic widgets are easy, when you hit forms and tables, the troubles begin.
Well, tables with sort, filter, resize columns, reorder columns, multi-level, etc and performance is not that simple imho.
s
Yeah, on the fringes they do not. Like as much as I dislike using Flutter, they have much better support for interop between Flutter and platform UI than CMP does right now (and that's hard to solve with a library outside of the CMP framework itself)
s
My most complex web app is https://mapsnotincluded.github.io/oni-seed-browser/ right now. I will try to run Ashampoo Photo Organizer with compose for Web, too.
s
Well, tables with sort, filter, resize columns, reorder columns, multi-level, etc and performance is not that simple imho.
this sort of data table UI library would be a solid library addition to the CMP ecosystem (and Jetpack Compose) ecosystem
t
I don't use Compose, the whole point of this post was that I don't use it and I still do everything KMP without dependencies. 😇
s
Ah, you mean the DOM-based Compose for Web? yeah I think it's less likely somebody will make that sort of UI library there
t
I had this kind of functionality before for Kotlin/JS (non-reactive) and now I'm about to add it to my library (which is reactive, but not Compose).
Nope, no Compose at all. :)
I wrote my own reactivity (with compiler plugin support) based on Svelte.
s
Ahh, I see.
s
DOM-based Compose for Web was rebranded to Compose HTML. Compose for Web now means running WebAssembly Canvas with real Compose
👍 1
t
Yes, i think the WASM Compose is better if you think inside Compose. I think outside of it.
I mean better than HTML Compose.
s
Compose HTML is limited. You can use the standard HTML tags. But I believe there are not a lot of components.
Compose for Web can be supported by just adding the wasmJS target to any Compose component library. Most did that by now.
t
I feel (might not be true) that Compose is not the right direction. For example, my system (which is nowhere close to Compose in maturity) already offers more components, more complex components, hydration, no-code components etc.
For some reason I don't see Compose development feels extremely slow.
s
DOM-based Compose for Web was rebranded to Compose HTML.
Compose for Web now means running WebAssembly Canvas with real Compose
the naming in this ecosystem is ... rough "Compose" -> compiler plugin for reactivity "Compose" -> Skia-based implementation of Jetpack Compose on Multiplatform "Compose" -> alternative compositions, like Compose HTML, Redwood, my MapLibre Compose library
💯 1
s
As you correctly said Compose is rather basic building blocks. Things like validation and forms are not available, you need third party libs for that.
It’s not a problem to build a form library with validation. People can do that. But they opt to build logging frameworks instead 😄
t
That is the problem. When I was programming react, the basic building blocks were there. But those are actually the easy parts. Forms are extremely complex when you go above the "please type delivery address" type forms.
Compose does have some structural problems that make proper validation hard to implement well.
s
Yes, I have to do the forms myself in my apps and also doing the validation. It is low level work if you like to compare that to something like JGoodies Forms for Java Swing. That said Swing didn’t offer that, too - JGoodies did.
t
You are right tho that it can be written... only no-one writes them. Unfortunately. I do, but I don't like Compose, so I write them in my own system. This is how a complex for should look like (well, this is an example only)
s
Compose does have some structural problems that make proper validation hard to implement well.
I'd be curious to learn about these problems. What about Compose makes it hard to build a library like those in the JS world (for example, https://github.com/TanStack/form)?
t
And the actual code.. compare this to Compose and you'll see why I don't like it.
Copy code
@Adaptive
fun formBasicExample(): AdaptiveFragment {
    val template = FormData()
    val form = observe { adatFormBackend(template) }

    localContext(form) {
        flowBox {
            maxWidth .. gap { 20.dp }

            column {
                gap { 16.dp } .. width { 250.dp }

                textEditor { template.string }

                booleanEditor { template.boolean }

                intEditor { <http://template.int|template.int> }
                longEditor { template.long }
                doubleEditor { template.double }

                dateEditor { template.date }
                timeEditor { template.time }
                dateTimeEditor { template.dateTime }
                timeRangeEditor { template.timeRange }

                colorEditor { template.color }

                enumEditorDropdown(ExampleEnum.entries) { template.enum }
                enumEditorList(ExampleEnum.entries) { template.enum }

                badgeEditor { template.badges }

                button("Save") .. onClick {
                    if (form.isInvalid()) {
                        warningNotification("Form is not valid!")
                        return@onClick
                    }
                    infoNotification("Saved!")
                }
            }
            column {
                width { 250.dp } .. gap { 16.dp }

                text("Valid: ${form.isValid()}")
                codeFence(form.inputValue.encodeToPrettyJson()) .. maxWidth
            }
        }
    }

    return fragment()
}

@Adat
class FormData(
    val boolean: Boolean = true,
    val int: Int = 34,
    val long: Long = 45,
    val double: Double = 89.10,
    val string: String = "ab",
    val date : LocalDate = localDate(),
    val time : LocalTime = localTime(),
    val dateTime : LocalDateTime = localDateTime(),
    val timeRange : TimeRange = TimeRange(),
    val color : Color = color(0xff0000),
    val enum: ExampleEnum = ExampleEnum.V1,
    val enumOrNull: ExampleEnum? = null,
    val badges : Set<String> = setOf("badge1", "badge2")
) {
    override fun descriptor() {
        properties {
            int maximum 100 minimum 10
            string pattern "[a-z]+"
        }
    }
}
s
It’s good that you provide an alternative. If people use my apps like the ONI seed browser they feel that it’s not a real website, but an app running in their browser. That starts with things like text selection or not being able to download images on right-click. It’s just a big HTML5 canvas and that makes a difference.
t
TanStack form is unreadable at first sight to be honest. This is why I stopped using react. It is so hard to read. The code I posted is the only code I want to write, nothing else. No onChange handlers, no onBlue= etc.. The code above is a fully working form, validating from the metadata provided by the data model.
It’s just a big HTML5 canvas and that makes a difference.
It has benefits and also drawbacks. There is a lot of experience behind browser mechanisms and APIs. I think it depends on the type of application. Yours is clearly graphics oriented, there it makes perfect sense. In a data input intensive application it might be a bad choice.
👍 1
s
Is there a link to a demo website using Adaptive? I’m curious how it feels like. Is it like HTML and JavaScript? Or is it server-side rendered like PHP?
t
http://adaptive.fun the documentation opens automatically, if you click in middle and then Double-Shift, and type form, you will see the Form demo, click on it.
It's not optimized for mobile yet and I guess windows shows additional scroll bars sometimes (I've solved that once but it came back again.)
s
I am on iPad 😄
t
Might work, it is HTML and JavaScript.
s
👍 1
t
Under each example there is a code icon which shows the code. That code is what actually runs in the browser.
s
So adaptive generates HTML and JavaScript like Google GWT did from Java code?
t
No, it uses Kotlin/JS. Kotlin/JS compiles the whole application into one big javascript file. There are about 50 lines of HTML code in the whole library.
The actual code is like 94% in commonMain I think.
s
Ah, so it’s Kotlin/JS that manipulates the DOM?
t
There is a compiler plugin (part of the library) which is similar to the Compose compiler plugin and it compiles the code you see into a reactive, stateful instance tree.
s
That’s really quite advanced. 👍
t
Yes, it is Kotlin/JS or JVM for Android or ... whatever for iOS. The system works on these three platforms.
It is a big system, it has it's own serialization and RPC, you call server side services with simple suspend functions.
(I've tried to use kotlinx.serialization but it's too closed unfortunatelly.)
Actually, you can call client side functions from the server as well if there is an active connection.
I don't really advertise the library because it is quite preliminary. I do use it for production projects, but I know where the problems are.
s
Does the UI on Android and iOS render to platform UI components? Or is it custom UI there?
1
Really cool to see an alternative reactivity framework in the KMP world
s
Choice is always good.
t
It uses some platform UI components, but the layouts are deterministic and same on all platfroms. Nothing keeps you from adding something platform-dependent tho, it is fully open and actually very easy to extend.
But in general I use my own components on mobile as well. Whatever you see on the web site could be run on mobile as it is.
(Could be, because I'm lagging with the canvas wrapper and the input field wrapper for mobile.)
The idea is that I write my mobile app in a web browser and then just use it everywhere without modification. The web app will need a mobile friendly view anyway, why not use it as a native mobile app as well?
1