Ansh Tyagi
11/15/2021, 5:57 PMoverride fun RBuilder.render() {
div {
div(){}
div(){}
div(){}
div(){}
div(){}
div(){}
div(){}
div(){}
div(){}
div(){}
}
}
is there any way around like List.generate()
something that sort of in kotlin or can we use map
function?martmists
11/15/2021, 7:25 PMAnsh Tyagi
11/16/2021, 9:15 AMjsMain/kotlin
and used kotlinext.require
but it the build throws an error of module not found in jsBrowserProductionWebpack
i used the template for fullstack web app from idea i think it enables cssSupport by default as specified in the docs. Is it that i have to specify the file path under gradle as well or do i have to change the location of the css?ankushg
11/16/2021, 8:32 PM"-Xir-per-module"
flag, we get separate files (which is great!)
For local project dependencies, we get filenames like ${rootProject.name}-{project.name}.js
.
From a Maven artifact like org.jetbrains.kotlinx:kotlinx-serialization-core
, we get kotlinx-serialization-kotlinx-serialization-core.js
I’m assuming the kotlinx-serialization
prefix is because that's also the rootProject.name
in the kotlinx.serialization
repo (and this lines up with the other artifacts). But I can't figure out how to get that prefix programatically. Instead, I'm stuck hardcoding values for all our external dependencies.
Is there a way to get that prefix for a Kotlin/JS maven artifact within Gradle?
If there isn't a way to get that prefix programatically, using rootProject.name
(instead of group
) makes it really hard to interact with those files in an automated fashion…Kevin Luo
11/16/2021, 9:00 PMreact-dom
library. I can't set the ref
attribute for my react components, since it no longer allows passing lambdas to attrs.ref
.
var myRef : Element? = null
styledDiv {
attrs.ref {
myRef = it as? Element
}
}
So the above code no longer works. Is there a workaround for this?Jeff Lockhart
11/17/2021, 1:16 AMUncaught TypeError: $this$child._get_attrs__0_k$()._set_baz__qlpr75_k$ is not a function
.
fun main() {
render(document.getElementById("root")) {
child(app)
}
}
val app = fc<Props> {
child(foo) {
attrs.baz = "test"
}
}
interface Bar : Props {
var baz: String
}
val foo = fc<Bar> { props ->
+props.baz
}
It's erroring on the line attrs.baz = "test"
. Am I doing something wrong? I'm using version 17.0.2-pre.265-kotlin-1.5.31
of the Kotlin React wrappers.Carson Holzheimer
11/17/2021, 2:18 PMbuild/externals
folder is basically empty.
This is in a multiplatform project
val jsMain by getting {
dependencies {
implementation(npm("fabric", "4.5.0"))
implementation(npm("@types/fabric", "4.5.0", generateExternals = true))
}
}
Carter
11/17/2021, 6:18 PMCould not determine the dependencies of task ':kotlinNodeJsSetup'.
> Could not resolve all files for configuration ':detachedConfiguration2'.
> Could not find node-14.17.0-darwin-arm64.tar.gz (org.nodejs:node:14.17.0).
Searched in the following locations:
<https://nodejs.org/dist/v14.17.0/node-v14.17.0-darwin-arm64.tar.gz>
In the meantime, has anyone else run into this or is there a workaround?Mihai Voicescu
11/17/2021, 6:45 PMankushg
11/17/2021, 8:23 PMNpmTask
and NpxTask
• seems to be better-documented than the almost-secret tasks bundled with Kotlin/JS
At the same time, the Kotlin/JS compiler also downloads node/yarn as needed too.
Does anyone have a setup where they have them configured to play well together?
Maybe just
• turning off downloads for one of the two plugins
• setting them both to run yarn from the same directory
• making sure that the setup task for the plugin with the disabled download dependsOn the setup task for the other plugin ?ankushg
11/18/2021, 7:30 AMexternal interface
definition) that gets exported as a JS/TS Map
with specific key/value types?Ansh Tyagi
11/18/2021, 9:35 AMAyfri
11/18/2021, 6:47 PMankushg
11/18/2021, 11:29 PM@JsExport
a typealias
? Have some complicated types that I'd love to be able to provide more readable names to in my .d.ts fileAyfri
11/20/2021, 10:56 PMhfhbd
11/21/2021, 10:56 AMenum
or an interface
with inline functions and unsafeCast
to reduce binary size?altavir
11/23/2021, 2:49 PM> Task :visionforge-solid:compileTestDevelopmentExecutableKotlinJs FAILED
e: org.jetbrains.kotlin.backend.common.serialization.linkerissues.IrDisallowedErrorNode: Class found but error nodes are not allowed.
at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeErrorType(IrDeclarationDeserializer.kt:840)
Have anyone seen something like this?MrPowerGamerBR
11/23/2021, 3:20 PM@JsModule("./star.svg")
@JsNonModule
external val star: dynamic
console.log(star)
= <http://localhost:8080/images/8879ae8fb00946dae2fd.svg>
, instead of printing the svg content. I want the svg to be inlined (because animations) so that's why I can't just reference the svg in a <img> tagfkrauthan
11/24/2021, 5:22 AMWebpackManifestPlugin
and HtmlWebpackPlugin
but are wondering where the webpack file is gonna be generated in and how I can point to files in build/processedResources/js/main
?
Also is there any way in my webpack.config.d
files to have a condition depending on if its a dev build vs a prod build? I couldn't find any obvious flag I could useandylamax
11/24/2021, 5:14 PM> Task compileKotlinJs FAILED
e: Could not find "kotlin" in [/home/andylamax/.local/share/kotlin/daemon]
e: java.lang.IllegalStateException: Could not find "kotlin" in [/home/andylamax/.local/share/kotlin/daemon]
at org.jetbrains.kotlin.cli.js.K2JsIrCompilerKt$messageCollectorLogger$1.fatal(K2JsIrCompiler.kt:539)
at org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:175)
It should be also be known that task compileKotlinJvm executes successfully. What might the problem be?hfhbd
11/24/2021, 6:03 PMbinaries.executable()
or binaries.library()
in your gradle config?andylamax
11/25/2021, 1:58 AM> Task :compileDevelopmentExecutableKotlinJs FAILED
e: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.collections.CollectionsKt___CollectionsKt.joinToString, parameter $this$joinToString
at kotlin.collections.CollectionsKt___CollectionsKt.joinToString(_Collections.kt)
at kotlin.collections.CollectionsKt___CollectionsKt.joinToString$default(_Collections.kt:3360)
at org.jetbrains.kotlin.ir.util.RenderIrElementVisitor.visitClass(RenderIrElement.kt:467)
Has anyone seen this?? compileKotlinJs does execute successfully. Help??Slackbot
11/25/2021, 1:46 PMMrPowerGamerBR
11/26/2021, 2:34 AMprintln("Test: ${"297153970613387264".toLong()}")
prints...
Test: 297153970613387260
Only happens with the IR compiler, not with the Legacy compiler, I actually thought this was a kotlinx.serialization bug until I tried debugging it further to find out that it is actually Kotlin that is having the issue! 😭
Tested in Kotlin 1.5.31, haven't tested in Kotlin 1.6.0 yet because Jetpack Compose Web doesn't support Kotlin 1.6.0... yet!Pavel Matusevich
11/28/2021, 12:19 AMfun getSelected(): Set<RowData>
fun getActive(): Set<RowData>
and then trying to access this set using for (selected in selection.getSelected()){..}
in browser it throws Uncaught TypeError: it.getSelected().iterator is not a function
.
By looking at Kotlin/JS documentation I see that Kotlin collections does not map to any specific class in JS ("Kotlin collections (List
, Set
, Map
, and so on) are not mapped to any specific JavaScript type."). So, my question: is it okay to publish mapping like that or is there a better way to do that mapping? (like custom Set class, or anything else...)smallshen
11/28/2021, 8:36 PMhfhbd
11/29/2021, 8:04 AMPavel Matusevich
11/29/2021, 9:22 PMthis
when executing callback
) from JS Set? My current implementation is
@JsName("Set")
external class JsSet<T> {
...
fun <A> forEach(callback: (value: T, key: T, set: JsSet<T>, thisArg: A) -> Unit, thisArg: A)
...
}
However, when calling this function
forEach({ key, value, set, thisArg ->
console.log("1", key, "2", value, "3", set, thisArg)
}, "thisArgValue")
thisArg is undefined
, when it should be "thisArgValue"
Thanks.Franco
11/30/2021, 9:36 PMCould not determine the dependencies of task ':kotlinNodeJsSetup'.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
> Could not resolve all files for configuration ':detachedConfiguration3'.
> Could not resolve org.nodejs:node:14.17.0.
Required by:
project :
> Could not resolve org.nodejs:node:14.17.0.
> Could not get resource '<https://kotlin.bintray.com/kotlinx/org/nodejs/node/14.17.0/node-14.17.0.pom>'.
> Could not GET '<https://kotlin.bintray.com/kotlinx/org/nodejs/node/14.17.0/node-14.17.0.pom>'. Received status code 502 from server: Bad Gateway
Anyone know what's happening?Nicodemus Ojwee
12/01/2021, 12:19 PMNicodemus Ojwee
12/01/2021, 12:19 PMandylamax
12/01/2021, 12:24 PMRobert Jaros
12/01/2021, 12:31 PM