-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added wasmJs target for library & implemented browser sample * Upgrade Kotlin to version 2.0.21 * Tiny updates --------- Co-authored-by: Albert Chang <[email protected]>
- Loading branch information
1 parent
70e7179
commit 598f8c1
Showing
12 changed files
with
2,992 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,6 @@ buildscript { | |
} | ||
} | ||
|
||
task<Delete>("clean") { | ||
tasks.withType<Delete> { | ||
delete(rootProject.layout.buildDirectory) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
sample/shared/src/wasmJsMain/kotlin/com/mxalbert/zoomable/sample/AsyncZoomableImage.wasm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.mxalbert.zoomable.sample | ||
|
||
import io.ktor.client.HttpClient | ||
import io.ktor.client.engine.js.Js | ||
|
||
internal actual val httpClient = HttpClient(Js) |
16 changes: 16 additions & 0 deletions
16
sample/shared/src/wasmJsMain/kotlin/com/mxalbert/zoomable/sample/ZoomableApp.wasm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.mxalbert.zoomable.sample | ||
|
||
import androidx.compose.material.SnackbarHostState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
|
||
@Composable | ||
fun ZoomableApp() { | ||
val snackbarHostState = remember { SnackbarHostState() } | ||
|
||
ZoomableApp(snackbarHostState = snackbarHostState) { | ||
ZoomableImagePage(snackbarHostState = snackbarHostState) { | ||
AsyncZoomableImage(url = Images[0]) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl | ||
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig | ||
|
||
plugins { | ||
kotlin("multiplatform") | ||
alias(libs.plugins.jetbrains.compose) | ||
alias(libs.plugins.kotlin.plugin.compose) | ||
} | ||
|
||
kotlin { | ||
@OptIn(ExperimentalWasmDsl::class) | ||
wasmJs { | ||
browser { | ||
val rootDirPath = project.rootDir.path | ||
commonWebpackConfig { | ||
outputFileName = "zoomable.js" | ||
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply { | ||
port = 8080 | ||
static = (static ?: mutableListOf()).apply { | ||
add(rootDirPath) | ||
} | ||
} | ||
} | ||
} | ||
binaries.executable() | ||
} | ||
sourceSets { | ||
wasmJsMain.dependencies { | ||
implementation(project(":sample:shared")) | ||
implementation(libs.compose.foundation.jetbrains) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.github.trueddd | ||
|
||
import androidx.compose.ui.ExperimentalComposeUiApi | ||
import androidx.compose.ui.window.CanvasBasedWindow | ||
import com.mxalbert.zoomable.sample.ZoomableApp | ||
|
||
@OptIn(ExperimentalComposeUiApi::class) | ||
fun main() { | ||
CanvasBasedWindow( | ||
title = "Zoomable", | ||
canvasElementId = "canvas", | ||
) { | ||
ZoomableApp() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta content="width=device-width, initial-scale=1" name="viewport"> | ||
<title>Zoomable</title> | ||
<script type="application/javascript" src="zoomable.js"></script> | ||
</head> | ||
<body> | ||
<canvas id="canvas"></canvas> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters