Daniele B
09/18/2020, 6:41 PMExecution failed for task ':shared:jsPackageJson'.
> NPM Dependencies already resolved and installed
at org.jetbrains.kotlin.gradle.targets.js.npm.KotlinNpmResolutionManager.requireConfiguringState$kotlin_gradle_plugin(KotlinNpmResolutionManager.kt:122)
at org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask.getCompilationResolver(KotlinPackageJsonTask.kt:26)
at org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask.getPackageJson(KotlinPackageJsonTask.kt:50)
any idea?Daniele B
09/19/2020, 11:35 AMPATH_VALUE
value inside route() in Kotlin/React ?
browserRouter {
switch {
route("/country/*") {
getCountry(PATH_VALUE.split("/")[2])
...
}
...
}
}
Big Chungus
09/20/2020, 3:29 PMDaniele B
09/20/2020, 11:45 PMbuild
command, which I guess it’s already doing DCE (Dead Code Elimination).Josh Feinberg
09/21/2020, 1:48 AMDaniele B
09/21/2020, 1:42 PMwidth = 50.percent
this doesn’t seem to be recognized
what is the way to set a percentage value in Kotlin / CSS ?Daniele B
09/21/2020, 6:04 PMDaniele B
09/21/2020, 11:48 PMMyElementsList
and MyElement
MyElementsList(content = {
MyElement(label = "a", value = "1")
MyElement(label = "b", value = "2")
MYElement(label = "c", value = "3")
})
what should be the definition of MyElementsList’s content
parameter to be able to pass a block of components ?
currently this is what I wrote, but it doesn’t seem to work:
fun RBuilder.ElementsList(content: (ReactElement) -> Unit) = child(ElementsList) {
attrs {
this.content = content
}
}
external interface ElementsListProps : RProps {
var content : (ReactElement) -> Unit
}
val ElementsList = functionalComponent<ElementsListProps> { props ->
div {
props.content
}
}
it compiles, but it just shows <div></div>
with no content
the MyElement
components are shown correctly if they are not enclosed in the MyElementsList
component, so it looks like the issue is in the MyElementsList
componentadk
09/22/2020, 9:09 AMgenerateExternals = true
from gradle doesn't give any opportunity to tweak the generated files, yet they all seem to need tweaking?Daniele B
09/22/2020, 12:50 PMrouteLink
, I want to change the url when I am clicking on a td
element, what code should I use?Daniele B
09/22/2020, 3:02 PMtr {
attrs {
onMouseOver = { HOW DO I CHANGE BG COLOR? }
}
}
I guess I need to use the onMouseOver
attribute. But how do I change the background color programmatically?Daniele B
09/23/2020, 2:51 PMOndrej Zavodny
09/23/2020, 8:15 PMpeekandpoke
09/24/2020, 6:59 AMgradle -t assemble
for continuous building.
But as soon as I change some code I get this error:
Failed to compile.
(webpack)-dev-server/client?<http://localhost:8888>
Module build failed (from /PROJECT/build/js/node_modules/source-map-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, open '/PROJECT/build/js/node_modules/webpack-dev-server/client/index.js'
I checked what is going on and indeed there is no webpack-dev-server present in build/js/node_modules folder.
I should also mention that I have multiple JS modules in my project. So maybe they all write to the build/js/node_modules directory and interfere with each other, as they have different configurations. But even when only building a single module the problem stays the same.
I then tried to be sneaky and added this to one of the build.gradle files
testImplementation npm("webpack-dev-server", "3.11.0")
Which in fact solves the issue with reload in so far, that the error does no longer show up and that in build/js/node_modules there truely is the webpack-dev-server dependency.
But now the problem is: The page is reloading on code changes -> Good -> BUT: the changes are not picked up -> BAD
Does anyone have an idea what to look for or some workaround?
Thank you for reading 🙂Christian Jensen
09/24/2020, 8:25 AMadk
09/24/2020, 3:35 PMDaniele B
09/24/2020, 6:41 PMKotlin/React
for a few days and I found it interesting.
I was very amazed by the chance of creating HTML/CSS using Kotlin DSL rather than plain HTML/CSS. It is very powerful, as the the HTML and CSS are created automatically in an optimized way, without having to organize CSS classes yourself.
However I was disappointed by the performance
and by the js filesize
.
I am working on a multiplatform project, with a shared ViewModel, which on Android is plugged into a JetpackCompose UI and on iOS into SwiftUI. I am looking for the best way to use my declarativeUI-ready ViewModel on web too, via StateFlow
.
My basic requirements for a web framework are these 5:
• collect a StateFlow emitted by the KMP shared ViewModel
• create HTML components using Kotlin DSL
• use a decent variety of already made web components
• react to ViewModel state changes quickly
• compile to a small JS filesize
I just came across two interesting web frameworks written in Kotlin:
`Fritz2`: https://www.fritz2.dev/
`KVision`: https://kvision.gitbook.io/
I would be very interesting to hear the experiences of people here, and how they compare them in terms of performance and filesize to React/Kotlin:Devil Ster 1
09/25/2020, 7:52 AMDaniele B
09/25/2020, 10:41 AMDaniele B
09/25/2020, 10:56 PMturansky
09/27/2020, 10:41 AM@JsExport
for legacy mode in Kotlin 1.4?Christian Dräger
09/27/2020, 3:53 PMimplementation(npm(name = "react-toastify", version = "6.0.8", generateExternals = true))
to my build gradle. and it actually does but i am wondering how to use the generated externals.
The libraries documentation says <ToastContainer …props /> has to be added to the apps JSX code. in my generated externals i found a useToastContainer
function in the generated externals (see screenshot). no extension function to RBuilder or something that looks like i can just use it straight away
questions:
is there a naming convention that dukat uses to place the public functions of a dependency like prefixing the file that includes the api of a library with ‘use….’ ? if not, where are the public functions of library placed that has a dukat generated kotlin wrapper?
do i need to write an extension function to RBuilder like `fun RBuilder.toastContainer() = useToastContainer()`to use it with kotlin react wrapper?
useToastContainer
wants ToastContainerProps
which is an interface regarding to the generated externals i couldn’t find an implementation of that interface. I would assume an implementation with default values like the original lib has. so im wondering how to use this or do i have to implement it myself (would be extremely unhandy since it has a lot of props) ?
what experiences do you have using libraries that extend react in kotlinjs?altavir
09/29/2020, 8:58 AMgaetan
09/29/2020, 4:01 PMadk
09/29/2020, 4:03 PMcomponent1()
methods used in destructuring - which I can't see being used in typescript or javascript. Are we likely to see cleaner typescript definitions from multiplatform kotlin libs as this shapes up towards GA status? Or am I perhaps just missing something?ankushg
09/29/2020, 4:57 PM@JsExport
annotations, or do we still need to manually pass in a list through keep
?spierce7
09/30/2020, 4:18 AMBearDev
09/30/2020, 11:00 AMbinaries.executable()
set in the build.gradle, but I cannot find the generated production .js file(s) in the build directory.Alexander Weickmann
09/30/2020, 3:29 PMadk
10/01/2020, 2:11 PMadk
10/01/2020, 2:11 PMCasey Brooks
10/01/2020, 2:14 PMawait
in JS/TS is just syntactic sugar over a Promise, so you should be ableto return a Promise<T>
(https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-promise/) from Kotlin to be able to await
it from TS. You likely can’t await
a suspend
Kotlin functionadk
10/01/2020, 2:15 PMRobert Jaros
10/01/2020, 2:23 PMadk
10/01/2020, 2:24 PMCasey Brooks
10/01/2020, 4:29 PMdynamic
type instead of Promise
?adk
10/02/2020, 2:48 PM@JsExport
and @Serializable
on the same class.ankushg
10/02/2020, 11:41 PMadk
10/07/2020, 10:53 AMankushg
10/07/2020, 5:23 PMadk
10/08/2020, 7:59 AM@JsExport
with @Serializable
.