Skip to content

Commit

Permalink
Merge pull request #47 from huanshankeji/rename-project
Browse files Browse the repository at this point in the history
More on renaming the project to "Compose Multiplatform HTML Unified"
  • Loading branch information
ShreckYe authored Dec 3, 2024
2 parents b81b525 + d2d7711 commit 114b1ce
Show file tree
Hide file tree
Showing 38 changed files with 78 additions and 78 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The Compose HTML / JS DOM source is mainly based on [Kobweb Silk](https://github

## References and limitations

Complete visual consistency across different platforms is not guaranteed. See [the side-by-side demo site](https://huanshankeji.github.io/compose-multiplatform-material/) for the visual effects and their differences.
Complete visual consistency across different platforms is not guaranteed. See [the side-by-side demo site](https://huanshankeji.github.io/compose-multiplatform-html-unified/) for the visual effects and their differences.

This project is still in development and has not reached a stable state. Some APIs are subject to change and there is no detailed documentation yet. Check out [the demo project source](demo) on how to use the components in addition to the sections below.

Expand Down Expand Up @@ -109,8 +109,7 @@ The components in the `ext` packages don't follow the `androidx.compose` APIs ex

#### About parameter names

The parameter names with suffixes such as "JsDom" or "ComposeUi" are platform-specific, and only apply on their respective platform(s), Compose HTML / JS DOM or
`androidx.compose` platforms.
The parameter names with suffixes such as "JsDom" or "ComposeUi" are platform-specific, and only apply on their respective platform(s), Compose HTML / JS DOM or Compose UI platforms.

#### Material Icons

Expand Down Expand Up @@ -179,7 +178,7 @@ kotlin {
commonMain {
dependencies {
// ...
implementation("com.huanshankeji:compose-multiplatform-material3:$version")
implementation("com.huanshankeji:compose-multiplatform-html-unified-material3:$version")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Constants.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const val FOR_COMPOSE_TARGETS_IN_TITLE = "for `androidx.compose` and Compose HTML"
const val FOR_COMPOSE_TARGETS_IN_TITLE = "for Compose UI and Compose HTML"
const val FOR_COMPOSE_TARGETS_IN_DESCRIPTION =
"for `androidx.compose` (Android, desktop (JVM), iOS, and web (Kotlin/Wasm)) and Compose HTML"
"for Compose UI (Android, desktop (JVM), iOS, and web (Kotlin/Wasm)) and Compose HTML"
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/common-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ group = "com.huanshankeji"
version = projectVersion

kotlin {
// for `androidx.compose`
// for Compose UI

jvm() // TODO: `jvm("desktop")`?
jvmToolchain(8)
Expand Down
10 changes: 5 additions & 5 deletions common/api/compose-multiplatform-html-unified-common.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -1017,12 +1017,12 @@ final val com.huanshankeji.compose.foundation.layout/com_huanshankeji_compose_fo
final val com.huanshankeji.compose.foundation/com_huanshankeji_compose_foundation_ScrollState$stableprop // com.huanshankeji.compose.foundation/com_huanshankeji_compose_foundation_ScrollState$stableprop|#static{}com_huanshankeji_compose_foundation_ScrollState$stableprop[0]

// Targets: [js]
final val com.huanshankeji.compose.foundation/imitateAndroidxLayoutHorizontalScrollPlatformModifier // com.huanshankeji.compose.foundation/imitateAndroidxLayoutHorizontalScrollPlatformModifier|{}imitateAndroidxLayoutHorizontalScrollPlatformModifier[0]
final fun <get-imitateAndroidxLayoutHorizontalScrollPlatformModifier>(): com.varabyte.kobweb.compose.ui/Modifier // com.huanshankeji.compose.foundation/imitateAndroidxLayoutHorizontalScrollPlatformModifier.<get-imitateAndroidxLayoutHorizontalScrollPlatformModifier>|<get-imitateAndroidxLayoutHorizontalScrollPlatformModifier>(){}[0]
final val com.huanshankeji.compose.foundation/imitateComposeUiLayoutHorizontalScrollPlatformModifier // com.huanshankeji.compose.foundation/imitateComposeUiLayoutHorizontalScrollPlatformModifier|{}imitateComposeUiLayoutHorizontalScrollPlatformModifier[0]
final fun <get-imitateComposeUiLayoutHorizontalScrollPlatformModifier>(): com.varabyte.kobweb.compose.ui/Modifier // com.huanshankeji.compose.foundation/imitateComposeUiLayoutHorizontalScrollPlatformModifier.<get-imitateComposeUiLayoutHorizontalScrollPlatformModifier>|<get-imitateComposeUiLayoutHorizontalScrollPlatformModifier>(){}[0]

// Targets: [js]
final val com.huanshankeji.compose.foundation/imitateAndroidxLayoutVerticalScrollPlatformModifier // com.huanshankeji.compose.foundation/imitateAndroidxLayoutVerticalScrollPlatformModifier|{}imitateAndroidxLayoutVerticalScrollPlatformModifier[0]
final fun <get-imitateAndroidxLayoutVerticalScrollPlatformModifier>(): com.varabyte.kobweb.compose.ui/Modifier // com.huanshankeji.compose.foundation/imitateAndroidxLayoutVerticalScrollPlatformModifier.<get-imitateAndroidxLayoutVerticalScrollPlatformModifier>|<get-imitateAndroidxLayoutVerticalScrollPlatformModifier>(){}[0]
final val com.huanshankeji.compose.foundation/imitateComposeUiLayoutVerticalScrollPlatformModifier // com.huanshankeji.compose.foundation/imitateComposeUiLayoutVerticalScrollPlatformModifier|{}imitateComposeUiLayoutVerticalScrollPlatformModifier[0]
final fun <get-imitateComposeUiLayoutVerticalScrollPlatformModifier>(): com.varabyte.kobweb.compose.ui/Modifier // com.huanshankeji.compose.foundation/imitateComposeUiLayoutVerticalScrollPlatformModifier.<get-imitateComposeUiLayoutVerticalScrollPlatformModifier>|<get-imitateComposeUiLayoutVerticalScrollPlatformModifier>(){}[0]

// Targets: [js]
final fun (androidx.compose.ui.unit/Dp).com.huanshankeji.compose.ui.unit/toPx(): org.jetbrains.compose.web.css/CSSSizeValue<org.jetbrains.compose.web.css/CSSUnit.px> // com.huanshankeji.compose.ui.unit/toPx|[email protected](){}[0]
Expand Down Expand Up @@ -1064,7 +1064,7 @@ final fun (com.varabyte.kobweb.compose.ui/Modifier).com.huanshankeji.compose.fou
final fun (com.varabyte.kobweb.compose.ui/Modifier).com.huanshankeji.compose.ui/toCommonModifier(): com.huanshankeji.compose.ui/Modifier.Impl // com.huanshankeji.compose.ui/toCommonModifier|[email protected](){}[0]

// Targets: [js]
final fun (com.varabyte.kobweb.compose.ui/Modifier).com.huanshankeji.kobweb.compose.ui.modifiers/imitateAndroidxLayout(): com.varabyte.kobweb.compose.ui/Modifier // com.huanshankeji.kobweb.compose.ui.modifiers/imitateAndroidxLayout|imitateAndroidxLayout@com.varabyte.kobweb.compose.ui.Modifier(){}[0]
final fun (com.varabyte.kobweb.compose.ui/Modifier).com.huanshankeji.kobweb.compose.ui.modifiers/imitateComposeUiLayout(): com.varabyte.kobweb.compose.ui/Modifier // com.huanshankeji.kobweb.compose.ui.modifiers/imitateComposeUiLayout|imitateComposeUiLayout@com.varabyte.kobweb.compose.ui.Modifier(){}[0]

// Targets: [js]
final fun (com.varabyte.kobweb.compose.ui/Modifier).com.huanshankeji.kobweb.compose.ui.modifiers/size(com.varabyte.kobweb.compose.css/Width, com.varabyte.kobweb.compose.css/Height): com.varabyte.kobweb.compose.ui/Modifier // com.huanshankeji.kobweb.compose.ui.modifiers/size|[email protected](com.varabyte.kobweb.compose.css.Width;com.varabyte.kobweb.compose.css.Height){}[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.huanshankeji.compose.ui.Modifier

/*
const val MATCH_POSITION_RELATIVE_PARENT_DEPRECATED_MESSAGE =
"This function's functionality is replaced by `imitateAndroidxLayout`."
"This function's functionality is replaced by `imitateComposeUiLayout`."
*/


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.huanshankeji.compose.foundation.layout.ext.KobwebBox
import com.huanshankeji.compose.ui.Alignment
import com.huanshankeji.compose.ui.Modifier
import com.huanshankeji.compose.ui.PlatformModifier
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateAndroidxLayout
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateComposeUiLayout
import com.varabyte.kobweb.compose.ui.styleModifier

fun PlatformModifier.verticalScroll() =
Expand All @@ -19,8 +19,9 @@ fun PlatformModifier.verticalScroll() =
fun PlatformModifier.horizontalScroll() =
styleModifier { horizontalScroll() }

val imitateAndroidxLayoutVerticalScrollPlatformModifier = PlatformModifier.imitateAndroidxLayout().verticalScroll()
val imitateAndroidxLayoutHorizontalScrollPlatformModifier = PlatformModifier.imitateAndroidxLayout().horizontalScroll()
val imitateComposeUiLayoutVerticalScrollPlatformModifier = PlatformModifier.imitateComposeUiLayout().verticalScroll()
val imitateComposeUiLayoutHorizontalScrollPlatformModifier =
PlatformModifier.imitateComposeUiLayout().horizontalScroll()


@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.huanshankeji.compose.ui.Alignment
import com.huanshankeji.compose.ui.Modifier
import com.huanshankeji.compose.ui.PlatformModifier
import com.huanshankeji.compose.ui.toCommonModifier
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateAndroidxLayout
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateComposeUiLayout
import com.varabyte.kobweb.compose.foundation.layout.LayoutScopeMarker
import com.varabyte.kobweb.compose.foundation.layout.BoxScope as PlatformBoxScope

Expand All @@ -19,14 +19,14 @@ actual fun Box(
content: @Composable BoxScope.() -> Unit
) =
KobwebBox(
PlatformModifier.imitateAndroidxLayout().toCommonModifier().then(modifier),
PlatformModifier.imitateComposeUiLayout().toCommonModifier().then(modifier),
contentAlignment,
content
)

@Composable
actual fun Box(modifier: Modifier) =
KobwebBox(PlatformModifier.imitateAndroidxLayout().then(modifier.platformModifier))
KobwebBox(PlatformModifier.imitateComposeUiLayout().then(modifier.platformModifier))

@LayoutScopeMarker
@Immutable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.compose.runtime.Stable
import com.huanshankeji.compose.ui.Alignment
import com.huanshankeji.compose.ui.Modifier
import com.huanshankeji.compose.ui.PlatformModifier
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateAndroidxLayout
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateComposeUiLayout
import com.varabyte.kobweb.compose.foundation.layout.LayoutScopeMarker

@Composable
Expand All @@ -19,7 +19,7 @@ actual fun Column(
AddKobwebComposeStyleSheet()
com.varabyte.kobweb.compose.foundation.layout.Column(
PlatformModifier
.imitateAndroidxLayout() // "fit-content" is added to make it consistent with the `androidx` one
.imitateComposeUiLayout() // "fit-content" is added to make it consistent with the `androidx` one
.stylesFrom(verticalArrangement)
.then(modifier.platformModifier),
verticalArrangement.platformValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.compose.runtime.Stable
import com.huanshankeji.compose.ui.Alignment
import com.huanshankeji.compose.ui.Modifier
import com.huanshankeji.compose.ui.PlatformModifier
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateAndroidxLayout
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateComposeUiLayout
import com.varabyte.kobweb.compose.foundation.layout.LayoutScopeMarker

@Composable
Expand All @@ -19,7 +19,7 @@ actual fun Row(
AddKobwebComposeStyleSheet()
com.varabyte.kobweb.compose.foundation.layout.Row(
PlatformModifier
.imitateAndroidxLayout()
.imitateComposeUiLayout()
.stylesFrom(horizontalArrangement)
.then(modifier.platformModifier),
horizontalArrangement.platformValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.huanshankeji.compose.foundation.layout.AddKobwebComposeStyleSheet
import com.huanshankeji.compose.foundation.layout.BoxScope
import com.huanshankeji.compose.ui.CommonModifier
import com.huanshankeji.compose.ui.PlatformModifier
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateAndroidxLayout
import com.huanshankeji.kobweb.compose.ui.modifiers.imitateComposeUiLayout
import com.varabyte.kobweb.compose.dom.ElementRefScope
import com.varabyte.kobweb.compose.foundation.layout.Box
import com.varabyte.kobweb.compose.ui.toAttrs
Expand All @@ -19,7 +19,7 @@ import com.varabyte.kobweb.compose.foundation.layout.BoxScope as PlatformBoxScop
import com.varabyte.kobweb.compose.ui.Alignment as PlatformAlignment

/**
* Delegates to [Box] without [com.varabyte.kobweb.compose.ui.Modifier.imitateAndroidxLayout].
* Delegates to [Box] without [com.varabyte.kobweb.compose.ui.Modifier.imitateComposeUiLayout].
*/
@Composable
fun KobwebBox(
Expand All @@ -43,7 +43,7 @@ fun KobwebBox(
}

/**
* Delegates to [Div] without [com.varabyte.kobweb.compose.ui.Modifier.imitateAndroidxLayout].
* Delegates to [Div] without [com.varabyte.kobweb.compose.ui.Modifier.imitateComposeUiLayout].
*/
@Composable
fun DivBox(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.huanshankeji.compose.foundation.lazy

import androidx.compose.runtime.Composable
import com.huanshankeji.compose.foundation.imitateAndroidxLayoutHorizontalScrollPlatformModifier
import com.huanshankeji.compose.foundation.imitateAndroidxLayoutVerticalScrollPlatformModifier
import com.huanshankeji.compose.foundation.imitateComposeUiLayoutHorizontalScrollPlatformModifier
import com.huanshankeji.compose.foundation.imitateComposeUiLayoutVerticalScrollPlatformModifier
import com.huanshankeji.compose.foundation.layout.*
import com.huanshankeji.compose.runtime.DeferredComposableRunner
import com.huanshankeji.compose.ui.Alignment
Expand Down Expand Up @@ -63,7 +63,7 @@ actual fun LazyRow(
content: LazyListScope.() -> Unit
) =
Row(
commonLazyModifier(imitateAndroidxLayoutHorizontalScrollPlatformModifier, contentPadding, modifier),
commonLazyModifier(imitateComposeUiLayoutHorizontalScrollPlatformModifier, contentPadding, modifier),
horizontalArrangement,
verticalAlignment
) {
Expand All @@ -80,7 +80,7 @@ actual fun LazyColumn(
content: LazyListScope.() -> Unit
) =
Column(
commonLazyModifier(imitateAndroidxLayoutVerticalScrollPlatformModifier, contentPadding, modifier),
commonLazyModifier(imitateComposeUiLayoutVerticalScrollPlatformModifier, contentPadding, modifier),
verticalArrangement,
horizontalAlignment
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.jetbrains.compose.web.css.maxWidth
* and make the `overflow-*` CSS property / the `*Scroll` modifier work better on JS DOM.
* See https://developer.android.com/develop/ui/compose/layouts/constraints-modifiers for more details.
*/
fun Modifier.imitateAndroidxLayout() =
fun Modifier.imitateComposeUiLayout() =
styleModifier {
width(Width.FitContent)
height(Height.FitContent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fun Modifier.size(width: Width, height: Height): Modifier =

//TODO consider removing and inlining this
/**
* Consider using [Modifier.imitateAndroidxLayout] instead when adding this for a layout.
* Consider using [Modifier.imitateComposeUiLayout] instead when adding this for a layout.
*/
fun Modifier.sizeFitContent() =
size(Width.FitContent, Height.FitContent)
2 changes: 1 addition & 1 deletion demo/iosApp/Configuration/Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TEAM_ID=
BUNDLE_ID=com.huanshankeji.compose.material.demo
APP_NAME=compose-multiplatform-material-demo
APP_NAME=compose-multiplatform-html-unified-demo
6 changes: 3 additions & 3 deletions demo/iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = "<group>"; };
7555FF7B242A565900829871 /* compose-multiplatform-material-demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = compose-multiplatform-material-demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
7555FF7B242A565900829871 /* compose-multiplatform-html-unified-demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = compose-multiplatform-html-unified-demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -62,7 +62,7 @@
7555FF7C242A565900829871 /* Products */ = {
isa = PBXGroup;
children = (
7555FF7B242A565900829871 /* compose-multiplatform-material-demo.app */,
7555FF7B242A565900829871 /* compose-multiplatform-html-unified-demo.app */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -107,7 +107,7 @@
packageProductDependencies = (
);
productName = iosApp;
productReference = 7555FF7B242A565900829871 /* compose-multiplatform-material-demo.app */;
productReference = 7555FF7B242A565900829871 /* compose-multiplatform-html-unified-demo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand Down
2 changes: 1 addition & 1 deletion demo/side-by-side-site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta charset="UTF-8">
<title>Side by side - Compose Multiplatform Material demo</title>
<title>Side by side - Compose Multiplatform HTML Unified demo</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<style>
body {
Expand Down
2 changes: 1 addition & 1 deletion demo/src/androidMain/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">Compose Multiplatform Material demo</string>
<string name="app_name">Compose Multiplatform HTML Unified demo</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun Material2(/*modifier: Modifier = Modifier*/) {
val snackbarHostState = remember { SnackbarHostState() }
// It seems the modifier can't be set on `TopAppBarScaffold` or a box wrapping it
TopAppBarScaffold({
Text("Compose Multiplatform Material demo")
Text("Compose Multiplatform HTML Unified demo")
}, navigationIcon = {
MaterialIconNavButton({}, icon = Icons.Default.Menu, contentDescription = "menu")
}, actions = {
Expand Down
2 changes: 1 addition & 1 deletion demo/src/jsMain/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>JS DOM - Compose Multiplatform Material demo</title>
<title>JS DOM - Compose Multiplatform HTML Unified demo</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<style>
body {
Expand Down
2 changes: 1 addition & 1 deletion demo/src/wasmJsMain/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wasm JS canvas - Compose Multiplatform Material demo</title>
<title>Wasm JS canvas - Compose Multiplatform HTML Unified demo</title>
<link type="text/css" rel="stylesheet" href="styles.css">
<script src="app.js" type="application/javascript"></script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions material-icons-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ kotlin {
publishing.publications.withType<MavenPublication> {
pomForTeamDefaultOpenSource(
project,
"Compose Multiplatform Material core Icon wrappers",
"Compose Multiplatform Material Design core Icon wrappers for `androidx.compose` and Compose HTML"
"Compose Multiplatform HTML Unified core Icon wrappers",
"Compose Multiplatform HTML Unified Design core Icon wrappers for `androidx.compose` and Compose HTML"
) {
`Shreck Ye`()
}
Expand Down
Loading

0 comments on commit 114b1ce

Please sign in to comment.