Ayfri
08/01/2022, 12:48 PM${Br()}
into a raw string ? For now it just prints the result of the method which is kotlin.Unit
谢朋刚
08/02/2022, 7:14 AMdata class Line(
val lng: Double,
val lat: Double,
)
I create an object of Line and parse this object to javascript, the field's name changed.谢朋刚
08/02/2022, 7:14 AM谢朋刚
08/02/2022, 7:15 AMEduardo Zuza
08/03/2022, 2:08 AMDiv(attrs = { style { id("seAdmRet"); display(DisplayStyle.Block) }; classes("form-group") }) {
Span { Text("Opção AdmRet - 1") }
Select(attrs = { classes("custom-select", "mr-sm-2", "dlg-100") }
) {
// TextInput("ola1","GD")
// Text( "opa")
// Text("olá")
}
}
Ayfri
08/03/2022, 9:56 PMAyfri
08/06/2022, 12:23 AMOliver.O
08/09/2022, 10:16 PMBrowserViewportWindow
for the initial window. It is easy to use, supports resizing, fills the entire browser viewport, sets the window title correctly and does not require a stylesheet. Inspired by code in @Tlaster's PreCompose. If you want to try: Code in 🧵Ayfri
08/10/2022, 3:17 PMjeran
08/11/2022, 4:13 PMhfhbd
08/11/2022, 6:26 PMattrs("visibility", "hidden")
. Alternative use if
.Michael Paus
08/12/2022, 7:37 AMСтефан Јовановић
08/12/2022, 11:00 AMandylamax
08/13/2022, 1:59 PMAyfri
08/14/2022, 9:16 PMDiv({
classes(AboutMeStyle.timeline)
window.addEventListener("scroll", {
val footerOffset = document.querySelector(".${AppStyle.footer}")?.asDynamic()?.offsetTop as Double? ?: return@addEventListener
val currentOffset by mutableStateOf(window.scrollY + 100)
if (currentOffset < footerOffset) {
style {
top(currentOffset.px)
}
}
})
})
If I put a console.log
inside the condition it gets called so it should be fine, but no style is set, what am I doing wrong ?Ayfri
08/15/2022, 7:11 PMobject FooterStyle : StyleSheet() {
val buttonColor by variable<CSSColorValue>()
val button by style {
backgroundColor(buttonColor.value())
...
}
}
// somewhere in a @Composable
A(href = "/my-route", {
target(ATarget.blank)
classes(FooterStyle.button)
style {
FooterStye.buttonColor(Color.gray)
}
}) {
Text("Download")
}
But the variable isn't set in my resulting CSS and there's even no inline style at all 🤔John Aoussou
08/16/2022, 12:39 PMagrosner
08/18/2022, 1:18 AMagrosner
08/18/2022, 12:07 PMOliver.O
08/18/2022, 3:26 PMModule "androidx.compose.foundation:foundation" has a reference to symbol [...] EmptyLazyGridLayoutInfo
. It did work a couple of days ago. Re-downloaded the artifacts to no avail. Could it be that there's something wrong in the JB space repo? More Details in 🧵Casey Brooks
08/19/2022, 4:00 PMcompose.runtime
as a dependency? I’m trying to make a library with a “common Compose” module that’s compose-runtime only, and then additional modules that add on support for Material and JS DOM, but it seems like there’s a problem with compose runtime being used in the common sourceSetagrosner
08/19/2022, 5:30 PMval scrollListener = Channel<Double>()
2. Consume it in your scrollable composable:
val scrollState = rememberLazyListState()
LaunchedEffect(Unit) {
scrollListener.consumeAsFlow()
.collect {
scrollState.scrollBy(it.toFloat())
}
}
3. attach it to a window event:
fun main() {
window.addEventListener("wheel", { event ->
if (event is WheelEvent) {
event.stopPropagation()
GlobalScope.launch {
scrollListener.trySend(event.deltaY)
}
}
})
}
then you have scrolling supportCasey Brooks
08/19/2022, 10:03 PMzt
08/25/2022, 5:50 PMtheapache64
08/28/2022, 12:16 PMDavid Herman
09/02/2022, 1:57 AMagrosner
09/02/2022, 11:03 AMdeviant
09/02/2022, 11:15 AMModifier.onPreviewKeyEvent
and Modifier.onKeyEvent
don't work in browsers. desktop and android are okSebastien Leclerc Lavallee
09/08/2022, 3:14 PMtimothy.paetz
09/10/2022, 11:35 PMimplementation("app.softwork:routing-compose:0.2.8")
Thanks!timothy.paetz
09/10/2022, 11:35 PMimplementation("app.softwork:routing-compose:0.2.8")
Thanks!import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
}
repositories {
mavenCentral()
maven("<https://maven.pkg.jetbrains.space/public/p/compose/dev>")
google()
}
kotlin {
js(IR) {
browser()
binaries.executable()
}
sourceSets {
val jsMain by getting {
kotlin.srcDir("src/main/kotlin")
resources.srcDir("src/main/resources")
dependencies {
implementation(compose.web.core)
implementation(compose.runtime)
}
}
}
}
// a temporary workaround for a bug in jsRun invocation - see <https://youtrack.jetbrains.com/issue/KT-48273>
afterEvaluate {
rootProject.extensions.configure<NodeJsRootExtension> {
nodeVersion = "16.0.0"
versions.webpackDevServer.version = "4.0.0"
versions.webpackCli.version = "4.10.0"
}
}
Thomas
09/10/2022, 11:38 PMdependencies
block next to the other implementation lines, if I understand your question correctly.timothy.paetz
09/10/2022, 11:52 PM\src\main\kotlin\main.kt: (2, 12): Unresolved reference: jetbrains
\src\main\kotlin\main.kt: (3, 12): Unresolved reference: jetbrains
\src\main\kotlin\main.kt: (4, 12): Unresolved reference: jetbrains
\src\main\kotlin\main.kt: (5, 12): Unresolved reference: jetbrains
\src\main\kotlin\main.kt: (8, 5): Unresolved reference: renderComposable
\src\main\kotlin\main.kt: (9, 9): @Composable invocations can only happen from the context of a @Composable function
\src\main\kotlin\main.kt: (21, 5): Unresolved reference: Div
\src\main\kotlin\main.kt: (22, 9): Unresolved reference: Text
\src\main\kotlin\main.kt: (24, 5): Unresolved reference: Button
\src\main\kotlin\main.kt: (26, 13): Unresolved reference: onClick
\src\main\kotlin\main.kt: (26, 23): Cannot infer a type for this parameter. Please specify it explicitly.
\src\main\kotlin\main.kt: (31, 9): Unresolved reference: Text
val commonMain by getting {
dependencies {
implementation("app.softwork:routing-compose:0.2.8")
}
}
Thomas
09/11/2022, 12:12 AMtimothy.paetz
09/11/2022, 12:28 AMimport androidx.compose.runtime.*
import org.jetbrains.compose.web.dom.Button
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.dom.Text
import org.jetbrains.compose.web.renderComposable
fun main() {
renderComposable(rootElementId = "root") {
Body()
// HashRouter(initPath = "/") {
// route("/blogs") {
// Text("Hello World")
// }
// }
}
}
@Composable
fun Body() {
var counter by remember { mutableStateOf(0) }
Div {
Text("Clicked: ${counter}")
}
Button(
attrs = {
onClick { _ ->
counter++
}
}
) {
Text("Click")
}
}
hfhbd
09/11/2022, 8:10 AMkotlin("multiplatform") version "1.7.10"
id("org.jetbrains.compose") version "1.2.0-alpha01-dev770"
implementation("app.softwork:routing-compose:0.2.8")
And if you only want to have a web project, you could also use kotlin("js") version "1.7.10"
, this makes the config a little bit easier imho.timothy.paetz
09/11/2022, 4:01 PM