Skip to content

Commit 8f04066

Browse files
committed
Merge branch 'dependent-on-compose-web-material-snapshot'
2 parents 7470ab6 + d8c7ed2 commit 8f04066

File tree

62 files changed

+1075
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1075
-133
lines changed

README.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,53 @@
11
# Compose Multiplatform Material wrappers
22

3-
Some simple Compose Multiplatform Material Design component wrappers for desktop, Android, and web (mainly based on [KMDC](https://github.com/mpetuska/kmdc))
3+
[![Maven Central](https://img.shields.io/maven-central/v/com.huanshankeji/compose-multiplatform-material)](https://search.maven.org/artifact/com.huanshankeji/compose-multiplatform-material)
44

5-
We try to make the styles of the composable components follow those of the desktop and Android ones in `com.huanshankeji.compose.material`, meanwhile being compatible with the Web APIs. However, only a subset of the composable arguments is supported due to the API differences and limitations of the web composables this project depends on.
5+
Some simple Compose Multiplatform wrappers of common components, layouts, and Material Design components for desktop,
6+
Android, and web (mainly based on [KMDC](https://github.com/mpetuska/kmdc))
67

7-
Customizing styles (using `Modifier`s for desktop and Android, and `attrs: AttrBuilderContext<*>?` for web) is not supported yet.
8+
We try to make the function types of the composable components follow those of the desktop and Android ones
9+
in `androidx.compose.foundation` and `androidx.compose.material`, meanwhile being compatible with the Web APIs. However,
10+
only subsets of the composables and composable arguments are supported due to the API differences, limitations of the
11+
web composables this project depends on, and our limited effort.
812

913
Visual consistency across different platforms is not guaranteed.
1014

11-
There is no documentation for this project yet. Check out the demo project on how to use the components.
15+
This project is prototype and there is no documentation yet. Check out [the demo project](demo) on how to use the components.
1216

13-
## Supported components
17+
<!--
18+
There is no plan to support Apple platforms until there is official support from [Compose Multiplatform](https://github.com/JetBrains/compose-jb). Check out <https://github.com/cl3m/multiplatform-compose> for some experiments and prototypes on supporting iOS with Compose Multiplatform.
19+
-->
20+
21+
## Supported features
22+
23+
### Components
24+
25+
#### Common (Foundation) components
26+
27+
- `BasicText`
28+
- `RawText`
29+
30+
##### Layouts
31+
32+
- `Box`
33+
- `Column` (via flexbox on web)
34+
- `Row` (via flexbox on web)
35+
36+
#### Material components
1437

1538
- `Button`
39+
- `Card`
40+
- `Icon`
41+
- `IconButton`
42+
- `ScrollableList`/`LazyColumn` (visually inconsistent for now)
43+
- `Text`/`MaterialText`
1644
- `TopAppBarScaffold`
45+
46+
### styles
47+
48+
- `height`
49+
- `margin`
50+
- `width`
51+
- `backgroundColor`
52+
- `border`
53+
- `outerBorder`

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repositories {
1010

1111
dependencies {
1212
implementation(kotlin("gradle-plugin", "1.7.20"))
13-
implementation("org.jetbrains.compose:compose-gradle-plugin:1.2.1")
13+
implementation("org.jetbrains.compose:compose-gradle-plugin:1.2.2")
1414
implementation("com.huanshankeji.team:gradle-plugins:0.3.2") {
1515
exclude("org.jetbrains.kotlin")
1616
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
object DependencyVersions {
2+
val huanshankejiComposeWeb = "0.2.0"
3+
}

buildSrc/src/main/kotlin/common-conventions.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
}
55

66
repositories {
7+
mavenLocal()
78
mavenCentral()
89
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
910
google()

compose-multiplatform-common/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ kotlin {
77
named("commonMain") {
88
dependencies {
99
implementation(compose.runtime)
10+
//compileOnly(compose.foundation) // for KDoc element links only
1011
}
1112
}
1213
named("jvmMain") {
@@ -17,6 +18,8 @@ kotlin {
1718
named("jsMain") {
1819
dependencies {
1920
implementation(compose.web.core)
21+
22+
api("com.huanshankeji:compose-web-common:${DependencyVersions.huanshankejiComposeWeb}")
2023
}
2124
}
2225
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package com.huanshankeji.compose
22

33
import androidx.compose.runtime.Composable
4+
import com.huanshankeji.compose.ui.Element
5+
import com.huanshankeji.compose.ui.ModifierOrAttrs
6+
7+
expect abstract class BasicTextElement : Element
48

59
@Composable
6-
expect fun BasicText(text: String)
10+
expect fun BasicText(text: String, modifierOrAttrs: ModifierOrAttrs<BasicTextElement> = null)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.huanshankeji.compose
2+
3+
import androidx.compose.runtime.Composable
4+
5+
/** A raw text composable which doesn't add any element on web. */
6+
@Composable
7+
expect fun RawText(text: String)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.huanshankeji.compose.layout
2+
3+
import androidx.compose.runtime.Composable
4+
import com.huanshankeji.compose.ui.Element
5+
import com.huanshankeji.compose.ui.ModifierOrAttrs
6+
7+
expect abstract class ColumnElement : Element
8+
expect interface ColumnScope
9+
10+
@Composable
11+
expect fun Column(modifierOrAttrs: ModifierOrAttrs<ColumnElement> = null, content: @Composable ColumnScope.() -> Unit)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.huanshankeji.compose.layout
2+
3+
import androidx.compose.runtime.Composable
4+
import com.huanshankeji.compose.ui.Element
5+
import com.huanshankeji.compose.ui.ModifierOrAttrs
6+
7+
expect abstract class RowElement : Element
8+
expect interface RowScope
9+
10+
@Composable
11+
expect fun Row(modifierOrAttrs: ModifierOrAttrs<RowElement> = null, content: @Composable RowScope.() -> Unit)

0 commit comments

Comments
 (0)