This repository was archived by the owner on Jul 21, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 11 files changed +119
-66
lines changed
commonMain/kotlin/com/adamglin/composeshadow
desktopMain/kotlin/com/adamglin/composeshadow/utils
skikoMain/kotlin/com/adamglin/composeshadow/utils Expand file tree Collapse file tree 11 files changed +119
-66
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,6 @@ fabric.properties
9494# Generated files
9595bin /
9696gen /
97- out /
9897
9998# Gradle files
10099.gradle
143142
144143# IntelliJ IDEA
145144* .iml
146- * .iws
147145/out /
148146
149147# User-specific configurations
@@ -190,87 +188,45 @@ hs_err_pid*
190188
191189# # Plugin-specific files:
192190
193- # mpeltonen/sbt-idea plugin
194- .idea_modules /
195-
196- # JIRA plugin
197- atlassian-ide-plugin.xml
198-
199191# Mongo Explorer plugin
200192.idea /mongoSettings.xml
201193
202- # Crashlytics plugin (for Android Studio and IntelliJ)
203- com_crashlytics_export_strings.xml
204- crashlytics.properties
205- crashlytics-build.properties
206- fabric.properties
207-
208194# ## Example user template template
209195# ## Example user template
210196
211197# IntelliJ project files
212198.idea
213- * .iml
214199out
215200gen
216201# ## Kotlin template
217- # Compiled class file
218- * .class
219-
220- # Log file
221- * .log
222202
223203# BlueJ files
224204* .ctxt
225205
226- # Mobile Tools for Java (J2ME)
227- .mtj.tmp /
228-
229- # Package Files #
230- * .war
231206* .nar
232- * .ear
233207* .zip
234208* .tar.gz
235209* .rar
236210
237- # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
238- hs_err_pid *
239- replay_pid *
240211
241- # ## Android template
242- # Gradle files
243- .gradle /
244- build /
245-
246- # Local configuration file (sdk path, etc)
247- local.properties
248-
249- # Log/OS Files
250- * .log
212+ replay_pid *
251213
252214# Android Studio generated files and folders
253- captures /
254215.externalNativeBuild /
255216.cxx /
256- * .apk
257217output.json
258218
259219# IntelliJ
260- * .iml
261220.idea /
262221misc.xml
263222deploymentTargetDropDown.xml
264223render.experimental.xml
265224
266- # Keystore files
267- * .jks
268- * .keystore
269-
270225# Google Services (e.g. APIs or Firebase)
271226google-services.json
272227
273228# Android Profiling
274229* .hprof
275230
276- .kotlin
231+ .kotlin
232+ /kotlin-js-store
Original file line number Diff line number Diff line change 1- @file:OptIn(ExperimentalEncodingApi ::class )
1+ @file:OptIn(ExperimentalEncodingApi ::class , ExperimentalWasmDsl :: class )
22
33import com.vanniktech.maven.publish.SonatypeHost
44import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
5+ import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
56import org.jetbrains.kotlin.gradle.dsl.JvmTarget
67import kotlin.io.encoding.ExperimentalEncodingApi
78
@@ -22,7 +23,7 @@ kotlin {
2223 }
2324 }
2425
25- jvm(" desktop " )
26+ jvm()
2627
2728 iosX64()
2829 iosArm64()
@@ -31,12 +32,38 @@ kotlin {
3132 macosX64()
3233 macosArm64()
3334
35+ wasmJs {
36+ browser()
37+ }
38+
3439 sourceSets {
3540 commonMain.dependencies {
3641 implementation(compose.runtime)
3742 implementation(compose.foundation)
3843 implementation(compose.ui)
39- implementation(libs.androidx.annotation)
44+ }
45+ val nonWebMain by creating {
46+ dependsOn(commonMain.get())
47+ dependencies {
48+ implementation(libs.androidx.annotation)
49+ }
50+ }
51+ val skikoMain by creating {
52+ dependsOn(commonMain.get())
53+ }
54+ androidMain.configure {
55+ dependsOn(nonWebMain)
56+ }
57+ jvmMain.configure {
58+ dependsOn(skikoMain)
59+ dependsOn(nonWebMain)
60+ }
61+ nativeMain.configure {
62+ dependsOn(skikoMain)
63+ dependsOn(nonWebMain)
64+ }
65+ wasmJsMain.configure {
66+ dependsOn(skikoMain)
4067 }
4168 }
4269}
Original file line number Diff line number Diff line change 11package com.adamglin.composeshadow
22
3- import androidx.annotation.RequiresApi
43import androidx.compose.ui.Modifier
54import androidx.compose.ui.draw.shadow
65import androidx.compose.ui.geometry.Size
@@ -34,7 +33,6 @@ import com.adamglin.composeshadow.utils.setMaskFilter
3433 * @param blur The blur radius of the shadow.
3534 * @param spread The spread radius of the shadow.
3635 */
37- @RequiresApi(26 )
3836fun Modifier.dropShadow (
3937 shape : Shape ,
4038 color : Color = Color .Black .copy(0.25f),
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11package com.adamglin.composeshadow.utils
22
3-
43import androidx.compose.ui.graphics.NativePaint
54import org.jetbrains.skia.FilterBlurMode
65import org.jetbrains.skia.MaskFilter
76
8- internal actual fun NativePaint.setMaskFilter (blurRadius : Float ) {
7+ actual fun NativePaint.setMaskFilter (blurRadius : Float ) {
98 this .maskFilter = MaskFilter .makeBlur(FilterBlurMode .NORMAL , blurRadius / 2 , true )
109}
Original file line number Diff line number Diff line change 1+ @file:OptIn(ExperimentalWasmDsl ::class )
2+
13import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
4+ import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
25import org.jetbrains.kotlin.gradle.dsl.JvmTarget
36
47
@@ -16,7 +19,7 @@ kotlin {
1619 jvmTarget.set(JvmTarget .JVM_11 )
1720 }
1821 }
19- jvm(" desktop " )
22+ jvm()
2023 listOf (
2124 iosArm64(),
2225 iosX64(),
@@ -28,8 +31,14 @@ kotlin {
2831 }
2932 }
3033
34+ wasmJs {
35+ moduleName = " composeApp"
36+ browser {
37+ }
38+ binaries.executable()
39+ }
40+
3141 sourceSets {
32- val desktopMain by getting
3342 commonMain.dependencies {
3443 // compose multiplatform
3544 implementation(compose.runtime)
Original file line number Diff line number Diff line change 1+ import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
2+ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
3+
4+ plugins {
5+ alias(libs.plugins.kotlin.multiplatform)
6+ alias(libs.plugins.compose.multiplatform)
7+ alias(libs.plugins.compose.compiler)
8+ }
9+
10+ kotlin {
11+ @OptIn(ExperimentalWasmDsl ::class )
12+ wasmJs {
13+ moduleName = " composeApp"
14+ browser {
15+ val rootDirPath = project.rootDir.path
16+ val projectDirPath = project.projectDir.path
17+ commonWebpackConfig {
18+ outputFileName = " composeApp.js"
19+ devServer = (devServer ? : KotlinWebpackConfig .DevServer ()).apply {
20+ static = (static ? : mutableListOf ()).apply {
21+ // Serve sources to debug inside browser
22+ add(rootDirPath)
23+ add(projectDirPath)
24+ }
25+ }
26+ }
27+ }
28+ binaries.executable()
29+ }
30+ sourceSets {
31+ wasmJsMain.dependencies {
32+ implementation(compose.runtime)
33+ implementation(compose.foundation)
34+ implementation(compose.material)
35+ implementation(compose.ui)
36+ implementation(compose.components.resources)
37+ implementation(compose.components.uiToolingPreview)
38+ implementation(project(" :sample:shared" ))
39+ }
40+ }
41+ }
Original file line number Diff line number Diff line change 1+ package com.demo0913
2+
3+ import SampleApp
4+ import androidx.compose.ui.ExperimentalComposeUiApi
5+ import androidx.compose.ui.window.ComposeViewport
6+ import kotlinx.browser.document
7+
8+ @OptIn(ExperimentalComposeUiApi ::class )
9+ fun main () {
10+ ComposeViewport (document.body!! ) {
11+ SampleApp ()
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > KotlinProject</ title >
7+ < link type ="text/css " rel ="stylesheet " href ="styles.css ">
8+ < script type ="application/javascript " src ="composeApp.js "> </ script >
9+ </ head >
10+ < body >
11+ </ body >
12+ </ html >
Original file line number Diff line number Diff line change 1+ html , body {
2+ width : 100% ;
3+ height : 100% ;
4+ margin : 0 ;
5+ padding : 0 ;
6+ overflow : hidden;
7+ }
You can’t perform that action at this time.
0 commit comments