webHtmlApp is a new web build using Compose HTML instead of Compose Multiplatform UI's Skia/canvas renderer - real <select>/<input>/<button> elements, an anchored popup menu for reordering/removing currencies (Compose HTML has no built-in DropdownMenu), and locale-independent English strings (moko-resources' Compose integration pulls in compose.foundation/ui, which this module exists to avoid). Realizing the bundle-size win needed splitting sharedUi out of shared: the Compose Multiplatform Gradle plugin bundles Skiko's several-MB web runtime into any js/wasmJs target whose resolved dependencies contain org.jetbrains.compose.ui:ui anywhere, and shared previously declared it directly for the other (Skia-based) web app's UI. shared is now pure business/data logic with no Compose dependency; sharedUi holds App()/ PriceScreen() for androidApp, desktopApp, and webApp to render. PriceViewModel's ViewModel supertype and CurrencyConverter's BigDecimal params moved from implementation() to api() in shared, since they're part of its public surface that webHtmlApp now touches directly. Also drops the @js-joda/timezone dependency from both web builds: the app only ever calls TimeZone.currentSystemDefault(), which resolves to a synthetic zone backed by the native Date offset on Kotlin/JS and never touches the tz database - confirmed empirically on both js and wasmJs targets. Cuts webApp's js bundle by ~950 KB and webHtmlApp's by ~800 KB. currencyFlagEmoji() gained an explicit supportsFlagEmoji parameter (defaulting to the existing expect/actual, false on web) so webHtmlApp can opt in - Compose HTML renders real DOM text, so flag emoji work fine there even though they don't on Compose Multiplatform's canvas. website/serve-local.sh now builds and serves webHtmlApp instead of webApp's wasmJs build, so it no longer mirrors what's actually deployed to production; docs updated to reflect the new module layout and that divergence, and the Pages workflow's path trigger now includes sharedUi/** so UI changes there still redeploy the site. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
62 lines
1.9 KiB
Kotlin
62 lines
1.9 KiB
Kotlin
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
plugins {
|
|
alias(libs.plugins.kotlinMultiplatform)
|
|
alias(libs.plugins.androidMultiplatformLibrary)
|
|
alias(libs.plugins.composeMultiplatform)
|
|
alias(libs.plugins.composeCompiler)
|
|
}
|
|
|
|
// The Skia-based Compose Multiplatform UI (App()/PriceScreen()) that androidApp, desktopApp,
|
|
// and webApp render. Split out of :shared so :shared itself stays free of compose.ui - the
|
|
// Compose Multiplatform Gradle plugin bundles the several-MB Skiko web runtime into *any*
|
|
// js/wasmJs target whose resolved dependency graph contains org.jetbrains.compose.ui:ui
|
|
// anywhere, and webHtmlApp's DOM-only build needs to avoid that.
|
|
kotlin {
|
|
jvm()
|
|
|
|
js {
|
|
browser()
|
|
}
|
|
|
|
@OptIn(ExperimentalWasmDsl::class)
|
|
wasmJs {
|
|
browser()
|
|
}
|
|
|
|
android {
|
|
namespace = "xyz.tyiu.satsprice.sharedui"
|
|
compileSdk = libs.versions.android.compileSdk.get().toInt()
|
|
minSdk = libs.versions.android.minSdk.get().toInt()
|
|
|
|
compilerOptions {
|
|
jvmTarget = JvmTarget.JVM_11
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
androidMain.dependencies {
|
|
implementation(libs.compose.uiToolingPreview)
|
|
implementation(libs.compose.uiTooling)
|
|
}
|
|
commonMain.dependencies {
|
|
api(project(":shared"))
|
|
|
|
implementation(libs.compose.runtime)
|
|
implementation(libs.compose.foundation)
|
|
implementation(libs.compose.material3)
|
|
implementation(libs.compose.materialIconsExtended)
|
|
implementation(libs.compose.ui)
|
|
implementation(libs.compose.uiToolingPreview)
|
|
implementation(libs.moko.resourcesCompose)
|
|
implementation(libs.androidx.lifecycle.viewmodelCompose)
|
|
implementation(libs.androidx.lifecycle.runtimeCompose)
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
androidRuntimeClasspath(libs.compose.uiTooling)
|
|
}
|